1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
//dans le fichier .h
typedef struct H2
{
NODE_ADDR previoussource;
struct H2 *nexth2;
} NTH2;
typedef struct H1
{
NODE_ADDR source;
struct H1 *nexth1;
NTH2 *nexth2;
} MAC_ASYN_NT_Node;
typedef struct
{
MAC_ASYN_NT_Node *head;
} MAC_ASYN_NT;
ypedef struct glomo_mac_mac_async_str
{
GlomoMac* myGlomoMac;
MAC_ASYN_NT nbrTable;
}GlomoMac_async;
//dans le fichier.c
static
BOOL MAC_ASYN_CheckNbrExist(NODE_ADDR source, NODE_ADDR previoussource, MAC_ASYN_NT* nbrTable)
{/*traitement*/}
static
void MAC_ASYN_InsertNbrTable(NODE_ADDR source, NODE_ADDR previoussource, MAC_ASYN_NT* nbrTable)
{/*traitements*/}
static
void mac_asyncReTransmit_table_voisinage(GlomoNode *node,GlomoMac_async* M802,Message* msg){/*traitements*/}
void mac_asyncReceivePacketFromRadio(GlomoNode* node, GlomoMac_async* M802, Message* msg)
{ mac_asyncShortControlFrame* hdr = (mac_asyncShortControlFrame*)msg->packet;
if (hdr->destAddr == ANY_DEST)
{ switch (hdr->frameType) {
//quand le noeud reçoit un paquet de construction de la table de voisinage
case mac_async_table:
printf("je suis le noeud %d qui a recu le paquet du noeud %d \n",node->nodeAddr,hdr->sourceAddr);
if( MAC_ASYN_CheckNbrExist(hdr->sourceAddr,hdr->previous, &(M802->nbrTable) ) == FALSE )
{
printf("le paquet que je viens de recevoir n'existe pas, je vais l'inserer\n");
MAC_ASYN_InsertNbrTable(hdr->sourceAddr,hdr->previous,&(M802->nbrTable));
mac_asyncReTransmit_table_voisinage(node,M802,msg);
}
break;
//suites des cases
} |
Partager