p802_15_4nam.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  ATTRIBUTELINK
class  MACLINK
class  Nam802_15_4

Defines

#define at_oper_del   1
#define at_oper_est   2
#define mac_oper_del   1
#define mac_oper_est   2

Functions

int addAttrLink (packet_t pt, char *clr, int s=-2, int d=-2)
int addMacLink (int ad, Mac802_15_4 *m)
int chkAddAttrLink (packet_t pt, char *clr, int s=-2, int d=-2)
int chkAddMacLink (int ad, Mac802_15_4 *m)
ATTRIBUTELINKfindAttrLink (packet_t pt, int s=-2, int d=-2)
Mac802_15_4getMacLink (int ad)
packet_t nam_pktName2Type (const char *name)
int updateAttrLink (int oper, packet_t pt, int s=-2, int d=-2)
int updateMacLink (int oper, int ad)

Variables

int ATTRIBUTE_SN


Define Documentation

#define at_oper_del   1
 

Definition at line 84 of file p802_15_4nam.h.

Referenced by updateAttrLink().

#define at_oper_est   2
 

Definition at line 85 of file p802_15_4nam.h.

Referenced by chkAddAttrLink(), and chkAddMacLink().

#define mac_oper_del   1
 

Definition at line 56 of file p802_15_4nam.h.

Referenced by updateMacLink().

#define mac_oper_est   2
 

Definition at line 57 of file p802_15_4nam.h.


Function Documentation

int addAttrLink packet_t  pt,
char *  clr,
int  s = -2,
int  d = -2
 

Definition at line 185 of file p802_15_4nam.cc.

References attrLink1, attrLink2, ATTRIBUTELINK::last, and ATTRIBUTELINK::next.

Referenced by chkAddAttrLink().

00186 {
00187     ATTRIBUTELINK *tmp;
00188 
00189     if (attrLink2 == NULL)      //not exist yet
00190     {
00191         attrLink2 = new ATTRIBUTELINK(pt,clr,s,d);
00192         if (attrLink2 == NULL) return 1;
00193         attrLink1 = attrLink2;
00194     }
00195     else
00196     {
00197         tmp=new ATTRIBUTELINK(pt,clr,s,d);
00198         if (tmp == NULL) return 1;
00199         tmp->last = attrLink2;
00200         attrLink2->next = tmp;
00201         attrLink2 = tmp;
00202     }
00203     return 0;
00204 }

int addMacLink int  ad,
Mac802_15_4 m
 

Definition at line 60 of file p802_15_4nam.cc.

References MACLINK::last, macLink1, macLink2, and MACLINK::next.

Referenced by chkAddMacLink().

00061 {
00062     MACLINK *tmp;
00063 
00064     if (macLink2 == NULL)       //not exist yet
00065     {
00066         macLink2 = new MACLINK(ad,m);
00067         if (macLink2 == NULL) return 1;
00068         macLink1 = macLink2;
00069     }
00070     else
00071     {
00072         tmp=new MACLINK(ad,m);
00073         if (tmp == NULL) return 1;
00074         tmp->last = macLink2;
00075         macLink2->next = tmp;
00076         macLink2 = tmp;
00077     }
00078     return 0;
00079 }

int chkAddAttrLink packet_t  pt,
char *  clr,
int  s = -2,
int  d = -2
 

Definition at line 248 of file p802_15_4nam.cc.

References addAttrLink(), at_oper_est, and updateAttrLink().

00249 {
00250         int i;
00251 
00252         i = updateAttrLink(at_oper_est,pt,s,d);
00253         if (i == 0) return 1;
00254         i = addAttrLink(pt,clr,s,d);
00255         if (i == 0) return 0;
00256         else return 2;
00257 }

Here is the call graph for this function:

int chkAddMacLink int  ad,
Mac802_15_4 m
 

Definition at line 138 of file p802_15_4nam.cc.

References addMacLink(), at_oper_est, and updateMacLink().

Referenced by Mac802_15_4::Mac802_15_4().

00139 {
00140         int i;
00141 
00142         i = updateMacLink(at_oper_est,ad);
00143         if (i == 0) return 1;
00144         i = addMacLink(ad,m);
00145         if (i == 0) return 0;
00146         else return 2;
00147 }

Here is the call graph for this function:

ATTRIBUTELINK* findAttrLink packet_t  pt,
int  s = -2,
int  d = -2
 

Definition at line 259 of file p802_15_4nam.cc.

References attrLink1, ATTRIBUTELINK::dst, ATTRIBUTELINK::next, ATTRIBUTELINK::ptype, and ATTRIBUTELINK::src.

00260 {
00261     ATTRIBUTELINK *tmp;
00262 
00263     tmp = attrLink1;
00264     while(tmp != NULL)
00265     {
00266         if((tmp->ptype == pt)&&(tmp->src == s)&&(tmp->dst == d))
00267             return tmp;
00268         tmp = tmp->next;
00269     }
00270 
00271     return NULL;
00272 }

Mac802_15_4* getMacLink int  ad  ) 
 

Definition at line 123 of file p802_15_4nam.cc.

References MACLINK::addr, MACLINK::mac, macLink1, and MACLINK::next.

00124 {
00125     MACLINK *tmp;
00126 
00127     tmp = macLink1;
00128     while(tmp != NULL)
00129     {
00130         if(tmp->addr == ad)
00131             return tmp->mac;
00132         tmp = tmp->next;
00133     }
00134 
00135     return NULL;
00136 }

packet_t nam_pktName2Type const char *  name  ) 
 

Definition at line 155 of file p802_15_4nam.cc.

References p_info::name(), packet_info, PT_ACK, PT_AODV, PT_ARP, PT_CBR, PT_DSR, PT_FTP, PT_GAF, PT_GRAFT, PT_GRAFTACK, PT_HTTP, PT_IMEP, PT_LDP, PT_MAC, PT_MFTP, PT_NTYPE, PT_PING, PT_PRUNE, PT_RTCP, PT_RTP, PT_SRM, PT_TCP, PT_TELNET, PT_TORA, and PT_UDP.

00156 {
00157     //not all types included
00158 
00159     return (strcmp(packet_info.name(PT_TCP),name) == 0)?PT_TCP:
00160                (strcmp(packet_info.name(PT_UDP),name) == 0)?PT_UDP: 
00161                (strcmp(packet_info.name(PT_CBR),name) == 0)?PT_CBR: 
00162                (strcmp(packet_info.name(PT_ACK),name) == 0)?PT_ACK: 
00163                (strcmp(packet_info.name(PT_PRUNE),name) == 0)?PT_PRUNE: 
00164                (strcmp(packet_info.name(PT_GRAFT),name) == 0)?PT_GRAFT: 
00165                (strcmp(packet_info.name(PT_GRAFTACK),name) == 0)?PT_GRAFTACK: 
00166                (strcmp(packet_info.name(PT_RTCP),name) == 0)?PT_RTCP: 
00167                (strcmp(packet_info.name(PT_RTP),name) == 0)?PT_RTP: 
00168                (strcmp(packet_info.name(PT_SRM),name) == 0)?PT_SRM: 
00169                (strcmp(packet_info.name(PT_TELNET),name) == 0)?PT_TELNET: 
00170                (strcmp(packet_info.name(PT_FTP),name) == 0)?PT_FTP: 
00171                (strcmp(packet_info.name(PT_HTTP),name) == 0)?PT_HTTP: 
00172                (strcmp(packet_info.name(PT_MFTP),name) == 0)?PT_MFTP: 
00173                (strcmp(packet_info.name(PT_ARP),name) == 0)?PT_ARP: 
00174                (strcmp(packet_info.name(PT_MAC),name) == 0)?PT_MAC: 
00175                (strcmp(packet_info.name(PT_TORA),name) == 0)?PT_TORA: 
00176                (strcmp(packet_info.name(PT_DSR),name) == 0)?PT_DSR: 
00177                (strcmp(packet_info.name(PT_AODV),name) == 0)?PT_AODV: 
00178                (strcmp(packet_info.name(PT_IMEP),name) == 0)?PT_IMEP: 
00179                (strcmp(packet_info.name(PT_PING),name) == 0)?PT_PING: 
00180                (strcmp(packet_info.name(PT_LDP),name) == 0)?PT_LDP: 
00181                (strcmp(packet_info.name(PT_GAF),name) == 0)?PT_GAF: 
00182                (strcmp(packet_info.name(PT_PGM),name) == 0)?PT_PGM:PT_NTYPE;
00183 }

