|Skip Navigation Links|
|Exit Print View|
|man pages section 9: DDI and DKI Driver Entry Points Oracle Solaris 11.1 Information Library|
- filter incoming and outgoing data
#include <sys/sockfilter.h> mblk_t *prefix_data_in(sof_handle_t hdl, void *cookie, mblk_t *mp);
mblk_t *prefix_data_in_proc(sof_handle_t hdl, void *cookie, mblk_t *mp, cred_t *cr);
mblk_t *prefix_data_out(sof_handle_t hdl, void *cookie, mblk_t *mp, cred_t *cr, sof_rval_t *rvalp);
per-socket filter handle
per-socket filter-private data
pointer to the user credential structure for the operation
pointer to msgb(9S) chain
pointer to msghdr structure
result parameter, modified on return to give reason for operation failure
The sofop_data_in() entry point is called when data is received, but before the data is placed in the socket's receive buffer. sofop_data_in() may be called from the protocol data path, and the filter should perform minimum amount of processing to minimize the performance impact. Intensive data operations should be performed by sofop_data_in_proc(), if possible.
The sofop_data_in_proc() entry point is called before data is copied out from the socket's receive buffer.
The sofop_data_out() entry point is called before data is passed to the protocol for transmission. The filter can directly modify the content of the address and control buffers pointed to by the message header. If the buffers provided by the message header are insufficient, then the filter can return a control message block as described below.
The message chain passed to sofop_data_in(), sofop_data_in_proc(), and sofop_data_out() consist of one or more message blocks, linked together via b_cont. For sofop_data_in() and sofop_data_in_proc(), the first message block may be of a type other than M_DATA, indicating that control and/or address information may be present, and accessible via sof_mblk_msghdr(9F). In-place modification of a message block is only allowed if db_ref is 1 (see datab(9S)).
Returning a message chain resumes the data operation. The first message block may contain control and/or address information, which can be constructed from a message header structure using sof_mblk_create(9F). The filter can return NULL, which ends the data operation. It is the filter's responsibility to free any message blocks that are not returned to the framework.
The sofop_data_in(), sofop_data_in_proc(), and sofop_data_out() entry points return a message block chain on success and NULL if the original message was consumed or if an error occurred. If sofop_data_out() returns NULL, then rvalp must be set to one of the following:
An argument was invalid.
There was insufficient memory for the operation to complete.
Permission was denied.
The filter satisfied the request.
The sofop_data_in(), sofop_data_in_proc(), and sofop_data_out() entry points can be called from kernel or user context. The sofop_data_in() entry point can also be called from interrupt context.
See attributes(5) for descriptions of the following attributes: