Codename Pineapple

Home page | Mailing list | Docs

Last updated: Sat Feb 3 05:01:35 2007

Asterisk developer's documentation :: Codename Pineapple


linkedlists.h File Reference


Detailed Description

A set of macros to manage forward-linked lists.

Definition in file linkedlists.h.

#include "asterisk/lock.h"

Include dependency graph for linkedlists.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define AST_LIST_APPEND_LIST(head, list, field)
 Appends a whole list to the tail of a list.
#define AST_LIST_EMPTY(head)   (AST_LIST_FIRST(head) == NULL)
 Checks whether the specified list contains any entries.
#define AST_LIST_ENTRY(type)
 Declare a forward link structure inside a list entry.
#define AST_LIST_FIRST(head)   ((head)->first)
 Returns the first entry contained in a list.
#define AST_LIST_HEAD(name, type)
 Defines a structure to be used to hold a list of specified type.
#define AST_LIST_HEAD_DESTROY(head)
 Destroys a list head structure.
#define AST_LIST_HEAD_INIT(head)
 Initializes a list head structure.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
 Initializes a list head structure.
#define AST_LIST_HEAD_INIT_VALUE
 Defines initial values for a declaration of AST_LIST_HEAD.
#define AST_LIST_HEAD_NOLOCK(name, type)
 Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
 Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
#define AST_LIST_HEAD_NOLOCK_STATIC(name, type)
 Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_HEAD_SET(head, entry)
 Initializes a list head structure with a specified first entry.
#define AST_LIST_HEAD_SET_NOLOCK(head, entry)
 Initializes a list head structure with a specified first entry.
#define AST_LIST_HEAD_STATIC(name, type)
 Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_INSERT_AFTER(head, listelm, elm, field)
 Inserts a list entry after a given entry.
#define AST_LIST_INSERT_BEFORE_CURRENT(head, elm, field)
 Inserts a list entry before the current entry during a traversal.
#define AST_LIST_INSERT_HEAD(head, elm, field)
 Inserts a list entry at the head of a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
 Appends a list entry to the tail of a list.
#define AST_LIST_LAST(head)   ((head)->last)
 Returns the last entry contained in a list.
#define AST_LIST_LOCK(head)   ast_mutex_lock(&(head)->lock)
 Locks a list.
#define AST_LIST_NEXT(elm, field)   ((elm)->field.next)
 Returns the next entry in the list after the given entry.
#define AST_LIST_REMOVE(head, elm, field)
 Removes a specific entry from a list.
#define AST_LIST_REMOVE_CURRENT(head, field)
 Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
 Removes and returns the head entry from a list.
#define AST_LIST_TRAVERSE(head, var, field)   for((var) = (head)->first; (var); (var) = (var)->field.next)
 Loops over (traverses) the entries in a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
 Loops safely over (traverses) the entries in a list.
#define AST_LIST_TRAVERSE_SAFE_END   }
 Closes a safe loop traversal block.
#define AST_LIST_TRYLOCK(head)   ast_mutex_trylock(&(head)->lock)
 Locks a list, without blocking if the list is locked.
#define AST_LIST_UNLOCK(head)   ast_mutex_unlock(&(head)->lock)
 Attempts to unlock a list.
#define AST_RWLIST_APPEND_LIST   AST_LIST_APPEND_LIST
#define AST_RWLIST_EMPTY   AST_LIST_EMPTY
#define AST_RWLIST_ENTRY   AST_LIST_ENTRY
#define AST_RWLIST_FIRST   AST_LIST_FIRST
#define AST_RWLIST_HEAD(name, type)
 Defines a structure to be used to hold a read/write list of specified type.
#define AST_RWLIST_HEAD_DESTROY(head)
 Destroys an rwlist head structure.
#define AST_RWLIST_HEAD_INIT(head)
 Initializes an rwlist head structure.
#define AST_RWLIST_HEAD_INIT_VALUE
 Defines initial values for a declaration of AST_RWLIST_HEAD.
#define AST_RWLIST_HEAD_SET(head, entry)
 Initializes an rwlist head structure with a specified first entry.
#define AST_RWLIST_HEAD_STATIC(name, type)
 Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_RWLIST_INSERT_AFTER   AST_LIST_INSERT_AFTER
