comparison src/g23m-aci/aci/cmh_sm.h @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
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 NAS_NSAPI_5
31 #define SMH_LAST_FREE_NSAPIS NAS_NSAPI_15
32 #define SMH_NSAPI_MAX 16
33
34 /* invalid values */
35 #define INVALID_NSAPI (0xFF) /* marks an invalid nsapi */
36
37 /* for network requested context activation */
38 #define MAX_GPRS_CALL_TABLE_ENTRIES 2
39 /* MAX_PDP_TYPE_LEN + MAX_PDP_ADDR_LEN + MAX_L2P_LENGTH = 7 + 21 + 6 = 34 */
40 #define MAX_CRING_INFORMATION_LENGTH 42
41
42 /* undefiend ti */
43 #define UNDEFINED_TI 0xFF
44
45 typedef enum
46 {
47 PCO_USER,
48 PCO_NETWORK
49
50 } T_PCO_TYPE;
51
52 typedef enum
53 {
54 SNDCP_PEER_NORMAL,
55 SNDCP_PEER_SWITCHED
56
57 } T_SNDCP_PEER;
58
59 typedef enum
60 {
61 GCTT_NORMAL = 0,
62 GCTT_REACTIVATION
63
64 } T_GPRS_CALL_TABLE_TYPE;
65
66 typedef enum
67 {
68 GPRS_DETACH = 0,
69 GPRS_ATTACH
70 } T_GPRS_ATTACH_STATE;
71
72
73 /*==== MACROS =====================================================*/
74 #define GET_NUM_OF_DTI_ENTITIES(A) (sizeof(A)/(sizeof(A##[0])))
75
76
77 /*==== TYPES ======================================================*/
78
79 typedef struct
80 {
81 UBYTE len;
82 UBYTE pco[251];
83 } T_GPRS_CONT_PCO;
84
85
86 typedef struct
87 {
88 T_SMREG_PDP_ACTIVATE_IND sm_ind;
89 char L2P[MAX_L2P_LENGTH];
90 SHORT cid;
91 UBYTE reactivation; /* T_GPRS_CALL_TABLE_TYPE */
92
93 } T_GPRS_CALL_TABLE;
94
95 typedef enum /* GPRS Packet Data Protocol type */
96 {
97 PDP_T_NONE = 0, /* no valid PDP type */
98 PDP_T_PPP = SMREG_PDP_PPP, /* Point to Point Protocol (IETF STD 51) */
99 PDP_T_IP = SMREG_PDP_IPV4, /* Internet Protocol, version 4, IETF STD 5 */
100 PDP_T_IPV6 = SMREG_PDP_IPV6, /* Internet Protocol, version 6, IETF RFC 2460 */
101 PDP_T_MAX /* maximum GPRS PDP types */
102
103 } T_GACI_PDP_TYPE;
104
105 #ifdef CO_UDP_IP
106 typedef void T_SM_IP_CB (T_ACI_RETURN result);
107 #endif /* WCO_UDP_IP */
108
109 /*==== PROTOTYPES =================================================*/
110 EXTERN void cmhSM_NetDeactivate ( void );
111 EXTERN void cmhSM_Deactivated ( void );
112 EXTERN void cmhSM_NetActivate ( void );
113 EXTERN SHORT cmhSM_NoActivate ( void );
114 EXTERN SHORT cmhSM_Activated ( T_SMREG_PDP_ACTIVATE_CNF *pdp_cnf );
115 EXTERN void cmhSM_NetModify ( T_SMREG_PDP_MODIFY_IND *smreg_pdp_modify_ind );
116
117 #ifdef REL99
118 EXTERN SHORT cmhSM_Modified ( T_SMREG_PDP_MODIFY_CNF *smreg_pdp_modify_cnf );
119 EXTERN SHORT cmhSM_NoModify ( T_SMREG_PDP_MODIFY_REJ *smreg_pdp_nodify_rej );
120 EXTERN SHORT cmhSM_ActivatedSecondary ( T_SMREG_PDP_ACTIVATE_SEC_CNF *p_smreg_pdp_activate_sec_cnf );
121 EXTERN SHORT cmhSM_NoActivateSecondary ( T_SMREG_PDP_ACTIVATE_SEC_REJ *p_smreg_pdp_activate_sec_rej );
122 #endif
123
124
125 EXTERN void cmhSM_Init ( void );
126 EXTERN void cmhSM_Reset ( void );
127 EXTERN void cmhSM_ResetNonWorkingContexts( void );
128 EXTERN void cmhSM_empty_call_table ( void );
129 EXTERN void cmhSM_GiveNSapiFree ( USHORT cid );
130 EXTERN void cmhSM_contextDeactivated ( void );
131 EXTERN USHORT cmhSM_pdp_typ_to_string ( UBYTE pdp_typ_no, char* string );
132 EXTERN UBYTE cmhSM_Get_pdp_type ( void );
133 EXTERN void cmhSM_Get_pdp_address ( T_NAS_ip_address *pdp_address, T_NAS_ctrl_ip_address * ctrl_ip_address );
134 EXTERN UBYTE cmhSM_pdp_address_to_ip ( T_PDP_TYPE pdp_type, T_NAS_ip *pdp_addr_str, U8 *ip );
135 EXTERN void cmhSM_ip_to_pdp_address ( UBYTE *ip, T_NAS_ip pdp_address );
136 EXTERN void cmhSM_Get_smreg_apn ( T_SMREG_apn *smreg_apn );
137 EXTERN UBYTE cmhSM_Get_h_comp ( void );
138 EXTERN UBYTE cmhSM_Get_d_comp ( void );
139 EXTERN void cmhSM_change_def_QOS ( T_PS_qos *qos, T_PS_ctrl_qos ctrl_qos );
140 EXTERN void cmhSM_change_def_QOS_min ( T_PS_min_qos *qos, T_PS_ctrl_min_qos ctrl_min_qos );
141 EXTERN void cmhSM_Set_default_QOS ( U8 cid );
142 EXTERN void cmhSM_Set_default_QOS_min ( U8 cid );
143 EXTERN void cmhSM_Get_QOS ( T_PS_qos *dest_qos );
144 EXTERN void cmhSM_Get_QOS_min ( T_PS_min_qos *dest_qos_min );
145 EXTERN char* cmhSM_ring_gprs_par ( void );
146 EXTERN BOOL cmhSM_call_answer ( UBYTE ring_counter, T_ACI_CRING_MOD mode );
147 EXTERN BOOL cmhSM_call_reject ( UBYTE ring_counter, T_ACI_CRING_MOD mode );
148 EXTERN BOOL cmhSM_sAT_H ( T_ACI_CMD_SRC srcId, T_ACI_RETURN *aci_ret );
149 EXTERN BOOL cmhSM_sAT_A ( T_ACI_CMD_SRC srcId, T_ACI_RETURN *aci_ret );
150 EXTERN USHORT cmhSM_Give_nsapi_set ( U8 cid );
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 T_ACI_RETURN cmhSM_activate_context_For_WAP(void);
158
159 EXTERN BOOL cmhSM_next_work_cid ( T_ACI_AT_CMD curCmd );
160 EXTERN T_PDP_CONTEXT_STATE pdp_context_get_state_for_cid( U8 cid );
161 EXTERN BOOL pdp_context_type_omitted ( char *p_type );
162 EXTERN BOOL pdp_context_type_valid ( char *p_type );
163 EXTERN BOOL pdp_context_apn_omitted ( char *p_apn );
164 EXTERN BOOL pdp_context_apn_valid ( char *p_apn );
165 EXTERN BOOL pdp_context_addr_omitted ( T_NAS_ip *p_addr );
166 EXTERN BOOL pdp_context_addr_valid ( T_NAS_ip *p_addr );
167
168 EXTERN BOOL pdp_context_cid_used_by_other( U8 cid );
169
170 EXTERN SHORT cmhSM_make_active_cid_list ( T_ACI_CMD_SRC srcId, U8 *cids );
171 EXTERN void cmhSM_Set_pdp_type( U8 cid, char *pdp_type );
172
173 EXTERN U8 cmhSM_get_pdp_addr_for_CGPADDR ( U8 cid, T_NAS_ip * pdp_adress );
174 EXTERN void cmhSM_GprsAttached ( T_GPRS_ATTACH_STATE state );
175 EXTERN void cmhSM_activate_context (void);
176 EXTERN void cmhSM_data_link_context (void);
177
178 #ifdef DTI
179 EXTERN SHORT cmhSM_connect_context ( U8 cid, T_DTI_ENTITY_ID peer );
180 #endif /* DTI */
181
182 EXTERN SHORT cmhSM_context_connected ( USHORT nsapi);
183 EXTERN BOOL cmhSM_is_smreg_ti_used ( UBYTE ti, U8 *cid );
184 EXTERN void cmhSM_context_reactivation ( void );
185 EXTERN void cmhSM_stop_context_reactivation ( void );
186 EXTERN void cmhSM_next_call_table_entry ( void );
187 EXTERN SHORT cmhSM_connect_working_cid ( void );
188 EXTERN void cmhSM_set_PCO ( U8 cid, T_PCO_TYPE pco_type, UBYTE* buf_addr, UBYTE length );
189
190 #if defined (CO_UDP_IP) || defined (FF_GPF_TCPIP)
191 EXTERN void cmhSM_IP_activate_cb ( T_ACI_RETURN result );
192 EXTERN void cmhSM_IP_Enable (T_DTI_CONN_LINK_ID link_id );
193 EXTERN void cmhSM_IP_Disable (void);
194 #endif /* (CO_UDP_IP) || defined (FF_GPF_TCPIP) */
195
196 /* execution AT set command without parameter check */
197 EXTERN void sAT_PlusCGDCONT_exec ( U8 cid, T_PDP_CONTEXT *inputCtxt);
198 EXTERN BOOL sAT_PlusCGDSCONT_exec ( U8 cid, T_PDP_CONTEXT *p_pdp_context_input);
199
200 EXTERN T_ACI_RETURN cmhSM_CGPCO_HEX ( U8 cid, UBYTE *pco_array, UBYTE pco_len );
201 EXTERN ULONG cmhSM_get_link_id_UPM_peer ( U8 cid );
202 EXTERN void cmhSM_context_deactivated ( USHORT nsapi_set );
203 EXTERN void cmhSM_connection_down ( UBYTE dti_id );
204
205 EXTERN T_ACI_RETURN cmhSM_deactivateContexts ( T_ACI_CMD_SRC srcId, SHORT *cids);
206 EXTERN T_ACI_RETURN cmhSM_deactivateAContext ( T_ACI_CMD_SRC srcId, U8 cid );
207
208 EXTERN BOOL isContextDeactivationRequestedByCGACT(SHORT cid);
209
210
211 //EXTERN void cmhSM_ip_to_pdp_address ( UBYTE *ip, T_NAS_ip pdp_address );
212 EXTERN T_PS_qos* cmhSM_getCurQOS ( U8 cid );
213
214 EXTERN BOOL cmhSM_isContextActive ( void );
215
216 EXTERN void cmhSM_connection_down ( UBYTE dti_id );
217
218
219 #ifdef DTI
220 EXTERN void set_conn_param_on_working_cid ( UBYTE owner, T_DTI_ENTITY_ID entity_id );
221 EXTERN void set_conn_param_on_all_working_cids ( UBYTE owner, T_DTI_ENTITY_ID entity_id );
222 #endif /* DTI */
223
224 EXTERN BOOL PKTIO_SNDCP_connect_dti_cb(UBYTE dti_id, T_DTI_CONN_STATE result_type);
225
226 EXTERN void cmhSM_free_pdpcontext_list(void);
227 EXTERN UBYTE cmhSM_mapSM2ACI_Cause(U16 cause_value);
228 EXTERN void cmhSM_clear_work_cids(U8 cid);
229
230 /*==== EXPORT =====================================================*/
231 #ifdef CMH_SMF_C
232
233 GLOBAL T_ENT_STAT smEntStat;
234
235 U8 work_cids[PDP_CONTEXT_CID_MAX + 1];
236 U8 cid_pointer;
237
238 T_PDP_CONTEXT_INTERNAL pdp_context_default;
239 T_PS_qos pdp_context_default_qos;
240 T_PS_min_qos pdp_context_default_qos_min;
241
242 SHORT automatic_response_mode;
243
244 /* network requested context activation */
245 T_GPRS_CALL_TABLE gprs_call_table[MAX_GPRS_CALL_TABLE_ENTRIES];
246 SHORT current_gprs_ct_index;
247 SHORT gprs_ct_index;
248
249 /* command values */
250 T_CGEREP_MODE sm_cgerep_mode;
251 T_CGEREP_BFR sm_cgerep_bfr;
252 T_CGSMS_SERVICE sm_cgsms_service;
253 T_ACI_CMD_SRC sm_cgerep_srcId;
254
255 #else
256
257 EXTERN T_ENT_STAT smEntStat;
258
259 EXTERN U8 work_cids[PDP_CONTEXT_CID_MAX + 1];
260 EXTERN U8 cid_pointer;
261 EXTERN T_GPRS_CONT_REC defaultCtx;
262
263 EXTERN T_PDP_CONTEXT_INTERNAL pdp_context_default;
264 EXTERN T_PS_qos pdp_context_default_qos;
265 EXTERN T_PS_min_qos pdp_context_default_qos_min;
266 EXTERN T_PDP_CONTEXT_PCO pdp_context_default_pco;
267
268 EXTERN SHORT automatic_response_mode;
269
270 /* network requested context activation */
271 EXTERN T_GPRS_CALL_TABLE gprs_call_table[MAX_GPRS_CALL_TABLE_ENTRIES];
272 EXTERN SHORT current_gprs_ct_index;
273 EXTERN SHORT gprs_ct_index;
274
275 /* command values */
276 EXTERN T_CGEREP_MODE sm_cgerep_mode;
277 EXTERN T_CGEREP_BFR sm_cgerep_bfr;
278 EXTERN T_CGSMS_SERVICE sm_cgsms_service;
279
280 EXTERN T_ACI_CMD_SRC cmhSM_getSrcIdOfRunningCGACTDeactivation(U8 cid);
281 EXTERN T_ACI_CMD_SRC sm_cgerep_srcId;
282
283 #endif /* CMH_SMF_C */
284
285 #endif /* CMH_SM_H */
286
287 #endif /* GPRS */
288
289 /*==== EOF =======================================================*/