Prosody generic: API: sm_udp_dispatcher_create
Prototype Definition
int sm_udp_dispatcher_create(struct sm_udp_dispatcher_create_parms *dp)
Parameters
- *dp
-
a structure of the following type:
typedef struct sm_udp_dispatcher_create_parms {
tSMDispatcherId dispatcher; /* out */
tSMModuleId module; /* in */
SOCKADDR_IN destination; /* in */
SOCKADDR_IN source; /* in */
int TOS; /* in */
} SM_UDP_DISPATCHER_CREATE_PARMS;
Description
Allocates, on a specific module, a new UDP dispatcher
to transmit data. If the call completes
successfully, the parameter
dispatcher
will be set to the identifier for that dispatcher.
This requires the module
toudp
to have been downloaded.
Fields
- dispatcher
- The newly created dispatcher.
- module
- A value obtained from
sm_open_module()
which indicates the module where the dispatcher to be allocated.
- destination
- The SOCKADDR_IN structure specifying the destination IP address
and port for the UDP stream. A struct SOCKADDR_IN must be
configured with an address family, an IP address and a port.
Note that most operating systems define this structure such that
fields are in network byte order.
The structure must be correctly cast such that an IP V4
address is specified.
- source
- The SOCKADDR_IN structure allows you to specify the source IP
address and port for the UDP stream. A struct SOCKADDR_IN must
be configured with an address family. The IP address may be
specified, or the value INADDR_ANY may be used to indicate
that any suitable address may be used. The port number may be
specified, or the value zero may be used to indicate that a
suitable port number is to be automatically allocated and
used.
Note that most operating systems define this structure such that
fields are in network byte order.
The structure must be correctly cast such that an IP V4
address is specified.
- TOS
- The Type Of Service (TOS) indicator to be sent in the UDP packets
Returns
0
if call completed successfully, otherwise a standard error such as:
- ERR_SM_DEVERR - device error
This function is part of the Prosody generic API.