From Alexis La Goutte:

Add support of TCP Packet Mood (TCP Option 25)
More information is available in RFC 5841

svn path=/trunk/; revision=32498
This commit is contained in:
Jaap Keuter 2010-04-16 19:21:31 +00:00
parent e635180aeb
commit bba09f0284
2 changed files with 59 additions and 0 deletions

View File

@ -2916,6 +2916,7 @@ Alexis La Goutte <alexis.lagoutte [AT] gmail.com> {
Aruba ERM dissector
CAPWAP dissector
Miscellaneous ISAKMP enhancements
Packet TCP Mood Option (RFC5841) support
}
Varun Notibala <nbvarun [AT] gmail.com> {

View File

@ -160,6 +160,8 @@ static int hf_tcp_option_snack_offset = -1;
static int hf_tcp_option_snack_size = -1;
static int hf_tcp_option_snack_le = -1;
static int hf_tcp_option_snack_re = -1;
static int hf_tcp_option_mood = -1;
static int hf_tcp_option_mood_val = -1;
static int hf_tcp_proc_src_uid = -1;
static int hf_tcp_proc_src_pid = -1;
static int hf_tcp_proc_src_uname = -1;
@ -1461,6 +1463,7 @@ print_tcp_fragment_tree(fragment_data *ipfd_head, proto_tree *tree, proto_tree *
#define TCPOPT_SNACK 21 /* SCPS SNACK */
#define TCPOPT_RECBOUND 22 /* SCPS Record Boundary */
#define TCPOPT_CORREXP 23 /* SCPS Corruption Experienced */
#define TCPOPT_MOOD 25 /* RFC5841 TCP Packet Mood */
#define TCPOPT_QS 27 /* RFC4782 */
/*
@ -1482,6 +1485,7 @@ print_tcp_fragment_tree(fragment_data *ipfd_head, proto_tree *tree, proto_tree *
#define TCPOLEN_SNACK 6
#define TCPOLEN_RECBOUND 2
#define TCPOLEN_CORREXP 2
#define TCPOLEN_MOOD_MIN 2
#define TCPOLEN_QS 8
@ -2576,6 +2580,44 @@ dissect_tcpopt_snack(const ip_tcp_opt *optp, tvbuff_t *tvb,
}
}
static void
dissect_tcpopt_mood(const ip_tcp_opt _U_*optp, tvbuff_t *tvb,
int offset, guint optlen, packet_info *pinfo,
proto_tree *opt_tree)
{
/* Mood TCP option, as defined by RFC5841 */
static const string_string mood_type[] = {
{ ":)", "Happy" },
{ ":(", "Sad" },
{ ":D", "Amused" },
{ "%(", "Confused" },
{ ":o", "Bored" },
{ ":O", "Surprised" },
{ ":P", "Silly" },
{ ":@", "Frustrated" },
{ ">:@", "Angry" },
{ ":|", "Apathetic" },
{ ";)", "Sneaky" },
{ ">:)", "Evil" },
{ NULL, NULL }
};
proto_item *hidden_item;
proto_item *mood_item;
gchar *mood;
mood = tvb_get_ephemeral_string(tvb, offset + 2, optlen-2);
hidden_item = proto_tree_add_boolean(opt_tree, hf_tcp_option_mood, tvb, offset+2, optlen-2, TRUE);
PROTO_ITEM_SET_HIDDEN(hidden_item);
mood_item = proto_tree_add_string_format_value(opt_tree, hf_tcp_option_mood_val, tvb, offset+2, optlen-2, mood,"%s (%s)", mood, str_to_str(mood, mood_type, "Unknown") );
tcp_info_append_str(pinfo, "Mood", mood);
expert_add_info_format(pinfo, mood_item, PI_PROTOCOL, PI_NOTE, "The packet Mood is %s (%s) (RFC 5841)", mood, str_to_str(mood, mood_type, "Unknown"));
}
static const ip_tcp_opt tcpopts[] = {
{
TCPOPT_EOL,
@ -2713,6 +2755,14 @@ static const ip_tcp_opt tcpopts[] = {
TCPOLEN_CORREXP,
NULL
},
{
TCPOPT_MOOD,
"Packet Mood",
NULL,
VARIABLE_LENGTH,
TCPOLEN_MOOD_MIN,
dissect_tcpopt_mood
},
{
TCPOPT_QS,
"Quick-Start",
@ -3996,6 +4046,14 @@ proto_register_tcp(void)
"tcp.options.scpsflags.reserved3", FT_BOOLEAN, 8,
TFS(&tfs_set_notset), 0x1, NULL, HFILL }},
{ &hf_tcp_option_mood,
{ "TCP Mood Option", "tcp.options.mood", FT_BOOLEAN,
BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_tcp_option_mood_val,
{ "TCP Mood Option Value", "tcp.options.mood_val", FT_STRING,
BASE_NONE, NULL, 0x0, NULL, HFILL}},
{ &hf_tcp_pdu_time,
{ "Time until the last segment of this PDU", "tcp.pdu.time", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
"How long time has passed until the last frame of this PDU", HFILL}},