#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <sofia-sip/su_alloc.h>
#include <sofia-sip/su.h>
#include "msg_internal.h"
#include "sofia-sip/msg.h"
#include "sofia-sip/msg_parser.h"
#include "sofia-sip/msg_header.h"
Include dependency graph for msg_header_copy.c:
Functions | |
size_t | msg_params_copy_xtra (msg_param_t const pp[], size_t offset) |
Calculate size of a parameter vector. | |
char * | msg_params_copy (char *b, size_t size, msg_param_t **dst, msg_param_t const src[]) |
Copy a vector of parameters. | |
msg_header_t * | msg_header_copy_as (su_home_t *home, msg_hclass_t *hc, msg_header_t const *src) |
Copy a list of header objects. | |
msg_header_t * | msg_header_copy_one (su_home_t *home, msg_header_t const *src) |
Copy a single header. | |
msg_header_t * | msg_header_copy (su_home_t *home, msg_header_t const *src) |
Copy a header list. | |
msg_header_t * | msg_header_dup_one (su_home_t *home, msg_header_t const *src) |
Duplicate a sigle header. | |
msg_header_t * | msg_header_dup_as (su_home_t *home, msg_hclass_t *hc, msg_header_t const *src) |
Duplicate a header as class hc. | |
msg_header_t * | msg_header_dup (su_home_t *home, msg_header_t const *h) |
Duplicate a header list. | |
isize_t | msg_default_dup_xtra (msg_header_t const *header, isize_t offset) |
Calculate extra size of a plain header. | |
char * | msg_default_dup_one (msg_header_t *h, msg_header_t const *src, char *b, isize_t xtra) |
Duplicate a header object without external references. | |
msg_t * | msg_copy (msg_t *original) |
Copy a message shallowly. | |
msg_t * | msg_dup (msg_t const *original) |
Deep copy a message. |
Copy a message shallowly.
Copy a message and the header structures. The copied message will share all the strings with the original message. It will keep a reference to the original message, and the original message is not destroyed until all the copies have been destroyed.
original | message to be copied |
pointer | to newly copied message object when successful | |
NULL | upon an error |
char* msg_default_dup_one | ( | msg_header_t * | h, | |
msg_header_t const * | src, | |||
char * | b, | |||
isize_t | xtra | |||
) |
Duplicate a header object without external references.
The function msg_default_dup_one()
copies the contents of header object src to h. The header object should not contain external references (pointers).
h | pointer to newly allocated header object | |
src | pointer to a header object to be duplicated | |
b | memory buffer used to copy (not used) | |
xtra | number bytes in buffer b (not used) |
msg_default_dup_one()
returns a pointer to the memory buffer b. isize_t msg_default_dup_xtra | ( | msg_header_t const * | header, | |
isize_t | offset | |||
) |
Calculate extra size of a plain header.
Deep copy a message.
Copy a message, the header structures and all the related strings. The duplicated message does not share any (non-const) data with original. Note that the cached representation (in h_data) is not copied.
original | message to be duplicated |
pointer | to newly duplicated message object when successful | |
NULL | upon an error |
msg_header_t* msg_header_copy | ( | su_home_t * | home, | |
msg_header_t const * | src | |||
) |
Copy a header list.
msg_header_t* msg_header_copy_as | ( | su_home_t * | home, | |
msg_hclass_t * | hc, | |||
msg_header_t const * | src | |||
) |
Copy a list of header objects.
The function msg_header_copy_as()
shallowly copies a list of header objects, and casts them to the given header class.
home | pointer to the memory home | |
hc | header class | |
src | pointer to a list of header objects to be copied |
msg_header_copy_as()
returns a pointer to the first of the copied msg header object(s), or NULL
upon an error. msg_header_t* msg_header_copy_one | ( | su_home_t * | home, | |
msg_header_t const * | src | |||
) |
Copy a single header.
msg_header_t* msg_header_dup | ( | su_home_t * | home, | |
msg_header_t const * | h | |||
) |
Duplicate a header list.
The function msg_header_dup()
deeply copies a list of message headers objects.
home | pointer to the memory home | |
h | pointer to a list of header objects to be copied |
msg_header_dup()
returns a pointer to the first of the copied message header object(s), or NULL
upon an error. msg_header_t* msg_header_dup_as | ( | su_home_t * | home, | |
msg_hclass_t * | hc, | |||
msg_header_t const * | src | |||
) |
Duplicate a header as class hc.
The function msg_header_dup_as()
casts a list of header headers to given type, and then deeply copies the list.
home | pointer to the memory home | |
hc | header class | |
src | pointer to a list of header objects to be copied |
msg_header_copy_as()
returns a pointer to the first of the copied msg header object(s), or NULL
upon an error. msg_header_t* msg_header_dup_one | ( | su_home_t * | home, | |
msg_header_t const * | src | |||
) |
Duplicate a sigle header.
Deeply copy a single header.
home | pointer to the memory home | |
src | pointer to asingle header object to be copied |
NULL
upon an error.