equal
deleted
inserted
replaced
|
1 // Socket.h |
|
2 // |
|
3 // Copyright (c) 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "Eclipse Public License v1.0" |
|
6 // which accompanies this distribution, and is available |
|
7 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // |
|
9 // Initial Contributors: |
|
10 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #if !defined(AFX_SOCKET_H__EE7BB9E5_00B0_4007_A36C_A2251979F83F__INCLUDED_) |
|
14 #define AFX_SOCKET_H__EE7BB9E5_00B0_4007_A36C_A2251979F83F__INCLUDED_ |
|
15 |
|
16 #if _MSC_VER > 1000 |
|
17 #pragma once |
|
18 #endif // _MSC_VER > 1000 |
|
19 |
|
20 #include "Base.h" |
|
21 #include <winsock2.h> |
|
22 #include "Window.h" |
|
23 |
|
24 |
|
25 class CSocket; |
|
26 |
|
27 |
|
28 class MSocketClosureObserver |
|
29 { |
|
30 public: |
|
31 virtual void HandleSocketClosure(CSocket& aSocket) = 0; |
|
32 }; |
|
33 |
|
34 |
|
35 class CSocket : public CBase, public MWindowMessageHandler |
|
36 { |
|
37 public: |
|
38 virtual ~CSocket(); |
|
39 void SetClosureObserver(MSocketClosureObserver* aClosureObserver); |
|
40 protected: |
|
41 CSocket(CWindow& aWindow); |
|
42 CSocket(CWindow& aWindow, SOCKET aSocket); |
|
43 void Construct(); |
|
44 void HandleClosure(); |
|
45 private: // From MWindowMessageHandler. |
|
46 virtual LRESULT HandleWindowMessage(UINT aMessage, WPARAM aWParam, LPARAM aLParam); |
|
47 protected: // New. |
|
48 virtual LRESULT HandleSocketMessage(LPARAM aLParam) = 0; |
|
49 protected: |
|
50 CWindow& iWindow; |
|
51 SOCKET iSocket; |
|
52 private: |
|
53 MSocketClosureObserver* iClosureObserver; |
|
54 }; |
|
55 |
|
56 |
|
57 #endif // !defined(AFX_SOCKET_H__EE7BB9E5_00B0_4007_A36C_A2251979F83F__INCLUDED_) |