📄 m_osip_list.h
字号:
/*
The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
Copyright (C) 2001,2002,2003,2004 Aymeric MOIZARD jack@atosc.org
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _M_OSIP_LIST_H_
#define _M_OSIP_LIST_H_
/**
* Structure for referencing a node in a osip_list_t element.
* @var __node_t
*/
typedef struct _m_node _m_node_t;
/**
* Structure for referencing a node in a osip_list_t element.
* @struct __node
*/
struct _m_node
{
void *next; /**< next __node_t containing element */
void *element; /**< element in Current node */
};
/**
* Structure for referencing a list of elements.
* @var osip_list_t
*/
typedef struct m_osip_list m_osip_list_t;
/* added by bennewit@cs.tu-berlin.de */
typedef struct
{
_m_node_t *actual;
_m_node_t **prev;
m_osip_list_t *li;
int pos;
} m_osip_list_iterator_t;
/**
* Structure for referencing a list of elements.
* @struct osip_list
*/
struct m_osip_list
{
int nb_elt; /**< Number of element in the list */
_m_node_t *node; /**< Next node containing element */
};
/* added by bennewit@cs.tu-berlin.de */
#define m_osip_list_iterator_has_elem(it) (0!=(it).actual&&(it).pos<(it).li->nb_elt)
/**
* Initialise a osip_list_t element.
* NOTE: this element MUST be previously allocated with
* osip_malloc(). The osip_free() call on the list is
* still automatically done by osip_list_free(). This
* also means you can't use a static osip_list_t variable
* if you want to use osip_list_free().
* @param li The element to initialise.
*/
int m_osip_list_init (m_osip_list_t * li);
/**
* Free a list of element.
* Each element will be free with the method given as the second parameter.
* @param li The element to work on.
* @param free_func The method that is able to release one element of the list.
*/
void m_osip_list_special_free (m_osip_list_t * li, void *(*free_func) (void *));
/**
* Free a list of element where elements are pointer to 'char'.
* @param li The element to work on.
*/
void m_osip_list_ofchar_free (m_osip_list_t * li);
/**
* Get the size of a list of element.
* @param li The element to work on.
*/
int m_osip_list_size (const m_osip_list_t * li);
/**
* Check if the end of list is detected .
* @param li The element to work on.
* @param pos The index of the possible element.
*/
int m_osip_list_eol (const m_osip_list_t * li, int pos);
/**
* Add an element in a list.
* @param li The element to work on.
* @param element The pointer on the element to add.
* @param pos the index of the element to add. (or -1 to append the element at the end)
*/
int m_osip_list_add (m_osip_list_t * li, void *element, int pos);
/**
* Get an element from a list.
* @param li The element to work on.
* @param pos the index of the element to get.
*/
void *m_osip_list_get (const m_osip_list_t * li, int pos);
/**
* Remove an element from a list.
* @param li The element to work on.
* @param pos the index of the element to remove.
*/
int m_osip_list_remove (m_osip_list_t * li, int pos);
/* added by bennewit@cs.tu-berlin.de */
void *m_osip_list_get_first (m_osip_list_t * li, m_osip_list_iterator_t * it);
/* added by bennewit@cs.tu-berlin.de */
void *m_osip_list_get_next (m_osip_list_iterator_t * it);
/* added by bennewit@cs.tu-berlin.de */
void *m_osip_list_iterator_remove (m_osip_list_iterator_t * it);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -