The following interfaces must be registered by the application to provide I/O related functionalities to the stack. The interfaces act on a connection object that is defined by the application and transparent to the stack. The application registers these interfaces for the stack to work with the connection object. The connection object is application defined, but the stack requires that the first member of the connection object is a void *, which is used by the stack to store connection object specific information that is private to the stack.
int (*sip_conn_send)(const sip_conn_object_t, char *, int);
This function will be invoked by the stack after processing an outbound SIP message. This function will actually send the SIP message to the remote endpoint. A return of 0 indicates success. The SIP message is passed to this function a string along with the length information.
void (*sip_hold_conn_object)(sip_conn_object_t); void (*sip_hold_conn_object)(sip_conn_object_t);
The application provides mechanism for the stack to indicate that a connection object is in use by the stack and must not be freed. The stack calls the sip_hold_conn_object() function to increment the reference count on a connection object and the sip_hold_conn_object() function to release it after use. The stack expects that the application won't free the connection object if the application increments the references to that connection object.
boolean_t (*sip_conn_is_stream)(sip_conn_object_t); boolean_t (*sip_conn_is_reliable)(sip_conn_object_t);
These interfaces are used by the stack to obtain attributes of the connection object. The sip_conn_is_stream() function states if the connection object is byte-stream oriented (TCP) or not (SCTP and UDP) and the sip_conn_is_reliable() function indicates if the transport is reliable (TCP and SCTP) or not (UDP).
int (*sip_conn_local_address)(sip_conn_object_t, struct sockaddr *, socklen_t *); int (*sip_conn_remote_address)(sip_conn_object_t, struct sockaddr *, socklen_t *);
These two interfaces are used by the stack to obtain endpoint information for a connection object. The sip_conn_local_address() function provides the local address/port information while the sip_conn_remote_address() function provides the peer's address/port information. The caller allocates the buffer and passes its associated length along with it. On return the length is updated to reflect the actual length.
This interface is used to obtain the transport used by a connection object (TCP, SCTP or UDP).
int (*sip_conn_timer1)(sip_conn_object_t); int (*sip_conn_timer2)(sip_conn_object_t); int (*sip_conn_timer4)(sip_conn_object_t); int (*sip_conn_timerd)(sip_conn_object_t);
These four interfaces may be registered by an application to provide connection object specific timer information. If these are not registered the stack uses default values. The interfaces provide the timer values for Timer 1 (RTT estimate - default 500 msec, Timer 2 (maximum retransmit interval for non-INVITE request and INVITE response - default 4 secs), Timer 4 (maximum duration a message will remain in the network - default 5 secs) and Timer D (wait time for response retransmit interval - default 32 secs).