本文整理汇总了C++中osip_list_add函数的典型用法代码示例。如果您正苦于以下问题:C++ osip_list_add函数的具体用法?C++ osip_list_add怎么用?C++ osip_list_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osip_list_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
{
int pos = 0;
osip_generic_param_t *u_param;
osip_generic_param_t *dest_param;
while (!osip_list_eol(&ctt->gen_params, pos)) {
u_param =
(osip_generic_param_t *) osip_list_get(&ctt->gen_params, pos);
i = osip_generic_param_clone(u_param, &dest_param);
if (i != 0) {
osip_content_type_free(ct);
//osip_free(ct);
return i;
}
osip_list_add(&ct->gen_params, dest_param, -1);
pos++;
}
}
*dest = ct;
return OSIP_SUCCESS;
}
示例2: osip_message_set_content_encoding
/* content-Encoding = token
token possible values are gzip,compress,deflate
*/
int
osip_message_set_content_encoding (osip_message_t * sip, const char *hvalue)
{
osip_content_encoding_t *content_encoding;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_content_encoding_init (&content_encoding);
if (i != 0)
return -1;
i = osip_content_encoding_parse (content_encoding, hvalue);
if (i != 0)
{
osip_content_encoding_free (content_encoding);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->content_encodings, content_encoding, -1);
return 0;
}
示例3: osip_message_set_via
/* returns -1 on error. */
int
osip_message_set_via (osip_message_t * sip, const char *hvalue)
{
osip_via_t *via;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_via_init (&via);
if (i != 0)
return -1;
i = osip_via_parse (via, hvalue);
if (i != 0)
{
osip_via_free (via);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->vias, via, -1);
return 0;
}
示例4: osip_message_set_record_route
/* returns -1 on error. */
int
osip_message_set_record_route (osip_message_t * sip, const char *hvalue)
{
osip_record_route_t *record_route;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_record_route_init (&record_route);
if (i != 0)
return -1;
i = osip_record_route_parse (record_route, hvalue);
if (i != 0)
{
osip_record_route_free (record_route);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->record_routes, record_route, -1);
return 0;
}
示例5: osip_message_set_error_info
int
osip_message_set_error_info (osip_message_t * sip, const char *hvalue)
{
osip_error_info_t *error_info;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_error_info_init (&error_info);
if (i != 0)
return -1;
i = osip_error_info_parse (error_info, hvalue);
if (i != 0)
{
osip_error_info_free (error_info);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->error_infos, error_info, -1);
return 0;
}
示例6: osip_message_set_proxy_authenticate
/* returns -1 on error. */
int
osip_message_set_proxy_authenticate (osip_message_t * sip, const char *hvalue)
{
osip_proxy_authenticate_t *proxy_authenticate;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_proxy_authenticate_init (&(proxy_authenticate));
if (i != 0)
return -1;
i = osip_proxy_authenticate_parse (proxy_authenticate, hvalue);
if (i != 0)
{
osip_proxy_authenticate_free (proxy_authenticate);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->proxy_authenticates, proxy_authenticate, -1);
return 0;
}
示例7: osip_message_set_allow
int
osip_message_set_allow (osip_message_t * sip, const char *hvalue)
{
osip_allow_t *allow;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_allow_init (&allow);
if (i != 0)
return -1;
i = osip_allow_parse (allow, hvalue);
if (i != 0)
{
osip_allow_free (allow);
return -1;
}
sip->message_property = 2;
osip_list_add (&sip->allows, allow, -1);
return 0;
}
示例8: osip_message_set_call_info
int
osip_message_set_call_info (osip_message_t * sip, const char *hvalue)
{
osip_call_info_t *call_info;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_call_info_init (&call_info);
if (i != 0)
return -1;
i = osip_call_info_parse (call_info, hvalue);
if (i != 0) /* allocation failed */
{
osip_call_info_free (call_info);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->call_infos, call_info, -1);
return 0;
}
示例9: osip_message_set_accept_language
int
osip_message_set_accept_language (osip_message_t * sip, const char *hvalue)
{
osip_accept_language_t *accept_language;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return 0;
i = osip_accept_language_init (&accept_language);
if (i != 0)
return -1;
i = osip_accept_language_parse (accept_language, hvalue);
if (i != 0)
{
osip_accept_language_free (accept_language);
return -1;
}
sip->message_property = 2;
osip_list_add (sip->accept_languages, accept_language, -1);
return 0;
}
示例10: eXosip_options_send_request
int eXosip_options_send_request(struct eXosip_t *excontext, osip_message_t * options)
{
osip_transaction_t *transaction;
osip_event_t *sipevent;
int i;
i = _eXosip_transaction_init(excontext, &transaction, NICT, excontext->j_osip, options);
if (i != 0) {
osip_message_free(options);
return i;
}
osip_list_add(&excontext->j_transactions, transaction, 0);
sipevent = osip_new_outgoing_sipmessage(options);
sipevent->transactionid = transaction->transactionid;
osip_transaction_add_event(transaction, sipevent);
_eXosip_wakeup(excontext);
return OSIP_SUCCESS;
}
示例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 -1;
if (ctt->element == NULL)
return -1;
i = osip_call_info_init (&ct);
if (i != 0) /* allocation failed */
return -1;
ct->element = osip_strdup (ctt->element);
{
int pos = 0;
osip_generic_param_t *u_param;
osip_generic_param_t *dest_param;
while (!osip_list_eol (ctt->gen_params, pos))
{
u_param = (osip_generic_param_t *) osip_list_get (ctt->gen_params, pos);
i = osip_generic_param_clone (u_param, &dest_param);
if (i != 0)
{
osip_call_info_free (ct);
return -1;
}
osip_list_add (ct->gen_params, dest_param, -1);
pos++;
}
}
*dest = ct;
return 0;
}
示例12: osip_message_set_header
/* returns -1 on error. */
int
osip_message_set_header (osip_message_t * sip, const char *hname,
const char *hvalue)
{
osip_header_t *h;
int i;
if (sip == NULL || hname == NULL)
return OSIP_BADPARAMETER;
i = osip_header_init (&h);
if (i != 0)
return i;
h->hname = (char *) osip_malloc (strlen (hname) + 1);
if (h->hname == NULL)
{
osip_header_free (h);
return OSIP_NOMEM;
}
osip_clrncpy (h->hname, hname, strlen (hname));
if (hvalue != NULL)
{ /* some headers can be null ("subject:") */
h->hvalue = (char *) osip_malloc (strlen (hvalue) + 1);
if (h->hvalue == NULL)
{
osip_header_free (h);
return OSIP_NOMEM;
}
osip_clrncpy (h->hvalue, hvalue, strlen (hvalue));
} else
h->hvalue = NULL;
sip->message_property = 2;
osip_list_add (&sip->headers, h, -1);
return OSIP_SUCCESS; /* ok */
}
示例13: osip_message_set_authorization
/* returns -1 on error. */
int
osip_message_set_authorization (osip_message_t * sip, const char *hvalue)
{
osip_authorization_t *authorization;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return OSIP_SUCCESS;
if (sip == NULL)
return OSIP_BADPARAMETER;
i = osip_authorization_init (&authorization);
if (i != 0)
return i;
i = osip_authorization_parse (authorization, hvalue);
if (i != 0) {
osip_authorization_free (authorization);
return i;
}
sip->message_property = 2;
osip_list_add (&sip->authorizations, authorization, -1);
return OSIP_SUCCESS;
}
示例14: osip_message_set_www_authenticate
/* returns -1 on error. */
int
osip_message_set_www_authenticate (osip_message_t * sip, const char *hvalue)
{
osip_www_authenticate_t *www_authenticate;
int i;
if (hvalue == NULL || hvalue[0] == '\0')
return OSIP_SUCCESS;
if (sip == NULL)
return OSIP_BADPARAMETER;
i = osip_www_authenticate_init (&www_authenticate);
if (i != 0)
return i;
i = osip_www_authenticate_parse (www_authenticate, hvalue);
if (i != 0) {
osip_www_authenticate_free (www_authenticate);
return i;
}
sip->message_property = 2;
osip_list_add (&sip->www_authenticates, www_authenticate, -1);
return OSIP_SUCCESS;
}
示例15: osip_accept_encoding_clone
int
osip_accept_encoding_clone (const osip_accept_encoding_t * ctt, osip_accept_encoding_t ** dest)
{
int i;
osip_accept_encoding_t *ct;
*dest = NULL;
if (ctt == NULL)
return OSIP_BADPARAMETER;
if (ctt->element == NULL)
return OSIP_BADPARAMETER;
i = osip_accept_encoding_init (&ct);
if (i != 0) /* allocation failed */
return i;
ct->element = osip_strdup (ctt->element);
if (ct->element == NULL) {
osip_accept_encoding_free (ct);
return OSIP_NOMEM;
}
{
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_accept_encoding_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;
}