OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
wsksockm.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1995, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Winsock for OWL subsystem.
7/// Based on work by Paul Pedriana, 70541.3223@compuserve.com
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_WSKSOCKM_H)
11#define OWL_WSKSOCKM_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/defs.h>
19#include <winsock.h>
20
21
22namespace owl {
23
24#include <owl/preclass.h>
25
26//
27/// \class TSocketInfo
28// ~~~~~ ~~~~~~~~~~~
29/// TSocketInfo encapsulates the structure that contains details of the
30/// Windows Socket implementation. For example, it contains the version
31/// of the Windows Socket specification implemented, the maximum number of
32/// sockets that a single process can open etc. etc.
33//
34class _OWLCLASS TSocketInfo : public WSAData {
35 public:
37};
38
39//
40/// \class TSocketManager
41// ~~~~~ ~~~~~~~~~~~~~~
42/// A class that starts up WinSock and provides information about the system's WinSock.
43//
45 public:
46 TSocketManager(short versionMajor = 1, short versionMinor = 1,
47 bool autoStartup = true);
48 virtual ~TSocketManager();
49
50 void Init(short versionMajor = 1, short versionMinor = 1);
51
52 int Startup();
53 int ShutDown();
54
55 int IsAvailable();
56 int GetMajorVersion();
57 int GetMinorVersion();
58 char* GetDescription();
59 char* GetSystemStatus();
60 ushort GetMaxUdpDgAvailable();
61 ushort GetMaxSocketsAvailable();
62 char * GetVendorInfo();
63 int GetLastError();
64 void Information(TSocketInfo& socketInfo);
65
66 protected:
67 int LastError; ///< Last error code
68 short Available; ///< Flag for Winsock availability
69 short StartupCount; ///< Make sure to not overflow number of connects
70 TSocketInfo SocketInfo; ///< Information about this WinSocket implementation
71 short VersionMajor; ///< Major verion number
72 short VersionMinor; ///< Minor verion number
73};
74
75#include <owl/posclass.h>
76
77
78//----------------------------------------------------------------------------
79// Inline implementations
80//
81
82//
83/// Returns true if WinSock is available.
84//
85inline int
90
91//
92/// Returns the major version of WinSock support.
93//
94inline int
99
100//
101/// Returns the minor version of WinSock support.
102//
103inline int
108
109//
110/// Returns the system's description of WinSock.
111//
112inline char*
114{
115 return SocketInfo.szDescription;
116}
117
118//
119/// Returns the status of WinSock.
120//
121inline char*
123{
124 return SocketInfo.szSystemStatus;
125}
126
127//
128/// Returns maximum number of bytes each UDP packet can be.
129//
130inline ushort
132{
133 return SocketInfo.iMaxUdpDg;
134}
135
136//
137/// Returns maximum number of WinSock connections avaialble.
138//
139inline ushort
141{
142 return SocketInfo.iMaxSockets;
143}
144
145//
146/// Returns this WinSocket's vendor's information.
147//
148inline char *
150{
151 return SocketInfo.lpVendorInfo;
152}
153
154//
155/// Returns the last error code.
156//
157inline int
162
163//
164/// Sets the information about this WinSocket.
165//
166inline void
171
172} // OWL namespace
173
174#endif // OWL_SOCKMGR_H
TSocketInfo encapsulates the structure that contains details of the Windows Socket implementation.
Definition wsksockm.h:34
A class that starts up WinSock and provides information about the system's WinSock.
Definition wsksockm.h:44
int LastError
Last error code.
Definition wsksockm.h:67
short StartupCount
Make sure to not overflow number of connects.
Definition wsksockm.h:69
int IsAvailable()
Returns true if WinSock is available.
Definition wsksockm.h:86
int GetMinorVersion()
Returns the minor version of WinSock support.
Definition wsksockm.h:104
ushort GetMaxSocketsAvailable()
Returns maximum number of WinSock connections avaialble.
Definition wsksockm.h:140
int GetMajorVersion()
Returns the major version of WinSock support.
Definition wsksockm.h:95
int GetLastError()
Returns the last error code.
Definition wsksockm.h:158
char * GetVendorInfo()
Returns this WinSocket's vendor's information.
Definition wsksockm.h:149
char * GetDescription()
Returns the system's description of WinSock.
Definition wsksockm.h:113
char * GetSystemStatus()
Returns the status of WinSock.
Definition wsksockm.h:122
void Information(TSocketInfo &socketInfo)
Sets the information about this WinSocket.
Definition wsksockm.h:167
short Available
Flag for Winsock availability.
Definition wsksockm.h:68
ushort GetMaxUdpDgAvailable()
Returns maximum number of bytes each UDP packet can be.
Definition wsksockm.h:131
short VersionMajor
Major verion number.
Definition wsksockm.h:71
TSocketInfo SocketInfo
Information about this WinSocket implementation.
Definition wsksockm.h:70
short VersionMinor
Minor verion number.
Definition wsksockm.h:72
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned short ushort
Definition number.h:24
General definitions used by all ObjectWindows programs.
#define _OWLCLASS
Definition defs.h:338
Main header of the Winsock OWL subsystem.