#define AST_RWLIST_INSERT_BEFORE_CURRENT   AST_LIST_INSERT_BEFORE_CURRENT
#define AST_RWLIST_INSERT_HEAD   AST_LIST_INSERT_HEAD
#define AST_RWLIST_INSERT_TAIL   AST_LIST_INSERT_TAIL
#define AST_RWLIST_LAST   AST_LIST_LAST
#define AST_RWLIST_NEXT   AST_LIST_NEXT
#define AST_RWLIST_RDLOCK(head)   ast_rwlock_rdlock(&(head)->lock)
 Read locks a list.
#define AST_RWLIST_REMOVE   AST_LIST_REMOVE
#define AST_RWLIST_REMOVE_CURRENT   AST_LIST_REMOVE_CURRENT
#define AST_RWLIST_REMOVE_HEAD   AST_LIST_REMOVE_HEAD
#define AST_RWLIST_TRAVERSE   AST_LIST_TRAVERSE
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN   AST_LIST_TRAVERSE_SAFE_BEGIN
#define AST_RWLIST_TRAVERSE_SAFE_END   AST_LIST_TRAVERSE_SAFE_END
#define AST_RWLIST_TRYRDLOCK(head)   ast_rwlock_tryrdlock(&(head)->lock)
 Read locks a list, without blocking if the list is locked.
#define AST_RWLIST_TRYWRLOCK(head)   ast_rwlock_trywrlock(&(head)->lock)
 Write locks a list, without blocking if the list is locked.
#define AST_RWLIST_UNLOCK(head)   ast_rwlock_unlock(&(head)->lock)
 Attempts to unlock a read/write based list.
#define AST_RWLIST_WRLOCK(head)   ast_rwlock_wrlock(&(head)->lock)
 Write locks a list.


Define Documentation

#define AST_LIST_APPEND_LIST head,
list,
field   ) 
 

Appends a whole list to the tail of a list.

Parameters:
head This is a pointer to the list head structure
list This is a pointer to the list to be appended.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.

Definition at line 689 of file linkedlists.h.

Referenced by clone_variables().

#define AST_LIST_EMPTY head   )     (AST_LIST_FIRST(head) == NULL)
 

Checks whether the specified list contains any entries.

Parameters:
head This is a pointer to the list head structure
Returns non-zero if the list has entries, zero if not.

Definition at line 413 of file linkedlists.h.

Referenced by __ast_read(), ack_trans(), ast_dial_option_disable(), ast_dial_option_enable(), ast_dial_run(), ast_log(), ast_sched_runq(), ast_sched_wait(), check_bridge(), do_devstate_changes(), domains_configured(), dundi_lookup_internal(), dundi_precache_internal(), dundi_query_eid_internal(), dundi_show_peer(), features_show(), get_destination(), handle_request_refer(), handle_showmanagers(), locals_show(), logger_print_normal(), logger_thread(), process_sip_queue(), register_verify(), sip_show_domains(), sip_show_settings(), and spy_cleanup().

#define AST_LIST_ENTRY type   ) 
 

Value:

struct {                      \
   struct type *next;                  \
}
Declare a forward link structure inside a list entry.

Parameters:
type This is the type of each list entry.
This macro declares a structure to be used to link list entries together. It must be used inside the definition of the structure named in type, as follows:

  struct list_entry {
   ...
   AST_LIST_ENTRY(list_entry) list;
  }

The field name list here is arbitrary, and can be anything you wish.

Definition at line 374 of file linkedlists.h.

#define AST_LIST_FIRST head   )     ((head)->first)
 

Returns the first entry contained in a list.

Parameters:
head This is a pointer to the list head structure

Definition at line 385 of file linkedlists.h.

Referenced by __ast_read(), abort_request(), ast_add_extension2(), ast_channel_spy_read_frame(), ast_dial_answered(), ast_do_masquerade(), ast_get_indication_tone(), ast_get_indication_zone(), ast_sched_runq(), ast_sched_wait(), ast_speech_unregister(), ast_walk_context_switches(), cli_next(), clone_variables(), copy_data_from_queue(), do_devstate_changes(), logger_thread(), process_precache(), purge_events(), and reschedule_precache().

#define AST_LIST_HEAD name,
type   ) 
 

Value:

struct name {                       \
   struct type *first;                 \
   struct type *last;                  \
   ast_mutex_t lock;                \
}
Defines a structure to be used to hold a list of specified type.

