SWILIB API (NSG)    
Loading...
Searching...
No Matches
gprs.h
Go to the documentation of this file.
1#pragma once
2
13#ifndef __IN_SWILIB__
14#include "base.h"
15#endif
16
18
20typedef struct CTX_NAPDEF CTX_NAPDEF;
22typedef struct LMAN_DATA LMAN_DATA;
28typedef struct ENIP_MODULE ENIP_MODULE;
29typedef struct ENIP_PORT ENIP_PORT;
30typedef struct ENIP_PKT ENIP_PKT;
31typedef struct ENIP_TIMER ENIP_TIMER;
36
40typedef struct ENIP_SOCKET ENIP_SOCKET;
41
52
67
71#pragma pack(2)
73 uint16_t _0x0080;
74 uint16_t _0xFFFF;
75 uint16_t _0x0000;
76};
77#pragma pack()
78
83 uint16_t cepid;
85 uint32_t unk_08;
86 int unk_0C;
87 int keep;
88};
89
94 uint8_t state;
95 uint8_t bearer;
96 uint8_t type;
97 uint8_t unk_03;
98 uint16_t iface;
99 uint16_t unk_06;
100#ifdef NEWSGOLD
101 char name[25];
102 uint8_t unk_21[3];
103 uint32_t unk_24;
104 char unk_28[25];
105 char unk_41[25];
106 uint8_t unk_5A[2];
107 uint32_t unk_5C;
108 uint32_t unk_60;
109 int unk_64;
110 int unk_68;
111 uint8_t unk_6C;
112 uint8_t unk_6D[3];
113#endif
114};
115
120 uint16_t app_flags;
121 uint16_t selector;
122 uint8_t bearer;
123 uint8_t unk_05;
124 uint16_t iface;
125};
126
131 uint16_t cepid;
132 uint16_t app_flags;
133 uint16_t selector;
134 uint8_t bearer;
135 uint8_t unk_07;
136 uint16_t iface;
137};
138
143 void *next;
144 void *prev;
145};
146
151 void *first;
152 void *last;
153};
154
159 uint8_t state;
160 uint8_t unk_01[3];
161 int (*up)(ENIP_MODULE *module);
162 void (*down)(ENIP_MODULE *module, uint32_t reason);
163 void (*run)(ENIP_MODULE *module);
164 void (*notify)(ENIP_MODULE *module, int event);
166 void (*post_run)(ENIP_MODULE *module);
167 void (*packet_available)(ENIP_MODULE *module, uint8_t pool);
170 char name[10];
171 uint8_t unk_32[2];
174};
175
185
189struct ENIP_PKT {
191 uint8_t *data;
192 uint8_t *transport;
193 uint8_t *buffer;
194 uint32_t unk_14;
195 uint32_t size;
197#ifdef NEWSGOLD
198 uint8_t pool[4];
199 uint8_t ref_count;
200 uint8_t bearer;
201 uint16_t iface;
202#else
203 uint8_t pool;
204 uint8_t ref_count;
205 uint8_t bearer;
206 uint8_t unk_23;
207 uint16_t iface;
208 uint16_t unk_26;
209#endif
210 uint8_t unk_28[28];
211};
212
218 ENIP_MODULE *module;
219 uint32_t start;
220 uint32_t timeout;
222};
223
235
241 uint32_t local_ip;
242 uint32_t dns1;
243 uint32_t dns2;
244 uint8_t ip_version;
245 uint8_t unk_11[3];
246 uint32_t mtu;
247 uint8_t headroom;
248 uint8_t tailroom;
249 uint8_t unk_1A[2];
250 ENIP_MODULE *module;
252 uint8_t bearer;
253 uint8_t unk_25;
254 uint16_t iface;
255#ifdef NEWSGOLD
256 uint32_t unk_28;
257#endif
258};
259
271
277 char body[0x204];
278};
279
290
295struct LMAN_DATA {
296#ifdef NEWSGOLD
297 int zero;
299 char _1;
300 char _4;
301 uint16_t _0;
303#else
304 char unk1;
305 char *unk;
306 char one;
307 char isactivated;
308#endif
309};
310
320__swi_begin(0x0A7)
322__swi_end(0x0A7, IsGPRSEnabled, ());
323
328__swi_begin(0x284)
330__swi_end(0x284, IsGPRSAvailable, ());
331
337__swi_begin(0x285)
339__swi_end(0x285, IsEDGEAvailable, ());
340
345__swi_begin(0x0A8)
347__swi_end(0x0A8, IsGPRSConnected, ());
348
354__swi_begin(0x18E)
355void GPRS_OnOff(int enable, int unk)
356__swi_end(0x18E, GPRS_OnOff, (enable, unk));
357
364__swi_begin(0x1A3)
367
375__swi_begin(0x23C)
376int SetCurrentGPRSProfile(int profile_id)
377__swi_end(0x23C, SetCurrentGPRSProfile, (profile_id));
378
394__swi_begin(0x1A2)
395int ActivateDialUpProfile(uint32_t cepid, int profile_id)
396__swi_end(0x1A2, ActivateDialUpProfile, (cepid, profile_id));
397
406__swi_begin(0x1A5)
407void RegisterCepIdForCurProfile(uint32_t cepid, int profile_id, uint32_t is_gprs)
408__swi_end(0x1A5, RegisterCepIdForCurProfile, (cepid, profile_id, is_gprs));
409
416__swi_begin(0x1A4)
418__swi_end(0x1A4, GetDisconnectTime, ());
419
433__swi_begin(0x186)
436
443__swi_begin(0x187)
445__swi_end(0x187, RequestLMANConnect, (data));
446
452__swi_begin(0x43B)
454__swi_end(0x43B, RequestLMANDisconnect, (req));
455
461__swi_begin(0x43C)
462unsigned GetSocketRegIndex(unsigned cepid)
463__swi_end(0x43C, GetSocketRegIndex, (cepid));
464
470__swi_begin(0x43D)
471unsigned GetServiceCepid(unsigned service)
472__swi_end(0x43D, GetServiceCepid, (service));
473
480__swi_begin(0x43E)
481unsigned LMAN_AllocContext(unsigned bearer, uint8_t type)
482__swi_end(0x43E, LMAN_AllocContext, (bearer, type));
483
484#ifdef NEWSGOLD
491__swi_begin(0x43F)
492void LMAN_SetProfile(unsigned cid, const CTX_NAPDEF *profile)
493__swi_end(0x43F, LMAN_SetProfile, (cid, profile));
494#endif
495
502__swi_begin(0x440)
503void LMAN_SetRef(unsigned reg_index, unsigned cid, int on)
504__swi_end(0x440, LMAN_SetRef, (reg_index, cid, on));
505
511__swi_begin(0x441)
512void LMAN_SetState(unsigned cid, int state)
513__swi_end(0x441, LMAN_SetState, (cid, state));
514
519__swi_begin(0x442)
520void LMAN_FreeContext(unsigned cid)
521__swi_end(0x442, LMAN_FreeContext, (cid));
522
527__swi_begin(0x8444)
529__swi_end(0x8444, RamLmanContexts, ());
530
535__swi_begin(0x8445)
536uint32_t *RamLmanRefs(void)
537__swi_end(0x8445, RamLmanRefs, ());
538
543__swi_begin(0x8446)
545__swi_end(0x8446, RamSocketRegs, ());
546
552__swi_begin(0x44D)
553void *WSP_GetObject(unsigned id)
554__swi_end(0x44D, WSP_GetObject, (id));
555
563__swi_begin(0x44E)
564int WSP_ReadProperty(const char *key, void *value, unsigned *length)
565__swi_end(0x44E, WSP_ReadProperty, (key, value, length));
566
567#ifdef NEWSGOLD
575__swi_begin(0x44F)
576uint8_t WSP_GetConnectionState(int bearer, int nap)
577__swi_end(0x44F, WSP_GetConnectionState, (bearer, nap));
578#endif
579
591__swi_begin(0x464)
592void ENIP_ModuleInit(ENIP_MODULE *module, const char *name, int (*up)(ENIP_MODULE *module),
593 void (*down)(ENIP_MODULE *module, uint32_t reason), void (*run)(ENIP_MODULE *module),
594 void (*notify)(ENIP_MODULE *module, int event), void (*post_run)(ENIP_MODULE *module),
595 void (*packet_available)(ENIP_MODULE *module, uint8_t pool))
596__swi_end(0x464, ENIP_ModuleInit, (module, name, up, down, run, notify, post_run, packet_available));
597
604__swi_begin(0x465)
605uint8_t ENIP_ModuleRun(ENIP_MODULE *module, uint32_t *result)
606__swi_end(0x465, ENIP_ModuleRun, (module, result));
607
613__swi_begin(0x466)
615__swi_end(0x466, ENIP_ModuleUp, (module));
616
622__swi_begin(0x467)
623void ENIP_ModuleDown(ENIP_MODULE *module, uint32_t reason)
624__swi_end(0x467, ENIP_ModuleDown, (module, reason));
625
631__swi_begin(0x468)
633__swi_end(0x468, ENIP_PortInit, (port, module));
634
640__swi_begin(0x469)
641void ENIP_PortSend(ENIP_PORT *port, ENIP_PKT *packet)
642__swi_end(0x469, ENIP_PortSend, (port, packet));
643
653__swi_begin(0x46A)
654ENIP_PKT *ENIP_PacketAlloc(ENIP_MODULE *module, int size, uint32_t pool, int offset, int quota)
655__swi_end(0x46A, ENIP_PacketAlloc, (module, size, pool, offset, quota));
656
661__swi_begin(0x46B)
663__swi_end(0x46B, ENIP_PacketFree, (packet));
664
671__swi_begin(0x46C)
672int ENIP_RegisterDriver(ENIP_IP_DRIVER *driver, int flags)
673__swi_end(0x46C, ENIP_RegisterDriver, (driver, flags));
674
679__swi_begin(0x46D)
681__swi_end(0x46D, ENIP_UnregisterDriver, (module));
682
689__swi_begin(0x46E)
690ENIP_IPH_INTERFACE *ENIP_FindInterface(uint32_t bearer, uint16_t iface)
691__swi_end(0x46E, ENIP_FindInterface, (bearer, iface));
692
699__swi_begin(0x46F)
700void LMAN_AttachInterface(unsigned cid, unsigned iface, unsigned unk)
701__swi_end(0x46F, LMAN_AttachInterface, (cid, iface, unk));
702
708__swi_begin(0x470)
710__swi_end(0x470, zDLL_RemHead, (list));
711
716__swi_begin(0x8471)
718__swi_end(0x8471, RamPdpDrivers, ());
719
725__swi_begin(0x472)
727__swi_end(0x472, enip_module_post_run, (module));
728
733__swi_begin(0x473)
735__swi_end(0x473, enip_module_nsapi_post_init, (module));
736
742__swi_begin(0x474)
744__swi_end(0x474, enip_port_handle_pkt, (port, packet));
745
752__swi_begin(0x475)
753void *enip_memory_allocate(uint32_t unused, int size)
754__swi_end(0x475, enip_memory_allocate, (unused, size));
755
760__swi_begin(0x476)
761void enip_memory_release(void *block)
762__swi_end(0x476, enip_memory_release, (block));
763
768__swi_begin(0x477)
771
777__swi_begin(0x478)
778int enip_ip_init(void (*post_run)(ENIP_MODULE *module))
779__swi_end(0x478, enip_ip_init, (post_run));
780
786__swi_begin(0x479)
788__swi_end(0x479, enip_find_iface_by_driver, (driver));
789
796__swi_begin(0x47A)
797void enip_iph_calc_chk_and_port_send(ENIP_PORT **port, ENIP_PKT *packet, uint32_t size)
798__swi_end(0x47A, enip_iph_calc_chk_and_port_send, (port, packet, size));
799
807__swi_begin(0x47B)
808uint16_t enip_iph_compute_checksum(uint16_t seed, const void *data, uint16_t size)
809__swi_end(0x47B, enip_iph_compute_checksum, (seed, data, size));
810
816__swi_begin(0x47C)
819
825__swi_begin(0x47D)
827__swi_end(0x47D, enip_iph_frame_read, (packet));
828
840__swi_begin(0x47E)
841int enip_iph_manage_reassembly(ENIP_IPH_INTERFACE *iface, ENIP_PKT *packet, uint8_t *header, uint32_t total_size,
842 uint32_t header_size, uint32_t fragment, int source)
843__swi_end(0x47E, enip_iph_manage_reassembly, (iface, packet, header, total_size, header_size, fragment, source));
844
848__swi_begin(0x47F)
851
856__swi_begin(0x480)
857void enip_iph_rheader_init(void *slot)
858__swi_end(0x480, enip_iph_rheader_init, (slot));
859
864__swi_begin(0x481)
866__swi_end(0x481, enip_iph_run, (module));
867
875__swi_begin(0x482)
876int enip_iph_write(ENIP_PORT **port, ENIP_PKT *packet, uint32_t size)
877__swi_end(0x482, enip_iph_write, (port, packet, size));
878
886__swi_begin(0x483)
888__swi_end(0x483, enip_siph_crypt_frame_read, (iface, packet));
889
895__swi_begin(0x484)
897__swi_end(0x484, enip_siph_find_IF, (address));
898
906__swi_begin(0x485)
908__swi_end(0x485, enip_icmp_frame_read, (iface, packet));
909
915__swi_begin(0x486)
917__swi_end(0x486, enip_udph_frame_read, (iface, packet));
918
925__swi_begin(0x487)
927__swi_end(0x487, enip_init_csd_iface, (module, driver));
928
934__swi_begin(0x488)
936__swi_end(0x488, enip_nsapi_init_iface, (module));
937
943__swi_begin(0x489)
945__swi_end(0x489, enip_nsapi_init_module, (module));
946
952__swi_begin(0x48A)
953void ENIP_PDP_NET_UP_CNF(uint16_t context, int result)
954__swi_end(0x48A, ENIP_PDP_NET_UP_CNF, (context, result));
955
961__swi_begin(0x48B)
962void ENIP_PDP_NET_UP_REJ_IND(uint16_t context, int result)
963__swi_end(0x48B, ENIP_PDP_NET_UP_REJ_IND, (context, result));
964
970__swi_begin(0x48C)
971void ENIP_PDP_NET_DOWN_IND(uint16_t context, int mode)
972__swi_end(0x48C, ENIP_PDP_NET_DOWN_IND, (context, mode));
973
979__swi_begin(0x48D)
980void ENIP_PDP_START_REQ(int context, int mode)
981__swi_end(0x48D, ENIP_PDP_START_REQ, (context, mode));
982
988__swi_begin(0x48E)
989void ENIP_PDP_STOP_REQ(uint16_t context, int mode)
990__swi_end(0x48E, ENIP_PDP_STOP_REQ, (context, mode));
991
996__swi_begin(0x48F)
998__swi_end(0x48F, ENIP_PDP_START_CSD_INT_REQ, (bearer));
999
1010__swi_begin(0x490)
1011int enip_sock_create(int family, int type, int protocol, int *socket_id, uint32_t param,
1012 const ENIP_SOCKET_DESTINATION *destination)
1013__swi_end(0x490, enip_sock_create, (family, type, protocol, socket_id, param, destination));
1014
1024__swi_begin(0x491)
1025int enip_socket_connect(int socket, int address, int unknown, uint16_t port, uint32_t timeout)
1026__swi_end(0x491, enip_socket_connect, (socket, address, unknown, port, timeout));
1027
1032__swi_begin(0x492)
1034__swi_end(0x492, enip_sockh_IF_init, (iface));
1035
1046__swi_begin(0x493)
1047ENIP_SOCKET *enip_sockh_create_internal(int family, int type, int protocol, int *socket_id, uint32_t param1,
1048 uint32_t param2)
1049__swi_end(0x493, enip_sockh_create_internal, (family, type, protocol, socket_id, param1, param2));
1050
1057__swi_begin(0x494)
1059__swi_end(0x494, enip_sockh_autobind_IF, (socket, address));
1060
1070__swi_begin(0x495)
1071int enip_sockh_packet_allocate(ENIP_SOCKET *socket, uint32_t size, uint32_t pool, ENIP_PKT **packet, int timeout)
1072__swi_end(0x495, enip_sockh_packet_allocate, (socket, size, pool, packet, timeout));
1073
1082__swi_begin(0x496)
1083int enip_sockh_dgram_connect(ENIP_SOCKET *socket, int address, uint32_t unused, uint16_t port)
1084__swi_end(0x496, enip_sockh_dgram_connect, (socket, address, unused, port));
1085
1086#ifdef NEWSGOLD
1094__swi_begin(0x497)
1096__swi_end(0x497, enip_sockh_from_ipheader, (iface, header));
1097#endif
1098
1106__swi_begin(0x498)
1107int enip_sockh_prepare_send(int index, ENIP_SOCKET *socket, uint32_t address)
1108__swi_end(0x498, enip_sockh_prepare_send, (index, socket, address));
1109
1110#ifdef NEWSGOLD
1117__swi_begin(0x499)
1120#endif
1121
1127__swi_begin(0x49A)
1130
1140__swi_begin(0x49B)
1141int enip_tcph_sock_connect(ENIP_SOCKET *socket, int address, uint32_t unknown, uint16_t port, uint32_t timeout)
1142__swi_end(0x49B, enip_tcph_sock_connect, (socket, address, unknown, port, timeout));
1143
1154__swi_begin(0x49C)
1155int enip_tcph_send_segment(ENIP_SOCKET *socket, uint32_t flags, const void *data, uint32_t size, ENIP_PKT *packet,
1156 int unknown)
1157__swi_end(0x49C, enip_tcph_send_segment, (socket, flags, data, size, packet, unknown));
1158
1165__swi_begin(0x49D)
1166void enip_tcph_write_segment(ENIP_SOCKET *socket, ENIP_PKT *packet, int use_sequence)
1167__swi_end(0x49D, enip_tcph_write_segment, (socket, packet, use_sequence));
1168
1174__swi_begin(0x49E)
1177
1183__swi_begin(0x49F)
1185__swi_end(0x49F, enip_tcph_frame_read, (iface, packet));
1186
1190__swi_begin(0x4A0)
1192__swi_end(0x4A0, enip_tcph_run, ());
1193
1201__swi_begin(0x4A1)
1202uint32_t enip_tcph_get_SACK_option_from_list(ENIP_SOCKET *socket, uint32_t count, uint8_t *option)
1203__swi_end(0x4A1, enip_tcph_get_SACK_option_from_list, (socket, count, option));
1204
1209__swi_begin(0x4A2)
1212
1218__swi_begin(0x4A3)
1220__swi_end(0x4A3, enip_timer_init, (timer, module));
1221
1226__swi_begin(0x4A4)
1228__swi_end(0x4A4, enip_timer_cancel, (timer));
1229
1235__swi_begin(0x4A5)
1236void enip_timer_start(ENIP_TIMER *timer, uint32_t timeout)
1237__swi_end(0x4A5, enip_timer_start, (timer, timeout));
1238
1242__swi_begin(0x4A6)
1244__swi_end(0x4A6, LMAN_LINK_UP_CNF, ());
1245
1250__swi_begin(0x4A8)
1251void LMAN_FreeSocketReg(unsigned index)
1252__swi_end(0x4A8, LMAN_FreeSocketReg, (index));
1253
1260__swi_begin(0x4AA)
1261uint16_t LMAN_FindContext(uint16_t bearer, uint16_t iface)
1262__swi_end(0x4AA, LMAN_FindContext, (bearer, iface));
1263
1269__swi_begin(0x4AB)
1270uint8_t LMAN_GetBearerIdForCi(uint16_t cid)
1271__swi_end(0x4AB, LMAN_GetBearerIdForCi, (cid));
1272
1279__swi_begin(0x4AC)
1281__swi_end(0x4AC, LMAN_GetSocketDestination, (cepid, destination));
1282
1287__swi_begin(0x4AD)
1289__swi_end(0x4AD, zDLL_Init, (list));
1290
1303__swi_begin(0x828E)
1306
1317__swi_begin(0x06F)
1319__swi_end(0x06F, RefreshGPRSTraffic, ());
1320
1324__swi_begin(0x0A6)
1326__swi_end(0x0A6, ResetGPRSTraffic, ());
1327
1336__swi_begin(0x070)
1339
1345__swi_begin(0x4DF)
1346unsigned LMAN_GetOrAllocSocketRegIndex(unsigned cepid)
1348
1358__swi_begin(0x4E0)
1359int LMAN_SetSocketReg(unsigned index, const REGSOCKCEPID_DATA *reg, int keep)
1360__swi_end(0x4E0, LMAN_SetSocketReg, (index, reg, keep));
1361
1365
#define __swilib_begin
Definition doxygen.h:29
#define __swi_end(number, func, call)
Definition doxygen.h:33
#define __swi_begin(number)
Definition doxygen.h:32
#define __swilib_end
Definition doxygen.h:30
uint16_t unk1
Definition gprs.h:265
uint16_t _0xFFFF
Set to 0xFFFF.
Definition gprs.h:74
NAP_PARAM_CONT * NapParameterContainer
Pointer to the NAP: NAP_PARAM_CONT.
Definition gprs.h:302
ENIP_ZDLL_HEAD packets
Queued packets.
Definition gprs.h:183
int need_post_run
Definition gprs.h:165
void(* run)(ENIP_MODULE *module)
Definition gprs.h:163
ENIP_ZDLL_ITEM item
In the port list of the module.
Definition gprs.h:180
uint8_t unk3[10]
Definition gprs.h:269
uint16_t selector
See REGSOCKCEPID_DATA.
Definition gprs.h:121
ENIP_MODULE *void(* callback)(ENIP_PORT *port, ENIP_PKT *packet)
< Owning module
Definition gprs.h:182
uint8_t unk_11[3]
Definition gprs.h:245
uint8_t unk_25
Definition gprs.h:253
int keep
See LMAN_SetSocketReg.
Definition gprs.h:87
ENIP_ZDLL_HEAD sockets
Definition gprs.h:267
void * last
Definition gprs.h:152
void(* packet_available)(ENIP_MODULE *module, uint8_t pool)
Definition gprs.h:167
uint32_t unk_08
Definition gprs.h:85
ENIP_ZDLL_ITEM item
In the timer list of the module.
Definition gprs.h:217
uint8_t state
Bits 7..6: 2 = up, 0 = down.
Definition gprs.h:159
uint8_t bearer
See LMAN_AllocContext, 0xFF = free.
Definition gprs.h:95
uint32_t unk_28
Set by ENIP_RegisterDriver.
Definition gprs.h:256
uint32_t unk_5C
Definition gprs.h:107
uint8_t unk_6C
Definition gprs.h:111
uint8_t * buffer
Start of the buffer.
Definition gprs.h:193
uint8_t ip_version
4
Definition gprs.h:244
ENIP_IP_DRIVER driver
Copy of the registered driver.
Definition gprs.h:264
int(* up)(ENIP_MODULE *module)
Definition gprs.h:161
uint32_t unk_60
Definition gprs.h:108
uint16_t app_flags
See LMAN_SOCKET_DESTINATION.
Definition gprs.h:132
uint16_t cepid
Process, 0xFFFF = free.
Definition gprs.h:83
uint32_t mtu
Definition gprs.h:246
uint16_t _0
Set to 0.
Definition gprs.h:301
ENIP_PORT * ip_port
Input port of the IP layer.
Definition gprs.h:230
char body[0x204]
Binary data of the NAP profile.
Definition gprs.h:277
ENIP_ZDLL_ITEM item
Definition gprs.h:190
void * next
Definition gprs.h:143
uint32_t dns1
Definition gprs.h:242
uint16_t _0x0000
Set to 0x0000.
Definition gprs.h:75
uint8_t unk_01[3]
Definition gprs.h:160
uint32_t allocation_size
Buffer size.
Definition gprs.h:196
uint8_t headroom
Bytes reserved before the IP header.
Definition gprs.h:247
void * native_profile
Set to NULL.
Definition gprs.h:298
uint16_t iface
Interface index.
Definition gprs.h:254
uint8_t * data
Current data.
Definition gprs.h:191
uint16_t unk2
Definition gprs.h:266
uint8_t tailroom
Bytes reserved after the data.
Definition gprs.h:248
uint16_t _0x0080
Set to 0x0080.
Definition gprs.h:73
char name[25]
Profile name, see LMAN_SetProfile.
Definition gprs.h:101
uint16_t unk_06
See LMAN_AttachInterface.
Definition gprs.h:99
ENIP_MODULE ENIP_PORT port
Definition gprs.h:229
uint8_t unk_6D[3]
Definition gprs.h:112
uint32_t len
Definition gprs.h:285
uint32_t timeout
Definition gprs.h:220
uint8_t unk_1A[2]
Definition gprs.h:249
uint32_t zero
Definition gprs.h:287
uint16_t iface
See LMAN_AttachInterface.
Definition gprs.h:98
uint32_t unk_24
Definition gprs.h:103
uint8_t pool[4]
Pools of the owners, [0] = allocating pool.
Definition gprs.h:198
uint16_t iface
Receiving interface index.
Definition gprs.h:201
uint8_t bearer
See LMAN_SOCKET_DESTINATION.
Definition gprs.h:134
uint16_t selector
See LMAN_SOCKET_DESTINATION.
Definition gprs.h:133
uint16_t app_flags
See REGSOCKCEPID_DATA.
Definition gprs.h:120
uint8_t * transport
Transport header, set by the IP layer.
Definition gprs.h:192
ENIP_ZDLL_HEAD timers
See ENIP_TIMER.
Definition gprs.h:172
uint8_t bearer
Bearer ID, 0xFF = no context.
Definition gprs.h:122
uint8_t unk_5A[2]
Definition gprs.h:106
uint32_t unk_14
Definition gprs.h:194
uint8_t state
See LMAN_SetState.
Definition gprs.h:94
int run_posted
Definition gprs.h:168
ENIP_MODULE *ENIP_PORT * port_rx
< Module of the driver
Definition gprs.h:251
char unk_28[25]
Definition gprs.h:104
char _4
Set to 4.
Definition gprs.h:300
CTX_NAPDEF napdef
Definition gprs.h:288
void * first
Definition gprs.h:151
uint8_t unk_32[2]
Definition gprs.h:171
REGSOCKCEPID_DATA data
See LMAN_SetSocketReg.
Definition gprs.h:84
int unk_68
unk_60 is set
Definition gprs.h:110
uint16_t iface
See LMAN_SOCKET_DESTINATION.
Definition gprs.h:136
uint16_t cepid
Owner process.
Definition gprs.h:131
char name[10]
Definition gprs.h:170
uint16_t iface
Interface index.
Definition gprs.h:124
void(* post_run)(ENIP_MODULE *module)
Definition gprs.h:166
uint8_t bearer
Receiving bearer ID.
Definition gprs.h:200
ENIP_ZDLL_HEAD ports
See ENIP_PORT.
Definition gprs.h:173
uint32_t unk_68
Definition gprs.h:232
int active
Definition gprs.h:221
ENIP_MODULE *uint32_t start
Start tick.
Definition gprs.h:219
uint8_t type
See LMAN_AllocContext.
Definition gprs.h:96
uint32_t local_ip
IPv4 address.
Definition gprs.h:241
void(* down)(ENIP_MODULE *module, uint32_t reason)
Definition gprs.h:162
ENIP_ZDLL_HEAD unk_60
Definition gprs.h:231
CTX_NAPDEF * ctx_napdef
Definition gprs.h:286
char unk_41[25]
Definition gprs.h:105
uint8_t unk_21[3]
Definition gprs.h:102
uint8_t unk_03
Definition gprs.h:97
int running
Definition gprs.h:169
void * prev
Definition gprs.h:144
uint8_t ref_count
Definition gprs.h:199
char _1
Set to 1.
Definition gprs.h:299
uint32_t dns2
Definition gprs.h:243
uint32_t size
Data size.
Definition gprs.h:195
int unk_64
unk_5C is set
Definition gprs.h:109
uint16_t next_port
Next local port for automatic binding.
Definition gprs.h:268
uint8_t unk_28[28]
Definition gprs.h:210
void(* notify)(ENIP_MODULE *module, int event)
Definition gprs.h:164
uint32_t unk_6C
Definition gprs.h:233
int zero
Set to 0.
Definition gprs.h:297
ENIP_PORT * port_tx
Port of the driver for outgoing packets.
Definition gprs.h:240
uint8_t bearer
Bearer ID, 0xFF = none.
Definition gprs.h:252
void ResetGPRSTraffic(void)
Reset the GPRS traffic counter.
void ENIP_PDP_START_REQ(int context, int mode)
ENIP handler of the PDP start request: initialise and bring up the context's NSAPI module.
int WSP_ReadProperty(const char *key, void *value, unsigned *length)
Read a WSP property.
char IsGPRSEnabled(void)
Check if GPRS enabled.
uint32_t * RamLmanRefs(void)
Get the LMAN process-to-context reference table.
int enip_sockh_autobind_IF(ENIP_SOCKET *socket, int address)
Bind a socket to an IP interface: the one matching its LMAN destination, or the first usable one.
void RefreshGPRSTraffic()
Refresh the GPRS traffic counter.
int enip_nsapi_init_module(ENIP_NSAPI_MODULE *module)
Initialise an NSAPI (PDP context) module named "NSAPI".
ENIP_IPH_INTERFACE * ENIP_FindInterface(uint32_t bearer, uint16_t iface)
Find the IP interface of a bearer.
void ENIP_PDP_START_CSD_INT_REQ(int bearer)
ENIP handler of the CSD (PPP dial-up) start request: set up the "PPP CSD" module.
void ENIP_PacketFree(ENIP_PKT *packet)
Free an ENIP packet.
void LMAN_FreeContext(unsigned cid)
Reset and release a native LMAN context without disconnecting a physical bearer.
int enip_packet_max_size(void)
Get the largest ENIP packet size (a firmware constant).
void enip_tcph_frame_read(ENIP_IPH_INTERFACE *iface, ENIP_PKT *packet)
Process a received TCP segment.
int RequestLMANDisconnect(const uint8_t *req)
Request disconnection of a native LMAN context.
void enip_timer_init(ENIP_TIMER *timer, ENIP_MODULE *module)
Initialise an ENIP timer.
uint16_t enip_iph_compute_checksum(uint16_t seed, const void *data, uint16_t size)
Compute the Internet (one's complement) checksum of a buffer.
ENIP_SOCKET * enip_sockh_create_internal(int family, int type, int protocol, int *socket_id, uint32_t param1, uint32_t param2)
Allocate and initialise a socket in a free slot of the socket table.
void enip_tcph_update_SACK_block_list(ENIP_SOCKET *socket)
Remove the SACK blocks that are already acknowledged.
void enip_port_handle_pkt(ENIP_PORT *port, ENIP_PKT *packet)
Append a packet to an ENIP port's queue and schedule the port's module if the queue was empty.
LMAN_CONTEXT * RamLmanContexts(void)
Get the LMAN context table.
void * enip_memory_allocate(uint32_t unused, int size)
Allocate memory from the ENIP pool, falling back to the second ENIP pool.
ENIP_IP_DRIVER * RamPdpDrivers(void)
Get the GPRS PDP driver table (the DNS resolver takes servers for bearer 1 from it).
unsigned LMAN_AllocContext(unsigned bearer, uint8_t type)
Allocate a native LMAN context.
int enip_iph_manage_reassembly(ENIP_IPH_INTERFACE *iface, ENIP_PKT *packet, uint8_t *header, uint32_t total_size, uint32_t header_size, uint32_t fragment, int source)
Add an IPv4 fragment to its reassembly slot.
uint32_t enip_tcph_get_SACK_option_from_list(ENIP_SOCKET *socket, uint32_t count, uint8_t *option)
Write a TCP SACK option (NOP, NOP, SACK) from the socket's SACK blocks.
int enip_sockh_tcp_packet_allocate(ENIP_SOCKET *socket)
Check that a TCP segment of the socket's maximum size can be allocated (allocates it and frees it at ...
void enip_timer_start(ENIP_TIMER *timer, uint32_t timeout)
Start or restart an ENIP timer and schedule its module.
void enip_sockh_IF_init(ENIP_IPH_INTERFACE *iface)
Pick a pseudo-random first local port for an interface.
void enip_tcph_write_segment(ENIP_SOCKET *socket, ENIP_PKT *packet, int use_sequence)
Fill in the TCP header of an outgoing segment of the socket and send it.
int RequestLMANConnect(LMAN_DATA *data)
Connect to the GPRS.
int enip_sockh_prepare_send(int index, ENIP_SOCKET *socket, uint32_t address)
Fill the IPv4 header of an outgoing packet from the socket's settings.
ENIP_IPH_INTERFACE * enip_iph_find_IF_for_socket(ENIP_SOCKET *socket)
Find the IP interface whose bearer ID and interface index equal the socket's LMAN destination.
int enip_iph_write(ENIP_PORT **port, ENIP_PKT *packet, uint32_t size)
Send a packet from the IP layer: fill the header checksum and pass it to the port.
const char * RamActiveGPRSProfileName(void)
Get name of the current internet profile.
int enip_tcph_sock_init(ENIP_SOCKET *socket)
Initialise the TCP state of a socket: initial sequence number, windows and MSS.
void ENIP_PDP_NET_UP_CNF(uint16_t context, int result)
ENIP handler of the PDP NET_UP confirmation.
void LMAN_SetState(unsigned cid, int state)
Change a native LMAN context state and notify its registered owners.
LMAN_SOCKET_REG * RamSocketRegs(void)
Get the LMAN socket registration table.
void enip_iph_packet_avail(void)
Notify the IP layer that a packet buffer is free again.
int enip_socket_connect(int socket, int address, int unknown, uint16_t port, uint32_t timeout)
Connect a socket: set the peer of a datagram socket or start a TCP connection.
char IsGPRSConnected(void)
Check if the GPRS session is established.
int RegisterCepidForSocketWork(REGSOCKCEPID_DATA *reg)
Register current CEPID for sockets.
unsigned GetSocketRegIndex(unsigned cepid)
Find the socket-registration slot for a CEPID.
int enip_sockh_dgram_connect(ENIP_SOCKET *socket, int address, uint32_t unused, uint16_t port)
Set the peer of a datagram socket.
void enip_memory_release(void *block)
Release a block allocated with enip_memory_allocate.
void LMAN_SetProfile(unsigned cid, const CTX_NAPDEF *profile)
Copy a NAP profile into an allocated LMAN context.
int SetCurrentGPRSProfile(int profile_id)
Change current internet profile.
unsigned GetServiceCepid(unsigned service)
Get the process identifier assigned to a native service.
int enip_init_csd_iface(ENIP_MODULE *module, ENIP_IP_DRIVER *driver)
Fill an IP driver description for the CSD (PPP dial-up) interface.
void ENIP_PortInit(ENIP_PORT *port, ENIP_MODULE *module)
Initialize the packet port of an ENIP network module.
void enip_iph_calc_chk_and_port_send(ENIP_PORT **port, ENIP_PKT *packet, uint32_t size)
Fill the IPv4 header checksum of a packet, set its size and send it to a port.
void LMAN_SetRef(unsigned reg_index, unsigned cid, int on)
Attach or detach a registered process from an LMAN context.
void ENIP_ModuleInit(ENIP_MODULE *module, const char *name, int(*up)(ENIP_MODULE *module), void(*down)(ENIP_MODULE *module, uint32_t reason), void(*run)(ENIP_MODULE *module), void(*notify)(ENIP_MODULE *module, int event), void(*post_run)(ENIP_MODULE *module), void(*packet_available)(ENIP_MODULE *module, uint8_t pool))
Initialize an ENIP network module (the driver side of a network interface).
uint8_t WSP_GetConnectionState(int bearer, int nap)
Get the WSP connection state.
void ENIP_PDP_NET_DOWN_IND(uint16_t context, int mode)
ENIP handler of the PDP NET_DOWN indication: take the context's interface down.
int LMAN_GetSocketDestination(uint16_t cepid, LMAN_SOCKET_DESTINATION *destination)
Get where sockets of a process go: application flags, selector, bearer ID and interface index.
uint8_t ENIP_ModuleRun(ENIP_MODULE *module, uint32_t *result)
Run an ENIP network module once.
int LMAN_SetSocketReg(unsigned index, const REGSOCKCEPID_DATA *reg, int keep)
Set the data of an LMAN socket registration, as RegisterCepidForSocketWork does for the current proce...
void enip_iph_frame_read(ENIP_PKT *packet)
Process a received IP packet: check the IPv4 header, find the interface, reassemble fragments and pas...
int ActivateDialUpProfile(uint32_t cepid, int profile_id)
Activate internet profile.
void ENIP_PDP_STOP_REQ(uint16_t context, int mode)
ENIP handler of the PDP stop request.
void enip_tcph_run(void)
Check the TCP timers of all sockets: retransmit, time out or move on in the close states.
unsigned LMAN_GetOrAllocSocketRegIndex(unsigned cepid)
Find the LMAN socket registration (see RamSocketRegs) of a process or take a free one.
void enip_udph_frame_read(ENIP_IPH_INTERFACE *iface, ENIP_PKT *packet)
Process a received UDP packet: check it and queue it on the matching socket.
ENIP_IPH_INTERFACE * enip_find_iface_by_driver(ENIP_IP_DRIVER *driver)
Find the IP interface whose registered driver belongs to the same module as the given driver.
int enip_nsapi_init_iface(ENIP_NSAPI_MODULE *module)
Create and register the IP interface of a PDP context (NSAPI module).
LmanEventID
LinkManager GBS events.
Definition gprs.h:45
int GetCurrentGPRSProfile(void)
Get an ID of the active internet profile.
void LMAN_LINK_UP_CNF(void)
LMAN handler of the link-up confirmation: mark the waiting connection as up and notify the owner.
void enip_module_post_run(ENIP_MODULE *module)
Schedule a run of an ENIP module: mark it as needing a run and call its post-run procedure if one is ...
void * zDLL_RemHead(ENIP_ZDLL_HEAD *list)
Remove the first item of an ENIP list (packet queue).
int ENIP_RegisterDriver(ENIP_IP_DRIVER *driver, int flags)
Register an IP driver (network interface) in the ENIP IP layer.
ENIP_SOCKET * enip_sockh_from_ipheader(ENIP_IPH_INTERFACE *iface, const uint8_t *header)
Find the socket for a received packet by protocol, ports and address.
int GetDisconnectTime(void)
Get internet connection timeout for disconnect when there is no activity.
void LMAN_AttachInterface(unsigned cid, unsigned iface, unsigned unk)
Attach an IP interface to a native LMAN context.
uint8_t LMAN_GetBearerIdForCi(uint16_t cid)
Get the bearer ID of an LMAN context.
uint16_t LMAN_FindContext(uint16_t bearer, uint16_t iface)
Find the LMAN context with the given bearer ID and interface.
void enip_module_nsapi_post_init(ENIP_NSAPI_MODULE *module)
Reset the per-context fields of an NSAPI module after enip_nsapi_init_module.
int enip_ip_init(void(*post_run)(ENIP_MODULE *module))
Initialise the ENIP IP module, its interface slots (8 on NSG/ELKA, 16 on SG/X75) and the 2 reassembly...
int enip_siph_crypt_frame_read(ENIP_IPH_INTERFACE *iface, ENIP_PKT *packet)
Receive handler of the secure IP layer: answers a special 8-byte ICMP probe (type 0x49,...
int enip_tcph_sock_connect(ENIP_SOCKET *socket, int address, uint32_t unknown, uint16_t port, uint32_t timeout)
Start a TCP connection: send SYN and start the connect timer.
void zDLL_Init(ENIP_ZDLL_HEAD *list)
Initialise an empty ENIP double-linked list (two pointers: first, last).
void GPRS_OnOff(int enable, int unk)
Enable or disable GPRS internet.
int enip_sockh_packet_allocate(ENIP_SOCKET *socket, uint32_t size, uint32_t pool, ENIP_PKT **packet, int timeout)
Allocate an outgoing packet for a socket with room for the interface headers.
void ENIP_PDP_NET_UP_REJ_IND(uint16_t context, int result)
ENIP handler of the PDP NET_UP reject indication.
struct ENIP_SOCKET ENIP_SOCKET
ENIP socket.
Definition gprs.h:40
void RegisterCepIdForCurProfile(uint32_t cepid, int profile_id, uint32_t is_gprs)
Register CEPID for internet profile.
void ENIP_ModuleDown(ENIP_MODULE *module, uint32_t reason)
Bring an ENIP network module down.
void ENIP_PortSend(ENIP_PORT *port, ENIP_PKT *packet)
Queue a packet on an ENIP port.
void enip_icmp_frame_read(ENIP_IPH_INTERFACE *iface, ENIP_PKT *packet)
Process a received ICMP packet and release it.
void * WSP_GetObject(unsigned id)
Get a WSP object.
void enip_timer_cancel(ENIP_TIMER *timer)
Stop an ENIP timer if it is running.
void ENIP_UnregisterDriver(ENIP_MODULE *module)
Unregister the IP driver of an ENIP network module.
ENIP_IPH_INTERFACE * enip_siph_find_IF(int address)
Find the IP interface with the given local address.
void enip_iph_run(ENIP_MODULE *module)
Run procedure of the IP module: expire socket timers and handle queued packets.
int * GetGPRSTrafficPointer()
Get traffic used by GPRS.
void enip_tcph_change_sock_state(ENIP_SOCKET *socket, uint32_t state)
Change the TCP state of a socket and notify its owner.
ENIP_PKT * ENIP_PacketAlloc(ENIP_MODULE *module, int size, uint32_t pool, int offset, int quota)
Allocate an ENIP packet.
void enip_iph_rheader_init(void *slot)
Reset an IPv4 reassembly slot and its timer.
int enip_sock_create(int family, int type, int protocol, int *socket_id, uint32_t param, const ENIP_SOCKET_DESTINATION *destination)
Create an ENIP socket.
EnipEventID
ENIP GBS events.
Definition gprs.h:56
char IsGPRSAvailable(void)
Check if GPRS available in the current network.
void LMAN_FreeSocketReg(unsigned index)
Free an LMAN socket registration (see RamSocketRegs).
int enip_tcph_send_segment(ENIP_SOCKET *socket, uint32_t flags, const void *data, uint32_t size, ENIP_PKT *packet, int unknown)
Build and send one TCP segment.
int ENIP_ModuleUp(ENIP_MODULE *module)
Bring an ENIP network module up.
char IsEDGEAvailable(void)
Check if EDGE is available in the current network.
@ LMAN_CONNECT_REJ_IND
Definition gprs.h:47
@ LMAN_DISCONNECT_CNF
Definition gprs.h:49
@ LMAN_LINK_UP_IND
Definition gprs.h:50
@ LMAN_CONNECT_CNF
Definition gprs.h:46
@ LMAN_DISCONNECT_IND
Definition gprs.h:48
@ ENIP_SOCK_CONNECTED
Definition gprs.h:60
@ ENIP_SOCK_DATA_READ
Definition gprs.h:59
@ ENIP_SOCK_ICMP_ERROR
Definition gprs.h:64
@ ENIP_SOCK_REMOTE_CLOSED
Definition gprs.h:62
@ ENIP_BUFFER_FREE1
Definition gprs.h:58
@ ENIP_DNR_HOST_BY_NAME
Definition gprs.h:65
@ ENIP_SOCK_ACCEPTED
Definition gprs.h:63
@ ENIP_BUFFER_FREE
Definition gprs.h:57
@ ENIP_SOCK_CLOSED
Definition gprs.h:61
Network Access Point data.
Definition gprs.h:276
ENIP IP driver: the network side of an interface (see ENIP_RegisterDriver).
Definition gprs.h:239
ENIP IP interface: a registered driver (see ENIP_FindInterface).
Definition gprs.h:263
ENIP network module (see ENIP_ModuleInit).
Definition gprs.h:158
ENIP NSAPI module (see enip_nsapi_init_module).
Definition gprs.h:227
ENIP packet header (see ENIP_PacketAlloc).
Definition gprs.h:189
ENIP port: packet input of a module (see ENIP_PortInit).
Definition gprs.h:179
Socket destination passed to enip_sock_create.
Definition gprs.h:130
ENIP timer (see enip_timer_init).
Definition gprs.h:216
ENIP list (see zDLL_Init).
Definition gprs.h:150
ENIP list item, the first field of a listed object.
Definition gprs.h:142
LMAN context (see RamLmanContexts).
Definition gprs.h:93
LinkManager data.
Definition gprs.h:295
Where sockets of a process go (see LMAN_GetSocketDestination).
Definition gprs.h:119
LMAN socket registration of a process (see RamSocketRegs).
Definition gprs.h:82
Network Access Point data container.
Definition gprs.h:284
CEPID registration data for sockets.
Definition gprs.h:72
int socket(int domain, int type, int protocol)
#define const
Definition zconf.h:115