confbridge: Rename items for clarity and consistency.

struct conference_bridge_user -> struct confbridge_user
struct conference_bridge -> struct confbridge_conference
struct conference_state -> struct confbridge_state

struct conference_bridge_user *conference_bridge_user -> struct confbridge_user *user
struct conference_bridge_user *cbu -> struct confbridge_user *user
struct conference_bridge *conference_bridge -> struct confbridge_conference *conference

The names are now generally shorter, consistently used, and don't conflict
with the struct names.

This patch handles the renaming part of the issue.

(issue ASTERISK-20776)
Reported by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382764 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2013-03-09 00:21:46 +00:00
parent b4a010e958
commit 761465d642
11 changed files with 920 additions and 918 deletions

View File

@@ -36,16 +36,16 @@
#ifndef _CONF_STATE_H_
#define _CONF_STATE_H_
struct conference_state;
struct conference_bridge;
struct conference_bridge_user;
struct confbridge_state;
struct confbridge_conference;
struct confbridge_user;
typedef void (*conference_event_fn)(struct conference_bridge_user *cbu);
typedef void (*conference_entry_fn)(struct conference_bridge_user *cbu);
typedef void (*conference_exit_fn)(struct conference_bridge_user *cbu);
typedef void (*conference_event_fn)(struct confbridge_user *user);
typedef void (*conference_entry_fn)(struct confbridge_user *user);
typedef void (*conference_exit_fn)(struct confbridge_user *user);
/*! \brief A conference state object to hold the various state callback functions */
struct conference_state {
struct confbridge_state {
const char *name;
conference_event_fn join_unmarked; /*!< Handle an unmarked join event */
conference_event_fn join_waitmarked; /*!< Handle a waitmarked join event */
@@ -58,38 +58,38 @@ struct conference_state {
};
/*! \brief Conference state with no active or waiting users */
extern struct conference_state *CONF_STATE_EMPTY;
extern struct confbridge_state *CONF_STATE_EMPTY;
/*! \brief Conference state with only waiting users */
extern struct conference_state *CONF_STATE_INACTIVE;
extern struct confbridge_state *CONF_STATE_INACTIVE;
/*! \brief Conference state with only a single unmarked active user */
extern struct conference_state *CONF_STATE_SINGLE;
extern struct confbridge_state *CONF_STATE_SINGLE;
/*! \brief Conference state with only a single marked active user */
extern struct conference_state *CONF_STATE_SINGLE_MARKED;
extern struct confbridge_state *CONF_STATE_SINGLE_MARKED;
/*! \brief Conference state with multiple active users, but no marked users */
extern struct conference_state *CONF_STATE_MULTI;
extern struct confbridge_state *CONF_STATE_MULTI;
/*! \brief Conference state with multiple active users and at least one marked user */
extern struct conference_state *CONF_STATE_MULTI_MARKED;
extern struct confbridge_state *CONF_STATE_MULTI_MARKED;
/*! \brief Execute conference state transition because of a user action
* \param cbu The user that joined/left
* \param user The user that joined/left
* \param newstate The state to transition to
*/
void conf_change_state(struct conference_bridge_user *cbu, struct conference_state *newstate);
void conf_change_state(struct confbridge_user *user, struct confbridge_state *newstate);
/* Common event handlers shared between different states */
/*! \brief Logic to execute every time a waitmarked user joins an unmarked conference */
void conf_default_join_waitmarked(struct conference_bridge_user *cbu);
void conf_default_join_waitmarked(struct confbridge_user *user);
/*! \brief Logic to execute every time a waitmarked user leaves an unmarked conference */
void conf_default_leave_waitmarked(struct conference_bridge_user *cbu);
void conf_default_leave_waitmarked(struct confbridge_user *user);
/*! \brief A handler for join/leave events that are invalid in a particular state */
void conf_invalid_event_fn(struct conference_bridge_user *cbu);
void conf_invalid_event_fn(struct confbridge_user *user);
#endif

View File

@@ -201,16 +201,16 @@ struct bridge_profile {
};
/*! \brief The structure that represents a conference bridge */
struct conference_bridge {
struct confbridge_conference {
char name[MAX_CONF_NAME]; /*!< Name of the conference bridge */
struct conference_state *state; /*!< Conference state information */
struct confbridge_state *state; /*!< Conference state information */
struct ast_bridge *bridge; /*!< Bridge structure doing the mixing */
struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */
unsigned int activeusers; /*!< Number of active users present */
unsigned int markedusers; /*!< Number of marked users present */
unsigned int waitingusers; /*!< Number of waiting users present */
unsigned int locked:1; /*!< Is this conference bridge locked? */
unsigned int muted:1; /*!< Is this conference bridge muted? */
unsigned int muted:1; /*!< Is this conference bridge muted? */
unsigned int record_state:2; /*!< Whether recording is started, stopped, or should exit */
struct ast_channel *playback_chan; /*!< Channel used for playback into the conference bridge */
struct ast_channel *record_chan; /*!< Channel used for recording the conference */
@@ -218,18 +218,18 @@ struct conference_bridge {
ast_mutex_t playback_lock; /*!< Lock used for playback channel */
ast_mutex_t record_lock; /*!< Lock used for the record thread */
ast_cond_t record_cond; /*!< Recording condition variable */
AST_LIST_HEAD_NOLOCK(, conference_bridge_user) active_list; /*!< List of users participating in the conference bridge */
AST_LIST_HEAD_NOLOCK(, conference_bridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */
AST_LIST_HEAD_NOLOCK(, confbridge_user) active_list; /*!< List of users participating in the conference bridge */
AST_LIST_HEAD_NOLOCK(, confbridge_user) waiting_list; /*!< List of users waiting to join the conference bridge */
};
struct post_join_action {
int (*func)(struct conference_bridge_user *);
int (*func)(struct confbridge_user *user);
AST_LIST_ENTRY(post_join_action) list;
};
/*! \brief The structure that represents a conference bridge user */
struct conference_bridge_user {
struct conference_bridge *conference_bridge; /*!< Conference bridge they are participating in */
struct confbridge_user {
struct confbridge_conference *conference; /*!< Conference bridge they are participating in */
struct bridge_profile b_profile; /*!< The Bridge Configuration Profile */
struct user_profile u_profile; /*!< The User Configuration Profile */
char menu_name[64]; /*!< The name of the DTMF menu assigned to this user */
@@ -241,7 +241,7 @@ struct conference_bridge_user {
unsigned int kicked:1; /*!< User has been kicked from the conference */
unsigned int playing_moh:1; /*!< MOH is currently being played to the user */
AST_LIST_HEAD_NOLOCK(, post_join_action) post_join_list; /*!< List of sounds to play after joining */;
AST_LIST_ENTRY(conference_bridge_user) list; /*!< Linked list information */
AST_LIST_ENTRY(confbridge_user) list; /*!< Linked list information */
};
/*! \brief load confbridge.conf file */
@@ -296,7 +296,7 @@ void conf_bridge_profile_copy(struct bridge_profile *dst, struct bridge_profile
* \retval 0 on success, menu was found and set
* \retval -1 on error, menu was not found
*/
int conf_set_menu_to_user(const char *menu_name, struct conference_bridge_user *conference_bridge_user);
int conf_set_menu_to_user(const char *menu_name, struct confbridge_user *user);
/*!
* \brief Finds a menu_entry in a menu structure matched by DTMF sequence.
@@ -318,7 +318,7 @@ void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry);
* called to perform the menu action.
*
* \param bridge_channel Bridged channel this is involving
* \param conference_bridge_user the conference user to perform the action on.
* \param user the conference user to perform the action on.
* \param menu_entry the menu entry that invoked this callback to occur.
* \param menu an AO2 referenced pointer to the entire menu structure the menu_entry
* derived from.
@@ -333,7 +333,7 @@ void conf_menu_entry_destroy(struct conf_menu_entry *menu_entry);
*/
int conf_handle_dtmf(
struct ast_bridge_channel *bridge_channel,
struct conference_bridge_user *conference_bridge_user,
struct confbridge_user *user,
struct conf_menu_entry *menu_entry,
struct conf_menu *menu);
@@ -347,18 +347,18 @@ int func_confbridge_helper(struct ast_channel *chan, const char *cmd, char *data
/*!
* \brief Play sound file into conference bridge
*
* \param conference_bridge The conference bridge to play sound file into
* \param conference The conference bridge to play sound file into
* \param filename Sound file to play
*
* \retval 0 success
* \retval -1 failure
*/
int play_sound_file(struct conference_bridge *conference_bridge, const char *filename);
int play_sound_file(struct confbridge_conference *conference, const char *filename);
/*! \brief Callback to be called when the conference has become empty
* \param conference_bridge The conference bridge
* \param conference The conference bridge
*/
void conf_ended(struct conference_bridge *conference_bridge);
void conf_ended(struct confbridge_conference *conference);
/*!
* \brief Stop MOH for the conference user.
@@ -367,7 +367,7 @@ void conf_ended(struct conference_bridge *conference_bridge);
*
* \return Nothing
*/
void conf_moh_stop(struct conference_bridge_user *user);
void conf_moh_stop(struct confbridge_user *user);
/*!
* \brief Start MOH for the conference user.
@@ -376,88 +376,88 @@ void conf_moh_stop(struct conference_bridge_user *user);
*
* \return Nothing
*/
void conf_moh_start(struct conference_bridge_user *user);
void conf_moh_start(struct confbridge_user *user);
/*! \brief Attempt to mute/play MOH to the only user in the conference if they require it
* \param conference_bridge A conference bridge containing a single user
* \param conference A conference bridge containing a single user
*/
void conf_mute_only_active(struct conference_bridge *conference_bridge);
void conf_mute_only_active(struct confbridge_conference *conference);
/*! \brief Callback to execute any time we transition from zero to one marked users
* \param cbu The first marked user joining the conference
* \param user The first marked user joining the conference
* \retval 0 success
* \retval -1 failure
*/
int conf_handle_first_marked_common(struct conference_bridge_user *cbu);
int conf_handle_first_marked_common(struct confbridge_user *user);
/*! \brief Callback to execute any time we transition from zero to one active users
* \param conference_bridge The conference bridge with a single active user joined
* \param conference The conference bridge with a single active user joined
* \retval 0 success
* \retval -1 failure
*/
void conf_handle_first_join(struct conference_bridge *conference_bridge);
void conf_handle_first_join(struct confbridge_conference *conference);
/*! \brief Handle actions every time a waitmarked user joins w/o a marked user present
* \param cbu The waitmarked user
* \param user The waitmarked user
* \retval 0 success
* \retval -1 failure
*/
int conf_handle_inactive_waitmarked(struct conference_bridge_user *cbu);
int conf_handle_inactive_waitmarked(struct confbridge_user *user);
/*! \brief Handle actions whenever an unmarked user joins an inactive conference
* \note These actions seem like they could apply just as well to a marked user
* and possibly be made to happen any time transitioning to a single state.
*
* \param cbu The unmarked user
* \param user The unmarked user
*/
int conf_handle_only_unmarked(struct conference_bridge_user *cbu);
int conf_handle_only_unmarked(struct confbridge_user *user);
/*! \brief Handle when a conference moves to having more than one active participant
* \param conference_bridge The conference bridge with more than one active participant
* \param conference The conference bridge with more than one active participant
*/
void conf_handle_second_active(struct conference_bridge *conference_bridge);
void conf_handle_second_active(struct confbridge_conference *conference);
/*! \brief Add a conference bridge user as an unmarked active user of the conference
* \param conference_bridge The conference bridge to add the user to
* \param cbu The conference bridge user to add to the conference
* \param conference The conference bridge to add the user to
* \param user The conference bridge user to add to the conference
*/
void conf_add_user_active(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
void conf_add_user_active(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Add a conference bridge user as a marked active user of the conference
* \param conference_bridge The conference bridge to add the user to
* \param cbu The conference bridge user to add to the conference
* \param conference The conference bridge to add the user to
* \param user The conference bridge user to add to the conference
*/
void conf_add_user_marked(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
void conf_add_user_marked(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Add a conference bridge user as an waiting user of the conference
* \param conference_bridge The conference bridge to add the user to
* \param cbu The conference bridge user to add to the conference
* \param conference The conference bridge to add the user to
* \param user The conference bridge user to add to the conference
*/
void conf_add_user_waiting(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
void conf_add_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Remove a conference bridge user from the unmarked active conference users in the conference
* \param conference_bridge The conference bridge to remove the user from
* \param cbu The conference bridge user to remove from the conference
* \param conference The conference bridge to remove the user from
* \param user The conference bridge user to remove from the conference
*/
void conf_remove_user_active(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
void conf_remove_user_active(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Remove a conference bridge user from the marked active conference users in the conference
* \param conference_bridge The conference bridge to remove the user from
* \param cbu The conference bridge user to remove from the conference
* \param conference The conference bridge to remove the user from
* \param user The conference bridge user to remove from the conference
*/
void conf_remove_user_marked(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
void conf_remove_user_marked(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Remove a conference bridge user from the waiting conference users in the conference
* \param conference_bridge The conference bridge to remove the user from
* \param cbu The conference bridge user to remove from the conference
* \param conference The conference bridge to remove the user from
* \param user The conference bridge user to remove from the conference
*/
void conf_remove_user_waiting(struct conference_bridge *conference_bridge, struct conference_bridge_user *cbu);
void conf_remove_user_waiting(struct confbridge_conference *conference, struct confbridge_user *user);
/*! \brief Queue a function to run with the given conference bridge user as an argument once the state transition is complete
* \param cbu The conference bridge user to pass to the function
* \param user The conference bridge user to pass to the function
* \param func The function to queue
* \retval 0 success
* \retval non-zero failure
*/
int conf_add_post_join_action(struct conference_bridge_user *cbu, int (*func)(struct conference_bridge_user *cbu));
int conf_add_post_join_action(struct confbridge_user *user, int (*func)(struct confbridge_user *user));
#endif