tport_internal.h File Reference


Detailed Description

Transport interface.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>
Date:
Created: Thu Jun 29 15:58:06 2000 ppessi

#include <sofia-sip/su.h>
#include <sofia-sip/su_uniqueid.h>
#include <sofia-sip/msg_addr.h>
#include <sofia-sip/tport_plugins.h>
#include <sofia-sip/su_debug.h>
#include <sofia-sip/tport.h>

Include dependency graph for tport_internal.h:

Go to the source code of this file.

Data Structures

struct  tport_params_t
 Transport parameters. More...
struct  tport_s
 Transport object. More...
struct  tport_primary
 Primary structure. More...
struct  tport_master
 Master structure. More...
struct  tport_vtable
 Virtual funtion table for transports. More...

Functions

int tport_register_type (tport_vtable_t const *vtp)
 Register new transport vtable.
int tport_is_connection_oriented (tport_t const *self)
 Test if transport is needs connect() before sending.
int tport_has_connection (tport_t const *self)
 Test if transport involves connection.
void tport_has_been_updated (tport_t *tport)
 Indicate stack that a transport has been updated.
void tport_set_tos (su_socket_t socket, su_addrinfo_t *ai, int tos)
 Set IP TOS for socket.
tport_t * tport_base_connect (tport_primary_t *pri, su_addrinfo_t *ai, su_addrinfo_t *name, tp_name_t const *tpn)
 Create a connected transport object with socket.
tport_t * tport_alloc_secondary (tport_primary_t *pri, int socket, int accepted, char const **return_reason)
 Allocate a secondary transport.
int tport_accept (tport_primary_t *pri, int events)
 Accept a new connection.
void tport_zap_secondary (tport_t *self)
 Destroy a secondary transport.
void tport_close (tport_t *self)
 Close a transport.
int tport_error_event (tport_t *self)
 Process error event.
void tport_recv_event (tport_t *self)
 Process "ready to receive" event.
void tport_send_event (tport_t *self)
 Send event.
void tport_hup_event (tport_t *self)
 Process "hangup" event.
ssize_t tport_recv_iovec (tport_t const *self, msg_t **mmsg, msg_iovec_t iovec[msg_n_fragments], size_t N, int exact)
 Allocate message for N bytes, return message buffer as a iovec.
msg_ttport_msg_alloc (tport_t const *self, usize_t size)
 Allocate a new message object.
int tport_send_msg (tport_t *self, msg_t *msg, tp_name_t const *tpn, struct sigcomp_compartment *cc)
 Send a message.
void tport_deliver (tport_t *self, msg_t *msg, msg_t *next, tport_compressor_t *comp, su_time_t now)
 Deliver message to the protocol stack.
void tport_base_deliver (tport_t *self, msg_t *msg, su_time_t now)
 Pass message to the protocol stack.
void tport_error_report (tport_t *self, int errcode, su_sockaddr_t const *addr)
 Process errors from transport.
void tport_open_log (tport_master_t *mr, tagi_t *tags)
 Initialize logging.
void tport_log_msg (tport_t *tp, msg_t *msg, char const *what, char const *via, su_time_t now)
 Log the message.
void tport_dump_iovec (tport_t const *self, msg_t *msg, size_t n, su_iovec_t const iov[], size_t iovused, char const *what, char const *how)
 Dump the data from the iovec.
int tport_recv_dgram (tport_t *self)
 Receive datagram.
ssize_t tport_send_dgram (tport_t const *self, msg_t *msg, msg_iovec_t iov[], size_t iovused)
 Send using su_vsend().
int tport_udp_error (tport_t const *self, su_sockaddr_t name[1])
 Process UDP error event.
int tport_recv_stream (tport_t *self)
 Receive from stream.
int tport_init_stun_server (tport_master_t *mr, tagi_t const *tags)
 Initialize stun server.
void tport_deinit_stun_server (tport_master_t *mr)
 Deinit stun server.
int tport_recv_stun_dgram (tport_t const *self, msg_t **in_out_msg, su_sockaddr_t *from, socklen_t fromlen)
 Process stun messagee.
char const * tport_canonize_comp (char const *comp)
 Canonize compression string.
void tport_sigcomp_accept_incomplete (tport_t *self, msg_t *msg)
 This function is called when the application message is still incomplete but a complete SigComp message could have been received.
int tport_recv_comp_dgram (tport_t const *self, tport_compressor_t *sc, msg_t **in_out_msg, su_sockaddr_t *from, socklen_t fromlen)
 Receive data from datagram using SigComp.


Function Documentation

int tport_accept ( tport_primary_t pri,
int  events 
)

Accept a new connection.

The function tport_accept() accepts a new connection and creates a secondary transport object for the new socket.

tport_t* tport_base_connect ( tport_primary_t pri,
su_addrinfo_t *  ai,
su_addrinfo_t *  real_ai,
tp_name_t const *  tpn 
)

Create a connected transport object with socket.

The function tport_connect() creates a secondary transport with a connected socket. It registers the socket with suitable events to the root.

Parameters:
pri primary transport object
ai pointer to addrinfo structure describing socket
real_ai pointer to addrinfo structure describing real target
tpn canonical name of node

void tport_close ( tport_t *  self  ) 

Close a transport.

The function tport_close() closes a socket associated with a transport object.

int tport_error_event ( tport_t *  self  ) 

Process error event.

Return events that can be processed afterwards.

int tport_has_connection ( tport_t const *  self  )  [inline]

Test if transport involves connection.

Since:
New in 1.12.5

int tport_recv_dgram ( tport_t *  self  ) 

Receive datagram.

Return values:
-1 error
0 end-of-stream
1 normal receive (should never happen)
2 incomplete recv, call me again (should never happen)
3 STUN keepalive, ignore

int tport_recv_stream ( tport_t *  self  ) 

Receive from stream.

Return values:
-1 error
0 end-of-stream
1 normal receive
2 incomplete recv, recv again

int tport_recv_stun_dgram ( tport_t const *  self,
msg_t **  in_out_msg,
su_sockaddr_t *  from,
socklen_t  fromlen 
)

Process stun messagee.

Return values:
-1 error
3 stun message received, ignore

ssize_t tport_send_dgram ( tport_t const *  self,
msg_t msg,
msg_iovec_t  iov[],
size_t  iovused 
)

Send using su_vsend().

Map IPv4 addresses as IPv6 addresses, if needed.

void tport_send_event ( tport_t *  self  ) 

Send event.

Process SU_WAIT_OUT event.

int tport_send_msg ( tport_t *  self,
msg_t msg,
tp_name_t const *  tpn,
struct sigcomp_compartment *  cc 
)

Send a message.

Return values:
0 when succesful
-1 upon an error


Sofia-SIP 1.12.6work - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.