libosmogsm  0.9.3
Osmocom GSM library
include/osmocom/gsm/gsm0411_smc.h
00001 #pragma once
00002 
00003 #include <osmocom/core/timer.h>
00004 #include <osmocom/gsm/protocol/gsm_04_11.h>
00005 
00006 #define GSM411_MMSMS_EST_REQ            0x310
00007 #define GSM411_MMSMS_EST_IND            0x312
00008 #define GSM411_MMSMS_EST_CNF            0x311
00009 #define GSM411_MMSMS_REL_REQ            0x320
00010 #define GSM411_MMSMS_REL_IND            0x322
00011 #define GSM411_MMSMS_DATA_REQ           0x330
00012 #define GSM411_MMSMS_DATA_IND           0x332
00013 #define GSM411_MMSMS_UNIT_DATA_REQ      0x340
00014 #define GSM411_MMSMS_UNIT_DATA_IND      0x342
00015 #define GSM411_MMSMS_ERR_IND            0x372
00016 
00017 #define GSM411_MNSMS_ABORT_REQ          0x101
00018 #define GSM411_MNSMS_DATA_REQ           0x102
00019 #define GSM411_MNSMS_DATA_IND           0x103
00020 #define GSM411_MNSMS_EST_REQ            0x104
00021 #define GSM411_MNSMS_EST_IND            0x105
00022 #define GSM411_MNSMS_ERROR_IND          0x106
00023 #define GSM411_MNSMS_REL_REQ            0x107
00024 
00025 struct gsm411_smc_inst {
00026         uint64_t id;            /* a unique id for the SMS */
00027         int network;            /* is this a MO (0) or MT (1) transfer */
00028         int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type,
00029                         struct msgb *msg);
00030         int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type,
00031                         struct msgb *msg, int cp_msg_type);
00032 
00033         enum gsm411_cp_state cp_state;
00034         struct osmo_timer_list cp_timer;
00035         struct msgb *cp_msg;    /* store pending message */
00036         int cp_rel;             /* store pending release */
00037         int cp_retx;            /* retry counter */
00038         int cp_max_retr;        /* maximum retry */
00039         int cp_tc1;             /* timer value TC1* */
00040 
00041 };
00042 
00043 extern const struct value_string gsm411_cp_cause_strs[];
00044 
00045 /* init a new instance */
00046 void gsm411_smc_init(struct gsm411_smc_inst *inst, uint64_t id, int network,
00047         int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type,
00048                         struct msgb *msg),
00049         int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type,
00050                         struct msgb *msg, int cp_msg_type));
00051 
00052 /* clear instance */
00053 void gsm411_smc_clear(struct gsm411_smc_inst *inst);
00054 
00055 /* message from upper layer */
00056 int gsm411_smc_send(struct gsm411_smc_inst *inst, int msg_type,
00057         struct msgb *msg);
00058 
00059 /* message from lower layer */
00060 int gsm411_smc_recv(struct gsm411_smc_inst *inst, int msg_type,
00061         struct msgb *msg, int cp_msg_type);