File: internalmessage.h

package info (click to toggle)
vic 2.8ucl4-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,864 kB
  • ctags: 9,033
  • sloc: ansic: 56,989; cpp: 44,560; tcl: 5,550; sh: 1,382; perl: 1,329; makefile: 357
file content (179 lines) | stat: -rw-r--r-- 5,225 bytes parent folder | download
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
 * internalmesage.h
 * Anindo banerjea (banerjea@tenet)
 */
#ifndef INTERNALMESSAGE_H
#define INTERNALMESSAGE_H
#include "internal.h"

/* Note about Dependencies in the data structures in this file and in
 * the file "internal.h".
 * 
 * Every time you add an ER you must change
 * 1. RcapInternalMessage.messageLength
 * 2. RcapHeader.rcap_message_length
 * 3. The local copy of this with the host byte ordering
 * 4. RcapInternetNSR.level_length (and the local copy)
 * 5. RcapInternetNSR.er_count (and the local copy)
 * 
 * Every time you add an NSR you must change
 * 1. RcapInternalMessage.messageLength
 * 2. RcapHeader.rcap_message_length ( and local copy)
 * 3. RmtpHeaderRecord.level_count (and local copies )
 * 
 */

/*
 * RcapInfo
 *
 * A machine-dependent representation of portions of an RCAP control
 * message.
 */

typedef struct RcapInfo 
{
    unsigned char message_type;		/* message type */
    unsigned char *messageP;		/* pointer to RCAP control message */
    RcapHeader localHeader ;	/* Rcap header copy with host byte
    				 * ordering.
				 */
    unsigned char *headerP;		/* pointer to RCAP header */

    union {

	struct establish_request {
	    unsigned char *headerRecordP; /* Pointer to header Record
					   */
	    RmtpHeaderRecord localHeaderRecord;
					/* Local copy of header record
					 * Correct host byte ordering
					 */
	    unsigned char *nsrP;	/* pointer to current NSR */
	    RcapInternetNSR localNSR;	/* Current NSR with host byte
	    				 * ordering. This is a local
					 * copy so changes made have
					 * to be explicitly copied
					 * back. with hton conversions
					 */
	    unsigned char *erP;		/* pointer to current ER */
	    RcapInternetER localER;	/* Current ER with host byte
	    				 * ordering (local copy)
					 */
	    unsigned char *previous_erP;	/* pointer to last node's ER */
	    RcapInternetER previous_ER;	/* last node's ER with host byte
	    				 * ordering (local copy)
					 */
	} establish_request ;

	struct establish_denied {
	    unsigned char *establishDeniedP;
	    RcapEstablishDenied localEstablishDenied;
	} establish_denied ;

	struct establish_accept {
	    unsigned char *headerRecordP; /* Pointer to header Record
					   */
	    RmtpHeaderRecord localHeaderRecord;
					/* Local copy of header record
					 * Correct host byte ordering
					 */
	    unsigned char *nsrP;	/* pointer to current NSR */
	    RcapInternetNSR localNSR;	/* Current NSR with host byte
	    				 * ordering. This is a local
					 * copy so changes made have
					 * to be explicitly copied
					 * back. with hton conversions
					 */
	    unsigned char *erP;		/* pointer to current ER */
	    RcapInternetER localER;	/* Current ER with host byte
	    				 * ordering (local copy)
					 */
	    unsigned char *previous_erP;	/* pointer to last node's ER */
	    RcapInternetER previous_ER;	/* last node's ER with host byte
	    				 * ordering (local copy)
					 */
	} establish_accept ;

	struct close_request{
	    unsigned char *closeRequestP;
	    RcapCloseRequestMess localCloseRequest;
	} close_request;

	struct status_request {

	    unsigned char *srrP;	/* pointer to current status
	    				 * request record */
	    RcapInternetSRR localSRR;
	} status_request ;

	struct status_report {
	    unsigned char *srrP;	/* pointer to current status
	    				 * request record */
	    RcapInternetSRR localSRR;

	} status_report ;

    } variant;

} RcapInfo;

/*
 * RcapInternalMessage
 *
 * Internal message format used for communication between RCAP
 * modules on a single node.  This consists of the original
 * RCAP message along with some parsed fields.  The use of this
 * type of structure is purely a performance hack.
 */
typedef struct RcapInternalMessage 
{

    RcapInfo info;		/* info structure as defined above */

    unsigned char *message;		/* original RCAP message */
    unsigned int messageLength;		/* length of original RCAP message 
					 *
					 * Warning: dependency with
					 * RcapHeader.rcap_message_length
					 * and level_length in the
					 * last NSR
					 *
					 */

} RcapInternalMessage;

/*
 * Function prototypes
 */
extern int
InitializeRcapInternalMessage(RcapInternalMessage *theInternalMessage,
			      unsigned char *message, int size);

extern void
InitializeInternetER(RcapInternalMessage *theInternalMessage,  int er_number, RcapInternetER *local_ER, unsigned char **bufferP);

extern void
AddInternetER(RcapInternalMessage *theInternalMessage);

extern void
RemoveInternetER(RcapInternalMessage *theInternalMessage);

extern void
InitializeInternetSRR(RcapInternalMessage *theInternalMessage);

extern void
AddInternetSRR(RcapInternalMessage *theInternalMessage);

extern void
MakeEstablishDenied(RcapInternalMessage *theInternalMessage, unsigned short cause);

extern void
MakeCloseRequest(RcapInternalMessage *theInternalMessage, unsigned short cause, unsigned char message_type);

extern void
SendEstablishDenied(RcapInternalMessage *theInternalMessage, unsigned short upLine,  unsigned short downLine, unsigned short testId, unsigned short cause);

extern void
SendStatusReport(RcapInternalMessage *theInternalMessage, unsigned short outLine, unsigned short state);

#endif INTERNALMESSAGE_H