Apply two-letter acronyms (Ip --> IP)
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.Connection / Interop / Interop.Connection.cs
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
17 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.Network.Connection;
20
21 internal static partial class Interop
22 {
23     internal static partial class Connection
24     {
25         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
26         public delegate void ConnectionTypeChangedCallback(ConnectionType type, IntPtr userData);
27         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
28         public delegate void EthernetCableStateChangedCallback(EthernetCableState state, IntPtr userData);
29         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
30         public delegate void ConnectionAddressChangedCallback(IntPtr ipv4, IntPtr ipv6, IntPtr userData);
31         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
32         public delegate void ConnectionCallback(ConnectionError result, IntPtr userData);
33
34         [DllImport(Libraries.Connection, EntryPoint = "connection_create")]
35         public static extern int Create(out IntPtr handle);
36
37         [DllImport(Libraries.Connection, EntryPoint = "connection_destroy")]
38         public static extern int Destroy(IntPtr handle);
39
40         [DllImport(Libraries.Connection, EntryPoint = "connection_get_type")]
41         public static extern int GetType(IntPtr handle, out int type);
42
43         [DllImport(Libraries.Connection, EntryPoint = "connection_get_ip_address")]
44         public static extern int GetIPAddress(IntPtr handle, int family, out IntPtr address);
45
46         [DllImport(Libraries.Connection, EntryPoint = "connection_get_proxy")]
47         public static extern int GetProxy(IntPtr handle, int family, out IntPtr address);
48
49         [DllImport(Libraries.Connection, EntryPoint = "connection_get_mac_address")]
50         public static extern int GetMacAddress(IntPtr handle, int family, out IntPtr address);
51
52         [DllImport(Libraries.Connection, EntryPoint = "connection_get_wifi_state")]
53         public static extern int GetWiFiState(IntPtr handle, out int state);
54
55         [DllImport(Libraries.Connection, EntryPoint = "connection_get_cellular_state")]
56         public static extern int GetCellularState(IntPtr handle, out int state);
57
58         [DllImport(Libraries.Connection, EntryPoint = "connection_get_ethernet_state")]
59         public static extern int GetEthernetState(IntPtr handle, out int state);
60
61         [DllImport(Libraries.Connection, EntryPoint = "connection_get_ethernet_cable_state")]
62         public static extern int GetEthernetCableState(IntPtr handle, out int state);
63
64         [DllImport(Libraries.Connection, EntryPoint = "connection_get_bt_state")]
65         public static extern int GetBtState(IntPtr handle, out int state);
66
67         [DllImport(Libraries.Connection, EntryPoint = "connection_set_type_changed_cb")]
68         public static extern int SetTypeChangedCallback(IntPtr handle, ConnectionTypeChangedCallback callback, IntPtr userData);
69
70         [DllImport(Libraries.Connection, EntryPoint = "connection_set_ip_address_changed_cb")]
71         public static extern int SetIPAddressChangedCallback(IntPtr handle, ConnectionAddressChangedCallback callback, IntPtr userData);
72
73         [DllImport(Libraries.Connection, EntryPoint = "connection_set_ethernet_cable_state_chaged_cb")]
74         public static extern int SetEthernetCableStateChagedCallback(IntPtr handle, EthernetCableStateChangedCallback callback, IntPtr userData);
75
76         [DllImport(Libraries.Connection, EntryPoint = "connection_set_proxy_address_changed_cb")]
77         public static extern int SetProxyAddressChangedCallback(IntPtr handle, ConnectionAddressChangedCallback callback, IntPtr userData);
78
79         [DllImport(Libraries.Connection, EntryPoint = "connection_unset_type_changed_cb")]
80         public static extern int UnsetTypeChangedCallback(IntPtr handle);
81
82         [DllImport(Libraries.Connection, EntryPoint = "connection_unset_ip_address_changed_cb")]
83         public static extern int UnsetIPAddressChangedCallback(IntPtr handle);
84
85         [DllImport(Libraries.Connection, EntryPoint = "connection_unset_ethernet_cable_state_chaged_cb")]
86         public static extern int UnsetEthernetCableStateChagedCallback(IntPtr handle);
87
88         [DllImport(Libraries.Connection, EntryPoint = "connection_unset_proxy_address_changed_cb")]
89         public static extern int UnsetProxyAddressChangedCallback(IntPtr handle);
90
91         [DllImport(Libraries.Connection, EntryPoint = "connection_add_profile")]
92         public static extern int AddProfile(IntPtr handle, IntPtr profileHandle);
93
94         [DllImport(Libraries.Connection, EntryPoint = "connection_remove_profile")]
95         public static extern int RemoveProfile(IntPtr handle, IntPtr profileHandle);
96
97         [DllImport(Libraries.Connection, EntryPoint = "connection_update_profile")]
98         public static extern int UpdateProfile(IntPtr handle, IntPtr profileHandle);
99
100         [DllImport(Libraries.Connection, EntryPoint = "connection_get_default_cellular_service_profile")]
101         public static extern int GetDefaultCellularServiceProfile(IntPtr handle, int type, out IntPtr profileHandle);
102
103         [DllImport(Libraries.Connection, EntryPoint = "connection_get_current_profile")]
104         public static extern int GetCurrentProfile(IntPtr handle, out IntPtr profileHandle);
105
106         [DllImport(Libraries.Connection, EntryPoint = "connection_open_profile")]
107         public static extern int OpenProfile(IntPtr handle, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData);
108
109         [DllImport(Libraries.Connection, EntryPoint = "connection_close_profile")]
110         public static extern int CloseProfile(IntPtr handle, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData);
111
112         [DllImport(Libraries.Connection, EntryPoint = "connection_reset_profile")]
113         public static extern int ResetProfile(IntPtr handle, int Option, int Id, ConnectionCallback callback, IntPtr userData);
114
115         [DllImport(Libraries.Connection, EntryPoint = "connection_set_default_cellular_service_profile_async")]
116         public static extern int SetDefaultCellularServiceProfileAsync(IntPtr handle, int Type, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData);
117
118         [DllImport(Libraries.Connection, EntryPoint = "connection_get_profile_iterator")]
119         public static extern int GetProfileIterator(IntPtr handle, int type, out IntPtr iterHandle);
120
121         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_iterator_next")]
122         public static extern int GetNextProfileIterator(IntPtr iterHandle, out IntPtr profileHandle);
123
124         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_iterator_has_next")]
125         public static extern bool HasNextProfileIterator(IntPtr iterHandle);
126
127         [DllImport(Libraries.Connection, EntryPoint = "connection_destroy_profile_iterator")]
128         public static extern int DestroyProfileIterator(IntPtr iterHandle);
129     }
130
131     internal static partial class ConnectionProfile
132     {
133         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
134         public delegate void ProfileStateChangedCallback(ProfileState type, IntPtr userData);
135
136         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_create")]
137         public static extern int Create(int ProfileType, string Keyword, out IntPtr profileHandle);
138
139         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_clone")]
140         public static extern int Clone(out IntPtr cloneHandle, IntPtr profileHandle);
141
142         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_destroy")]
143         public static extern int Destroy(IntPtr profileHandle);
144
145         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_id")]
146         public static extern int GetId(IntPtr profileHandle, out IntPtr profileId);
147
148         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_name")]
149         public static extern int GetName(IntPtr profileHandle, out IntPtr name);
150
151         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_type")]
152         public static extern int GetType(IntPtr profileHandle, out int type);
153
154         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_network_interface_name")]
155         public static extern int GetNetworkInterfaceName(IntPtr profileHandle, out IntPtr interfaceName);
156
157         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_state")]
158         public static extern int GetState(IntPtr profileHandle, out int type);
159
160         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_config_type")]
161         public static extern int GetIPConfigType(IntPtr profileHandle, int family, out int type);
162
163         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_type")]
164         public static extern int GetProxyType(IntPtr profileHandle, out int type);
165
166         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_address")]
167         public static extern int GetIPAddress(IntPtr profileHandle, int family, out IntPtr address);
168
169         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_subnet_mask")]
170         public static extern int GetSubnetMask(IntPtr profileHandle, int family, out IntPtr address);
171
172         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_gateway_address")]
173         public static extern int GetGatewayAddress(IntPtr profileHandle, int family, out IntPtr address);
174
175         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dns_address")]
176         public static extern int GetDnsAddress(IntPtr profileHandle, int order, int Family, out IntPtr address);
177
178         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_address")]
179         public static extern int GetProxyAddress(IntPtr profileHandle, int family, out IntPtr address);
180
181         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_config_type")]
182         public static extern int SetIPConfigType(IntPtr profileHandle, int family, int type);
183
184         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_type")]
185         public static extern int SetProxyType(IntPtr profileHandle, int type);
186
187         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_address")]
188         public static extern int SetIPAddress(IntPtr profileHandle, int family, string address);
189
190         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_subnet_mask")]
191         public static extern int SetSubnetMask(IntPtr profileHandle, int family, string address);
192
193         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_gateway_address")]
194         public static extern int SetGatewayAddress(IntPtr profileHandle, int family, string address);
195
196         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_dns_address")]
197         public static extern int SetDnsAddress(IntPtr profileHandle, int family, string address);
198
199         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_address")]
200         public static extern int SetProxyAddress(IntPtr profileHandle, int family, string address);
201
202         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_state_changed_cb")]
203         public static extern int SetStateChangeCallback(IntPtr profileHandle, ProfileStateChangedCallback callback, IntPtr userData);
204
205         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_unset_state_changed_cb")]
206         public static extern int UnsetStateChangeCallback(IntPtr profileHandle);
207     }
208
209     internal static partial class ConnectionCellularProfile
210     {
211         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_service_type")]
212         public static extern int GetServiceType(IntPtr profileHandle, out int type);
213
214         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_apn")]
215         public static extern int GetApn(IntPtr profileHandle, out IntPtr apn);
216
217         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_auth_info")]
218         public static extern int GetAuthInfo(IntPtr profileHandle, out int authType, out IntPtr name, out IntPtr password);
219
220         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_home_url")]
221         public static extern int GetHomeUrl(IntPtr profileHandle, out IntPtr homeUrl);
222
223         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_roaming")]
224         public static extern int IsRoaming(IntPtr profileHandle, out bool roaming);
225
226         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_hidden")]
227         public static extern int IsHidden(IntPtr profileHandle, out bool hidden);
228
229         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_editable")]
230         public static extern int IsEditable(IntPtr profileHandle, out bool editable);
231
232         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_default")]
233         public static extern int IsDefault(IntPtr profileHandle, out bool isDefault);
234
235         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_service_type")]
236         public static extern int SetServiceType(IntPtr profileHandle, int type);
237
238         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_apn")]
239         public static extern int SetApn(IntPtr profileHandle, string apn);
240
241         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_auth_info")]
242         public static extern int SetAuthInfo(IntPtr profileHandle, int authType, string name, string password);
243
244         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_home_url")]
245         public static extern int SetHomeUrl(IntPtr profileHandle, string homeUrl);
246
247     }
248
249     internal static partial class ConnectionWiFiProfile
250     {
251         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_essid")]
252         public static extern int GetEssid(IntPtr profileHandle, out IntPtr essid);
253
254         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_bssid")]
255         public static extern int GetBssid(IntPtr profileHandle, out IntPtr bssid);
256
257         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_rssi")]
258         public static extern int GetRssi(IntPtr profileHandle, out int rssi);
259
260         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_frequency")]
261         public static extern int GetFrequency(IntPtr profileHandle, out int frequency);
262
263         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_max_speed")]
264         public static extern int GetMaxSpeed(IntPtr profileHandle, out int maxSpeed);
265
266         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_security_type")]
267         public static extern int GetSecurityType(IntPtr profileHandle, out int type);
268
269         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_encryption_type")]
270         public static extern int GetEncryptionType(IntPtr profileHandle, out int type);
271
272         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_wifi_passphrase_required")]
273         public static extern int IsRequiredPassphrase(IntPtr profileHandle, out bool required);
274
275         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_wifi_passphrase")]
276         public static extern int SetPassphrase(IntPtr profileHandle, string passphrase);
277
278         [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_wifi_wps_supported")]
279         public static extern int IsSupportedWps(IntPtr profileHandle, out bool supported);
280     }
281         
282     internal static partial class Libc
283     {
284         [DllImport(Libraries.Libc, EntryPoint = "free")]
285         public static extern void Free(IntPtr userData);
286
287     }
288 }