Loading...
Searching...
No Matches
msg_protos.h
Go to the documentation of this file.
/*
* This file is part of the Sofia-SIP package
*
* Copyright (C) 2005 Nokia Corporation.
*
* Contact: Pekka Pessi <pekka.pessi@nokia-email.address.hidden>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef MSG_PROTOS_H
#define MSG_PROTOS_H
#ifndef MSG_HEADER_H
#include <sofia-sip/msg_header.h>
#endif
SOFIA_BEGIN_DECLS
enum {
msg_request_hash = -1,
msg_status_hash = -2
};
/* Declare internal prototypes for unknown headers */
enum {
msg_unknown_hash = -3
};
MSG_DLL msg_parse_f msg_unknown_d;
MSG_DLL msg_print_f msg_unknown_e;
MSG_DLL extern msg_hclass_t msg_unknown_class[];
#define MSG_UNKNOWN_INIT() MSG_HDR_INIT(unknown)
#if SU_HAVE_INLINE
su_inline msg_unknown_t *msg_unknown_init(msg_unknown_t x[1])
{
return MSG_HEADER_INIT(x, msg_unknown_class, sizeof(msg_unknown_t));
}
#else
#define msg_unknown_init(x) \
MSG_HEADER_INIT(x, msg_unknown_class, sizeof(msg_unknown_t))
#endif
#if SU_HAVE_INLINE
su_inline int msg_is_unknown(msg_header_t const *header)
{
msg_generic_t const *h = (msg_generic_t *)header;
return h && h->g_common->h_class->hc_hash == msg_unknown_hash;
}
#else
int msg_is_unknown(msg_header_t const *header);
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_unknown_t *msg_unknown_dup(su_home_t *home,
msg_unknown_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_unknown_t *msg_unknown_dup(su_home_t *home,
msg_unknown_t const *header)
{
return (msg_unknown_t *)
msg_header_dup_as(home, msg_unknown_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_unknown_t *msg_unknown_copy(su_home_t *home,
msg_unknown_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_unknown_t *msg_unknown_copy(su_home_t *home,
msg_unknown_t const *header)
{
return (msg_unknown_t *)
msg_header_copy_as(home, msg_unknown_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline msg_unknown_t *msg_unknown_make(su_home_t *home, char const *s)
{
return (msg_unknown_t*)msg_header_make(home, msg_unknown_class, s);
}
#else
msg_unknown_t *msg_unknown_make(su_home_t *home, char const *s)
__attribute__((__malloc__));
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_unknown_t *msg_unknown_format(su_home_t *home, char const *fmt, ...)
__attribute__((__malloc__, __format__ (printf, 2, 3)));
#if SU_HAVE_INLINE
su_inline msg_unknown_t *msg_unknown_format(su_home_t *home, char const *fmt, ...)
{
msg_header_t *h;
va_list ap;
va_start(ap, fmt);
h = msg_header_vformat(home, msg_unknown_class, fmt, ap);
va_end(ap);
return (msg_unknown_t*)h;
}
#endif
/* Declare internal prototypes for erroneous headers */
enum {
msg_error_hash = -4
};
MSG_DLL msg_parse_f msg_error_d;
MSG_DLL msg_print_f msg_error_e;
MSG_DLL extern msg_hclass_t msg_error_class[];
#define MSG_ERROR_INIT() MSG_HDR_INIT(error)
#if SU_HAVE_INLINE
su_inline msg_error_t *msg_error_init(msg_error_t x[1])
{
return MSG_HEADER_INIT(x, msg_error_class, sizeof(msg_error_t));
}
#else
#define msg_error_init(x) \
MSG_HEADER_INIT(x, msg_error_class, sizeof(msg_error_t))
#endif
#if SU_HAVE_INLINE
su_inline int msg_is_error(msg_header_t const *header)
{
msg_generic_t const *h = (msg_generic_t *)header;
return h && h->g_common->h_class->hc_hash == msg_error_hash;
}
#else
int msg_is_error(msg_header_t const *header);
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_error_t *msg_error_dup(su_home_t *home,
msg_error_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_error_t *msg_error_dup(su_home_t *home,
msg_error_t const *header)
{
return (msg_error_t *)
msg_header_dup_as(home, msg_error_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_error_t *msg_error_copy(su_home_t *home,
msg_error_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_error_t *msg_error_copy(su_home_t *home,
msg_error_t const *header)
{
return (msg_error_t *)
msg_header_copy_as(home, msg_error_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline msg_error_t *msg_error_make(su_home_t *home, char const *s)
{
return (msg_error_t*)msg_header_make(home, msg_error_class, s);
}
#else
msg_error_t *msg_error_make(su_home_t *home, char const *s)
__attribute__((__malloc__));
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_error_t *msg_error_format(su_home_t *home, char const *fmt, ...)
__attribute__((__malloc__, __format__ (printf, 2, 3)));
#if SU_HAVE_INLINE
su_inline msg_error_t *msg_error_format(su_home_t *home, char const *fmt, ...)
{
msg_header_t *h;
va_list ap;
va_start(ap, fmt);
h = msg_header_vformat(home, msg_error_class, fmt, ap);
va_end(ap);
return (msg_error_t*)h;
}
#endif
/* Declare internal prototypes for separator line between headers and body */
enum {
msg_separator_hash = -5
};
MSG_DLL msg_parse_f msg_separator_d;
MSG_DLL msg_print_f msg_separator_e;
MSG_DLL extern msg_hclass_t msg_separator_class[];
#define MSG_SEPARATOR_INIT() MSG_HDR_INIT(separator)
#if SU_HAVE_INLINE
su_inline msg_separator_t *msg_separator_init(msg_separator_t x[1])
{
return MSG_HEADER_INIT(x, msg_separator_class, sizeof(msg_separator_t));
}
#else
#define msg_separator_init(x) \
MSG_HEADER_INIT(x, msg_separator_class, sizeof(msg_separator_t))
#endif
#if SU_HAVE_INLINE
su_inline int msg_is_separator(msg_header_t const *header)
{
msg_generic_t const *h = (msg_generic_t *)header;
return h && h->g_common->h_class->hc_hash == msg_separator_hash;
}
#else
int msg_is_separator(msg_header_t const *header);
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_separator_t *msg_separator_dup(su_home_t *home,
msg_separator_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_separator_t *msg_separator_dup(su_home_t *home,
msg_separator_t const *header)
{
return (msg_separator_t *)
msg_header_dup_as(home, msg_separator_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_separator_t *msg_separator_copy(su_home_t *home,
msg_separator_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_separator_t *msg_separator_copy(su_home_t *home,
msg_separator_t const *header)
{
return (msg_separator_t *)
msg_header_copy_as(home, msg_separator_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline msg_separator_t *msg_separator_make(su_home_t *home, char const *s)
{
return (msg_separator_t*)msg_header_make(home, msg_separator_class, s);
}
#else
msg_separator_t *msg_separator_make(su_home_t *home, char const *s)
__attribute__((__malloc__));
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_separator_t *msg_separator_format(su_home_t *home, char const *fmt, ...)
__attribute__((__malloc__, __format__ (printf, 2, 3)));
#if SU_HAVE_INLINE
su_inline msg_separator_t *msg_separator_format(su_home_t *home, char const *fmt, ...)
{
msg_header_t *h;
va_list ap;
va_start(ap, fmt);
h = msg_header_vformat(home, msg_separator_class, fmt, ap);
va_end(ap);
return (msg_separator_t*)h;
}
#endif
/* Declare internal prototypes for message payload */
enum {
msg_payload_hash = -6
};
MSG_DLL msg_parse_f msg_payload_d;
MSG_DLL msg_print_f msg_payload_e;
MSG_DLL extern msg_hclass_t msg_payload_class[];
#define MSG_PAYLOAD_INIT() MSG_HDR_INIT(payload)
#if SU_HAVE_INLINE
su_inline msg_payload_t *msg_payload_init(msg_payload_t x[1])
{
return MSG_HEADER_INIT(x, msg_payload_class, sizeof(msg_payload_t));
}
#else
#define msg_payload_init(x) \
MSG_HEADER_INIT(x, msg_payload_class, sizeof(msg_payload_t))
#endif
#if SU_HAVE_INLINE
su_inline int msg_is_payload(msg_header_t const *header)
{
msg_generic_t const *h = (msg_generic_t *)header;
return h && h->g_common->h_class->hc_hash == msg_payload_hash;
}
#else
int msg_is_payload(msg_header_t const *header);
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_payload_t *msg_payload_dup(su_home_t *home,
msg_payload_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_payload_t *msg_payload_dup(su_home_t *home,
msg_payload_t const *header)
{
return (msg_payload_t *)
msg_header_dup_as(home, msg_payload_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_payload_t *msg_payload_copy(su_home_t *home,
msg_payload_t const *header)
__attribute__((__malloc__));
#if SU_HAVE_INLINE
su_inline
msg_payload_t *msg_payload_copy(su_home_t *home,
msg_payload_t const *header)
{
return (msg_payload_t *)
msg_header_copy_as(home, msg_payload_class, (msg_header_t const *)header);
}
#endif
#if SU_HAVE_INLINE
su_inline msg_payload_t *msg_payload_make(su_home_t *home, char const *s)
{
return (msg_payload_t*)msg_header_make(home, msg_payload_class, s);
}
#else
msg_payload_t *msg_payload_make(su_home_t *home, char const *s)
__attribute__((__malloc__));
#endif
#if SU_HAVE_INLINE
su_inline
#endif
msg_payload_t *msg_payload_format(su_home_t *home, char const *fmt, ...)
__attribute__((__malloc__, __format__ (printf, 2, 3)));
#if SU_HAVE_INLINE
su_inline msg_payload_t *msg_payload_format(su_home_t *home, char const *fmt, ...)
{
msg_header_t *h;
va_list ap;
va_start(ap, fmt);
h = msg_header_vformat(home, msg_payload_class, fmt, ap);
va_end(ap);
return (msg_payload_t*)h;
}
#endif
SOFIA_END_DECLS
#endif
msg_error_t
struct msg_error_s msg_error_t
Type for erroneous headers.
Definition msg_types.h:94
msg_error_e
msg_print_f msg_error_e
Print a erroneous headers.
Definition msg_protos.h:317
msg_error_copy
msg_error_t * msg_error_copy(su_home_t *home, msg_error_t const *header))
Copy a msg_error_t header structure.
Definition msg_protos.h:471
msg_error_d
msg_parse_f msg_error_d
Parse a erroneous headers.
Definition msg_protos.h:314
msg_is_error
int msg_is_error(msg_header_t const *header)
Test if header object is instance of msg_error_t.
Definition msg_protos.h:380
msg_error_class
msg_hclass_t msg_error_class[]
Header class for erroneous headers.
Definition msg_basic.c:80
msg_error_make
msg_error_t * msg_error_make(su_home_t *home, char const *s)
Make a header structure msg_error_t.
Definition msg_protos.h:498
msg_error_init
msg_error_t * msg_error_init(msg_error_t x[1])
Initialize a structure msg_error_t.
Definition msg_protos.h:357
msg_error_format
msg_error_t * msg_error_format(su_home_t *home, char const *fmt,...)))
Make a erroneous headers from formatting result.
Definition msg_protos.h:536
msg_error_dup
msg_error_t * msg_error_dup(su_home_t *home, msg_error_t const *header))
Duplicate (deep copy) msg_error_t.
Definition msg_protos.h:425
msg_error_hash
@ msg_error_hash
Hash of erroneous headers.
Definition msg_protos.h:310
msg_payload_e
msg_print_f msg_payload_e
Print a message payload.
Definition msg_protos.h:815
msg_payload_format
msg_payload_t * msg_payload_format(su_home_t *home, char const *fmt,...)))
Make a message payload from formatting result.
Definition msg_protos.h:1034
msg_payload_d
msg_parse_f msg_payload_d
Parse a message payload.
Definition msg_protos.h:812
msg_payload_dup
msg_payload_t * msg_payload_dup(su_home_t *home, msg_payload_t const *header))
Duplicate (deep copy) msg_payload_t.
Definition msg_protos.h:923
msg_payload_init
msg_payload_t * msg_payload_init(msg_payload_t x[1])
Initialize a structure msg_payload_t.
Definition msg_protos.h:855
msg_payload_copy
msg_payload_t * msg_payload_copy(su_home_t *home, msg_payload_t const *header))
Copy a msg_payload_t header structure.
Definition msg_protos.h:969
msg_payload_class
msg_hclass_t msg_payload_class[]
Header class for message payload.
Definition msg_basic.c:207
msg_payload_make
msg_payload_t * msg_payload_make(su_home_t *home, char const *s)
Make a header structure msg_payload_t.
Definition msg_protos.h:996
msg_payload_t
struct msg_payload_s msg_payload_t
The structure msg_payload_t contains representation of MIME message payload.
Definition msg_types.h:92
msg_is_payload
int msg_is_payload(msg_header_t const *header)
Test if header object is instance of msg_payload_t.
Definition msg_protos.h:878
msg_payload_hash
@ msg_payload_hash
Hash of message payload.
Definition msg_protos.h:808
msg_separator_class
msg_hclass_t msg_separator_class[]
Header class for separator line between headers and body.
Definition msg_basic.c:320
msg_separator_e
msg_print_f msg_separator_e
Print a separator line between headers and body.
Definition msg_protos.h:566
msg_separator_init
msg_separator_t * msg_separator_init(msg_separator_t x[1])
Initialize a structure msg_separator_t.
Definition msg_protos.h:606
msg_is_separator
int msg_is_separator(msg_header_t const *header)
Test if header object is instance of msg_separator_t.
Definition msg_protos.h:629
msg_separator_d
msg_parse_f msg_separator_d
Parse a separator line between headers and body.
Definition msg_protos.h:563
msg_separator_copy
msg_separator_t * msg_separator_copy(su_home_t *home, msg_separator_t const *header))
Copy a msg_separator_t header structure.
Definition msg_protos.h:720
msg_separator_t
struct msg_separator_s msg_separator_t
The structure msg_separator_t contains representation of separator line between message headers and b...
Definition msg_types.h:91
msg_separator_format
msg_separator_t * msg_separator_format(su_home_t *home, char const *fmt,...)))
Make a separator line between headers and body from formatting result.
Definition msg_protos.h:785
msg_separator_dup
msg_separator_t * msg_separator_dup(su_home_t *home, msg_separator_t const *header))
Duplicate (deep copy) msg_separator_t.
Definition msg_protos.h:674
msg_separator_make
msg_separator_t * msg_separator_make(su_home_t *home, char const *s)
Make a header structure msg_separator_t.
Definition msg_protos.h:747
msg_separator_hash
@ msg_separator_hash
Hash of separator line between headers and body.
Definition msg_protos.h:559
msg_unknown_t
struct msg_unknown_s msg_unknown_t
Type for unknown headers.
Definition msg_types.h:93
msg_unknown_make
msg_unknown_t * msg_unknown_make(su_home_t *home, char const *s)
Make a header structure msg_unknown_t.
Definition msg_protos.h:249
msg_unknown_copy
msg_unknown_t * msg_unknown_copy(su_home_t *home, msg_unknown_t const *header))
Copy a msg_unknown_t header structure.
Definition msg_protos.h:222
msg_unknown_e
msg_print_f msg_unknown_e
Print a unknown headers.
Definition msg_protos.h:68
msg_unknown_init
msg_unknown_t * msg_unknown_init(msg_unknown_t x[1])
Initialize a structure msg_unknown_t.
Definition msg_protos.h:108
msg_is_unknown
int msg_is_unknown(msg_header_t const *header)
Test if header object is instance of msg_unknown_t.
Definition msg_protos.h:131
msg_unknown_dup
msg_unknown_t * msg_unknown_dup(su_home_t *home, msg_unknown_t const *header))
Duplicate (deep copy) msg_unknown_t.
Definition msg_protos.h:176
msg_unknown_class
msg_hclass_t msg_unknown_class[]
Header class for unknown headers.
Definition msg_basic.c:127
msg_unknown_format
msg_unknown_t * msg_unknown_format(su_home_t *home, char const *fmt,...)))
Make a unknown headers from formatting result.
Definition msg_protos.h:287
msg_unknown_d
msg_parse_f msg_unknown_d
Parse a unknown headers.
Definition msg_protos.h:65
msg_unknown_hash
@ msg_unknown_hash
Hash of unknown headers.
Definition msg_protos.h:61
msg_header.h
Message headers.
msg_header_make
msg_header_t * msg_header_make(su_home_t *home, msg_hclass_t *hc, char const *s))
Make a header from a value string.
Definition msg_header_make.c:64
msg_header_vformat
msg_header_t * msg_header_vformat(su_home_t *home, msg_hclass_t *hc, char const *fmt, va_list ap))
Make a MSG header with formatting provided.
Definition msg_header_make.c:105
msg_header_copy_as
msg_header_t * msg_header_copy_as(su_home_t *home, msg_hclass_t *hc, msg_header_t const *o))
Copy a list of header objects.
Definition msg_header_copy.c:148
msg_header_dup_as
msg_header_t * msg_header_dup_as(su_home_t *home, msg_hclass_t *hc, msg_header_t const *o))
Duplicate a header as class hc.
Definition msg_header_copy.c:259
MSG_HEADER_INIT
#define MSG_HEADER_INIT(h, msg_class, size)
Initialize a header structure.
Definition msg_header.h:298
msg_hclass_t
struct msg_hclass_s const msg_hclass_t
Header class.
Definition msg_types.h:48
msg_header_t
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition msg_types.h:87
msg_common_s::h_class
msg_hclass_t * h_class
Header class.
Definition msg_types.h:114
msg_generic_s::g_common
msg_common_t g_common[1]
Common fragment info.
Definition msg_types.h:152
su_home_t
SU_HOME_T su_home_t
su_inline
#define su_inline

Sofia-SIP 1.12.11devel - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.