blob: fc4739a59254c83fc5b8dc4bc68c8b8853000513 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#include <stdlib.h>
#include <string.h>
#include <esp_log.h>
#include "eos.h"
#include "net.h"
#include "cell.h"
void eos_cell_pdp_handler(unsigned char mtype, unsigned char *buffer, uint16_t buf_len) {
switch (mtype) {
case EOS_CELL_MTYPE_PDP_SET_APN:
case EOS_CELL_MTYPE_PDP_SET_USR:
case EOS_CELL_MTYPE_PDP_SET_PWD: {
char *arg;
size_t arg_len;
buffer++;
buf_len--;
arg = (char *)buffer;
arg_len = strnlen(arg, buf_len);
if (arg_len == buf_len) break;
if (arg_len >= EOS_CELL_PDP_SIZE_ARG) break;
switch (mtype) {
case EOS_CELL_MTYPE_PDP_SET_APN: {
eos_ppp_set_apn(arg);
break;
}
case EOS_CELL_MTYPE_PDP_SET_USR: {
eos_ppp_set_usr(arg);
break;
}
case EOS_CELL_MTYPE_PDP_SET_PWD: {
eos_ppp_set_pwd(arg);
break;
}
}
break;
}
case EOS_CELL_MTYPE_PDP_GET_APN:
case EOS_CELL_MTYPE_PDP_GET_USR:
case EOS_CELL_MTYPE_PDP_GET_PWD: {
char *arg;
buffer[0] = EOS_CELL_MTYPE_PDP | mtype;
arg = (char *)(buffer + 1);
switch (mtype) {
case EOS_CELL_MTYPE_PDP_GET_APN: {
eos_ppp_get_apn(arg);
break;
}
case EOS_CELL_MTYPE_PDP_GET_USR: {
eos_ppp_get_usr(arg);
break;
}
case EOS_CELL_MTYPE_PDP_GET_PWD: {
eos_ppp_get_pwd(arg);
break;
}
}
eos_net_reply(EOS_NET_MTYPE_CELL, buffer, 1 + strlen(arg));
break;
}
case EOS_CELL_MTYPE_PDP_CONNECT: {
eos_ppp_connect();
break;
}
case EOS_CELL_MTYPE_PDP_DISCONNECT: {
eos_ppp_disconnect();
break;
}
}
}
|