[PROTO] add message size to msg_probe_network
[platform/core/system/swap-probe.git] / probe_tizenapi / tizen_socket.cpp
1 /*
2  *  DA probe
3  *
4  * Copyright (File::*c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:
7  *
8  * Hyunjong Park        <phjwithyou.park@samsung.com>
9  * Juyoung Kim          <j0.kim@samsung.com>
10  * Vitaliy Cherepanov   <v.cherepanov@samsung.com>
11  *
12  * This library is free software; you can redistribute it and/or modify it under
13  * the terms of the GNU Lesser General Public License as published by the
14  * Free Software Foundation; either version 2.1 of the License, or (at your option)
15  * any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20  * License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * along with this library; if not, write to the Free Software Foundation, Inc., 51
24  * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  *
26  * Contributors:
27  * - S-Core Co., Ltd
28  * - Samsung RnD Institute Russia
29  *
30  */
31
32 #include <FBase.h>
33 #include <FBaseObject.h>
34 #include <FBaseResult.h>
35 #include <arpa/inet.h>
36 #include "daprobe.h"
37 #include "probeinfo.h"
38 #include "dahelper.h"
39 #include "dacollection.h"
40 #include "tizen_probe.h"
41 #include "../probe_socket/da_socket.h"
42 #include "binproto.h"
43 #include "api_id_mapping.h"
44
45 static enum DaOptions _sopt = OPT_NETWORK;
46
47 namespace Tizen {
48 namespace Net {
49
50 typedef int NetAccountId;
51
52 enum NetAddressFamily {
53
54         NET_AF_IPV4 = 1, /**< The default @n An IPv4 address [RFC791] is represented in decimal format with dots as delimiters. */
55         NET_AF_IPV6, /**< An IPv6 address [RFC2373] is generally represented in hexadecimal numbers with colons as delimiters @n It can also be a combination of hexadecimal and decimal numbers with dots and colons as delimiters. */
56         NET_AF_ALPHANUMERIC, /**< A generic alphanumeric address (as defined by alphanum in [RFC2396]) */
57         NET_AF_APN, /**< A GPRS APN as defined in [GENFORM] */
58         NET_AF_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. Network Address Family not set
59 };
60
61 enum NetConnectionState {
62         NET_CONNECTION_STATE_NONE, /**< The initial state */
63         NET_CONNECTION_STATE_STARTING, /**< The network connection is being established */
64         NET_CONNECTION_STATE_STARTED, /**< The network connection has been established */
65         NET_CONNECTION_STATE_STOPPING, /**< The network connection is being disconnected */
66         NET_CONNECTION_STATE_STOPPED, /**< The network connection has been disconnected */
67         NET_CONNECTION_STATE_SUSPENDED, /**< The network connection has been suspended */
68         NET_CONNECTION_STATE_SUSPEND = 5, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
69         NET_CONNECTION_STATE_RESUMED, /**< The network connection is established, and recovered from SUSPEND state - enable to send/receive packet data */
70         NET_CONNECTION_STATE_AVAILABLE, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
71         NET_CONNECTION_STATE_UNAVAILABLE, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
72 };
73 enum NetBearerType {
74         NET_BEARER_PS = 1, /**< The bearer type for the PS domain */
75         NET_BEARER_CS, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
76         NET_BEARER_WIFI, /**< The bearer type for Wi-Fi */
77         NET_BEARER_WIFI_DIRECT, /**< The bearer type for Wi-Fi Direct @n
78          *      This bearer type cannot be tested on the Emulator. */
79         NET_BEARER_USB, /**< The bearer type for USB NDIS mode @n
80          *      Can use this bearer type via USB Tethering mode. @n
81          *      This bearer type cannot be tested on the Emulator. */
82         NET_BEARER_MMS, /**< The bearer type for MMS */
83         NET_BEARER_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. Network Bearer Type not set
84 };
85
86 enum NetAddressScheme {
87         NET_ADDRESS_SCHEME_DYNAMIC = 1, /**< The Dynamic IP or DNS Address */
88         NET_ADDRESS_SCHEME_STATIC, /**< The Static IP or DNS Address */
89         NET_ADDRESS_SCHEME_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. Network Address Scheme not set
90 };
91
92 enum NetProtocolType {
93         NET_PROTO_TYPE_IPV4 = 1, /**< The IPV4 type */
94         NET_PROTO_TYPE_PPP, /**< The PPP type */
95         NET_PROTO_TYPE_IPV6, /**< The IPV6 type, currently NOT supported */
96         NET_PROTO_TYPE_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. Network Protocol type not set
97 };
98
99 class _IpAddressImpl;
100 class IpAddress {
101 public:
102         virtual ~IpAddress(void);
103         static unsigned short HostToNetworkOrder(unsigned short host);
104         static unsigned long HostToNetworkOrder(unsigned long host);
105         static unsigned short NetworkToHostOrder(unsigned short network);
106         static unsigned long NetworkToHostOrder(unsigned long network);
107         virtual NetAddressFamily GetNetAddressFamily(void) const = 0;
108         virtual result GetAddress(Tizen::Base::ByteBuffer& ipAddr) const = 0;
109         virtual Tizen::Base::String ToString(void) const = 0;
110         virtual IpAddress* CloneN(void) const = 0;
111 protected:
112         IpAddress(void);
113 protected:
114         virtual void IpAddress_Reserved1(void) {
115         }
116         virtual void IpAddress_Reserved2(void) {
117         }
118         virtual void IpAddress_Reserved3(void) {
119         }
120         virtual void IpAddress_Reserved4(void) {
121         }
122         virtual void IpAddress_Reserved5(void) {
123         }
124 private:
125         IpAddress(const IpAddress& rhs);
126         IpAddress& operator =(const IpAddress& rhs);
127 protected:
128         _IpAddressImpl* _pIpAddressImpl;
129         friend class _IpAddressImpl;
130 };
131 // IpAddress
132
133 class Ip4Address {
134 public:
135         Tizen::Base::String ToString(void) const;
136         //unsigned long GetAddress(unsigned long& ipAddr) const;
137         unsigned long GetAddress(uint32_t *ipAddr) const;
138 };
139
140 Tizen::Base::String Ip4Address::ToString(void) const {
141         typedef Tizen::Base::String (Ip4Address::*methodType)(void) const;
142         static methodType ToStringp;
143         CALL_ORIGINAL_TIZEN_NET( _ZNK5Tizen3Net10Ip4Address8ToStringEv, ToStringp);
144         return (this->*ToStringp)();
145 }
146
147 /* INFO this is not original Ip4Address function */
148 unsigned long Ip4Address::GetAddress( uint32_t *ipAddr) const {
149         unsigned long IP, res;
150         typedef unsigned long (Ip4Address::*methodType)(unsigned long& ipAddr) const;
151         static methodType GetAddresgp;
152         CALL_ORIGINAL_TIZEN_NET(_ZNK5Tizen3Net10Ip4Address10GetAddressERm,
153                                 GetAddresgp);
154         res = (this->*GetAddresgp)(IP);
155         *ipAddr = ntohl(IP);
156         return res;
157 }
158
159 class NetEndPoint {
160 public:
161         unsigned short GetPort(void) const;
162         IpAddress* GetAddress(void) const;
163 };
164
165 unsigned short NetEndPoint::GetPort(void) const {
166         typedef unsigned short (NetEndPoint::*methodType)(void) const;
167         static methodType GetPortp;
168         CALL_ORIGINAL_TIZEN_NET( _ZNK5Tizen3Net11NetEndPoint7GetPortEv, GetPortp);
169         return (this->*GetPortp)();
170 }
171
172 IpAddress* NetEndPoint::GetAddress(void) const {
173         typedef IpAddress *(NetEndPoint::*methodType)(void) const;
174         static methodType GetAddressp;
175         CALL_ORIGINAL_TIZEN_NET( _ZNK5Tizen3Net11NetEndPoint10GetAddressEv,
176                         GetAddressp);
177         return (this->*GetAddressp)();
178 }
179
180 class NetConnectionInfo;
181 class INetConnectionEventListener;
182
183 class _NetConnectionImpl;
184 class NetConnection {
185 public:
186         NetConnection(void);
187         virtual ~NetConnection(void);
188         result Construct(NetAccountId netAccountId);
189 public:
190         result AddNetConnectionListener(INetConnectionEventListener& listener);
191         result RemoveNetConnectionListener(INetConnectionEventListener& listener);
192         result Start(void);
193         result Stop(void);
194         result Close(void);
195         NetAccountId GetNetAccountId(void) const;
196         const NetConnectionInfo* GetNetConnectionInfo(void) const;
197         static NetConnectionInfo* GetNetConnectionInfoN(NetAccountId netAccountId);
198         static Tizen::Base::Collection::IList* GetAllNetConnectionInfoN(void);
199         NetConnectionState GetConnectionState(void) const;
200 private:
201         NetConnection(const NetConnection& rhs);
202         NetConnection& operator =(const NetConnection& rhs);
203 private:
204         _NetConnectionImpl* __pNetConnectionImpl;
205         friend class _NetConnectionImpl;
206 };
207
208 class INetConnectionEventListener {
209 public:
210         virtual ~INetConnectionEventListener(void) {
211         }
212 public:
213         virtual void OnNetConnectionStarted(NetConnection& netConnection,
214                         result r) = 0;
215         virtual void OnNetConnectionStopped(NetConnection& netConnection,
216                         result r) = 0;
217         virtual void OnNetConnectionSuspended(NetConnection& netConnection) = 0;
218         virtual void OnNetConnectionResumed(NetConnection& netConnection) = 0;
219 protected:
220         virtual void INetConnectionEventListener_Reserved1(void) {
221         }
222         virtual void INetConnectionEventListener_Reserved2(void) {
223         }
224 };
225
226 class _NetConnectionInfoImpl;
227 class NetConnectionInfo {
228 public:
229         NetConnectionInfo(void);
230         virtual ~NetConnectionInfo(void);
231         NetBearerType GetBearerType(void) const;
232         NetProtocolType GetProtocolType(void) const;
233         Tizen::Base::String GetAccessPointName(void) const;
234         NetAddressScheme GetLocalAddressScheme(void) const;
235         const IpAddress* GetLocalAddress(void) const;
236         NetAddressScheme GetDnsAddressScheme(void) const;
237         const IpAddress* GetPrimaryDnsAddress(void) const;
238         const IpAddress* GetSecondaryDnsAddress(void) const;
239         const IpAddress* GetSubnetMaskAddress(void) const;
240         const IpAddress* GetDefaultGatewayAddress(void) const;
241         NetConnectionInfo(const NetConnectionInfo& rhs);
242         NetConnectionInfo& operator =(const NetConnectionInfo& rhs);
243         virtual bool Equals(const Tizen::Base::Object& rhs) const;
244         virtual int GetHashCode(void) const;
245 private:
246         _NetConnectionInfoImpl* __pNetConnectionInfoImpl;
247         friend class _NetConnectionInfoImpl;
248 };
249
250 }
251 } //namespace Tizen { namespace Net {
252
253 namespace Tizen {
254 namespace Net {
255 namespace Sockets {
256
257 enum NetSocketAddressFamily {
258         //NET_SOCKET_AF_LOCAL = 1,                            /*< The local socket for loopback*/
259         NET_SOCKET_AF_IPV4 = 2, /**< An IP version 4 address family */
260         //NET_SOCKET_AF_IPV6,                                           /*< An IP version 6 address family */
261         NET_SOCKET_AF_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
262 };
263 //
264 enum NetSocketType {
265         NET_SOCKET_TYPE_STREAM = 1, /**< The stream socket */
266         NET_SOCKET_TYPE_DATAGRAM, /**< The datagram socket */
267         NET_SOCKET_TYPE_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
268 };
269 //
270 enum NetSocketProtocol {
271         NET_SOCKET_PROTOCOL_TCP = 1, /**< The TCP protocol */
272         NET_SOCKET_PROTOCOL_UDP, /**< The UDP protocol */
273         NET_SOCKET_PROTOCOL_SSL, /**< The SSL protocol */
274         NET_SOCKET_PROTOCOL_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
275 };
276
277 enum NetSocketIoctlCmd {
278         NET_SOCKET_FIONBIO = 1, /**< The command to set the non-blocking/blocking mode on a socket */
279         NET_SOCKET_FIONREAD, /**< The command to determine the amount of data pending in the network input buffer */
280         NET_SOCKET_FIONWRITE, /**< The functionality is not supported in this SDK */
281         NET_SOCKET_SIOCATMARK, /**< The command to determine whether all out-of-band data is read */
282         NET_SOCKET_IOCTLCMD_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
283 };
284
285 enum NetSocketOptLevel {
286         NET_SOCKET_IPPROTO_TCP = 1, /**< The socket options apply only to the TCP sockets */
287         NET_SOCKET_IPPROTO_IP, /**< The socket options apply only to the IP sockets */
288         NET_SOCKET_SOL_SOCKET, /**< The socket options apply to all the sockets */
289         NET_SOCKET_OPTLEVEL_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
290 };
291 //
292 enum NetSocketOptName {
293         NET_SOCKET_TCP_NODELAY = 1, /**< The option name is Level: NET_SOCKET_IPPROTO_TCP - Set/Get is possible */
294         NET_SOCKET_TCP_MAXSEG, /**< The option name is Level: NET_SOCKET_IPPROTO_TCP - Set/Get is possible */
295         NET_SOCKET_IP_TTL, /**< The option name is Level: NET_SOCKET_IPPROTO_IP - Set/Get is possible */
296         NET_SOCKET_IP_TOS, /**< The option name is Level: NET_SOCKET_IPPROTO_IP - Set/Get is possible */
297         NET_SOCKET_IP_ADD_MEMBERSHIP, /**< The option name is Level: NET_SOCKET_IPPROTO_IP - Only Set is possible */
298         NET_SOCKET_IP_DROP_MEMBERSHIP, /**< The option name is Level: NET_SOCKET_IPPROTO_IP - Only Set is possible */
299         NET_SOCKET_SO_ACCEPTCONN, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Only Get is possible */
300         NET_SOCKET_SO_BROADCAST, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
301         NET_SOCKET_SO_DEBUG, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible (Currently, not supported)
302         NET_SOCKET_SO_DONTROUTE, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
303         NET_SOCKET_SO_ERROR, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Only Get is possible */
304         NET_SOCKET_SO_KEEPALIVE, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
305         NET_SOCKET_SO_LINGER, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
306         NET_SOCKET_SO_OOBINLINE, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
307         NET_SOCKET_SO_RCVBUF, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
308         NET_SOCKET_SO_RCVLOWAT, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible (Currently, not supported)
309         NET_SOCKET_SO_RCVTIMEO, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
310         NET_SOCKET_SO_REUSEADDR, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
311         NET_SOCKET_SO_SNDBUF, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
312         NET_SOCKET_SO_SNDLOWAT, // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application. The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible (Currently, not supported)
313         NET_SOCKET_SO_SNDTIMEO, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
314         NET_SOCKET_SO_TYPE, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Only Get is possible */
315
316         //Secure Socket only
317         NET_SOCKET_SO_SSLVERSION, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
318         NET_SOCKET_SO_SSLCIPHERSUITEID, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Set/Get is possible */
319         NET_SOCKET_SO_SSLCERTVERIFY, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Only Set is possible */
320         NET_SOCKET_SO_SSLCERTID, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Only Set is possible */
321         NET_SOCKET_SO_SSLCLIENTCERTVERIFY, /**< The option name is Level: NET_SOCKET_SOL_SOCKET - Only Set is possible */
322         NET_SOCKET_OPTNAME_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
323 };
324
325 enum NetSocketClosedReason {
326         NET_SOCKET_CLOSED_REASON_NORMAL = 1, /**< A normal closed status by peer */
327         NET_SOCKET_CLOSED_REASON_TIMEOUT, /**< The connection attempt failed due to timeout */
328         NET_SOCKET_CLOSED_REASON_NETWORK_UNAVAILABLE, /**< The network is unavailable */
329         NET_SOCKET_CLOSED_REASON_SYSTEM, /**< An internal error has occurred */
330         NET_SOCKET_CLOSED_REASON_NO_CERTIFICATE, /**< The reason is there is no client's SSL certificate */
331         NET_SOCKET_CLOSED_REASON_BY_USER, /**< The connection closed by user */
332         NET_SOCKET_CLOSED_REASON_NONE = 0 // This enum value is for internal use only. Using this enum value can cause behavioral, security-related, and consistency-related issues in the application.
333 };
334
335 class Socket;
336
337 class _LingerOptionImpl;
338 class LingerOption {
339 public:
340         LingerOption(bool enable, int seconds);
341         virtual ~LingerOption(void);
342         LingerOption(const LingerOption& rhs);
343         LingerOption& operator =(const LingerOption& rhs);
344         virtual bool Equals(const Tizen::Base::Object& obj) const;
345         virtual int GetHashCode(void) const;
346 public:
347         void SetEnabled(bool on);
348         void SetLingerTime(int seconds);
349         int GetLingerTime(void) const;
350         bool IsEnabled(void) const;
351 private:
352         LingerOption(void);
353 private:
354         _LingerOptionImpl* __pLingerOptionImpl;
355         friend class _LingerOptionImpl;
356 };
357
358 class _IpMulticastRequestOptionImpl;
359 class IpMulticastRequestOption {
360 public:
361         IpMulticastRequestOption(const NetEndPoint& multicastAddress,
362                         const NetEndPoint& interfaceAddress);
363         virtual ~IpMulticastRequestOption(void);
364         IpMulticastRequestOption(const IpMulticastRequestOption& rhs);
365         IpMulticastRequestOption& operator =(const IpMulticastRequestOption& rhs);
366 public:
367         result SetMulticastEndPoint(NetEndPoint& multicastAddress);
368         result SetInterfaceEndPoint(NetEndPoint& interfaceAddress);
369         const NetEndPoint* GetMulticastEndPoint(void) const;
370         const NetEndPoint* GetInterfaceEndPoint(void) const;
371         virtual bool Equals(const Tizen::Base::Object& obj) const;
372         virtual int GetHashCode(void) const;
373 private:
374         IpMulticastRequestOption(void);
375 private:
376         _IpMulticastRequestOptionImpl* __pIpMulticastRequestOptionImpl;
377         friend class _IpMulticastRequestOptionImpl;
378 };
379
380 class ISocketEventListener {
381 public:
382         virtual ~ISocketEventListener(void) {
383         }
384 public:
385         virtual void OnSocketConnected(Socket& socket) = 0;
386         virtual void OnSocketClosed(Socket& socket,
387                         NetSocketClosedReason reason) = 0;
388         virtual void OnSocketReadyToReceive(Socket& socket) = 0;
389         virtual void OnSocketReadyToSend(Socket& socket) = 0;
390         virtual void OnSocketAccept(Socket& socket) = 0;
391 protected:
392         virtual void ISocketEventListener_Reserved1(void) {
393         }
394         virtual void ISocketEventListener_Reserved2(void) {
395         }
396 };
397
398 class Socket {
399 public:
400         result Construct(NetSocketAddressFamily addressFamily,
401                         NetSocketType socketType, NetSocketProtocol protocol);
402         result Construct(const NetConnection& netConnection,
403                         NetSocketAddressFamily addressFamily, NetSocketType socketType,
404                         NetSocketProtocol protocol);
405         result Bind(const Tizen::Net::NetEndPoint& localEndPoint);
406         result Listen(int backLog);
407         result Connect(const Tizen::Net::NetEndPoint& remoteEndPoint);
408         Socket* AcceptN(void) const;
409         result Receive(Tizen::Base::ByteBuffer& buffer) const;
410         result Receive(void* pBuffer, int length, int& rcvdLength) const;
411         result ReceiveFrom(Tizen::Base::ByteBuffer& buffer,
412                         Tizen::Net::NetEndPoint& remoteEndPoint) const;
413         result ReceiveFrom(void* pBuffer, int length,
414                         Tizen::Net::NetEndPoint& remoteEndPoint, int& rcvdLength) const;
415         result Send(Tizen::Base::ByteBuffer& buffer);
416         result Send(void* pBuffer, int length, int& sentLength);
417         result SendTo(Tizen::Base::ByteBuffer& buffer,
418                         const Tizen::Net::NetEndPoint& remoteEndPoint);
419         result SendTo(void* pBuffer, int length,
420                         const Tizen::Net::NetEndPoint& remoteEndPoint, int& sentLength);
421         result Close(void);
422
423         result SetSockOpt(NetSocketOptLevel optionLevel,
424                         NetSocketOptName optionName, int optionValue);
425         result SetSockOpt(NetSocketOptLevel optionLevel,
426                         NetSocketOptName optionName, const LingerOption& optionValue);
427         result SetSockOpt(NetSocketOptLevel optionLevel,
428                         NetSocketOptName optionName,
429                         const IpMulticastRequestOption& optionValue);
430         result Ioctl(NetSocketIoctlCmd cmd, unsigned long& value) const;
431         result AddSocketListener(ISocketEventListener& listener);
432         result AsyncSelectByListener(unsigned long socketEventType);
433         result RemoveSocketListener(ISocketEventListener& listener);
434         result GetSockOpt(NetSocketOptLevel optionLevel,
435                         NetSocketOptName optionName, int& optionValue) const;
436         result GetSockOpt(NetSocketOptLevel optionLevel,
437                         NetSocketOptName optionName, LingerOption& optionValue) const;
438 };
439
440 result Socket::Construct(NetSocketAddressFamily addressFamily,
441                 NetSocketType socketType, NetSocketProtocol protocol) {
442         typedef result (Socket::*methodType)(NetSocketAddressFamily addressFamily,
443                         NetSocketType socketType, NetSocketProtocol protocol);
444         static methodType Constructp;
445         result retVal;
446
447         BEFORE_ORIGINAL_TIZEN_NET(
448                         _ZN5Tizen3Net7Sockets6Socket9ConstructENS1_22NetSocketAddressFamilyENS1_13NetSocketTypeENS1_17NetSocketProtocolE,
449                         Constructp);
450
451         retVal = (this->*Constructp)(addressFamily, socketType, protocol);
452
453         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Construct", VT_ULONG, retVal,
454                         (unsigned int)this, (unsigned int)this, SOCKET_API_FD_OPEN, 
455                         info, "ddd", addressFamily, socketType, protocol);
456
457         return retVal;
458 }
459
460 result Socket::Construct(const NetConnection& netConnection,
461                 NetSocketAddressFamily addressFamily, NetSocketType socketType,
462                 NetSocketProtocol protocol) {
463         typedef result (Socket::*methodType)(const NetConnection& netConnection,
464                         NetSocketAddressFamily addressFamily, NetSocketType socketType,
465                         NetSocketProtocol protocol);
466         static methodType Constructp;
467         result retVal;
468
469         BEFORE_ORIGINAL_TIZEN_NET(
470                         _ZN5Tizen3Net7Sockets6Socket9ConstructERKNS0_13NetConnectionENS1_22NetSocketAddressFamilyENS1_13NetSocketTypeENS1_17NetSocketProtocolE,
471                         Constructp);
472
473         retVal = (this->*Constructp)(netConnection, addressFamily, socketType,
474                         protocol);
475
476         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Construct", VT_ULONG, retVal,
477                         (unsigned int)this, (unsigned int)this, SOCKET_API_FD_OPEN, 
478                         info, "xddd",
479                         (unsigned int)&netConnection, addressFamily, socketType, protocol);
480
481         return retVal;
482 }
483
484 Socket* Socket::AcceptN(void) const {
485         typedef Socket* (Socket::*methodType)(void) const;
486         static methodType AcceptNp;
487         Socket* pret;
488
489         BEFORE_ORIGINAL_TIZEN_NET( _ZNK5Tizen3Net7Sockets6Socket7AcceptNEv,
490                         AcceptNp);
491
492         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::AcceptN", VT_NULL, NULL,
493                         (unsigned int)this, (unsigned int)this, SOCKET_API_ACCEPT_START, 
494                         info, "s", "void");
495
496         pret = (this->*AcceptNp)();
497         if (pret == NULL)
498                 newerrno = 1;
499         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::AcceptN", VT_PTR, pret,
500                         (unsigned int)this, (unsigned int)this, SOCKET_API_ACCEPT_END, 
501                         info, "s", "void");
502
503         return pret;
504 }
505
506 result Socket::Connect(const Tizen::Net::NetEndPoint& remoteEndPoint) {
507         typedef result (Socket::*methodType)(
508                         const Tizen::Net::NetEndPoint& remoteEndPoint);
509         static methodType Connectp;
510         result retVal;
511
512         BEFORE_ORIGINAL_TIZEN_NET(
513                         _ZN5Tizen3Net7Sockets6Socket7ConnectERKNS0_11NetEndPointE,
514                         Connectp);
515
516         Ip4Address* iv4PeerAddr = (Ip4Address*) remoteEndPoint.GetAddress();
517
518         char temp[64];
519         WcharToChar(temp, iv4PeerAddr->ToString().GetPointer());
520         char addressInfo[64];
521         sprintf(addressInfo, "%s:%d", temp, remoteEndPoint.GetPort());
522         info.host_port = remoteEndPoint.GetPort();
523         iv4PeerAddr->GetAddress(&info.host_ip);
524         retVal = (this->*Connectp)(remoteEndPoint);
525
526
527         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Connect", VT_ULONG, retVal,
528                         (unsigned int)this, (unsigned int)this, SOCKET_API_CONNECT, 
529                         info, "s", addressInfo);
530
531         return retVal;
532 }
533
534 result Socket::Close(void) {
535         typedef result (Socket::*methodType)(void);
536         static methodType Closep;
537         result retVal;
538
539         BEFORE_ORIGINAL_TIZEN_NET( _ZN5Tizen3Net7Sockets6Socket5CloseEv, Closep);
540
541         retVal = (this->*Closep)();
542
543         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Close", VT_ULONG, retVal,
544                         (unsigned int)this, (unsigned int)this, SOCKET_API_FD_CLOSE, 
545                         info, "s", "void");
546
547         return retVal;
548 }
549
550 result Socket::Bind(const Tizen::Net::NetEndPoint& localEndPoint) {
551         typedef result (Socket::*methodType)(
552                         const Tizen::Net::NetEndPoint& localEndPoint);
553         static methodType Bindp;
554         result retVal;
555
556         BEFORE_ORIGINAL_TIZEN_NET(
557                         _ZN5Tizen3Net7Sockets6Socket4BindERKNS0_11NetEndPointE, Bindp);
558
559         retVal = (this->*Bindp)(localEndPoint);
560
561         Ip4Address* iv4PeerAddr = (Ip4Address*) localEndPoint.GetAddress();
562         char temp[64];
563         WcharToChar(temp, iv4PeerAddr->ToString().GetPointer());
564         char addressInfo[64];
565         sprintf(addressInfo, "%s:%d", temp, localEndPoint.GetPort());
566         info.host_port = localEndPoint.GetPort();
567         iv4PeerAddr->GetAddress(&info.host_ip);
568
569         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Bind", VT_ULONG, retVal,
570                         (unsigned int)this, (unsigned int)this, SOCKET_API_BIND, 
571                         info, "s", addressInfo);
572         return retVal;
573 }
574
575 result Socket::Listen(int backLog) {
576         typedef result (Socket::*methodType)(int backLog);
577         static methodType Listenp;
578         result retVal;
579
580         BEFORE_ORIGINAL_TIZEN_NET( _ZN5Tizen3Net7Sockets6Socket6ListenEi, Listenp);
581
582         retVal = (this->*Listenp)(backLog);
583
584         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Listen", VT_ULONG, retVal,
585                         (unsigned int)this, (unsigned int)this, SOCKET_API_LISTEN, 
586                         info, "d", backLog);
587
588         return retVal;
589 }
590
591 result Socket::Receive(Tizen::Base::ByteBuffer& buffer) const {
592         typedef result (Socket::*methodType)(Tizen::Base::ByteBuffer& buffer) const;
593         static methodType Receivep;
594         result pret;
595
596         BEFORE_ORIGINAL_TIZEN_NET(
597                         _ZNK5Tizen3Net7Sockets6Socket7ReceiveERNS_4Base10ByteBufferE,
598                         Receivep);
599
600         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::Receive", VT_NULL, NULL,
601                         (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_START,
602                         info, "x", (unsigned int)&buffer);
603
604         pret = (this->*Receivep)(buffer);
605
606         info.msg_total_size = buffer.GetLimit();
607         info.msg_pack_size = info.msg_total_size;
608         info.msg_buf = (char*)(buffer.GetPointer());
609
610         if (info.msg_pack_size > SOCKET_SEND_SIZE)
611                 info.msg_pack_size = SOCKET_SEND_SIZE;
612
613         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::Receive", VT_ULONG, pret,
614                         (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_END,
615                         info, "x", (unsigned int)&buffer);
616         return pret;
617 }
618
619 result Socket::Receive(void* pBuffer, int length, int& rcvdLength) const {
620         typedef result (Socket::*methodType)(void* pBuffer, int length,
621                         int& rcvdLength) const;
622         static methodType Receivep;
623         result pret;
624
625         BEFORE_ORIGINAL_TIZEN_NET(
626                         _ZNK5Tizen3Net7Sockets6Socket11ReceiveFromEPviRNS0_11NetEndPointERi,
627                         Receivep);
628
629         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::Receive", VT_NULL, NULL,
630                         (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_START, 
631                         info, "xdx",
632                         (unsigned int)&pBuffer, length, rcvdLength);
633
634         pret = (this->*Receivep)(pBuffer, length, rcvdLength);
635         info.msg_buf = (char *)pBuffer;
636         info.msg_total_size = rcvdLength;
637         info.msg_pack_size = rcvdLength > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : rcvdLength;
638
639         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::Receive", VT_ULONG, pret,
640                         (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_END,
641                         info, "xdx", (unsigned int)&pBuffer, length, rcvdLength);
642
643         return pret;
644 }
645
646 result Socket::ReceiveFrom(Tizen::Base::ByteBuffer& buffer,
647                 Tizen::Net::NetEndPoint& remoteEndPoint) const {
648         typedef result (Socket::*methodType)(Tizen::Base::ByteBuffer& buffer,
649                         Tizen::Net::NetEndPoint& remoteEndPoint) const;
650         static methodType ReceiveFromp;
651         result pret;
652
653         BEFORE_ORIGINAL_TIZEN_NET(
654                         _ZNK5Tizen3Net7Sockets6Socket11ReceiveFromERNS_4Base10ByteBufferERNS0_11NetEndPointE,
655                         ReceiveFromp);
656
657         Ip4Address* iv4PeerAddr = (Ip4Address*) remoteEndPoint.GetAddress();
658         char temp[64];
659         WcharToChar(temp, iv4PeerAddr->ToString().GetPointer());
660         char addressInfo[64];
661         sprintf(addressInfo, "%s:%d", temp, remoteEndPoint.GetPort());
662         info.host_port = remoteEndPoint.GetPort();
663         iv4PeerAddr->GetAddress(&info.host_ip);
664
665         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::ReceiveFrom", VT_NULL,
666                         NULL, (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_START,
667                         
668                         info, "xs", (unsigned int)&buffer, temp);
669
670         pret = (this->*ReceiveFromp)(buffer, remoteEndPoint);
671
672         int bufferSize = buffer.GetLimit();
673         char* pBuffer = (char*) (buffer.GetPointer());
674         Tizen::Base::String strData;
675         strData.SetCapacity(bufferSize);
676         strData.Append(pBuffer);
677         char* out = new char[bufferSize];
678         WcharToChar(out, strData.GetPointer());
679
680         info.msg_buf = out;
681         info.msg_total_size = bufferSize;
682         info.msg_pack_size = bufferSize > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : bufferSize;
683
684         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::ReceiveFrom", VT_ULONG,
685                         pret, (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_END,
686                         info, "xs", (unsigned int)&buffer, temp);
687         delete [] out;
688         return pret;
689 }
690 result Socket::ReceiveFrom(void* pBuffer, int length,
691                 Tizen::Net::NetEndPoint& remoteEndPoint, int& rcvdLength) const {
692         typedef result (Socket::*methodType)(void* pBuffer, int length,
693                         Tizen::Net::NetEndPoint& remoteEndPoint, int& rcvdLength) const;
694         static methodType ReceiveFromp;
695         result pret;
696
697         BEFORE_ORIGINAL_TIZEN_NET(
698                         _ZNK5Tizen3Net7Sockets6Socket11ReceiveFromEPviRNS0_11NetEndPointERi,
699                         ReceiveFromp);
700
701         Ip4Address* iv4PeerAddr = (Ip4Address*) remoteEndPoint.GetAddress();
702         char temp[64];
703         WcharToChar(temp, iv4PeerAddr->ToString().GetPointer());
704         char addressInfo[64];
705         sprintf(addressInfo, "%s:%d", temp, remoteEndPoint.GetPort());
706         info.host_port = remoteEndPoint.GetPort();
707         iv4PeerAddr->GetAddress(&info.host_ip);
708
709         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::ReceiveFrom", VT_NULL,
710                         NULL, (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_START,
711                          info, "xdsx",
712                         (unsigned int)&pBuffer, length, temp, rcvdLength);
713
714         pret = (this->*ReceiveFromp)(pBuffer, length, remoteEndPoint, rcvdLength);
715
716         info.msg_buf = (char *)pBuffer;
717         info.msg_total_size = length;
718         info.msg_pack_size = length > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : length;
719
720         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::ReceiveFrom", VT_ULONG,
721                         pret, (unsigned int)this, (unsigned int)this, SOCKET_API_RECV_END,
722                         info, "xdsx", (unsigned int)&pBuffer, length, temp, rcvdLength);
723
724         return pret;
725 }
726
727 result Socket::Send(Tizen::Base::ByteBuffer& buffer) {
728         typedef result (Socket::*methodType)(Tizen::Base::ByteBuffer& buffer);
729         static methodType Sendp;
730         result pret;
731
732         BEFORE_ORIGINAL_TIZEN_NET(
733                         _ZN5Tizen3Net7Sockets6Socket4SendERNS_4Base10ByteBufferE, Sendp);
734
735         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::Send", VT_NULL, NULL,
736                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_START,
737                         info, "x", (unsigned int)&buffer);
738
739         pret = (this->*Sendp)(buffer);
740         int bufferSize = buffer.GetLimit();
741         char* pBuffer = (char*) (buffer.GetPointer());
742         Tizen::Base::String strData;
743         strData.SetCapacity(bufferSize);
744         strData.Append(pBuffer);
745         char* out = new char[bufferSize];
746         WcharToChar(out, strData.GetPointer());
747
748         info.msg_buf = out;
749         info.msg_total_size = bufferSize;
750         info.msg_pack_size = bufferSize > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : bufferSize;
751
752         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::Send", VT_ULONG, pret,
753                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_END,
754                         info, "x", (unsigned int)&buffer);
755         delete [] out;
756         return pret;
757 }
758
759 result Socket::Send(void* pBuffer, int length, int& sentLength) {
760         typedef result (Socket::*methodType)(void* pBuffer, int length,
761                         int& sentLength);
762         static methodType Sendp;
763         result pret;
764
765         BEFORE_ORIGINAL_TIZEN_NET(
766                         _ZZN5Tizen3Net7Sockets6Socket4SendEPviRiE19__PRETTY_FUNCTION__,
767                         Sendp);
768
769         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::Send", VT_NULL, NULL,
770                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_START, 
771                         info, "xdx",
772                         (unsigned int)&pBuffer, length, (unsigned int)&sentLength);
773
774         pret = (this->*Sendp)(pBuffer, length, sentLength);
775
776         info.msg_buf = (char *)pBuffer;
777         info.msg_total_size = length;
778         info.msg_pack_size = length > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : length;
779
780         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::Send", VT_ULONG, pret,
781                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_END,
782                         info, "xdx", (unsigned int)&pBuffer, length, (unsigned int)&sentLength);
783
784         return pret;
785
786 }
787
788 result Socket::SendTo(Tizen::Base::ByteBuffer& buffer,
789                 const Tizen::Net::NetEndPoint& remoteEndPoint) {
790         typedef result (Socket::*methodType)(Tizen::Base::ByteBuffer& buffer,
791                         const Tizen::Net::NetEndPoint& remoteEndPoint);
792         static methodType SendTop;
793         result pret;
794
795         BEFORE_ORIGINAL_TIZEN_NET(
796                         _ZN5Tizen3Net7Sockets6Socket6SendToERNS_4Base10ByteBufferERKNS0_11NetEndPointE,
797                         SendTop);
798
799         Ip4Address* iv4PeerAddr = (Ip4Address*) remoteEndPoint.GetAddress();
800         char temp[64];
801         WcharToChar(temp, iv4PeerAddr->ToString().GetPointer());
802         char addressInfo[64];
803         sprintf(addressInfo, "%s:%d", temp, remoteEndPoint.GetPort());
804         info.host_port = remoteEndPoint.GetPort();
805         iv4PeerAddr->GetAddress(&info.host_ip);
806
807         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::SendTo", VT_NULL, NULL,
808                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_START, 
809                         info, "xs", (unsigned int)&buffer, temp);
810
811         pret = (this->*SendTop)(buffer, remoteEndPoint);
812
813         int bufferSize = buffer.GetLimit();
814         char* pBuffer = (char*) (buffer.GetPointer());
815         Tizen::Base::String strData;
816         strData.SetCapacity(bufferSize);
817         strData.Append(pBuffer);
818         char* out = new char[bufferSize];
819         WcharToChar(out, strData.GetPointer());
820
821         info.msg_buf = out;
822         info.msg_total_size = bufferSize;
823         info.msg_pack_size = bufferSize > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : bufferSize;
824
825         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::SendTo", VT_ULONG, pret,
826                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_END,
827                         info, "xs", (unsigned int)&buffer, temp);
828         delete [] out;
829         return pret;
830 }
831
832 result Socket::SendTo(void* pBuffer, int length,
833                 const Tizen::Net::NetEndPoint& remoteEndPoint, int& sentLength) {
834         typedef result (Socket::*methodType)(void* pBuffer, int length,
835                         const Tizen::Net::NetEndPoint& remoteEndPoint, int& sentLength);
836         static methodType SendTop;
837         result pret;
838
839         BEFORE_ORIGINAL_TIZEN_NET(
840                         _ZN5Tizen3Net7Sockets6Socket6SendToEPviRKNS0_11NetEndPointERi,
841                         SendTop);
842
843         Ip4Address* iv4PeerAddr = (Ip4Address*) remoteEndPoint.GetAddress();
844         char temp[64];
845         WcharToChar(temp, iv4PeerAddr->ToString().GetPointer());
846         char addressInfo[64];
847         sprintf(addressInfo, "%s:%d", temp, remoteEndPoint.GetPort());
848         info.host_port = remoteEndPoint.GetPort();
849         iv4PeerAddr->GetAddress(&info.host_ip);
850
851         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_START("Socket::SendTo", VT_NULL, NULL,
852                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_START, 
853                         info, "xdsx,",
854                         (unsigned int)&pBuffer, length, temp, (unsigned int)&sentLength);
855
856         pret = (this->*SendTop)(pBuffer, length, remoteEndPoint, sentLength);
857
858         info.msg_buf = (char *)pBuffer;
859         info.msg_total_size = length;
860         info.msg_pack_size = length > SOCKET_SEND_SIZE ? SOCKET_SEND_SIZE : length;
861
862         AFTER_ORIGINAL_TIZEN_SOCK_WAIT_FUNC_END("Socket::SendTo", VT_ULONG, pret,
863                         (unsigned int)this, (unsigned int)this, SOCKET_API_SEND_END,
864                         info, "xdsx,", (unsigned int)&pBuffer, length, temp,
865                         (unsigned int)&sentLength);
866
867         return pret;
868
869 }
870
871 //Option
872 result Socket::AddSocketListener(ISocketEventListener& listener) {
873         typedef result (Socket::*methodType)(ISocketEventListener& listener);
874         static methodType AddSocketListenerp;
875         result retVal;
876
877         BEFORE_ORIGINAL_TIZEN_NET(
878                         _ZN5Tizen3Net7Sockets6Socket17AddSocketListenerERNS1_20ISocketEventListenerE,
879                         AddSocketListenerp);
880
881         retVal = (this->*AddSocketListenerp)(listener);
882
883         AFTER_ORIGINAL_TIZEN_SOCK("Socket::AddSocketListener", VT_ULONG, retVal,
884                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
885                         "x", (unsigned int) &listener);
886
887         return retVal;
888 }
889
890 result Socket::AsyncSelectByListener(unsigned long socketEventType) {
891         typedef result (Socket::*methodType)(unsigned long socketEventType);
892         static methodType AsyncSelectByListenerp;
893         result retVal;
894
895         BEFORE_ORIGINAL_TIZEN_NET(
896                         _ZN5Tizen3Net7Sockets6Socket21AsyncSelectByListenerEm,
897                         AsyncSelectByListenerp);
898
899         retVal = (this->*AsyncSelectByListenerp)(socketEventType);
900
901         AFTER_ORIGINAL_TIZEN_SOCK("Socket::AsyncSelectByListener", VT_ULONG, retVal,
902                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
903                         "x", socketEventType);
904
905         return retVal;
906 }
907
908 result Socket::Ioctl(NetSocketIoctlCmd cmd, unsigned long& value) const {
909         typedef result (Socket::*methodType)(NetSocketIoctlCmd cmd,
910                         unsigned long& value) const;
911         static methodType Ioctlp;
912         result retVal;
913
914         BEFORE_ORIGINAL_TIZEN_NET(
915                         _ZNK5Tizen3Net7Sockets6Socket5IoctlENS1_17NetSocketIoctlCmdERm,
916                         Ioctlp);
917
918         retVal = (this->*Ioctlp)(cmd, value);
919
920         AFTER_ORIGINAL_TIZEN_SOCK("Socket::Ioctl", VT_ULONG, retVal,
921                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
922                         "dx", cmd, (unsigned int) &value);
923
924         return retVal;
925 }
926
927 result Socket::SetSockOpt(NetSocketOptLevel optionLevel,
928                 NetSocketOptName optionName, int optionValue) {
929         typedef result (Socket::*methodType)(NetSocketOptLevel optionLevel,
930                         NetSocketOptName optionName, int optionValue);
931         static methodType SetSockOptp;
932         result retVal;
933
934         BEFORE_ORIGINAL_TIZEN_NET(
935                         _ZN5Tizen3Net7Sockets6Socket10SetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameEi,
936                         SetSockOptp);
937
938         retVal = (this->*SetSockOptp)(optionLevel, optionName, optionValue);
939
940         AFTER_ORIGINAL_TIZEN_SOCK("Socket::SetSockOpt", VT_ULONG, retVal,
941                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
942                         "ddd", optionLevel, optionName, optionValue);
943
944         return retVal;
945 }
946 result Socket::SetSockOpt(NetSocketOptLevel optionLevel,
947                 NetSocketOptName optionName, const LingerOption& optionValue) {
948         typedef result (Socket::*methodType)(NetSocketOptLevel optionLevel,
949                         NetSocketOptName optionName, const LingerOption& optionValue);
950         static methodType SetSockOptp;
951         result retVal;
952
953         BEFORE_ORIGINAL_TIZEN_NET(
954                         _ZN5Tizen3Net7Sockets6Socket10SetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameERKNS1_12LingerOptionE,
955                         SetSockOptp);
956
957         retVal = (this->*SetSockOptp)(optionLevel, optionName, optionValue);
958
959         AFTER_ORIGINAL_TIZEN_SOCK("Socket::SetSockOpt", VT_ULONG, retVal,
960                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
961                         "ddx",
962                         optionLevel, optionName, (unsigned int) &optionValue);
963
964         return retVal;
965 }
966 result Socket::SetSockOpt(NetSocketOptLevel optionLevel,
967                 NetSocketOptName optionName,
968                 const IpMulticastRequestOption& optionValue) {
969         typedef result (Socket::*methodType)(NetSocketOptLevel optionLevel,
970                         NetSocketOptName optionName,
971                         const IpMulticastRequestOption& optionValue);
972         static methodType SetSockOptp;
973         result retVal;
974
975         BEFORE_ORIGINAL_TIZEN_NET(
976                         _ZN5Tizen3Net7Sockets6Socket10SetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameERKNS1_12LingerOptionE,
977                         SetSockOptp);
978
979         retVal = (this->*SetSockOptp)(optionLevel, optionName, optionValue);
980
981         AFTER_ORIGINAL_TIZEN_SOCK("Socket::SetSockOpt", VT_ULONG, retVal,
982                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
983                         "ddx",
984                         optionLevel, optionName, (unsigned int) &optionValue);
985
986         return retVal;
987 }
988
989 result Socket::GetSockOpt(NetSocketOptLevel optionLevel,
990                 NetSocketOptName optionName, int& optionValue) const {
991         typedef result (Socket::*methodType)(NetSocketOptLevel optionLevel,
992                         NetSocketOptName optionName, int& optionValue) const;
993         static methodType GetSockOptp;
994         result retVal;
995
996         BEFORE_ORIGINAL_TIZEN_NET(
997                         _ZNK5Tizen3Net7Sockets6Socket10GetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameERi,
998                         GetSockOptp);
999
1000         retVal = (this->*GetSockOptp)(optionLevel, optionName, optionValue);
1001
1002         AFTER_ORIGINAL_TIZEN_SOCK("Socket::GetSockOpt", VT_ULONG, retVal,
1003                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
1004                         "ddx",
1005                         optionLevel, optionName, (unsigned int) &optionValue);
1006
1007         return retVal;
1008 }
1009
1010 result Socket::GetSockOpt(NetSocketOptLevel optionLevel,
1011                 NetSocketOptName optionName, LingerOption& optionValue) const {
1012         typedef result (Socket::*methodType)(NetSocketOptLevel optionLevel,
1013                         NetSocketOptName optionName, LingerOption& optionValue) const;
1014         static methodType GetSockOptp;
1015         result retVal;
1016
1017         BEFORE_ORIGINAL_TIZEN_NET(
1018                         _ZNK5Tizen3Net7Sockets6Socket10GetSockOptENS1_17NetSocketOptLevelENS1_16NetSocketOptNameERNS1_12LingerOptionE,
1019                         GetSockOptp);
1020
1021         retVal = (this->*GetSockOptp)(optionLevel, optionName, optionValue);
1022
1023         AFTER_ORIGINAL_TIZEN_SOCK("Socket::GetSockOpt", VT_ULONG, retVal,
1024                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
1025                         "ddx",
1026                         optionLevel, optionName, (unsigned int) &optionValue);
1027
1028         return retVal;
1029 }
1030
1031 result Socket::RemoveSocketListener(ISocketEventListener& listener) {
1032         typedef result (Socket::*methodType)(ISocketEventListener& listener);
1033         static methodType RemoveSocketListenerp;
1034         result retVal;
1035
1036         BEFORE_ORIGINAL_TIZEN_NET(
1037                         _ZN5Tizen3Net7Sockets6Socket20RemoveSocketListenerERNS1_20ISocketEventListenerE,
1038                         RemoveSocketListenerp);
1039
1040         retVal = (this->*RemoveSocketListenerp)(listener);
1041
1042         AFTER_ORIGINAL_TIZEN_SOCK("Socket::RemoveSocketListener", VT_ULONG, retVal,
1043                         (unsigned int)this, (unsigned int)this, SOCKET_API_OTHER, info,
1044                         "x", (unsigned int) &listener);
1045
1046         return retVal;
1047 }
1048
1049 }
1050 }
1051 } //namespace Tizen {namespace Net {namespace Sockets {
1052