📄 inet_msg_mem.c
字号:
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!in_data || !mem_func)
{
return in_data;
}
val = inet_malloc(mem_func, sizeof(inet_str_param_list_struct));
CHECK_INET_PARAM(val, NULL);
val_t = val;
while (in_data)
{
if (in_data->object)
{
val->object = inet_str_param_struct_copy_fn(mem_func, in_data->object);
if (!val->object)
{
goto exit_due_to_mem;
}
}
in_data = in_data->next;
if (in_data)
{
if (val->object)
{
val->next = inet_malloc(mem_func, sizeof(inet_str_param_list_struct));
val = val->next;
if (!val)
{
goto exit_due_to_mem;
}
}
}
}
return (void*)val_t;
exit_due_to_mem:
inet_str_param_list_struct_free_fn(mem_func, val_t);
return NULL;
}
/*****************************************************************************
* FUNCTION
* inet_int_str_struct_copy_fn
* DESCRIPTION
*
* PARAMETERS
* mem_func [?]
* src [?]
* RETURNS
* void
*****************************************************************************/
void *inet_int_str_struct_copy_fn(inet_mem_func_struct *mem_func, void *src)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
inet_int_str_struct *val, *in_data = (inet_int_str_struct*) src;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!in_data || !mem_func)
{
return in_data;
}
val = inet_malloc(mem_func, sizeof(inet_int_str_struct));
CHECK_INET_PARAM(val, NULL);
if (in_data->str_value)
{
val->str_value = (kal_char*) inet_msg_strdup(mem_func, in_data->str_value);
if (!val->str_value)
{
goto exit_due_to_mem;
}
}
val->int_value = in_data->int_value;
return (void*)val;
exit_due_to_mem:
inet_int_str_struct_free_fn(mem_func, val);
return NULL;
}
/*****************************************************************************
* FUNCTION
* inet_int_str_list_struct_copy_fn
* DESCRIPTION
*
* PARAMETERS
* mem_func [?]
* src [?]
* RETURNS
* void
*****************************************************************************/
void *inet_int_str_list_struct_copy_fn(inet_mem_func_struct *mem_func, void *src)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
inet_int_str_list_struct *val, *val_t, *in_data = (inet_int_str_list_struct*) src;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!in_data || !mem_func)
{
return in_data;
}
val = inet_malloc(mem_func, sizeof(inet_int_str_list_struct));
CHECK_INET_PARAM(val, NULL);
val_t = val;
while (in_data)
{
if (in_data->object)
{
val->object = inet_int_str_struct_copy_fn(mem_func, in_data->object);
if (!val->object)
{
goto exit_due_to_mem;
}
}
in_data = in_data->next;
if (in_data)
{
if (val->object)
{
val->next = inet_malloc(mem_func, sizeof(inet_int_str_list_struct));
val = val->next;
if (!val)
{
goto exit_due_to_mem;
}
}
}
}
return (void*)val_t;
exit_due_to_mem:
inet_int_str_list_struct_free_fn(mem_func, val_t);
return NULL;
}
/*****************************************************************************
* FUNCTION
* inet_uri_struct_copy_fn
* DESCRIPTION
*
* PARAMETERS
* mem_func [?]
* src [?]
* RETURNS
* void
*****************************************************************************/
void *inet_uri_struct_copy_fn(inet_mem_func_struct *mem_func, void *src)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
inet_uri_struct *val, *in_data = (inet_uri_struct*) src;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!in_data || !mem_func)
{
return in_data;
}
val = inet_malloc(mem_func, sizeof(inet_uri_struct));
CHECK_INET_PARAM(val, NULL);
val->scheme = in_data->scheme;
val->port = in_data->port;
if (in_data->host)
{
val->host = (kal_char*) inet_msg_strdup(mem_func, in_data->host);
if (!val->host)
{
goto exit_due_to_mem;
}
}
if (in_data->path)
{
val->path = (kal_char*) inet_msg_strdup(mem_func, in_data->path);
if (!val->path)
{
goto exit_due_to_mem;
}
}
if (in_data->param_list)
{
val->param_list = inet_param_list_struct_copy_fn(mem_func, in_data->param_list);
if (!val->param_list)
{
goto exit_due_to_mem;
}
}
return (void*)val;
exit_due_to_mem:
inet_str_param_struct_free_fn(mem_func, val);
return NULL;
}
/*****************************************************************************
* FUNCTION
* inet_authenticate_struct_copy_fn
* DESCRIPTION
*
* PARAMETERS
* mem_func [?]
* src [?]
* RETURNS
* void
*****************************************************************************/
void *inet_authenticate_struct_copy_fn(inet_mem_func_struct *mem_func, void *src)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
inet_authenticate_struct *val, *in_data = (inet_authenticate_struct*) src;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!in_data || !mem_func)
{
return in_data;
}
val = inet_malloc(mem_func, sizeof(inet_authenticate_struct));
CHECK_INET_PARAM(val, NULL);
val->auth_type = in_data->auth_type;
val->stale = in_data->stale;
val->algorithm.int_value = in_data->algorithm.int_value;
if (in_data->algorithm.str_value)
{
val->algorithm.str_value = (kal_char*) inet_msg_strdup(mem_func, in_data->algorithm.str_value);
if (!val->algorithm.str_value)
{
goto exit_due_to_mem;
}
}
if (in_data->realm)
{
val->realm = (kal_char*) inet_msg_strdup(mem_func, in_data->realm);
if (!val->realm)
{
goto exit_due_to_mem;
}
}
if (in_data->domains)
{
val->domains = inet_str_list_struct_copy_fn(mem_func, in_data->domains);
if (!val->domains)
{
goto exit_due_to_mem;
}
}
if (in_data->nonce)
{
val->nonce = (kal_char*) inet_msg_strdup(mem_func, in_data->nonce);
if (!val->nonce)
{
goto exit_due_to_mem;
}
}
if (in_data->opaque)
{
val->opaque = (kal_char*) inet_msg_strdup(mem_func, in_data->opaque);
if (!val->opaque)
{
goto exit_due_to_mem;
}
}
if (in_data->qop)
{
val->qop = inet_int_str_list_struct_copy_fn(mem_func, in_data->qop);
if (!val->qop)
{
goto exit_due_to_mem;
}
}
if (in_data->param_list)
{
val->param_list = inet_param_list_struct_copy_fn(mem_func, in_data->param_list);
if (!val->param_list)
{
goto exit_due_to_mem;
}
}
return (void*)val;
exit_due_to_mem:
inet_authenticate_struct_free_fn(mem_func, val);
return NULL;
}
/*****************************************************************************
* FUNCTION
* inet_authorization_struct_copy_fn
* DESCRIPTION
*
* PARAMETERS
* mem_func [?]
* src [?]
* RETURNS
* void
*****************************************************************************/
void *inet_authorization_struct_copy_fn(inet_mem_func_struct *mem_func, void *src)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
inet_authorization_struct *val, *in_data = (inet_authorization_struct*) src;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
if (!in_data || !mem_func)
{
return in_data;
}
val = inet_malloc(mem_func, sizeof(inet_authorization_struct));
CHECK_INET_PARAM(val, NULL);
val->auth_type = in_data->auth_type;
if (in_data->username)
{
val->username = (kal_char*) inet_msg_strdup(mem_func, in_data->username);
if (!val->username)
{
goto exit_due_to_mem;
}
}
if (in_data->realm)
{
val->realm = (kal_char*) inet_msg_strdup(mem_func, in_data->realm);
if (!val->realm)
{
goto exit_due_to_mem;
}
}
if (in_data->nonce)
{
val->nonce = (kal_char*) inet_msg_strdup(mem_func, in_data->nonce);
if (!val->nonce)
{
goto exit_due_to_mem;
}
}
if (in_data->digest_uri)
{
val->digest_uri = (kal_char*) inet_msg_strdup(mem_func, in_data->digest_uri);
if (!val->digest_uri)
{
goto exit_due_to_mem;
}
}
if (in_data->response)
{
val->response = (kal_char*) inet_msg_strdup(mem_func, in_data->response);
if (!val->response)
{
goto exit_due_to_mem;
}
}
if (in_data->nc)
{
val->nc = (kal_char*) inet_msg_strdup(mem_func, in_data->nc);
if (!val->nc)
{
goto exit_due_to_mem;
}
}
val->algo = in_data->algo;
if (in_data->cnonce)
{
val->cnonce = (kal_char*) inet_msg_strdup(mem_func, in_data->cnonce);
if (!val->cnonce)
{
goto exit_due_to_mem;
}
}
if (in_data->opaque)
{
val->opaque = (kal_char*) inet_msg_strdup(mem_func, in_data->opaque);
if (!val->opaque)
{
goto exit_due_to_mem;
}
}
val->qop = in_data->qop;
return (void*)val;
exit_due_to_mem:
inet_authorization_struct_free_fn(mem_func, val);
return NULL;
}
/*****************************************************************************
* FUNCTION
* inet_authentication_info_struct_copy_fn
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -