next up previous contents index
Next: 8.2.2 accept: accept a Up: 8.2 oskit_socket: Socket Interface Previous: 8.2 oskit_socket: Socket Interface

8.2.1 oskit_socket_factory_t: socket factories

 

SYNOPSIS

#include <oskit/net/socket.h>

oskit_error_t oskit_socket_factory_create( oskit_socket_factory_t *factory, oskit_u32_t domain, oskit_u32_t type, oskit_u32_t protocol, [out] oskit_socket_t **newsocket);

DESCRIPTION

Socket instances are created by socket factories.

A socket factory is an instance of the oskit_socket_factory COM interface. Implementations of this interface will be provided by the networking stack(s) included in the OSKit. This interface implements a single method corresponding to the socket(2) call in addition to the oskit_iunknown interface.

Each instance of socket has a type and a protocol associated with it. This type and protocol is given to the socket by its factory, and cannot be changed during the lifetime of that socket instance.

PARAMETERS

factory
The socket factory used to create this socket.

domain
The domain parameter specifies a communications domain within which communication will take place; this selects the protocol family which should be used. Some common formats are

OSKIT_PF_LOCAL Host-internal protocols
OSKIT_PF_INET DARPA Internet protocols
OSKIT_PF_ISO ISO protocols
OSKIT_PF_CCITT ITU-T protocols, like X.25
OSKIT_PF_NS Xerox Network Systems protocols

OSKIT_PF_INET is the only format for which the OSKit currently contains an implementation.

type
The socket will have the indicated type, which specifies the semantics of communication. Currently defined types are

OSKIT_SOCK_STREAM stream socket
OSKIT_SOCK_DGRAM datagram socket
OSKIT_SOCK_RAW raw-protocol interface
OSKIT_SOCK_RDM reliably-delivered message
OSKIT_SOCK_SEQPACKET sequenced packet stream

An OSKIT_SOCK_STREAM type provides sequenced, reliable, two-way connection based byte streams. An out-of-band data transmission mechanism may be supported. An OSKIT_SOCK_DGRAM socket supports datagrams (connectionless, unreliable messages of a fixed (typically small) maximum length). An OSKIT_SOCK_SEQPACKET socket may provide a sequenced, reliable, two-way connection-based data transmission path for datagrams of fixed maximum length. OSKIT_SOCK_RAW sockets provide access to internal network protocols and interfaces.

protocol
The protocol specifies a particular protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family. However, it is possible that many protocols may exist, in which case a particular protocol must be specified. The protocol number to use is particular to the communication domain in which communication is to take place.

Protocols for the OSKIT_PF_INET protocol family are defined in oskit/c/netinet/in.h.

newsocket
The new oskit_socket_t instance that was created.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.


next up previous contents index
Next: 8.2.2 accept: accept a Up: 8.2 oskit_socket: Socket Interface Previous: 8.2 oskit_socket: Socket Interface

University of Utah Flux Research Group