Parameters:
name This will be the name of the defined structure.
type This is the type of each list entry.
This macro creates a structure definition that can be used to hold a list of the entries of type type. It does not actually declare (allocate) a structure; to do that, either follow this macro with the desired name of the instance you wish to declare, or use the specified name to declare instances elsewhere.

Example usage:

  static AST_LIST_HEAD(entry_list, entry) entries;

This would define struct entry_list, and declare an instance of it named entries, all intended to hold a list of type struct entry.

Definition at line 137 of file linkedlists.h.

#define AST_LIST_HEAD_DESTROY head   ) 
 

Value:

{              \
   (head)->first = NULL;                  \
   (head)->last = NULL;                \
   ast_mutex_destroy(&(head)->lock);            \
}
Destroys a list head structure.

Parameters:
head This is a pointer to the list head structure
This macro destroys a list head structure by setting the head entry to NULL (empty list) and destroying the embedded lock. It does not free the structure from memory.

Definition at line 592 of file linkedlists.h.

Referenced by aji_client_destroy(), ast_module_unregister(), and unload_module().

#define AST_LIST_HEAD_INIT head   ) 
 

Value:

{              \
   (head)->first = NULL;                  \
   (head)->last = NULL;                \
   ast_mutex_init(&(head)->lock);               \
}
Initializes a list head structure.

Parameters:
head This is a pointer to the list head structure
This macro initializes a list head structure by setting the head entry to NULL (empty list) and recreating the embedded lock.

Definition at line 565 of file linkedlists.h.

Referenced by aji_create_client(), and ast_module_register().

#define AST_LIST_HEAD_INIT_NOLOCK head   ) 
 

Value:

{           \
   (head)->first = NULL;                  \
   (head)->last = NULL;                \
}
Initializes a list head structure.

Parameters:
head This is a pointer to the list head structure
This macro initializes a list head structure by setting the head entry to NULL (empty list). There is no embedded lock handling with this macro.

Definition at line 620 of file linkedlists.h.

Referenced by ast_channel_free(), ast_channel_spy_add(), ast_dial_create(), do_devstate_changes(), dundi_lookup_local(), load_module(), load_modules(), logger_thread(), loopback_helper(), and new_iax().

#define AST_LIST_HEAD_INIT_VALUE
 

Value:

{     \
   .first = NULL,             \
   .last = NULL,              \
   .lock = AST_MUTEX_INIT_VALUE,       \
   }
Defines initial values for a declaration of AST_LIST_HEAD.

Definition at line 198 of file linkedlists.h.

Referenced by ast_merge_contexts_and_delete().

#define AST_LIST_HEAD_NOLOCK name,
type   ) 
 

Value:

struct name {                       \
   struct type *first;                 \
   struct type *last;                  \
}
Defines a structure to be used to hold a list of specified type (with no lock).

Parameters:
name This will be the name of the defined structure.
type This is the type of each list entry.
This macro creates a structure definition that can be used to hold a list of the entries of type type. It does not actually declare (allocate) a structure; to do that, either follow this macro with the desired name of the instance you wish to declare, or use the specified name to declare instances elsewhere.

Example usage:

  static AST_LIST_HEAD_NOLOCK(entry_list, entry) entries;

This would define struct entry_list, and declare an instance of it named entries, all intended to hold a list of type struct entry.

Definition at line 189 of file linkedlists.h.

#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
 

Value:

{  \
   .first = NULL,             \
   .last = NULL,              \
   }
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.

Definition at line 216 of file linkedlists.h.

#define AST_LIST_HEAD_NOLOCK_STATIC name,
type   ) 
 

Value:

struct name {                       \
   struct type *first;                 \
   struct type *last;                  \
} name = AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines a structure to be used to hold a list of specified type, statically initialized.

This is the same as AST_LIST_HEAD_STATIC, except without the lock included.

Definition at line 310 of file linkedlists.h.

#define AST_LIST_HEAD_SET head,
entry   ) 
 

Value:

do {           \
   (head)->first = (entry);               \
   (head)->last = (entry);                \
   ast_mutex_init(&(head)->lock);               \
} while (0)
Initializes a list head structure with a specified first entry.

Parameters:
head This is a pointer to the list head structure
entry pointer to the list entry that will become the head of the list
This macro initializes a list head structure by setting the head entry to the supplied value and recreating the embedded lock.

