Deleted Added
full compact
print-sctp.c (127668) print-sctp.c (146773)
1/* Copyright (c) 2001 NETLAB, Temple University
2 * Copyright (c) 2001 Protocol Engineering Lab, University of Delaware
3 *
4 * Jerry Heinz <gheinz@astro.temple.edu>
5 * John Fiore <jfiore@joda.cis.temple.edu>
6 * Armando L. Caro Jr. <acaro@cis.udel.edu>
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 21 unchanged lines hidden (view full) ---

30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#ifndef lint
37static const char rcsid[] _U_ =
1/* Copyright (c) 2001 NETLAB, Temple University
2 * Copyright (c) 2001 Protocol Engineering Lab, University of Delaware
3 *
4 * Jerry Heinz <gheinz@astro.temple.edu>
5 * John Fiore <jfiore@joda.cis.temple.edu>
6 * Armando L. Caro Jr. <acaro@cis.udel.edu>
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 21 unchanged lines hidden (view full) ---

30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#ifndef lint
37static const char rcsid[] _U_ =
38"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.13.2.2 2003/11/16 08:51:44 guy Exp $ (NETLAB/PEL)";
38"@(#) $Header: /tcpdump/master/tcpdump/print-sctp.c,v 1.16 2004/12/15 08:43:23 guy Exp $ (NETLAB/PEL)";
39#endif
40
41#ifdef HAVE_CONFIG_H
42#include "config.h"
43#endif
44
45#include <tcpdump-stdinc.h>
46

--- 22 unchanged lines hidden (view full) ---

69 const struct ip6_hdr *ip6;
70#endif
71 const u_char *cp;
72 const void *endPacketPtr;
73 u_short sourcePort, destPort;
74 int chunkCount;
75 const struct sctpChunkDesc *chunkDescPtr;
76 const void *nextChunk;
39#endif
40
41#ifdef HAVE_CONFIG_H
42#include "config.h"
43#endif
44
45#include <tcpdump-stdinc.h>
46

--- 22 unchanged lines hidden (view full) ---

69 const struct ip6_hdr *ip6;
70#endif
71 const u_char *cp;
72 const void *endPacketPtr;
73 u_short sourcePort, destPort;
74 int chunkCount;
75 const struct sctpChunkDesc *chunkDescPtr;
76 const void *nextChunk;
77 const char *sep;
77
78 sctpPktHdr = (const struct sctpHeader*) bp;
79 endPacketPtr = (const u_char*)sctpPktHdr+sctpPacketLength;
80
81 if( (u_long) endPacketPtr > (u_long) snapend)
82 endPacketPtr = (const void *) snapend;
83 ip = (struct ip *)bp2;
84#ifdef INET6

--- 35 unchanged lines hidden (view full) ---

120 (void)printf("%s.%d > %s.%d: sctp",
121 ipaddr_string(&ip->ip_src),
122 sourcePort,
123 ipaddr_string(&ip->ip_dst),
124 destPort);
125 }
126 fflush(stdout);
127
78
79 sctpPktHdr = (const struct sctpHeader*) bp;
80 endPacketPtr = (const u_char*)sctpPktHdr+sctpPacketLength;
81
82 if( (u_long) endPacketPtr > (u_long) snapend)
83 endPacketPtr = (const void *) snapend;
84 ip = (struct ip *)bp2;
85#ifdef INET6

--- 35 unchanged lines hidden (view full) ---

121 (void)printf("%s.%d > %s.%d: sctp",
122 ipaddr_string(&ip->ip_src),
123 sourcePort,
124 ipaddr_string(&ip->ip_dst),
125 destPort);
126 }
127 fflush(stdout);
128
128 if (vflag < 2)
129 return;
130
129 if (vflag >= 2)
130 sep = "\n\t";
131 else
132 sep = " (";
131 /* cycle through all chunks, printing information on each one */
132 for (chunkCount = 0,
133 chunkDescPtr = (const struct sctpChunkDesc *)
134 ((const u_char*) sctpPktHdr + sizeof(struct sctpHeader));
135 chunkDescPtr != NULL &&
136 ( (const void *)
137 ((const u_char *) chunkDescPtr + sizeof(struct sctpChunkDesc))
138 <= endPacketPtr);

--- 6 unchanged lines hidden (view full) ---

145 chunkEnd = ((const u_char*)chunkDescPtr + EXTRACT_16BITS(&chunkDescPtr->chunkLength));
146
147 align=EXTRACT_16BITS(&chunkDescPtr->chunkLength) % 4;
148 if (align != 0)
149 align = 4 - align;
150
151 nextChunk = (const void *) (chunkEnd + align);
152
133 /* cycle through all chunks, printing information on each one */
134 for (chunkCount = 0,
135 chunkDescPtr = (const struct sctpChunkDesc *)
136 ((const u_char*) sctpPktHdr + sizeof(struct sctpHeader));
137 chunkDescPtr != NULL &&
138 ( (const void *)
139 ((const u_char *) chunkDescPtr + sizeof(struct sctpChunkDesc))
140 <= endPacketPtr);

--- 6 unchanged lines hidden (view full) ---

147 chunkEnd = ((const u_char*)chunkDescPtr + EXTRACT_16BITS(&chunkDescPtr->chunkLength));
148
149 align=EXTRACT_16BITS(&chunkDescPtr->chunkLength) % 4;
150 if (align != 0)
151 align = 4 - align;
152
153 nextChunk = (const void *) (chunkEnd + align);
154
153 printf("\n\t%d) ", chunkCount+1);
155 printf("%s%d) ", sep, chunkCount+1);
154 switch (chunkDescPtr->chunkID)
155 {
156 case SCTP_DATA :
157 {
158 const struct sctpDataPart *dataHdrPtr;
159
160 printf("[DATA] ");
161

--- 22 unchanged lines hidden (view full) ---

184 dataHdrPtr=(const struct sctpDataPart*)(chunkDescPtr+1);
185
186 printf("[TSN: %u] ", EXTRACT_32BITS(&dataHdrPtr->TSN));
187 printf("[SID: %u] ", EXTRACT_16BITS(&dataHdrPtr->streamId));
188 printf("[SSEQ %u] ", EXTRACT_16BITS(&dataHdrPtr->sequence));
189 printf("[PPID 0x%x] ", EXTRACT_32BITS(&dataHdrPtr->payloadtype));
190 fflush(stdout);
191
156 switch (chunkDescPtr->chunkID)
157 {
158 case SCTP_DATA :
159 {
160 const struct sctpDataPart *dataHdrPtr;
161
162 printf("[DATA] ");
163

--- 22 unchanged lines hidden (view full) ---

186 dataHdrPtr=(const struct sctpDataPart*)(chunkDescPtr+1);
187
188 printf("[TSN: %u] ", EXTRACT_32BITS(&dataHdrPtr->TSN));
189 printf("[SID: %u] ", EXTRACT_16BITS(&dataHdrPtr->streamId));
190 printf("[SSEQ %u] ", EXTRACT_16BITS(&dataHdrPtr->sequence));
191 printf("[PPID 0x%x] ", EXTRACT_32BITS(&dataHdrPtr->payloadtype));
192 fflush(stdout);
193
192 if (vflag) /* if verbose output is specified */
194 if (vflag >= 2) /* if verbose output is specified */
193 { /* at the command line */
194 const u_char *payloadPtr;
195
196 printf("[Payload");
197
198 if (!xflag && !qflag) {
199 payloadPtr = (const u_char *) (++dataHdrPtr);
200 printf(":");

--- 135 unchanged lines hidden (view full) ---

336 break;
337 case SCTP_RELIABLE_CNTL_ACK :
338 printf("[REL CTRL ACK] ");
339 break;
340 default :
341 printf("[Unknown chunk type: 0x%x]", chunkDescPtr->chunkID);
342 return;
343 }
195 { /* at the command line */
196 const u_char *payloadPtr;
197
198 printf("[Payload");
199
200 if (!xflag && !qflag) {
201 payloadPtr = (const u_char *) (++dataHdrPtr);
202 printf(":");

--- 135 unchanged lines hidden (view full) ---

338 break;
339 case SCTP_RELIABLE_CNTL_ACK :
340 printf("[REL CTRL ACK] ");
341 break;
342 default :
343 printf("[Unknown chunk type: 0x%x]", chunkDescPtr->chunkID);
344 return;
345 }
346
347 if (vflag < 2)
348 sep = ", (";
344 }
345}
349 }
350}