diff options
author | Bill Meier <wmeier@newsguy.com> | 2014-10-10 10:41:10 -0400 |
---|---|---|
committer | Bill Meier <wmeier@newsguy.com> | 2014-10-10 14:50:08 +0000 |
commit | 23e78cd6bda4758d4f54e0cf3b9c79bb6bcb1f6e (patch) | |
tree | d8b5cb335a5f18353e186b298682b0e8cd7bb447 /epan | |
parent | bdbc8e3a79ae7ca7b4d5f100b985f0f1699a33fd (diff) |
Add editor modelines; Adjust whitespace as needed.
Change-Id: I3dc57f4c2ca57585103e3b71503ac4c332903e50
Reviewed-on: https://code.wireshark.org/review/4594
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan')
43 files changed, 1064 insertions, 516 deletions
diff --git a/epan/addr_and_mask.c b/epan/addr_and_mask.c index 780f9a4b60..080e216cdc 100644 --- a/epan/addr_and_mask.c +++ b/epan/addr_and_mask.c @@ -73,7 +73,7 @@ ipv4_addr_and_mask(tvbuff_t *tvb, int offset, guint8 *addr, guint32 prefix_len) int ipv6_addr_and_mask(tvbuff_t *tvb, int offset, struct e_in6_addr *addr, - guint32 prefix_len) + guint32 prefix_len) { guint32 addr_len; @@ -90,3 +90,16 @@ ipv6_addr_and_mask(tvbuff_t *tvb, int offset, struct e_in6_addr *addr, return addr_len; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/aftypes.c b/epan/aftypes.c index e9fb619554..6a4d70fe5b 100644 --- a/epan/aftypes.c +++ b/epan/aftypes.c @@ -71,3 +71,16 @@ static const value_string linux_af_vals[] = { }; value_string_ext linux_af_vals_ext = VALUE_STRING_EXT_INIT(linux_af_vals); + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/app_mem_usage.c b/epan/app_mem_usage.c index e233ca086f..c5db894bad 100644 --- a/epan/app_mem_usage.c +++ b/epan/app_mem_usage.c @@ -50,17 +50,17 @@ static gsize win32_get_total_mem_used_by_app(void) { - HANDLE pHandle; - PROCESS_MEMORY_COUNTERS pmc; - SIZE_T workingSize = 0; + HANDLE pHandle; + PROCESS_MEMORY_COUNTERS pmc; + SIZE_T workingSize = 0; - pHandle = GetCurrentProcess(); + pHandle = GetCurrentProcess(); - if (GetProcessMemoryInfo(pHandle, &pmc, sizeof(pmc))){ - workingSize = pmc.WorkingSetSize; - } + if (GetProcessMemoryInfo(pHandle, &pmc, sizeof(pmc))){ + workingSize = pmc.WorkingSetSize; + } - CloseHandle(pHandle); + CloseHandle(pHandle); if(workingSize == 0){ return -1; @@ -211,3 +211,16 @@ memory_usage_gc(void) } } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/asm_utils.c b/epan/asm_utils.c index 1f38afc383..c80b870176 100644 --- a/epan/asm_utils.c +++ b/epan/asm_utils.c @@ -62,12 +62,24 @@ wrs_check_charset(const guchar table[256], const char *str) guint wrs_str_hash(gconstpointer v) { - /* 31 bit hash function */ - const signed char *p = (const signed char *)v; - guint32 h = *p; - if (h) - for (p += 1; *p != '\0'; p++) - h = (h << 5) - h + *p; - return h; + /* 31 bit hash function */ + const signed char *p = (const signed char *)v; + guint32 h = *p; + if (h) + for (p += 1; *p != '\0'; p++) + h = (h << 5) - h + *p; + return h; } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/asn1.c b/epan/asn1.c index 81ba856c4b..1ce1bdcb47 100644 --- a/epan/asn1.c +++ b/epan/asn1.c @@ -219,3 +219,16 @@ double asn1_get_real(const guint8 *real_ptr, gint real_len) { return val; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/atalk-utils.c b/epan/atalk-utils.c index 9088e0e1de..78736a62f7 100644 --- a/epan/atalk-utils.c +++ b/epan/atalk-utils.c @@ -26,7 +26,7 @@ gchar * atalk_addr_to_str(const struct atalk_ddp_addr *addrp) { - gchar *cur; + gchar *cur; cur=(gchar *)ep_alloc(14); atalk_addr_to_str_buf(addrp, cur, 14); @@ -38,3 +38,16 @@ atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp, gchar *buf, int buf_le { g_snprintf(buf, buf_len, "%u.%u", addrp->net, addrp->node ); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/circuit.c b/epan/circuit.c index 75639da6b0..0991c8ea98 100644 --- a/epan/circuit.c +++ b/epan/circuit.c @@ -76,9 +76,9 @@ circuit_cleanup(void) * Free up any space allocated for the circuit hashtable. * * We can free the hash as the structures pointed to in the - * hash are in "seasonal" memory which is freed separately. - * Note: circuit_cleanup() must be called only when - * seasonal memory is also freed. + * hash are in "seasonal" memory which is freed separately. + * Note: circuit_cleanup() must be called only when + * seasonal memory is also freed. */ if (circuit_hashtable != NULL) @@ -306,3 +306,16 @@ try_circuit_dissector(circuit_type ctype, guint32 circuit_id, guint32 frame, } return FALSE; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/crc10-tvb.c b/epan/crc10-tvb.c index 072feb8e64..789cb209ab 100644 --- a/epan/crc10-tvb.c +++ b/epan/crc10-tvb.c @@ -38,3 +38,16 @@ update_crc10_by_bytes_tvb(guint16 crc10, tvbuff_t *tvb, int offset, int len) return update_crc10_by_bytes(crc10, buf, len); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/crc16-tvb.c b/epan/crc16-tvb.c index 10854c4401..3a2bb48c71 100644 --- a/epan/crc16-tvb.c +++ b/epan/crc16-tvb.c @@ -132,3 +132,16 @@ guint16 crc16_0x3D65_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint len, gui return crc16_0x3D65_seed(buf, len, seed); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/crc32-tvb.c b/epan/crc32-tvb.c index e729ce79cf..feef6ea367 100644 --- a/epan/crc32-tvb.c +++ b/epan/crc32-tvb.c @@ -113,7 +113,7 @@ crc32_802_tvb(tvbuff_t *tvb, guint len) guint32 crc32_mpeg2_tvb_offset_seed(tvbuff_t *tvb, guint offset, - guint len, guint32 seed) + guint len, guint32 seed) { const guint8* buf; @@ -126,28 +126,41 @@ crc32_mpeg2_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint32 crc32_mpeg2_tvb(tvbuff_t *tvb, guint len) { - return ( crc32_mpeg2_tvb_offset_seed(tvb, 0, len, CRC32_MPEG2_SEED) ); + return ( crc32_mpeg2_tvb_offset_seed(tvb, 0, len, CRC32_MPEG2_SEED) ); } guint32 crc32_mpeg2_tvb_offset(tvbuff_t *tvb, guint offset, guint len) { - return ( crc32_mpeg2_tvb_offset_seed(tvb, offset, len, CRC32_MPEG2_SEED) ); + return ( crc32_mpeg2_tvb_offset_seed(tvb, offset, len, CRC32_MPEG2_SEED) ); } guint32 crc32_mpeg2_tvb_seed(tvbuff_t *tvb, guint len, guint32 seed) { - return ( crc32_mpeg2_tvb_offset_seed(tvb, 0, len, seed) ); + return ( crc32_mpeg2_tvb_offset_seed(tvb, 0, len, seed) ); } guint32 crc32_0x0AA725CF_tvb_offset_seed(tvbuff_t *tvb, - guint offset, guint len, guint32 seed) + guint offset, guint len, guint32 seed) { - const guint8 *buf; + const guint8 *buf; - tvb_ensure_bytes_exist(tvb, offset, len); /* len == -1 not allowed */ - buf = tvb_get_ptr(tvb, offset, len); + tvb_ensure_bytes_exist(tvb, offset, len); /* len == -1 not allowed */ + buf = tvb_get_ptr(tvb, offset, len); - return crc32_0x0AA725CF_seed(buf, len, seed); + return crc32_0x0AA725CF_seed(buf, len, seed); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/crc6-tvb.c b/epan/crc6-tvb.c index c9a2e4470d..1222906cd6 100644 --- a/epan/crc6-tvb.c +++ b/epan/crc6-tvb.c @@ -37,3 +37,16 @@ crc6_compute_tvb(tvbuff_t *tvb, int len) return crc6_compute(buf, len); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/crc8-tvb.c b/epan/crc8-tvb.c index 8e7497b4df..799587556b 100644 --- a/epan/crc8-tvb.c +++ b/epan/crc8-tvb.c @@ -40,22 +40,22 @@ * Reversed CRC table *****************************************************************************/ static const guint8 crctable[256] = { /*reversed, 8-bit, poly=0x07*/ -0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B, -0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67, -0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0, 0xD2, 0x43, -0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC, 0xCE, 0x5F, -0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8, 0x9A, 0x0B, -0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17, -0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33, -0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F, -0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B, -0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87, -0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3, -0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF, -0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB, -0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7, -0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3, -0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E, 0xCF + 0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B, + 0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67, + 0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0, 0xD2, 0x43, + 0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC, 0xCE, 0x5F, + 0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8, 0x9A, 0x0B, + 0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4, 0x86, 0x17, + 0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0, 0xA2, 0x33, + 0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC, 0xBE, 0x2F, + 0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78, 0x0A, 0x9B, + 0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64, 0x16, 0x87, + 0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40, 0x32, 0xA3, + 0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C, 0x2E, 0xBF, + 0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08, 0x7A, 0xEB, + 0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14, 0x66, 0xF7, + 0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30, 0x42, 0xD3, + 0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C, 0x5E, 0xCF }; @@ -94,3 +94,16 @@ guint8 get_crc8_ieee8023_epon(tvbuff_t *p, guint8 len, guint8 offset) { return FCS; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/disabled_protos.c b/epan/disabled_protos.c index 9eb140dd72..1ccaf72f2d 100644 --- a/epan/disabled_protos.c +++ b/epan/disabled_protos.c @@ -39,8 +39,8 @@ #include "disabled_protos.h" #include <wsutil/file_util.h> -#define GLOBAL_PROTOCOLS_FILE_NAME "disabled_protos" -#define PROTOCOLS_FILE_NAME "disabled_protos" +#define GLOBAL_PROTOCOLS_FILE_NAME "disabled_protos" +#define PROTOCOLS_FILE_NAME "disabled_protos" /* * List of disabled protocols @@ -48,7 +48,7 @@ static GList *global_disabled_protos = NULL; static GList *disabled_protos = NULL; -#define INIT_BUF_SIZE 128 +#define INIT_BUF_SIZE 128 static void discard_existing_list (GList **flp) @@ -80,12 +80,12 @@ discard_existing_list (GList **flp) */ static int read_disabled_protos_list_file(const char *ff_path, FILE *ff, - GList **flp); + GList **flp); void read_disabled_protos_list(char **gpath_return, int *gopen_errno_return, - int *gread_errno_return, - char **path_return, int *open_errno_return, + int *gread_errno_return, + char **path_return, int *open_errno_return, int *read_errno_return) { int err; @@ -103,7 +103,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return, if ((ff = ws_fopen(gff_path, "r")) != NULL) { /* We succeeded in opening it; read it. */ err = read_disabled_protos_list_file(gff_path, ff, - &global_disabled_protos); + &global_disabled_protos); if (err != 0) { /* We had an error reading the file; return the errno and the pathname, so our caller can report the error. */ @@ -160,7 +160,7 @@ read_disabled_protos_list(char **gpath_return, int *gopen_errno_return, static int read_disabled_protos_list_file(const char *ff_path, FILE *ff, - GList **flp) + GList **flp) { protocol_def *prot; int c; @@ -181,34 +181,34 @@ read_disabled_protos_list_file(const char *ff_path, FILE *ff, /* Skip over leading white space, if any. */ while ((c = getc(ff)) != EOF && isspace(c)) { if (c == '\n') { - /* Blank line. */ - continue; + /* Blank line. */ + continue; } } if (c == EOF) { if (ferror(ff)) - goto error; /* I/O error */ + goto error; /* I/O error */ else - break; /* Nothing more to read */ + break; /* Nothing more to read */ } - ungetc(c, ff); /* Unread the non-white-space character. */ + ungetc(c, ff); /* Unread the non-white-space character. */ /* Get the name of the protocol. */ prot_name_index = 0; for (;;) { c = getc(ff); if (c == EOF) - break; /* End of file, or I/O error */ + break; /* End of file, or I/O error */ if (isspace(c)) - break; /* Trailing white space, or end of line. */ + break; /* Trailing white space, or end of line. */ if (c == '#') - break; /* Start of comment, running to end of line. */ + break; /* Start of comment, running to end of line. */ /* Add this character to the protocol name string. */ if (prot_name_index >= prot_name_len) { - /* protocol name buffer isn't long enough; double its length. */ - prot_name_len *= 2; - prot_name = (char *)g_realloc(prot_name, prot_name_len + 1); + /* protocol name buffer isn't long enough; double its length. */ + prot_name_len *= 2; + prot_name = (char *)g_realloc(prot_name, prot_name_len + 1); } prot_name[prot_name_index] = c; prot_name_index++; @@ -219,10 +219,10 @@ read_disabled_protos_list_file(const char *ff_path, FILE *ff, while ((c = getc(ff)) != EOF && c != '\n' && isspace(c)) ; if (c != EOF && c != '\n' && c != '#') { - /* Non-white-space after the protocol name; warn about it, - in case we come up with a reason to use it. */ - g_warning("'%s' line %d has extra stuff after the protocol name.", - ff_path, line); + /* Non-white-space after the protocol name; warn about it, + in case we come up with a reason to use it. */ + g_warning("'%s' line %d has extra stuff after the protocol name.", + ff_path, line); } } if (c != EOF && c != '\n') { @@ -233,13 +233,13 @@ read_disabled_protos_list_file(const char *ff_path, FILE *ff, if (c == EOF) { if (ferror(ff)) - goto error; /* I/O error */ + goto error; /* I/O error */ else { - /* EOF, not error; no newline seen before EOF */ - g_warning("'%s' line %d doesn't have a newline.", ff_path, - line); + /* EOF, not error; no newline seen before EOF */ + g_warning("'%s' line %d doesn't have a newline.", ff_path, + line); } - break; /* nothing more to read */ + break; /* nothing more to read */ } /* Null-terminate the protocol name. */ @@ -287,7 +287,7 @@ set_disabled_protos_list(void) /* XXX - complain here? */ } else { if (proto_can_toggle_protocol(i)) - proto_set_decoding(i, FALSE); + proto_set_decoding(i, FALSE); } fl_ent = fl_ent->next; @@ -306,8 +306,8 @@ skip: /* XXX - complain here? */ } else { if (proto_can_toggle_protocol(i)) { - proto_set_decoding(i, FALSE); - proto_set_cant_toggle(i); + proto_set_decoding(i, FALSE); + proto_set_cant_toggle(i); } } @@ -332,7 +332,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return) protocol_t *protocol; void *cookie; - *pref_path_return = NULL; /* assume no error */ + *pref_path_return = NULL; /* assume no error */ ff_path = get_persconffile_path(PROTOCOLS_FILE_NAME, TRUE); @@ -408,3 +408,16 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return) g_free(ff_path_new); g_free(ff_path); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/dissector_filters.c b/epan/dissector_filters.c index fd3d4eda6e..04ab235119 100644 --- a/epan/dissector_filters.c +++ b/epan/dissector_filters.c @@ -43,3 +43,15 @@ void register_dissector_filter(const char *name, is_filter_valid_func is_filter_ dissector_filter_list = g_list_append(dissector_filter_list, entry); } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/ex-opt.c b/epan/ex-opt.c index 358174facb..59909496cd 100644 --- a/epan/ex-opt.c +++ b/epan/ex-opt.c @@ -114,3 +114,15 @@ extern const gchar* ex_opt_get_next(const gchar* key) { } } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/exntest.c b/epan/exntest.c index ba940c1b4a..ef04c5c77b 100644 --- a/epan/exntest.c +++ b/epan/exntest.c @@ -207,3 +207,16 @@ int main(void) except_deinit(); exit(failed?1:0); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/exported_pdu.c b/epan/exported_pdu.c index a57f458697..a4cb7076b3 100644 --- a/epan/exported_pdu.c +++ b/epan/exported_pdu.c @@ -339,20 +339,33 @@ load_export_pdu_tags(packet_info *pinfo, const char* proto_name, int wtap_encap gint register_export_pdu_tap(const char *name) { - gchar *tap_name = g_strdup(name); - export_pdu_tap_name_list = g_slist_prepend(export_pdu_tap_name_list, tap_name); - return register_tap(tap_name); + gchar *tap_name = g_strdup(name); + export_pdu_tap_name_list = g_slist_prepend(export_pdu_tap_name_list, tap_name); + return register_tap(tap_name); } static gint sort_pdu_tap_name_list(gconstpointer a, gconstpointer b) { - return g_strcmp0((const char *)a, (const char*)b); + return g_strcmp0((const char *)a, (const char*)b); } GSList * get_export_pdu_tap_list(void) { - export_pdu_tap_name_list = g_slist_sort(export_pdu_tap_name_list, sort_pdu_tap_name_list); - return export_pdu_tap_name_list; + export_pdu_tap_name_list = g_slist_sort(export_pdu_tap_name_list, sort_pdu_tap_name_list); + return export_pdu_tap_name_list; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/filter_expressions.c b/epan/filter_expressions.c index ab084295d6..9d03213107 100644 --- a/epan/filter_expressions.c +++ b/epan/filter_expressions.c @@ -39,7 +39,7 @@ struct filter_expression **pfilter_expression_head = &_filter_expression_head; */ struct filter_expression * filter_expression_new(const gchar *label, const gchar *expr, - const gboolean enabled) + const gboolean enabled) { struct filter_expression *expression; struct filter_expression *prev; @@ -75,3 +75,16 @@ filter_expression_init(gboolean enable_prefs) if (enable_prefs) prefs.filter_expressions = pfilter_expression_head; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/follow.c b/epan/follow.c index e220eb7025..cd58b71116 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -552,3 +552,16 @@ write_packet_data( int idx, tcp_stream_chunk *sc, const char *data ) bytes_written[idx] += sc->dlen; empty_tcp_stream = FALSE; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/funnel.c b/epan/funnel.c index 1771717945..876f84b57e 100644 --- a/epan/funnel.c +++ b/epan/funnel.c @@ -72,5 +72,15 @@ void funnel_register_all_menus(funnel_registration_cb_t r_cb) { } } - - +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/guid-utils.c b/epan/guid-utils.c index faaf3c9d47..490ebd1a08 100644 --- a/epan/guid-utils.c +++ b/epan/guid-utils.c @@ -192,10 +192,23 @@ guids_resolve_guid_to_str(const e_guid_t *guid) } return ep_strdup_printf("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - guid->data1, guid->data2, guid->data3, - guid->data4[0], guid->data4[1], - guid->data4[2], guid->data4[3], - guid->data4[4], guid->data4[5], - guid->data4[6], guid->data4[7]); + guid->data1, guid->data2, guid->data3, + guid->data4[0], guid->data4[1], + guid->data4[2], guid->data4[3], + guid->data4[4], guid->data4[5], + guid->data4[6], guid->data4[7]); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/h225-persistentdata.c b/epan/h225-persistentdata.c index 2fd882137f..590c041614 100644 --- a/epan/h225-persistentdata.c +++ b/epan/h225-persistentdata.c @@ -146,3 +146,16 @@ h225_init_routine(void) } } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/in_cksum.c b/epan/in_cksum.c index 4d65c0646b..fa645a2985 100644 --- a/epan/in_cksum.c +++ b/epan/in_cksum.c @@ -213,3 +213,16 @@ in_cksum_shouldbe(guint16 sum, guint16 computed_sum) shouldbe = (shouldbe & 0xFFFF) + (shouldbe >> 16); return shouldbe; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/ipv4.c b/epan/ipv4.c index 0862f2b943..3957941eb0 100644 --- a/epan/ipv4.c +++ b/epan/ipv4.c @@ -152,3 +152,16 @@ ipv4_addr_le(const ipv4_addr *a, const ipv4_addr *b) return (val_a <= val_b); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/next_tvb.c b/epan/next_tvb.c index 36cd2ba9db..34aaee5862 100644 --- a/epan/next_tvb.c +++ b/epan/next_tvb.c @@ -122,3 +122,16 @@ void next_tvb_call(next_tvb_list_t *list, packet_info *pinfo, proto_tree *tree, } } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/print.c b/epan/print.c index 95124a5314..afd9431c21 100644 --- a/epan/print.c +++ b/epan/print.c @@ -1849,3 +1849,15 @@ get_field_hex_value(GSList *src_list, field_info *fi) } } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/range.c b/epan/range.c index d023fbd532..05bda35933 100644 --- a/epan/range.c +++ b/epan/range.c @@ -92,7 +92,7 @@ range_convert_str(range_t **rangep, const gchar *es, guint32 max_value) */ convert_ret_t range_convert_str_work(range_t **rangep, const gchar *es, guint32 max_value, - gboolean err_on_max) + gboolean err_on_max) { range_t *range; @@ -105,7 +105,7 @@ range_convert_str_work(range_t **rangep, const gchar *es, guint32 max_value, unsigned long val; if ( (rangep == NULL) || (es == NULL) ) - return CVT_SYNTAX_ERROR; + return CVT_SYNTAX_ERROR; /* Allocate a range; this has room for one subrange. */ range = (range_t *)g_malloc(RANGE_HDR_SIZE + sizeof (range_admin_t)); @@ -123,122 +123,122 @@ range_convert_str_work(range_t **rangep, const gchar *es, guint32 max_value, for (;;) { /* Skip white space. */ while ((c = *p) == ' ' || c == '\t') - p++; + p++; if (c == '\0') - break; + break; /* This must be a subrange. Make sure we have room for it. */ if (range->nranges >= nranges) { - /* Grow the structure. - * 4 is an arbitrarily chosen number. - * We start with 1, under the assumption that people - * will often give a single number or range, and then - * proceed to keep it a multiple of 4. - */ - if (nranges == 1) - nranges = 4; - else - nranges += 4; - range = (range_t *)g_realloc(range, RANGE_HDR_SIZE + - nranges*sizeof (range_admin_t)); + /* Grow the structure. + * 4 is an arbitrarily chosen number. + * We start with 1, under the assumption that people + * will often give a single number or range, and then + * proceed to keep it a multiple of 4. + */ + if (nranges == 1) + nranges = 4; + else + nranges += 4; + range = (range_t *)g_realloc(range, RANGE_HDR_SIZE + + nranges*sizeof (range_admin_t)); } if (c == '-') { - /* Subrange starts with 1. */ - range->ranges[range->nranges].low = 1; + /* Subrange starts with 1. */ + range->ranges[range->nranges].low = 1; } else if (isdigit((unsigned char)c)) { - /* Subrange starts with the specified number */ - errno = 0; - val = strtoul(p, &endp, 10); - if (p == endp) { - /* That wasn't a valid number. */ - g_free(range); - return CVT_SYNTAX_ERROR; - } - if (errno == ERANGE || val > max_value) { - /* That was valid, but it's too big. Return an error if requested - * (e.g., except when reading from the preferences file). - */ - if (err_on_max) { - g_free(range); - return CVT_NUMBER_TOO_BIG; - } else { - /* Silently use the range's maximum value */ - val = max_value; - } - } - p = endp; - range->ranges[range->nranges].low = (guint32)val; - - /* Skip white space. */ - while ((c = *p) == ' ' || c == '\t') - p++; + /* Subrange starts with the specified number */ + errno = 0; + val = strtoul(p, &endp, 10); + if (p == endp) { + /* That wasn't a valid number. */ + g_free(range); + return CVT_SYNTAX_ERROR; + } + if (errno == ERANGE || val > max_value) { + /* That was valid, but it's too big. Return an error if requested + * (e.g., except when reading from the preferences file). + */ + if (err_on_max) { + g_free(range); + return CVT_NUMBER_TOO_BIG; + } else { + /* Silently use the range's maximum value */ + val = max_value; + } + } + p = endp; + range->ranges[range->nranges].low = (guint32)val; + + /* Skip white space. */ + while ((c = *p) == ' ' || c == '\t') + p++; } else { - /* Neither empty nor a number. */ - g_free(range); - return CVT_SYNTAX_ERROR; + /* Neither empty nor a number. */ + g_free(range); + return CVT_SYNTAX_ERROR; } if (c == '-') { - /* There's a hyphen in the range. Skip past it. */ - p++; - - /* Skip white space. */ - while ((c = *p) == ' ' || c == '\t') - p++; - - if (c == ',' || c == '\0') { - /* End of subrange string; that means the subrange ends - * with max_value. - */ - range->ranges[range->nranges].high = max_value; - } else if (isdigit((unsigned char)c)) { - /* Subrange ends with the specified number. */ - errno = 0; - val = strtoul(p, &endp, 10); - if (p == endp) { - /* That wasn't a valid number. */ - g_free(range); - return CVT_SYNTAX_ERROR; - } - if (errno == ERANGE || val > max_value) { - /* That was valid, but it's too big. Return an error if requested - * (e.g., except when reading from the preferences file). - */ - if (err_on_max) { - g_free(range); - return CVT_NUMBER_TOO_BIG; - } else { - /* Silently use the range's maximum value */ - val = max_value; - } - } - p = endp; - range->ranges[range->nranges].high = (guint32)val; - - /* Skip white space. */ - while ((c = *p) == ' ' || c == '\t') - p++; - } else { - /* Neither empty nor a number. */ - g_free(range); - return CVT_SYNTAX_ERROR; - } + /* There's a hyphen in the range. Skip past it. */ + p++; + + /* Skip white space. */ + while ((c = *p) == ' ' || c == '\t') + p++; + + if (c == ',' || c == '\0') { + /* End of subrange string; that means the subrange ends + * with max_value. + */ + range->ranges[range->nranges].high = max_value; + } else if (isdigit((unsigned char)c)) { + /* Subrange ends with the specified number. */ + errno = 0; + val = strtoul(p, &endp, 10); + if (p == endp) { + /* That wasn't a valid number. */ + g_free(range); + return CVT_SYNTAX_ERROR; + } + if (errno == ERANGE || val > max_value) { + /* That was valid, but it's too big. Return an error if requested + * (e.g., except when reading from the preferences file). + */ + if (err_on_max) { + g_free(range); + return CVT_NUMBER_TOO_BIG; + } else { + /* Silently use the range's maximum value */ + val = max_value; + } + } + p = endp; + range->ranges[range->nranges].high = (guint32)val; + + /* Skip white space. */ + while ((c = *p) == ' ' || c == '\t') + p++; + } else { + /* Neither empty nor a number. */ + g_free(range); + return CVT_SYNTAX_ERROR; + } } else if (c == ',' || c == '\0') { - /* End of subrange string; that means there's no hyphen - * in the subrange, so the start and the end are the same. - */ - range->ranges[range->nranges].high = range->ranges[range->nranges].low; + /* End of subrange string; that means there's no hyphen + * in the subrange, so the start and the end are the same. + */ + range->ranges[range->nranges].high = range->ranges[range->nranges].low; } else { - /* Invalid character. */ - g_free(range); - return CVT_SYNTAX_ERROR; + /* Invalid character. */ + g_free(range); + return CVT_SYNTAX_ERROR; } range->nranges++; if (c == ',') { - /* Subrange is followed by a comma; skip it. */ - p++; + /* Subrange is followed by a comma; skip it. */ + p++; } } @@ -248,9 +248,9 @@ range_convert_str_work(range_t **rangep, const gchar *es, guint32 max_value, */ for (i=0; i < range->nranges; i++) { if (range->ranges[i].low > range->ranges[i].high) { - tmp = range->ranges[i].low; - range->ranges[i].low = range->ranges[i].high; - range->ranges[i].high = tmp; + tmp = range->ranges[i].low; + range->ranges[i].low = range->ranges[i].high; + range->ranges[i].high = tmp; } } @@ -276,7 +276,7 @@ value_is_in_range(range_t *range, guint32 val) if (range) { for (i=0; i < range->nranges; i++) { if (val >= range->ranges[i].low && val <= range->ranges[i].high) - return TRUE; + return TRUE; } } return(FALSE); @@ -297,10 +297,10 @@ ranges_are_equal(range_t *a, range_t *b) for (i=0; i < a->nranges; i++) { if (a->ranges[i].low != b->ranges[i].low) - return FALSE; + return FALSE; if (a->ranges[i].high != b->ranges[i].high) - return FALSE; + return FALSE; } return TRUE; @@ -318,7 +318,7 @@ range_foreach(range_t *range, void (*callback)(guint32 val)) if (range && callback) { for (i=0; i < range->nranges; i++) { for (j = range->ranges[i].low; j <= range->ranges[i].high; j++) - callback(j); + callback(j); } } } @@ -367,14 +367,26 @@ range_copy(range_t *src) static void value_is_in_range_check(range_t *range, guint32 val) { - /* Print the result for a given value */ - printf("Function : value_is_in_range_check Number %u\t",val); - - if (value_is_in_range(range, val)) { - printf("is in range\n"); - } else { - printf("is not in range\n"); - } + /* Print the result for a given value */ + printf("Function : value_is_in_range_check Number %u\t",val); + + if (value_is_in_range(range, val)) { + printf("is in range\n"); + } else { + printf("is not in range\n"); + } } #endif +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 3 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=3 tabstop=8 expandtab: + * :indentSize=3:tabSize=8:noTabs=true: + */ diff --git a/epan/reassemble_test.c b/epan/reassemble_test.c index 332efbe8aa..8d9a9b5515 100644 --- a/epan/reassemble_test.c +++ b/epan/reassemble_test.c @@ -1004,9 +1004,9 @@ test_fragment_add_seq_duplicate_conflict(void) static void test_fragment_add_seq_check_work(fragment_head *(*fn)(reassembly_table *, - tvbuff_t *, const int, const packet_info *, - const guint32, const void *, const guint32, - const guint32, const gboolean)) + tvbuff_t *, const int, const packet_info *, + const guint32, const void *, const guint32, + const guint32, const gboolean)) { fragment_head *fd_head; @@ -1574,7 +1574,7 @@ main(int argc _U_, char **argv _U_) for(i=0; i < sizeof(tests)/sizeof(tests[0]); i++ ) { /* re-init the fragment tables */ reassembly_table_init(&test_reassembly_table, - &addresses_reassembly_table_functions); + &addresses_reassembly_table_functions); ASSERT(test_reassembly_table.fragment_table != NULL); ASSERT(test_reassembly_table.reassembled_table != NULL); @@ -1594,3 +1594,16 @@ main(int argc _U_, char **argv _U_) printf(failure?"FAILURE\n":"SUCCESS\n"); return failure; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/reedsolomon.c b/epan/reedsolomon.c index 6fabd3b0bb..a11bd52a28 100644 --- a/epan/reedsolomon.c +++ b/epan/reedsolomon.c @@ -107,21 +107,21 @@ int Pp[MM+1] = { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; #endif #ifdef STANDARD_ORDER /* first byte transmitted is index of x**(KK-1) in message poly*/ - /* definitions used in the encode routine*/ - #define MESSAGE(i) data[KK-(i)-1] - #define REMAINDER(i) bb[NN-KK-(i)-1] - /* definitions used in the decode routine*/ - #define RECEIVED(i) data[NN-1-(i)] - #define ERAS_INDEX(i) (NN-1-eras_pos[i]) - #define INDEX_TO_POS(i) (NN-1-(i)) + /* definitions used in the encode routine*/ + #define MESSAGE(i) data[KK-(i)-1] + #define REMAINDER(i) bb[NN-KK-(i)-1] + /* definitions used in the decode routine*/ + #define RECEIVED(i) data[NN-1-(i)] + #define ERAS_INDEX(i) (NN-1-eras_pos[i]) + #define INDEX_TO_POS(i) (NN-1-(i)) #else /* first byte transmitted is index of x**0 in message polynomial*/ - /* definitions used in the encode routine*/ - #define MESSAGE(i) data[i] - #define REMAINDER(i) bb[i] - /* definitions used in the decode routine*/ - #define RECEIVED(i) data[i] - #define ERAS_INDEX(i) eras_pos[i] - #define INDEX_TO_POS(i) i + /* definitions used in the encode routine*/ + #define MESSAGE(i) data[i] + #define REMAINDER(i) bb[i] + /* definitions used in the decode routine*/ + #define RECEIVED(i) data[i] + #define ERAS_INDEX(i) eras_pos[i] + #define INDEX_TO_POS(i) i #endif @@ -143,7 +143,7 @@ static gf Index_of[NN + 1]; /* No legal value in index form represents zero, so * we need a special value for this purpose */ -#define A0 (NN) +#define A0 (NN) /* Generator polynomial g(x) in index form */ static gf Gg[NN - KK + 1]; @@ -164,21 +164,21 @@ modnn(int x) return x; } -#define min_(a,b) ((a) < (b) ? (a) : (b)) +#define min_(a,b) ((a) < (b) ? (a) : (b)) -#define CLEAR(a,n) {\ +#define CLEAR(a,n) {\ int ci;\ for(ci=(n)-1;ci >=0;ci--)\ (a)[ci] = 0;\ } -#define COPY(a,b,n) {\ +#define COPY(a,b,n) {\ int ci;\ for(ci=(n)-1;ci >=0;ci--)\ (a)[ci] = (b)[ci];\ } -#define COPYDOWN(a,b,n) {\ +#define COPYDOWN(a,b,n) {\ int ci;\ for(ci=(n)-1;ci >=0;ci--)\ (a)[ci] = (b)[ci];\ @@ -214,8 +214,8 @@ gen_ltab(void) taltab[i] = 0; for(j=0;j<8;j++) /* for each column of matrix */ for(k=0;k<8;k++){ /* for each row of matrix */ - if(i & (1<<k)) - taltab[i] ^= tal[7-k] & (1<<j); + if(i & (1<<k)) + taltab[i] ^= tal[7-k] & (1<<j); } tal1tab[taltab[i]] = i; } @@ -279,8 +279,8 @@ generate_gf(void) Index_of[Alpha_to[i]] = i; /* If Pp[i] == 1 then, term @^i occurs in poly-repr of @^MM */ if (Pp[i] != 0) - Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */ - mask <<= 1; /* single left-shift */ + Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */ + mask <<= 1; /* single left-shift */ } Index_of[Alpha_to[MM]] = MM; /* @@ -327,9 +327,9 @@ gen_poly(void) */ for (j = i; j > 0; j--) if (Gg[j] != 0) - Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + (B0 + i) *PRIM)]; + Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + (B0 + i) *PRIM)]; else - Gg[j] = Gg[j - 1]; + Gg[j] = Gg[j - 1]; /* Gg[0] can never be zero */ Gg[0] = Alpha_to[modnn(Index_of[Gg[0]] + (B0 + i) * PRIM)]; } @@ -374,17 +374,17 @@ encode_rs(dtype data[KK], dtype bb[NN-KK]) for(i = KK - 1; i >= 0; i--) { feedback = Index_of[MESSAGE(i) ^ REMAINDER(NN - KK - 1)]; - if (feedback != A0) { /* feedback term is non-zero */ + if (feedback != A0) { /* feedback term is non-zero */ for (j = NN - KK - 1; j > 0; j--) - if (Gg[j] != A0) - REMAINDER(j) = REMAINDER(j - 1) ^ Alpha_to[modnn(Gg[j] + feedback)]; - else - REMAINDER(j) = REMAINDER(j - 1); - REMAINDER(0) = Alpha_to[modnn(Gg[0] + feedback)]; - } else { /* feedback term is zero. encoder becomes a - * single-byte shifter */ + if (Gg[j] != A0) + REMAINDER(j) = REMAINDER(j - 1) ^ Alpha_to[modnn(Gg[j] + feedback)]; + else + REMAINDER(j) = REMAINDER(j - 1); + REMAINDER(0) = Alpha_to[modnn(Gg[0] + feedback)]; + } else { /* feedback term is zero. encoder becomes a + * single-byte shifter */ for (j = NN - KK - 1; j > 0; j--) - REMAINDER(j) = REMAINDER(j - 1); + REMAINDER(j) = REMAINDER(j - 1); REMAINDER(0) = 0; } } @@ -422,8 +422,8 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) int deg_lambda, el, deg_omega; int i, j, r,k; gf u,q,tmp,num1,num2,den,discr_r; - gf lambda[NN-KK + 1], s[NN-KK + 1]; /* Err+Eras Locator poly - * and syndrome poly */ + gf lambda[NN-KK + 1], s[NN-KK + 1]; /* Err+Eras Locator poly + * and syndrome poly */ gf b[NN-KK + 1], t[NN-KK + 1], omega[NN-KK + 1]; gf root[NN-KK], reg[NN-KK + 1], loc[NN-KK]; int syn_error, count; @@ -454,7 +454,7 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) continue; tmp = Index_of[RECEIVED(j)]; - /* s[i] ^= Alpha_to[modnn(tmp + (B0+i-1)*j)]; */ + /* s[i] ^= Alpha_to[modnn(tmp + (B0+i-1)*j)]; */ for(i=1;i<=NN-KK;i++) s[i] ^= Alpha_to[modnn(tmp + (B0+i-1)*PRIM*j)]; } @@ -462,7 +462,7 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) syn_error = 0; for(i=1;i<=NN-KK;i++){ syn_error |= s[i]; - /*printf("syndrome %d = %x\n",i,s[i]);*/ + /*printf("syndrome %d = %x\n",i,s[i]);*/ s[i] = Index_of[s[i]]; } @@ -482,9 +482,9 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) for (i = 1; i < no_eras; i++) { u = modnn(PRIM*ERAS_INDEX(i)); for (j = i+1; j > 0; j--) { - tmp = Index_of[lambda[j - 1]]; - if(tmp != A0) - lambda[j] ^= Alpha_to[modnn(u + tmp)]; + tmp = Index_of[lambda[j - 1]]; + if(tmp != A0) + lambda[j] ^= Alpha_to[modnn(u + tmp)]; } } #if DEBUG >= 1 @@ -498,12 +498,12 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) for (i = 1,k=NN-Ldec; i <= NN; i++,k = modnn(NN+k-Ldec)) { q = 1; for (j = 1; j <= no_eras; j++) - if (reg[j] != A0) { - reg[j] = modnn(reg[j] + j); - q ^= Alpha_to[reg[j]]; - } + if (reg[j] != A0) { + reg[j] = modnn(reg[j] + j); + q ^= Alpha_to[reg[j]]; + } if (q != 0) - continue; + continue; /* store root and error location number indices */ root[count] = i; loc[count] = k; @@ -531,15 +531,15 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) */ r = no_eras; el = no_eras; - while (++r <= NN-KK) { /* r is the step number */ + while (++r <= NN-KK) { /* r is the step number */ /* Compute discrepancy at the r-th step in poly-form */ discr_r = 0; for (i = 0; i < r; i++){ if ((lambda[i] != 0) && (s[r - i] != A0)) { - discr_r ^= Alpha_to[modnn(Index_of[lambda[i]] + s[r - i])]; + discr_r ^= Alpha_to[modnn(Index_of[lambda[i]] + s[r - i])]; } } - discr_r = Index_of[discr_r]; /* Index form */ + discr_r = Index_of[discr_r]; /* Index form */ if (discr_r == A0) { /* 2 lines below: B(x) <-- x*B(x) */ COPYDOWN(&b[1],b,NN-KK); @@ -548,23 +548,23 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) /* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */ t[0] = lambda[0]; for (i = 0 ; i < NN-KK; i++) { - if(b[i] != A0) - t[i+1] = lambda[i+1] ^ Alpha_to[modnn(discr_r + b[i])]; - else - t[i+1] = lambda[i+1]; + if(b[i] != A0) + t[i+1] = lambda[i+1] ^ Alpha_to[modnn(discr_r + b[i])]; + else + t[i+1] = lambda[i+1]; } if (2 * el <= r + no_eras - 1) { - el = r + no_eras - el; - /* - * 2 lines below: B(x) <-- inv(discr_r) * - * lambda(x) - */ - for (i = 0; i <= NN-KK; i++) - b[i] = (lambda[i] == 0) ? A0 : modnn(Index_of[lambda[i]] - discr_r + NN); + el = r + no_eras - el; + /* + * 2 lines below: B(x) <-- inv(discr_r) * + * lambda(x) + */ + for (i = 0; i <= NN-KK; i++) + b[i] = (lambda[i] == 0) ? A0 : modnn(Index_of[lambda[i]] - discr_r + NN); } else { - /* 2 lines below: B(x) <-- x*B(x) */ - COPYDOWN(&b[1],b,NN-KK); - b[0] = A0; + /* 2 lines below: B(x) <-- x*B(x) */ + COPYDOWN(&b[1],b,NN-KK); + b[0] = A0; } COPY(lambda,t,NN-KK+1); } @@ -582,13 +582,13 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) * Search */ COPY(®[1],&lambda[1],NN-KK); - count = 0; /* Number of roots of lambda(x) */ + count = 0; /* Number of roots of lambda(x) */ for (i = 1,k=NN-Ldec; i <= NN; i++,k = modnn(NN+k-Ldec)) { q = 1; for (j = deg_lambda; j > 0; j--){ if (reg[j] != A0) { - reg[j] = modnn(reg[j] + j); - q ^= Alpha_to[reg[j]]; + reg[j] = modnn(reg[j] + j); + q ^= Alpha_to[reg[j]]; } } if (q != 0) @@ -620,7 +620,7 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) j = (deg_lambda < i) ? deg_lambda : i; for(;j >= 0; j--){ if ((s[i + 1 - j] != A0) && (lambda[j] != A0)) - tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])]; + tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])]; } if(tmp != 0) deg_omega = i; @@ -636,7 +636,7 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) num1 = 0; for (i = deg_omega; i >= 0; i--) { if (omega[i] != A0) - num1 ^= Alpha_to[modnn(omega[i] + i * root[j])]; + num1 ^= Alpha_to[modnn(omega[i] + i * root[j])]; } num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)]; den = 0; @@ -644,7 +644,7 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ for (i = min_(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) { if(lambda[i+1] != A0) - den ^= Alpha_to[modnn(lambda[i+1] + i * root[j])]; + den ^= Alpha_to[modnn(lambda[i+1] + i * root[j])]; } if (den == 0) { #if DEBUG >= 1 @@ -661,17 +661,17 @@ eras_dec_rs(dtype data[NN], int eras_pos[NN-KK], int no_eras) } finish: #ifdef CCSDS - /* Convert to dual- basis */ - for(i=0;i<NN;i++) - RECEIVED(i) = taltab[RECEIVED(i)]; + /* Convert to dual- basis */ + for(i=0;i<NN;i++) + RECEIVED(i) = taltab[RECEIVED(i)]; #endif - if(eras_pos != NULL){ - for(i=0;i<count;i++){ + if(eras_pos != NULL){ + for(i=0;i<count;i++){ if(eras_pos!= NULL) - eras_pos[i] = INDEX_TO_POS(loc[i]); - } + eras_pos[i] = INDEX_TO_POS(loc[i]); } - return count; + } + return count; } /* Encoder/decoder initialization - call this first! */ static void @@ -687,3 +687,16 @@ init_rs(void) #endif RS_init = 1; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/show_exception.c b/epan/show_exception.c index 3e9d4bf2c9..7712b1e962 100644 --- a/epan/show_exception.c +++ b/epan/show_exception.c @@ -165,3 +165,16 @@ show_reported_bounds_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvb, 0, 0, "[Malformed Packet: %s]", pinfo->current_proto); expert_add_info(pinfo, item, &ei_malformed); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/sna-utils.c b/epan/sna-utils.c index d1ed3fa446..064d78ce83 100644 --- a/epan/sna-utils.c +++ b/epan/sna-utils.c @@ -33,7 +33,7 @@ gchar * sna_fid_to_str(const address *addr) { - gchar *cur; + gchar *cur; cur=(gchar *)ep_alloc(14); sna_fid_to_str_buf(addr, cur, 14); @@ -62,7 +62,20 @@ sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len) /* FID Type 4 */ memcpy(&sna_fid_type_4_addr, addr->data, SNA_FID_TYPE_4_ADDR_LEN); g_snprintf(buf, buf_len, "%08X.%04X", sna_fid_type_4_addr.saf, - sna_fid_type_4_addr.ef); + sna_fid_type_4_addr.ef); break; } } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/stream.c b/epan/stream.c index 29a6ebbccd..7bf3e3fb48 100644 --- a/epan/stream.c +++ b/epan/stream.c @@ -476,3 +476,16 @@ guint32 stream_get_pdu_no( const stream_pdu_fragment_t *frag) DISSECTOR_ASSERT( frag ); return frag->pdu->pdu_number; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/t35.c b/epan/t35.c index 8614fe77ba..5fa0601166 100644 --- a/epan/t35.c +++ b/epan/t35.c @@ -395,3 +395,15 @@ const value_string H221ManufacturerCode_vals[] = { /* Ref 2 http://www.cix.co.uk/~bpechey/H221/h221code.htm */ /* Ref 3 http://www.regtp.de/reg_tele/start/in_05-06-03-11-00_m/index.html */ +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/tap.c b/epan/tap.c index 8fda9a697b..d2b6fe9183 100644 --- a/epan/tap.c +++ b/epan/tap.c @@ -467,7 +467,7 @@ find_tap_id(const char *name) */ GString * register_tap_listener(const char *tapname, void *tapdata, const char *fstring, - guint flags, tap_reset_cb reset, tap_packet_cb packet, tap_draw_cb draw) + guint flags, tap_reset_cb reset, tap_packet_cb packet, tap_draw_cb draw) { tap_listener_t *tl; int tap_id; @@ -653,3 +653,16 @@ union_of_tap_listener_flags(void) } return flags; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/timestamp.c b/epan/timestamp.c index 1feda0d8e1..f37c44e85a 100644 --- a/epan/timestamp.c +++ b/epan/timestamp.c @@ -63,3 +63,16 @@ void timestamp_set_seconds_type(ts_seconds_type ts_t) { timestamp_seconds_type = ts_t; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/timestats.c b/epan/timestats.c index aef07fff10..399b433119 100644 --- a/epan/timestats.c +++ b/epan/timestats.c @@ -88,3 +88,16 @@ gdouble get_average(const nstime_t *sum, guint32 num) } return average; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/tpg.c b/epan/tpg.c index 001a22a73e..05ae6a4b18 100644 --- a/epan/tpg.c +++ b/epan/tpg.c @@ -55,3 +55,15 @@ extern tpg_parser_data_t* tpg_start(proto_tree* root_tree, return tpg; } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/tvbparse.c b/epan/tvbparse.c index 4a7cba0897..0d3b86de37 100644 --- a/epan/tvbparse.c +++ b/epan/tvbparse.c @@ -1388,3 +1388,15 @@ void tvbparse_tree_add_elem(proto_tree* tree, tvbparse_elem_t* curr) { } } +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ diff --git a/epan/tvbtest.c b/epan/tvbtest.c index 2877e59d1e..0517c204b2 100644 --- a/epan/tvbtest.c +++ b/epan/tvbtest.c @@ -507,3 +507,16 @@ main(void) except_deinit(); exit(failed?1:0); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/tvbuff_base64.c b/epan/tvbuff_base64.c index e2a265b0a0..5ae99091e4 100644 --- a/epan/tvbuff_base64.c +++ b/epan/tvbuff_base64.c @@ -41,3 +41,16 @@ base64_to_tvb(tvbuff_t *parent, const char *base64) return tvb; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/tvbuff_real.c b/epan/tvbuff_real.c index bff0af6030..991cc1c045 100644 --- a/epan/tvbuff_real.c +++ b/epan/tvbuff_real.c @@ -124,3 +124,16 @@ tvb_new_child_real_data(tvbuff_t *parent, const guint8* data, const guint length return tvb; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/tvbuff_zlib.c b/epan/tvbuff_zlib.c index 176e2daf12..6ea50c4b05 100644 --- a/epan/tvbuff_zlib.c +++ b/epan/tvbuff_zlib.c @@ -319,3 +319,16 @@ tvb_child_uncompress(tvbuff_t *parent, tvbuff_t *tvb, const int offset, int comp tvb_set_child_real_data_tvbuff (parent, new_tvb); return new_tvb; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 8 + * tab-width: 8 + * indent-tabs-mode: t + * End: + * + * vi: set shiftwidth=8 tabstop=8 noexpandtab: + * :indentSize=8:tabSize=8:noTabs=false: + */ diff --git a/epan/xdlc.c b/epan/xdlc.c index 982abd4e78..03793ba61f 100644 --- a/epan/xdlc.c +++ b/epan/xdlc.c @@ -142,27 +142,27 @@ get_xdlc_control(const guchar *pd, int offset, gboolean is_extended) case XDLC_S: default: /* - * Supervisory or Information frame. - */ - if (is_extended) - control = pletoh16(&pd[offset]); - else - control = pd[offset]; - break; + * Supervisory or Information frame. + */ + if (is_extended) + control = pletoh16(&pd[offset]); + else + control = pd[offset]; + break; case XDLC_U: - /* - * Unnumbered frame. - * - * XXX - is this two octets, with a P/F bit, in HDLC extended - * operation? It's one octet in LLC, even though the control - * field of I and S frames is a 2-byte extended-operation field - * in LLC. Given that there are no sequence numbers in the - * control field of a U frame, there doesn't appear to be any - * need for it to be 2 bytes in extended operation. - */ - control = pd[offset]; - break; + /* + * Unnumbered frame. + * + * XXX - is this two octets, with a P/F bit, in HDLC extended + * operation? It's one octet in LLC, even though the control + * field of I and S frames is a 2-byte extended-operation field + * in LLC. Given that there are no sequence numbers in the + * control field of a U frame, there doesn't appear to be any + * need for it to be 2 bytes in extended operation. + */ + control = pd[offset]; + break; } return control; } @@ -179,49 +179,49 @@ check_xdlc_control(tvbuff_t *tvb, int offset, guint16 control; if (!tvb_bytes_exist(tvb, offset, 1)) - return FALSE; /* not enough data to check */ + return FALSE; /* not enough data to check */ switch (tvb_get_guint8(tvb, offset) & 0x03) { case XDLC_S: /* - * Supervisory frame. - * No fields to check for validity here. - */ - return TRUE; + * Supervisory frame. + * No fields to check for validity here. + */ + return TRUE; case XDLC_U: - /* - * Unnumbered frame. - * - * XXX - is this two octets, with a P/F bit, in HDLC extended - * operation? It's one octet in LLC, even though the control - * field of I and S frames is a 2-byte extended-operation field - * in LLC. Given that there are no sequence numbers in the - * control field of a U frame, there doesn't appear to be any - * need for it to be 2 bytes in extended operation. - */ - if (u_modifier_short_vals_cmd == NULL) - u_modifier_short_vals_cmd = modifier_short_vals_cmd; - if (u_modifier_short_vals_resp == NULL) - u_modifier_short_vals_resp = modifier_short_vals_resp; - control = tvb_get_guint8(tvb, offset); - if (is_response) { - if (try_val_to_str(control & XDLC_U_MODIFIER_MASK, - u_modifier_short_vals_resp) == NULL) - return FALSE; /* unknown modifier */ - } else { - if (try_val_to_str(control & XDLC_U_MODIFIER_MASK, - u_modifier_short_vals_cmd) == NULL) - return FALSE; /* unknown modifier */ - } - return TRUE; + /* + * Unnumbered frame. + * + * XXX - is this two octets, with a P/F bit, in HDLC extended + * operation? It's one octet in LLC, even though the control + * field of I and S frames is a 2-byte extended-operation field + * in LLC. Given that there are no sequence numbers in the + * control field of a U frame, there doesn't appear to be any + * need for it to be 2 bytes in extended operation. + */ + if (u_modifier_short_vals_cmd == NULL) + u_modifier_short_vals_cmd = modifier_short_vals_cmd; + if (u_modifier_short_vals_resp == NULL) + u_modifier_short_vals_resp = modifier_short_vals_resp; + control = tvb_get_guint8(tvb, offset); + if (is_response) { + if (try_val_to_str(control & XDLC_U_MODIFIER_MASK, + u_modifier_short_vals_resp) == NULL) + return FALSE; /* unknown modifier */ + } else { + if (try_val_to_str(control & XDLC_U_MODIFIER_MASK, + u_modifier_short_vals_cmd) == NULL) + return FALSE; /* unknown modifier */ + } + return TRUE; default: - /* - * Information frame. - * No fields to check for validity here. - */ - return TRUE; + /* + * Information frame. + * No fields to check for validity here. + */ + return TRUE; } } @@ -248,185 +248,198 @@ dissect_xdlc_control(tvbuff_t *tvb, int offset, packet_info *pinfo, case XDLC_S: /* - * Supervisory frame. - */ - if (is_extended) { - control = tvb_get_letohs(tvb, offset); - control_len = 2; - cf_items = cf_items_ext; - control_format = "Control field: %s (0x%04X)"; - } else { - control = tvb_get_guint8(tvb, offset); - control_len = 1; - cf_items = cf_items_nonext; - control_format = "Control field: %s (0x%02X)"; - } - switch (control & XDLC_S_FTYPE_MASK) { - case XDLC_RR: - frame_type = "RR"; - break; + * Supervisory frame. + */ + if (is_extended) { + control = tvb_get_letohs(tvb, offset); + control_len = 2; + cf_items = cf_items_ext; + control_format = "Control field: %s (0x%04X)"; + } else { + control = tvb_get_guint8(tvb, offset); + control_len = 1; + cf_items = cf_items_nonext; + control_format = "Control field: %s (0x%02X)"; + } + switch (control & XDLC_S_FTYPE_MASK) { + case XDLC_RR: + frame_type = "RR"; + break; - case XDLC_RNR: - frame_type = "RNR"; - break; + case XDLC_RNR: + frame_type = "RNR"; + break; - case XDLC_REJ: - frame_type = "REJ"; - break; + case XDLC_REJ: + frame_type = "REJ"; + break; - case XDLC_SREJ: - frame_type = "SREJ"; - break; - } - if (is_extended) { - poll_final = (control & XDLC_P_F_EXT); - g_snprintf(info, 80, "S%s, func=%s, N(R)=%u", - (poll_final ? - (is_response ? " F" : " P") : - ""), - frame_type, - (control & XDLC_N_R_EXT_MASK) >> XDLC_N_R_EXT_SHIFT); - } else { - poll_final = (control & XDLC_P_F); - g_snprintf(info, 80, "S%s, func=%s, N(R)=%u", - (poll_final ? - (is_response ? " F" : " P") : - ""), - frame_type, - (control & XDLC_N_R_MASK) >> XDLC_N_R_SHIFT); - } - if (append_info) { - col_append_str(pinfo->cinfo, COL_INFO, ", "); - col_append_str(pinfo->cinfo, COL_INFO, info); - } else { - col_add_str(pinfo->cinfo, COL_INFO, info); - } - if (xdlc_tree) { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, tvb, - offset, control_len, control, control_format, info, control); - control_tree = proto_item_add_subtree(tc, ett_xdlc_control); - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_n_r, - tvb, offset, control_len, control); - if (poll_final) { - proto_tree_add_boolean(control_tree, - (is_response ? *cf_items->hf_xdlc_f : - *cf_items->hf_xdlc_p), - tvb, offset, control_len, control); - } - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_s_ftype, - tvb, offset, control_len, control); - /* This will always say it's a supervisory frame */ - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_ftype_s_u, - tvb, offset, control_len, control); - } - break; + case XDLC_SREJ: + frame_type = "SREJ"; + break; + } + if (is_extended) { + poll_final = (control & XDLC_P_F_EXT); + g_snprintf(info, 80, "S%s, func=%s, N(R)=%u", + (poll_final ? + (is_response ? " F" : " P") : + ""), + frame_type, + (control & XDLC_N_R_EXT_MASK) >> XDLC_N_R_EXT_SHIFT); + } else { + poll_final = (control & XDLC_P_F); + g_snprintf(info, 80, "S%s, func=%s, N(R)=%u", + (poll_final ? + (is_response ? " F" : " P") : + ""), + frame_type, + (control & XDLC_N_R_MASK) >> XDLC_N_R_SHIFT); + } + if (append_info) { + col_append_str(pinfo->cinfo, COL_INFO, ", "); + col_append_str(pinfo->cinfo, COL_INFO, info); + } else { + col_add_str(pinfo->cinfo, COL_INFO, info); + } + if (xdlc_tree) { + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, tvb, + offset, control_len, control, control_format, info, control); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_n_r, + tvb, offset, control_len, control); + if (poll_final) { + proto_tree_add_boolean(control_tree, + (is_response ? *cf_items->hf_xdlc_f : + *cf_items->hf_xdlc_p), + tvb, offset, control_len, control); + } + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_s_ftype, + tvb, offset, control_len, control); + /* This will always say it's a supervisory frame */ + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_ftype_s_u, + tvb, offset, control_len, control); + } + break; case XDLC_U: - /* - * Unnumbered frame. - * - * XXX - is this two octets, with a P/F bit, in HDLC extended - * operation? It's one octet in LLC, even though the control - * field of I and S frames is a 2-byte extended-operation field - * in LLC. Given that there are no sequence numbers in the - * control field of a U frame, there doesn't appear to be any - * need for it to be 2 bytes in extended operation. - */ - if (u_modifier_short_vals_cmd == NULL) - u_modifier_short_vals_cmd = modifier_short_vals_cmd; - if (u_modifier_short_vals_resp == NULL) - u_modifier_short_vals_resp = modifier_short_vals_resp; - control = tvb_get_guint8(tvb, offset); - control_len = 1; - cf_items = cf_items_nonext; - control_format = "Control field: %s (0x%02X)"; - if (is_response) { - modifier = val_to_str(control & XDLC_U_MODIFIER_MASK, - u_modifier_short_vals_resp, "Unknown"); - } else { - modifier = val_to_str(control & XDLC_U_MODIFIER_MASK, - u_modifier_short_vals_cmd, "Unknown"); - } - poll_final = (control & XDLC_P_F); - g_snprintf(info, 80, "U%s, func=%s", - (poll_final ? - (is_response ? " F" : " P") : - ""), - modifier); - if (append_info) { - col_append_str(pinfo->cinfo, COL_INFO, ", "); - col_append_str(pinfo->cinfo, COL_INFO, info); - } else { - col_add_str(pinfo->cinfo, COL_INFO, info); - } - if (xdlc_tree) { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, tvb, - offset, control_len, control, control_format, info, control); - control_tree = proto_item_add_subtree(tc, ett_xdlc_control); - if (poll_final) { - proto_tree_add_boolean(control_tree, - (is_response ? *cf_items->hf_xdlc_f: - *cf_items->hf_xdlc_p), - tvb, offset, control_len, control); - } - proto_tree_add_uint(control_tree, - (is_response ? *cf_items->hf_xdlc_u_modifier_resp : - *cf_items->hf_xdlc_u_modifier_cmd), - tvb, offset, control_len, control); - /* This will always say it's an unnumbered frame */ - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_ftype_s_u, - tvb, offset, control_len, control); - } - break; + /* + * Unnumbered frame. + * + * XXX - is this two octets, with a P/F bit, in HDLC extended + * operation? It's one octet in LLC, even though the control + * field of I and S frames is a 2-byte extended-operation field + * in LLC. Given that there are no sequence numbers in the + * control field of a U frame, there doesn't appear to be any + * need for it to be 2 bytes in extended operation. + */ + if (u_modifier_short_vals_cmd == NULL) + u_modifier_short_vals_cmd = modifier_short_vals_cmd; + if (u_modifier_short_vals_resp == NULL) + u_modifier_short_vals_resp = modifier_short_vals_resp; + control = tvb_get_guint8(tvb, offset); + control_len = 1; + cf_items = cf_items_nonext; + control_format = "Control field: %s (0x%02X)"; + if (is_response) { + modifier = val_to_str(control & XDLC_U_MODIFIER_MASK, + u_modifier_short_vals_resp, "Unknown"); + } else { + modifier = val_to_str(control & XDLC_U_MODIFIER_MASK, + u_modifier_short_vals_cmd, "Unknown"); + } + poll_final = (control & XDLC_P_F); + g_snprintf(info, 80, "U%s, func=%s", + (poll_final ? + (is_response ? " F" : " P") : + ""), + modifier); + if (append_info) { + col_append_str(pinfo->cinfo, COL_INFO, ", "); + col_append_str(pinfo->cinfo, COL_INFO, info); + } else { + col_add_str(pinfo->cinfo, COL_INFO, info); + } + if (xdlc_tree) { + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, tvb, + offset, control_len, control, control_format, info, control); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); + if (poll_final) { + proto_tree_add_boolean(control_tree, + (is_response ? *cf_items->hf_xdlc_f: + *cf_items->hf_xdlc_p), + tvb, offset, control_len, control); + } + proto_tree_add_uint(control_tree, + (is_response ? *cf_items->hf_xdlc_u_modifier_resp : + *cf_items->hf_xdlc_u_modifier_cmd), + tvb, offset, control_len, control); + /* This will always say it's an unnumbered frame */ + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_ftype_s_u, + tvb, offset, control_len, control); + } + break; default: - /* - * Information frame. - */ - if (is_extended) { - control = tvb_get_letohs(tvb, offset); - control_len = 2; - cf_items = cf_items_ext; - control_format = "Control field: %s (0x%04X)"; - poll_final = (control & XDLC_P_F_EXT); - g_snprintf(info, 80, "I%s, N(R)=%u, N(S)=%u", - ((control & XDLC_P_F_EXT) ? " P" : ""), - (control & XDLC_N_R_EXT_MASK) >> XDLC_N_R_EXT_SHIFT, - (control & XDLC_N_S_EXT_MASK) >> XDLC_N_S_EXT_SHIFT); - } else { - control = tvb_get_guint8(tvb, offset); - control_len = 1; - cf_items = cf_items_nonext; - control_format = "Control field: %s (0x%02X)"; - poll_final = (control & XDLC_P_F); - g_snprintf(info, 80, "I%s, N(R)=%u, N(S)=%u", - ((control & XDLC_P_F) ? " P" : ""), - (control & XDLC_N_R_MASK) >> XDLC_N_R_SHIFT, - (control & XDLC_N_S_MASK) >> XDLC_N_S_SHIFT); - } - if (append_info) { - col_append_str(pinfo->cinfo, COL_INFO, ", "); - col_append_str(pinfo->cinfo, COL_INFO, info); - } else { - col_add_str(pinfo->cinfo, COL_INFO, info); - } - if (xdlc_tree) { - tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, tvb, - offset, control_len, control, control_format, info, control); - control_tree = proto_item_add_subtree(tc, ett_xdlc_control); - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_n_r, - tvb, offset, control_len, control); - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_n_s, - tvb, offset, control_len, control); - if (poll_final) { - proto_tree_add_boolean(control_tree, *cf_items->hf_xdlc_p, - tvb, offset, control_len, control); - } - /* This will always say it's an information frame */ - proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_ftype_i, - tvb, offset, control_len, control); - } - break; + /* + * Information frame. + */ + if (is_extended) { + control = tvb_get_letohs(tvb, offset); + control_len = 2; + cf_items = cf_items_ext; + control_format = "Control field: %s (0x%04X)"; + poll_final = (control & XDLC_P_F_EXT); + g_snprintf(info, 80, "I%s, N(R)=%u, N(S)=%u", + ((control & XDLC_P_F_EXT) ? " P" : ""), + (control & XDLC_N_R_EXT_MASK) >> XDLC_N_R_EXT_SHIFT, + (control & XDLC_N_S_EXT_MASK) >> XDLC_N_S_EXT_SHIFT); + } else { + control = tvb_get_guint8(tvb, offset); + control_len = 1; + cf_items = cf_items_nonext; + control_format = "Control field: %s (0x%02X)"; + poll_final = (control & XDLC_P_F); + g_snprintf(info, 80, "I%s, N(R)=%u, N(S)=%u", + ((control & XDLC_P_F) ? " P" : ""), + (control & XDLC_N_R_MASK) >> XDLC_N_R_SHIFT, + (control & XDLC_N_S_MASK) >> XDLC_N_S_SHIFT); + } + if (append_info) { + col_append_str(pinfo->cinfo, COL_INFO, ", "); + col_append_str(pinfo->cinfo, COL_INFO, info); + } else { + col_add_str(pinfo->cinfo, COL_INFO, info); + } + if (xdlc_tree) { + tc = proto_tree_add_uint_format(xdlc_tree, hf_xdlc_control, tvb, + offset, control_len, control, control_format, info, control); + control_tree = proto_item_add_subtree(tc, ett_xdlc_control); + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_n_r, + tvb, offset, control_len, control); + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_n_s, + tvb, offset, control_len, control); + if (poll_final) { + proto_tree_add_boolean(control_tree, *cf_items->hf_xdlc_p, + tvb, offset, control_len, control); + } + /* This will always say it's an information frame */ + proto_tree_add_uint(control_tree, *cf_items->hf_xdlc_ftype_i, + tvb, offset, control_len, control); + } + break; } return control; } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * Local variables: + * c-basic-offset: 4 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * vi: set shiftwidth=4 tabstop=8 expandtab: + * :indentSize=4:tabSize=8:noTabs=true: + */ |