[C# Connection] Adding C# Connection code
[platform/core/csapi/tizenfx.git] / src / Tizen.Network.Connection / Tizen.Network.Connection / ConnectionTypes.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.Collections.Generic;
19 using System.Linq;
20 using System.Text;
21 using Tizen.Internals.Errors;
22
23
24 namespace Tizen.Network.Connection
25 {
26     /// <summary>
27     /// Enumeration for connection type.
28     /// </summary>
29     public enum ConnectionType
30     {
31         Disconnected = 0,  /**< Disconnected */
32         WiFi = 1,          /**< Wi-Fi type */
33         Cellular = 2,      /**< Cellular type */
34         Ethernet = 3,      /**< Ethernet type */
35         Bluetooth = 4,     /**< Bluetooth type */
36         NetProxy = 5       /**< Proxy type for internet connection (Since 3.0) */
37     }
38
39     /// <summary>
40     /// Enumeration for address family.
41     /// </summary>
42     public enum AddressFamily
43     {
44         Ipv4 = 0,
45         Ipv6 = 1
46     }
47
48     /// <summary>
49     /// Enumeration for cellular network state.
50     /// </summary>
51     public enum CellularState
52     {
53         OutOfService = 0,  /**< Out of service */
54         FlightMode = 1,    /**< Flight mode */
55         RoamingOff = 2,    /**< Roaming is turned off */
56         CallOnlyAvailable = 3,  /**< Call is only available */
57         Available = 4,     /**< Available but not connected yet */
58         Connected = 5,     /**< Connected */
59     }
60
61     /// <summary>
62     /// Enumeration for connection state.
63     /// </summary>
64     public enum ConnectionState
65     {
66         Deactivated = 0,   /**< Deactivated */
67         Disconnected = 1,  /**< Disconnected */
68         Connected = 2,     /**< Connected */
69     }
70
71     /// <summary>
72     /// This enumeration defines the attached or detached state of ethernet cable.
73     /// </summary>
74     public enum EthernetCableState
75     {
76         Detached = 0,  /**< Ethernet cable is detached */
77         Attached = 1,  /**< Ethernet cable is attached */
78     }
79
80     /// <summary>
81     /// Enumeration for network connection type.
82     /// </summary>
83     public enum ConnectionProfileType
84     {
85         Cellular = 0,  /**< Cellular type */
86         WiFi = 1,      /**< Wi-Fi type */
87         Ethernet = 2,  /**< Ethernet type */
88         Bt = 3,        /**< Bluetooth type */
89     }
90
91     /// <summary>
92     /// Enumeration for profile state type.
93     /// </summary>
94     public enum ProfileState
95     {
96         Disconnected = 0,  /**< Disconnected state */
97         Association = 1,  /**< Association state */
98         Configuration = 2,  /**< Configuration state */
99         Connected = 3,  /**< Connected state */
100     }
101
102     /// <summary>
103     /// Enumeration for proxy method type.
104     /// </summary>
105     public enum ProxyType
106     {
107         Direct = 0,  /**< Direct connection */
108         Auto = 1,    /**< Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried */
109         Manual = 2,  /**< Manual configuration */
110     }
111
112     /// <summary>
113     /// Enumeration for IP configuration type.
114     /// </summary>
115     public enum IpConfigType
116     {
117         None = 0,  /**< Not defined */
118         Static = 1,  /**< Manual IP configuration */
119         Dynamic = 2,  /**< Config IP using DHCP client*/
120         Auto = 3,  /**< Config IP from Auto IP pool (169.254/16). Later with DHCP client, if available */
121         Fixed = 4,  /**< Indicates an IP address that can not be modified */
122     }
123
124     /// <summary>
125     /// Enumeration for cellular service type.
126     /// </summary>
127     public enum CellularServiceType
128     {
129         Unknown = 0,  /**< Unknown */
130         Internet = 1,  /**< Internet */
131         MMS = 2,  /**< MMS */
132         PrepaidInternet = 3,  /**< Prepaid internet */
133         PrepaidMMS = 4,  /**< Prepaid MMS */
134         Tethering = 5,  /**< Tethering */
135         Application = 6,  /**< Specific application */
136     }
137
138     static internal class ConnectionErrorValue
139     {
140         internal const int Base = -0x01C10000;
141     }
142
143
144     /// <summary>
145     /// Enumeration for connection errors.
146     /// </summary>
147     // To do : have to assign valid error code
148     public enum ConnectionError
149     {
150         None = ErrorCode.None,         /**< Successful */
151         InvalidParameter = ErrorCode.InvalidParameter, /**< Invalid parameter */
152         OutOfMemoryError = ErrorCode.OutOfMemory, /**< Out of memory error */
153         InvalidOperation = ErrorCode.InvalidOperation, /**< Invalid Operation */
154         AddressFamilyNotSupported = ErrorCode.AddressFamilyNotSupported, /**< Address family not supported */
155         OperationFailed = ConnectionErrorValue.Base | 0x0401,  /**< Operation failed */
156         EndOfIteration = ConnectionErrorValue.Base | 0x0402,   /**< End of iteration */
157         NoConnection = ConnectionErrorValue.Base | 0x0403,     /**< There is no connection */
158         NowInProgress = ErrorCode.NowInProgress,    /** Now in progress */
159         AlreadyExists = ConnectionErrorValue.Base | 0x0404, /**< Already exists */
160         OperationAborted = ConnectionErrorValue.Base | 0x0405, /**< Operation is aborted */
161         DhcpFailed = ConnectionErrorValue.Base | 0x0406, /**< DHCP failed  */
162         InvalidKey = ConnectionErrorValue.Base | 0x0407, /**< Invalid key  */
163         NoReply = ConnectionErrorValue.Base | 0x0408, /**< No reply */
164         PermissionDenied = ErrorCode.PermissionDenied, /**< Permission denied */
165         NotSupported = ErrorCode.NotSupported    /**< Not Supported */
166     }
167
168     /// <summary>
169     /// Enumeration for profile list type.
170     /// </summary>
171     public enum ProfileListType
172     {
173         Registered = 0,  /**< The iterator of the registered profile  */
174         Connected = 1,   /**< The iterator of the connected profile  */
175         Default = 2,      /**< The iterator of the default profile  */
176     }
177
178     /// <summary>
179     /// Enumeration for security type of Wi-Fi.
180     /// </summary>
181     public enum WiFiSecureType
182     {
183         None  =  0,       /**< Security disabled */
184         Wep = 1,          /**< WEP */
185         WpaPsk = 2,    /**< WPA-PSK */
186         Wpa2Psk = 3,  /**< WPA2-PSK */
187         Eap = 4,            /**< EAP */
188     }
189
190     /// <summary>
191     /// Enumeration for encryption modes.
192     /// </summary>
193     public enum WiFiEncryptionType
194     {
195         None = 0,  /**< Encryption disabled */
196         Wep = 1,  /**< WEP */
197         Tkip = 2,  /**< TKIP */
198         Aes = 3,  /**< AES */
199         TkipAesMixed = 4,  /**< TKIP and AES are both supported */
200     }
201
202     /// <summary>
203     /// Enumeration for connection profile state.
204     /// </summary>
205     public enum ConnectionProfileState
206     {
207         Disconnected = 0,  /**< Disconnected state */
208         Association = 1,  /**< Association state */
209         Configuration = 2,  /**< Configuration state */
210         Connected = 3,   /**< Connected state */
211     }
212
213     /// <summary>
214     /// Enumeration for cellular authentication type.
215     /// </summary>
216     public enum CellularAuthType
217     {
218         None = 0,  /**< No authentication */
219         Pap = 1,  /**< PAP authentication */
220         Chap = 2,  /**< CHAP authentication */
221     }
222
223     public enum AddressInformationType
224     {
225         Connection = 0,
226         WiFi = 1
227     }
228
229     static internal class Globals
230     {
231         internal const string LogTag = "Tizen.Network.Connection";
232     }
233 }