lwpa  0.1.0
LightWeight Platform Abstraction (lwpa)
View other versions:
lwpa_netint.h
1 /******************************************************************************
2  * Copyright 2018 ETC Inc.
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  * This file is a part of lwpa. For more information, go to:
17  * https://github.com/ETCLabs/lwpa
18  ******************************************************************************/
19 
20 /* lwpa_netint.h: Platform-neutral method for enumerating network interfaces.
21  */
22 #ifndef _LWPA_NETINT_H_
23 #define _LWPA_NETINT_H_
24 
25 #include <stddef.h>
26 #include "lwpa_bool.h"
27 #include "lwpa_inet.h"
28 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
43 size_t netint_get_interfaces(LwpaNetintInfo *netint_arr, size_t netint_arr_size);
45 const LwpaNetintInfo *netint_get_iface_for_dest(const LwpaIpAddr *dest, const LwpaNetintInfo *netint_arr,
46  size_t netint_arr_size);
47 
48 // typedef void (*netint_change_notification)(void *context);
49 
50 // int netint_register_change_cb(netint_change_notification fn, void
51 // *context); void netint_unregister_change_cb(int handle);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
59 #endif /* _LWPA_NETINT_H_ */
const LwpaNetintInfo * netint_get_iface_for_dest(const LwpaIpAddr *dest, const LwpaNetintInfo *netint_arr, size_t netint_arr_size)
Get the network interface that the system will choose when routing an IP packet to the specified dest...
Definition: lwpa_netint.c:168
size_t netint_get_interfaces(LwpaNetintInfo *netint_arr, size_t netint_arr_size)
Enumerate the network interfaces on the system.
Definition: lwpa_netint.c:95
size_t netint_get_num_interfaces()
Get the number of network interfaces present on the system.
Definition: lwpa_netint.c:82
bool netint_get_default_interface(LwpaNetintInfo *netint)
Get information about the default network interface.
Definition: lwpa_netint.c:119
An IP address.
Definition: lwpa_inet.h:55
A description of a network interface.
Definition: lwpa_inet.h:196