MNCC: pass the actual 'struct msgb' down the mncc_recv() callback
this is required as we no longer have a dequeue-handler that can take care of free()ing the message after passing it to the MNCC handler.
This commit is contained in:
parent
04dc88fb9d
commit
29b64e9708
|
@ -694,7 +694,7 @@ struct gsm_network {
|
|||
struct gsmnet_stats stats;
|
||||
|
||||
/* layer 4 */
|
||||
int (*mncc_recv) (struct gsm_network *net, int msg_type, void *arg);
|
||||
int (*mncc_recv) (struct gsm_network *net, struct msgb *msg);
|
||||
struct llist_head upqueue;
|
||||
struct llist_head trans_list;
|
||||
struct bsc_api *bsc_api;
|
||||
|
@ -762,7 +762,7 @@ struct gsm_sms {
|
|||
|
||||
|
||||
struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code,
|
||||
int (*mncc_recv)(struct gsm_network *, int, void *));
|
||||
int (*mncc_recv)(struct gsm_network *, struct msgb *));
|
||||
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
|
||||
u_int8_t tsc, u_int8_t bsic);
|
||||
struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <osmocore/mncc.h>
|
||||
|
||||
struct gsm_network;
|
||||
struct msgb;
|
||||
|
||||
|
||||
/* One end of a call */
|
||||
|
@ -155,7 +156,7 @@ struct gsm_data_frame {
|
|||
};
|
||||
|
||||
char *get_mncc_name(int value);
|
||||
int int_mncc_recv(struct gsm_network *net, int msg_type, void *arg);
|
||||
int int_mncc_recv(struct gsm_network *net, struct msgb *msg);
|
||||
void mncc_set_cause(struct gsm_mncc *data, int loc, int val);
|
||||
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg);
|
||||
|
||||
|
|
|
@ -1184,7 +1184,7 @@ static int bootstrap_bts(struct gsm_bts *bts)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, int, void *),
|
||||
int bsc_bootstrap_network(int (*mncc_recv)(struct gsm_network *, struct msgb *),
|
||||
const char *config_file)
|
||||
{
|
||||
struct telnet_connection dummy_conn;
|
||||
|
|
|
@ -248,7 +248,7 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, enum gsm_bts_type type,
|
|||
}
|
||||
|
||||
struct gsm_network *gsm_network_init(u_int16_t country_code, u_int16_t network_code,
|
||||
int (*mncc_recv)(struct gsm_network *, int, void *))
|
||||
int (*mncc_recv)(struct gsm_network *, struct msgb *))
|
||||
{
|
||||
struct gsm_network *net;
|
||||
|
||||
|
|
|
@ -110,7 +110,5 @@ void mncc_set_cause(struct gsm_mncc *data, int loc, int val)
|
|||
|
||||
void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg)
|
||||
{
|
||||
struct gsm_mncc *mncc = msgb_data(msg);
|
||||
|
||||
net->mncc_recv(net, mncc->msg_type, mncc);
|
||||
net->mncc_recv(net, msg);
|
||||
}
|
||||
|
|
|
@ -277,9 +277,11 @@ static int mncc_rcv_tchf(struct gsm_call *call, int msg_type,
|
|||
|
||||
|
||||
/* Internal MNCC handler input function (from CC -> MNCC -> here) */
|
||||
int int_mncc_recv(struct gsm_network *net, int msg_type, void *arg)
|
||||
int int_mncc_recv(struct gsm_network *net, struct msgb *msg)
|
||||
{
|
||||
void *arg = msgb_data(msg);
|
||||
struct gsm_mncc *data = arg;
|
||||
int msg_type = data->msg_type;
|
||||
int callref;
|
||||
struct gsm_call *call = NULL, *callt;
|
||||
int rc = 0;
|
||||
|
@ -300,7 +302,7 @@ int int_mncc_recv(struct gsm_network *net, int msg_type, void *arg)
|
|||
/* create callref, if setup is received */
|
||||
if (!call) {
|
||||
if (msg_type != MNCC_SETUP_IND)
|
||||
return 0; /* drop */
|
||||
goto out_free; /* drop */
|
||||
/* create call */
|
||||
if (!(call = talloc_zero(tall_call_ctx, struct gsm_call))) {
|
||||
struct gsm_mncc rel;
|
||||
|
@ -310,7 +312,7 @@ int int_mncc_recv(struct gsm_network *net, int msg_type, void *arg)
|
|||
mncc_set_cause(&rel, GSM48_CAUSE_LOC_PRN_S_LU,
|
||||
GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
|
||||
mncc_tx_to_cc(net, MNCC_REL_REQ, &rel);
|
||||
return 0;
|
||||
goto out_free;
|
||||
}
|
||||
llist_add_tail(&call->entry, &call_list);
|
||||
call->net = net;
|
||||
|
@ -396,5 +398,8 @@ int int_mncc_recv(struct gsm_network *net, int msg_type, void *arg)
|
|||
break;
|
||||
}
|
||||
|
||||
out_free:
|
||||
talloc_free(msg);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue