comparison src/g23m-aci/aci/psa_dcms.c @ 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 : DCM and TCPIP
4 | Modul : ACI
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 :
18 +-----------------------------------------------------------------------------
19 */
20 #ifndef PSA_DCMS_C
21 #define PSA_DCMS_C
22 #endif
23
24 /*==== INCLUDES ===================================================*/
25 #include "aci_all.h"
26 #include "psa_dcm.h"
27 #include "socket_int.h"
28
29 /*==== CONSTANTS ==================================================*/
30
31 /*==== TYPES ======================================================*/
32
33 /*==== EXPORT =====================================================*/
34
35 /*==== VARIABLES ==================================================*/
36
37 /*==== FUNCTIONS ==================================================*/
38
39 /***************************************************************************************
40 * Function : psaDCM_open_conn_cnf
41 * Parameter : T_DCM_RET
42 * - dcm result
43 * T_APPLI_USER
44 * - application user id
45 * Return : BOOL
46 * if sending primitive is sucessful , return TREU , otherwise return FALSE
47 * Description : send dcm open conn cnf primitive to application
48 ***************************************************************************************/
49 GLOBAL BOOL psaDCM_open_conn_cnf(T_DCM_RET result, T_SOCK_API_INSTANCE api_instance)
50 {
51 T_SOCK_API_INSTANCE_DATA* api_data;
52
53 TRACE_FUNCTION("DCM: psaDCM_open_conn_cnf()");
54 TRACE_EVENT_P1("DCM: result %d",result);
55
56 /* set api_data */
57 api_data = (T_SOCK_API_INSTANCE_DATA*)api_instance;
58 {
59 PALLOC(dcm_open_conn_cnf, DCM_OPEN_CONN_CNF);
60 dcm_open_conn_cnf->result = result;
61 PSEND(api_data->hCommAPP, dcm_open_conn_cnf);
62 }
63 return TRUE;
64 }
65
66
67 /***************************************************************************************
68 * Function : psaDCM_close_conn_cnf
69 * Parameter : T_DCM_RET
70 * - dcm result
71 * T_APPLI_USER
72 * - application user id
73 * Return : BOOL
74 if sending primitive is sucessful , return TREU , otherwise return FALSE
75 * Description : send dcm cloes conn cnf primitive to application
76 ***************************************************************************************/
77 GLOBAL BOOL psaDCM_close_conn_cnf(T_DCM_RET result, T_SOCK_API_INSTANCE api_instance)
78 {
79 T_SOCK_API_INSTANCE_DATA* api_data;
80
81 TRACE_FUNCTION("DCM: psaDCM_close_conn_cnf()");
82
83 /* set api_data */
84 api_data = (T_SOCK_API_INSTANCE_DATA*)api_instance;
85 {
86 PALLOC(dcm_close_conn_cnf, DCM_CLOSE_CONN_CNF);
87 dcm_close_conn_cnf->result = result;
88 PSEND(api_data->hCommAPP, dcm_close_conn_cnf);
89 }
90 return TRUE;
91
92 }
93
94
95 /***************************************************************************************
96 * Function : psaDCM_get_current_conn_cnf
97 * Parameter : T_DCM_RET
98 * - dcm result
99 * T_APPLI_USER
100 * - application user id
101 * Return : BOOL
102 * if sending primitive is sucessful , return TREU , otherwise return FALSE
103 * Description : send dcm get current conn cnf primitive to application
104 ***************************************************************************************/
105 GLOBAL BOOL psaDCM_get_current_conn_cnf(T_DCM_RET result,
106 T_SOCK_API_INSTANCE api_instance,
107 T_DCM_ENV_CTRL_BLK *dcm_evt_blk)
108 {
109 U8 row;
110 T_SOCK_API_INSTANCE_DATA* api_data;
111
112 TRACE_FUNCTION("DCM: psaDCM_get_current_conn_cnf()");
113
114 /* set api_data */
115 api_data = (T_SOCK_API_INSTANCE_DATA*)api_instance;
116
117 row = dcm_evt_blk->current_row;
118 {
119 PALLOC(dcm_get_current_conn_cnf, DCM_GET_CURRENT_CONN_CNF);
120 dcm_get_current_conn_cnf->result = result;
121
122 if(result == DCM_OK)
123 {
124 /* current connected user infomation*/
125 dcm_get_current_conn_cnf->dcm_info_conn.bearer_handle =
126 dcm_evt_blk->ipu_list[row].bearer_handle;
127 dcm_get_current_conn_cnf->dcm_info_conn.app_handle =
128 dcm_evt_blk->ipu_list[row].app_handle;
129 dcm_get_current_conn_cnf->dcm_info_conn.bearer_type =
130 dcm_evt_blk->ipu_list[row].bearer_type;
131 dcm_get_current_conn_cnf->dcm_info_conn.apn_valid =
132 dcm_evt_blk->ipu_list[row].apn_valid;
133 memcpy(dcm_get_current_conn_cnf->dcm_info_conn.apn,
134 dcm_evt_blk->ipu_list[row].apn , (CDCM_APN_MAX_LEN + 1) );
135 dcm_get_current_conn_cnf->dcm_info_conn.phone_number_valid =
136 dcm_evt_blk->ipu_list[row].phone_number_valid;
137 memcpy(dcm_get_current_conn_cnf->dcm_info_conn.phone_number,
138 dcm_evt_blk->ipu_list[row].phone_number, (CDCM_PHONE_NR_LEN + 1) );
139 dcm_get_current_conn_cnf->dcm_info_conn.user_id_valid =
140 dcm_evt_blk->ipu_list[row].user_id_valid;
141 memcpy(dcm_get_current_conn_cnf->dcm_info_conn.user_id,
142 dcm_evt_blk->ipu_list[row].user_id, (CDCM_USER_MAX_LEN + 1) );
143 dcm_get_current_conn_cnf->dcm_info_conn.password_valid =
144 dcm_evt_blk->ipu_list[row].password_valid;
145 memcpy(dcm_get_current_conn_cnf->dcm_info_conn.password,
146 dcm_evt_blk->ipu_list[row].password, (CDCM_PASSWORD_MAX_LEN + 1) );
147 dcm_get_current_conn_cnf->dcm_info_conn.cid =
148 dcm_evt_blk->ipu_list[row].cid;
149 dcm_get_current_conn_cnf->dcm_info_conn.ip_address =
150 dcm_evt_blk->ipu_list[row].ip_address;
151 dcm_get_current_conn_cnf->dcm_info_conn.dns1 =
152 dcm_evt_blk->ipu_list[row].dns1;
153 dcm_get_current_conn_cnf->dcm_info_conn.dns2 =
154 dcm_evt_blk->ipu_list[row].dns2;
155 dcm_get_current_conn_cnf->dcm_info_conn.gateway =
156 dcm_evt_blk->ipu_list[row].gateway;
157 dcm_get_current_conn_cnf->dcm_info_conn.auth_type =
158 dcm_evt_blk->ipu_list[row].auth_type;
159 dcm_get_current_conn_cnf->dcm_info_conn.data_compr =
160 dcm_evt_blk->ipu_list[row].data_compr;
161 dcm_get_current_conn_cnf->dcm_info_conn.header_compr =
162 dcm_evt_blk->ipu_list[row].header_compr;
163 dcm_get_current_conn_cnf->dcm_info_conn.precedence =
164 dcm_evt_blk->ipu_list[row].precedence;
165 dcm_get_current_conn_cnf->dcm_info_conn.delay =
166 dcm_evt_blk->ipu_list[row].delay;
167 dcm_get_current_conn_cnf->dcm_info_conn.reliability =
168 dcm_evt_blk->ipu_list[row].reliability;
169 dcm_get_current_conn_cnf->dcm_info_conn.peak_throughput =
170 dcm_evt_blk->ipu_list[row].peak_throughput;
171 dcm_get_current_conn_cnf->dcm_info_conn.mean_throughput =
172 dcm_evt_blk->ipu_list[row].mean_throughput;
173 dcm_get_current_conn_cnf->dcm_info_conn.shareable =
174 dcm_evt_blk->ipu_list[row].shareable;
175 }
176 PSEND(api_data->hCommAPP, dcm_get_current_conn_cnf);
177 }
178 return TRUE;
179 }
180
181
182 /***************************************************************************************
183 * Function : psaDCM_error_ind
184 * Parameter : T_DCM_STATUS_IND_MSG *
185 * - dcm error indication msg
186 * T_APPLI_USER
187 * - application user id
188 * Return : BOOL
189 * if sending primitive is sucessful , return TRUE , otherwise return FALSE
190 * Description : send error ind primitive to application
191 ***************************************************************************************/
192 extern BOOL is_netdrop ;
193 GLOBAL BOOL psaDCM_error_ind(T_DCM_STATUS_IND_MSG* dcm_error_ind_msg,
194 T_SOCK_API_INSTANCE api_instance )
195 {
196 T_SOCK_API_INSTANCE_DATA* api_data;
197
198 TRACE_FUNCTION("DCM: psaDCM_error_ind()");
199
200 /* set api_data */
201 api_data = (T_SOCK_API_INSTANCE_DATA*)api_instance;
202 {
203 PALLOC(dcm_error_ind, DCM_ERROR_IND);
204 if( is_netdrop==TRUE) //pinghua added
205 {
206 dcm_error_ind->dcm_err = 99 ;
207 dcm_error_ind->result = 99;
208 is_netdrop=FALSE ;
209 }
210 else
211 {
212 dcm_error_ind->dcm_err = dcm_error_ind_msg->error;
213
214 dcm_error_ind->result = DCM_PS_CONN_BROKEN;
215 } //pinghua add end
216 PSEND(api_data->hCommAPP, dcm_error_ind);
217 }
218 return TRUE;
219 }
220