raw_usrreq Kernel Service

Purpose

Implements user requests for raw protocols.

Syntax

#include <sys/types.h>
#include <sys/errno.h>

void raw_usrreq (so, req, m, nam, control)
struct  socket * so;
int  req;
struct  mbuf * m;
struct  mbuf * nam;
struct  mbuf * control;

Parameters

Item Description
so Identifies the address of a raw socket.
req Specifies the request command.
m Specifies the address of an mbuf structure containing data.
nam Specifies the address of an mbuf structure containing the sockaddr structure.
control This parameter should be set to a null value.

Description

The raw_usrreq kernel service implements user requests for the raw protocol.

The raw_usrreq service supports the following commands:

Command Description
PRU_ABORT Aborts (fast DISCONNECT, DETACH).
PRU_ACCEPT Accepts connection from peer.
PRU_ATTACH Attaches protocol to up.
PRU_BIND Binds socket to address.
PRU_CONNECT Establishes connection to peer.
PRU_CONNECT2 Connects two sockets.
PRU_CONTROL Controls operations on protocol.
PRU_DETACH Detaches protocol from up.
PRU_DISCONNECT Disconnects from peer.
PRU_LISTEN Listens for connection.
PRU_PEERADDR Fetches peer's address.
PRU_RCVD Have taken data; more room now.
PRU_RCVOOB Retrieves out of band data.
PRU_SEND Sends this data.
PRU_SENDOOB Sends out of band data.
PRU_SENSE Returns status into m.
PRU_SOCKADDR Fetches socket's address.
PRU_SHUTDOWN Will not send any more data.

Any unrecognized command causes the panic kernel service to be called.

Execution Environment

The raw_userreq kernel service can be called from either the process or interrupt environment.

Return Values

Item Description
EOPNOTSUPP Indicates an unsupported command.
EINVAL Indicates a parameter error.
EACCES Indicates insufficient authority to support the PRU_ATTACH command.
ENOTCONN Indicates an attempt to detach when not attached.
EISCONN Indicates that the caller tried to connect while already connected.