Here is the call graph for this function:

int updateAttrLink int  oper,
packet_t  pt,
int  s = -2,
int  d = -2
 

Definition at line 206 of file p802_15_4nam.cc.

References at_oper_del, attrLink1, attrLink2, ATTRIBUTELINK::dst, ATTRIBUTELINK::last, ATTRIBUTELINK::next, ATTRIBUTELINK::ptype, and ATTRIBUTELINK::src.

Referenced by chkAddAttrLink().

00207 {
00208     ATTRIBUTELINK *tmp;
00209     int rt;
00210 
00211     rt = 1;
00212 
00213     tmp = attrLink1;
00214     while(tmp != NULL)
00215     {
00216         if ((tmp->ptype == pt)&&(tmp->src == s)&&(tmp->dst == d))
00217         {
00218             if (oper == at_oper_del)    //delete an element
00219             {
00220                 if(tmp->last != NULL)
00221                 {
00222                     tmp->last->next = tmp->next;
00223                     if(tmp->next != NULL)
00224                         tmp->next->last = tmp->last;
00225                     else
00226                         attrLink2 = tmp->last;
00227                 }
00228                 else if (tmp->next != NULL)
00229                 {
00230                     attrLink1 = tmp->next;
00231                     tmp->next->last = NULL;
00232                 }
00233                 else
00234                 {
00235                     attrLink1 = NULL;
00236                     attrLink2 = NULL;
00237                 }
00238                 delete tmp;
00239             }
00240             rt = 0;
00241             break;
00242         }
00243         tmp = tmp->next;
00244     }
00245     return rt;
00246 }

int updateMacLink int  oper,
int  ad
 

Definition at line 81 of file p802_15_4nam.cc.

References MACLINK::addr, MACLINK::last, mac_oper_del, macLink1, macLink2, and MACLINK::next.

Referenced by chkAddMacLink().

00082 {
00083     MACLINK *tmp;
00084     int rt;
00085 
00086     rt = 1;
00087 
00088     tmp = macLink1;
00089     while(tmp != NULL)
00090     {
00091         if (tmp->addr == ad)
00092         {
00093             if (oper == mac_oper_del)   //delete an element
00094             {
00095                 if(tmp->last != NULL)
00096                 {
00097                     tmp->last->next = tmp->next;
00098                     if(tmp->next != NULL)
00099                         tmp->next->last = tmp->last;
00100                     else
00101                         macLink2 = tmp->last;
00102                 }
00103                 else if (tmp->next != NULL)
00104                 {
00105                     macLink1 = tmp->next;
00106                     tmp->next->last = NULL;
00107                 }
00108                 else
00109                 {
00110                     macLink1 = NULL;
00111                     macLink2 = NULL;
00112                 }
00113                 delete tmp;
00114             }
00115             rt = 0;
00116             break;
00117         }
00118         tmp = tmp->next;
00119     }
00120     return rt;
00121 }


Variable Documentation

int ATTRIBUTE_SN
 

Definition at line 153 of file p802_15_4nam.cc.

Referenced by ATTRIBUTELINK::ATTRIBUTELINK().


Generated on Tue Mar 6 16:56:42 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6