void udp_init(void) { log_category_proto_udp_init(); static struct proto_ops const ops = { .parse = udp_parse, .parser_new = mux_parser_new, .parser_del = mux_parser_del, .info_2_str = udp_info_2_str, .info_addr = udp_info_addr }; mux_proto_ctor(&mux_proto_udp, &ops, &mux_proto_ops, "UDP", PROTO_CODE_UDP, sizeof(struct port_key), UDP_HASH_SIZE); port_muxer_list_ctor(&udp_port_muxers, "UDP muxers"); ip_subproto_ctor(&ip_subproto, IPPROTO_UDP, proto_udp); ip6_subproto_ctor(&ip6_subproto, IPPROTO_UDP, proto_udp); // Extension functions to introspect (and modify) port_muxers ext_function_ctor(&sg_udp_ports, "udp-ports", 0, 0, 0, g_udp_ports, "(udp-ports): returns an assoc-list of all defined udp subparsers with their port binding.\n"); ext_function_ctor(&sg_udp_add_port, "udp-add-port", 2, 1, 0, g_udp_add_port, "(udp-add-port \"proto\" port [port-max]): ask TCP to try this proto for this port [range].\n" "See also (? 'udp-del-port)\n"); ext_function_ctor(&sg_udp_del_port, "udp-del-port", 2, 1, 0, g_udp_del_port, "(udp-del-port \"proto\" port [port-max]): ask TCP to stop trying this proto for this port [range].\n" "See also (? 'udp-add-port)"); }
void cap_init(void) { log_category_proto_capture_init(); ext_param_collapse_ifaces_init(); static struct proto_ops const ops = { .parse = cap_parse, .parser_new = mux_parser_new, .parser_del = mux_parser_del, .info_2_str = cap_info_2_str, .info_addr = cap_info_addr, .serialize = cap_serialize, .deserialize = cap_deserialize, }; mux_proto_ctor(&mux_proto_cap, &ops, &mux_proto_ops, "Capture", PROTO_CODE_CAP, sizeof(zero)/* device_id */, 11); }
void eth_init(void) { log_category_proto_eth_init(); ext_param_collapse_vlans_init(); mutex_ctor(ð_subprotos_mutex, "Eth subprotocols"); static struct proto_ops const ops = { .parse = eth_parse, .parser_new = mux_parser_new, .parser_del = mux_parser_del, .info_2_str = eth_info_2_str, .info_addr = eth_info_addr }; mux_proto_ctor(&mux_proto_eth, &ops, &mux_proto_ops, "Ethernet", PROTO_CODE_ETH, sizeof(vlan_unset) /* vlan_id */, 11); LIST_INIT(ð_subprotos); }
void tcp_init(void) { mutex_pool_ctor(&tcp_locks, "TCP subparsers"); log_category_proto_tcp_init(); pkt_wl_config_ctor(&tcp_wl_config, "TCP-reordering", 100000, 20, 100000, 3 /* REORDERING TIMEOUT (second) */, true); static struct proto_ops const ops = { .parse = tcp_parse, .parser_new = mux_parser_new, .parser_del = mux_parser_del, .info_2_str = tcp_info_2_str, .info_addr = tcp_info_addr, .serialize = tcp_serialize, .deserialize = tcp_deserialize, }; static struct mux_proto_ops const mux_ops = { .subparser_new = tcp_subparser_new, .subparser_del = tcp_subparser_del, }; mux_proto_ctor(&mux_proto_tcp, &ops, &mux_ops, "TCP", PROTO_CODE_TCP, sizeof(struct port_key), TCP_HASH_SIZE); port_muxer_list_ctor(&tcp_port_muxers, "TCP muxers"); ip_subproto_ctor(&ip_subproto, IPPROTO_TCP, proto_tcp); ip6_subproto_ctor(&ip6_subproto, IPPROTO_TCP, proto_tcp); // Extension functions to introspect (and modify) port_muxers ext_function_ctor(&sg_tcp_ports, "tcp-ports", 0, 0, 0, g_tcp_ports, "(tcp-ports): returns an assoc-list of all defined tcp subparsers with their port binding.\n"); ext_function_ctor(&sg_tcp_add_port, "tcp-add-port", 2, 1, 0, g_tcp_add_port, "(tcp-add-port \"proto\" port [port-max]): ask TCP to try this proto for this port [range].\n" "See also (? 'tcp-del-port)\n"); ext_function_ctor(&sg_tcp_del_port, "tcp-del-port", 2, 1, 0, g_tcp_del_port, "(tcp-del-port \"proto\" port [port-max]): ask TCP to stop trying this proto for this port [range].\n" "See also (? 'tcp-add-port)"); }