本文整理汇总了C++中OSIP_TRACE函数的典型用法代码示例。如果您正苦于以下问题:C++ OSIP_TRACE函数的具体用法?C++ OSIP_TRACE怎么用?C++ OSIP_TRACE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OSIP_TRACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eXosip_message_build_answer
int
eXosip_message_build_answer (struct eXosip_t *excontext, int tid, int status, osip_message_t ** answer)
{
osip_transaction_t *tr = NULL;
int i;
*answer = NULL;
if (tid <= 0)
return OSIP_BADPARAMETER;
if (status < 200 || status > 699)
return OSIP_BADPARAMETER;
if (tid > 0) {
_eXosip_transaction_find (excontext, tid, &tr);
}
if (tr == NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No call here?\n"));
return OSIP_NOTFOUND;
}
i = -1;
if (status < 300) /* 2xx answer */
i = _eXosip_build_response_default (excontext, answer, NULL, status, tr->orig_request);
else if (status > 300) /* 3456xx answer */
i = _eXosip_build_response_default (excontext, answer, NULL, status, tr->orig_request);
if (i != 0)
return i;
return OSIP_SUCCESS;
}
示例2: osip_dialog_update_route_set_as_uas
int
osip_dialog_update_route_set_as_uas (osip_dialog_t * dialog, osip_message_t * invite)
{
osip_contact_t *contact;
int i;
if (osip_list_eol (invite->contacts, 0))
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_WARNING, NULL,
"missing a contact in invite!\n"));
}
else
{
if (dialog->remote_contact_uri != NULL)
{
osip_contact_free (dialog->remote_contact_uri);
}
dialog->remote_contact_uri = NULL;
contact = osip_list_get (invite->contacts, 0);
i = osip_contact_clone (contact, &(dialog->remote_contact_uri));
if (i != 0)
return -1;
}
return 0;
}
示例3: osip_fifo_insert
int
osip_fifo_insert (osip_fifo_t * ff, void *el)
{
#ifdef OSIP_MT
osip_mutex_lock (ff->qislocked);
#endif
if (ff->state != osip_full)
{
/* ff->nb_elt++; */
osip_list_add (&ff->queue, el, 0); /* insert at end of queue */
} else
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_WARNING, NULL,
"too much traffic in fifo.\n"));
#ifdef OSIP_MT
osip_mutex_unlock (ff->qislocked);
#endif
return -1; /* stack is full */
}
/* if (ff->nb_elt >= MAX_LEN) */
if (osip_list_size (&ff->queue) >= MAX_LEN)
ff->state = osip_full;
else
ff->state = osip_ok;
#ifdef OSIP_MT
osip_sem_post (ff->qisempty);
osip_mutex_unlock (ff->qislocked);
#endif
return 0;
}
示例4: _eXosip_default_gateway_with_getifaddrs
static int
_eXosip_default_gateway_with_getifaddrs(int type, char *address, int size)
{
struct ifaddrs *ifp;
struct ifaddrs *ifpstart;
int ret = -1;
if (getifaddrs(&ifpstart) < 0) {
return OSIP_NO_NETWORK;
}
for (ifp = ifpstart; ifp != NULL; ifp = ifp->ifa_next) {
if (ifp->ifa_addr && ifp->ifa_addr->sa_family == type
&& (ifp->ifa_flags & IFF_RUNNING) && !(ifp->ifa_flags & IFF_LOOPBACK))
{
getnameinfo(ifp->ifa_addr,
(type == AF_INET6) ?
sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in),
address, size, NULL, 0, NI_NUMERICHOST);
if (strchr(address, '%') == NULL) { /*avoid ipv6 link-local addresses */
OSIP_TRACE(osip_trace
(__FILE__, __LINE__, OSIP_INFO2, NULL,
"_eXosip_default_gateway_with_getifaddrs(): found %s\n",
address));
ret = 0;
break;
}
}
}
freeifaddrs(ifpstart);
return ret;
}
示例5: eXosip_message_send_answer
int
eXosip_message_send_answer (struct eXosip_t *excontext, int tid, int status, osip_message_t * answer)
{
osip_transaction_t *tr = NULL;
osip_event_t *evt_answer;
int i = -1;
if (tid <= 0)
return OSIP_BADPARAMETER;
if (status <= 100 || status > 699)
return OSIP_BADPARAMETER;
if (answer == NULL && status > 100 && status < 200)
return OSIP_BADPARAMETER;
if (tid > 0) {
_eXosip_transaction_find (excontext, tid, &tr);
}
if (tr == NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No MESSAGE transaction found\n"));
osip_message_free (answer);
return OSIP_NOTFOUND;
}
/* is the transaction already answered? */
if (tr->state == NIST_COMPLETED || tr->state == NIST_TERMINATED) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: transaction already answered\n"));
osip_message_free (answer);
return OSIP_WRONG_STATE;
}
if (answer == NULL) {
i = -1;
if (status > 199 && status < 300)
i = _eXosip_build_response_default (excontext, &answer, NULL, status, tr->orig_request);
else if (status > 300 && status <= 699)
i = _eXosip_build_response_default (excontext, &answer, NULL, status, tr->orig_request);
if (i != 0)
return i;
}
evt_answer = osip_new_outgoing_sipmessage (answer);
evt_answer->transactionid = tr->transactionid;
osip_transaction_add_event (tr, evt_answer);
_eXosip_wakeup (excontext);
return OSIP_SUCCESS;
}
示例6: _eXosip_answer_invite_3456xx
int
_eXosip_answer_invite_3456xx (eXosip_call_t * jc, eXosip_dialog_t * jd,
int code, osip_message_t ** answer)
{
int i;
osip_transaction_t *tr;
*answer = NULL;
tr = eXosip_find_last_inc_invite (jc, jd);
if (tr == NULL)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: cannot find transaction to answer"));
return -1;
}
/* is the transaction already answered? */
if (tr->state == IST_COMPLETED
|| tr->state == IST_CONFIRMED || tr->state == IST_TERMINATED)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: transaction already answered\n"));
return -1;
}
i =
_eXosip_build_response_default (answer, jd->d_dialog, code, tr->orig_request);
if (i != 0)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_INFO1, NULL,
"ERROR: Could not create response for invite\n"));
return -1;
}
if ((300 <= code) && (code <= 399))
{
/* Should add contact fields */
/* ... */
}
osip_message_set_content_length (*answer, "0");
/* send message to transaction layer */
return 0;
}
示例7: eXosip_insubscription_send_request
int
eXosip_insubscription_send_request (int did, osip_message_t * request)
{
eXosip_dialog_t *jd = NULL;
eXosip_notify_t *jn = NULL;
osip_transaction_t *transaction;
osip_event_t *sipevent;
int i;
if (request == NULL)
return -1;
if (did > 0)
{
eXosip_notify_dialog_find (did, &jn, &jd);
}
if (jd == NULL || jn == NULL)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: No incoming subscription here?\n"));
osip_message_free (request);
return -1;
}
transaction = NULL;
transaction = eXosip_find_last_out_notify (jn, jd);
if (transaction != NULL)
{
if (transaction->state != NICT_TERMINATED &&
transaction->state != NIST_TERMINATED &&
transaction->state != NICT_COMPLETED &&
transaction->state != NIST_COMPLETED)
{
osip_message_free (request);
return -1;
}
transaction = NULL;
}
i = osip_transaction_init (&transaction, NICT, eXosip.j_osip, request);
if (i != 0)
{
osip_message_free (request);
return -1;
}
osip_list_add (jd->d_out_trs, transaction, 0);
sipevent = osip_new_outgoing_sipmessage (request);
sipevent->transactionid = transaction->transactionid;
osip_transaction_set_your_instance (transaction,
__eXosip_new_jinfo (NULL, jd, NULL, jn));
osip_transaction_add_event (transaction, sipevent);
__eXosip_wakeup ();
return 0;
}
示例8: eXosip_insubscription_build_request
int
eXosip_insubscription_build_request (int did, const char *method,
osip_message_t ** request)
{
eXosip_dialog_t *jd = NULL;
eXosip_notify_t *jn = NULL;
osip_transaction_t *transaction;
char *transport;
int i;
*request = NULL;
if (method == NULL || method[0] == '\0')
return -1;
if (did > 0)
{
eXosip_notify_dialog_find (did, &jn, &jd);
}
if (jd == NULL || jn == NULL)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: No incoming subscription here?\n"));
return -1;
}
transaction = NULL;
transaction = eXosip_find_last_out_notify (jn, jd);
if (transaction != NULL)
{
if (transaction->state != NICT_TERMINATED &&
transaction->state != NIST_TERMINATED &&
transaction->state != NICT_COMPLETED &&
transaction->state != NIST_COMPLETED)
return -1;
}
transport = NULL;
if (transaction == NULL)
transaction = jn->n_inc_tr;
if (transaction != NULL && transaction->orig_request != NULL)
transport = _eXosip_transport_protocol (transaction->orig_request);
transaction = NULL;
if (transport == NULL)
i = _eXosip_build_request_within_dialog (request, method, jd->d_dialog, "UDP");
else
i =
_eXosip_build_request_within_dialog (request, method, jd->d_dialog,
transport);
if (i != 0)
return -2;
return 0;
}
示例9: __osip_nict_init
int
__osip_nict_init (osip_nict_t ** nict, osip_t * osip, osip_message_t * request)
{
osip_route_t *route;
int i;
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO2, NULL, "allocating NICT context\n"));
*nict = (osip_nict_t *) osip_malloc (sizeof (osip_nict_t));
if (*nict == NULL)
return OSIP_NOMEM;
memset (*nict, 0, sizeof (osip_nict_t));
/* for REQUEST retransmissions */
{
osip_via_t *via;
char *proto;
i = osip_message_get_via (request, 0, &via); /* get top via */
if (i < 0) {
osip_free (*nict);
*nict = NULL;
return i;
}
proto = via_get_protocol (via);
if (proto == NULL) {
osip_free (*nict);
*nict = NULL;
return OSIP_UNDEFINED_ERROR;
}
#ifdef USE_BLOCKINGSOCKET
if (osip_strcasecmp (proto, "TCP") != 0 && osip_strcasecmp (proto, "TLS") != 0 && osip_strcasecmp (proto, "SCTP") != 0) {
(*nict)->timer_e_length = DEFAULT_T1;
(*nict)->timer_k_length = DEFAULT_T4;
(*nict)->timer_e_start.tv_sec = -1;
(*nict)->timer_k_start.tv_sec = -1; /* not started */
}
else { /* reliable protocol is used: */
(*nict)->timer_e_length = -1; /* E is not ACTIVE */
(*nict)->timer_k_length = 0; /* MUST do the transition immediatly */
(*nict)->timer_e_start.tv_sec = -1;
(*nict)->timer_k_start.tv_sec = -1; /* not started */
}
}
#else
if (osip_strcasecmp (proto, "TCP") != 0 && osip_strcasecmp (proto, "TLS") != 0 && osip_strcasecmp (proto, "SCTP") != 0) {
(*nict)->timer_e_length = DEFAULT_T1;
(*nict)->timer_k_length = DEFAULT_T4;
(*nict)->timer_e_start.tv_sec = -1;
(*nict)->timer_k_start.tv_sec = -1; /* not started */
}
else { /* reliable protocol is used: */
(*nict)->timer_e_length = DEFAULT_T1;
(*nict)->timer_k_length = 0; /* MUST do the transition immediatly */
(*nict)->timer_e_start.tv_sec = -1;
(*nict)->timer_k_start.tv_sec = -1; /* not started */
}
}
示例10: eXosip_options_build_answer
int
eXosip_options_build_answer (int tid, int status, osip_message_t ** answer)
{
osip_transaction_t *tr = NULL;
int i = -1;
*answer = NULL;
if (tid > 0)
{
eXosip_transaction_find (tid, &tr);
}
if (tr == NULL)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: No call here?\n"));
return -1;
}
if (status > 100 && status < 200)
{
#if 0
/* TODO: not implemented */
i = _eXosip_build_response_default (response, NULL, code, tr->orig_request);
#endif
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: status code 1xx for options not implemented (use 200<status<=699)\n"));
return -1;
} else if (status > 199 && status < 300)
{
i = _eXosip_build_response_default (answer, NULL, status, tr->orig_request);
} else if (status > 300 && status <= 699)
{
i = _eXosip_build_response_default (answer, NULL, status, tr->orig_request);
} else
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: wrong status code (200<status<=699)\n"));
return -1;
}
if (i != 0)
return -1;
return 0;
}
示例11: __osip_ist_free
int
__osip_ist_free (osip_ist_t * ist)
{
if (ist == NULL)
return OSIP_SUCCESS;
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO2, NULL, "free ist resource\n"));
osip_free (ist);
return OSIP_SUCCESS;
}
示例12: _eXosip_insubscription_answer_3456xx
int
_eXosip_insubscription_answer_3456xx (eXosip_notify_t * jn,
eXosip_dialog_t * jd, int code)
{
osip_event_t *evt_answer;
osip_message_t *response;
int i;
osip_transaction_t *tr;
tr = eXosip_find_last_inc_subscribe (jn, jd);
if (tr == NULL)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_ERROR, NULL,
"eXosip: cannot find transaction to answer"));
return -1;
}
if (jd == NULL)
i = _eXosip_build_response_default (&response, NULL, code, tr->orig_request);
else
i =
_eXosip_build_response_default (&response, jd->d_dialog, code,
tr->orig_request);
if (i != 0)
{
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_INFO1, NULL,
"ERROR: Could not create response for subscribe\n"));
return -1;
}
if ((300 <= code) && (code <= 399))
{
/* Should add contact fields */
/* ... */
}
evt_answer = osip_new_outgoing_sipmessage (response);
evt_answer->transactionid = tr->transactionid;
osip_transaction_add_event (tr, evt_answer);
__eXosip_wakeup ();
return 0;
}
示例13: osip_dialog_update_route_set_as_uac
int
osip_dialog_update_route_set_as_uac (osip_dialog_t * dialog,
osip_message_t * response)
{
/* only the remote target URI is updated here... */
osip_contact_t *contact;
int i;
if (dialog == NULL)
return -1;
if (response == NULL)
return -1;
if (osip_list_eol (&response->contacts, 0))
{ /* no contact header in response? */
OSIP_TRACE (osip_trace
(__FILE__, __LINE__, OSIP_WARNING, NULL,
"missing a contact in response!\n"));
} else
{
/* I personally think it's a bad idea to keep the old
value in case the new one is broken... */
if (dialog->remote_contact_uri != NULL)
{
osip_contact_free (dialog->remote_contact_uri);
}
dialog->remote_contact_uri = NULL;
contact = osip_list_get (&response->contacts, 0);
i = osip_contact_clone (contact, &(dialog->remote_contact_uri));
if (i != 0)
return -1;
}
if (dialog->state == DIALOG_EARLY && osip_list_size (&dialog->route_set) == 0)
{ /* update the route set */
int pos = 0;
while (!osip_list_eol (&response->record_routes, pos))
{
osip_record_route_t *rr;
osip_record_route_t *rr2;
rr =
(osip_record_route_t *) osip_list_get (&response->record_routes, pos);
i = osip_record_route_clone (rr, &rr2);
if (i != 0)
return -1;
osip_list_add (&dialog->route_set, rr2, 0);
pos++;
}
}
if (MSG_IS_STATUS_2XX (response))
dialog->state = DIALOG_CONFIRMED;
return 0;
}
示例14: SendMsg
int SendMsg(osip_transaction_t *tr,osip_message_t *sip, char *host,int port, int out_socket)
{
int len = 0;
char *msgP;
int msgLen;
int i;
int status;
printf("SendMsg\n");
if((i = osip_message_to_str(sip, &msgP, &msgLen)) != 0){
OSIP_TRACE(osip_trace(__FILE__,__LINE__,OSIP_BUG,NULL,"failed to convert message\n"));
return -1;
}
if(!networkMsgSend(sipSock,msgP,strlen(msgP),host,5080))
OSIP_TRACE(osip_trace(__FILE__,__LINE__,OSIP_INFO1,NULL,"Time: Udp message sent: \n%s\n",msgP));
return 0;
}
示例15: eXosip_subscribe_send_refresh_request
int
eXosip_subscribe_send_refresh_request (struct eXosip_t *excontext, int did, osip_message_t * sub)
{
eXosip_dialog_t *jd = NULL;
eXosip_subscribe_t *js = NULL;
osip_transaction_t *transaction;
osip_event_t *sipevent;
int i;
if (did <= 0)
return OSIP_BADPARAMETER;
if (did > 0) {
_eXosip_subscribe_dialog_find (excontext, did, &js, &jd);
}
if (jd == NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: No subscribe here?\n"));
osip_message_free (sub);
return OSIP_NOTFOUND;
}
transaction = NULL;
transaction = _eXosip_find_last_out_subscribe (js, jd);
if (transaction != NULL) {
if (transaction->state != NICT_TERMINATED && transaction->state != NIST_TERMINATED && transaction->state != NICT_COMPLETED && transaction->state != NIST_COMPLETED) {
osip_message_free (sub);
return OSIP_WRONG_STATE;
}
transaction = NULL;
}
transaction = NULL;
i = _eXosip_transaction_init (excontext, &transaction, NICT, excontext->j_osip, sub);
if (i != 0) {
osip_message_free (sub);
return i;
}
js->s_reg_period = 3600;
_eXosip_subscribe_set_refresh_interval (js, sub);
osip_list_add (jd->d_out_trs, transaction, 0);
sipevent = osip_new_outgoing_sipmessage (sub);
sipevent->transactionid = transaction->transactionid;
osip_transaction_set_reserved5 (transaction, js);
osip_transaction_set_reserved3 (transaction, jd);
osip_transaction_add_event (transaction, sipevent);
_eXosip_wakeup (excontext);
return OSIP_SUCCESS;
}