Skip to content

Commit

Permalink
rtp_relay: rename binds with funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea committed Nov 22, 2021
1 parent e25873d commit c4a674f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions modules/rtp_relay/rtp_relay.h
Expand Up @@ -41,7 +41,7 @@ struct rtp_relay_server {
str node;
};

struct rtp_relay_binds {
struct rtp_relay_funcs {
int (*offer)(struct rtp_relay_session *sess, struct rtp_relay_server *server,
str *ip, str *type, str *in_iface, str *out_iface,
str *flags, str *extra, str *body);
Expand All @@ -54,24 +54,24 @@ struct rtp_relay_binds {

struct rtp_relay {
str name;
struct rtp_relay_binds binds;
struct rtp_relay_funcs funcs;
struct list_head list;
char _name_s[0];
};

typedef int (*reg_rtp_relay_f)(char *, struct rtp_relay_binds *);
typedef int (*reg_rtp_relay_f)(char *, struct rtp_relay_funcs *);
struct rtp_relay *rtp_relay_get(str *name);
int rtp_relay_reg(char *name, struct rtp_relay_binds *binds);
int rtp_relay_reg(char *name, struct rtp_relay_funcs *funcs);

static inline int register_rtp_relay(char *name, struct rtp_relay_binds *binds)
static inline int register_rtp_relay(char *name, struct rtp_relay_funcs *funcs)
{
reg_rtp_relay_f func;

/* import the rtpproxy auto-loading function */
if (!(func=(reg_rtp_relay_f)find_export("register_rtp_relay", 0)))
return -1;

return func(name, binds);
return func(name, funcs);
}

#endif /* _RTP_RELAY_H_ */
6 changes: 3 additions & 3 deletions modules/rtp_relay/rtp_relay_ctx.c
Expand Up @@ -468,7 +468,7 @@ static int rtp_relay_offer(struct rtp_relay_session *info,
LM_BUG("no relay found!\n");
return -1;
}
if (sess->relay->binds.offer(info, &sess->server,
if (sess->relay->funcs.offer(info, &sess->server,
RTP_RELAY_FLAGS(RTP_RELAY_PEER(type), RTP_RELAY_FLAGS_IP),
RTP_RELAY_FLAGS(RTP_RELAY_PEER(type), RTP_RELAY_FLAGS_TYPE),
RTP_RELAY_FLAGS(type, RTP_RELAY_FLAGS_IFACE),
Expand All @@ -490,7 +490,7 @@ static int rtp_relay_answer(struct rtp_relay_session *info,
LM_BUG("no relay found!\n");
return -1;
}
return sess->relay->binds.answer(info, &sess->server,
return sess->relay->funcs.answer(info, &sess->server,
RTP_RELAY_FLAGS(type, RTP_RELAY_FLAGS_IP),
RTP_RELAY_FLAGS(RTP_RELAY_PEER(type), RTP_RELAY_FLAGS_TYPE),
RTP_RELAY_FLAGS(RTP_RELAY_PEER(type), RTP_RELAY_FLAGS_IFACE),
Expand All @@ -508,7 +508,7 @@ static int rtp_relay_delete(struct rtp_relay_session *info,
LM_BUG("no relay found!\n");
return -1;
}
ret = sess->relay->binds.delete(info, &sess->server,
ret = sess->relay->funcs.delete(info, &sess->server,
RTP_RELAY_FLAGS(RTP_RELAY_OFFER, RTP_RELAY_FLAGS_SELF),
RTP_RELAY_FLAGS(RTP_RELAY_ANSWER, RTP_RELAY_FLAGS_PEER));
if (ret < 0)
Expand Down
4 changes: 2 additions & 2 deletions modules/rtp_relay/rtp_relay_server.c
Expand Up @@ -36,7 +36,7 @@ struct rtp_relay *rtp_relay_get(str *name)
return NULL;
}

int rtp_relay_reg(char *name, struct rtp_relay_binds *binds)
int rtp_relay_reg(char *name, struct rtp_relay_funcs *funcs)
{
struct rtp_relay *relay;
str name_s;
Expand All @@ -56,7 +56,7 @@ int rtp_relay_reg(char *name, struct rtp_relay_binds *binds)
relay->name.len = name_s.len;
relay->name.s = relay->_name_s;
memcpy(relay->name.s, name_s.s, name_s.len);
memcpy(&relay->binds, binds, sizeof *binds);
memcpy(&relay->funcs, funcs, sizeof *funcs);

list_add(&relay->list, &rtp_relays);
LM_INFO("Adding RTP relay %.*s\n", relay->name.len, relay->name.s);
Expand Down
2 changes: 1 addition & 1 deletion modules/rtpengine/rtpengine.c
Expand Up @@ -1232,7 +1232,7 @@ static pv_spec_t media_pvar;
static int mod_preinit(void)
{
static str rtpengine_relay_pvar_str = str_init("$var(___rtpengine_relay_var__)");
struct rtp_relay_binds binds = {
struct rtp_relay_funcs binds = {
.offer = rtpengine_api_offer,
.answer = rtpengine_api_answer,
.delete = rtpengine_api_delete,
Expand Down
2 changes: 1 addition & 1 deletion modules/rtpproxy/rtpproxy.c
Expand Up @@ -1052,7 +1052,7 @@ static pv_spec_t media_pvar;
static int mod_preinit(void)
{
static str rtpproxy_relay_pvar_str = str_init("$var(___rtpproxy_relay_var__)");
struct rtp_relay_binds binds = {
struct rtp_relay_funcs binds = {
.offer = rtpproxy_api_offer,
.answer = rtpproxy_api_answer,
.delete = rtpproxy_api_delete,
Expand Down

0 comments on commit c4a674f

Please sign in to comment.