Prefer official Samsung IPC protocol names
[libsamsung-ipc.git] / include / gprs.h
1 /*
2  * This file is part of libsamsung-ipc.
3  *
4  * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
5  * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
6  *
7  * libsamsung-ipc is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * libsamsung-ipc is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with libsamsung-ipc.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include <samsung-ipc.h>
22
23 #ifndef __SAMSUNG_IPC_GPRS_H__
24 #define __SAMSUNG_IPC_GPRS_H__
25
26 /*
27  * Commands
28  */
29
30 #define IPC_GPRS_DEFINE_PDP_CONTEXT                             0x0D01
31 #define IPC_GPRS_QOS                                            0x0D02
32 #define IPC_GPRS_PS                                             0x0D03
33 #define IPC_GPRS_PDP_CONTEXT                                    0x0D04
34 #define IPC_GPRS_ENTER_DATA                                     0x0D05
35 #define IPC_GPRS_SHOW_PDP_ADDR                                  0x0D06
36 #define IPC_GPRS_MS_CLASS                                       0x0D07
37 #define IPC_GPRS_3G_QUAL_SRVC_PROFILE                           0x0D08
38 #define IPC_GPRS_IP_CONFIGURATION                               0x0D09
39 #define IPC_GPRS_DEFINE_SEC_PDP_CONTEXT                         0x0D0A
40 #define IPC_GPRS_TFT                                            0x0D0B
41 #define IPC_GPRS_HSDPA_STATUS                                   0x0D0C
42 #define IPC_GPRS_CURRENT_SESSION_DATA_COUNTER                   0x0D0D
43 #define IPC_GPRS_DATA_DORMANT                                   0x0D0E
44 #define IPC_GPRS_PIN_CTRL                                       0x0D0F
45 #define IPC_GPRS_CALL_STATUS                                    0x0D10
46 #define IPC_GPRS_PORT_LIST                                      0x0D11
47
48 /*
49  * Values
50  */
51
52 #define IPC_GPRS_STATUS_NOT_ENABLED                             0x00
53 #define IPC_GPRS_STATUS_ENABLED                                 0x01
54 #define IPC_GPRS_STATUS_DISABLED                                0x03
55
56 #define IPC_GPRS_FAIL_CAUSE_INSUFFICIENT_RESOURCES              0x0004
57 #define IPC_GPRS_FAIL_CAUSE_MISSING_UKNOWN_APN                  0x0005
58 #define IPC_GPRS_FAIL_CAUSE_UNKNOWN_PDP_ADDRESS_TYPE            0x0006
59 #define IPC_GPRS_FAIL_CAUSE_USER_AUTHENTICATION                 0x0007
60 #define IPC_GPRS_FAIL_CAUSE_ACTIVATION_REJECT_GGSN              0x0008
61 #define IPC_GPRS_FAIL_CAUSE_ACTIVATION_REJECT_UNSPECIFIED       0x0009
62 #define IPC_GPRS_FAIL_CAUSE_SERVICE_OPTION_NOT_SUPPORTED        0x000A
63 #define IPC_GPRS_FAIL_CAUSE_SERVICE_OPTION_NOT_SUBSCRIBED       0x000B
64 #define IPC_GPRS_FAIL_CAUSE_SERVICE_OPTION_OUT_OF_ORDER         0x000C
65 #define IPC_GPRS_FAIL_CAUSE_NSAPI_IN_USE                        0x000D
66
67 /*
68  * Structures
69  */
70
71 struct ipc_gprs_define_pdp_context_data {
72     unsigned char enable;
73     unsigned char cid;
74     unsigned char magic;
75     unsigned char apn[124];
76 } __attribute__((__packed__));
77
78 struct ipc_gprs_pdp_context_request_set_data {
79     unsigned char enable;
80     unsigned char cid;
81     unsigned char magic[4];
82     unsigned char username[32];
83     unsigned char password[32];
84     unsigned char unknown1[32];
85     unsigned char unknown2;
86 } __attribute__((__packed__));
87
88 struct ipc_gprs_pdp_context_request_get_entry {
89     unsigned char cid;
90     unsigned char status; // IPC_GPRS_STATUS
91 } __attribute__((__packed__));
92
93 struct ipc_gprs_pdp_context_request_get_data {
94     unsigned char unknown;
95     struct ipc_gprs_pdp_context_request_get_entry entries[3];
96 } __attribute__((__packed__));
97
98 struct ipc_gprs_ip_configuration_data {
99     unsigned char cid;
100     unsigned char field_flag;
101     unsigned char unknown1;
102     unsigned char ip[4];
103     unsigned char dns1[4];
104     unsigned char dns2[4];
105     unsigned char gateway[4];
106     unsigned char subnet_mask[4];
107     unsigned char unknown2[4];
108 } __attribute__((__packed__));
109
110 struct ipc_gprs_hsdpa_status_data {
111     unsigned char status;
112 } __attribute__((__packed__));
113
114 struct ipc_gprs_current_session_data_counter_data {
115     unsigned char cid;
116     unsigned int rx_count;
117     unsigned int tx_count;
118 } __attribute__((__packed__));
119
120 struct ipc_gprs_call_status_data {
121     unsigned char cid;
122     unsigned char status;
123     unsigned short fail_cause; // IPC_GPRS_FAIL_CAUSE
124 } __attribute__((__packed__));
125
126 struct ipc_gprs_port_list_data {
127     unsigned char magic[804];
128 } __attribute__((__packed__));
129
130 /*
131  * Helpers
132  */
133
134 void ipc_gprs_port_list_setup(struct ipc_gprs_port_list_data *message);
135 void ipc_gprs_pdp_context_request_set_setup(struct ipc_gprs_pdp_context_request_set_data *message,
136     unsigned char cid, int enable, char *username, char *password);
137 void ipc_gprs_define_pdp_context_setup(struct ipc_gprs_define_pdp_context_data *message,
138     unsigned char cid, int enable, char *apn);
139
140 #endif
141
142 // vim:ts=4:sw=4:expandtab