summaryrefslogtreecommitdiffstats
path: root/src/shared/libosmocore
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-13 13:51:42 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-13 13:51:42 +0200
commitf633ea5f43f26a60935534c3e98fd62fe9a657ae (patch)
tree667d52c969b47625f3afde2864704437e3b27754 /src/shared/libosmocore
parent298b361b133a54f3b7c39d168e5028e69e736113 (diff)
parent33f0fc3c9565308044c934c9e0c1bb81c1a26311 (diff)
Merge commit '33f0fc3c9565308044c934c9e0c1bb81c1a26311'
Diffstat (limited to 'src/shared/libosmocore')
-rw-r--r--src/shared/libosmocore/include/osmocore/protocol/gsm_08_58.h9
-rw-r--r--src/shared/libosmocore/include/osmocore/rsl.h6
-rw-r--r--src/shared/libosmocore/src/rsl.c35
-rw-r--r--src/shared/libosmocore/src/vty/command.c98
4 files changed, 107 insertions, 41 deletions
diff --git a/src/shared/libosmocore/include/osmocore/protocol/gsm_08_58.h b/src/shared/libosmocore/include/osmocore/protocol/gsm_08_58.h
index 7dc35693..5fe332e0 100644
--- a/src/shared/libosmocore/include/osmocore/protocol/gsm_08_58.h
+++ b/src/shared/libosmocore/include/osmocore/protocol/gsm_08_58.h
@@ -49,6 +49,14 @@ struct abis_rsl_dchan_hdr {
uint8_t data[0];
} __attribute__ ((packed));
+/* Chapter 8.5 */
+struct abis_rsl_cchan_hdr {
+ struct abis_rsl_common_hdr c;
+ uint8_t ie_chan;
+ uint8_t chan_nr;
+ uint8_t data[0];
+} __attribute__ ((packed));
+
/* Chapter 9.1 */
#define ABIS_RSL_MDISC_RLL 0x02
@@ -88,6 +96,7 @@ enum abis_rsl_msgtype {
RSL_MT_PAGING_CMD,
RSL_MT_IMMEDIATE_ASSIGN_CMD,
RSL_MT_SMS_BC_REQ,
+ RSL_MT_CHAN_CONF, /* non-standard element */
/* empty */
RSL_MT_RF_RES_IND = 0x19,
RSL_MT_SACCH_FILL,
diff --git a/src/shared/libosmocore/include/osmocore/rsl.h b/src/shared/libosmocore/include/osmocore/rsl.h
index 99b90d68..cd84057b 100644
--- a/src/shared/libosmocore/include/osmocore/rsl.h
+++ b/src/shared/libosmocore/include/osmocore/rsl.h
@@ -7,6 +7,8 @@
void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type);
+void rsl_init_cchan_hdr(struct abis_rsl_cchan_hdr *ch, uint8_t msg_type);
+
extern const struct tlv_definition rsl_att_tlvdef;
#define rsl_tlv_parse(dec, buf, len) \
tlv_parse(dec, &rsl_att_tlvdef, buf, len, 0, 0)
@@ -22,6 +24,10 @@ const char *rsl_rlm_cause_name(uint8_t err);
/* Section 3.3.2.3 TS 05.02. I think this looks like a table */
int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf);
+/* Push a RSL RLL header */
+void rsl_rll_push_hdr(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
+ uint8_t link_id, int transparent);
+
/* Push a RSL RLL header with L3_INFO IE */
void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
uint8_t link_id, int transparent);
diff --git a/src/shared/libosmocore/src/rsl.c b/src/shared/libosmocore/src/rsl.c
index c002d33e..7bc1712f 100644
--- a/src/shared/libosmocore/src/rsl.c
+++ b/src/shared/libosmocore/src/rsl.c
@@ -38,6 +38,13 @@ void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type)
dh->ie_link_id = RSL_IE_LINK_IDENT;
}
+void rsl_init_cchan_hdr(struct abis_rsl_cchan_hdr *ch, uint8_t msg_type)
+{
+ ch->c.msg_discr = ABIS_RSL_MDISC_COM_CHAN;
+ ch->c.msg_type = msg_type;
+ ch->ie_chan = RSL_IE_CHAN_NR;
+}
+
const struct tlv_definition rsl_att_tlvdef = {
.def = {
[RSL_IE_CHAN_NR] = { TLV_TYPE_TV },
@@ -277,12 +284,28 @@ int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf)
}
}
+/* Push a RSL RLL header */
+void rsl_rll_push_hdr(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
+ uint8_t link_id, int transparent)
+{
+ struct abis_rsl_rll_hdr *rh;
+
+ rh = (struct abis_rsl_rll_hdr *) msgb_push(msg, sizeof(*rh));
+ rsl_init_rll_hdr(rh, msg_type);
+ if (transparent)
+ rh->c.msg_discr |= ABIS_RSL_MDISC_TRANSP;
+ rh->chan_nr = chan_nr;
+ rh->link_id = link_id;
+
+ /* set the l2 header pointer */
+ msg->l2h = (uint8_t *)rh;
+}
+
/* Push a RSL RLL header with L3_INFO IE */
void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
uint8_t link_id, int transparent)
{
uint8_t l3_len = msg->tail - (uint8_t *)msgb_l3(msg);
- struct abis_rsl_rll_hdr *rh;
/* construct a RSLms RLL message (DATA INDICATION, UNIT DATA
* INDICATION) and send it off via RSLms */
@@ -291,15 +314,7 @@ void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
msgb_tv16_push(msg, RSL_IE_L3_INFO, l3_len);
/* Then push the RSL header */
- rh = (struct abis_rsl_rll_hdr *) msgb_push(msg, sizeof(*rh));
- rsl_init_rll_hdr(rh, msg_type);
- if (transparent)
- rh->c.msg_discr |= ABIS_RSL_MDISC_TRANSP;
- rh->chan_nr = chan_nr;
- rh->link_id = link_id;
-
- /* set the l2 header pointer */
- msg->l2h = (uint8_t *)rh;
+ rsl_rll_push_hdr(msg, msg_type, chan_nr, link_id, transparent);
}
struct msgb *rsl_rll_simple(uint8_t msg_type, uint8_t chan_nr,
diff --git a/src/shared/libosmocore/src/vty/command.c b/src/shared/libosmocore/src/vty/command.c
index 21afa5c0..598e63cc 100644
--- a/src/shared/libosmocore/src/vty/command.c
+++ b/src/shared/libosmocore/src/vty/command.c
@@ -867,41 +867,77 @@ static int cmd_range_match(const char *range, const char *str)
char *p;
char buf[DECIMAL_STRLEN_MAX + 1];
char *endptr = NULL;
- unsigned long min, max, val;
if (str == NULL)
return 1;
- val = strtoul(str, &endptr, 10);
- if (*endptr != '\0')
- return 0;
-
- range++;
- p = strchr(range, '-');
- if (p == NULL)
- return 0;
- if (p - range > DECIMAL_STRLEN_MAX)
- return 0;
- strncpy(buf, range, p - range);
- buf[p - range] = '\0';
- min = strtoul(buf, &endptr, 10);
- if (*endptr != '\0')
- return 0;
-
- range = p + 1;
- p = strchr(range, '>');
- if (p == NULL)
- return 0;
- if (p - range > DECIMAL_STRLEN_MAX)
- return 0;
- strncpy(buf, range, p - range);
- buf[p - range] = '\0';
- max = strtoul(buf, &endptr, 10);
- if (*endptr != '\0')
- return 0;
-
- if (val < min || val > max)
- return 0;
+ if (range[1] == '-') {
+ signed long min = 0, max = 0, val;
+
+ val = strtol(str, &endptr, 10);
+ if (*endptr != '\0')
+ return 0;
+
+ range += 2;
+ p = strchr(range, '-');
+ if (p == NULL)
+ return 0;
+ if (p - range > DECIMAL_STRLEN_MAX)
+ return 0;
+ strncpy(buf, range, p - range);
+ buf[p - range] = '\0';
+ min = -strtol(buf, &endptr, 10);
+ if (*endptr != '\0')
+ return 0;
+
+ range = p + 1;
+ p = strchr(range, '>');
+ if (p == NULL)
+ return 0;
+ if (p - range > DECIMAL_STRLEN_MAX)
+ return 0;
+ strncpy(buf, range, p - range);
+ buf[p - range] = '\0';
+ max = strtol(buf, &endptr, 10);
+ if (*endptr != '\0')
+ return 0;
+
+ if (val < min || val > max)
+ return 0;
+ } else {
+ unsigned long min, max, val;
+
+ val = strtoul(str, &endptr, 10);
+ if (*endptr != '\0')
+ return 0;
+
+ range++;
+ p = strchr(range, '-');
+ if (p == NULL)
+ return 0;
+ if (p - range > DECIMAL_STRLEN_MAX)
+ return 0;
+ strncpy(buf, range, p - range);
+ buf[p - range] = '\0';
+ min = strtoul(buf, &endptr, 10);
+ if (*endptr != '\0')
+ return 0;
+
+ range = p + 1;
+ p = strchr(range, '>');
+ if (p == NULL)
+ return 0;
+ if (p - range > DECIMAL_STRLEN_MAX)
+ return 0;
+ strncpy(buf, range, p - range);
+ buf[p - range] = '\0';
+ max = strtoul(buf, &endptr, 10);
+ if (*endptr != '\0')
+ return 0;
+
+ if (val < min || val > max)
+ return 0;
+ }
return 1;
}