2a494938c13b8b8227cc27b23210f14bd362f9b7
[libsamsung-ipc.git] / include / net.h
1 /*
2  * This file is part of libsamsung-ipc.
3  *
4  * Copyright (C) 2010-2011 Joerie de Gram <j.de.gram@gmail.com>
5  * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
6  * Copyright (C) 2011-2014 Paul Kocialkowski <contact@paulk.fr>
7  *
8  * libsamsung-ipc is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * libsamsung-ipc is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with libsamsung-ipc.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #include <samsung-ipc.h>
23
24 #ifndef __SAMSUNG_IPC_NET_H__
25 #define __SAMSUNG_IPC_NET_H__
26
27 /*
28  * Commands
29  */
30
31 #define IPC_NET_PREF_PLMN                                       0x0801
32 #define IPC_NET_PLMN_SEL                                        0x0802
33 #define IPC_NET_CURRENT_PLMN                                    0x0803
34 #define IPC_NET_PLMN_LIST                                       0x0804
35 #define IPC_NET_REGIST                                          0x0805
36 #define IPC_NET_SUBSCRIBER_NUM                                  0x0806
37 #define IPC_NET_BAND_SEL                                        0x0807
38 #define IPC_NET_SERVICE_DOMAIN_CONFIG                           0x0808
39 #define IPC_NET_POWERON_ATTACH                                  0x0809
40 #define IPC_NET_MODE_SEL                                        0x080A
41 #define IPC_NET_ACQ_ORDER                                       0x080B
42 #define IPC_NET_IDENTITY                                        0x080C
43 #define IPC_NET_CURRENT_RRC_STATUS                              0x080D
44
45 /*
46  * Values
47  */
48
49 #define IPC_NET_PLMN_SEL_MANUAL                                 0x03
50 #define IPC_NET_PLMN_SEL_AUTO                                   0x02
51
52 #define IPC_NET_MODE_SEL_GSM_UMTS                               0x01
53 #define IPC_NET_MODE_SEL_GSM_ONLY                               0x02
54 #define IPC_NET_MODE_SEL_UMTS_ONLY                              0x03
55
56 #define IPC_NET_ACCESS_TECHNOLOGY_UNKNOWN                       0xFF
57 #define IPC_NET_ACCESS_TECHNOLOGY_GSM                           0x00
58 #define IPC_NET_ACCESS_TECHNOLOGY_GSM2                          0x01
59 #define IPC_NET_ACCESS_TECHNOLOGY_GPRS                          0x02
60 #define IPC_NET_ACCESS_TECHNOLOGY_EDGE                          0x03
61 #define IPC_NET_ACCESS_TECHNOLOGY_UMTS                          0x04
62
63 #define IPC_NET_PLMN_STATUS_AVAILABLE                           0x02
64 #define IPC_NET_PLMN_STATUS_CURRENT                             0x03
65 #define IPC_NET_PLMN_STATUS_FORBIDDEN                           0x04
66
67 #define IPC_NET_SERVICE_DOMAIN_GSM                              0x02
68 #define IPC_NET_SERVICE_DOMAIN_GPRS                             0x03
69
70 #define IPC_NET_REGISTRATION_STATUS_NONE                        0x01
71 #define IPC_NET_REGISTRATION_STATUS_HOME                        0x02
72 #define IPC_NET_REGISTRATION_STATUS_SEARCHING                   0x03
73 #define IPC_NET_REGISTRATION_STATUS_EMERGENCY                   0x04
74 #define IPC_NET_REGISTRATION_STATUS_UNKNOWN                     0x05
75 #define IPC_NET_REGISTRATION_STATUS_ROAMING                     0x06
76
77 /*
78  * Structures
79  */
80
81 struct ipc_net_plmn_sel_response_data {
82     unsigned char plmn_sel; // IPC_NET_PLMN_SEL
83 } __attribute__((__packed__));
84
85 struct ipc_net_plmn_sel_request_data {
86     unsigned char mode_sel; // IPC_NET_MODE_SEL
87     char plmn[6];
88     unsigned char act; // IPC_NET_ACCESS_TECHNOLOGY
89 } __attribute__((__packed__));
90
91 struct ipc_net_current_plmn_data {
92     unsigned char unknown[3];
93     char plmn[5];
94     unsigned char type;
95     unsigned short lac;
96 } __attribute__((__packed__));
97
98 struct ipc_net_plmn_list_header {
99     unsigned char count;
100 } __attribute__((__packed__));
101
102 struct ipc_net_plmn_list_entry {
103     unsigned char status; // IPC_NET_PLMN_STATUS
104     char plmn[6];
105     unsigned char type;
106     unsigned char unknown[2];
107 } __attribute__((__packed__));
108
109 struct ipc_net_regist_request_data {
110     unsigned char act; // IPC_NET_ACCESS_TECHNOLOGY
111     unsigned char domain; // IPC_NET_SERVICE_DOMAIN
112 } __attribute__((__packed__));
113
114 struct ipc_net_regist_response_data {
115     unsigned char act; // IPC_NET_ACCESS_TECHNOLOGY
116     unsigned char domain; // IPC_NET_SERVICE_DOMAIN
117     unsigned char status; // IPC_NET_REGISTRATION_STATUS
118     unsigned char edge;
119     unsigned short lac;
120     unsigned int cid;
121     unsigned char fail_cause;
122 } __attribute__((__packed__));
123
124 struct ipc_net_mode_sel_data {
125     unsigned char mode_sel; // IPC_NET_MODE_SEL
126 } __attribute__((__packed__));
127
128 /*
129  * Helpers
130  */
131
132 void ipc_net_regist_setup(struct ipc_net_regist_request_data *message,
133     unsigned char domain);
134 void ipc_net_plmn_sel_set_setup(struct ipc_net_plmn_sel_request_data *message,
135     unsigned char mode, char *plmn, unsigned char act);
136
137 #endif
138
139 // vim:ts=4:sw=4:expandtab