Asterisk - The Open Source Telephony Project  18.5.0
Data Structures | Macros | Functions | Variables
stasis_message.c File Reference

Stasis Message API. More...

#include "asterisk.h"
#include "asterisk/astobj2.h"
#include "asterisk/stasis.h"
#include "asterisk/utils.h"
#include "asterisk/hashtab.h"
Include dependency graph for stasis_message.c:

Go to the source code of this file.

Data Structures

struct  stasis_message
 
struct  stasis_message_type
 

Macros

#define HAS_VIRTUAL(fn, msg)
 
#define INVOKE_VIRTUAL(fn, ...)
 

Functions

static void message_type_dtor (void *obj)
 
int stasis_message_can_be_ami (struct stasis_message *msg)
 Determine if the given message can be converted to AMI. More...
 
struct stasis_messagestasis_message_create (struct stasis_message_type *type, void *data)
 Create a new message. More...
 
struct stasis_messagestasis_message_create_full (struct stasis_message_type *type, void *data, const struct ast_eid *eid)
 Create a new message for an entity. More...
 
void * stasis_message_data (const struct stasis_message *msg)
 Get the data contained in a message. More...
 
static void stasis_message_dtor (void *obj)
 
const struct ast_eidstasis_message_eid (const struct stasis_message *msg)
 Get the entity id for a stasis_message. More...
 
const struct timeval * stasis_message_timestamp (const struct stasis_message *msg)
 Get the time when a message was created. More...
 
struct ast_manager_event_blobstasis_message_to_ami (struct stasis_message *msg)
 Build the AMI representation of the message. More...
 
struct ast_eventstasis_message_to_event (struct stasis_message *msg)
 Build the Generic event system representation of the message. More...
 
struct ast_jsonstasis_message_to_json (struct stasis_message *msg, struct stasis_message_sanitizer *sanitize)
 Build the JSON representation of the message. More...
 
struct stasis_message_typestasis_message_type (const struct stasis_message *msg)
 Get the message type for a stasis_message. More...
 
enum stasis_subscription_message_formatters stasis_message_type_available_formatters (const struct stasis_message_type *type)
 Get a bitmap of available formatters for a message type. More...
 
int stasis_message_type_create (const char *name, struct stasis_message_vtable *vtable, struct stasis_message_type **result)
 Create a new message type. More...
 
unsigned int stasis_message_type_hash (const struct stasis_message_type *type)
 Gets the hash of a given message type. More...
 
int stasis_message_type_id (const struct stasis_message_type *type)
 Gets the id of a given message type. More...
 
const char * stasis_message_type_name (const struct stasis_message_type *type)
 Gets the name of a given message type. More...
 

Variables

static int message_type_id
 
static struct stasis_message_vtable null_vtable = {}
 

Detailed Description

Stasis Message API.

Author
David M. Lee, II dlee@.nosp@m.digi.nosp@m.um.co.nosp@m.m

Definition in file stasis_message.c.

Macro Definition Documentation

◆ HAS_VIRTUAL

#define HAS_VIRTUAL (   fn,
  msg 
)

Definition at line 241 of file stasis_message.c.

Referenced by stasis_message_can_be_ami().

◆ INVOKE_VIRTUAL

#define INVOKE_VIRTUAL (   fn,
  ... 
)

Function Documentation

◆ message_type_dtor()

static void message_type_dtor ( void *  obj)
static

Definition at line 49 of file stasis_message.c.

References ast_free, stasis_message_type::name, NULL, and type.

Referenced by stasis_message_type_create().

50 {
51  struct stasis_message_type *type = obj;
52  ast_free(type->name);
53  type->name = NULL;
54 }
static const char type[]
Definition: chan_ooh323.c:109
#define NULL
Definition: resample.c:96
#define ast_free(a)
Definition: astmm.h:182

◆ stasis_message_can_be_ami()