Definition at line 324 of file linkedlists.h.

#define AST_LIST_HEAD_SET_NOLOCK head,
entry   ) 
 

Value:

do {        \
   (head)->first = (entry);               \
   (head)->last = (entry);                \
} while (0)
Initializes a list head structure with a specified first entry.

Parameters:
head This is a pointer to the list head structure
entry pointer to the list entry that will become the head of the list
This macro initializes a list head structure by setting the head entry to the supplied value.

Definition at line 352 of file linkedlists.h.

Referenced by __ast_read(), ast_channel_spy_read_frame(), and ast_do_masquerade().

#define AST_LIST_HEAD_STATIC name,
type   ) 
 

Value:

struct name {                       \
   struct type *first;                 \
   struct type *last;                  \
   ast_mutex_t lock;                \
} name = AST_LIST_HEAD_INIT_VALUE
Defines a structure to be used to hold a list of specified type, statically initialized.

Parameters:
name This will be the name of the defined structure.
type This is the type of each list entry.
This macro creates a structure definition that can be used to hold a list of the entries of type type, and allocates an instance of it, initialized to be empty.

Example usage:

  static AST_LIST_HEAD_STATIC(entry_list, entry);

This would define struct entry_list, intended to hold a list of type struct entry.

Definition at line 255 of file linkedlists.h.

#define AST_LIST_INSERT_AFTER head,
listelm,
elm,
field   ) 
 

Inserts a list entry after a given entry.

Parameters:
head This is a pointer to the list head structure
listelm This is a pointer to the entry after which the new entry should be inserted.
elm This is a pointer to the entry to be inserted.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.

Definition at line 634 of file linkedlists.h.

Referenced by reschedule_precache().

#define AST_LIST_INSERT_BEFORE_CURRENT head,
elm,
field   ) 
 

Inserts a list entry before the current entry during a traversal.

Parameters:
head This is a pointer to the list head structure
elm This is a pointer to the entry to be inserted.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.
Note:
This macro can only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN() block.

Definition at line 538 of file linkedlists.h.

Referenced by schedule().

#define AST_LIST_INSERT_HEAD head,
elm,
field   ) 
 

Inserts a list entry at the head of a list.

Parameters:
head This is a pointer to the list head structure
elm This is a pointer to the entry to be inserted.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.

Definition at line 650 of file linkedlists.h.

Referenced by __ast_module_user_add(), ack_trans(), aji_handle_message(), append_transaction(), ast_cdr_copy_vars(), ast_cdr_register(), ast_channel_datastore_add(), ast_channel_register(), ast_channel_spy_add(), ast_dnsmgr_get(), ast_frame_free(), ast_frame_header_new(), ast_loader_register(), ast_merge_contexts_and_delete(), ast_odbc_request_obj(), ast_register_atexit(), ast_register_feature(), ast_register_file_version(), ast_register_thread(), ast_register_verbose(), ast_speech_register(), build_mapping(), build_peer(), create_transaction(), dundi_lookup_local(), dundi_send(), features_alloc(), handle_frame(), handle_frame_ownerless(), iax2_register(), iax_frame_free(), init_logger_chain(), local_alloc(), loopback_helper(), moh_register(), mohalloc(), odbc_register_class(), pbx_builtin_pushvar_helper(), pbx_builtin_setvar_helper(), realtime_user(), register_request(), reschedule_precache(), sched_release(), session_do(), and set_config().

#define AST_LIST_INSERT_TAIL head,
elm,
field   ) 
 

Appends a list entry to the tail of a list.

Parameters:
head This is a pointer to the list head structure
elm This is a pointer to the entry to be appended.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.
Note: The link field in the appended entry is not modified, so if it is actually the head of a list itself, the entire list will be appended temporarily (until the next AST_LIST_INSERT_TAIL is performed).

Definition at line 670 of file linkedlists.h.

Referenced by __ast_device_state_changed_literal(), add_agent(), add_sip_domain(), add_to_load_order(), append_event(), append_history_va(), append_permission(), ast_channel_inherit_variables(), ast_channel_spy_add(), ast_context_add_switch2(), ast_dial_append(), ast_log(), ast_module_register(), ast_odbc_request_obj(), ast_queue_frame(), ast_slinfactory_feed(), ast_verbose(), find_cache(), find_tpeer(), iax2_transmit(), insert_idle_thread(), local_call(), queue_frame_to_spies(), queue_sip_request(), schedule(), and try_firmware().

