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
20#pragma pack(push, 8)
21#include <winsock.h>
22#pragma pack(pop)
23
24
25namespace owl {
26
27#include <owl/preclass.h>
28
29//
30/// \class TSocketInfo
31// ~~~~~ ~~~~~~~~~~~
32/// TSocketInfo encapsulates the structure that contains details of the
33/// Windows Socket implementation. For example, it contains the version
34/// of the Windows Socket specification implemented, the maximum number of
35/// sockets that a single process can open etc. etc.
36//
37class _OWLCLASS TSocketInfo : public WSAData {
38 public:
40};
41
42//
43/// \class TSocketManager
44// ~~~~~ ~~~~~~~~~~~~~~
45/// A class that starts up WinSock and provides information about the system's WinSock.
46//
48 public:
49 TSocketManager(short versionMajor = 1, short versionMinor = 1,
50 bool autoStartup = true);
51 virtual ~TSocketManager();
52
53 void Init(short versionMajor = 1, short versionMinor = 1);
54
55 int Startup();
56 int ShutDown();
57
58 int IsAvailable();
59 int GetMajorVersion();
60 int GetMinorVersion();
61 char* GetDescription();
62 char* GetSystemStatus();
63 ushort GetMaxUdpDgAvailable();
64 ushort GetMaxSocketsAvailable();
65 char * GetVendorInfo();
66 int GetLastError();
67 void Information(TSocketInfo& socketInfo);
68
69 protected:
70 int LastError; ///< Last error code
71 short Available; ///< Flag for Winsock availability
72 short StartupCount; ///< Make sure to not overflow number of connects
73 TSocketInfo SocketInfo; ///< Information about this WinSocket implementation
74 short VersionMajor; ///< Major verion number
75 short VersionMinor; ///< Minor verion number
76};
77
78#include <owl/posclass.h>
79
80
81//----------------------------------------------------------------------------
82// Inline implementations
83//
84
85//
86/// Returns true if WinSock is available.
87//
88inline int
93
94//
95/// Returns the major version of WinSock support.
96//
97inline int
102
103//
104/// Returns the minor version of WinSock support.
105//
106inline int
111
112//
113/// Returns the system's description of WinSock.
114//
115inline char*
117{
118 return SocketInfo.szDescription;
119}
120
121//
122/// Returns the status of WinSock.
123//
124inline char*
126{
127 return SocketInfo.szSystemStatus;
128}
129
130//
131/// Returns maximum number of bytes each UDP packet can be.
132//
133inline ushort
135{
136 return SocketInfo.iMaxUdpDg;
137}
138
139//
140/// Returns maximum number of WinSock connections avaialble.
141//
142inline ushort
144{
145 return SocketInfo.iMaxSockets;
146}
147
148//
149/// Returns this WinSocket's vendor's information.
150//
151inline char *
153{
154 return SocketInfo.lpVendorInfo;
155}
156
157//
158/// Returns the last error code.
159//
160inline int
165
166//
167/// Sets the information about this WinSocket.
168//
169inline void
174
175} // OWL namespace
176
177#endif // OWL_SOCKMGR_H
TSocketInfo encapsulates the structure that contains details of the Windows Socket implementation.
Definition wsksockm.h:37
A class that starts up WinSock and provides information about the system's WinSock.
Definition wsksockm.h:47
int LastError
Last error code.
Definition wsksockm.h:70
short StartupCount
Make sure to not overflow number of connects.
Definition wsksockm.h:72
int IsAvailable()
Returns true if WinSock is available.
Definition wsksockm.h:89
int GetMinorVersion()
Returns the minor version of WinSock support.
Definition wsksockm.h:107
ushort GetMaxSocketsAvailable()
Returns maximum number of WinSock connections avaialble.
Definition wsksockm.h:143
int GetMajorVersion()
Returns the major version of WinSock support.
Definition wsksockm.h:98
int GetLastError()
Returns the last error code.
Definition wsksockm.h:161
char * GetVendorInfo()
Returns this WinSocket's vendor's information.
Definition wsksockm.h:152
char * GetDescription()
Returns the system's description of WinSock.
Definition wsksockm.h:116
char * GetSystemStatus()
Returns the status of WinSock.
Definition wsksockm.h:125
void Information(TSocketInfo &socketInfo)
Sets the information about this WinSocket.
Definition wsksockm.h:170
short Available
Flag for Winsock availability.
Definition wsksockm.h:71
ushort GetMaxUdpDgAvailable()
Returns maximum number of bytes each UDP packet can be.
Definition wsksockm.h:134
short VersionMajor
Major verion number.
Definition wsksockm.h:74
TSocketInfo SocketInfo
Information about this WinSocket implementation.
Definition wsksockm.h:73
short VersionMinor
Minor verion number.
Definition wsksockm.h:75
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.