int stasis_message_can_be_ami ( struct stasis_message msg)

Determine if the given message can be converted to AMI.

Parameters
msgMessage to see if can be converted to AMI.
Return values
0Cannot be converted
non-zeroCan be converted

Definition at line 251 of file stasis_message.c.

References HAS_VIRTUAL, and to_ami().

Referenced by manager_default_msg_cb().

252 {
253  return HAS_VIRTUAL(to_ami, msg);
254 }
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)
#define HAS_VIRTUAL(fn, msg)

◆ stasis_message_create()

struct stasis_message* stasis_message_create ( struct stasis_message_type type,
void *  data 
)

Create a new message.

This message is an ao2 object, and must be ao2_cleanup()'ed when you are done with it. Messages are also immutable, and must not be modified after they are initialized. Especially the data in the message.

Parameters
typeType of the message
dataImmutable data that is the actual contents of the message
Returns
New message
NULL on error
Since
12

Definition at line 174 of file stasis_message.c.

References ast_eid_default, and stasis_message_create_full().

Referenced by __ast_test_suite_event_notify(), aoc_publish_blob(), ast_bridge_blob_create(), ast_bridge_blob_create_from_snapshots(), ast_bridge_publish_attended_transfer(), ast_bridge_publish_blind_transfer(), ast_bridge_publish_merge(), ast_bridge_publish_state(), ast_cdr_engine_term(), ast_channel_publish_dial_internal(), ast_channel_publish_final_snapshot(), ast_channel_publish_snapshot(), ast_endpoint_blob_create(), ast_manager_publish_event(), ast_multi_object_blob_single_channel_publish(), ast_mwi_blob_create(), ast_rtp_publish_rtcp_message(), ast_system_publish_registry(), AST_TEST_DEFINE(), bridge_publish_state_from_blob(), bridge_topics_destroy(), cc_publish(), cdr_prop_write(), cdr_read(), cdr_write(), create_channel_blob_message(), create_endpoint_snapshot_message(), endpoint_publish_snapshot(), forkcdr_exec(), handle_security_event(), local_optimization_finished_cb(), local_optimization_started_cb(), presence_state_event(), publish_acl_change(), publish_app_cdr_message(), publish_chanspy_message(), publish_cluster_discovery_to_stasis_full(), publish_corosync_ping_to_stasis(), publish_format_update(), publish_hint_change(), publish_hint_remove(), publish_load_message_type(), publish_local_bridge_message(), publish_parked_call(), publish_parked_call_failure(), queue_publish_member_blob(), queue_publish_multi_channel_snapshot_blob(), send_call_pickup_stasis_message(), send_msg(), send_start_msg_snapshots(), send_subscription_subscribe(), send_subscription_unsubscribe(), stasis_app_user_event(), stasis_cache_clear_create(), stasis_test_message_create(), stun_monitor_request(), and update_create().

175 {
176  return stasis_message_create_full(type, data, &ast_eid_default);
177 }
struct stasis_message * stasis_message_create_full(struct stasis_message_type *type, void *data, const struct ast_eid *eid)
Create a new message for an entity.
struct ast_eid ast_eid_default
Global EID.
Definition: options.c:93

◆ stasis_message_create_full()

struct stasis_message* stasis_message_create_full ( struct stasis_message_type type,
void *  data,
const struct ast_eid eid 
)

Create a new message for an entity.

This message is an ao2 object, and must be ao2_cleanup()'ed when you are done with it. Messages are also immutable, and must not be modified after they are initialized. Especially the data in the message.

Parameters
typeType of the message
dataImmutable data that is the actual contents of the message
eidWhat entity originated this message. (NULL for aggregate)
Note
An aggregate message is a combined representation of the local and remote entities publishing the message data. e.g., An aggregate device state represents the combined device state from the local and any remote entities publishing state for a device. e.g., An aggregate MWI message is the old/new MWI counts accumulated from the local and any remote entities publishing to a mailbox.
Return values
Newmessage