#define AST_LIST_LAST head   )     ((head)->last)
 

Returns the last entry contained in a list.

Parameters:
head This is a pointer to the list head structure

Definition at line 393 of file linkedlists.h.

Referenced by ast_dial_option_disable(), ast_dial_option_enable(), ast_queue_frame(), and grab_last().

#define AST_LIST_LOCK head   )     ast_mutex_lock(&(head)->lock)
 

Locks a list.

Parameters:
head This is a pointer to the list head structure
This macro attempts to place an exclusive lock in the list head structure pointed to by head. Returns non-zero on success, 0 on failure

Definition at line 38 of file linkedlists.h.

Referenced by __ast_cli_generator(), __ast_cli_unregister(), __ast_device_state_changed_literal(), __ast_module_user_add(), __ast_module_user_hangup_all(), __ast_module_user_remove(), __attempt_transmit(), __expire_registry(), __iax2_show_peers(), __login_exec(), __manager_event(), __unload_module(), abort_request(), action_agents(), add_sip_domain(), agent_devicestate(), agent_hangup(), agent_request(), agentmonitoroutgoing_exec(), agents_show(), agents_show_online(), aji_client_destroy(), aji_handle_message(), append_event(), ast_active_channels(), ast_begin_shutdown(), ast_cdr_register(), ast_cdr_unregister(), ast_channel_free(), ast_channel_register(), ast_channel_unregister(), ast_cli_command(), ast_dnsmgr_get(), ast_dnsmgr_release(), ast_frame_free(), ast_frame_header_new(), ast_get_channel_tech(), ast_load_resource(), ast_loader_register(), ast_loader_unregister(), ast_log(), ast_module_helper(), ast_module_register(), ast_module_unregister(), ast_moh_destroy(), ast_odbc_request_obj(), ast_queue_log(), ast_register_atexit(), ast_register_feature(), ast_register_file_version(), ast_register_thread(), ast_register_verbose(), ast_request(), ast_run_atexits(), ast_speech_register(), ast_speech_unregister(), ast_unload_resource(), ast_unregister_atexit(), ast_unregister_feature(), ast_unregister_features(), ast_unregister_file_version(), ast_unregister_thread(), ast_unregister_verbose(), ast_update_use_count(), ast_verbose(), authenticate_reply(), authenticate_request(), authenticate_verify(), build_peer(), build_transactions(), build_user(), cancel_request(), channel_find_locked(), check_access(), check_availability(), check_beep(), check_request(), check_sip_domain(), clear_sip_domains(), cli_files_show(), close_logger(), complete_dpreply(), complete_iax2_show_peer(), complete_peer_helper(), complete_show_version_files(), complete_transfer(), delete_users(), destroy_session(), discover_transactions(), do_devstate_changes(), dundi_flush(), dundi_ie_append_eid_appropriately(), dundi_precache_internal(), dundi_precache_thread(), dundi_query_thread(), dundi_rexmit(), dundi_show_entityid(), dundi_show_mappings(), dundi_show_peer(), dundi_show_peers(), dundi_show_precache(), dundi_show_requests(), dundi_show_trans(), feature_exec_app(), features_alloc(), features_hangup(), features_show(), find_best(), find_cache(), find_engine(), find_feature(), find_idle_thread(), find_peer(), find_resource(), find_session(), find_tpeer(), grab_last(), handle_cli_status(), handle_help(), handle_logger_show_channels(), handle_show_threads(), handle_show_version_files(), handle_showmanager(), handle_showmanagers(), handle_showmanconn(), handle_showmaneventq(), help1(), iax2_canmatch(), iax2_destroy(), iax2_destroy_helper(), iax2_exec(), iax2_exists(), iax2_getpeername(), iax2_getpeertrunk(), iax2_matchmore(), iax2_process_thread(), iax2_register(), iax2_show_cache(), iax2_show_firmware(), iax2_show_registry(), iax2_show_stats(), iax2_show_threads(), iax2_show_users(), iax2_transmit(), iax_check_version(), iax_firmware_append(), init_classes(), init_logger_chain(), insert_idle_thread(), load_module(), local_alloc(), local_ast_moh_start(), local_hangup(), locals_show(), logger_print_normal(), logger_print_verbose(), logger_thread(), mark_mappings(), mark_peers(), moh_classes_show(), moh_register(), moh_release(), network_thread(), odbc_register_class(), odbc_show_command(), optimize_transactions(), post_cdr(), precache_transactions(), process_precache(), process_sip_queue(), prune_mappings(), prune_peers(), prune_users(), purge_events(), purge_sessions(), query_transactions(), queue_sip_request(), read_agent_config(), realtime_user(), refresh_list(), register_request(), reload(), reload_agents(), reload_config(), reload_firmware(), reload_logger(), reschedule_precache(), session_do(), set_config(), show_channeltype(), show_channeltypes(), sip_show_domains(), socket_process(), socket_read(), timing_read(), unload_module(), unregister_request(), and vnak_retransmit().

