コード例 #1
0
ファイル: packet-xmpp-core.c プロジェクト: pvons/wireshark
void
xmpp_init_parsers(void)
{
    tvbparse_wanted_t *want_name;
    tvbparse_wanted_t *want_stream_end;

    want_name = tvbparse_chars(2,1,0,"abcdefghijklmnopqrstuvwxyz.-_ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",NULL,NULL,NULL);

    want_stream_end_with_ns = tvbparse_set_seq(3, NULL, NULL, NULL,
                                               want_name,
                                               tvbparse_char(4, ":", NULL, NULL, NULL),
                                               want_name,
                                               NULL);

    want_stream_end = tvbparse_set_oneof(5, NULL, NULL, NULL,
                                         want_stream_end_with_ns,
                                         want_name,
                                         NULL);

    want_ignore = tvbparse_chars(1,1,0," \t\r\n",NULL,NULL,NULL);

    want_stream_end_tag = tvbparse_set_seq(6, NULL, NULL, NULL,
                                           tvbparse_string(-1,"</",NULL,NULL,NULL),
                                           want_stream_end,
                                           tvbparse_char(-1,">",NULL,NULL,NULL),
                                           NULL);
}
コード例 #2
0
/*
 * Initialize tvb-parser, which is used to dissect data part of NTP control
 * messages
 *
 * Here some constants are defined, which describes character groups used for
 * various purposes. These groups are then used to configure the two global
 * variables "want_ignore" and "want" that we use for dissection
 */
static void
init_parser(void)
{
	/* specify what counts as character */
	tvbparse_wanted_t* want_identifier = tvbparse_chars(-1, 1, 0,
		"abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789", NULL, NULL, NULL);
	/* this is the equal sign used in assignments */
	tvbparse_wanted_t* want_equalsign = tvbparse_chars(-1, 1, 0, "=", NULL, NULL, NULL);
	/* possible characters allowed for values */
	tvbparse_wanted_t* want_value = tvbparse_set_oneof(0, NULL, NULL, NULL,
		tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\"', '\\'),
		tvbparse_quoted(-1, NULL, NULL, tvbparse_shrink_token_cb, '\'', '\\'),
		tvbparse_chars(-1, 1, 0, "abcdefghijklmnopqrstuvwxyz-_ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789 ", NULL, NULL, NULL),
		NULL);
	/* the following specifies an assignment of the form identifier=value */
	tvbparse_wanted_t* want_assignment = tvbparse_set_seq(-1, NULL, NULL, NULL,
		want_identifier,
		want_equalsign,
		want_value,
		NULL);

	/* we ignore white space characters */
	want_ignore = tvbparse_chars(-1, 1, 0, ", \t\r\n", NULL, NULL, NULL);
	/* data part of control messages consists of either identifiers or assignments */
	want = tvbparse_set_oneof(-1, NULL, NULL, NULL,
		want_assignment,
		want_identifier,
		NULL);
}
コード例 #3
0
ファイル: packet-gdb.c プロジェクト: Ekleog/wireshark
static void init_gdb_parser(void) {
    tvbparse_wanted_t *want_ack;
    tvbparse_wanted_t *want_start;
    tvbparse_wanted_t *want_payload;
    tvbparse_wanted_t *want_end;
    tvbparse_wanted_t *want_chksum;

    want_ack = tvbparse_chars(-1, 1, 1, "+-",
            GUINT_TO_POINTER(GDB_TOK_ACK), NULL, dissect_gdb_token);
    want_start = tvbparse_chars(-1, 1, 1, "$",
            GUINT_TO_POINTER(GDB_TOK_START), NULL, dissect_gdb_token);
    want_payload = tvbparse_not_chars(-1, 1, 0, "$#",
            GUINT_TO_POINTER(GDB_TOK_PAYLOAD), NULL, dissect_gdb_token);
    want_end = tvbparse_chars(-1, 1, 1, "#",
            GUINT_TO_POINTER(GDB_TOK_END), NULL, dissect_gdb_token);
    want_chksum = tvbparse_chars(-1, 2, 2, "0123456789abcdefABCDEF",
            GUINT_TO_POINTER(GDB_TOK_CHKSUM), NULL, dissect_gdb_token);

    want = tvbparse_set_seq(-1, NULL, NULL, NULL,
            tvbparse_some(-1, 0, 1, NULL, NULL, NULL, want_ack),
            want_start, want_payload, want_end, want_chksum, NULL);
}