summaryrefslogtreecommitdiff
path: root/cesar/cp2/conn/src/link.c
diff options
context:
space:
mode:
authorboure2008-06-02 15:02:24 +0000
committerboure2008-06-02 15:02:24 +0000
commitf76d76ba6192d2bcf2bc2330088ca053ee1e985d (patch)
tree462b56b81b4941a3cdc02e6dc4d968a99783f3dd /cesar/cp2/conn/src/link.c
parentc789fd61660fb94d7c4e458bb8b0d9dca93c6539 (diff)
managing conn list working & tested
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2191 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp2/conn/src/link.c')
-rw-r--r--cesar/cp2/conn/src/link.c79
1 files changed, 63 insertions, 16 deletions
diff --git a/cesar/cp2/conn/src/link.c b/cesar/cp2/conn/src/link.c
index 1c9292637c..b8be55f399 100644
--- a/cesar/cp2/conn/src/link.c
+++ b/cesar/cp2/conn/src/link.c
@@ -28,32 +28,18 @@
* fill the elements concerning the link
*/
cp_link_t*
-cp_link_init (cp_link_ble_interval_t *table_ble, u16 nb_ble)
+cp_link_init (void)
{
cp_link_t *link;
- blk_t *tmp_blk, *last_blk;
-
- int i;
link = blk_alloc();
link->cinfo = blk_alloc();
-
- link->ble = blk_alloc_desc_range(10, &last_blk);
+ link->ble = NULL;
blk_print_memory();
-
- tmp_blk = link->ble;
-
- for(i=0;i<nb_ble;i++)
- {
- (cp_link_ble_interval_t*)tmp_blk->data = &table_ble[i];
- tmp_blk = tmp_blk->next;
- }
return link;
}
-
-
/**
* del a connection regarding to its CID.
* \param ctx conn context.
@@ -63,4 +49,65 @@ cp_link_init (cp_link_ble_interval_t *table_ble, u16 nb_ble)
void
cp_link_uninit (cp_link_t *link)
{
+
+ blk_release(link->cinfo);
+
+ blk_print_memory();
+
+ release_ble (link);
+
+ blk_print_memory();
+}
+
+/**
+ * BLE memory allocation
+ * \param first first BLE of a link
+ * \param new new element to add to the heap
+ *
+ * link the BLE
+ */
+void
+push_ble(cp_link_t *link, u8 ble, u16 et)
+{
+
+ cp_link_ble_interval_t *new;
+ cp_link_ble_interval_t *tmp;
+
+ dbg_assert(link);
+
+ new = blk_alloc();
+ new->ble = ble;
+ new->et = et;
+ new->next = NULL;
+
+ tmp = link->ble;
+
+ if (!tmp)
+ link->ble = new;
+ else
+ {
+ while(tmp->next)
+ tmp = tmp->next;
+
+ tmp->next = new;
+ }
+}
+
+void
+release_ble(cp_link_t *link)
+{
+ cp_link_ble_interval_t *ble;
+ cp_link_ble_interval_t *tmp_ble;
+
+ dbg_assert(link);
+
+ ble = link->ble;
+
+ while(ble)
+ {
+ tmp_ble = ble->next;
+
+ blk_release(ble);
+ ble = tmp_ble;
+ }
}