#define AST_LIST_NEXT elm,
field   )     ((elm)->field.next)
 

Returns the next entry in the list after the given entry.

Parameters:
elm This is a pointer to the current entry.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.

Definition at line 403 of file linkedlists.h.

Referenced by __ast_read(), append_event(), ast_channel_spy_read_frame(), ast_walk_context_switches(), channel_find_locked(), cli_next(), do_devstate_changes(), logger_thread(), purge_events(), reschedule_precache(), udptl_rx_packet(), and unref_event().

#define AST_LIST_REMOVE head,
elm,
field   ) 
 

Removes a specific entry from a list.

Parameters:
head This is a pointer to the list head structure
elm This is a pointer to the entry to be removed.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.
Warning:
The removed entry is not freed nor modified in any way.

Definition at line 731 of file linkedlists.h.

Referenced by __ast_cli_unregister(), __ast_module_user_remove(), __attempt_transmit(), agent_hangup(), ast_channel_free(), ast_channel_spy_remove(), ast_dnsmgr_release(), ast_frame_free(), ast_unregister_feature(), build_peer(), build_user(), destroy_packet(), destroy_session(), features_hangup(), handle_frame(), handle_frame_ownerless(), iax2_process_thread(), local_hangup(), moh_release(), network_thread(), pbx_builtin_setvar_helper(), and unregister_request().

#define AST_LIST_REMOVE_CURRENT head,
field   ) 
 

Removes the current entry from a list during a traversal.

Parameters:
head This is a pointer to the list head structure
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.
Note:
This macro can only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN() block; it is used to unlink the current entry from the list without affecting the list traversal (and without having to re-traverse the list to modify the previous entry, if any).

Definition at line 516 of file linkedlists.h.

Referenced by __unload_module(), aji_handle_message(), ast_cdr_unregister(), ast_channel_datastore_remove(), ast_channel_spy_stop_by_type(), ast_channel_unregister(), ast_context_remove_switch2(), ast_frdup(), ast_loader_unregister(), ast_module_unregister(), ast_sched_del(), ast_speech_unregister(), ast_unregister_atexit(), ast_unregister_file_version(), ast_unregister_thread(), ast_unregister_verbose(), clone_variables(), complete_dpreply(), detach_spies(), find_cache(), iax_frame_new(), prune_mappings(), prune_peers(), prune_users(), purge_sessions(), read_agent_config(), reload_firmware(), reschedule_precache(), timing_read(), and unload_module().

#define AST_LIST_REMOVE_HEAD head,
field   ) 
 

Removes and returns the head entry from a list.

Parameters:
head This is a pointer to the list head structure
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.
Removes the head entry from the list, and returns a pointer to it. This macro is safe to call on an empty list.

Definition at line 710 of file linkedlists.h.

Referenced by __ast_module_user_hangup_all(), __ast_read(), __sip_destroy(), aji_client_destroy(), ast_cdr_free_vars(), ast_channel_free(), ast_channel_spy_free(), ast_channel_spy_read_frame(), ast_frame_header_new(), ast_merge_contexts_and_delete(), ast_moh_destroy(), ast_moh_free_class(), ast_sched_runq(), ast_slinfactory_destroy(), ast_slinfactory_read(), ast_unregister_features(), cancel_request(), clear_sip_domains(), copy_data_from_queue(), delete_users(), destroy_packets(), destroy_permissions(), dundi_lookup_local(), find_idle_thread(), frame_cache_cleanup(), init_logger_chain(), loopback_helper(), pbx_builtin_clear_globals(), process_precache(), process_sip_queue(), purge_events(), queue_frame_to_spies(), sched_alloc(), sched_context_destroy(), and unload_module().

#define AST_LIST_TRAVERSE head,
var,
field   )     for((var) = (head)->first; (var); (var) = (var)->field.next)
 

Loops over (traverses) the entries in a list.

Parameters:
head This is a pointer to the list head structure
var This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro.
field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together.
This macro is use to loop over (traverse) the entries in a list. It uses a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows:
  static AST_LIST_HEAD(entry_list, list_entry) entries;
  ...
  struct list_entry {
   ...
   AST_LIST_ENTRY(list_entry) list;
  }
  ...
  struct list_entry *current;
  ...
  AST_LIST_TRAVERSE(&entries, current, list) {
     (do something with current here)
  }
Warning:
If you modify the forward-link pointer contained in the current entry while inside the loop, the behavior will be unpredictable. At a minimum, the following macros will modify the forward-link pointer, and should not be used inside AST_LIST_TRAVERSE() against the entry pointed to by the current pointer without careful consideration of their consequences:

Definition at line 453 of file linkedlists.h.

Referenced by __iax2_show_peers(), __login_exec(), __manager_event(), ack_trans(), action_agents(), add_agent(), add_to_load_order(), agent_devicestate(), agent_logoff(), agent_request(), agentmonitoroutgoing_exec(), agents_show(), agents_show_online(), allow_multiple_login(), ast_active_channels(), ast_begin_shutdown(), ast_cdr_copy_vars(), ast_cdr_getvar_internal(), ast_cdr_register(), ast_cdr_serialize_variables(), ast_channel_inherit_variables(), ast_channel_register(), ast_channel_spy_read_frame(), ast_channeltype_list(), ast_context_add_switch2(), ast_dial_destroy(), ast_dial_hangup(), ast_dial_option_disable(), ast_dial_option_enable(), ast_get_channel_tech(), ast_module_helper(), ast_odbc_request_obj(), ast_queue_frame(), ast_request(), ast_run_atexits(), ast_sched_dump(), ast_sched_when(), ast_slinfactory_feed(), ast_update_module_list(), ast_update_use_count(), authenticate_reply(), authenticate_request(), authenticate_verify(), begin_dial(), build_mapping(), build_peer(), build_transactions(), build_user(), channel_find_locked(), check_access(), check_availability(), check_beep(), check_request(), check_sip_domain(), cli_files_show(), close_logger(), complete_agent_logoff_cmd(), complete_channeltypes(), complete_iax2_show_peer(), complete_peer_helper(), complete_show_version_files(), complete_transfer(), delete_users(), destroy_trans(), discover_transactions(), dump_agents(), dundi_answer_query(), dundi_flush(), dundi_ie_append_eid_appropriately(), dundi_precache_full(), dundi_precache_internal(), dundi_show_mappings(), dundi_show_peer(), dundi_show_peers(), dundi_show_precache(), dundi_show_requests(), dundi_show_trans(), feature_exec_app(), features_alloc(), features_show(), find_agent(), find_feature(), find_peer(), find_relative_dial_channel(), find_resource(), find_session(), find_tpeer(), find_transaction(), get_manager_by_name_locked(), get_mohbyname(), get_trans_id(), group_show_channels(), handle_cli_status(), handle_logger_show_channels(), handle_show_globals(), handle_show_threads(), handle_show_version_files(), handle_showmanagers(), handle_showmanconn(), handle_showmaneventq(), has_permission(), iax2_call(), iax2_destroy(), iax2_destroy_helper(), iax2_getpeername(), iax2_getpeertrunk(), iax2_show_cache(), iax2_show_firmware(), iax2_show_registry(), iax2_show_stats(), iax2_show_threads(), iax2_show_users(), iax_check_version(), iax_firmware_append(), init_classes(), load_module(), load_modules(), local_call(), locals_show(), logger_print_normal(), logger_print_verbose(), mark_mappings(), mark_peers(), mgcp_call(), moh_classes_show(), monitor_dial(), odbc_show_command(), optimize_transactions(), pbx_builtin_getvar_helper(), pbx_builtin_serialize_variables(), pbx_builtin_setvar_helper(), pbx_retrieve_variable(),