mtcp_bind_monitor_filter

NAME

mtcp_bind_monitor_filter − Bind a monitoring socket to a connection filter

SYNOPSIS

#include <mos_api.h>

int mtcp_bind_monitor_filter(mctx_t mctx, int sockid, monitor_filter_t buf);

DESCRIPTION

mtcp_bind_monitor_filter() can be used bind an mTCP socket via socket descriptor sockid to filter only that traffic that the user is interested to examine. The monitoring filter is expressed as a union defined below:

union monitor_filter {

    char *raw_pkt_filter; // for MOS_SOCK_MONITOR_RAW sockets

    struct { // for MOS_SOCK_MONITOR_STREAM sockets

        char *stream_syn_filter;

        char *stream_orphan_filter;

    };

}

The user can apply BPF filters specific to the socket type. raw_pkt_filter can be applied for MOS_SOCK_MONITOR_RAW sockets (general IP traffic). stream_syn_filter can be used for those connections that observe a complete 3-way connection handshake. stream_orphan_filter is used for TCP traffic that have no connection initiation records inside mOS.

An mtcp_bind_monitor_filter() call takes an additional argument named mctx that represents the per-core mTCP context in an application (see mtcp_create_context() for details).

RETURN VALUE

Returns 0 on success; -1 on failure and errno is set appropriately. It is not an error if the filter passed is NULL.

ERRORS

EACCES

mctx is invalid.

EBADF

The socket descriptor sockid is invalid.

EINVAL

The filter expression ft is not valid.

ENOPROTOOPT

The socket referred to by sockid has invalid type

AUTHORS

mOS development team <mtcp-user@list.ndsl.kaist.edu>

EXAMPLES

http://mos.kaist.edu/guide/programmer/05_api_example.html#per-core-initialization-routine

SEE ALSO

mtcp_socket(), mtcp_register_callback(), mtcp_bind(),

COLOPHON

This page is part of mOS release 0.3 docs section. A description of the project, and information about reporting bugs, can be found at http://mos.kaist.edu/.