e73a1d9972e75121301c3d6088aed0e12229f51b
[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 #define SA_CONFIG_VERSION                                                       "version"
20 #define SA_CONFIG_NETWORKDATA                                           "networkData"
21 #define SA_CONFIG_SYSTEMDATA                                            "systemData"
22
23 #define SA_CONFIG_NETWORKDATA_WIFI                                      "wifi"
24 #define SA_CONFIG_NETWORKDATA_WIFI_SSID                         "ssid"
25 #define SA_CONFIG_NETWORKDATA_WIFI_PASSWORD                     "password"
26
27 #define SA_CONFIG_NETWORKDATA_ETHERNET                          "ethernet"
28
29 #define SA_CONFIG_NETWORKDATA_ENABLED                           "enabled"
30 #define SA_CONFIG_NETWORKDATA_DHCPENABLED                       "dhcpEnabled"
31 #define SA_CONFIG_NETWORKDATA_IPADDRESS                         "ipAddress"
32 #define SA_CONFIG_NETWORKDATA_NETMASK                           "netmask"
33 #define SA_CONFIG_NETWORKDATA_DEFAULTGATEWAY            "defaultGateway"
34 #define SA_CONFIG_NETWORKDATA_PRIMARYDNSSERVER          "primaryDnsServer"
35 #define SA_CONFIG_NETWORKDATA_SECONDARYDNSSERVER    "SecondaryDnsServer"
36
37 #define SA_CONFIG_NETWORKDATA_HTTPPROXYHOST                     "httpProxyHost"
38 #define SA_CONFIG_NETWORKDATA_HTTPPROXYPORT                     "httpProxyPort"
39
40 /**
41  * @brief  This enum contains setup-adaptor error information
42  *
43  * The sa_error_e indicates what error is happened
44  *
45  */
46 typedef enum {
47         SA_ERROR_NONE = 0,                      /**< Successful */
48         SA_ERROR_INVALID_PARAMETER,     /**< Invalid parameter */
49         SA_ERROR_INVALID_CONTENTS,      /**< Invalid contents */
50         SA_ERROR_OUT_OF_MEMORY,         /**< Out of memory */
51         SA_ERROR_PERMISSION_DENIED,     /**< Permission denied */
52         SA_ERROR_NOT_SUPPORTED,         /**< Not supported  */
53         SA_ERROR_UNKNOWN,                       /**< UNKNOWN  */
54 } sa_error_e;
55
56 /**
57  * @brief  This enum contains setup-adaptor error information
58  *
59  * The sa_error_e indicates what error is happened
60  *
61  */
62 typedef enum {
63         SA_NETWORK_TYPE_WIFI = 0,       /**< wifi */
64         SA_NETWORK_TYPE_ETH,            /**< eth */
65         SA_NETWORK_TYPE_UNKNOWN,        /**< UNKNOWN  */
66 } sa_network_type_e;
67
68 /**
69  * @brief  This enum contains setup-adaptor error information
70  *
71  * The sa_network_state_e indicates connection info in the system
72  *
73  */
74 typedef enum {
75         SA_NETWORK_STATE_DISCONNECTED = 0,              /**< Successful */
76         SA_NETWORK_STATE_PROGRESSING,                   /**< Connecting/Association/Configuration */
77         SA_NETWORK_STATE_CONNECTED,                             /**< connected */
78         SA_NETWORK_STATE_UNKNOWN,                               /**< UNKNOWN  */
79 } sa_network_state_e;
80
81 /**
82  * @struct sa_network_static_s
83  * @brief  This struct contains network static information in the config
84  *
85  * The sa_network_static_s struct encapsulate ip, netmast, gateway and dns information in the one data
86  *
87  */
88 typedef struct {
89         char *ipAddress;
90         char *netmask;
91         char *defaultGateway;
92         char *primaryDnsServer;
93         char *secondaryDnsServer;
94 } sa_network_static_s;
95
96 /**
97  * @struct sa_wifi_s
98  * @brief  This struct contains wifi information in the config
99  *
100  * The sa_wifi_s struct encapsulate enabled, dhcpEnabled, ssid, password and static information in the one data
101  *
102  */
103 typedef struct {
104         int enabled;
105         int dhcpEnabled;
106         char *ssid;
107         char *password;
108         sa_network_static_s *staticInfo;
109 } sa_wifi_s;
110
111 /**
112  * @struct sa_eth_s
113  * @brief  This struct contains ethernet information in the config
114  *
115  * The sa_eth_s struct encapsulate enabled, dhcpEnabled and static information in the one data
116  *
117  */
118 typedef struct {
119         int enabled;
120         int dhcpEnabled;
121         sa_network_static_s *staticInfo;
122 } sa_eth_s;
123
124 /**
125  * @struct sa_network_s
126  * @brief  This struct contains network information in the config
127  *
128  * The sa_network_s struct encapsulate wifi, ethernet and proxy information in the one data
129  *
130  */
131 typedef struct {
132         sa_wifi_s *wifi;
133         sa_eth_s *eth;
134         char *httpProxyHost;
135         int httpProxyPort;
136 } sa_network_s;
137
138 /**
139  * @struct sa_network_activate_pararms_s
140  * @brief  This struct contains update params for activation of network
141  *
142  * The sa_network_activate_pararms_s struct encapsulate network type and network info to update in the one data
143  *
144  */
145 typedef struct {
146         sa_network_type_e type;
147         sa_network_s *network;
148 } sa_network_activate_pararms_s;
149
150 /**
151  * @struct sa_systemdata_s
152  * @brief  This struct contains system data information in the config
153  *
154  * The sa_systemdata_s struct encapsulate device name information in the one data
155  *
156  */
157 typedef struct {
158         char *deviceName;
159 } sa_systemdata_s;
160
161 /**
162  * @struct sa_config_s
163  * @brief  This struct contains config information
164  *
165  * The sa_config_s struct encapsulate version, network and system data information in the one data
166  *
167  */
168 typedef struct {
169         char *version;
170         sa_network_s *network;
171         sa_systemdata_s *systemData;
172 } sa_config_s;
173
174 #endif                                                  /* __SA_TYPES_H__ */