Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cNetPort.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cNetPort_H
7 #define _INC_cNetPort_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "../GrayLibBase.h"
15 
16 namespace GrayLib
17 {
19 
21  typedef WORD NET_PORT_t;
22 
23  static const StrLen_t k_NET_HOSTNAME_MAX = 1024;
24 
26  static const NET_PORT_t k_NET_PORT_INVALID = 0;
27  static const NET_PORT_t k_NET_PORT_RESERVE = 1024;
28  static const NET_PORT_t k_NET_PORT_TEMP = 49152;
29  static const NET_PORT_t k_NET_PORT_MAX = 0xFFFF;
30 
32  {
43 
44  // NETSERVICE_mailto, // IPPORT_SMTP. none secure.
45  // NETSERVICE_mailsec, // secure mail.
46  // NETSERVICE_ssh, // TLS secure shell.
47 
49  // NETSERVICE_socks, // SOCKS port 1080. proxy.
50  // NETSERVICE_news, // NNTP
51  // NETSERVICE_rtp, // Data stream (http://en.wikipedia.org/wiki/Real-time_Transport_Protocol)
52  // NETSERVICE_rtsp, // Control stream. (http://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol)
53  // NETSERVICE_sip, // Session initiation protocol.
54  // NETSERVICE_xmpp, // http://en.wikipedia.org/wiki/Extensible_Messaging_and_Presence_Protocol
55  // NETSERVICE_upnp, // Universal plug and play.
56  // echo.
57  // time.
58 
60  };
61 
63  {
69 
70  public:
71  static const char* k_Prefix_Http;
72  static const char* k_Prefix_Https;
73  static const NET_PORT_t k_Default_Http = 80; // port 80 = HTTP default = IPPORT_HTTP = INTERNET_DEFAULT_HTTP_PORT
74 
75  static const cNetPort k_Services[NETSERVICE_QTY + 1];
76 
77  const char* m_pszName;
79 
80  public:
81  static NET_PORT_t GRAYCALL FindPortByServiceName(const char* pszPort);
82  static cStringA GRAYCALL FindServiceNameByPort(NET_PORT_t wPort);
83 
85  };
86 };
87 #endif // _INC_cNetPort_H
#define GRAYCALL
declare calling convention for static functions so everyone knows the arg passing scheme....
Definition: GrayCore.h:36
#define GRAYLIB_LINK
Definition: GrayLibBase.h:35
Definition: cNetPort.h:63
static const char * k_Prefix_Http
Definition: cNetPort.h:71
NET_PORT_t m_wPortDefault
default port for the service type.
Definition: cNetPort.h:78
UNITTEST_FRIEND(cNetPort)
static const char * k_Prefix_Https
Definition: cNetPort.h:72
const char * m_pszName
Name of the service. e.g. "http". NI_MAXSERV.
Definition: cNetPort.h:77
Definition: cMesh.h:22
WORD NET_PORT_t
WinINet calls ports NET_PORT_t INTERNET_PORT = a service.
Definition: cNetPort.h:21
UNITTEST2_PREDEF(cQuadtree)
NETSERVICE_TYPE
Definition: cNetPort.h:32
@ NETSERVICE_rtmp
port 1935 = Flash video. (http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol)
Definition: cNetPort.h:48
@ NETSERVICE_ftps
port 990 = FTPS command port. explicit SSL/TLS mode.
Definition: cNetPort.h:40
@ NETSERVICE_file
local file system. Not really a port at all.
Definition: cNetPort.h:38
@ NETSERVICE_ftp
port 21 = IPPORT_FTP command port. INTERNET_DEFAULT_FTP_PORT
Definition: cNetPort.h:39
@ NETSERVICE_https
port 443 (NOT the same as S-HTTP) INTERNET_DEFAULT_HTTPS_PORT
Definition: cNetPort.h:42
@ NETSERVICE_UNDEF
undefined service.
Definition: cNetPort.h:37
@ NETSERVICE_QTY
Definition: cNetPort.h:59
@ NETSERVICE_http
port 80 = IPPORT_HTTP = HTTP default = INTERNET_DEFAULT_HTTP_PORT =
Definition: cNetPort.h:41
int StrLen_t
the length of a string in chars (bytes for UTF8, wchar_t for UNICODE). or offset in characters....
Definition: StrConst.h:32