1 /*
2 * fca-pkt.h --
3 *
4 * FIXME: This file needs a description here.
5 *
6 * Copyright (c) 1997-2002 The Regents of the University of California.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * A. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 * B. Redistributions in binary form must reproduce the above copyright notice,
15 * this list of conditions and the following disclaimer in the documentation
16 * and/or other materials provided with the distribution.
17 * C. Neither the names of the copyright holders nor the names of its
18 * contributors may be used to endorse or promote products derived from this
19 * software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
22 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef MASH_FCA_PKT_H
35 #define MASH_FCA_PKT_H
36
37
38 #define FCA_VERSION 1 /* current protocol version */
39
40 #define PKT_FLOOR_REQUEST 1
41 #define PKT_FLOOR_CANCEL 2
42 #define PKT_FLOOR_RELEASE 3
43 #define PKT_GRANT_UPDATE 4
44 #define PKT_QUEUE_UPDATE 5
45 #define PKT_MODERATOR_SA 6
46 #define PKT_PARTICIPANT_SA 7
47 #define PKT_PARTICIPANT_RREQ 8
48 #define PKT_MODERATOR_RREQ 9
49 #define PKT_PARTICIPANT_RREPLY 10
50 #define PKT_MODERATOR_RREPLY 11
51 #define PKT_OBSOLETE 12
52
53
54 class FCA_Packet : public TclObject {
55 public:
56 static FCA_Packet *New();
57 static void Delete(FCA_Packet *packet);
58
59 FCA_Packet() { }
60
61 Bool Extract(u_char *&pb, int &len);
62 Bool ExtractFloorRequest (u_char *&pb, int &len);
63 Bool ExtractFloorCancel (u_char *&pb, int &len);
64 Bool ExtractFloorRelease (u_char *&pb, int &len);
65 Bool ExtractModeratorSA (u_char *&pb, int &len);
66 Bool ExtractParticipantSA(u_char *&pb, int &len);
67 Bool ExtractModeratorUpdate (u_char *&pb, int &len, u_int32_t pktType);
68 Bool ExtractGrantUpdateHelper(u_char *&pb, int &len);
69 Bool ExtractQueueUpdateHelper(u_char *&pb, int &len);
70
71 Bool Packetize(u_char *pb, int &len);
72 Bool PacketizeFloorRequest (u_char *&pb, int &len);
73 Bool PacketizeFloorCancel (u_char *&pb, int &len);
74 Bool PacketizeFloorRelease (u_char *&pb, int &len);
75 Bool PacketizeModeratorSA (u_char *&pb, int &len);
76 Bool PacketizeParticipantSA(u_char *&pb, int &len);
77 Bool PacketizeModeratorUpdate (u_char *&pb, int &len, u_int32_t pktType);
78 Bool PacketizeGrantUpdateHelper(u_char *&pb, int &len);
79 Bool PacketizeQueueUpdateHelper(u_char *&pb, int &len);
80
81 Bool ExtractParticipantRreq (u_char *&pb, int &len);
82 Bool ExtractModeratorRreq (u_char *&pb, int &len);
83 Bool ExtractParticipantRreply(u_char *&pb, int &len);
84 Bool ExtractModeratorRreply (u_char *&pb, int &len);
85 Bool ExtractObsolete (u_char *&pb, int &len);
86
87 Bool PacketizeParticipantRreq (u_char *&pb, int &len);
88 Bool PacketizeModeratorRreq (u_char *&pb, int &len);
89 Bool PacketizeParticipantRreply(u_char *&pb, int &len);
90 Bool PacketizeModeratorRreply (u_char *&pb, int &len);
91 Bool PacketizeObsolete (u_char *&pb, int &len);
92
93 private:
94 void SetVar(const char *varname, const char *value);
95 void SetVar(const char *varname, u_int32_t value);
96 void SetVar(const char *varname, u_int16_t value);
97
98 void LAppendVar(const char *varname, const char *value);
99 void LAppendVar(const char *varname, u_int16_t value);
100
101 const char *GetVar(const char *varname);
102 void GetVar(const char *varname, u_int32_t &value);
103 void GetVar(const char *varname, u_int16_t &value);
104 void GetVar(const char *varname, SrcId &value);
105 void DGetVar(const char *varname, char *&value);
106
107 const char *LIndex(const char *varname, int index);
108 void LIndex(const char *varname, int index, u_int16_t &value);
109 void LIndex(const char *varname, int index, FCA_Packet *&value);
110
111 inline int roundoff(int value) {
112 return ((value % 4 == 0) ? value : (value/4 + 1) * 4);
113 }
114
115 inline void incr(u_char *&pb, int &len, int howMuch) {
116 pb += howMuch;
117 len -= howMuch;
118 }
119 };
120
121
122
123
124
125
126 #endif // MASH_FCA_PKT_H
127
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.