Loading...
Searching...
No Matches
su_tag_inline.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 SU_TAG_INLINE_H
#define SU_TAG_INLINE_H
#ifndef SU_TAG_H
#include <sofia-sip/su_tag.h>
#endif
#ifndef SU_TAG_CLASS_H
#include <sofia-sip/su_tag_class.h>
#endif
SOFIA_BEGIN_DECLS
#define tt_next tt_class->tc_next
#define tt_len tt_class->tc_len
#define tt_move tt_class->tc_move
#define tt_xtra tt_class->tc_xtra
#define tt_dup tt_class->tc_dup
#define tt_free tt_class->tc_free
#define tt_find tt_class->tc_find
#define tt_snprintf tt_class->tc_snprintf
#define tt_filter tt_class->tc_filter
#define TAG_TYPE_OF(t) ((t) && (t)->t_tag ? (t)->t_tag : tag_null)
su_inline int t_end(tagi_t const *t)
{
tag_type_t tt = TAG_TYPE_OF(t);
/* XXX - virtualize this */
return tt == tag_null || tt == tag_next;
}
su_inline tagi_t const *t_next(tagi_t const *t)
{
tag_type_t tt = TAG_TYPE_OF(t);
if (tt->tt_next)
return tt->tt_next(t);
else
return t + 1;
}
su_inline tagi_t *t_move(tagi_t *dst, tagi_t const *src)
{
tag_type_t tt = TAG_TYPE_OF(src);
if (tt->tt_move)
return tt->tt_move(dst, src);
*dst = *src;
return dst + 1;
}
su_inline size_t t_xtra(tagi_t const *t, size_t offset)
{
tag_type_t tt = TAG_TYPE_OF(t);
if (tt->tt_xtra)
return tt->tt_xtra(t, offset);
return 0;
}
su_inline tagi_t *t_dup(tagi_t *dst, tagi_t const *src, void **bb)
{
tag_type_t tt = TAG_TYPE_OF(src);
if (tt->tt_dup)
return tt->tt_dup(dst, src, bb);
*dst = *src;
return dst + 1;
}
su_inline tagi_t const *t_find(tag_type_t tt, tagi_t const *lst)
{
if (!tt)
return NULL;
if (tt->tt_find)
return tt->tt_find(tt, lst);
for (; lst; lst = t_next(lst)) {
if (tt == lst->t_tag)
return lst;
}
return NULL;
}
su_inline tagi_t *t_free(tagi_t *t)
{
tag_type_t tt = TAG_TYPE_OF(t);
if (tt->tt_free)
return tt->tt_free(t);
else if (tt->tt_next)
return (tagi_t *)tt->tt_next(t);
else
return t + 1;
}
su_inline size_t t_len(tagi_t const *t)
{
tag_type_t tt = TAG_TYPE_OF(t);
if (tt->tt_len)
return tt->tt_len(t);
return sizeof(*t);
}
SOFIA_END_DECLS
#endif /* !defined(SU_TAG_INLINE_H) */
tagi_t
Tag item.
Definition su_tag.h:63
tagi_t::t_tag
tag_type_t t_tag
Tag.
Definition su_tag.h:64
su_inline
#define su_inline
Define as suitable declarator static inline functions.
Definition su_configure.h:90
su_tag.h
\ Object-oriented tags and tag list interface.
tag_type_t
struct tag_type_s const * tag_type_t
Tag item type.
Definition su_tag.h:55
tag_next
tag_typedef_t tag_next
Jump to another tag list.
Definition su_taglist.c:1030
tag_null
tag_typedef_t tag_null
End of tag list.
Definition su_taglist.c:889
su_tag_class.h
\
t_end
int t_end(tagi_t const *t)
Check if the tag item is last in current list.
Definition su_tag_inline.h:59

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