2 * Declarations for pgm packet disassembly
4 * $Id: packet-pgm.h,v 1.6 2001/08/06 19:05:14 guy Exp $
6 * Copyright (c) 2000 by Talarian Corp
8 * Ethereal - Network traffic analyzer
9 * By Gerald Combs <gerald@ethereal.com>
10 * Copyright 1999 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 typedef guint8 nchar_t;
30 typedef guint16 nshort_t;
31 typedef guint32 nlong_t;
33 /* The PGM main header */
35 nshort_t sport; /* source port */
36 nshort_t dport; /* destination port */
37 nchar_t type; /* PGM type */
38 nchar_t opts; /* options */
39 nshort_t cksum; /* checksum */
40 nchar_t gsi[6]; /* Global Source ID */
41 nshort_t tsdulen; /* TSDU length */
43 #define pgmhdr_ntoh(_p) \
44 (_p)->sport = ntohs((_p)->sport); \
45 (_p)->dport = ntohs((_p)->dport); \
46 (_p)->type = ntohs((_p)->type); \
47 (_p)->opts = ntohs((_p)->opts); \
48 (_p)->cksum = ntohs((_p)->cksum); \
49 (_p)->tsdulen = ntohs((_p)->tsdulen)
51 /* The PGM SPM header */
53 nlong_t sqn; /* SPM's sequence number */
54 nlong_t trail; /* Trailing edge sequence number */
55 nlong_t lead; /* Leading edge sequence number */
56 nshort_t path_afi; /* NLA AFI */
57 nshort_t res; /* reserved */
58 nlong_t path; /* Path NLA */
60 const size_t PGM_SPM_SZ = sizeof(pgm_type)+sizeof(pgm_spm_t);
61 #define spm_ntoh(_p) \
62 (_p)->sqn = ntohl((_p)->sqn); \
63 (_p)->trail = ntohl((_p)->trail); \
64 (_p)->lead = ntohl((_p)->lead); \
65 (_p)->path_afi = ntohs((_p)->path_afi); \
66 (_p)->res = ntohs((_p)->res);
68 /* The PGM Data (ODATA/RDATA) header */
70 nlong_t sqn; /* Data Packet sequence number */
71 nlong_t trail; /* Trailing edge sequence number */
73 #define data_ntoh(_p) \
74 (_p)->sqn = ntohl((_p)->sqn); \
75 (_p)->trail = ntohl((_p)->trail)
76 const size_t PGM_DATA_HDR_SZ = sizeof(pgm_type)+sizeof(pgm_data_t);
78 /* The PGM NAK (NAK/N-NAK/NCF) header */
80 nlong_t sqn; /* Requested sequence number */
81 nshort_t src_afi; /* NLA AFI for source (IPv4 is set to 1) */
82 nshort_t src_res; /* reserved */
83 nlong_t src; /* Source NLA */
84 nshort_t grp_afi; /* Multicast group AFI (IPv4 is set to 1) */
85 nshort_t grp_res; /* reserved */
86 nlong_t grp; /* Multicast group NLA */
88 const size_t PGM_NAK_SZ = sizeof(pgm_type)+sizeof(pgm_nak_t);
89 #define nak_ntoh(_p) \
90 (_p)->sqn = ntohl((_p)->sqn); \
91 (_p)->src_afi = ntohs((_p)->src_afi); \
92 (_p)->src_res = ntohs((_p)->src_res); \
93 (_p)->grp_afi = ntohs((_p)->grp_afi); \
94 (_p)->grp_res = ntohs((_p)->grp_res)
96 /* The PGM ACK header (PGMCC) */
98 nlong_t rx_max_sqn; /* RX_MAX sequence number */
99 nlong_t bitmap; /* Received Packet Bitmap */
101 const size_t PGM_ACK_SZ = sizeof(pgm_type)+sizeof(pgm_ack_t);
102 #define ack_ntoh(_p) \
103 (_p)->rx_max_sqn = ntohl((_p)->rx_max_sqn); \
104 (_p)->bitmap = ntohl((_p)->bitmap)
106 /* constants for hdr types */
107 #if defined(PGM_SPEC_01_PCKTS)
108 /* old spec-01 types */
109 #define PGM_SPM_PCKT 0x00
110 #define PGM_ODATA_PCKT 0x10
111 #define PGM_RDATA_PCKT 0x11
112 #define PGM_NAK_PCKT 0x20
113 #define PGM_NNAK_PCKT 0x21
114 #define PGM_NCF_PCKT 0x30
116 /* spec-02 types (as well as spec-04+) */
117 #define PGM_SPM_PCKT 0x00
118 #define PGM_ODATA_PCKT 0x04
119 #define PGM_RDATA_PCKT 0x05
120 #define PGM_NAK_PCKT 0x08
121 #define PGM_NNAK_PCKT 0x09
122 #define PGM_NCF_PCKT 0x0A
123 #define PGM_ACK_PCKT 0x0D
124 #endif /* PGM_SPEC_01_PCKTS */
126 /* port swapping on NAK and NNAKs or not (default is to swap) */
127 /* PGM_NO_PORT_SWAP */
129 /* option flags (main PGM header) */
131 #define PGM_OPT_NETSIG 0x02
132 #define PGM_OPT_VAR_PKTLEN 0x40
133 #define PGM_OPT_PARITY 0x80
136 #define PGM_OPT_LENGTH 0x00
137 #define PGM_OPT_END 0x80
138 #define PGM_OPT_FRAGMENT 0x01
139 #define PGM_OPT_NAK_LIST 0x02
140 #define PGM_OPT_JOIN 0x03
141 #define PGM_OPT_REDIRECT 0x07
142 #define PGM_OPT_SYN 0x0D
143 #define PGM_OPT_FIN 0x0E
144 #define PGM_OPT_RST 0x0F
145 #define PGM_OPT_PARITY_PRM 0x08
146 #define PGM_OPT_PARITY_GRP 0x09
147 #define PGM_OPT_CURR_TGSIZE 0x0A
148 #define PGM_OPT_PGMCC_DATA 0x12
149 #define PGM_OPT_PGMCC_FEEDBACK 0x13
151 const nchar_t PGM_OPT_INVALID = 0x7F;
154 #define PGM_OPX_IGNORE 0x00
155 #define PGM_OPX_INVAL 0x01
156 #define PGM_OPX_DISCARD 0x10
177 } pgm_opt_nak_list_t;
180 * To squeeze the whole option into 255 bytes, we
181 * can only have 62 in the list
183 #define PGM_MAX_NAK_LIST_SZ (62)
190 nlong_t opt_join_min;
199 } pgm_opt_parity_prm_t;
201 /* OPT_PARITY_PRM P and O bits */
202 const nchar_t PGM_OPT_PARITY_PRM_PRO = 0x2;
203 const nchar_t PGM_OPT_PARITY_PRM_OND = 0x1;
211 } pgm_opt_parity_grp_t;
219 } pgm_opt_curr_tgsize_t;
230 } pgm_opt_pgmcc_data_t;
241 } pgm_opt_pgmcc_feedback_t;
244 * Udp port for UDP encapsulation
246 #define DEFAULT_UDP_ENCAP_UCAST_PORT 3055
247 #define DEFAULT_UDP_ENCAP_MCAST_PORT 3056
249 #endif /* _PACKET_PGM_H */