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