Filter results by

Older Versions

Older API versions are available as a download. To view, extract the file and open the index.html file in a web browser.

artik_network.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2017 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  */
18 
19 #ifndef INCLUDE_ARTIK_NETWORK_H_
20 #define INCLUDE_ARTIK_NETWORK_H_
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "artik_error.h"
27 #include "artik_types.h"
28 
46 #define MAX_IP_ADDRESS_LEN 24
47 
48 
54 #define MAX_MAC_ADDRESS_LEN 18
55 
63 #define MAX_DNS_ADDRESSES 2
64 
72 
79 
85 typedef enum {
86  ARTIK_IPV4,
87  ARTIK_IPV6
89 
97 typedef struct {
101  char address[MAX_IP_ADDRESS_LEN];
105  artik_network_ip_type_t type;
107 
115 typedef void (*watch_online_status_callback)(bool online_status,
116  void *user_data);
117 
125 
133 
139 typedef enum {
140  ARTIK_WIFI,
141  ARTIK_ETHERNET
143 
150 typedef struct {
151  artik_network_interface_t interface;
152  artik_network_ip ip_addr;
153  artik_network_ip netmask;
154  artik_network_ip gw_addr;
156  artik_network_ip start_addr;
157  unsigned int num_leases;
159 
166 typedef struct {
167  artik_network_ip ip_addr;
168  artik_network_ip netmask;
169  artik_network_ip gw_addr;
171  artik_network_mac mac_addr;
173 
181 typedef struct {
194  artik_error(*set_network_config)(
195  artik_network_config * config,
196  artik_network_interface_t interface
197  );
198 
210  artik_error(*get_network_config)(
211  artik_network_config * config,
212  artik_network_interface_t interface
213  );
214 
224  artik_error(*get_current_public_ip)(artik_network_ip *ip);
225 
236  artik_error(*dhcp_client_start)(
237  artik_network_dhcp_client_handle * handle,
238  artik_network_interface_t interface
239  );
240 
249  artik_error(*dhcp_client_stop)(
250  artik_network_dhcp_client_handle handle
251  );
252 
262  artik_error(*dhcp_server_start)(
263  artik_network_dhcp_server_handle * handle,
265  );
266 
275  artik_error(*dhcp_server_stop)(
276  artik_network_dhcp_server_handle handle
277  );
278 
287  artik_error(*get_online_status)(bool *online_status);
288 
302  artik_error(*add_watch_online_status)(
303  watch_online_status_handle * handle,
305  void *user_data);
306 
314  artik_error(*remove_watch_online_status)(
315  watch_online_status_handle handle
316  );
318 
319 extern const artik_network_module network_module;
320 
321 #ifdef __cplusplus
322 }
323 #endif
324 #endif /* INCLUDE_ARTIK_NETWORK_H_ */
#define MAX_MAC_ADDRESS_LEN
Maximum length for MAC Address.
Definition: artik_network.h:54
artik_network_ip_type_t type
IP Address type.
Custom types.
IP Address definition structure.
Definition: artik_network.h:97
#define MAX_IP_ADDRESS_LEN
Maximum length for IP Address.
Definition: artik_network.h:46
artik_network_interface_t
Network Interface.
char artik_network_mac[MAX_MAC_ADDRESS_LEN]
MAC_ADDRESS type.
Definition: artik_network.h:78
#define MAX_DNS_ADDRESSES
Maximum number of configurable DNS servers for the DHCP server.
Definition: artik_network.h:63
int artik_error
Error type.
Definition: artik_error.h:35
void(* watch_online_status_callback)(bool online_status, void *user_data)
Watch online status callback prototype.
void * artik_network_dhcp_server_handle
DHCP server handle type.
Network module operations.
void * watch_online_status_handle
WATCH_ONLINE_STATUS handle type.
Definition: artik_network.h:71
artik_network_ip_type_t
IP address type.
Definition: artik_network.h:85
DHCP server configuration structure.
Error codes.
Network configuration.
void * artik_network_dhcp_client_handle
DHCP client handle type.
Last updated on: