Example #1
0
static int pg_parser_ctor(struct pgsql_parser *pg_parser, struct proto *proto)
{
    assert(proto == proto_pgsql);
    if (0 != parser_ctor(&pg_parser->parser, proto)) return -1;
    pg_parser->phase = NONE;
    pg_parser->c2s_way = UNSET;    // unset
    if (0 != streambuf_ctor(&pg_parser->sbuf, pg_sbuf_parse, 30000)) return -1;

    return 0;
}
Example #2
0
static int tns_parser_ctor(struct tns_parser *tns_parser, struct proto *proto)
{
    assert(proto == proto_tns);
    if (0 != parser_ctor(&tns_parser->parser, proto)) return -1;
    tns_parser->c2s_way = UNSET;    // unset
    tns_parser->nb_fields = UNSET;
    tns_parser->msg_type = SQL_UNKNOWN;
    if (0 != streambuf_ctor(&tns_parser->sbuf, tns_sbuf_parse, 30000, NULL)) return -1;

    return 0;
}
Example #3
0
static int skinny_parser_ctor(struct skinny_parser *skinny_parser, struct proto *proto)
{
    SLOG(LOG_DEBUG, "Construct SKINNY parser@%p", skinny_parser);

    assert(proto == proto_skinny);
    if (0 != parser_ctor(&skinny_parser->parser, proto)) return -1;
#   define SKINNY_MAX_HDR_SIZE 1000   // in bytes
    if (0 != streambuf_ctor(&skinny_parser->sbuf, skinny_sbuf_parse, SKINNY_MAX_HDR_SIZE, NULL)) return -1;

    return 0;
}
Example #4
0
static int netbios_parser_ctor(struct netbios_parser *netbios_parser, struct proto *proto)
{
    SLOG(LOG_DEBUG, "Constructing netbios_parser@%p", netbios_parser);
    assert(proto == proto_netbios);
    if (0 != parser_ctor(&netbios_parser->parser, proto)) return -1;
    netbios_parser->msg_parser = NULL;
    timeval_reset(&netbios_parser->first_packet_tv[0]);
    timeval_reset(&netbios_parser->first_packet_tv[1]);
    if (0 != streambuf_ctor(&netbios_parser->sbuf, netbios_sbuf_parse, 30000, NULL)) {
        parser_dtor(&netbios_parser->parser);
        return -1;
    }
    return 0;
}
Example #5
0
static int tds_parser_ctor(struct tds_parser *tds_parser, struct proto *proto)
{
    SLOG(LOG_DEBUG, "Constructing tds_parser@%p", tds_parser);
    assert(proto == proto_tds);
    if (0 != parser_ctor(&tds_parser->parser, proto)) return -1;
    tds_parser->msg_parser = NULL;
    tds_parser->had_gap = false;
    tds_parser->data_left = 0;
    tds_parser->channels[0] = 0;
    tds_parser->channels[1] = 0;
    tds_parser->pkt_number = 1;
    if (0 != streambuf_ctor(&tds_parser->sbuf, tds_sbuf_parse, 30000, NULL)) return -1;

    return 0;
}