OverSim
XmlRpcSocket.h
Go to the documentation of this file.
1 #ifndef _XMLRPCSOCKET_H_
2 #define _XMLRPCSOCKET_H_
3 //
4 // XmlRpc++ Copyright (c) 2002-2003 by Chris Morley
5 //
6 
12 #if defined(_MSC_VER)
13 # pragma warning(disable:4786) // identifier was truncated in debug info
14 #endif
15 
16 #ifndef MAKEDEPEND
17 # include <string>
18 #endif
19 
20 #ifdef USE_SSL
21 #include <openssl/ssl.h>
22 #else
23 #define SSL void*
24 #define SSL_read void*
25 #define SSL_write void*
26 #endif
27 
28 namespace XmlRpc {
29 
31  class XmlRpcSocket {
32  public:
33  // TODO - typedef the socket type, casting to int won't work for 64 bit windows
34 
36  static int getSocket();
37 
39  static void close(int socket);
40 
41 
43  static bool setNonBlocking(int socket);
44 
46  static bool nbRead(int socket, std::string& s, bool *eof, SSL *ssl);
47 
49  static bool nbWrite(int socket, std::string& s, int *bytesSoFar, SSL* ssl);
50 
51 
52  // The next four methods are appropriate for servers.
53 
56  static bool setReuseAddr(int socket);
57 
59  static bool bind(int socket, int port);
60 
62  static bool listen(int socket, int backlog);
63 
65  static int accept(int socket);
66 
68  static bool connect(int socket, std::string& host, int port);
69 
71  static int getPort(int socket);
72 
74  static bool nonFatalError();
75 
77  static int getError();
78 
80  static std::string getErrorMsg();
81 
83  static std::string getErrorMsg(int error);
84  };
85 
86 } // namespace XmlRpc
87 
88 #endif