Merge "Add the exception handling when using manual cert mode" into tizen_2.1
[platform/framework/native/net.git] / src / FNet_NetUtility.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file        FNet_NetUtility.h
19  * @brief       This is the header file for the %_NetUtility class.
20  *
21  * This header file contains the declarations of the %_NetUtility class.
22  */
23
24 #ifndef _FNET_INTERNAL_NET_UTILITY_H_
25 #define _FNET_INTERNAL_NET_UTILITY_H_
26
27 #include <net_connection.h>
28 #include <tethering.h>
29 #include <unique_ptr.h>
30 #include <FBaseDataType.h>
31
32 namespace Tizen { namespace Base { namespace Runtime
33 {
34 class Mutex;
35 } } } // Tizen::Base::Runtime
36
37 namespace Tizen { namespace Net
38 {
39
40 struct _CharDeleter
41 {
42         void operator()(char* pChar)
43         {
44                 free(pChar);
45         }
46 };
47
48 struct _ConnectionDeleter
49 {
50         void operator()(void* pConnection)
51         {
52                 connection_destroy(pConnection);
53         }
54 };
55
56 struct _ProfileDeleter
57 {
58         void operator()(void* pProfile)
59         {
60                 connection_profile_destroy(pProfile);
61         }
62 };
63
64 struct _TetheringDeleter
65 {
66         void operator()(void* pTethering)
67         {
68                 tethering_destroy(pTethering);
69         }
70 };
71
72
73 struct _ProfileIteratorDeleter
74 {
75         void operator()(void* pIterator)
76         {
77                 connection_destroy_profile_iterator(pIterator);
78         }
79 };
80
81 struct _CollectionDeleter
82 {
83         template<typename Collection>
84         void operator()(Collection* pCollection)
85         {
86                 pCollection->RemoveAll(true);
87                 delete pCollection;
88         }
89 };
90
91 class  _NetUtility
92 {
93 public:
94         static Tizen::Base::Runtime::Mutex* GetLock(void);
95
96 private:
97         /**
98          * This is the default constructor for this class.
99          */
100         _NetUtility(void);
101
102         /**
103          * This is the destructor for this class.
104          */
105         virtual ~_NetUtility(void);
106
107         _NetUtility(const _NetUtility& rhs);
108         _NetUtility& operator =(const _NetUtility& rhs);
109
110         static void InitLock(void);
111
112 private:
113         static Tizen::Base::Runtime::Mutex* __pLock;
114
115 }; // _NetUtility
116
117 } } // Tizen::Net
118 #endif // _FNET_INTERNAL_NET_UTILITY_H_
119