2 * Network Configuration Module
4 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
24 #ifdef USE_UDEV_MONITOR
25 #include <gudev/gudev.h>
26 #endif /* USE_UDEV_MONITOR */
29 /**< Internal error code with mesh daemon. It should be matched with API side */
31 MESHD_ERROR_NONE = 0, /**< Successful */
32 MESHD_ERROR_IO_ERROR, /**< I/O error */
33 MESHD_ERROR_NO_DATA, /**< Data not exists */
34 MESHD_ERROR_OUT_OF_MEMORY, /**< out of memory */
35 MESHD_ERROR_OPERATION_FAILED, /**< operation failed */
36 MESHD_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
37 MESHD_ERROR_ALREADY_REGISTERED, /**< Request already registered */
38 MESHD_ERROR_IN_PROGRESS /**< operation is in progress */
41 /**< Internal enum for connection state. It should be matched with API side */
43 MESHD_CONNECTION_STATE_DISCONNECTED = 0, /**< Disconnected state */
44 MESHD_CONNECTION_STATE_ASSOCIATION, /**< Association state */
45 MESHD_CONNECTION_STATE_CONFIGURATION, /**< Configuration state */
46 MESHD_CONNECTION_STATE_CONNECTED /**< Connected state */
47 } meshd_connection_state_e;
49 /**< Internal enum for security type. It should be matched with API side */
51 MESHD_SECURITY_NONE = 0, /**< No security */
52 MESHD_SECURITY_SAE, /**< SAE */
53 } meshd_security_type_e;
55 /**< mesh interface information structure */
57 gchar *bridge_interface; /**< Bridge name between mesh and others */
58 gchar *base_interface; /**< Base interface mesh interface created on */
59 gchar *mesh_interface; /**< The name of mesh network interface */
60 gchar *softap_interface; /**< The name of SoftAP network interface */
61 gchar *external_interface; /**< The name of external network interface */
62 gboolean can_be_gate; /**< Whether this device can be Mesh Gate */
64 gchar *mesh_id; /**< Mesh ID */
65 gint mesh_channel; /**< The channel number of mesh network */
66 #ifdef USE_UDEV_MONITOR
67 GUdevClient *udev_client; /**< The udev event client */
68 #endif /* USE_UDEV_MONITOR */
71 /**< Saved mesh network list structure */
72 typedef struct _mesh_network_info {
73 char* mesh_id; /**< The mesh id */
74 char* bssid; /**< BSSID */
75 int channel; /**< Channel */
76 meshd_security_type_e security; /**< Security type */
77 meshd_connection_state_e state; /**< Connection state */
78 } mesh_network_info_s;
80 /**< Mesh network scan result structure */
82 gchar *object_path; /**< Object path from connman */
83 gchar *mesh_id; /**< The mesh id */
84 gchar *bssid; /**< BSSID */
85 gint rssi; /**< RSSI */
86 gint channel; /**< Channel */
87 gint data_rate; /**< Data rate */
88 meshd_security_type_e security; /**< Security type */
89 meshd_connection_state_e state; /**< Connection state */
92 /**< Mesh peer structure */
94 gchar *address; /**< MAC address of connected peer */
97 /**< Connected mesh network station */
99 gchar *bssid; /* station bssid ex) 7c:dd:90:62:37:cf */
100 guint inactive_time; /**< inactive time ex) 1685 ms */
101 guint64 rx_bytes; /**< rx bytes ex) 34174 */
102 guint rx_packets; /**< rx packet ex) 1181 */
103 guint64 tx_bytes; /**< tx bytes ex) 6877 */
104 guint tx_packets; /**< tx packets ex) 76 */
105 guint tx_retries; /**< tx retries ex) 0 */
106 guint tx_failed; /**< tx failed ex) 0 */
107 guint beacon_loss; /**< beacon loss count ex) 0 */
108 guint64 beacon_rx; /**< beacon rx ex) 0 */
109 guint64 rx_drop_misc; /**< rx drop misc ex) 0 */
110 gint rssi; /**< Signal ex) -64 dBm */
111 gint rssi_avg; /**< Average Signal ex) -63 dBm */
112 guint beacon_signal_avg;
114 guint tx_bitrate; /**< tx bitrate ex) 54.0 MBit/s => 540 */
115 guint rx_bitrate; /**< rx bitrate ex) 5.5 MBit/s => 55 */
117 gushort llid; /**< mesh_llid ex) 51731 */
118 gushort plid; /**< mesh plid ex) 35432 */
119 guchar mesh_plink; /**< mesh plink ex) ESTAB */
120 guint local_ps_mode; /**< mesh local power save mode ex) ACTIVE */
121 guint peer_ps_mode; /**< mesh peer power save mode ex) ACTIVE */
122 guint non_peer_ps_mode; /**< mesh non-peer power save mode ex) ACTIVE */
123 gboolean authorized; /**< autorized ex) yes */
124 gboolean authenticated; /**< authenticated ex) yes */
125 gboolean associated; /**< associated ex) yes */
126 gboolean preamble; /**< preamble ex) long */
127 gboolean wme; /**< WMM/WME supported ex) yes */
128 gboolean mfp; /**< MFP ex) no */
129 gboolean tdls_peer; /**< TDLS peer ex) no */
130 guchar dtim_period; /**< DTIM period ex) 0 */
131 gushort beacon_interval; /**< beacon interval ex) 1000 */
132 gboolean cts_protection; /**< CTS protection */
133 gboolean short_preamble; /**< short preamble */
134 gboolean short_slot_time; /**< short slot time supported ex) yes */
135 guint connected_time; /**< connected time : ex) 256 seconds */
136 } mesh_station_info_s;
138 /**< Mesh path information structure */
140 gchar *dest_addr; /**< Destination address */
141 gchar *next_hop; /**< Next Hop */
142 gchar *interface; /**< Interface name */
144 guint metric; /**< Metric */
145 guint qlen; /**< QLEN */
146 guint exptime; /**< Expired time */
147 guint discovery_timeout; /**< Discovery timeout */
148 guchar discovery_retries; /**< Discovery retries */
149 guchar flags; /**< Flags */
153 /**< mesh service structure */
154 typedef struct _mesh_service {
155 GMainLoop *main_loop; /**< Service main-loop */
156 guint dbus_id; /**< D-Bus id */
157 guint activation_dbus_id; /**< D-Bus id for activation */
159 gpointer connection; /**< Connection handle for D-Bus call to other process */
160 GCancellable *ca; /**< Cancellable object for D-Bus call (Daemon->other) */
161 GList *dbus_sub_ids; /**< The list of subscribed signals */
163 mesh_interface_s *interface_info; /**< Name of network interfaces */
164 gboolean mesh_activated; /**< Stored if mesh network is activated */
165 GList *scanned_mesh_network; /**< Scanned mesh network list */
166 GList *connected_mesh_peers; /**< Connected mesh peer list */
167 mesh_network_info_s *joined_network; /**< Joined network info */
169 GList *station_list; /**< Mesh station list */
170 GList *mpath_list; /**< MPath list */
171 int netlink_fd; /**< Netlink event socket file descriptor */
172 int monitor_timer; /**< Timer ID for peer monitoring service */
175 #endif /* __MESH_H__ */