From 569f1e171df2f055d0be5fc637e050a523a9ae8a Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 2 Jan 2011 18:47:49 +0100 Subject: mtp: Rename mtp_link to mtp_link_set as this is the linkset The link_udp is actually below the linkset. We need to get this right now and then can have multiple links. --- src/mtp_layer3.c | 72 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'src/mtp_layer3.c') diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c index e756440..0c835cd 100644 --- a/src/mtp_layer3.c +++ b/src/mtp_layer3.c @@ -33,9 +33,9 @@ static void *tall_mtp_ctx = NULL; -static int mtp_int_submit(struct mtp_link *link, int pc, int sls, int type, const uint8_t *data, unsigned int length); +static int mtp_int_submit(struct mtp_link_set *link, int pc, int sls, int type, const uint8_t *data, unsigned int length); -static struct msgb *mtp_msg_alloc(struct mtp_link *link) +static struct msgb *mtp_msg_alloc(struct mtp_link_set *link) { struct mtp_level_3_hdr *hdr; struct msgb *msg = msgb_alloc_headroom(4096, 128, "mtp-msg"); @@ -52,7 +52,7 @@ static struct msgb *mtp_msg_alloc(struct mtp_link *link) return msg; } -static struct msgb *mtp_create_sltm(struct mtp_link *link) +static struct msgb *mtp_create_sltm(struct mtp_link_set *link) { const uint8_t test_ptrn[14] = { 'G', 'S', 'M', 'M', 'M', 'S', }; struct mtp_level_3_hdr *hdr; @@ -79,7 +79,7 @@ static struct msgb *mtp_create_sltm(struct mtp_link *link) return msg; } -static struct msgb *mtp_create_slta(struct mtp_link *link, struct mtp_level_3_mng *in_mng, int l3_len) +static struct msgb *mtp_create_slta(struct mtp_link_set *link, struct mtp_level_3_mng *in_mng, int l3_len) { struct mtp_level_3_hdr *hdr; struct mtp_level_3_mng *mng; @@ -100,7 +100,7 @@ static struct msgb *mtp_create_slta(struct mtp_link *link, struct mtp_level_3_mn return out; } -static struct msgb *mtp_tfp_alloc(struct mtp_link *link, int apoc) +static struct msgb *mtp_tfp_alloc(struct mtp_link_set *link, int apoc) { struct mtp_level_3_hdr *hdr; struct mtp_level_3_prohib *prb; @@ -118,7 +118,7 @@ static struct msgb *mtp_tfp_alloc(struct mtp_link *link, int apoc) return out; } -static struct msgb *mtp_tra_alloc(struct mtp_link *link) +static struct msgb *mtp_tra_alloc(struct mtp_link_set *link) { struct mtp_level_3_hdr *hdr; struct mtp_level_3_cmn *cmn; @@ -135,7 +135,7 @@ static struct msgb *mtp_tra_alloc(struct mtp_link *link) return out; } -static struct msgb *mtp_sccp_alloc_scmg(struct mtp_link *link, +static struct msgb *mtp_sccp_alloc_scmg(struct mtp_link_set *link, int type, int assn, int sls) { struct sccp_data_unitdata *udt; @@ -186,12 +186,12 @@ static struct msgb *mtp_sccp_alloc_scmg(struct mtp_link *link, return out; } -void mtp_link_init(void) +void mtp_link_set_init(void) { tall_mtp_ctx = talloc_named_const(NULL, 1, "mtp-link"); } -static void mtp_send_sltm(struct mtp_link *link) +static void mtp_send_sltm(struct mtp_link_set *link) { struct msgb *msg; @@ -202,12 +202,12 @@ static void mtp_send_sltm(struct mtp_link *link) return; } - mtp_link_submit(link, msg); + mtp_link_set_submit(link, msg); } static void mtp_sltm_t1_timeout(void *_link) { - struct mtp_link *link = (struct mtp_link *) _link; + struct mtp_link_set *link = (struct mtp_link_set *) _link; if (link->slta_misses == 0) { LOGP(DINP, LOGL_ERROR, "No SLTM response. Retrying. Link: %p\n", link); @@ -219,14 +219,14 @@ static void mtp_sltm_t1_timeout(void *_link) link->sccp_up = 0; link->running = 0; bsc_del_timer(&link->t2_timer); - mtp_link_sccp_down(link); - mtp_link_restart(link); + mtp_link_set_sccp_down(link); + mtp_link_set_restart(link); } } static void mtp_sltm_t2_timeout(void *_link) { - struct mtp_link *link = (struct mtp_link *) _link; + struct mtp_link_set *link = (struct mtp_link_set *) _link; if (!link->running) { LOGP(DINP, LOGL_INFO, "Not restarting SLTM timer on link: %p\n", link); @@ -249,11 +249,11 @@ static void mtp_delayed_start(void *link) mtp_sltm_t2_timeout(link); } -struct mtp_link *mtp_link_alloc(void) +struct mtp_link_set *mtp_link_set_alloc(void) { - struct mtp_link *link; + struct mtp_link_set *link; - link = talloc_zero(tall_mtp_ctx, struct mtp_link); + link = talloc_zero(tall_mtp_ctx, struct mtp_link_set); if (!link) return NULL; @@ -267,7 +267,7 @@ struct mtp_link *mtp_link_alloc(void) return link; } -void mtp_link_stop(struct mtp_link *link) +void mtp_link_set_stop(struct mtp_link_set *link) { bsc_del_timer(&link->t1_timer); bsc_del_timer(&link->t2_timer); @@ -276,17 +276,17 @@ void mtp_link_stop(struct mtp_link *link) link->running = 0; link->sltm_pending = 0; - mtp_link_sccp_down(link); + mtp_link_set_sccp_down(link); } -void mtp_link_reset(struct mtp_link *link) +void mtp_link_set_reset(struct mtp_link_set *link) { - mtp_link_stop(link); + mtp_link_set_stop(link); link->running = 1; bsc_schedule_timer(&link->delay_timer, START_DELAY); } -static int mtp_link_sign_msg(struct mtp_link *link, struct mtp_level_3_hdr *hdr, int l3_len) +static int mtp_link_sign_msg(struct mtp_link_set *link, struct mtp_level_3_hdr *hdr, int l3_len) { struct msgb *msg; struct mtp_level_3_cmn *cmn; @@ -308,18 +308,18 @@ static int mtp_link_sign_msg(struct mtp_link *link, struct mtp_level_3_hdr *hdr, case MTP_RESTR_MSG_ALLWED: LOGP(DINP, LOGL_INFO, "Received Restart Allowed. SST could be next: %p\n", link); link->sccp_up = 0; - mtp_link_sccp_down(link); + mtp_link_set_sccp_down(link); msg = mtp_tfp_alloc(link, 0); if (!msg) return -1; - mtp_link_submit(link, msg); + mtp_link_set_submit(link, msg); msg = mtp_tra_alloc(link); if (!msg) return -1; - mtp_link_submit(link, msg); + mtp_link_set_submit(link, msg); link->sccp_up = 1; link->was_up = 1; LOGP(DINP, LOGL_INFO, "SCCP traffic allowed. %p\n", link); @@ -348,7 +348,7 @@ static int mtp_link_sign_msg(struct mtp_link *link, struct mtp_level_3_hdr *hdr, return -1; } -static int mtp_link_regular_msg(struct mtp_link *link, struct mtp_level_3_hdr *hdr, int l3_len) +static int mtp_link_regular_msg(struct mtp_link_set *link, struct mtp_level_3_hdr *hdr, int l3_len) { struct msgb *out; struct mtp_level_3_mng *mng; @@ -371,7 +371,7 @@ static int mtp_link_regular_msg(struct mtp_link *link, struct mtp_level_3_hdr *h out = mtp_create_slta(link, mng, l3_len); if (!out) return -1; - mtp_link_submit(link, out); + mtp_link_set_submit(link, out); return 0; break; case MTP_TST_MSG_SLTA: @@ -402,7 +402,7 @@ static int mtp_link_regular_msg(struct mtp_link *link, struct mtp_level_3_hdr *h return -1; } -static int mtp_link_sccp_data(struct mtp_link *link, struct mtp_level_3_hdr *hdr, struct msgb *msg, int l3_len) +static int mtp_link_sccp_data(struct mtp_link_set *link, struct mtp_level_3_hdr *hdr, struct msgb *msg, int l3_len) { struct msgb *out; struct sccp_con_ctrl_prt_mgt *prt; @@ -455,15 +455,15 @@ static int mtp_link_sccp_data(struct mtp_link *link, struct mtp_level_3_hdr *hdr if (!out) return -1; - mtp_link_submit(link, out); + mtp_link_set_submit(link, out); return 0; } - mtp_link_forward_sccp(link, msg, MTP_LINK_SLS(hdr->addr)); + mtp_link_set_forward_sccp(link, msg, MTP_LINK_SLS(hdr->addr)); return 0; } -int mtp_link_data(struct mtp_link *link, struct msgb *msg) +int mtp_link_set_data(struct mtp_link_set *link, struct msgb *msg) { int rc = -1; struct mtp_level_3_hdr *hdr; @@ -492,7 +492,7 @@ int mtp_link_data(struct mtp_link *link, struct msgb *msg) break; case MTP_SI_MNT_ISUP: msg->l3h = &hdr->data[0]; - rc = mtp_link_forward_isup(link, msg, MTP_LINK_SLS(hdr->addr)); + rc = mtp_link_set_forward_isup(link, msg, MTP_LINK_SLS(hdr->addr)); break; default: fprintf(stderr, "Unhandled: %u\n", hdr->ser_ind); @@ -502,7 +502,7 @@ int mtp_link_data(struct mtp_link *link, struct msgb *msg) return rc; } -int mtp_link_submit_sccp_data(struct mtp_link *link, int sls, const uint8_t *data, unsigned int length) +int mtp_link_set_submit_sccp_data(struct mtp_link_set *link, int sls, const uint8_t *data, unsigned int length) { if (!link->sccp_up) { @@ -518,13 +518,13 @@ int mtp_link_submit_sccp_data(struct mtp_link *link, int sls, const uint8_t *dat return mtp_int_submit(link, link->sccp_opc, sls, MTP_SI_MNT_SCCP, data, length); } -int mtp_link_submit_isup_data(struct mtp_link *link, int sls, +int mtp_link_set_submit_isup_data(struct mtp_link_set *link, int sls, const uint8_t *data, unsigned int length) { return mtp_int_submit(link, link->opc, sls, MTP_SI_MNT_ISUP, data, length); } -static int mtp_int_submit(struct mtp_link *link, int pc, int sls, int type, +static int mtp_int_submit(struct mtp_link_set *link, int pc, int sls, int type, const uint8_t *data, unsigned int length) { uint8_t *put_ptr; @@ -544,6 +544,6 @@ static int mtp_int_submit(struct mtp_link *link, int pc, int sls, int type, put_ptr = msgb_put(msg, length); memcpy(put_ptr, data, length); - mtp_link_submit(link, msg); + mtp_link_set_submit(link, msg); return 0; } -- cgit v1.2.3