1 /** 2 * \file gammu-wap.h 3 * \author Michal Čihař 4 * 5 * WAP data and functions. 6 */ 7 #ifndef __gammu_wap_h 8 #define __gammu_wap_h 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 /** 15 * \defgroup WAP WAP 16 * WAP bookmars and settings manipulations. 17 */ 18 19 #include <gammu-types.h> 20 #include <gammu-error.h> 21 #include <gammu-statemachine.h> 22 23 #include <stdlib.h> /* Needed for size_t declaration */ 24 25 /** 26 * WAP bookmark data. 27 * 28 * \ingroup WAP 29 */ 30 typedef struct { 31 /** 32 * Location where it is stored. 33 */ 34 int Location; 35 /** 36 * Bookmark URL. 37 */ 38 unsigned char Address[(255 + 1) * 2]; 39 /** 40 * Bookmark title. 41 */ 42 unsigned char Title[(50 + 1) * 2]; 43 } GSM_WAPBookmark; 44 45 /* --------------------------- WAP or MMS settings ------------------------- */ 46 47 /** 48 * Connection speed configuration. 49 * 50 * \ingroup WAP 51 */ 52 typedef enum { 53 WAPSETTINGS_SPEED_9600, 54 WAPSETTINGS_SPEED_14400, 55 WAPSETTINGS_SPEED_AUTO 56 } WAPSettings_Speed; 57 58 /** 59 * Connection bearer configuration. 60 * 61 * \ingroup WAP 62 */ 63 typedef enum { 64 WAPSETTINGS_BEARER_SMS = 1, 65 WAPSETTINGS_BEARER_DATA, 66 WAPSETTINGS_BEARER_USSD, 67 WAPSETTINGS_BEARER_GPRS 68 } WAPSettings_Bearer; 69 70 /** 71 * WAP setting. 72 * 73 * \ingroup WAP 74 */ 75 typedef struct { 76 /** 77 * Settings name. 78 */ 79 char Title[(20 + 1) * 2]; 80 /** 81 * Home page. 82 */ 83 char HomePage[(100 + 1) * 2]; 84 /** 85 * Bearer of WAP connection. 86 */ 87 WAPSettings_Bearer Bearer; 88 /** 89 * Secure connection? 90 */ 91 gboolean IsSecurity; 92 /** 93 * Is this connectin continuous? 94 */ 95 gboolean IsContinuous; 96 97 /** 98 * Whether is ISDN for data bearer 99 */ 100 gboolean IsISDNCall; 101 /** 102 * Whether is normal auth for data bearer 103 */ 104 gboolean IsNormalAuthentication; 105 106 /** 107 * Server for sms bearer. 108 */ 109 char Server[(21 + 1) * 2]; 110 111 /** 112 * Service for sms or ussd bearer. 113 */ 114 char Service[(20 + 1) * 2]; 115 /** 116 * Whether is IP, for sms or ussd bearer. 117 */ 118 gboolean IsIP; 119 120 /** 121 * Code for ussd bearer. 122 */ 123 char Code[(10 + 1) * 2]; 124 125 /** 126 * IP address for data or gprs. 127 */ 128 char IPAddress[(20 + 1) * 2]; 129 /** 130 * Login for data or gprs. 131 */ 132 gboolean ManualLogin; 133 /** 134 * Dial up number for data or gprs. 135 */ 136 char DialUp[(20 + 1) * 2]; 137 /** 138 * User name for data or gprs. 139 * 140 * \todo Is length okay? 141 */ 142 char User[(50 + 1) * 2]; 143 /** 144 * User password for data or gprs. 145 * 146 * \todo Is length okay? 147 */ 148 char Password[(50 + 1) * 2]; 149 /** 150 * Speed settings for data or gprs. 151 */ 152 WAPSettings_Speed Speed; 153 } GSM_WAPSettings; 154 155 /** 156 * Set of WAP settings. 157 * 158 * \ingroup WAP 159 */ 160 typedef struct { 161 /** 162 * Location. 163 */ 164 int Location; 165 /** 166 * Number of elements in Settings. 167 */ 168 unsigned char Number; 169 /** 170 * Real WAP settings. 171 */ 172 GSM_WAPSettings Settings[4]; 173 /** 174 * Whether this configuration is active. 175 */ 176 gboolean Active; 177 /** 178 * Whether this configuration is read only. 179 */ 180 gboolean ReadOnly; 181 /** 182 * Proxy server. 183 */ 184 char Proxy[(100 + 1) * 2]; 185 /** 186 * Proxy port. 187 */ 188 int ProxyPort; 189 /** 190 * Second proxy server. 191 */ 192 char Proxy2[(100 + 1) * 2]; 193 /** 194 * Second proxy port. 195 */ 196 int Proxy2Port; 197 /** 198 * Bearer of current connection. 199 */ 200 WAPSettings_Bearer ActiveBearer; 201 } GSM_MultiWAPSettings; 202 203 /** 204 * Encodes URL to VBKM file. 205 * 206 * \param Buffer Storage for text. 207 * \param Length Pointer to storage, will be updated. 208 * \param bookmark Bookmark to encode. 209 * 210 * \return Error code. 211 * 212 * \ingroup WAP 213 */ 214 GSM_Error GSM_EncodeURLFile(unsigned char *Buffer, size_t * Length, 215 GSM_WAPBookmark * bookmark); 216 217 /** 218 * Reads WAP bookmark. 219 * 220 * \param s State machine pointer. 221 * \param bookmark Bookmark storage, need to contain location. 222 * 223 * \return Error code 224 * 225 * \ingroup WAP 226 */ 227 GSM_Error GSM_GetWAPBookmark(GSM_StateMachine * s, GSM_WAPBookmark * bookmark); 228 229 /** 230 * Sets WAP bookmark. 231 * 232 * \param s State machine pointer. 233 * \param bookmark Bookmark data. 234 * 235 * \return Error code 236 * 237 * \ingroup WAP 238 */ 239 GSM_Error GSM_SetWAPBookmark(GSM_StateMachine * s, GSM_WAPBookmark * bookmark); 240 241 /** 242 * Deletes WAP bookmark. 243 * 244 * \param s State machine pointer. 245 * \param bookmark Bookmark data, need to contain location. 246 * 247 * \return Error code 248 * 249 * \ingroup WAP 250 */ 251 GSM_Error GSM_DeleteWAPBookmark(GSM_StateMachine * s, 252 GSM_WAPBookmark * bookmark); 253 254 /** 255 * Acquires WAP settings. 256 * 257 * \param s State machine pointer. 258 * \param settings Settings storage. 259 * 260 * \return Error code 261 * 262 * \ingroup WAP 263 */ 264 GSM_Error GSM_GetWAPSettings(GSM_StateMachine * s, 265 GSM_MultiWAPSettings * settings); 266 267 /** 268 * Changes WAP settings. 269 * 270 * \param s State machine pointer. 271 * \param settings Settings data. 272 * 273 * \return Error code 274 * 275 * \ingroup WAP 276 */ 277 GSM_Error GSM_SetWAPSettings(GSM_StateMachine * s, 278 GSM_MultiWAPSettings * settings); 279 #ifdef __cplusplus 280 } 281 #endif 282 #endif 283 284 /* Editor configuration 285 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: 286 */ 287