本文整理汇总了C++中osip_strdup函数的典型用法代码示例。如果您正苦于以下问题:C++ osip_strdup函数的具体用法?C++ osip_strdup怎么用?C++ osip_strdup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osip_strdup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: osip_cseq_clone
int
osip_cseq_clone (const osip_cseq_t * cseq, osip_cseq_t ** dest)
{
int i;
osip_cseq_t *cs;
*dest = NULL;
if (cseq == NULL)
return OSIP_BADPARAMETER;
if (cseq->method == NULL)
return OSIP_BADPARAMETER;
if (cseq->number == NULL)
return OSIP_BADPARAMETER;
i = osip_cseq_init (&cs);
if (i != 0) {
osip_cseq_free (cs);
return i;
}
cs->method = osip_strdup (cseq->method);
cs->number = osip_strdup (cseq->number);
*dest = cs;
return OSIP_SUCCESS;
}
示例2: osip_authentication_info_clone
int
osip_authentication_info_clone (const osip_authentication_info_t * ainfo,
osip_authentication_info_t ** dest)
{
int i;
osip_authentication_info_t *wa;
*dest = NULL;
if (ainfo == NULL)
return -1;
i = osip_authentication_info_init (&wa);
if (i == -1) /* allocation failed */
return -1;
if (ainfo->nextnonce != NULL)
wa->nextnonce = osip_strdup (ainfo->nextnonce);
if (ainfo->cnonce != NULL)
wa->cnonce = osip_strdup (ainfo->cnonce);
if (ainfo->rspauth != NULL)
wa->rspauth = osip_strdup (ainfo->rspauth);
if (ainfo->nonce_count != NULL)
wa->nonce_count = osip_strdup (ainfo->nonce_count);
if (ainfo->qop_options != NULL)
wa->qop_options = osip_strdup (ainfo->qop_options);
*dest = wa;
return 0;
}
示例3: osip_cseq_clone
int
osip_cseq_clone (const osip_cseq_t * cseq, osip_cseq_t ** dest)
{
int i;
osip_cseq_t *cs;
*dest = NULL;
if (cseq == NULL)
return -1;
if (cseq->method == NULL)
return -1;
if (cseq->number == NULL)
return -1;
i = osip_cseq_init (&cs);
if (i != 0)
{
osip_cseq_free (cs);
return -1;
}
cs->method = osip_strdup (cseq->method);
cs->number = osip_strdup (cseq->number);
*dest = cs;
return 0;
}
示例4: add_relay_info
static void add_relay_info(sdp_message_t *sdp, int mline, const char *relay, const char *relay_session_id){
if (relay) sdp_message_a_attribute_add(sdp, mline,
osip_strdup ("relay-addr"),osip_strdup(relay));
if (relay_session_id) sdp_message_a_attribute_add(sdp, mline,
osip_strdup ("relay-session-id"), osip_strdup(relay_session_id));
}
示例5: eXtl_update_local_target
static int
eXtl_update_local_target(osip_message_t *req)
{
int pos = 0;
if (dtls_firewall_ip!='\0')
{
while (!osip_list_eol (&req->contacts, pos))
{
osip_contact_t *co;
co = (osip_contact_t *) osip_list_get (&req->contacts, pos);
pos++;
if (co != NULL && co->url != NULL && co->url->host != NULL
&& 0 == osip_strcasecmp (co->url->host, dtls_firewall_ip))
{
if (co->url->port == NULL &&
0 != osip_strcasecmp (dtls_firewall_port, "5061"))
{
co->url->port = osip_strdup (dtls_firewall_port);
}
else if (co->url->port != NULL &&
0 != osip_strcasecmp (dtls_firewall_port,
co->url->port))
{
osip_free (co->url->port);
co->url->port = osip_strdup (dtls_firewall_port);
}
}
}
}
return 0;
}
示例6: osip_content_type_clone
int
osip_content_type_clone (const osip_content_type_t * ctt, osip_content_type_t ** dest)
{
int i;
osip_content_type_t *ct;
*dest = NULL;
if (ctt == NULL)
return OSIP_BADPARAMETER;
i = osip_content_type_init (&ct);
if (i != 0) /* allocation failed */
return i;
if (ctt->type != NULL)
ct->type = osip_strdup (ctt->type);
if (ctt->subtype != NULL)
ct->subtype = osip_strdup (ctt->subtype);
{
osip_generic_param_t *dest_param;
osip_list_iterator_t it;
osip_generic_param_t *u_param = (osip_generic_param_t*) osip_list_get_first(&ctt->gen_params, &it);
while (u_param != OSIP_SUCCESS) {
i = osip_generic_param_clone (u_param, &dest_param);
if (i != 0) {
osip_content_type_free (ct);
return i;
}
osip_list_add (&ct->gen_params, dest_param, -1);
u_param = (osip_generic_param_t *) osip_list_get_next(&it);
}
}
*dest = ct;
return OSIP_SUCCESS;
}
示例7: osip_header_clone
int
osip_header_clone (const osip_header_t * header, osip_header_t ** dest)
{
int i;
osip_header_t *he;
*dest = NULL;
if (header == NULL)
return OSIP_BADPARAMETER;
if (header->hname == NULL)
return OSIP_BADPARAMETER;
i = osip_header_init (&he);
if (i != 0)
return i;
he->hname = osip_strdup (header->hname);
if (he->hname==NULL)
{
osip_header_free (he);
return OSIP_NOMEM;
}
if (header->hvalue != NULL)
{
he->hvalue = osip_strdup (header->hvalue);
if (he->hvalue==NULL)
{
osip_header_free (he);
return OSIP_NOMEM;
}
}
*dest = he;
return OSIP_SUCCESS;
}
示例8: sip_rewrite_osip_uri
static void sip_rewrite_osip_uri(osip_uri_t* uri, char* host, char* username)
{
if (NULL != uri->host) osip_free(uri->host);
if (NULL != uri->username) osip_free(uri->username);
uri->host = osip_strdup(host);
uri->username = osip_strdup(username);
}
示例9: init_gateway_map
void init_gateway_map(void)
{
gw_count = 0;
gateway_map[gw_count].dp = NULL;
gateway_map[gw_count].host = osip_strdup("sip.sipgate.com");
gateway_map[gw_count].username = osip_strdup("user");
gateway_map[gw_count].password = osip_strdup("password");
gateway_map[gw_count].port = 5060;
gw_count++;
}
示例10: osip_via_clone
int
osip_via_clone (const osip_via_t * via, osip_via_t ** dest)
{
int i;
osip_via_t *vi;
*dest = NULL;
if (via == NULL)
return -1;
if (via->version == NULL)
return -1;
if (via->protocol == NULL)
return -1;
if (via->host == NULL)
return -1;
i = osip_via_init (&vi);
if (i != 0)
return -1;
vi->version = osip_strdup (via->version);
vi->protocol = osip_strdup (via->protocol);
vi->host = osip_strdup (via->host);
if (via->port != NULL)
vi->port = osip_strdup (via->port);
if (via->comment != NULL)
vi->comment = osip_strdup (via->comment);
{
int pos = 0;
osip_generic_param_t *u_param;
osip_generic_param_t *dest_param;
while (!osip_list_eol (via->via_params, pos))
{
u_param =
(osip_generic_param_t *) osip_list_get (via->via_params, pos);
i = osip_generic_param_clone (u_param, &dest_param);
if (i != 0)
{
osip_via_free (vi);
return -1;
}
osip_list_add (vi->via_params, dest_param, -1);
pos++;
}
}
*dest = vi;
return 0;
}
示例11: osip_call_info_clone
int
osip_call_info_clone (const osip_call_info_t * ctt, osip_call_info_t ** dest)
{
int i;
osip_call_info_t *ct;
*dest = NULL;
if (ctt == NULL)
return OSIP_BADPARAMETER;
if (ctt->element == NULL)
return OSIP_BADPARAMETER;
i = osip_call_info_init (&ct);
if (i != 0) /* allocation failed */
return i;
ct->element = osip_strdup (ctt->element);
if (ct->element==NULL)
{
osip_call_info_free (ct);
return OSIP_NOMEM;
}
i = osip_list_clone(&ctt->gen_params, &ct->gen_params, &osip_generic_param_clone);
if (i != 0)
{
osip_call_info_free (ct);
return i;
}
*dest = ct;
return OSIP_SUCCESS;
}
示例12: osip_content_length_clone
int
osip_content_length_clone (const osip_content_length_t * ctl, osip_content_length_t ** dest)
{
int i;
osip_content_length_t *cl;
*dest = NULL;
if (ctl == NULL)
return OSIP_BADPARAMETER;
/*
empty headers are allowed:
if (ctl->value==NULL) return -1;
*/
i = osip_content_length_init (&cl);
if (i != 0) /* allocation failed */
return i;
if (ctl->value != NULL) {
cl->value = osip_strdup (ctl->value);
if (cl->value == NULL) {
osip_content_length_free (cl);
return OSIP_NOMEM;
}
}
*dest = cl;
return OSIP_SUCCESS;
}
示例13: osip_dialog_update_tag_as_uac
int
osip_dialog_update_tag_as_uac (osip_dialog_t * dialog, osip_message_t * response)
{
osip_generic_param_t *tag;
int i;
if (dialog == NULL)
return OSIP_BADPARAMETER;
if (response == NULL || response->to == NULL)
return OSIP_BADPARAMETER;
if (dialog->remote_tag != NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_WARNING, NULL, "This dialog already have a remote tag: it can't be changed!\n"));
return OSIP_WRONG_STATE;
}
i = osip_to_get_tag (response->to, &tag);
if (i != 0 || tag == NULL || tag->gvalue == NULL) {
OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_WARNING, NULL, "Remote UA is not compliant: missing a tag in response!\n"));
dialog->remote_tag = NULL;
}
else
dialog->remote_tag = osip_strdup (tag->gvalue);
return OSIP_SUCCESS;
}
示例14: osip_content_length_to_str
/* returns null on error. */
int
osip_content_length_to_str (const osip_content_length_t * cl, char **dest)
{
if (cl == NULL)
return -1;
*dest = osip_strdup (cl->value);
return 0;
}
示例15: osip_negotiation_sdp_message_put_on_hold
int
osip_negotiation_sdp_message_put_on_hold (sdp_message_t * sdp)
{
int pos;
int pos_media = -1;
char *rcvsnd;
int recv_send = -1;
pos = 0;
rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
while (rcvsnd != NULL)
{
if (rcvsnd != NULL && 0 == strcmp (rcvsnd, "sendonly"))
{
recv_send = 0;
}
else if (rcvsnd != NULL && (0 == strcmp (rcvsnd, "recvonly")
|| 0 == strcmp (rcvsnd, "sendrecv")))
{
recv_send = 0;
sprintf (rcvsnd, "sendonly");
}
pos++;
rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
}
pos_media = 0;
while (!sdp_message_endof_media (sdp, pos_media))
{
pos = 0;
rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
while (rcvsnd != NULL)
{
if (rcvsnd != NULL && 0 == strcmp (rcvsnd, "sendonly"))
{
recv_send = 0;
}
else if (rcvsnd != NULL && (0 == strcmp (rcvsnd, "recvonly")
|| 0 == strcmp (rcvsnd, "sendrecv")))
{
recv_send = 0;
sprintf (rcvsnd, "sendonly");
}
pos++;
rcvsnd = sdp_message_a_att_field_get (sdp, pos_media, pos);
}
pos_media++;
}
if (recv_send == -1)
{
/* we need to add a global attribute with a field set to "sendonly" */
sdp_message_a_attribute_add (sdp, -1, osip_strdup ("sendonly"), NULL);
}
return 0;
}