Daniel Willmann | 8b3390e | 2008-12-28 00:31:09 +0000 | [diff] [blame] | 1 | /* Point-to-Point (PP) Short Message Service (SMS) |
| 2 | * Support on Mobile Radio Interface |
| 3 | * 3GPP TS 04.11 version 7.1.0 Release 1998 / ETSI TS 100 942 V7.1.0 */ |
| 4 | |
| 5 | /* (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de> |
| 6 | * |
| 7 | * All Rights Reserved |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License along |
| 20 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | #include <stdio.h> |
| 27 | #include <stdlib.h> |
| 28 | #include <string.h> |
| 29 | #include <errno.h> |
| 30 | #include <netinet/in.h> |
| 31 | |
| 32 | #include <openbsc/msgb.h> |
| 33 | #include <openbsc/debug.h> |
| 34 | #include <openbsc/gsm_04_11.h> |
| 35 | #include <openbsc/gsm_04_08.h> |
| 36 | #include <openbsc/abis_rsl.h> |
| 37 | |
| 38 | static int gsm411_cp_data(struct msgb *msg) |
| 39 | { |
| 40 | struct gsm48_hdr *gh = msgb_l3(msg); |
| 41 | int rc = 0; |
| 42 | |
Daniel Willmann | fdd0a6c | 2008-12-28 01:51:14 +0000 | [diff] [blame] | 43 | struct gsm411_rp_data_hdr *rp_data = (struct gsm411_rp_data_hdr*)&gh->data; |
Daniel Willmann | 8b3390e | 2008-12-28 00:31:09 +0000 | [diff] [blame] | 44 | u_int8_t msg_type = rp_data->msg_type & 0x07; |
| 45 | |
| 46 | switch (msg_type) { |
| 47 | case GSM411_MT_RP_DATA_MO: |
| 48 | DEBUGP(DSMS, "SMS RP-DATA (MO)\n"); |
Daniel Willmann | fdd0a6c | 2008-12-28 01:51:14 +0000 | [diff] [blame] | 49 | |
Daniel Willmann | 8b3390e | 2008-12-28 00:31:09 +0000 | [diff] [blame] | 50 | break; |
| 51 | default: |
| 52 | DEBUGP(DSMS, "Unimplemented RP type 0x%02x\n", msg_type); |
| 53 | break; |
| 54 | } |
| 55 | |
| 56 | return rc; |
| 57 | } |
| 58 | |
| 59 | int gsm0411_rcv_sms(struct msgb *msg) |
| 60 | { |
| 61 | struct gsm48_hdr *gh = msgb_l3(msg); |
| 62 | u_int8_t msg_type = gh->msg_type; |
| 63 | int rc = 0; |
| 64 | |
| 65 | DEBUGP(DSMS, "SMS Message\n"); |
| 66 | |
| 67 | switch(msg_type) { |
| 68 | case GSM411_MT_CP_DATA: |
| 69 | DEBUGP(DSMS, "SMS CP-DATA\n"); |
| 70 | rc = gsm411_cp_data(msg); |
| 71 | break; |
| 72 | case GSM411_MT_CP_ACK: |
| 73 | case GSM411_MT_CP_ERROR: |
| 74 | default: |
| 75 | DEBUGP(DSMS, "Unimplemented CP msg_type: 0x%02x\n", msg_type); |
| 76 | break; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | return rc; |
| 81 | } |
| 82 | |