aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.c
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2009-06-16 03:16:55 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2009-06-16 03:16:55 +0000
commit41905e01c0ebba93a75348bff39daaf87e0063e1 (patch)
treee1d560ce99307cf69fe1a2ee7254fcb971d856ec /wiretap/wtap.c
parent8d38e56b2225b6337d540eeb9d82d69f79131165 (diff)
Support per packet dumping in wtap_encap_string() and wtap_encap_short_string().
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28752 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r--wiretap/wtap.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 976dacccdc..49449000d9 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -91,7 +91,7 @@ struct encap_type_info {
static struct encap_type_info encap_table_base[] = {
/* WTAP_ENCAP_UNKNOWN */
- { "Unknown", NULL },
+ { "Unknown", "unknown" },
/* WTAP_ENCAP_ETHERNET */
{ "Ethernet", "ether" },
@@ -489,8 +489,10 @@ int wtap_register_encap_type(char* name, char* short_name) {
const char
*wtap_encap_string(int encap)
{
- if (encap < 0 || encap >= WTAP_NUM_ENCAP_TYPES)
- return NULL;
+ if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
+ return "Illegal";
+ else if (encap == WTAP_ENCAP_PER_PACKET)
+ return "Per packet";
else
return encap_table[encap].name;
}
@@ -499,8 +501,10 @@ const char
const char
*wtap_encap_short_string(int encap)
{
- if (encap < 0 || encap >= WTAP_NUM_ENCAP_TYPES)
- return NULL;
+ if (encap < WTAP_ENCAP_PER_PACKET || encap >= WTAP_NUM_ENCAP_TYPES)
+ return "illegal";
+ else if (encap == WTAP_ENCAP_PER_PACKET)
+ return "per-packet";
else
return encap_table[encap].short_name;
}