Prosody SPRT end point: API

The following functions are provided by the Prosody SPRT end point API:

API call W Description
sm_sprt_config()   Configure the SPRT end point using IPv4
sm_sprt_config_data_channel()   Configure which SPRT channel is used for data
sm_sprt_config_data_format()   Configure the SPRT end point data format
sm_sprt_config_ipv6()   Configure the SPRT end point using IPv6
sm_sprt_config_reliable_channel()   Configure the reliable channels of the SPRT end point
sm_sprt_create()   Create an SPRT end point
sm_sprt_datafeed_connect()   Connect a datafeed to an SPRT end point
sm_sprt_destroy()   Destroy an SPRT end point
sm_sprt_get_datafeed()   Obtain a datafeed from a SPRT end point
sm_sprt_get_event()   Get an event for the SPRT end point
sm_sprt_read_message()   Read a message from a SPRT end point
sm_sprt_send_message()   Send a message via a SPRT end point
sm_sprt_status()   Fetch status info on a SPRT end point

This document is also available as separate pages for each function.


Prosody SPRT end point: API: sm_sprt_config

Prototype Definition

int sm_sprt_config(struct sm_sprt_config_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_sprt_config_parms {
	tSMSPRTId sprt;						/* in */
	SOCKADDR_IN dest;					/* in */
	SOCKADDR_IN src;					/* in */
	int payload_type;					/* in */
} SM_SPRT_CONFIG_PARMS;

Description

Configures the destination of the transmitted SPRT packets and the payload type identifier to use in those packets.

Fields

sprt
The SPRT end point to configure.
dest
The SOCKADDR_IN structure specifying the destination IP address and port of the remote SPRT end point. 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.
src
The SOCKADDR_IN structure specifying the source IP address and port of the local SPRT end point. 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. This should match the values returned by the VMP[rx] receiving the SPRT packets.
payload_type
The payload type of the SPRT packets.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_config_data_channel

Prototype Definition

int sm_sprt_config_data_channel(struct sm_sprt_config_data_channel_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_sprt_config_data_channel_parms {
	tSMSPRTId sprt;						/* in */
	int data_channel;					/* in */
	int max_payload_length;					/* in */
	int max_latency;					/* in */
} SM_SPRT_CONFIG_DATA_CHANNEL_PARMS;

Description

Configures the channel used for data by the SPRT end point. The default is channel 3, but can be either 1 or 3.

A packet is filled with the data passed in via the datafeed and is sent when it has reached the max_payload_length or it has had data for max_latency milliseconds.

Fields

sprt
The SPRT end point to configure.
data_channel
The channel to use for data
max_payload_length
The maximum length of the payload on the data channel
max_latency
The data maximum latency

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_config_data_format

Prototype Definition

int sm_sprt_config_data_format(struct sm_sprt_config_data_format_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_sprt_config_data_format_parms {
	tSMSPRTId sprt;						/* in */
	enum kSMSPRTDataDirection {
		kSMSPRTDataDirectionTx,
		kSMSPRTDataDirectionRx,
	} direction;						/* in */
	enum kSMSPRTDataFormat {
		kSMSPRTDataFormatNone,
		kSMSPRTDataFormatIOctet,
		kSMSPRTDataFormatIOctetCS,
		kSMSPRTDataFormatIRawOctet,
	} format;						/* in */
} SM_SPRT_CONFIG_DATA_FORMAT_PARMS;

Description

Configures the data formats used.

Fields

sprt
The SPRT end point to configure.
direction
The data direction to configure One of these values:
kSMSPRTDataDirectionTx
kSMSPRTDataDirectionRx
format
The data format to be used One of these values:
kSMSPRTDataFormatNone
kSMSPRTDataFormatIOctet
kSMSPRTDataFormatIOctetCS
kSMSPRTDataFormatIRawOctet

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_config_ipv6

Prototype Definition

int sm_sprt_config_ipv6(struct sm_sprt_config_ipv6_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_sprt_config_ipv6_parms {
	tSMSPRTId sprt;						/* in */
	SOCKADDR_IN6 dest;					/* in */
	SOCKADDR_IN6 src;					/* in */
	int payload_type;					/* in */
} SM_SPRT_CONFIG_IPV6_PARMS;

Description

Configures the destination of the transmitted SPRT packets and the payload type identifier to use in those packets.

Fields

sprt
The SPRT end point to configure.
dest
The SOCKADDR_IN6 structure specifying the destination IPv6 address and port of the remote SPRT end point. A struct SOCKADDR_IN6 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.
src
The SOCKADDR_IN6 structure specifying the source IPv6 address and port of the local SPRT end point. A struct SOCKADDR_IN6 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. This should match the values returned by the VMP[rx] receiving the SPRT packets.
payload_type
The payload type of the SPRT packets.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_config_reliable_channel

Prototype Definition

int sm_sprt_config_reliable_channel(struct sm_sprt_config_reliable_channel_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_sprt_config_reliable_channel_parms {
	tSMSPRTId sprt;						/* in */
	int channel;						/* in */
	int window_size;					/* in */
	int timer_TA01;						/* in */
	int timer_TA02;						/* in */
	int timer_TR03;						/* in */
} SM_SPRT_CONFIG_RELIABLE_CHANNEL_PARMS;

Description

Configures the settings for one of the reliable SPRT channels. Hence channel must be either 1 or 2.

Fields

sprt
The SPRT end point to configure.
channel
The channel to be configured
window_size
The window size for the channel
timer_TA01
The value for timer TA01 in milliseconds
timer_TA02
The value for timer TA02 in milliseconds
timer_TR03
The value for timer TR03 in milliseconds

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_create

Prototype Definition

int sm_sprt_create(struct sm_sprt_create_parms *createp)

Parameters

*createp
a structure of the following type:
typedef struct sm_sprt_create_parms {
	tSMSPRTId sprt;						/* out */
	tSMModuleId module;					/* in */
} SM_SPRT_CREATE_PARMS;

Description

Creates an SPRT end point.

Fields

sprt
The created SPRT end point.
module
A value obtained from sm_open_module() Indicates the module on which the SPRT end point is to be created.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_datafeed_connect

Prototype Definition

int sm_sprt_datafeed_connect(struct sm_sprt_datafeed_connect_parms *datafeedp)

Parameters

*datafeedp
a structure of the following type:
typedef struct sm_sprt_datafeed_connect_parms {
	tSMDatafeedId data_source;				/* in */
	tSMSPRTId sprt;						/* in */
} SM_SPRT_DATAFEED_CONNECT_PARMS;

Description

Connects a datafeed to a SPRT end point.

Requires the module datafeed to have been downloaded.

Fields

data_source
The datafeed acting as a source of data
sprt
The SPRT end point that will receive the data

Returns

0 if call completed successfully, otherwise a standard error.


Prosody SPRT end point: API: sm_sprt_destroy

Prototype Definition

int sm_sprt_destroy(tSMSPRTId sprt)

Parameters

sprt
The SPRT end point to destroy. Must have been previously created by a call to sm_sprt_create().

Description

Destroys an SPRT end point.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_get_datafeed

Prototype Definition

int sm_sprt_get_datafeed(struct sm_sprt_get_datafeed_parms *datafeedp)

Parameters

*datafeedp
a structure of the following type:
typedef struct sm_sprt_get_datafeed_parms {
	tSMSPRTId sprt;						/* in */
	tSMDatafeedId datafeed;					/* out */
} SM_SPRT_GET_DATAFEED_PARMS;

Description

Request a datafeed identifier from a SPRT end point. It is valid until the SPRT end point is destroyed. Datafeed connections can only be made between objects allocated on the same tSMModuleId.

Requires the module datafeed to have been downloaded.

Fields

sprt
The SPRT end point from which to obtain a datafeed
datafeed
The datafeed object associated with the output channel

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_get_event

Prototype Definition

int sm_sprt_get_event(struct sm_sprt_get_event_parms *eventp)

Parameters

*eventp
a structure of the following type:
typedef struct sm_sprt_get_event_parms {
	tSMSPRTId sprt;						/* in */
	tSMEventId event;					/* out */
} SM_SPRT_GET_EVENT_PARMS;

Description

the event will be signalled when a status change occurs on the SPRT end point.

Fields

sprt
The SPRT end point.
event
The event identifier

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_read_message

Prototype Definition

int sm_sprt_read_message(struct sm_sprt_read_message_parms *datafeedp)

Parameters

*datafeedp
a structure of the following type:
typedef struct sm_sprt_read_message_parms {
	tSMSPRTId sprt;						/* in */
	char *message;						/* inout */
	int max_length;						/* in */
	int length;						/* out */
} SM_SPRT_READ_MESSAGE_PARMS;

Description

Reads a message from a SPRT end point

Fields

sprt
The SPRT end point from which to read the message
message
A pointer to the buffer to store the read message
max_length
The maximum length of the message data
length
The length of the message data

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_send_message

Prototype Definition

int sm_sprt_send_message(struct sm_sprt_send_message_parms *datafeedp)

Parameters

*datafeedp
a structure of the following type:
typedef struct sm_sprt_send_message_parms {
	tSMSPRTId sprt;						/* in */
	char *message;						/* in */
	int length;						/* in */
} SM_SPRT_SEND_MESSAGE_PARMS;

Description

Send a SPRT packet with the message data as the payload

Fields

sprt
The SPRT end point from which to send the message
message
A pointer to the message to be sent
length
The length of the message data

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody SPRT end point: API: sm_sprt_status

Prototype Definition

int sm_sprt_status(struct sm_sprt_status_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct sm_sprt_status_parms {
	tSMSPRTId sprt;						/* in */
	enum kSMSPRTStatus {
		kSMSPRTStatusRunning,
		kSMSPRTStatusStopped,
		kSMSPRTStatusMessage,
	} status;						/* out */
} SM_SPRT_STATUS_PARMS;

Description

returns the status of the SPRT end point.

Fields

sprt
The SPRT end point.
status
The status. One of these values:
kSMSPRTStatusRunning
The SPRT end point is running
kSMSPRTStatusStopped
The SPRT end point is not running
kSMSPRTStatusMessage
The SPRT end point has a message to be read

Returns

0 if call completed successfully, otherwise a standard error such as:


These functions constitute the Prosody SPRT end point API.