add details for doxygen
[obnox/wireshark/wip.git] / packet-rtps.h
1 /*
2  *  $Id: packet-rtps.h,v 1.3 2004/04/22 20:29:46 jmayer Exp $
3  *
4  *  AUTHOR: Petr Smolik                 petr.smolik@wo.cz
5  *
6  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
7  *  --------------------------------------------------------------------
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *  
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *  
19  */
20  
21 #ifndef _TYPEDEFS_DEFINES_RTPS_H
22 #define _TYPEDEFS_DEFINES_RTPS_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define RTPS_HEADER_LENGTH   16
29
30 #define MAX_PATHNAME         128
31 #define MAX_TYPENAME         128
32 #define ORTE_TRUE            1
33 #define ORTE_FALSE           0
34
35 typedef gint8                    Boolean;
36
37 typedef gint8                    PathName[MAX_PATHNAME];
38 typedef gint8                    TypeName[MAX_TYPENAME];
39
40 typedef gint32                   TypeChecksum;
41
42 /*****************************************************************/
43 /*             Wire Protocol Specification (WPS)                 */
44 /*****************************************************************/
45
46          
47 /**
48   Host identifier.
49    
50   for example: IP address working nodes
51 */
52 typedef gint32                   HostId;
53 #define HID_UNKNOWN              0x00
54
55 /**
56   Application identifier.
57
58   composed from: 3 bytes - instance Id
59                  1 byte  - appKind (1 - ManagedApplication, 2 - Manager) 
60 */
61 typedef gint32                   AppId;
62 #define AID_UNKNOWN              0x00
63 #define MANAGEDAPPLICATION       0x01
64 #define MANAGER                  0x02
65
66 /**
67   Object identifier.
68    
69   composed from: 3 bytes - instance Id
70                  1 byte  - objKind
71 */
72 typedef gint32                   ObjectId;
73
74 #define OID_UNKNOWN              0x00000000
75 #define OID_APP                  0x000001C1
76 #define OID_WRITE_APPSELF        0x000008C2
77 #define OID_READ_APPSELF         0x000008C7
78 #define OID_WRITE_APP            0x000001C2
79 #define OID_READ_APP             0x000001C7
80 #define OID_WRITE_MGR            0x000007C2
81 #define OID_READ_MGR             0x000007C7
82 #define OID_WRITE_PUBL           0x000003C2
83 #define OID_READ_PUBL            0x000003C7
84 #define OID_WRITE_SUBS           0x000004C2
85 #define OID_READ_SUBS            0x000004C7
86 /* Kind */
87 #define OID_APPLICATION      0x01
88 #define OID_CSTWRITER        0x02
89 #define OID_PUBLICATION      0x03
90 #define OID_SUBSCRIPTION     0x04
91 #define OID_CSTREADER        0x07
92
93 #define OID_USEROBJ          0x00
94 #define OID_RESUSEROBJ       0x40
95 #define OID_METAOBJ          0x80
96 #define OID_RESMETAOBJ       0xC0
97
98 typedef struct {
99        HostId                hid;
100        AppId                 aid;
101        ObjectId              oid;
102      } GUID_RTPS;    
103
104 typedef struct {
105        gint8                 major;
106        gint8                 minor;
107      } VendorId;
108
109 #define VENDOR_ID_UNKNOWN(id)    {id.major=0;id.minor=0;}
110 #define VENDOR_ID_RTI(id)        {id.major=1;id.minor=1;}
111 #define VENDOR_ID_OCERA(id)      {id.major=0;id.minor=0;}
112
113 typedef struct {
114        gint8                 major;
115        gint8                 minor;
116      } ProtocolVersion;
117
118 #define PROTOCOL_VERSION_1_0(pv) {pv.major=1;pv.minor=0;}
119
120 typedef struct {
121        gint32                high;
122        gint32                low;
123      } SequenceNumber;
124
125
126 #define SEQUENCE_NUMBER_NONE(sn)    {sn.high=0;sn.low=0;}
127 #define SEQUENCE_NUMBER_UNKNOWN(sn) {sn.high=0x7fffffff;sn.low=0xffffffff;}
128
129
130 typedef struct {
131        gint32                seconds;    /* time in seconds */
132        guint32               fraction;   /* time in seconds / 2^32 */
133      } NtpTime;
134
135 #define NTPTIME_ZERO(t)          {t.seconds=0;t.fraction=0;}
136 #define NTPTIME_BUILD(t,s)       {t.seconds=s;t.fraction=0;}
137 #define NTPTIME_INFINITE(t)      {t.seconds=0xffffffff;t.fraction=0;}
138
139 typedef gint32                   IPAddress;
140
141 #define IPADDRESS_INVALID        0
142
143 typedef gint32                   Port;
144
145 #define PORT_INVALID             0
146
147 typedef enum {
148        PAD                       = 0x01,
149        VAR                       = 0x02,
150        ISSUE                     = 0x03,
151        ACK                       = 0x06,
152        HEARTBEAT                 = 0x07,
153        GAP                       = 0x08,
154        INFO_TS                   = 0x09,
155        INFO_SRC                  = 0x0c,
156        INFO_REPLY                = 0x0d,
157        INFO_DST                  = 0x0e,
158        APP_QUIT                  = 0x90
159      } SubmessageId;
160
161 typedef struct {
162        ProtocolVersion           sourceVersion;
163        VendorId                  sourceVendorId;
164        HostId                    sourceHostId;
165        AppId                     sourceAppId;
166        HostId                    destHostId;
167        AppId                     destAppId;
168        IPAddress                 unicastReplyIPAddress;
169        Port                      unicastReplyPort;
170        IPAddress                 multicastReplyIPAddress;
171        Port                      multicastReplyPort;
172        Boolean                   haveTimestamp;
173        NtpTime                   timestamp;          
174      } MessageInterpret;
175
176
177 #define PID_PAD                             0x00
178 #define PID_SENTINEL                        0x01
179 #define PID_EXPIRATION_TIME                 0x02
180 #define PID_PERSISTENCE                     0x03
181 #define PID_MINIMUM_SEPARATION              0x04
182 #define PID_TOPIC                           0x05
183 #define PID_STRENGTH                        0x06
184 #define PID_TYPE_NAME                       0x07
185 #define PID_TYPE_CHECKSUM                   0x08
186 #define RTPS_PID_TYPE2_NAME                 0x09
187 #define RTPS_PID_TYPE2_CHECKSUM             0x0a
188 #define PID_METATRAFFIC_MULTICAST_IPADDRESS 0x0b  /*tady byla chyba MATA_TRAFF....*/
189 #define PID_APP_IPADDRESS                   0x0c
190 #define PID_METATRAFFIC_UNICAST_PORT        0x0d
191 #define PID_USERDATA_UNICAST_PORT           0x0e
192 #define PID_IS_RELIABLE                     0x0f
193 #define PID_EXPECTS_ACK                     0x10
194 #define PID_USERDATA_MULTICAST_IPADDRESS    0x11
195 #define PID_MANAGER_KEY                     0x12
196 #define PID_SEND_QUEUE_SIZE                 0x13
197 #define PID_RELIABILITY_ENABLED             0x14
198 #define PID_PROTOCOL_VERSION                0x15
199 #define PID_VENDOR_ID                       0x16
200 #define PID_VARGAPPS_SEQUENCE_NUMBER_LAST   0x17
201 #define PID_RECV_QUEUE_SIZE                 0x18
202 #define PID_RELIABILITY_OFFERED             0x19
203 #define PID_RELIABILITY_REQUESTED           0x1a
204
205 /* possible values for PID_RELIABILITY_REQUEST */
206 #define PID_VALUE_RELIABILITY_BEST_EFFORTS  0x01
207 #define PID_VALUE_RELIABILITY_STRICT        0x02
208
209 typedef guint16   ParameterId;
210 typedef guint16   ParameterLength;
211
212 /* State Machines */
213 typedef enum {
214         MAYSENDHB                           = 0x01,
215         MUSTSENDHB                          = 0x02,
216         SENDHB                              = 0x03
217       } StateMachineHB;
218
219 typedef enum {
220         NOTHNIGTOSEND                       = 0x01,
221         MUSTSENDDATA                        = 0x02
222       } StateMachineSend;
223
224 typedef enum {
225         NEW                                 = 0x01,
226         TOSEND                              = 0x02,
227         UNDERWAY                            = 0x03,
228         UNACKNOWLEDGED                      = 0x04,
229         ANNOUCED                            = 0x05,
230         ACKNOWLEDGED                        = 0x06
231       } StateMachineChFReader;
232
233 typedef enum {
234         WAITING                             = 0x01,
235         PULLING                             = 0x02,
236         ACKPENDING                          = 0x03
237       } StateMachineACK;
238
239 typedef enum {
240         FUTURE                              = 0x01,
241         REQUESTED                           = 0x02,
242         MISSING                             = 0x03,
243         RECEIVED                            = 0x04
244       } StateMachineChFWriter;
245
246 #ifdef __cplusplus
247 } /* extern "C"*/
248 #endif
249             
250 #endif /* _TYPEDEFS_DEFINES_RTPS_H */