Loading...
Searching...
No Matches
msg_internal.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_INTERNAL_H
#define MSG_INTERNAL_H
#ifdef MSG_H
#error "msg_internal.h" should be included before "msg.h"
#endif
#include "sofia-sip/msg.h"
#include "sofia-sip/msg_addr.h"
#include "sofia-sip/msg_buffer.h"
#ifndef SU_ALLOC_H
#include <sofia-sip/su_alloc.h>
#endif
SOFIA_BEGIN_DECLS
/* ---------------------------------------------------------------------- */
/* Types used when handling streaming */
typedef struct msg_buffer_s msg_buffer_t;
/* ---------------------------------------------------------------------- */
struct msg_s {
su_home_t m_home[1];
msg_mclass_t const *m_class;
int m_oflags;
msg_pub_t *m_object;
size_t m_maxsize;
size_t m_size;
msg_header_t *m_chain;
msg_header_t **m_tail;
msg_payload_t *m_chunk;
/* Parsing/printing buffer */
struct msg_mbuffer_s {
char *mb_data;
usize_t mb_size;
usize_t mb_used;
usize_t mb_commit;
unsigned mb_eos:1;
unsigned :0;
} m_buffer[1];
msg_buffer_t *m_stream;
size_t m_ssize;
unsigned short m_extract_err;
/* Internal flags */
unsigned m_set_buffer:1;
unsigned m_streaming:1;
unsigned m_prepared:1;
unsigned :0;
msg_t *m_next;
msg_t *m_parent;
int m_refs;
su_addrinfo_t m_addrinfo;
su_sockaddr_t m_addr[1];
int m_errno;
};
struct msg_buffer_s {
char *b_data;
size_t b_size;
size_t b_used;
size_t b_avail;
int b_complete;
msg_buffer_t *b_next;
msg_payload_t *b_chunks;
};
#define MSG_SSIZE_MAX (USIZE_MAX)
/* ---------------------------------------------------------------------- */
/* Header-kind predicate functions. */
su_inline int msg_is_single(msg_header_t const *h)
{
return h->sh_class->hc_kind == msg_kind_single;
}
su_inline int msg_is_prepend(msg_header_t const *h)
{
return h->sh_class->hc_kind == msg_kind_prepend;
}
su_inline int msg_is_append(msg_header_t const *h)
{
return
h->sh_class->hc_kind == msg_kind_append ||
h->sh_class->hc_kind == msg_kind_apndlist;
}
su_inline int msg_is_list(msg_header_t const *h)
{
return h->sh_class->hc_kind == msg_kind_list;
}
su_inline int msg_is_special(msg_header_t const *h)
{
return h->sh_class->hc_hash < 0;
}
SOFIA_END_DECLS
#endif /* MSG_INTERNAL_H */
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.h
Base message interface.
msg_addr.h
Addressing and I/O interface for messages.
msg_buffer.h
Internal buffer management functions.
msg_header_t
MSG_HDR_T msg_header_t
Any protocol-specific header object.
Definition msg_types.h:87
msg_t
struct msg_s msg_t
Message object.
Definition msg_types.h:54
msg_kind_prepend
@ msg_kind_prepend
New header is prepended.
Definition msg_types.h:256
msg_kind_list
@ msg_kind_list
A token list header, new header is combined with old one.
Definition msg_types.h:253
msg_kind_single
@ msg_kind_single
Only one header is allowed.
Definition msg_types.h:251
msg_kind_append
@ msg_kind_append
New header is appended.
Definition msg_types.h:252
msg_kind_apndlist
@ msg_kind_apndlist
A complex list header.
Definition msg_types.h:255
msg_pub_t
MSG_PUB_T msg_pub_t
Public protocol-specific message structure for accessing the message.
Definition msg_types.h:81
msg_mclass_t
struct msg_mclass_s msg_mclass_t
Message class.
Definition msg_types.h:45
msg_buffer_s
Buffer for message body.
Definition msg_internal.h:107
msg_buffer_s::b_data
char * b_data
Data - may contain NUL.
Definition msg_internal.h:108
msg_buffer_s::b_avail
size_t b_avail
Available data.
Definition msg_internal.h:111
msg_buffer_s::b_size
size_t b_size
Length of message payload.
Definition msg_internal.h:109
msg_buffer_s::b_complete
int b_complete
This buffer completes the message.
Definition msg_internal.h:112
msg_buffer_s::b_chunks
msg_payload_t * b_chunks
List of body chunks.
Definition msg_internal.h:114
msg_buffer_s::b_next
msg_buffer_t * b_next
Next buffer.
Definition msg_internal.h:113
msg_buffer_s::b_used
size_t b_used
Used data.
Definition msg_internal.h:110
msg_s
Message object.
Definition msg_internal.h:59
msg_s::m_home
su_home_t m_home[1]
Memory home.
Definition msg_internal.h:60
msg_s::m_stream
msg_buffer_t * m_stream
User-provided buffers.
Definition msg_internal.h:85
msg_s::m_size
size_t m_size
Total size of fragments.
Definition msg_internal.h:68
msg_s::m_ssize
size_t m_ssize
Stream size.
Definition msg_internal.h:86
msg_s::m_tail
msg_header_t ** m_tail
Tail of fragment chain.
Definition msg_internal.h:71
msg_s::m_maxsize
size_t m_maxsize
Maximum size.
Definition msg_internal.h:67
msg_s::m_chain
msg_header_t * m_chain
Fragment chain.
Definition msg_internal.h:70
msg_s::m_set_buffer
unsigned m_set_buffer
Buffer has been set.
Definition msg_internal.h:90
msg_s::m_prepared
unsigned m_prepared
Prepared/not.
Definition msg_internal.h:92
msg_s::m_extract_err
unsigned short m_extract_err
Bitmask of erroneous headers.
Definition msg_internal.h:88
msg_s::m_next
msg_t * m_next
Next message.
Definition msg_internal.h:95
msg_s::m_streaming
unsigned m_streaming
Use streaming with message.
Definition msg_internal.h:91
msg_s::m_oflags
int m_oflags
Original flags.
Definition msg_internal.h:63
msg_s::m_class
msg_mclass_t const * m_class
Message class.
Definition msg_internal.h:62
msg_s::m_parent
msg_t * m_parent
Reference to a parent message.
Definition msg_internal.h:97
msg_s::m_addrinfo
su_addrinfo_t m_addrinfo
Message addressing info (protocol).
Definition msg_internal.h:100
msg_s::m_object
msg_pub_t * m_object
Public view to parsed message.
Definition msg_internal.h:65
msg_s::m_refs
int m_refs
Number of references to this message.
Definition msg_internal.h:98
msg_s::m_errno
int m_errno
Errno.
Definition msg_internal.h:103
msg_s::m_addr
su_sockaddr_t m_addr[1]
Message address.
Definition msg_internal.h:101
msg_s::m_chunk
msg_payload_t * m_chunk
Incomplete payload fragment.
Definition msg_internal.h:73
su_addrinfo_t
struct addrinfo su_addrinfo_t
su_alloc.h
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.