aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/openbsc/db.h2
-rw-r--r--include/openbsc/debug.h1
-rw-r--r--include/openbsc/gsm_04_08.h1
-rw-r--r--include/openbsc/gsm_data.h8
-rw-r--r--include/openbsc/gsm_subscriber.h1
-rw-r--r--include/openbsc/misdn.h1
-rw-r--r--src/abis_nm.c8
-rw-r--r--src/abis_rsl.c32
-rw-r--r--src/bsc_hack.c215
-rw-r--r--src/db.c2
-rw-r--r--src/debug.c11
-rw-r--r--src/gsm_04_08.c51
-rw-r--r--src/gsm_04_11.c10
-rw-r--r--src/misdn.c13
-rw-r--r--src/telnet_parser.l6
15 files changed, 54 insertions, 308 deletions
diff --git a/include/openbsc/db.h b/include/openbsc/db.h
index bd30aabec..9ce718136 100644
--- a/include/openbsc/db.h
+++ b/include/openbsc/db.h
@@ -32,7 +32,7 @@ int db_fini();
/* subscriber management */
struct gsm_subscriber* db_create_subscriber(char *imsi);
-struct gsm_subscriber* db_get_subscriber(enum gsm_subscriber_field field, char *subscr);
+struct gsm_subscriber* db_get_subscriber(enum gsm_subscriber_field field, const char *subscr);
int db_sync_subscriber(struct gsm_subscriber* subscriber);
int db_subscriber_alloc_tmsi(struct gsm_subscriber* subscriber);
int db_subscriber_assoc_imei(struct gsm_subscriber* subscriber, char *imei);
diff --git a/include/openbsc/debug.h b/include/openbsc/debug.h
index d30f0d05a..56719806f 100644
--- a/include/openbsc/debug.h
+++ b/include/openbsc/debug.h
@@ -22,6 +22,7 @@
#define static_assert(exp, name) typedef int dummy##name [(exp) ? 1 : -1];
+void hexdump(unsigned char *buf, int len);
void debugp(unsigned int subsys, char *file, int line, const char *format, ...);
void debug_parse_category_mask(const char* mask);
void debug_use_color(int use_color);
diff --git a/include/openbsc/gsm_04_08.h b/include/openbsc/gsm_04_08.h
index 3ef4fdb01..b5eecf051 100644
--- a/include/openbsc/gsm_04_08.h
+++ b/include/openbsc/gsm_04_08.h
@@ -394,6 +394,7 @@ enum gsm_chreq_reason_t get_reason_by_chreq(struct gsm_bts *bts, u_int8_t ra);
int gsm48_tx_mm_info(struct gsm_lchan *lchan);
struct msgb *gsm48_msgb_alloc(void);
int gsm48_sendmsg(struct msgb *msg);
+int generate_mid_from_tmsi(u_int8_t *buf, u_int32_t tmsi);
#endif
diff --git a/include/openbsc/gsm_data.h b/include/openbsc/gsm_data.h
index 02fdeafba..5ab4c61d1 100644
--- a/include/openbsc/gsm_data.h
+++ b/include/openbsc/gsm_data.h
@@ -177,14 +177,6 @@ struct gsm_network {
unsigned int num_bts;
/* private lists */
struct gsm_bts bts[GSM_MAX_BTS+1];
-
- /* management of the lower layers to allow the bsc to hook into it */
- void (*update_request)(struct gsm_bts *, u_int32_t tmsi, int accepted);
- void (*channel_allocated)(struct gsm_lchan *bts, enum gsm_chreq_reason_t);
- void (*channel_deallocated)(struct gsm_lchan *bts);
- void (*channel_response)(struct gsm_lchan *, int acked);
- void (*channel_subscriber_assigned)(struct gsm_lchan *);
- void (*call_state_changed)(struct gsm_lchan *, enum gsm_call_state new_state);
};
struct gsm_network *gsm_network_init(unsigned int num_bts, u_int16_t country_code,
diff --git a/include/openbsc/gsm_subscriber.h b/include/openbsc/gsm_subscriber.h
index 27726a8f5..8dcde3e53 100644
--- a/include/openbsc/gsm_subscriber.h
+++ b/include/openbsc/gsm_subscriber.h
@@ -34,6 +34,7 @@ struct gsm_subscriber *subscr_get(struct gsm_subscriber *subscr);
struct gsm_subscriber *subscr_put(struct gsm_subscriber *subscr);
struct gsm_subscriber *subscr_get_by_tmsi(const char *tmsi);
struct gsm_subscriber *subscr_get_by_imsi(const char *imsi);
+int subscr_update(struct gsm_subscriber *s, struct gsm_bts *bts);
/* internal */
struct gsm_subscriber *subscr_alloc(void);
diff --git a/include/openbsc/misdn.h b/include/openbsc/misdn.h
index 09dc5ba3f..51932c2bb 100644
--- a/include/openbsc/misdn.h
+++ b/include/openbsc/misdn.h
@@ -23,5 +23,6 @@
int mi_setup(struct gsm_bts *bts, int cardnr,
void (cb)(int event, struct gsm_bts *bts));
void mi_set_pcap_fd(int fd);
+int _abis_nm_sendmsg(struct msgb *msg);
#endif
diff --git a/src/abis_nm.c b/src/abis_nm.c
index b297a11db..e6230b4b0 100644
--- a/src/abis_nm.c
+++ b/src/abis_nm.c
@@ -32,6 +32,7 @@
#include <openbsc/msgb.h>
#include <openbsc/tlv.h>
#include <openbsc/abis_nm.h>
+#include <openbsc/misdn.h>
#define OM_ALLOC_SIZE 1024
#define OM_HEADROOM_SIZE 128
@@ -92,11 +93,13 @@ static int is_in_arr(enum abis_nm_msgtype mt, const enum abis_nm_msgtype *arr, i
return 0;
}
+#if 0
/* is this msgtype the usual ACK/NACK type ? */
static int is_ack_nack(enum abis_nm_msgtype mt)
{
return !is_in_arr(mt, no_ack_nack, ARRAY_SIZE(no_ack_nack));
}
+#endif
/* is this msgtype a report ? */
static int is_report(enum abis_nm_msgtype mt)
@@ -182,8 +185,6 @@ int abis_nm_rcvmsg(struct msgb *msg)
{
int rc;
struct abis_om_hdr *oh = msgb_l2(msg);
- unsigned int l2_len = msg->tail - (u_int8_t *)msgb_l2(msg);
- unsigned int hlen = sizeof(*oh) + sizeof(struct abis_om_fom_hdr);
/* Various consistency checks */
if (oh->placement != ABIS_OM_PLACEMENT_ONLY) {
@@ -197,6 +198,8 @@ int abis_nm_rcvmsg(struct msgb *msg)
return -EINVAL;
}
#if 0
+ unsigned int l2_len = msg->tail - (u_int8_t *)msgb_l2(msg);
+ unsigned int hlen = sizeof(*oh) + sizeof(struct abis_om_fom_hdr);
if (oh->length + hlen > l2_len) {
fprintf(stderr, "ABIS OML truncated message (%u > %u)\n",
oh->length + sizeof(*oh), l2_len);
@@ -296,7 +299,6 @@ int abis_nm_establish_tei(struct gsm_bts *bts, u_int8_t trx_nr,
{
struct abis_om_hdr *oh;
struct abis_nm_channel *ch;
- u_int8_t *tei_attr;
u_int8_t len = sizeof(*ch) + 2;
struct msgb *msg = nm_msgb_alloc();
diff --git a/src/abis_rsl.c b/src/abis_rsl.c
index 04c8455b7..14b4108e3 100644
--- a/src/abis_rsl.c
+++ b/src/abis_rsl.c
@@ -264,7 +264,6 @@ int rsl_chan_activate(struct gsm_bts *bts, u_int8_t chan_nr,
{
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg = rsl_msgb_alloc();
- u_int8_t encr_info = 0x01;
dh = (struct abis_rsl_dchan_hdr *) msgb_put(msg, sizeof(*dh));
init_dchan_hdr(dh, RSL_MT_CHAN_ACTIV);
@@ -295,9 +294,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type, u_int8_t
struct abis_rsl_dchan_hdr *dh;
struct msgb *msg = rsl_msgb_alloc();
/* FXIME: don't hardcode these!! */
- u_int8_t encr_info = 0x01;
u_int8_t ms_power = 0x0f;
- u_int8_t bs_power = 0x01;
u_int8_t chan_nr = lchan2chan_nr(lchan);
u_int16_t arfcn = lchan->ts->trx->arfcn;
@@ -317,6 +314,12 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type, u_int8_t
cm.chan_rt = RSL_CMOD_CRT_TCH_Bm;
cm.chan_rate = 0x11; /* speech coding alg version 2*/
break;
+ case GSM_LCHAN_TCH_H:
+ DEBUGP(DRSL, "Unimplemented TCH_H activation in %s:%d\n", __FILE__, __LINE__);
+ return -1;
+ case GSM_LCHAN_UNKNOWN:
+ case GSM_LCHAN_NONE:
+ return -1;
}
ci.chan_desc.iei = 0x64;
@@ -334,7 +337,7 @@ int rsl_chan_activate_lchan(struct gsm_lchan *lchan, u_int8_t act_type, u_int8_t
(u_int8_t *) &cm);
msgb_tlv_put(msg, RSL_IE_CHAN_IDENT, 4,
(u_int8_t *) &ci);
- /* FIXME: this shoould be optional */
+ /* FIXME: this should be optional */
#if 0
msgb_tlv_put(msg, RSL_IE_ENCR_INFO, 1,
(u_int8_t *) &encr_info);
@@ -386,9 +389,11 @@ int rsl_paging_cmd(struct gsm_bts *bts, u_int8_t paging_group, u_int8_t len,
int rsl_paging_cmd_subscr(struct gsm_bts *bts, u_int8_t chan_need,
struct gsm_subscriber *subscr)
{
+#if 0
u_int8_t mi[128];
unsigned int mi_len;
u_int8_t paging_group;
+#endif
return -1;
}
@@ -458,8 +463,6 @@ int rsl_data_request(struct msgb *msg, u_int8_t link_id)
/* Chapter 8.4.2: Channel Activate Acknowledge */
static int rsl_rx_chan_act_ack(struct msgb *msg)
{
- struct gsm_lchan *lchan;
- struct gsm_network *network;
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
/* BTS has confirmed channel activation, we now need
@@ -469,19 +472,12 @@ static int rsl_rx_chan_act_ack(struct msgb *msg)
DEBUGP(DRSL, "Channel Activate ACK Channel 0x%02x\n", rslh->chan_nr);
- lchan = lchan_lookup(msg->trx, rslh->chan_nr);
- network = msg->trx->bts->network;
- if (network->channel_response)
- (*network->channel_response)(lchan, 1);
-
return 0;
}
/* Chapter 8.4.3: Channel Activate NACK */
static int rsl_rx_chan_act_nack(struct msgb *msg)
{
- struct gsm_lchan *lchan;
- struct gsm_network *network;
struct abis_rsl_dchan_hdr *rslh = msgb_l2(msg);
/* BTS has confirmed channel activation, we now need
@@ -491,11 +487,6 @@ static int rsl_rx_chan_act_nack(struct msgb *msg)
DEBUGP(DRSL, "Channel Activate NACK Channel 0x%02x\n", rslh->chan_nr);
- lchan = lchan_lookup(msg->trx, rslh->chan_nr);
- network = msg->trx->bts->network;
- if (network->channel_response)
- (*network->channel_response)(lchan, 0);
-
return 0;
}
@@ -655,10 +646,6 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
/* send IMMEDIATE ASSIGN CMD on RSL to BTS (to send on CCCH to MS) */
ret = rsl_imm_assign_cmd(bts, sizeof(ia), (u_int8_t *) &ia);
- /* inform the bsc that a channel has been allocated */
- if (bts->network->channel_allocated)
- (*bts->network->channel_allocated)(lchan, chreq_reason);
-
return ret;
}
@@ -752,7 +739,6 @@ static int abis_rsl_rx_rll(struct msgb *msg)
int abis_rsl_rcvmsg(struct msgb *msg)
{
struct abis_rsl_common_hdr *rslh = msgb_l2(msg) ;
- unsigned int l2_len = (void *)msg->tail - msgb_l2(msg);
int rc;
switch (rslh->msg_discr & 0xfe) {
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index a3aefc664..ef61e75f5 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -53,16 +53,6 @@ static int MCC = 1;
static int MNC = 1;
static const char *database_name = "hlr.sqlite3";
-/* forward declarations */
-static void bsc_hack_update_request(struct gsm_bts *bts,
- u_int32_t assigned_tmi, int accepted);
-static void bsc_hack_channel_allocated(struct gsm_lchan *chan,
- enum gsm_chreq_reason_t reason);
-static void bsc_hack_channel_response(struct gsm_lchan *chan, int acked);
-static void bsc_hack_call_state_changed(struct gsm_lchan *chan,
- enum gsm_call_state new_state);
-
-
/* The following definitions are for OM and NM packets that we cannot yet
* generate by code but we just pass on */
@@ -607,15 +597,6 @@ static int set_system_infos(struct gsm_bts *bts)
return 0;
}
-static void activate_traffic_channels(struct gsm_bts_trx *trx)
-{
- int i;
-
- /* channel 0 is CCCH */
- for (i = 1; i < 8; i++)
- rsl_chan_activate_tch_f(&trx->ts[i]);
-}
-
/*
* Patch the various SYSTEM INFORMATION tables to update
* the LAI
@@ -646,9 +627,6 @@ static void bootstrap_rsl(struct gsm_bts *bts)
fprintf(stdout, "bootstrapping RSL MCC=%u MNC=%u\n", MCC, MNC);
patch_tables(bts);
set_system_infos(bts);
-
- /* FIXME: defer this until the channels are used */
- //activate_traffic_channels(&bts->trx[0]);
}
static void mi_cb(int event, struct gsm_bts *bts)
@@ -680,12 +658,6 @@ static int bootstrap_network(void)
bts = &gsmnet->bts[0];
bts->location_area_code = 1;
bts->trx[0].arfcn = HARDCODED_ARFCN;
-#if 0
- gsmnet->update_request = bsc_hack_update_request;
- gsmnet->channel_allocated = bsc_hack_channel_allocated;
- gsmnet->channel_response = bsc_hack_channel_response;
- gsmnet->call_state_changed = bsc_hack_call_state_changed;
-#endif
telnet_init(gsmnet, 4242);
if (mi_setup(bts, 0, mi_cb) < 0)
@@ -785,193 +757,6 @@ static void handle_options(int argc, char** argv)
}
}
-static struct timer_list pag_timer;
-
-/* handles uppercase decimal and hexadecimal */
-static u_int8_t char2bcd(char c)
-{
- if (c <= '9')
- return c - '0';
- else
- return c - 'A';
-}
-
-static int string_to_mi(u_int8_t *mi, const char *string,
- u_int8_t type)
-{
- u_int8_t *cur = mi+3;
-
- mi[0] = GSM48_IE_MOBILE_ID;
- //mi[1] = TMSI_LEN;
- mi[2] = type & GSM_MI_TYPE_MASK;
-
- if (strlen(string) & 0x01)
- mi[2] |= char2bcd(*string++) << 4;
- else
- mi[2] |= 0xf0;
-
- while (*string && *(string+1))
- *cur++ = char2bcd(*string++) | (char2bcd(*string++) << 4);
-
- mi[1] = cur - mi;
-
- return cur - mi;
-}
-
-/*
- * Stations that registered and that we need to page
- */
-struct pending_registered_station {
- struct llist_head entry;
-
- /* the tmsi of the subscriber */
- u_int32_t tmsi;
- int last_page_group;
-};
-
-static LLIST_HEAD(pending_stations);
-
-static void pag_timer_cb(void *data);
-static struct timer_list pag_timer = {
- .cb = pag_timer_cb,
-};
-
-/* page the tmsi and wait for the channel request */
-static void pag_timer_cb(void *data)
-{
- struct gsm_bts *bts = &gsmnet->bts[0];
- struct pending_registered_station *pending_station;
- u_int8_t mi[128];
- unsigned int mi_len;
-
-return;
-
- if (llist_empty(&pending_stations)) {
- DEBUGP(DPAG, "pag_timer_cb but no pending mobile stations\n");
- return;
- }
-
- /* FIXME: 05.02 6.5.2 Determination of CCCH_GROUP and PAGING_GROUP... */
- /* get the station to page */
- pending_station = (struct pending_registered_station*) pending_stations.next;
- mi_len = generate_mid_from_tmsi(mi, pending_station->tmsi);
- rsl_paging_cmd(bts, pending_station->last_page_group, mi_len, mi, RSL_CHANNEED_TCH_F);
-
- /* which group to page next */
- pending_station->last_page_group = (pending_station->last_page_group+1) % 12;
- schedule_timer(&pag_timer, 1, 0);
-}
-
-/*
- * initiate the a page command for the given
- * station and retry until we get a channel request
- */
-static void station_timer_cb(void *data)
-{
- DEBUGP(DPAG, "Initiating paging of a channel\n");
- pag_timer_cb(0);
-}
-
-static struct timer_list station_timer = {
- .cb = station_timer_cb,
-};
-
-/*
- * schedule work
- */
-static void bsc_hack_update_request(struct gsm_bts *bts, u_int32_t tmsi, int accepted)
-{
- struct pending_registered_station *station =
- (struct pending_registered_station*)malloc(sizeof(*station));
-
- /*
- * Only deal with LOCATION UPDATE REQUEST we have
- * accepted.
- */
- if (!accepted)
- return;
-
-
- station->tmsi = tmsi;
- station->last_page_group = 0;
- llist_add_tail(&station->entry, &pending_stations);
-
- if (!timer_pending(&station_timer))
- schedule_timer(&station_timer, 1, 0);
-}
-
-static void bsc_hack_channel_allocated(struct gsm_lchan *chan,
- enum gsm_chreq_reason_t chreq_reason)
-{
- struct pending_registered_station *station;
- if (chreq_reason != GSM_CHREQ_REASON_PAG)
- return;
-
- if (llist_empty(&pending_stations)) {
- DEBUGP(DPAG, "Channel allocated for pag but not waitin for it\n");
- return;
- }
-
- station = (struct pending_registered_station*) pending_stations.next;
-
- DEBUGP(DPAG, "CHAN RQD due PAG %d on %d for %u\n", chan->type, chan->nr, station->tmsi);
-
- /* allocate some token in the chan for us */
- chan->user_data = (void*)station->tmsi;
- del_timer(&pag_timer);
-}
-
-static void bsc_hack_channel_response(struct gsm_lchan *lchan, int ack)
-{
- struct pending_registered_station *station;
- if (llist_empty(&pending_stations)) {
- return;
- }
-
- station = (struct pending_registered_station*) pending_stations.next;
- if (station->tmsi != (u_int32_t)lchan->user_data) {
- DEBUGP(DPAG, "Hmmm the channel is not allocated by the"
- "station we wanted channel: %u us:%u\n",
- (u_int32_t)(lchan->user_data), station->tmsi);
- return;
- }
-
- if (ack) {
- DEBUGP(DPAG, "We have probably paged a channel for tmsi: %u on %d\n",
- station->tmsi, lchan->nr);
-
- llist_del(&station->entry);
- free(station);
-
- /*
- * start a call
- */
- gsm48_cc_tx_setup(lchan);
- } else {
- /*
- * give up and go to the next channel
- */
- llist_del(&station->entry);
- free(station);
- pag_timer_cb(0);
- }
-}
-
-static void bsc_hack_call_state_changed(struct gsm_lchan *lchan,
- enum gsm_call_state new_state)
-{
- DEBUGP(DPAG, "Call released jumping to the next...\n");
-
- /* only handle the transition back to the NULL state */
- if (new_state != GSM_CSTATE_NULL)
- return;
-
- rsl_chan_release(lchan);
-
- /* next!!! */
- pag_timer_cb(0);
-}
-
static void signal_handler(int signal)
{
fprintf(stdout, "signal %u received\n", signal);
diff --git a/src/db.c b/src/db.c
index 8ee213224..50459cff0 100644
--- a/src/db.c
+++ b/src/db.c
@@ -194,7 +194,7 @@ struct gsm_subscriber* db_create_subscriber(char *imsi) {
return subscr;
}
-struct gsm_subscriber *db_get_subscriber(enum gsm_subscriber_field field, char *id) {
+struct gsm_subscriber *db_get_subscriber(enum gsm_subscriber_field field, const char *id) {
dbi_result result;
const char *string;
char *quoted;
diff --git a/src/debug.c b/src/debug.c
index ecd7be11d..0a35dbccc 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -77,7 +77,7 @@ void debug_parse_category_mask(const char *_mask)
if (strcasecmp(debug_info[i].name, category_token) == 0)
new_mask |= debug_info[i].number;
}
- } while (category_token = strtok(NULL, ":"));
+ } while ((category_token = strtok(NULL, ":")));
free(mask);
@@ -120,3 +120,12 @@ void debugp(unsigned int subsys, char *file, int line, const char *format, ...)
fflush(outfd);
}
+void hexdump(unsigned char *buf, int len)
+{
+ int i;
+ for (i = 0; i < len; i++) {
+ fprintf(stdout, "%02x ", buf[i]);
+ }
+ fprintf(stdout, "\n");
+}
+
diff --git a/src/gsm_04_08.c b/src/gsm_04_08.c
index 69207d72b..aca4cf240 100644
--- a/src/gsm_04_08.c
+++ b/src/gsm_04_08.c
@@ -38,6 +38,7 @@
#include <openbsc/gsm_04_11.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/abis_rsl.h>
+#include <openbsc/chan_alloc.h>
#define GSM48_ALLOC_SIZE 1024
#define GSM48_ALLOC_HEADROOM 128
@@ -106,25 +107,6 @@ static void allocate_loc_updating_req(struct gsm_lchan *lchan)
memset(lchan->loc_operation, 0, sizeof(*lchan->loc_operation));
}
-static void parse_lai(struct gsm_lai *lai, const struct gsm48_loc_area_id *lai48)
-{
- u_int8_t dig[4];
-
- /* MCC */
- dig[1] = lai48->digits[0] & 0x0f;
- dig[2] = lai48->digits[0] >> 4;
- dig[3] = lai48->digits[1] & 0x0f;
- lai->mcc = dig[3] * 100 + dig[2];
-
- /* MNC */
- dig[1] = lai48->digits[1] >> 4;
- dig[2] = lai48->digits[2] & 0x0f;
- dig[3] = lai48->digits[2] >> 4;
- lai->mnc = dig[3] * 100 + dig[2];
-
- lai->lac = lai48->lac;
-}
-
static void to_bcd(u_int8_t *bcd, u_int16_t val)
{
bcd[2] = val % 10;
@@ -135,17 +117,6 @@ static void to_bcd(u_int8_t *bcd, u_int16_t val)
val = val / 10;
}
-static u_int8_t to_bcd8(unsigned int val)
-{
- u_int8_t bcd;
-
- bcd = (val % 10) & 0x0f;
- val = val / 10;
- bcd |= (val % 10) << 4;
-
- return bcd;
-}
-
void gsm0408_generate_lai(struct gsm48_loc_area_id *lai48, u_int16_t mcc,
u_int16_t mnc, u_int16_t lac)
{
@@ -207,6 +178,8 @@ int gsm48_sendmsg(struct msgb *msg)
break;
case GSM_CT_MT:
break;
+ case GSM_CT_NONE:
+ break;
}
}
}
@@ -262,10 +235,6 @@ int gsm0408_loc_upd_acc(struct gsm_lchan *lchan, u_int32_t tmsi)
DEBUGP(DMM, "-> LOCATION UPDATE ACCEPT\n");
- /* inform the upper layer on the progress */
- if (bts->network->update_request)
- (*bts->network->update_request)(bts, tmsi, 1);
-
ret = gsm48_sendmsg(msg);
/* return gsm48_cc_tx_setup(lchan); */
@@ -448,7 +417,7 @@ static int mm_rx_loc_upd_req(struct msgb *msg)
lchan->loc_operation->waiting_for_imei = 1;
/* look up the subscriber based on TMSI, request IMSI if it fails */
- subscr = subscr_get_by_tmsi(lu->mi);
+ subscr = subscr_get_by_tmsi((char *)lu->mi);
if (!subscr) {
/* send IDENTITY REQUEST message to get IMSI */
use_lchan(lchan);
@@ -492,12 +461,9 @@ int gsm48_tx_mm_info(struct gsm_lchan *lchan)
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
struct gsm_network *net = lchan->ts->trx->bts->network;
- time_t cur_t;
- struct tm* cur_time;
u_int8_t *ptr8;
u_int16_t *ptr16;
int name_len;
- int tz15min;
int i;
msg->lchan = lchan;
@@ -536,6 +502,10 @@ int gsm48_tx_mm_info(struct gsm_lchan *lchan)
}
#if 0
+ /* move back to the top */
+ time_t cur_t;
+ struct tm* cur_time;
+ int tz15min;
/* Section 10.5.3.9 */
cur_t = time(NULL);
cur_time = gmtime(cur_t);
@@ -673,11 +643,13 @@ static int gsm48_cc_rx_status_enq(struct msgb *msg)
return gsm48_cc_tx_status(msg->lchan);
}
+#if 0
static int gsm48_cc_rx_setup(struct msgb *msg)
{
return gsm48_tx_simple(msg->lchan, GSM48_PDISC_CC,
GSM48_MT_CC_CALL_CONF);
}
+#endif
int gsm48_cc_tx_setup(struct gsm_lchan *lchan)
{
@@ -711,7 +683,6 @@ static int gsm0408_rcv_cc(struct msgb *msg)
struct gsm48_hdr *gh = msgb_l3(msg);
u_int8_t msg_type = gh->msg_type & 0xbf;
struct gsm_call *call = &msg->lchan->call;
- struct gsm_network *network = msg->lchan->ts->trx->bts->network;
int rc = 0;
switch (msg_type) {
@@ -722,8 +693,6 @@ static int gsm0408_rcv_cc(struct msgb *msg)
case GSM48_MT_CC_RELEASE_COMPL:
/* Answer from MS to RELEASE */
DEBUGP(DCC, "RELEASE COMPLETE (state->NULL)\n");
- if (network->call_state_changed)
- (*network->call_state_changed)(msg->lchan, call->state);
call->state = GSM_CSTATE_NULL;
break;
case GSM48_MT_CC_ALERTING:
diff --git a/src/gsm_04_11.c b/src/gsm_04_11.c
index ede89ef68..b0d3a0127 100644
--- a/src/gsm_04_11.c
+++ b/src/gsm_04_11.c
@@ -73,11 +73,11 @@ static char *gsm411_7bit_decode(u_int8_t *user_data, u_int8_t length)
return text;
}
+#if 0
static u_int8_t gsm0411_tpdu_from_sms(u_int8_t *tpdu, struct sms_deliver *sms)
{
- u_int8_t len = 0;
-
}
+#endif
static int gsm411_sms_submit_from_msgb(struct msgb *msg)
{
@@ -111,7 +111,7 @@ static int gsm411_sms_submit_from_msgb(struct msgb *msg)
}
sms->ud_len = *smsp++;
- sms->user_data = gsm411_7bit_decode(smsp, sms->ud_len);
+ sms->user_data = (u_int8_t *)gsm411_7bit_decode(smsp, sms->ud_len);
DEBUGP(DSMS, "SMS:\nMTI: 0x%02x, VPF: 0x%02x, MR: 0x%02x\n"
"PID: 0x%02x, DCS: 0x%02x, UserDataLength: 0x%02x\n"
@@ -147,6 +147,7 @@ static int gsm411_send_rp_ack(struct gsm_lchan *lchan, u_int8_t trans_id,
return gsm0411_sendmsg(msg);
}
+#if 0
static int gsm411_send_rp_error(struct gsm_lchan *lchan, u_int8_t trans_id,
u_int8_t msg_ref)
{
@@ -169,6 +170,7 @@ static int gsm411_send_rp_error(struct gsm_lchan *lchan, u_int8_t trans_id,
return gsm0411_sendmsg(msg);
}
+#endif
static int gsm411_cp_data(struct msgb *msg)
{
@@ -248,7 +250,7 @@ int gsm0411_send_sms(struct gsm_lchan *lchan, struct sms_deliver *sms)
struct msgb *msg = gsm411_msgb_alloc();
struct gsm48_hdr *gh;
struct gsm411_rp_hdr *rp;
- u_int8_t *data, *tpdu, smslen;
+ u_int8_t *data;
msg->lchan = lchan;
diff --git a/src/misdn.c b/src/misdn.c
index 17d26698c..75cdb8365 100644
--- a/src/misdn.c
+++ b/src/misdn.c
@@ -197,15 +197,6 @@ static struct mi_e1_handle *global_e1h;
#define TEI_OML 25
#define TEI_RSL 1
-void hexdump(unsigned char *buf, int len)
-{
- int i;
- for (i = 0; i < len; i++) {
- fprintf(stdout, "%02x ", buf[i]);
- }
- fprintf(stdout, "\n");
-}
-
#define TS1_ALLOC_SIZE 300
static int handle_ts1_read(struct bsc_fd *bfd)
@@ -389,7 +380,7 @@ static int handle_tsX_read(struct bsc_fd *bfd)
struct mi_e1_handle *e1h = bfd->data;
struct msgb *msg = msgb_alloc(TSX_ALLOC_SIZE);
struct mISDNhead *hh;
- int ret;
+ int ret, dummy;
if (!msg)
return -ENOMEM;
@@ -425,7 +416,7 @@ static int handle_tsX_read(struct bsc_fd *bfd)
if (!e1h->ts2_fd)
e1h->ts2_fd = open("/tmp/ts2.dump", O_WRONLY|O_APPEND|O_CREAT, 0660);
- write(e1h->ts2_fd, msgb_l2(msg), ret - MISDN_HEADER_LEN);
+ dummy = write(e1h->ts2_fd, msgb_l2(msg), ret - MISDN_HEADER_LEN);
break;
default:
diff --git a/src/telnet_parser.l b/src/telnet_parser.l
index 796c5c915..e4327191d 100644
--- a/src/telnet_parser.l
+++ b/src/telnet_parser.l
@@ -182,3 +182,9 @@ void telnet_parse(struct telnet_connection *conn, char *buf)
conn->imsi = NULL;
}
}
+
+__attribute__((unused)) void telnet_unused(void)
+{
+ yyunput(0, 0, 0);
+ input(0);
+}