Definition at line 140 of file stasis_message.c.

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_ref, ao2_t_alloc_options, ast_tvnow(), stasis_message::data, stasis_message::eid, stasis_message::eid_ptr, stasis_message_type::name, NULL, stasis_message_dtor(), stasis_message::timestamp, type, and stasis_message::type.

Referenced by ast_publish_device_state_full(), AST_TEST_DEFINE(), cache_test_message_create_full(), create_foo_type_message(), device_state_aggregate_calc(), mwi_state_create_message(), and stasis_message_create().

141 {
142  struct stasis_message *message;
143 
144  if (type == NULL || data == NULL) {
145  return NULL;
146  }
147 
148  message = ao2_t_alloc_options(sizeof(*message), stasis_message_dtor,
150  if (message == NULL) {
151  return NULL;
152  }
153 
154  message->timestamp = ast_tvnow();
155  /*
156  * XXX Normal ao2 ref counting rules says we should increment the message
157  * type ref here and decrement it in stasis_message_dtor(). However, the
158  * stasis message could be cached and legitimately cause the type ref count
159  * to hit the excessive ref count assertion. Since the message type
160  * practically has to be a global object anyway, we can get away with not
161  * holding a ref in the stasis message.
162  */
163  message->type = type;
164  ao2_ref(data, +1);
165  message->data = data;
166  if (eid) {
167  message->eid_ptr = &message->eid;
168  message->eid = *eid;
169  }
170 
171  return message;
172 }
static const char type[]
Definition: chan_ooh323.c:109
struct ast_eid eid
static void stasis_message_dtor(void *obj)
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Definition: time.h:150
#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg)
Allocate and initialize an object.
Definition: astobj2.h:404
#define NULL
Definition: resample.c:96
struct stasis_message_type * type
struct timeval timestamp
#define ao2_ref(o, delta)
Definition: astobj2.h:464
const struct ast_eid * eid_ptr

◆ stasis_message_data()

void* stasis_message_data ( const struct stasis_message msg)

Get the data contained in a message.

Parameters
msgMessage.
Returns
Immutable data pointer
NULL if msg is NULL.
Since
12

Definition at line 195 of file stasis_message.c.

References stasis_message::data, and NULL.

Referenced by agent_login_to_ami(), agent_logoff_to_ami(), agi_channel_to_ami(), aoc_to_ami(), appcdr_callback(), ast_ari_endpoints_list(), ast_ari_endpoints_list_by_tech(), ast_bridge_merge_message_to_json(), ast_bridge_publish_enter(), ast_bridge_publish_leave(), ast_channel_entered_bridge_to_json(), ast_channel_left_bridge_to_json(), ast_delete_mwi_state_full(), ast_endpoint_latest_snapshot(), ast_mwi_publish_by_mailbox(), AST_TEST_DEFINE(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), attended_transfer_to_ami(), attended_transfer_to_json(), blind_transfer_to_ami(), blind_transfer_to_json(), bridge_attended_transfer_handler(), bridge_blind_transfer_handler(), bridge_merge_cb(), bridge_merge_handler(), bridge_snapshot_update(), cache_test_aggregate_calc_fn(), cache_test_data_id(), cache_update(), cache_update_cb(), caching_topic_exec(), call_forwarded_handler(), call_pickup_to_ami(), cc_available_to_ami(), cc_callerrecalling_to_ami(), cc_callerstartmonitoring_to_ami(), cc_callerstopmonitoring_to_ami(), cc_failure_to_ami(), cc_monitorfailed_to_ami(), cc_offertimerstart_to_ami(), cc_recallcomplete_to_ami(), cc_requestacknowledged_to_ami(), cc_requested_to_ami(), cdr_prop_write_callback(), cdr_read_callback(), cdr_write_callback(), cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_dial_cb(), cel_generic_cb(), cel_local_cb(), cel_parking_cb(), cel_pickup_cb(), cel_snapshot_update_cb(), channel_blob_to_json(), channel_chanspy_start_cb(), channel_chanspy_stop_cb(), channel_dial_cb(), channel_dtmf_begin_cb(), channel_dtmf_end_cb(), channel_enter_cb(), channel_fax_cb(), channel_flash_cb(), channel_hangup_handler_cb(), channel_hangup_request_cb(), channel_hold_cb(), channel_leave_cb(), channel_mixmonitor_mute_cb(), channel_mixmonitor_start_cb(), channel_mixmonitor_stop_cb(), channel_moh_start_cb(), channel_moh_stop_cb(), channel_monitor_start_cb(), channel_monitor_stop_cb(), channel_snapshot_update(), channel_unhold_cb(), check_cache_aggregate(), conf_send_event_to_participants(), confbridge_atxfer_cb(), confbridge_publish_manager_event(), confbridge_talking_cb(), consumer_exec(), contactstatus_to_ami(), contactstatus_to_json(), corosync_ping_to_event(), dahdichannel_to_ami(), device_state_aggregate_calc(), device_state_cb(), device_state_get_id(), devstate_cached(), devstate_change_cb(), devstate_to_ami(), devstate_to_event(), dial_to_json(), dtmf_end_to_json(), dump_cache_load(), dump_cache_unload(), dump_consumer(), endpoint_cache_clear(), endpoint_snapshot_get_id(), endpoints_scrape_cb(), explicit_publish_cb(), fake_ami(), fake_json(), find_route(), forkcdr_callback(), generic_agent_devstate_cb(), generic_monitor_devstate_cb(), get_bool_header(), get_cached_mwi(), handle_attended_transfer(), handle_blind_transfer(), handle_bridge_enter(), handle_bridge_enter_message(), handle_bridge_leave_message(), handle_channel_snapshot_update_message(), handle_dial_message(), handle_hangup(), handle_hint_change_message_type(), handle_local_optimization_begin(), handle_local_optimization_end(), handle_masquerade(), handle_mwi_state(), handle_parked_call_message(), has_voicemail(), hold_to_json(), implicit_publish_cb(), is_msg(), local_message_to_ami(), manager_generic_msg_cb(), meetme_stasis_cb(), moh_post_start(), moh_post_stop(), multi_user_event_to_ami(), multi_user_event_to_json(), mwi_app_event_cb(), mwi_event_cb(), mwi_startup_event_cb(), mwi_state_get_id(), mwi_to_event(), mwi_update_cb(), park_announce_update_cb(), parker_update_cb(), parking_event_cb(), peerstatus_to_ami(), peerstatus_to_json(), playback_to_json(), presence_state_cached(), presence_state_cb(), presence_state_get_id(), presence_state_to_ami(), queue_agent_cb(), queue_channel_to_ami(), queue_member_to_ami(), queue_multi_channel_to_ami(), recording_to_json(), refer_progress_bridge(), registry_message_cb(), remove_device_states_cb(), rtcp_report_to_ami(), rtcp_report_to_json(), security_event_to_ami(), security_stasis_cb(), session_timeout_to_ami(), startup_event_cb(), stasis_end_to_json(), stasis_start_to_json(), stasis_state_subscriber_data(), stasis_subscription_final_message(), sub_bridge_update_handler(), sub_channel_update_handler(), sub_endpoint_update_handler(), subscription_persistence_event_cb(), system_registry_to_ami(), talking_start_to_ami(), talking_stop_to_ami(), test_cb(), test_suite_event_to_ami(), unhold_to_json(), unistim_send_mwi_to_peer(), update_registry(), updates(), varset_to_ami(), xmpp_pubsub_devstate_cb(), and xmpp_pubsub_mwi_cb().

196 {
197  if (msg == NULL) {
198  return NULL;
199  }
200  return msg->data;
201 }
#define NULL
Definition: resample.c:96

◆ stasis_message_dtor()

static void stasis_message_dtor ( void *  obj)
static

Definition at line 134 of file stasis_message.c.

References ao2_cleanup, and stasis_message::data.

Referenced by stasis_message_create_full().

135 {
136  struct stasis_message *message = obj;
137  ao2_cleanup(message->data);
138 }
#define ao2_cleanup(obj)
Definition: astobj2.h:1958

◆ stasis_message_eid()

const struct ast_eid* stasis_message_eid ( const struct stasis_message msg)

Get the entity id for a stasis_message.

Since
12.2.0
Parameters
msgMessage to get eid.
Return values
Entityid of msg

Definition at line 179 of file stasis_message.c.

References stasis_message::eid_ptr, and NULL.

Referenced by AST_TEST_DEFINE(), cache_entry_by_eid(), cache_entry_create(), cache_remove(), cache_udpate(), caching_topic_exec(), and clear_node_cache().

180 {
181  if (msg == NULL) {
182  return NULL;
183  }
184  return msg->eid_ptr;
185 }
#define NULL
Definition: resample.c:96
const struct ast_eid * eid_ptr

◆ stasis_message_timestamp()

const struct timeval* stasis_message_timestamp ( const struct stasis_message msg)

◆ stasis_message_to_ami()

struct ast_manager_event_blob* stasis_message_to_ami ( struct stasis_message msg)

Build the AMI representation of the message.

May return NULL, to indicate no representation. The returned object should be ao2_cleanup()'ed.

Parameters
msgMessage to convert to AMI.
Returns
NULL on error.
NULL if AMI format is not supported.

Definition at line 224 of file stasis_message.c.

References INVOKE_VIRTUAL, and to_ami().

Referenced by action_devicestatelist(), action_presencestatelist(), AST_TEST_DEFINE(), and manager_default_msg_cb().

225 {
226  return INVOKE_VIRTUAL(to_ami, msg);
227 }
#define INVOKE_VIRTUAL(fn,...)
static void to_ami(struct ast_sip_subscription *sub, struct ast_str **buf)

◆ stasis_message_to_event()

struct ast_event* stasis_message_to_event ( struct stasis_message msg)

Build the Generic event system representation of the message.

May return NULL, to indicate no representation. The returned object should be disposed of via ast_event_destroy.

Parameters
msgMessage to convert to AMI.
Returns
NULL on error.
NULL if AMI format is not supported.

Definition at line 236 of file stasis_message.c.

References INVOKE_VIRTUAL.

Referenced by publish_to_corosync().

237 {
238  return INVOKE_VIRTUAL(to_event, msg);
239 }
#define INVOKE_VIRTUAL(fn,...)

◆ stasis_message_to_json()

struct ast_json* stasis_message_to_json ( struct stasis_message msg,
struct stasis_message_sanitizer sanitize 
)

Build the JSON representation of the message.

May return NULL, to indicate no representation. The returned object should be ast_json_unref()'ed.

Parameters
msgMessage to convert to JSON string.
sanitizeSnapshot sanitization callback.
Returns
Newly allocated string with JSON message.
NULL on error.
NULL if JSON format is not supported.

Definition at line 229 of file stasis_message.c.

References INVOKE_VIRTUAL.

Referenced by AST_TEST_DEFINE(), rtcp_message_handler(), and sub_default_handler().

232 {
233  return INVOKE_VIRTUAL(to_json, msg, sanitize);
234 }
#define INVOKE_VIRTUAL(fn,...)

◆ stasis_message_type()

struct stasis_message_type* stasis_message_type ( const struct stasis_message msg)

Get the message type for a stasis_message.

Parameters
msgMessage to type
Returns
Type of msg
NULL if msg is NULL.
Since
12

Definition at line 187 of file stasis_message.c.

References NULL, and stasis_message::type.

Referenced by acl_change_stasis_cb(), appcdr_callback(), AST_TEST_DEFINE(), asterisk_publisher_devstate_cb(), asterisk_publisher_mwistate_cb(), cache_entry_create(), cache_put(), cache_simple(), cache_test_aggregate_calc_fn(), cache_test_data_id(), cache_update(), caching_topic_exec(), cdr_prop_write_callback(), cdr_read_callback(), cdr_write_callback(), conf_send_event_to_participants(), confbridge_publish_manager_event(), device_state_cb(), device_state_get_id(), devstate_change_cb(), dispatch_message(), dump_consumer(), endpoint_snapshot_get_id(), find_route(), forkcdr_callback(), generic_agent_devstate_cb(), generic_monitor_devstate_cb(), handle_hint_change_message_type(), is_msg(), local_message_to_ami(), meetme_stasis_cb(), message_sink_cb(), mwi_event_cb(), mwi_startup_event_cb(), mwi_stasis_cb(), mwi_state_get_id(), mwi_update_cb(), network_change_stasis_cb(), pack_bridge_and_channels(), park_announce_update_cb(), parker_update_cb(), parking_event_cb(), presence_state_cb(), presence_state_get_id(), publish_msg(), queue_agent_cb(), refer_progress_bridge(), rtcp_report_to_ami(), rtp_topic_handler(), security_event_to_ami(), security_stasis_cb(), startup_event_cb(), stasis_subscription_final_message(), statsmaker(), sub_default_handler(), sub_endpoint_update_handler(), subscription_invoke(), subscription_persistence_event_cb(), test_cb(), update_create(), xmpp_pubsub_devstate_cb(), and xmpp_pubsub_mwi_cb().

188 {
189  if (msg == NULL) {
190  return NULL;
191  }
192  return msg->type;
193 }
#define NULL
Definition: resample.c:96
struct stasis_message_type * type

◆ stasis_message_type_available_formatters()

enum stasis_subscription_message_formatters stasis_message_type_available_formatters ( const struct stasis_message_type message_type)

Get a bitmap of available formatters for a message type.

Parameters
message_typeMessage type
Returns
A bitmap of stasis_subscription_message_formatters
Since
13.25.0
16.2.0

Definition at line 114 of file stasis_message.c.

References stasis_message_type::available_formatters.

Referenced by dispatch_message().

116 {
117  return type->available_formatters;
118 }
enum stasis_subscription_message_formatters available_formatters

◆ stasis_message_type_create()

int stasis_message_type_create ( const char *  name,
struct stasis_message_vtable vtable,
struct stasis_message_type **  result 
)

Create a new message type.

stasis_message_type is an AO2 object, so ao2_cleanup() when you're done with it.

Parameters
nameName of the new type.
vtableVirtual table of message methods. May be NULL.
[out]resultThe location where the new message type will be placed
Note
Stasis message type creation may be declined if the message type is disabled
Returns
A stasis_message_type_result enum
Since
12

Definition at line 56 of file stasis_message.c.

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_t_alloc_options, ast_atomic_fetchadd_int(), ast_hashtab_hash_string(), ast_strdup, stasis_message_type::available_formatters, stasis_message_type::hash, stasis_message_type::id, message_type_dtor(), message_type_id, stasis_message_type::name, null_vtable, STASIS_MESSAGE_TYPE_DECLINED, stasis_message_type_declined(), STASIS_MESSAGE_TYPE_ERROR, STASIS_MESSAGE_TYPE_SUCCESS, STASIS_SUBSCRIPTION_FORMATTER_AMI, STASIS_SUBSCRIPTION_FORMATTER_EVENT, STASIS_SUBSCRIPTION_FORMATTER_JSON, stasis_message_vtable::to_ami, stasis_message_vtable::to_event, stasis_message_vtable::to_json, type, and stasis_message_type::vtable.

Referenced by AST_TEST_DEFINE(), and create_message_types().

59 {
60  struct stasis_message_type *type;
61 
62  /* Check for declination */
65  }
66 
67  type = ao2_t_alloc_options(sizeof(*type), message_type_dtor,
69  if (!type) {
71  }
72  if (!vtable) {
73  /* Null object pattern, FTW! */
74  vtable = &null_vtable;
75  }
76 
77  type->name = ast_strdup(name);
78  if (!type->name) {
79  ao2_cleanup(type);
81  }
83  type->vtable = vtable;
84  if (vtable->to_json) {
86  }
87  if (vtable->to_ami) {
89  }
90  if (vtable->to_event) {
92  }
94  *result = type;
95 
97 }
static const char type[]
Definition: chan_ooh323.c:109
int stasis_message_type_declined(const char *name)
Check whether a message type is declined.
Definition: stasis.c:2283
static int message_type_id
#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg)
Allocate and initialize an object.
Definition: astobj2.h:404
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:243
struct ast_event *(* to_event)(struct stasis_message *message)
Build the ast_event representation of the message.
Definition: stasis.h:281
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
Definition: lock.h:755
struct ast_json *(* to_json)(struct stasis_message *message, const struct stasis_message_sanitizer *sanitize)
Build the JSON representation of the message.
Definition: stasis.h:253
static struct stasis_message_vtable null_vtable
static void message_type_dtor(void *obj)
struct ast_manager_event_blob *(* to_ami)(struct stasis_message *message)
Build the AMI representation of the message.
Definition: stasis.h:266
static const char name[]
Definition: cdr_mysql.c:74
unsigned int ast_hashtab_hash_string(const void *obj)
Hashes a string to a number.
Definition: hashtab.c:153
struct stasis_message_vtable * vtable
#define ao2_cleanup(obj)
Definition: astobj2.h:1958
enum stasis_subscription_message_formatters available_formatters

◆ stasis_message_type_hash()

unsigned int stasis_message_type_hash ( const struct stasis_message_type type)

Gets the hash of a given message type.

Parameters
typeThe type to get the hash of.
Returns
The hash
Since
13.24.0

Definition at line 104 of file stasis_message.c.

References stasis_message_type::hash.

Referenced by cache_entry_compute_hash().

105 {
106  return type->hash;
107 }

◆ stasis_message_type_id()

int stasis_message_type_id ( const struct stasis_message_type type)

Gets the id of a given message type.

Parameters
typeThe type to get the id of.
Returns
The id
Since
17.0.0

Definition at line 109 of file stasis_message.c.

References stasis_message_type::id.

Referenced by dispatch_message(), publish_msg(), stasis_subscription_accept_message_type(), stasis_subscription_decline_message_type(), and subscription_invoke().

110 {
111  return type->id;
112 }

◆ stasis_message_type_name()

const char* stasis_message_type_name ( const struct stasis_message_type type)

Gets the name of a given message type.

Parameters
typeThe type to get.
Returns
Name of the type.
NULL if type is NULL.
Since
12

Definition at line 99 of file stasis_message.c.

References stasis_message_type::name.

Referenced by AST_TEST_DEFINE(), cache_find(), cache_simple(), cache_test_data_id(), caching_topic_exec(), dump_consumer(), print_cache_entry(), send_msg(), stasis_subscription_accept_message_type(), stasis_subscription_decline_message_type(), statistics_show_messages(), statistics_show_subscription(), and statsmaker().

100 {
101  return type->name;
102 }

Variable Documentation

◆ message_type_id

int message_type_id
static

Definition at line 47 of file stasis_message.c.

Referenced by publish_msg(), stasis_message_type_create(), and subscription_invoke().

◆ null_vtable

struct stasis_message_vtable null_vtable = {}
static

Definition at line 46 of file stasis_message.c.

Referenced by stasis_message_type_create().