-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
62 lines (52 loc) · 1.53 KB
/
Copy pathnode.h
File metadata and controls
62 lines (52 loc) · 1.53 KB
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
56
57
58
59
60
61
62
#ifndef _NODE_H_
#define _NODE_H_
/* a rtpkt is the packet sent from one routing update process to
another via the call tolayer3() */
struct rtpkt {
int sourceid; /* id of sending router sending this pkt */
int destid; /* id of router to which pkt being sent
(must be an immediate neighbor) */
int mincost[4]; /* min cost to node 0 ... 3 */
};
struct distance_table
{
int costs[4][4];
};
struct event {
float evtime; /* event time */
int evtype; /* event type code */
int eventity; /* entity where event occurs */
struct rtpkt *rtpktptr; /* ptr to packet (if any) assoc w/ this event */
struct event *prev;
struct event *next;
};
extern int TRACE;
extern int YES;
extern int NO;
/* fuctions define */
// node0.c
void rtinit0();
void rtupdate0(struct rtpkt* rcvdpkt);
void printdt0(struct distance_table* dtptr);
void linkhandler0(int linkid, int newcost);
// node1.c
void rtinit1();
void rtupdate1(struct rtpkt *rcvdpkt);
void printdt1(struct distance_table* dtptr);
void linkhandler1(int linkid, int newcost);
// node2.c
void rtinit2();
void rtupdate2(struct rtpkt *rcvdpkt);
void printdt2(struct distance_table *dtptr);
// node3.c
void rtinit3();
void rtupdate3(struct rtpkt* rcvdpkt);
void printdt3(struct distance_table* dtptr);
// main.c
void creatertpkt(struct rtpkt *initrtpkt, int srcid, int destid, int mincosts[]);
void init();
float jimsrand();
void insertevent(struct event *p);
void printevlist();
void tolayer2(struct rtpkt packet);
#endif