mtcp_get_uctx

NAME

mtcp_get_uctx − get private per-flow user-context data

SYNOPSIS

#include <mos_api.h>

int mtcp_get_uctx(mctx_t mctx, int sockid);

DESCRIPTION

mtcp_get_uctx() can be used to retrieve flow-specific monitoring data to a flow record in the application layer. It is generally used in tandem with mtcp_set_uctx(). The flow-specific data is stored with the socket that can referred to by the sockid argument. The private data can be stored as a void *. It is the responsibility of the user to free up the private data (if it is dynamically allocated from memory) when the flow record gets deleted from the stack (due to, e.g., connection termination).

The mtcp_get_uctx() 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 pointer to the private data as void * on success; NULL on failure. In case of failure, errno is set appropriately.

ERRORS

EACCES

mctx is not a valid.

EBADF

sockid is not a valid socket descriptor for binding to an address.

EPERM

The user does not have permission to access the data.

AUTHORS

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

EXAMPLES

http://mos.kaist.edu/guide/programmer/05_api_example.html#saving-and-loading-user-level-metadata

SEE ALSO

mtcp_socket(), mtcp_set_uctx(),

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/.