diff options
author | Denis Ovsienko <infrastation@yandex.ru> | 2014-04-21 15:07:15 +0400 |
---|---|---|
committer | Denis Ovsienko <infrastation@yandex.ru> | 2014-04-21 18:56:55 +0400 |
commit | 1cd6519c4ea8d4005bf0813b7e67977daf01c8c9 (patch) | |
tree | 782dc90a5c15722875106a4d24e3886bf798d9be /print-sctp.c | |
parent | a97e56cb1124eec90a989e7aa75973343c656f1e (diff) | |
download | tcpdump-1cd6519c4ea8d4005bf0813b7e67977daf01c8c9.tar.gz |
M3UA: improve code style
Merge m3ua.h into the only file that includes it (print-m3ua.c). Make
M3UA functions follow naming pattern, constify some of their arguments
and switch to ND_PRINT(). Make use of tok2str() and ternary conditional.
Eliminate declarations in the middle of code (C89).
Diffstat (limited to 'print-sctp.c')
-rw-r--r-- | print-sctp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/print-sctp.c b/print-sctp.c index 4e079b0b..566a8d1a 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -606,6 +606,9 @@ void sctp_print(netdissect_options *ndo, case SCTP_DATA : { const struct sctpDataPart *dataHdrPtr; + u_int32_t ppid; + const u_char *payloadPtr; + u_int payload_size; if ((chunkDescPtr->chunkFlg & SCTP_DATA_UNORDERED) == SCTP_DATA_UNORDERED) @@ -631,7 +634,7 @@ void sctp_print(netdissect_options *ndo, dataHdrPtr=(const struct sctpDataPart*)(chunkDescPtr+1); - u_int32_t ppid = EXTRACT_32BITS(&dataHdrPtr->payloadtype); + ppid = EXTRACT_32BITS(&dataHdrPtr->payloadtype); ND_PRINT((ndo, "[TSN: %u] ", EXTRACT_32BITS(&dataHdrPtr->TSN))); ND_PRINT((ndo, "[SID: %u] ", EXTRACT_16BITS(&dataHdrPtr->streamId))); ND_PRINT((ndo, "[SSEQ %u] ", EXTRACT_16BITS(&dataHdrPtr->sequence))); @@ -644,14 +647,14 @@ void sctp_print(netdissect_options *ndo, (ppid == SCTP_PPID_FORCES_LP); } - const u_char *payloadPtr = (const u_char *) (dataHdrPtr + 1); + payloadPtr = (const u_char *) (dataHdrPtr + 1); if (EXTRACT_16BITS(&chunkDescPtr->chunkLength) < sizeof(struct sctpDataPart) + sizeof(struct sctpChunkDesc) + 1) { ND_PRINT((ndo, "bogus chunk length %u]", EXTRACT_16BITS(&chunkDescPtr->chunkLength))); return; } - u_int payload_size = EXTRACT_16BITS(&chunkDescPtr->chunkLength) - + payload_size = EXTRACT_16BITS(&chunkDescPtr->chunkLength) - (sizeof(struct sctpDataPart) + sizeof(struct sctpChunkDesc)); if (isforces) { @@ -660,7 +663,7 @@ void sctp_print(netdissect_options *ndo, /* at the command line */ switch (ppid) { case SCTP_PPID_M3UA : - print_m3ua(payloadPtr, payload_size); + m3ua_print(ndo, payloadPtr, payload_size); break; default: ND_PRINT((ndo, "[Payload")); |