4595736a4ce465299d0d4894be53d0a9d4b2b5e7
[platform/core/system/setup-adaptor.git] / include / sa_types.h
1 /*
2  * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef __SA_TYPES_H__
17 #define __SA_TYPES_H__
18
19
20
21 #define SA_CONFIG_VERSION                                                       "version"
22 #define SA_CONFIG_NETWORKDATA                                           "networkData"
23 #define SA_CONFIG_SYSTEMDATA                                            "systemData"
24
25 #define SA_CONFIG_NETWORKDATA_WIFI                                      "wifi"
26 #define SA_CONFIG_NETWORKDATA_WIFI_SSID                         "ssid"
27 #define SA_CONFIG_NETWORKDATA_WIFI_PASSWORD                     "password"
28
29 #define SA_CONFIG_NETWORKDATA_ETHERNET                          "ethernet"
30
31
32 #define SA_CONFIG_NETWORKDATA_ENABLED                           "enabled"
33 #define SA_CONFIG_NETWORKDATA_DHCPENABLED                       "dhcpEnabled"
34 #define SA_CONFIG_NETWORKDATA_IPADDRESS                         "ipAddress"
35 #define SA_CONFIG_NETWORKDATA_NETMASK                           "netmask"
36 #define SA_CONFIG_NETWORKDATA_DEFAULTGATEWAY            "defaultGateway"
37 #define SA_CONFIG_NETWORKDATA_PRIMARYDNSSERVER          "primaryDnsServer"
38 #define SA_CONFIG_NETWORKDATA_SECONDARYDNSSERVER    "SecondaryDnsServer"
39
40 #define SA_CONFIG_NETWORKDATA_HTTPPROXYHOST                     "httpProxyHost"
41 #define SA_CONFIG_NETWORKDATA_HTTPPROXYPORT                     "httpProxyPort"
42
43
44
45 /**
46  * @brief  This enum contains setup-adaptor error information
47  *
48  * The sa_error_e indicates what error is happened
49  *
50  */
51 typedef enum {
52         SA_ERROR_NONE = 0,                      /**< Successful */
53         SA_ERROR_INVALID_PARAMETER,     /**< Invalid parameter */
54         SA_ERROR_INVALID_CONTENTS,      /**< Invalid contents */
55         SA_ERROR_OUT_OF_MEMORY,         /**< Out of memory */
56         SA_ERROR_PERMISSION_DENIED,     /**< Permission denied */
57         SA_ERROR_NOT_SUPPORTED,         /**< Not supported  */
58         SA_ERROR_UNKNOWN,                       /**< UNKNOWN  */
59 } sa_error_e;
60
61 /**
62  * @brief  This enum contains setup-adaptor error information
63  *
64  * The sa_error_e indicates what error is happened
65  *
66  */
67 typedef enum {
68         SA_NETWORK_TYPE_WIFI = 0,       /**< wifi */
69         SA_NETWORK_TYPE_ETH,            /**< eth */
70         SA_NETWORK_TYPE_UNKNOWN,        /**< UNKNOWN  */
71 } sa_network_type_e;
72
73
74 /**
75  * @brief  This enum contains setup-adaptor error information
76  *
77  * The sa_network_state_e indicates connection info in the system
78  *
79  */
80 typedef enum {
81         SA_NETWORK_STATE_DISCONNECTED = 0,              /**< Successful */
82         SA_NETWORK_STATE_PROGRESSING,               /**< Connecting/Association/Configuration */
83         SA_NETWORK_STATE_CONNECTED,                             /**< connected */
84         SA_NETWORK_STATE_UNKNOWN,                               /**< UNKNOWN  */
85 } sa_network_state_e;
86
87 /**
88  * @struct sa_network_static_s
89  * @brief  This struct contains network static information in the config
90  *
91  * The sa_network_static_s struct encapsulate ip, netmast, gateway and dns information in the one data
92  *
93  */
94 typedef struct {
95         char *ipAddress;
96         char *netmask;
97         char *defaultGateway;
98         char *primaryDnsServer;
99         char *secondaryDnsServer;
100 } sa_network_static_s;
101
102 /**
103  * @struct sa_wifi_s
104  * @brief  This struct contains wifi information in the config
105  *
106  * The sa_wifi_s struct encapsulate enabled, dhcpEnabled, ssid, password and static information in the one data
107  *
108  */
109 typedef struct {
110         int enabled;
111         int dhcpEnabled;
112         char *ssid;
113         char *password;
114         sa_network_static_s *staticInfo;
115 } sa_wifi_s;
116
117 /**
118  * @struct sa_eth_s
119  * @brief  This struct contains ethernet information in the config
120  *
121  * The sa_eth_s struct encapsulate enabled, dhcpEnabled and static information in the one data
122  *
123  */
124 typedef struct {
125         int enabled;
126         int dhcpEnabled;
127         sa_network_static_s *staticInfo;
128 } sa_eth_s;
129
130 /**
131  * @struct sa_network_s
132  * @brief  This struct contains network information in the config
133  *
134  * The sa_network_s struct encapsulate wifi, ethernet and proxy information in the one data
135  *
136  */
137 typedef struct {
138         sa_wifi_s *wifi;
139         sa_eth_s *eth;
140         char *httpProxyHost;
141         int httpProxyPort;
142 } sa_network_s;
143
144
145 /**
146  * @struct sa_network_activate_pararms_s
147  * @brief  This struct contains update params for activation of network
148  *
149  * The sa_network_activate_pararms_s struct encapsulate network type and network info to update in the one data
150  *
151  */
152 typedef struct {
153         sa_network_type_e type;
154         sa_network_s *network;
155 } sa_network_activate_pararms_s;
156
157 /**
158  * @struct sa_systemdata_s
159  * @brief  This struct contains system data information in the config
160  *
161  * The sa_systemdata_s struct encapsulate device name information in the one data
162  *
163  */
164 typedef struct {
165         char *deviceName;
166 } sa_systemdata_s;
167
168 /**
169  * @struct sa_config_s
170  * @brief  This struct contains config information
171  *
172  * The sa_config_s struct encapsulate version, network and system data information in the one data
173  *
174  */
175 typedef struct {
176         char *version;
177         sa_network_s *network;
178         sa_systemdata_s *systemData;
179 } sa_config_s;
180
181 #endif /* __SA_TYPES_H__ */