comparison g23m/condat/ms/src/aci/cmh_sm.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Definitions for the command handler of the
18 | GPRS session management ( SM ).
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifdef GPRS
23
24 #ifndef CMH_SM_H
25 #define CMH_SM_H
26
27 /*==== CONSTANTS ==================================================*/
28
29 /* dynamic numbers of nsapis */
30 #define SMH_FIRST_FREE_NSAPIS SMREG_NSAPI_5
31 #define SMH_LAST_FREE_NSAPIS SMREG_NSAPI_15
32 #define SMH_NSAPI_MAX 16
33
34 /* invalid values */
35 #define INVALID_NSAPI (0xFF) /* marks an invalid nsapi */
36
37 /* not used nsapi */
38 #define UNUSED_NSAPI (0x00) /* nsapi currently not in use */
39
40 /* for network requested context activation */
41 #define MAX_GPRS_CALL_TABLE_ENTRIES 2
42 /* MAX_PDP_TYPE_LEN + MAX_PDP_ADDR_LEN + MAX_L2P_LENGTH = 7 + 21 + 6 = 34 */
43 #define MAX_CRING_INFORMATION_LENGTH 42
44
45 /* undefiend smreg_ti */
46 #define UNDEFINED_TI 0xFF
47
48 typedef enum
49 {
50 PCO_USER,
51 PCO_NETWORK
52
53 } T_PCO_TYPE;
54
55 typedef enum
56 {
57 SNDCP_PEER_NORMAL,
58 SNDCP_PEER_SWITCHED
59
60 } T_SNDCP_PEER;
61
62 typedef enum
63 {
64 GCTT_NORMAL = 0,
65 GCTT_REACTIVATION
66
67 } T_GPRS_CALL_TABLE_TYPE;
68
69 /*==== TYPES ======================================================*/
70
71 typedef struct
72 {
73 UBYTE len;
74 UBYTE pco[251];
75 } T_GPRS_CONT_PCO;
76
77 typedef struct
78 {
79 T_CONTEXT_STATE state;
80 UBYTE nsapi;
81 UBYTE smreg_ti;
82 T_DTI_CONN_LINK_ID link_id_sn;
83 T_DTI_CONN_LINK_ID link_id_uart;
84 T_DTI_CONN_LINK_ID link_id_new;
85 T_DTI_ENTITY_ID entity_id;
86 T_GPRS_CONT_REC con;
87 T_QOS qos;
88 T_PDP_ADDRESS allocated_pdp_addr;
89 T_ACI_CMD_SRC owner;
90 T_GPRS_CONT_PCO user_pco; /* setup with %CGPCO=... */
91 T_GPRS_CONT_PCO network_pco; /* setup with SMREG_PDP_ACTIVATE_CNF */
92 } T_GPRS_CONT_CLASS;
93
94 typedef struct
95 {
96 T_SMREG_PDP_ACTIVATE_IND sm_ind;
97 char L2P[MAX_L2P_LENGTH];
98 SHORT cid;
99 UBYTE reactivation; /* T_GPRS_CALL_TABLE_TYPE */
100
101 } T_GPRS_CALL_TABLE;
102
103 typedef enum /* GPRS Packet Data Protocol type */
104 {
105 PDP_T_NONE = 0, /* no valid PDP type */
106 PDP_T_X25, /* ITU-T/CCITT X.25 layer 3 */
107 PDP_T_IP, /* Internet Protocol (IETF STD 5) */
108 PDP_T_MAX /* maximum GPRS PDP types */
109
110 } T_GACI_PDP_TYPE;
111
112 #ifdef CO_UDP_IP
113 typedef void T_SM_IP_CB (T_ACI_RETURN result);
114 #endif /* WAP || SAT E */
115
116 /*==== PROTOTYPES =================================================*/
117 EXTERN void cmhSM_NetDeactivate ( void );
118 EXTERN void cmhSM_Deactivated ( void );
119 EXTERN void cmhSM_NetActivate ( void );
120 EXTERN SHORT cmhSM_NoActivate ( void );
121 EXTERN SHORT cmhSM_Activated ( T_SMREG_PDP_ACTIVATE_CNF *pdp_cnf );
122 EXTERN void cmhSM_NetModify ( USHORT nsapi_set, T_smreg_qos *qos );
123
124 EXTERN void cmhSM_Init ( void );
125 EXTERN void cmhSM_Reset ( void );
126 EXTERN void cmhSM_ResetNonWorkingContexts( void );
127 EXTERN void cmhSM_empty_call_table ( void );
128 EXTERN void cmhSM_GiveNSapiFree ( USHORT cid );
129 EXTERN void cmhSM_contextDeactivated ( void );
130 EXTERN USHORT cmhSM_pdp_typ_to_string ( UBYTE pdp_typ_no, char* string );
131 EXTERN UBYTE cmhSM_Get_pdp_type ( void );
132 EXTERN void cmhSM_Get_pdp_address ( T_pdp_address *pdp_address );
133 EXTERN SHORT cmhSM_pdp_address_to_ip ( T_PDP_ADDRESS *pdp_address, UBYTE *ip );
134 EXTERN void cmhSM_ip_to_pdp_address ( UBYTE *ip, T_PDP_ADDRESS pdp_address );
135 EXTERN void cmhSM_Get_smreg_apn ( T_smreg_apn *smreg_apn );
136 EXTERN UBYTE cmhSM_Get_h_comp ( void );
137 EXTERN UBYTE cmhSM_Get_d_comp ( void );
138 EXTERN void cmhSM_change_def_QOS ( T_QOS *qos );
139 EXTERN void cmhSM_change_def_QOS_min ( T_QOS *qos );
140 EXTERN void cmhSM_Set_default_QOS ( SHORT cid );
141 EXTERN void cmhSM_Set_default_QOS_min ( SHORT cid );
142 EXTERN void cmhSM_Get_QOS ( T_smreg_qos *dest_qos );
143 EXTERN void cmhSM_Get_QOS_min ( T_smreg_min_qos *dest_qos_min );
144 EXTERN char* cmhSM_ring_gprs_par ( void );
145 EXTERN BOOL cmhSM_call_answer ( UBYTE ring_counter, T_ACI_CRING_MOD mode );
146 EXTERN BOOL cmhSM_call_reject ( UBYTE ring_counter, T_ACI_CRING_MOD mode );
147 EXTERN BOOL cmhSM_sAT_H ( T_ACI_CMD_SRC srcId, T_ACI_RETURN *aci_ret );
148 EXTERN BOOL cmhSM_sAT_A ( T_ACI_CMD_SRC srcId, T_ACI_RETURN *aci_ret );
149 EXTERN USHORT cmhSM_Give_nsapi_set ( SHORT cid );
150 EXTERN BOOL cmhSM_pdp_addr_well_formed( USHORT type, T_PDP_ADDRESS pdp_addr );
151 EXTERN BOOL cmhSM_apn_well_formed ( T_APN apn );
152 EXTERN USHORT cmhSM_transform_pdp_type ( char *pdp_type );
153 EXTERN void cmhSM_cgerep_buffer ( void );
154 EXTERN void cmhSM_save_event ( T_CGEREP_EVENT event, T_CGEREP_EVENT_REP_PARAM *param );
155 EXTERN void cmhSM_set_sms_service ( T_CGSMS_SERVICE service );
156 EXTERN void cmhSM_sms_service_changed ( UBYTE service );
157 EXTERN SHORT cmhSM_get_cid ( USHORT nsapi );
158 EXTERN BOOL cmhSM_next_work_cid ( T_ACI_AT_CMD curCmd );
159 EXTERN SHORT cmhSM_define_cid_list ( T_ACI_CMD_SRC srcId, SHORT *cids );
160
161 EXTERN SHORT cmhSM_get_pdp_addr_for_CGPADDR ( SHORT cid, T_PDP_ADDRESS pdp_adress );
162
163 EXTERN T_ACI_RETURN cmhSM_GprsAttached ( SHORT state );
164 EXTERN T_ACI_RETURN cmhSM_activate_context (void);
165 EXTERN void cmhSM_data_link_context (void);
166
167 #ifdef DTI
168 EXTERN SHORT cmhSM_connect_context ( SHORT cid, T_DTI_ENTITY_ID peer, UBYTE ppp_hc, UBYTE msid );
169 #endif /* DTI */
170
171 EXTERN SHORT cmhSM_context_connected ( USHORT nsapi);
172
173 EXTERN BOOL cmhSM_is_smreg_ti_used ( UBYTE smreg_ti, SHORT *cid );
174 EXTERN void cmhSM_context_reactivation ( void );
175 EXTERN void cmhSM_stop_context_reactivation ( void );
176 EXTERN void cmhSM_next_call_table_entry ( void );
177
178 EXTERN SHORT cmhSM_connect_working_cid ( void );
179
180 EXTERN void cmhSM_set_PCO( SHORT cid, T_PCO_TYPE pco_type, UBYTE* buf_addr, UBYTE length);
181 #if defined (CO_UDP_IP) || defined (FF_GPF_TCPIP)
182 EXTERN void cmhSM_IP_activate_cb (T_ACI_RETURN result);
183 EXTERN void cmhSM_IP_Enable (T_DTI_CONN_LINK_ID link_id );
184 EXTERN void cmhSM_IP_Disable (void);
185 #endif /* CO_UDP_IP || FF_GPF_TCPIP */
186
187 /* execution AT set command without parameter check */
188 EXTERN void sAT_PlusCGDCONT_exec ( T_ACI_CMD_SRC srcId, SHORT cid, T_GPRS_CONT_REC *inputCtxt);
189
190 EXTERN ULONG cmhSM_get_link_id_SNDCP_peer ( SHORT cid, T_SNDCP_PEER which );
191 EXTERN void cmhSM_context_deactivated ( USHORT nsapi_set );
192 EXTERN void cmhSM_connection_down ( UBYTE dti_id );
193
194 EXTERN T_ACI_CMD_SRC cmhSM_getSrcIdOfRunningCGACTDeactivation(SHORT cid);
195 EXTERN BOOL isContextDeactivationRequestedByCGACT(SHORT cid);
196
197 EXTERN T_ACI_RETURN cmhSM_deactivateContexts ( T_ACI_CMD_SRC srcId, SHORT *cids);
198 EXTERN T_ACI_RETURN cmhSM_deactivateAContext ( T_ACI_CMD_SRC srcId, SHORT cid );
199
200 #ifdef DTI
201 EXTERN void cmhSNDCP_Disable ( T_DTI_CONN_LINK_ID link_id );
202 #endif /* DTI */
203
204 EXTERN void cmhSM_ip_to_pdp_address ( UBYTE *ip, T_PDP_ADDRESS pdp_address );
205
206 #ifdef FF_SAT_E
207 EXTERN T_QOS* cmhSM_getCurQOS ( SHORT cid );
208 #endif /* FF_SAT_E */
209
210 EXTERN BOOL cmhSM_isContextActive ( void );
211
212 #ifdef DTI
213 EXTERN void set_conn_param_on_working_cid ( UBYTE owner, T_DTI_ENTITY_ID entity_id );
214 EXTERN void set_conn_param_on_all_working_cids ( UBYTE owner, T_DTI_ENTITY_ID entity_id );
215 #endif /* DTI */
216
217 /*==== EXPORT =====================================================*/
218 #ifdef CMH_SMF_C
219
220 GLOBAL T_ENT_STAT smEntStat;
221
222 T_GPRS_CONT_CLASS pdp_context[MAX_CID];
223 SHORT work_cids[MAX_CID_PLUS_EINS];
224 SHORT cid_pointer;
225 T_GPRS_CONT_REC defaultCtx;
226
227 SHORT automatic_response_mode;
228
229 /* network requested context activation */
230 T_GPRS_CALL_TABLE gprs_call_table[MAX_GPRS_CALL_TABLE_ENTRIES];
231 SHORT current_gprs_ct_index;
232 SHORT gprs_ct_index;
233
234 T_CGSMS_SERVICE sm_cgsms_service;
235
236 #else
237
238 EXTERN T_ENT_STAT smEntStat;
239
240 EXTERN T_GPRS_CONT_CLASS pdp_context[MAX_CID];
241 EXTERN SHORT work_cids[MAX_CID_PLUS_EINS];
242 EXTERN SHORT cid_pointer;
243 EXTERN T_GPRS_CONT_REC defaultCtx;
244
245 EXTERN SHORT automatic_response_mode;
246
247 /* network requested context activation */
248 EXTERN T_GPRS_CALL_TABLE gprs_call_table[MAX_GPRS_CALL_TABLE_ENTRIES];
249 EXTERN SHORT current_gprs_ct_index;
250 EXTERN SHORT gprs_ct_index;
251
252 EXTERN T_CGSMS_SERVICE sm_cgsms_service;
253
254 #endif /* CMH_SMF_C */
255
256 #endif /* CMH_SM_H */
257
258
259 #endif /* GPRS */
260 /*==== EOF =======================================================*/