Start implementing GSM 04.11 (short message service)
This commit is contained in:
parent
f3c8e11336
commit
8b3390effd
|
@ -1,2 +1,2 @@
|
||||||
noinst_HEADERS = abis_nm.h abis_rsl.h debug.h db.h gsm_04_08.h gsm_data.h \
|
noinst_HEADERS = abis_nm.h abis_rsl.h debug.h db.h gsm_04_08.h gsm_data.h \
|
||||||
gsm_subscriber.h linuxlist.h msgb.h select.h tlv.h
|
gsm_subscriber.h linuxlist.h msgb.h select.h tlv.h gsm_04_11.h
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef _GSM_04_11_H
|
||||||
|
#define _GSM_04_11_H
|
||||||
|
|
||||||
|
/* GSM TS 04.11 definitions */
|
||||||
|
|
||||||
|
/* Chapter 8.1.2 (refers to GSM 04.07 Chapter 11.2.3.1.1 */
|
||||||
|
#define GSM411_PDISC_SMS 0x09
|
||||||
|
|
||||||
|
/* Chapter 8.1.3 */
|
||||||
|
#define GSM411_MT_CP_DATA 0x01
|
||||||
|
#define GSM411_MT_CP_ACK 0x04
|
||||||
|
#define GSM411_MT_CP_ERROR 0x10
|
||||||
|
|
||||||
|
/* Chapter 8.2.2 */
|
||||||
|
#define GSM411_MT_RP_DATA_MO 0x00
|
||||||
|
#define GSM411_MT_RP_DATA_MT 0x01
|
||||||
|
#define GSM411_MT_RP_ACK_MO 0x02
|
||||||
|
#define GSM411_MT_RP_ACK_MT 0x03
|
||||||
|
#define GSM411_MT_RP_ERROR_MO 0x04
|
||||||
|
#define GSM411_MT_RP_ERROR_MT 0x04
|
||||||
|
#define GSM411_MT_RP_SMMA_MO 0x05
|
||||||
|
|
||||||
|
/* Chapter 8.1.1 */
|
||||||
|
struct gsm411_rp_data_hdr {
|
||||||
|
u_int8_t msg_type;
|
||||||
|
u_int8_t msg_ref;
|
||||||
|
u_int8_t data[0];
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
struct msgb;
|
||||||
|
|
||||||
|
int gsm0411_rcv_sms(struct msgb *msg);
|
||||||
|
|
||||||
|
#endif
|
|
@ -4,7 +4,8 @@ AM_CFLAGS=-Wall
|
||||||
sbin_PROGRAMS = bsc_hack db_test
|
sbin_PROGRAMS = bsc_hack db_test
|
||||||
|
|
||||||
bsc_hack_SOURCES = bsc_hack.c misdn.c abis_rsl.c abis_nm.c gsm_04_08.c gsm_data.c \
|
bsc_hack_SOURCES = bsc_hack.c misdn.c abis_rsl.c abis_nm.c gsm_04_08.c gsm_data.c \
|
||||||
gsm_subscriber.c msgb.c select.c chan_alloc.c timer.c debug.c db.c
|
gsm_subscriber.c msgb.c select.c chan_alloc.c timer.c debug.c db.c \
|
||||||
|
gsm_04_11.c
|
||||||
bsc_hack_LDADD = -ldl -ldbi
|
bsc_hack_LDADD = -ldl -ldbi
|
||||||
|
|
||||||
db_test_SOURCES = db_test.c db.c
|
db_test_SOURCES = db_test.c db.c
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <openbsc/debug.h>
|
#include <openbsc/debug.h>
|
||||||
#include <openbsc/gsm_data.h>
|
#include <openbsc/gsm_data.h>
|
||||||
#include <openbsc/gsm_subscriber.h>
|
#include <openbsc/gsm_subscriber.h>
|
||||||
|
#include <openbsc/gsm_04_11.h>
|
||||||
#include <openbsc/gsm_04_08.h>
|
#include <openbsc/gsm_04_08.h>
|
||||||
#include <openbsc/abis_rsl.h>
|
#include <openbsc/abis_rsl.h>
|
||||||
|
|
||||||
|
@ -545,12 +546,6 @@ static int gsm0408_rcv_cc(struct msgb *msg)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gsm0408_rcv_sms(struct msgb *msg)
|
|
||||||
{
|
|
||||||
DEBUGP(DSMS, "SMS Message\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* here we pass in a msgb from the RSL->RLL. We expect the l3 pointer to be set */
|
/* here we pass in a msgb from the RSL->RLL. We expect the l3 pointer to be set */
|
||||||
int gsm0408_rcvmsg(struct msgb *msg)
|
int gsm0408_rcvmsg(struct msgb *msg)
|
||||||
{
|
{
|
||||||
|
@ -569,7 +564,7 @@ int gsm0408_rcvmsg(struct msgb *msg)
|
||||||
rc = gsm0408_rcv_rr(msg);
|
rc = gsm0408_rcv_rr(msg);
|
||||||
break;
|
break;
|
||||||
case GSM48_PDISC_SMS:
|
case GSM48_PDISC_SMS:
|
||||||
rc = gsm0408_rcv_sms(msg);
|
rc = gsm0411_rcv_sms(msg);
|
||||||
break;
|
break;
|
||||||
case GSM48_PDISC_MM_GPRS:
|
case GSM48_PDISC_MM_GPRS:
|
||||||
case GSM48_PDISC_SM_GPRS:
|
case GSM48_PDISC_SM_GPRS:
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/* Point-to-Point (PP) Short Message Service (SMS)
|
||||||
|
* Support on Mobile Radio Interface
|
||||||
|
* 3GPP TS 04.11 version 7.1.0 Release 1998 / ETSI TS 100 942 V7.1.0 */
|
||||||
|
|
||||||
|
/* (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de>
|
||||||
|
*
|
||||||
|
* All Rights Reserved
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
|
#include <openbsc/msgb.h>
|
||||||
|
#include <openbsc/debug.h>
|
||||||
|
#include <openbsc/gsm_04_11.h>
|
||||||
|
#include <openbsc/gsm_04_08.h>
|
||||||
|
#include <openbsc/abis_rsl.h>
|
||||||
|
|
||||||
|
static int gsm411_cp_data(struct msgb *msg)
|
||||||
|
{
|
||||||
|
struct gsm48_hdr *gh = msgb_l3(msg);
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
struct gsm411_rp_data_hdr *rp_data = (struct gsm411_rp_data_hdr*)msg->data;
|
||||||
|
u_int8_t msg_type = rp_data->msg_type & 0x07;
|
||||||
|
|
||||||
|
switch (msg_type) {
|
||||||
|
case GSM411_MT_RP_DATA_MO:
|
||||||
|
DEBUGP(DSMS, "SMS RP-DATA (MO)\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DEBUGP(DSMS, "Unimplemented RP type 0x%02x\n", msg_type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gsm0411_rcv_sms(struct msgb *msg)
|
||||||
|
{
|
||||||
|
struct gsm48_hdr *gh = msgb_l3(msg);
|
||||||
|
u_int8_t msg_type = gh->msg_type;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
DEBUGP(DSMS, "SMS Message\n");
|
||||||
|
|
||||||
|
switch(msg_type) {
|
||||||
|
case GSM411_MT_CP_DATA:
|
||||||
|
DEBUGP(DSMS, "SMS CP-DATA\n");
|
||||||
|
rc = gsm411_cp_data(msg);
|
||||||
|
break;
|
||||||
|
case GSM411_MT_CP_ACK:
|
||||||
|
case GSM411_MT_CP_ERROR:
|
||||||
|
default:
|
||||||
|
DEBUGP(DSMS, "Unimplemented CP msg_type: 0x%02x\n", msg_type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
0b -
|
0b -
|
||||||
00 -
|
00 -
|
||||||
1d -
|
1d -
|
||||||
39 - TransactionID 3, SMS messages
|
39 - TransactionID 3, SMS messages :: gh->proto_discr
|
||||||
01 - CP-DATA
|
01 - CP-DATA :: gh->msg_type
|
||||||
1a - Length: 26
|
1a - Length: 26 :: gh->data[0]
|
||||||
00 - MTI 0 RP-DATA (ms-> n)
|
00 - MTI 0 RP-DATA (ms-> n)
|
||||||
01 - MR 1
|
01 - MR 1
|
||||||
00 - RP-OA
|
00 - RP-OA
|
||||||
|
|
Loading…
Reference in New Issue