FreeCalypso > hg > fc-tourmaline
comparison src/g23m-fad/app/app.h @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
1 /* | |
2 +------------------------------------------------------------------------------ | |
3 | File: app.h | |
4 +------------------------------------------------------------------------------ | |
5 | Copyright 2003 Texas Instruments Berlin, AG | |
6 | All rights reserved. | |
7 | | |
8 | This file is confidential and a trade secret of Texas | |
9 | Instruments Berlin, AG | |
10 | The receipt of or possession of this file does not convey | |
11 | any rights to reproduce or disclose its contents or to | |
12 | manufacture, use, or sell anything it may describe, in | |
13 | whole, or in part, without the specific written consent of | |
14 | Texas Instruments Berlin, AG. | |
15 +----------------------------------------------------------------------------- | |
16 | Purpose : Definitions for the Protocol Stack Entity app. | |
17 +----------------------------------------------------------------------------- | |
18 */ | |
19 | |
20 #ifndef APP_H | |
21 #define APP_H | |
22 | |
23 /*==== INCLUDES =============================================================*/ | |
24 | |
25 /*==== CONSTS ===============================================================*/ | |
26 | |
27 #ifdef _SIMULATION_ | |
28 #define VSI_CALLER | |
29 #else /* _SIMULATION_ */ | |
30 #define VSI_CALLER APP_handle, | |
31 #endif /* _SIMULATION_ */ | |
32 | |
33 #define ENTITY_DATA app_data | |
34 | |
35 #define ENCODE_OFFSET 0 /* Bitoffset for encoding/decoding */ | |
36 | |
37 /* Timer definitions */ | |
38 #define T001 0 | |
39 #define T002 1 | |
40 | |
41 /* Timer durations */ | |
42 #define T001_VALUE 1000 /* 1 second */ | |
43 #define T002_VALUE 3000 /* 3 seconds */ | |
44 | |
45 /* make the pei_create function unique */ | |
46 #define pei_create app_pei_create | |
47 | |
48 | |
49 /* Default values for application procedures. */ | |
50 #define APP_DEF_BUFFER_SIZE 200 | |
51 #define APP_DEF_DOWNLOAD_REPS 1 | |
52 #define APP_DEF_DOWNLOAD_SIZE 5000 | |
53 #define APP_DEF_UPLOAD_REPS 1 | |
54 #define APP_DEF_UPLOAD_SIZE 5000 | |
55 #define APP_DEF_UDP_INTERVAL 100 /* ms between packets */ | |
56 #define APP_DEF_ECHO_ITEMS 10 | |
57 #define APP_DEF_ECHO_REPS 1 | |
58 #define APP_DEF_DNSQUERY_TIMES 1 | |
59 | |
60 typedef enum { | |
61 APP_PROV_T_MOBILE = 1, | |
62 APP_PROV_VODAFONE, | |
63 APP_PROV_DEFAULT = APP_PROV_VODAFONE, | |
64 APP_PROV_HUTCH, | |
65 APP_PROV_AIRTEL, | |
66 APP_PROV_CUSTOM, | |
67 // add new providers here | |
68 APP_PROV_INVALID | |
69 } T_APP_PROV; | |
70 | |
71 #ifdef _SIMULATION_ | |
72 #define APP_DEF_SERVER "137.167.238.28" | |
73 #define APP_DEF_CLOSE_SLEEP 2000 /* Sleep before sock_close_bearer(). */ | |
74 #define APP_DATA_DUMP_LENGTH 256 | |
75 #define APP_DEF_DNSQUERY_ADDR "chuck.berlin.tide.ti.com" | |
76 #else /* _SIMULATION_ */ | |
77 #define APP_DEF_SERVER "217.160.109.110" | |
78 #define APP_DEF_CLOSE_SLEEP 2000 | |
79 #define APP_DATA_DUMP_LENGTH 16 | |
80 #define APP_DEF_DNSQUERY_ADDR "gsmtest.com" | |
81 #endif /* _SIMULATION_ */ | |
82 | |
83 #define APP_DEF_TCPSRV_PORT 3425 | |
84 #define APP_DEF_TCPSRV_REPEAT 0 | |
85 | |
86 #define APP_N_CLIENTS 10 | |
87 | |
88 #define APP_SEND_PATTERN \ | |
89 "Testapp for GPF-based TCP/IP [ni@ti.com] " \ | |
90 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOP" \ | |
91 "QRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ " | |
92 | |
93 /*==== TYPES =================================================================*/ | |
94 | |
95 /* APP global typedefs */ | |
96 | |
97 typedef struct /* T_APP_DATA */ | |
98 { | |
99 unsigned char version; | |
100 /* | |
101 * entity parameters | |
102 */ | |
103 } T_APP_DATA; | |
104 | |
105 /*==== EXPORTS ===============================================================*/ | |
106 | |
107 short app_pei_create (T_PEI_INFO **info); | |
108 | |
109 #ifdef APP_PEI_C | |
110 /* Entity data base */ | |
111 T_APP_DATA app_data_base; | |
112 T_APP_DATA *app_data; | |
113 | |
114 /* Communication handles */ | |
115 T_HANDLE APP_handle; | |
116 #else /* APP_PEI_C */ | |
117 extern T_APP_DATA app_data_base; | |
118 extern T_APP_DATA *app_data; | |
119 extern T_HANDLE hCommYYY; | |
120 extern T_HANDLE hCommMMI; | |
121 extern T_HANDLE APP_handle; | |
122 #ifdef FF_GPF_TCPIP | |
123 extern T_SOCK_API_INSTANCE sock_api_inst ; | |
124 extern T_SOCK_BEARER_HANDLE sock_bearer_handle; | |
125 EXTERN char custom_apn[SOCK_MAX_APN_LEN+1]; | |
126 EXTERN char custom_user_id[SOCK_MAX_USERID_LEN+1]; | |
127 EXTERN char custom_password[SOCK_MAX_PASSWORD_LEN+1]; | |
128 #endif /* FF_GPF_TCPIP */ | |
129 #endif /* APP_PEI_C */ | |
130 | |
131 #define BAT_MAX_TEST_CLNT_NUM 4 | |
132 #define BAT_MAX_TEST_INST_NUM 2 | |
133 | |
134 #ifdef FF_GPF_TCPIP | |
135 | |
136 /*==== Callbacks =============================================================*/ | |
137 | |
138 void app_sock_callback(T_SOCK_EVENTSTRUCT *event, void *context) ; | |
139 | |
140 | |
141 /*==== APP-internal functions ================================================*/ | |
142 | |
143 /** Initialize the application core, including APIs for DCM and Sockets. | |
144 * | |
145 * @param handle own communication handle | |
146 * @return PEI_OK/PEI_ERROR depending on the success of the API initializations. | |
147 */ | |
148 BOOL app_initialize_tcpip(T_HANDLE app_handle) ; | |
149 | |
150 /** Parse a command and execute it if it is valid. Return appropriate error | |
151 * message if the command is invalid or fails. | |
152 * | |
153 * @param command command line to execute | |
154 * @return an error message or NULL on success | |
155 */ | |
156 char *app_handle_command_tcpip(char *command) ; | |
157 | |
158 | |
159 void app_start_tcpdl(int prov, int size, int reps) ; | |
160 void app_start_tcpul(int prov, int size, int reps) ; | |
161 void app_start_udpdl(int prov, int size, int reps) ; | |
162 void app_start_udpul(int prov, int size, int reps) ; | |
163 void app_start_tcpecho(int prov, int size, int reps) ; | |
164 void app_start_udpecho(int prov, int size, int reps) ; | |
165 void app_start_tcpsrv(int prov, int port, int repeat) ; | |
166 void app_start_dnsquery(int prov, int times, char *address) ; | |
167 void app_shutdown(void) ; | |
168 void app_pstat(void) ; | |
169 void app_server(char *server) ; | |
170 void app_port(char *port) ; | |
171 void app_buffer(char *bufsize) ; | |
172 void app_bearer(char *bearer) ; | |
173 void app_switch_flow(int flow_on) ; | |
174 LOCAL void app_print_conn_info(T_SOCK_BEARER_INFO_CNF *info); | |
175 | |
176 void app_open_bearer(int prov, int size, int reps); | |
177 void app_close_bearer(); | |
178 | |
179 char *string_to_lower(char *s) ; | |
180 | |
181 #endif /* FF_GPF_TCPIP */ | |
182 | |
183 #endif /* !APP_H */ |