Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 984 | runge | 1 | /*************************************************************************** |
| 2 | * Copyright (C) December 30, 2008 by Mattias Runge * |
||
| 3 | * mattias@runge.se * |
||
| 4 | * socketevent.h * |
||
| 5 | * * |
||
| 6 | * This program is free software; you can redistribute it and/or modify * |
||
| 7 | * it under the terms of the GNU General Public License as published by * |
||
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
||
| 9 | * (at your option) any later version. * |
||
| 10 | * * |
||
| 11 | * This program is distributed in the hope that it will be useful, * |
||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
| 14 | * GNU General Public License for more details. * |
||
| 15 | * * |
||
| 16 | * You should have received a copy of the GNU General Public License * |
||
| 17 | * along with this program; if not, write to the * |
||
| 18 | * Free Software Foundation, Inc., * |
||
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
| 20 | ***************************************************************************/ |
||
| 21 | |||
| 22 | #ifndef _SOCKETEVENT_H |
||
| 23 | #define _SOCKETEVENT_H |
||
| 24 | |||
| 25 | using namespace std; |
||
| 26 | |||
| 27 | #include <string> |
||
| 28 | |||
| 29 | #define ASYNCSOCKET_EVENT_NONE 0 |
||
| 30 | #define ASYNCSOCKET_EVENT_DATA 1 |
||
| 31 | #define ASYNCSOCKET_EVENT_CONNECTED 2 |
||
| 32 | #define ASYNCSOCKET_EVENT_CONNECT_FAILED 3 |
||
| 33 | #define ASYNCSOCKET_EVENT_WAITING_TO_RECONNECT 4 |
||
| 34 | #define ASYNCSOCKET_EVENT_CLOSED 5 |
||
| 35 | #define ASYNCSOCKET_EVENT_RESET 6 |
||
| 36 | #define ASYNCSOCKET_EVENT_DIED 7 |
||
| 37 | #define ASYNCSOCKET_EVENT_INACTIVITY 8 |
||
| 38 | |||
| 39 | class SocketEvent |
||
| 40 | { |
||
| 41 | public: |
||
| 42 | SocketEvent(unsigned int type, string data) |
||
| 43 | { |
||
| 44 | myType = type; |
||
| 45 | myData = data; |
||
| 46 | } |
||
| 47 | |||
| 48 | SocketEvent(const SocketEvent& socketEvent) |
||
| 49 | { |
||
| 50 | myType = socketEvent.myType; |
||
| 51 | myData = socketEvent.myData; |
||
| 52 | } |
||
| 53 | |||
| 54 | unsigned int getType() { return myType; }; |
||
| 55 | string getData() { return myData; }; |
||
| 56 | |||
| 57 | static const unsigned int TYPE_NONE = 0; |
||
| 58 | static const unsigned int TYPE_DATA = 1; |
||
| 59 | static const unsigned int TYPE_INACTIVITY = 2; |
||
| 60 | |||
| 61 | static const unsigned int TYPE_CONNECTING = 3; |
||
| 62 | static const unsigned int TYPE_CONNECTED = 4; |
||
| 63 | static const unsigned int TYPE_WAITING_RECONNECT = 5; |
||
| 64 | static const unsigned int TYPE_CONNECTION_CLOSED = 6; |
||
| 65 | static const unsigned int TYPE_CONNECTION_RESET = 7; |
||
| 66 | static const unsigned int TYPE_CONNECTION_DIED = 8; |
||
| 67 | static const unsigned int TYPE_CONNECTION_FAILED = 9; |
||
| 68 | |||
| 69 | private: |
||
| 70 | unsigned int myType; |
||
| 71 | string myData; |
||
| 72 | }; |
||
| 73 | |||
| 74 | #endif /* _SOCKETEVENT_H */ |
||
| 75 |