p802_15_4fail.cc File Reference

#include "p802_15_4fail.h"

Include dependency graph for p802_15_4fail.cc:

Go to the source code of this file.

Functions

int addLFailLink (int s, int d)
int addNFailLink (int a)
int chkAddLFailLink (int s, int d)
int chkAddNFailLink (int a)
int updateLFailLink (int oper, int s, int d)
int updateNFailLink (int oper, int a)

Variables

LFAILLINKlfailLink1 = NULL
LFAILLINKlfailLink2 = NULL
NFAILLINKnfailLink1 = NULL
NFAILLINKnfailLink2 = NULL


Function Documentation

int addLFailLink int  s,
int  d
 

Definition at line 60 of file p802_15_4fail.cc.

References LFAILLINK::last, lfailLink1, and lfailLink2.

Referenced by chkAddLFailLink().

00061 {
00062     LFAILLINK *tmp;
00063     if(lfailLink2 == NULL)      //not exist yet
00064     {
00065         lfailLink2 = new LFAILLINK(s,d);
00066         if (lfailLink2 == NULL) return 1;
00067         lfailLink1 = lfailLink2;
00068     }
00069     else
00070     {
00071         tmp=new LFAILLINK(s,d);
00072         if (tmp == NULL) return 1;
00073         tmp->last = lfailLink2;
00074         (lfailLink2)->next = tmp;
00075         lfailLink2 = tmp;
00076     }
00077     return 0;
00078 }

int addNFailLink int  a  ) 
 

Definition at line 133 of file p802_15_4fail.cc.

References NFAILLINK::last, nfailLink1, and nfailLink2.

Referenced by chkAddNFailLink().

00134 {
00135     NFAILLINK *tmp;
00136     if(nfailLink2 == NULL)      //not exist yet
00137     {
00138         nfailLink2 = new NFAILLINK(a);
00139         if (nfailLink2 == NULL) return 1;
00140         nfailLink1 = nfailLink2;
00141     }
00142     else
00143     {
00144         tmp=new NFAILLINK(a);
00145         if (tmp == NULL) return 1;
00146         tmp->last = nfailLink2;
00147         (nfailLink2)->next = tmp;
00148         nfailLink2 = tmp;
00149     }
00150     return 0;
00151 }

int chkAddLFailLink int  s,
int  d
 

Definition at line 122 of file p802_15_4fail.cc.

References addLFailLink(), fl_oper_est, and updateLFailLink().

Referenced by Mac802_15_4Class::method().

00123 {
00124         int i;
00125 
00126         i = updateLFailLink(fl_oper_est,s,d);
00127         if (i == 0) return 1;
00128         i = addLFailLink(s,d);
00129         if (i == 0) return 0;
00130         else return 2;
00131 }

Here is the call graph for this function:

int chkAddNFailLink int  a  ) 
 

Definition at line 195 of file p802_15_4fail.cc.

References addNFailLink(), fl_oper_est, and updateNFailLink().

Referenced by Mac802_15_4::command().

00196 {
00197         int i;
00198 
00199         i = updateNFailLink(fl_oper_est,a);
00200         if (i == 0) return 1;
00201         i = addNFailLink(a);
00202         if (i == 0) return 0;
00203         else return 2;
00204 }

Here is the call graph for this function:

int updateLFailLink int  oper,
int  s,
int  d
 

Definition at line 80 of file p802_15_4fail.cc.

References LFAILLINK::dst, fl_oper_del, LFAILLINK::last, lfailLink1, lfailLink2, LFAILLINK::next, and LFAILLINK::src.

Referenced by chkAddLFailLink(), Mac802_15_4Class::method(), Phy802_15_4::recv(), and Mac802_15_4::sendDown().

00081 {
00082     LFAILLINK *tmp;
00083     int rt;
00084 
00085     rt = 1;
00086 
00087     tmp = lfailLink1;
00088     while(tmp != NULL)
00089     {
00090         if ((tmp->src == s)&&(tmp->dst == d))
00091         {
00092             if (oper == fl_oper_del)    //delete an element
00093             {
00094                 if(tmp->last != NULL)
00095                 {
00096                     tmp->last->next = tmp->next;
00097                     if(tmp->next != NULL)
00098                         tmp->next->last = tmp->last;
00099                     else
00100                         lfailLink2 = tmp->last;
00101                 }
00102                 else if (tmp->next != NULL)
00103                 {
00104                     lfailLink1 = tmp->next;
00105                     tmp->next->last = NULL;
00106                 }
00107                 else
00108                 {
00109                     lfailLink1 = NULL;
00110                     lfailLink2 = NULL;
00111                 }
00112                 delete tmp;
00113             }
00114             rt = 0;
00115             break;
00116         }
00117         tmp = tmp->next;
00118     }
00119     return rt;
00120 }

int updateNFailLink int  oper,
int  a
 

Definition at line 153 of file p802_15_4fail.cc.

References NFAILLINK::addr, fl_oper_del, NFAILLINK::last, NFAILLINK::next, nfailLink1, and nfailLink2.

Referenced by Mac802_15_4::beaconTxHandler(), chkAddNFailLink(), Mac802_15_4::command(), Phy802_15_4::recv(), and Mac802_15_4::sendDown().

00154 {
00155     NFAILLINK *tmp;
00156     int rt;
00157 
00158     rt = 1;
00159 
00160     tmp = nfailLink1;
00161     while(tmp != NULL)
00162     {
00163         if (tmp->addr == a)
00164         {
00165             if (oper == fl_oper_del)    //delete an element
00166             {
00167                 if(tmp->last != NULL)
00168                 {
00169                     tmp->last->next = tmp->next;
00170                     if(tmp->next != NULL)
00171                         tmp->next->last = tmp->last;
00172                     else
00173                         nfailLink2 = tmp->last;
00174                 }
00175                 else if (tmp->next != NULL)
00176                 {
00177                     nfailLink1 = tmp->next;
00178                     tmp->next->last = NULL;
00179                 }
00180                 else
00181                 {
00182                     nfailLink1 = NULL;
00183                     nfailLink2 = NULL;
00184                 }
00185                 delete tmp;
00186             }
00187             rt = 0;
00188             break;
00189         }
00190         tmp = tmp->next;
00191     }
00192     return rt;
00193 }


Variable Documentation

LFAILLINK* lfailLink1 = NULL
 

Definition at line 55 of file p802_15_4fail.cc.

Referenced by addLFailLink(), and updateLFailLink().

LFAILLINK* lfailLink2 = NULL
 

Definition at line 56 of file p802_15_4fail.cc.

Referenced by addLFailLink(), and updateLFailLink().

NFAILLINK* nfailLink1 = NULL
 

Definition at line 57 of file p802_15_4fail.cc.

Referenced by addNFailLink(), and updateNFailLink().

NFAILLINK* nfailLink2 = NULL
 

Definition at line 58 of file p802_15_4fail.cc.

Referenced by addNFailLink(), and updateNFailLink().


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