nat: Rename "struct sccp_connections" to "struct nat_sccp_connection"

The name sccp_connection is used in the osmo-sccp code, sccp_connections
was used in the NAT for tracking a sccp_connection. Rename it so it is
obvious that the struct belongs to the nat.

The rename was done with sed:
$ sed -i s,"struct sccp_connections","struct nat_sccp_connection",g \
		include/openbsc/*.h src/osmo-bsc_nat/* tests/*/*
This commit is contained in:
Holger Hans Peter Freyther 2013-04-16 09:53:13 +02:00
parent 0e5f5aeaad
commit c279e39c12
10 changed files with 70 additions and 70 deletions

View File

@ -42,7 +42,7 @@
#define PAGIN_GROUP_UNASSIGNED -1 #define PAGIN_GROUP_UNASSIGNED -1
struct sccp_source_reference; struct sccp_source_reference;
struct sccp_connections; struct nat_sccp_connection;
struct bsc_nat_parsed; struct bsc_nat_parsed;
struct bsc_nat; struct bsc_nat;
struct bsc_nat_ussd_con; struct bsc_nat_ussd_con;
@ -380,7 +380,7 @@ struct bsc_nat *bsc_nat_alloc(void);
struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat); struct bsc_connection *bsc_connection_alloc(struct bsc_nat *nat);
void bsc_nat_set_msc_ip(struct bsc_nat *bsc, const char *ip); void bsc_nat_set_msc_ip(struct bsc_nat *bsc, const char *ip);
void sccp_connection_destroy(struct sccp_connections *); void sccp_connection_destroy(struct nat_sccp_connection *);
void bsc_close_connection(struct bsc_connection *); void bsc_close_connection(struct bsc_connection *);
const char *bsc_con_type_to_string(int type); const char *bsc_con_type_to_string(int type);
@ -404,31 +404,31 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
struct bsc_nat_parsed *, int *con_type, char **imsi, struct bsc_nat_parsed *, int *con_type, char **imsi,
struct bsc_nat_reject_cause *cause); struct bsc_nat_reject_cause *cause);
int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg, int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct nat_sccp_connection *con, struct bsc_nat_parsed *parsed,
struct bsc_nat_reject_cause *cause); struct bsc_nat_reject_cause *cause);
/** /**
* SCCP patching and handling * SCCP patching and handling
*/ */
struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parsed); struct nat_sccp_connection *create_sccp_src_ref(struct bsc_connection *bsc, struct bsc_nat_parsed *parsed);
int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *parsed); int update_sccp_src_ref(struct nat_sccp_connection *sccp, struct bsc_nat_parsed *parsed);
void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed); void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed);
struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *); struct nat_sccp_connection *patch_sccp_src_ref_to_bsc(struct msgb *, struct bsc_nat_parsed *, struct bsc_nat *);
struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *); struct nat_sccp_connection *patch_sccp_src_ref_to_msc(struct msgb *, struct bsc_nat_parsed *, struct bsc_connection *);
struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *); struct nat_sccp_connection *bsc_nat_find_con_by_bsc(struct bsc_nat *, struct sccp_source_reference *);
/** /**
* MGCP/Audio handling * MGCP/Audio handling
*/ */
int bsc_mgcp_nr_multiplexes(int max_endpoints); int bsc_mgcp_nr_multiplexes(int max_endpoints);
int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length); int bsc_write_mgcp(struct bsc_connection *bsc, const uint8_t *data, unsigned int length);
int bsc_mgcp_assign_patch(struct sccp_connections *, struct msgb *msg); int bsc_mgcp_assign_patch(struct nat_sccp_connection *, struct msgb *msg);
void bsc_mgcp_init(struct sccp_connections *); void bsc_mgcp_init(struct nat_sccp_connection *);
void bsc_mgcp_dlcx(struct sccp_connections *); void bsc_mgcp_dlcx(struct nat_sccp_connection *);
void bsc_mgcp_free_endpoints(struct bsc_nat *nat); void bsc_mgcp_free_endpoints(struct bsc_nat *nat);
int bsc_mgcp_nat_init(struct bsc_nat *nat); int bsc_mgcp_nat_init(struct bsc_nat *nat);
struct sccp_connections *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number); struct nat_sccp_connection *bsc_mgcp_find_con(struct bsc_nat *, int endpoint_number);
struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip, int port); struct msgb *bsc_mgcp_rewrite(char *input, int length, int endp, const char *ip, int port);
void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg); void bsc_mgcp_forward(struct bsc_connection *bsc, struct msgb *msg);
@ -452,13 +452,13 @@ int bsc_nat_lst_check_allow(struct bsc_nat_acc_lst *lst, const char *imsi);
int bsc_nat_msc_is_connected(struct bsc_nat *nat); int bsc_nat_msc_is_connected(struct bsc_nat *nat);
int bsc_conn_type_to_ctr(struct sccp_connections *conn); int bsc_conn_type_to_ctr(struct nat_sccp_connection *conn);
struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, struct msgb *msg, uint32_t *len); struct gsm48_hdr *bsc_unpack_dtap(struct bsc_nat_parsed *parsed, struct msgb *msg, uint32_t *len);
/** USSD filtering */ /** USSD filtering */
int bsc_ussd_init(struct bsc_nat *nat); int bsc_ussd_init(struct bsc_nat *nat);
int bsc_check_ussd(struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct msgb *msg); int bsc_check_ussd(struct nat_sccp_connection *con, struct bsc_nat_parsed *parsed, struct msgb *msg);
int bsc_close_ussd_connections(struct bsc_nat *nat); int bsc_close_ussd_connections(struct bsc_nat *nat);
struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi); struct msgb *bsc_nat_rewrite_msg(struct bsc_nat *nat, struct msgb *msg, struct bsc_nat_parsed *, const char *imsi);

