主要类型定义:

1、osip_t

/**
* Structure for osip handling.
* In order to use osip, you have to manage at least one global instance
* of an osip_t element. Then, you'll register a set of required callbacks
* and a set of optional ones.
* @var osip_t
*/
typedef struct osip osip_t; /**
* Structure for osip handling.
* @struct osip
*/
struct osip { void *application_context;
/**< User defined Pointer */ /* list of transactions for ict, ist, nict, nist */
osip_list_t osip_ict_transactions;
/**< list of ict transactions */
osip_list_t osip_ist_transactions;
/**< list of ist transactions */
osip_list_t osip_nict_transactions;
/**< list of nict transactions */
osip_list_t osip_nist_transactions;
/**< list of nist transactions */ osip_list_t ixt_retransmissions;/**< list of ixt elements */ osip_message_cb_t msg_callbacks[OSIP_MESSAGE_CALLBACK_COUNT]; /**@internal */
osip_kill_transaction_cb_t kill_callbacks[OSIP_KILL_CALLBACK_COUNT];
/**@internal */
osip_transport_error_cb_t
tp_error_callbacks[OSIP_TRANSPORT_ERROR_CALLBACK_COUNT];
/**@internal */ int (*cb_send_message) (osip_transaction_t *, osip_message_t *, char *,
int, int);
/**@internal */ #if defined(HAVE_DICT_DICT_H)
dict *osip_ict_hastable; /**< htable of ict transactions */
dict *osip_ist_hastable; /**< htable of ist transactions */
dict *osip_nict_hastable; /**< htable of nict transactions */
dict *osip_nist_hastable; /**< htable of nist transactions */
#endif
}; 注意:
、ict, ist, nict, nist是osip的四种状态机

2、osip_fsm_type_t

/**
* Enumeration for transaction type.
* A transaction can be either of:
* ICT,
* IST,
* NICT,
* NIST,
*/
typedef enum osip_fsm_type_t {
ICT,
/**< Invite Client (outgoing) Transaction */
IST,
/**< Invite Server (incoming) Transaction */
NICT,
/**< Non-Invite Client (outgoing) Transaction */
NIST
/**< Non-Invite Server (incoming) Transaction */
} osip_fsm_type_t;

主要函数定义:

1、osip 4中状态机ict, ist, nict, nist事务处理核心函数osip_*_execute:

/**
* Consume ALL pending osip_event_t previously added in the fifos of ict transactions.
* @param osip The element to work on.
*/
int osip_ict_execute(osip_t * osip);
/**
* Consume ALL pending osip_event_t previously added in the fifos of ist transactions.
* @param osip The element to work on.
*/
int osip_ist_execute(osip_t * osip);
/**
* Consume ALL pending osip_event_t previously added in the fifos of nict transactions.
* @param osip The element to work on.
*/
int osip_nict_execute(osip_t * osip);
/**
* Consume ALL pending osip_event_t previously added in the fifos of nist transactions.
* @param osip The element to work on.
*/
int osip_nist_execute(osip_t * osip);

2、osip_timers_gettimeout

/**
* Retreive the minimum timer value to be used by an application
* so that the osip_timer_*_execute method don't have to be called
* often.
*
* @param osip The element to work on.
* @param lower_tv The minimum timer when the application should wake up.
*/
void osip_timers_gettimeout(osip_t * osip, struct timeval *lower_tv);

3、osip_timers_*_execute

/**
* Check if an ict transactions needs a timer event.
* @param osip The element to work on.
*/
void osip_timers_ict_execute(osip_t * osip);
/**
* Check if an ist transactions needs a timer event.
* @param osip The element to work on.
*/
void osip_timers_ist_execute(osip_t * osip);
/**
* Check if a nict transactions needs a timer event.
* @param osip The element to work on.
*/
void osip_timers_nict_execute(osip_t * osip);
/**
* Check if a nist transactions needs a timer event.
* @param osip The element to work on.
*/
void osip_timers_nist_execute(osip_t * osip);

aa

osip_fsm_type_t

04-28 00:42