View File

@ -62,7 +62,7 @@ struct bsc_nat_parsed {
* be updated on new SCCP connections, connection confirm and reject, * be updated on new SCCP connections, connection confirm and reject,
* and on the loss of the BSC connection. * and on the loss of the BSC connection.
*/ */
struct sccp_connections { struct nat_sccp_connection {
struct llist_head list_entry; struct llist_head list_entry;
struct bsc_connection *bsc; struct bsc_connection *bsc;

View File

@ -108,7 +108,7 @@ static int bsc_init_endps_if_needed(struct bsc_connection *con)
return con->_endpoint_status == NULL; return con->_endpoint_status == NULL;
} }
static int bsc_assign_endpoint(struct bsc_connection *bsc, struct sccp_connections *con) static int bsc_assign_endpoint(struct bsc_connection *bsc, struct nat_sccp_connection *con)
{ {
int multiplex; int multiplex;
int timeslot; int timeslot;
@ -165,9 +165,9 @@ static uint16_t create_cic(int endpoint)
return (multiplex << 5) | (timeslot & 0x1f); return (multiplex << 5) | (timeslot & 0x1f);
} }
int bsc_mgcp_assign_patch(struct sccp_connections *con, struct msgb *msg) int bsc_mgcp_assign_patch(struct nat_sccp_connection *con, struct msgb *msg)
{ {
struct sccp_connections *mcon; struct nat_sccp_connection *mcon;
struct tlv_parsed tp; struct tlv_parsed tp;
uint16_t cic; uint16_t cic;
uint8_t timeslot; uint8_t timeslot;
@ -299,7 +299,7 @@ static void bsc_mgcp_send_dlcx(struct bsc_connection *bsc, int endpoint, int tra
bsc_write_mgcp(bsc, (uint8_t *) buf, len); bsc_write_mgcp(bsc, (uint8_t *) buf, len);
} }
void bsc_mgcp_init(struct sccp_connections *con) void bsc_mgcp_init(struct nat_sccp_connection *con)
{ {
con->msc_endp = -1; con->msc_endp = -1;
con->bsc_endp = -1; con->bsc_endp = -1;
@ -310,7 +310,7 @@ void bsc_mgcp_init(struct sccp_connections *con)
* once the internal DLCX response arrives this can be combined with the * once the internal DLCX response arrives this can be combined with the
* the BSC side and forwarded as a trap. * the BSC side and forwarded as a trap.
*/ */
static void remember_pending_dlcx(struct sccp_connections *con, uint32_t transaction) static void remember_pending_dlcx(struct nat_sccp_connection *con, uint32_t transaction)
{ {
struct bsc_nat_call_stats *stats; struct bsc_nat_call_stats *stats;
struct bsc_connection *bsc = con->bsc; struct bsc_connection *bsc = con->bsc;
@ -366,7 +366,7 @@ static void remember_pending_dlcx(struct sccp_connections *con, uint32_t transac
llist_add_tail(&stats->entry, &bsc->pending_dlcx); llist_add_tail(&stats->entry, &bsc->pending_dlcx);
} }
void bsc_mgcp_dlcx(struct sccp_connections *con) void bsc_mgcp_dlcx(struct nat_sccp_connection *con)
{ {
/* send a DLCX down the stream */ /* send a DLCX down the stream */
if (con->bsc_endp != -1 && con->bsc->_endpoint_status) { if (con->bsc_endp != -1 && con->bsc->_endpoint_status) {
@ -475,10 +475,10 @@ free_stat:
} }
struct sccp_connections *bsc_mgcp_find_con(struct bsc_nat *nat, int endpoint) struct nat_sccp_connection *bsc_mgcp_find_con(struct bsc_nat *nat, int endpoint)
{ {
struct sccp_connections *con = NULL; struct nat_sccp_connection *con = NULL;
struct sccp_connections *sccp; struct nat_sccp_connection *sccp;
llist_for_each_entry(sccp, &nat->sccp_connections, list_entry) { llist_for_each_entry(sccp, &nat->sccp_connections, list_entry) {
if (sccp->msc_endp == -1) if (sccp->msc_endp == -1)
@ -501,7 +501,7 @@ static int bsc_mgcp_policy_cb(struct mgcp_trunk_config *tcfg, int endpoint, int
{ {
struct bsc_nat *nat; struct bsc_nat *nat;
struct bsc_endpoint *bsc_endp; struct bsc_endpoint *bsc_endp;
struct sccp_connections *sccp; struct nat_sccp_connection *sccp;
struct mgcp_endpoint *mgcp_endp; struct mgcp_endpoint *mgcp_endp;
struct msgb *bsc_msg; struct msgb *bsc_msg;
@ -590,7 +590,7 @@ static void free_chan_downstream(struct mgcp_endpoint *endp, struct bsc_endpoint
/* if a CRCX failed... send a DLCX down the stream */ /* if a CRCX failed... send a DLCX down the stream */
if (bsc_endp->transaction_state == MGCP_ENDP_CRCX) { if (bsc_endp->transaction_state == MGCP_ENDP_CRCX) {
struct sccp_connections *con; struct nat_sccp_connection *con;
con = bsc_mgcp_find_con(bsc->nat, ENDPOINT_NUMBER(endp)); con = bsc_mgcp_find_con(bsc->nat, ENDPOINT_NUMBER(endp));
if (!con) { if (!con) {
LOGP(DMGCP, LOGL_ERROR, LOGP(DMGCP, LOGL_ERROR,

View File

@ -200,7 +200,7 @@ static void send_id_req(struct bsc_connection *bsc)
bsc_send_data(bsc, id_req, sizeof(id_req), IPAC_PROTO_IPACCESS); bsc_send_data(bsc, id_req, sizeof(id_req), IPAC_PROTO_IPACCESS);
} }
static struct msgb *nat_create_rlsd(struct sccp_connections *conn) static struct msgb *nat_create_rlsd(struct nat_sccp_connection *conn)
{ {
struct sccp_connection_released *rel; struct sccp_connection_released *rel;
struct msgb *msg; struct msgb *msg;
@ -221,7 +221,7 @@ static struct msgb *nat_create_rlsd(struct sccp_connections *conn)
return msg; return msg;
} }
static void nat_send_rlsd_ussd(struct bsc_nat *nat, struct sccp_connections *conn) static void nat_send_rlsd_ussd(struct bsc_nat *nat, struct nat_sccp_connection *conn)
{ {
struct msgb *msg; struct msgb *msg;
@ -235,7 +235,7 @@ static void nat_send_rlsd_ussd(struct bsc_nat *nat, struct sccp_connections *con
bsc_do_write(&nat->ussd_con->queue, msg, IPAC_PROTO_SCCP); bsc_do_write(&nat->ussd_con->queue, msg, IPAC_PROTO_SCCP);
} }
static void nat_send_rlsd_msc(struct sccp_connections *conn) static void nat_send_rlsd_msc(struct nat_sccp_connection *conn)
{ {
struct msgb *msg; struct msgb *msg;
@ -247,7 +247,7 @@ static void nat_send_rlsd_msc(struct sccp_connections *conn)
queue_for_msc(conn->msc_con, msg); queue_for_msc(conn->msc_con, msg);
} }
static void nat_send_rlsd_bsc(struct sccp_connections *conn) static void nat_send_rlsd_bsc(struct nat_sccp_connection *conn)
{ {
struct msgb *msg; struct msgb *msg;
struct sccp_connection_released *rel; struct sccp_connection_released *rel;
@ -268,7 +268,7 @@ static void nat_send_rlsd_bsc(struct sccp_connections *conn)
bsc_write(conn->bsc, msg, IPAC_PROTO_SCCP); bsc_write(conn->bsc, msg, IPAC_PROTO_SCCP);
} }
static struct msgb *nat_creat_clrc(struct sccp_connections *conn, uint8_t cause) static struct msgb *nat_creat_clrc(struct nat_sccp_connection *conn, uint8_t cause)
{ {
struct msgb *msg; struct msgb *msg;
struct msgb *sccp; struct msgb *sccp;
@ -290,7 +290,7 @@ static struct msgb *nat_creat_clrc(struct sccp_connections *conn, uint8_t cause)
return sccp; return sccp;
} }
static int nat_send_clrc_bsc(struct sccp_connections *conn) static int nat_send_clrc_bsc(struct nat_sccp_connection *conn)
{ {
struct msgb *sccp; struct msgb *sccp;
@ -423,7 +423,7 @@ static void bsc_stat_reject(int filter, struct bsc_connection *bsc, int normal)
* 2.1) Depending on the con type reject the service, or just close it * 2.1) Depending on the con type reject the service, or just close it
*/ */
static void bsc_send_con_release(struct bsc_connection *bsc, static void bsc_send_con_release(struct bsc_connection *bsc,
struct sccp_connections *con, struct nat_sccp_connection *con,
struct bsc_nat_reject_cause *cause) struct bsc_nat_reject_cause *cause)
{ {
struct msgb *rlsd; struct msgb *rlsd;
@ -496,7 +496,7 @@ static void bsc_send_con_refuse(struct bsc_connection *bsc,
*/ */
if (payload) { if (payload) {
struct msgb *cc, *udt, *clear, *rlsd; struct msgb *cc, *udt, *clear, *rlsd;
struct sccp_connections *con; struct nat_sccp_connection *con;
con = create_sccp_src_ref(bsc, parsed); con = create_sccp_src_ref(bsc, parsed);
if (!con) if (!con)
goto send_refuse; goto send_refuse;
@ -612,7 +612,7 @@ static void bsc_nat_handle_paging(struct bsc_nat *nat, struct msgb *msg)
* Update the auth status. This can be either a CIPHER MODE COMAMND or * Update the auth status. This can be either a CIPHER MODE COMAMND or
* a CM Serivce Accept. Maybe also LU Accept or such in the future. * a CM Serivce Accept. Maybe also LU Accept or such in the future.
*/ */
static void update_con_authorize(struct sccp_connections *con, static void update_con_authorize(struct nat_sccp_connection *con,
struct bsc_nat_parsed *parsed, struct bsc_nat_parsed *parsed,
struct msgb *msg) struct msgb *msg)
{ {
@ -642,7 +642,7 @@ static void update_con_authorize(struct sccp_connections *con,
static int forward_sccp_to_bts(struct bsc_msc_connection *msc_con, struct msgb *msg) static int forward_sccp_to_bts(struct bsc_msc_connection *msc_con, struct msgb *msg)
{ {
struct sccp_connections *con = NULL; struct nat_sccp_connection *con = NULL;
struct bsc_connection *bsc; struct bsc_connection *bsc;
struct bsc_nat_parsed *parsed; struct bsc_nat_parsed *parsed;
int proto; int proto;
@ -862,7 +862,7 @@ static int ipaccess_msc_write_cb(struct osmo_fd *bfd, struct msgb *msg)
*/ */
void bsc_close_connection(struct bsc_connection *connection) void bsc_close_connection(struct bsc_connection *connection)
{ {
struct sccp_connections *sccp_patch, *tmp; struct nat_sccp_connection *sccp_patch, *tmp;
struct bsc_cmd_list *cmd_entry, *cmd_tmp; struct bsc_cmd_list *cmd_entry, *cmd_tmp;
struct rate_ctr *ctr = NULL; struct rate_ctr *ctr = NULL;
@ -912,7 +912,7 @@ void bsc_close_connection(struct bsc_connection *connection)
static void bsc_maybe_close(struct bsc_connection *bsc) static void bsc_maybe_close(struct bsc_connection *bsc)
{ {
struct sccp_connections *sccp; struct nat_sccp_connection *sccp;
if (!bsc->nat->blocked) if (!bsc->nat->blocked)
return; return;
@ -987,7 +987,7 @@ static void ipaccess_auth_bsc(struct tlv_parsed *tvp, struct bsc_connection *bsc
bsc->write_queue.bfd.fd); bsc->write_queue.bfd.fd);
} }
static void handle_con_stats(struct sccp_connections *con) static void handle_con_stats(struct nat_sccp_connection *con)
{ {
struct rate_ctr_group *ctrg; struct rate_ctr_group *ctrg;
int id = bsc_conn_type_to_ctr(con); int id = bsc_conn_type_to_ctr(con);
@ -1038,7 +1038,7 @@ static int forward_sccp_to_msc(struct bsc_connection *bsc, struct msgb *msg)
/* modify the SCCP entries */ /* modify the SCCP entries */
if (parsed->ipa_proto == IPAC_PROTO_SCCP) { if (parsed->ipa_proto == IPAC_PROTO_SCCP) {
int filter; int filter;
struct sccp_connections *con; struct nat_sccp_connection *con;
switch (parsed->sccp_type) { switch (parsed->sccp_type) {
case SCCP_MSG_TYPE_CR: case SCCP_MSG_TYPE_CR:
memset(&cause, 0, sizeof(cause)); memset(&cause, 0, sizeof(cause));
@ -1433,7 +1433,7 @@ static void sccp_close_unconfirmed(void *_data)
{ {
int destroyed = 0; int destroyed = 0;
struct bsc_connection *bsc, *bsc_tmp; struct bsc_connection *bsc, *bsc_tmp;
struct sccp_connections *conn, *tmp1; struct nat_sccp_connection *conn, *tmp1;
struct timespec now; struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
@ -1595,7 +1595,7 @@ int main(int argc, char **argv)
/* Close all connections handed out to the USSD module */ /* Close all connections handed out to the USSD module */
int bsc_close_ussd_connections(struct bsc_nat *nat) int bsc_close_ussd_connections(struct bsc_nat *nat)
{ {
struct sccp_connections *con; struct nat_sccp_connection *con;
llist_for_each_entry(con, &nat->sccp_connections, list_entry) { llist_for_each_entry(con, &nat->sccp_connections, list_entry) {
if (con->con_local != NAT_CON_END_USSD) if (con->con_local != NAT_CON_END_USSD)
continue; continue;

View File

@ -290,7 +290,7 @@ static int _cr_check_pag_resp(struct bsc_connection *bsc,
static int _dt_check_id_resp(struct bsc_connection *bsc, static int _dt_check_id_resp(struct bsc_connection *bsc,
uint8_t *data, unsigned int length, uint8_t *data, unsigned int length,
struct sccp_connections *con, struct nat_sccp_connection *con,
struct bsc_nat_reject_cause *cause) struct bsc_nat_reject_cause *cause)
{ {
char mi_string[GSM48_MI_SIZE]; char mi_string[GSM48_MI_SIZE];
@ -404,7 +404,7 @@ int bsc_nat_filter_sccp_cr(struct bsc_connection *bsc, struct msgb *msg,
} }
int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg, int bsc_nat_filter_dt(struct bsc_connection *bsc, struct msgb *msg,
struct sccp_connections *con, struct bsc_nat_parsed *parsed, struct nat_sccp_connection *con, struct bsc_nat_parsed *parsed,
struct bsc_nat_reject_cause *cause) struct bsc_nat_reject_cause *cause)
{ {
uint32_t len; uint32_t len;

View File

@ -271,7 +271,7 @@ int bsc_config_handles_lac(struct bsc_config *cfg, int lac_nr)
return 0; return 0;
} }
void sccp_connection_destroy(struct sccp_connections *conn) void sccp_connection_destroy(struct nat_sccp_connection *conn)
{ {
LOGP(DNAT, LOGL_DEBUG, "Destroy 0x%x <-> 0x%x mapping for con %p\n", LOGP(DNAT, LOGL_DEBUG, "Destroy 0x%x <-> 0x%x mapping for con %p\n",
sccp_src_ref_to_int(&conn->real_ref), sccp_src_ref_to_int(&conn->real_ref),
@ -486,7 +486,7 @@ static const int con_to_ctr[] = {
[NAT_CON_TYPE_OTHER] = BCFG_CTR_CON_OTHER, [NAT_CON_TYPE_OTHER] = BCFG_CTR_CON_OTHER,
}; };
int bsc_conn_type_to_ctr(struct sccp_connections *conn) int bsc_conn_type_to_ctr(struct nat_sccp_connection *conn)
{ {
return con_to_ctr[conn->con_type]; return con_to_ctr[conn->con_type];
} }

View File

@ -178,7 +178,7 @@ DEFUN(show_sccp, show_sccp_cmd, "show sccp connections",
SHOW_STR "Display information about SCCP\n" SHOW_STR "Display information about SCCP\n"
"All active connections\n") "All active connections\n")
{ {
struct sccp_connections *con; struct nat_sccp_connection *con;
vty_out(vty, "Listing all open SCCP connections%s", VTY_NEWLINE); vty_out(vty, "Listing all open SCCP connections%s", VTY_NEWLINE);
llist_for_each_entry(con, &_nat->sccp_connections, list_entry) { llist_for_each_entry(con, &_nat->sccp_connections, list_entry) {

View File

@ -42,7 +42,7 @@ static int equal(struct sccp_source_reference *ref1, struct sccp_source_referenc
/* check if we are using this ref for patched already */ /* check if we are using this ref for patched already */
static int sccp_ref_is_free(struct sccp_source_reference *ref, struct bsc_nat *nat) static int sccp_ref_is_free(struct sccp_source_reference *ref, struct bsc_nat *nat)
{ {
struct sccp_connections *conn; struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &nat->sccp_connections, list_entry) { llist_for_each_entry(conn, &nat->sccp_connections, list_entry) {
if (memcmp(ref, &conn->patched_ref, sizeof(*ref)) == 0) if (memcmp(ref, &conn->patched_ref, sizeof(*ref)) == 0)
@ -82,10 +82,10 @@ static int assign_src_local_reference(struct sccp_source_reference *ref, struct
return -1; return -1;
} }
struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc, struct nat_sccp_connection *create_sccp_src_ref(struct bsc_connection *bsc,
struct bsc_nat_parsed *parsed) struct bsc_nat_parsed *parsed)
{ {
struct sccp_connections *conn; struct nat_sccp_connection *conn;
/* Some commercial BSCs like to reassign there SRC ref */ /* Some commercial BSCs like to reassign there SRC ref */
llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) { llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) {
@ -111,7 +111,7 @@ struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc,
} }
conn = talloc_zero(bsc->nat, struct sccp_connections); conn = talloc_zero(bsc->nat, struct nat_sccp_connection);
if (!conn) { if (!conn) {
LOGP(DNAT, LOGL_ERROR, "Memory allocation failure.\n"); LOGP(DNAT, LOGL_ERROR, "Memory allocation failure.\n");
return NULL; return NULL;
@ -138,7 +138,7 @@ struct sccp_connections *create_sccp_src_ref(struct bsc_connection *bsc,
return conn; return conn;
} }
int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *parsed) int update_sccp_src_ref(struct nat_sccp_connection *sccp, struct bsc_nat_parsed *parsed)
{ {
if (!parsed->dest_local_ref || !parsed->src_local_ref) { if (!parsed->dest_local_ref || !parsed->src_local_ref) {
LOGP(DNAT, LOGL_ERROR, "CC MSG should contain both local and dest address.\n"); LOGP(DNAT, LOGL_ERROR, "CC MSG should contain both local and dest address.\n");
@ -156,7 +156,7 @@ int update_sccp_src_ref(struct sccp_connections *sccp, struct bsc_nat_parsed *pa
void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed) void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bsc_nat_parsed *parsed)
{ {
struct sccp_connections *conn; struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) { llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) {
if (memcmp(parsed->src_local_ref, if (memcmp(parsed->src_local_ref,
@ -176,11 +176,11 @@ void remove_sccp_src_ref(struct bsc_connection *bsc, struct msgb *msg, struct bs
* an address that was assigned by the MUX, we need to update the * an address that was assigned by the MUX, we need to update the
* dest reference to the real network. * dest reference to the real network.
*/ */
struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *msg, struct nat_sccp_connection *patch_sccp_src_ref_to_bsc(struct msgb *msg,
struct bsc_nat_parsed *parsed, struct bsc_nat_parsed *parsed,
struct bsc_nat *nat) struct bsc_nat *nat)
{ {
struct sccp_connections *conn; struct nat_sccp_connection *conn;
if (!parsed->dest_local_ref) { if (!parsed->dest_local_ref) {
LOGP(DNAT, LOGL_ERROR, "MSG should contain dest_local_ref.\n"); LOGP(DNAT, LOGL_ERROR, "MSG should contain dest_local_ref.\n");
@ -208,11 +208,11 @@ struct sccp_connections *patch_sccp_src_ref_to_bsc(struct msgb *msg,
* in all other cases we need to work by the destination local * in all other cases we need to work by the destination local
* reference.. * reference..
*/ */
struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *msg, struct nat_sccp_connection *patch_sccp_src_ref_to_msc(struct msgb *msg,
struct bsc_nat_parsed *parsed, struct bsc_nat_parsed *parsed,
struct bsc_connection *bsc) struct bsc_connection *bsc)
{ {
struct sccp_connections *conn; struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) { llist_for_each_entry(conn, &bsc->nat->sccp_connections, list_entry) {
if (conn->bsc != bsc) if (conn->bsc != bsc)
@ -235,10 +235,10 @@ struct sccp_connections *patch_sccp_src_ref_to_msc(struct msgb *msg,
return NULL; return NULL;
} }
struct sccp_connections *bsc_nat_find_con_by_bsc(struct bsc_nat *nat, struct nat_sccp_connection *bsc_nat_find_con_by_bsc(struct bsc_nat *nat,
struct sccp_source_reference *ref) struct sccp_source_reference *ref)
{ {
struct sccp_connections *conn; struct nat_sccp_connection *conn;
llist_for_each_entry(conn, &nat->sccp_connections, list_entry) { llist_for_each_entry(conn, &nat->sccp_connections, list_entry) {
if (memcmp(ref, &conn->real_ref, sizeof(*ref)) == 0) if (memcmp(ref, &conn->real_ref, sizeof(*ref)) == 0)

View File

@ -68,7 +68,7 @@ static void bsc_nat_ussd_destroy(struct bsc_nat_ussd_con *con)
static int forward_sccp(struct bsc_nat *nat, struct msgb *msg) static int forward_sccp(struct bsc_nat *nat, struct msgb *msg)
{ {
struct sccp_connections *con; struct nat_sccp_connection *con;
struct bsc_nat_parsed *parsed; struct bsc_nat_parsed *parsed;
@ -255,7 +255,7 @@ int bsc_ussd_init(struct bsc_nat *nat)
ntohl(addr.s_addr), 5001, 0, ussd_listen_cb, nat); ntohl(addr.s_addr), 5001, 0, ussd_listen_cb, nat);
} }
static int forward_ussd_simple(struct sccp_connections *con, struct msgb *input) static int forward_ussd_simple(struct nat_sccp_connection *con, struct msgb *input)
{ {
struct msgb *copy; struct msgb *copy;
struct bsc_nat_ussd_con *ussd; struct bsc_nat_ussd_con *ussd;
@ -279,7 +279,7 @@ static int forward_ussd_simple(struct sccp_connections *con, struct msgb *input)
return 0; return 0;
} }
static int forward_ussd(struct sccp_connections *con, const struct ussd_request *req, static int forward_ussd(struct nat_sccp_connection *con, const struct ussd_request *req,
struct msgb *input) struct msgb *input)
{ {
struct msgb *msg, *copy; struct msgb *msg, *copy;
@ -323,7 +323,7 @@ static int forward_ussd(struct sccp_connections *con, const struct ussd_request
return 0; return 0;
} }
int bsc_check_ussd(struct sccp_connections *con, struct bsc_nat_parsed *parsed, int bsc_check_ussd(struct nat_sccp_connection *con, struct bsc_nat_parsed *parsed,
struct msgb *msg) struct msgb *msg)
{ {
uint32_t len; uint32_t len;

View File

@ -305,8 +305,8 @@ static void test_contrack()
{ {
struct bsc_nat *nat; struct bsc_nat *nat;
struct bsc_connection *con; struct bsc_connection *con;
struct sccp_connections *con_found; struct nat_sccp_connection *con_found;
struct sccp_connections *rc_con; struct nat_sccp_connection *rc_con;
struct bsc_nat_parsed *parsed; struct bsc_nat_parsed *parsed;
struct msgb *msg; struct msgb *msg;
@ -457,7 +457,7 @@ static void test_mgcp_allocations(void)
#if 0 #if 0
struct bsc_connection *bsc; struct bsc_connection *bsc;
struct bsc_nat *nat; struct bsc_nat *nat;
struct sccp_connections con; struct nat_sccp_connection con;
int i, j, multiplex; int i, j, multiplex;
printf("Testing MGCP.\n"); printf("Testing MGCP.\n");
@ -501,7 +501,7 @@ static void test_mgcp_ass_tracking(void)
{ {
struct bsc_connection *bsc; struct bsc_connection *bsc;
struct bsc_nat *nat; struct bsc_nat *nat;
struct sccp_connections con; struct nat_sccp_connection con;
struct bsc_nat_parsed *parsed; struct bsc_nat_parsed *parsed;
struct msgb *msg; struct msgb *msg;
@ -581,7 +581,7 @@ static void test_mgcp_find(void)
{ {
struct bsc_nat *nat; struct bsc_nat *nat;
struct bsc_connection *con; struct bsc_connection *con;
struct sccp_connections *sccp_con; struct nat_sccp_connection *sccp_con;
printf("Testing finding of a BSC Connection\n"); printf("Testing finding of a BSC Connection\n");
@ -589,7 +589,7 @@ static void test_mgcp_find(void)
con = bsc_connection_alloc(nat); con = bsc_connection_alloc(nat);
llist_add(&con->list_entry, &nat->bsc_connections); llist_add(&con->list_entry, &nat->bsc_connections);
sccp_con = talloc_zero(con, struct sccp_connections); sccp_con = talloc_zero(con, struct nat_sccp_connection);
sccp_con->msc_endp = 12; sccp_con->msc_endp = 12;
sccp_con->bsc_endp = 12; sccp_con->bsc_endp = 12;
sccp_con->bsc = con; sccp_con->bsc = con;
@ -832,7 +832,7 @@ static void test_dt_filter()
struct bsc_nat *nat = bsc_nat_alloc(); struct bsc_nat *nat = bsc_nat_alloc();
struct bsc_connection *bsc = bsc_connection_alloc(nat); struct bsc_connection *bsc = bsc_connection_alloc(nat);
struct sccp_connections *con = talloc_zero(0, struct sccp_connections); struct nat_sccp_connection *con = talloc_zero(0, struct nat_sccp_connection);
bsc->cfg = bsc_config_alloc(nat, "foo"); bsc->cfg = bsc_config_alloc(nat, "foo");
bsc_config_add_lac(bsc->cfg, 23); bsc_config_add_lac(bsc->cfg, 23);