OWLNext
7.0
Borland's Object Windows Library for the modern age
Toggle main menu visibility
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
25
namespace
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
//
37
class
_OWLCLASS
TSocketInfo
:
public
WSAData {
38
public
:
39
TSocketInfo
();
40
};
41
42
//
43
/// \class TSocketManager
44
// ~~~~~ ~~~~~~~~~~~~~~
45
/// A class that starts up WinSock and provides information about the system's WinSock.
46
//
47
class
_OWLCLASS
TSocketManager
{
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
//
88
inline
int
89
TSocketManager::IsAvailable
()
90
{
91
return
Available
;
92
}
93
94
//
95
/// Returns the major version of WinSock support.
96
//
97
inline
int
98
TSocketManager::GetMajorVersion
()
99
{
100
return
VersionMajor
;
101
}
102
103
//
104
/// Returns the minor version of WinSock support.
105
//
106
inline
int
107
TSocketManager::GetMinorVersion
()
108
{
109
return
VersionMinor
;
110
}
111
112
//
113
/// Returns the system's description of WinSock.
114
//
115
inline
char
*
116
TSocketManager::GetDescription
()
117
{
118
return
SocketInfo
.szDescription;
119
}
120
121
//
122
/// Returns the status of WinSock.
123
//
124
inline
char
*
125
TSocketManager::GetSystemStatus
()
126
{
127
return
SocketInfo
.szSystemStatus;
128
}
129
130
//
131
/// Returns maximum number of bytes each UDP packet can be.
132
//
133
inline
ushort
134
TSocketManager::GetMaxUdpDgAvailable
()
135
{
136
return
SocketInfo
.iMaxUdpDg;
137
}
138
139
//
140
/// Returns maximum number of WinSock connections avaialble.
141
//
142
inline
ushort
143
TSocketManager::GetMaxSocketsAvailable
()
144
{
145
return
SocketInfo
.iMaxSockets;
146
}
147
148
//
149
/// Returns this WinSocket's vendor's information.
150
//
151
inline
char
*
152
TSocketManager::GetVendorInfo
()
153
{
154
return
SocketInfo
.lpVendorInfo;
155
}
156
157
//
158
/// Returns the last error code.
159
//
160
inline
int
161
TSocketManager::GetLastError
()
162
{
163
return
LastError
;
164
}
165
166
//
167
/// Sets the information about this WinSocket.
168
//
169
inline
void
170
TSocketManager::Information
(
TSocketInfo
& socketInfo)
171
{
172
socketInfo =
SocketInfo
;
173
}
174
175
}
// OWL namespace
176
177
#endif
// OWL_SOCKMGR_H
owl::TSocketInfo
TSocketInfo encapsulates the structure that contains details of the Windows Socket implementation.
Definition
wsksockm.h:37
owl::TSocketInfo::TSocketInfo
TSocketInfo()
Default constructor. Initializes all data members to 0.
Definition
wsksockm.cpp:20
owl::TSocketManager::Startup
int Startup()
The Startup() function is equivalent to the Winsock WSAStartup() function.
Definition
wsksockm.cpp:81
owl::TSocketManager::LastError
int LastError
Last error code.
Definition
wsksockm.h:70
owl::TSocketManager::StartupCount
short StartupCount
Make sure to not overflow number of connects.
Definition
wsksockm.h:72
owl::TSocketManager::Init
void Init(short versionMajor=1, short versionMinor=1)
The ITSocketManager function does some initialization for the TSocketManager.
Definition
wsksockm.cpp:67
owl::TSocketManager::TSocketManager
TSocketManager(short versionMajor=1, short versionMinor=1, bool autoStartup=true)
The SocketManager constructor takes a major and minor version as parameters.
Definition
wsksockm.cpp:38
owl::TSocketManager::IsAvailable
int IsAvailable()
Returns true if WinSock is available.
Definition
wsksockm.h:89
owl::TSocketManager::GetMinorVersion
int GetMinorVersion()
Returns the minor version of WinSock support.
Definition
wsksockm.h:107
owl::TSocketManager::GetMaxSocketsAvailable
ushort GetMaxSocketsAvailable()
Returns maximum number of WinSock connections avaialble.
Definition
wsksockm.h:143
owl::TSocketManager::GetMajorVersion
int GetMajorVersion()
Returns the major version of WinSock support.
Definition
wsksockm.h:98
owl::TSocketManager::GetLastError
int GetLastError()
Returns the last error code.
Definition
wsksockm.h:161
owl::TSocketManager::ShutDown
int ShutDown()
The ShutDown() function is the equivalent to the Winsock WSACleanup() function.
Definition
wsksockm.cpp:103
owl::TSocketManager::GetVendorInfo
char * GetVendorInfo()
Returns this WinSocket's vendor's information.
Definition
wsksockm.h:152
owl::TSocketManager::GetDescription
char * GetDescription()
Returns the system's description of WinSock.
Definition
wsksockm.h:116
owl::TSocketManager::GetSystemStatus
char * GetSystemStatus()
Returns the status of WinSock.
Definition
wsksockm.h:125
owl::TSocketManager::Information
void Information(TSocketInfo &socketInfo)
Sets the information about this WinSocket.
Definition
wsksockm.h:170
owl::TSocketManager::Available
short Available
Flag for Winsock availability.
Definition
wsksockm.h:71
owl::TSocketManager::GetMaxUdpDgAvailable
ushort GetMaxUdpDgAvailable()
Returns maximum number of bytes each UDP packet can be.
Definition
wsksockm.h:134
owl::TSocketManager::VersionMajor
short VersionMajor
Major verion number.
Definition
wsksockm.h:74
owl::TSocketManager::SocketInfo
TSocketInfo SocketInfo
Information about this WinSocket implementation.
Definition
wsksockm.h:73
owl::TSocketManager::VersionMinor
short VersionMinor
Minor verion number.
Definition
wsksockm.h:75
owl
Object Windows Library (OWLNext Core).
Definition
animctrl.h:22
owl::ushort
unsigned short ushort
Definition
number.h:24
defs.h
General definitions used by all ObjectWindows programs.
defs.h
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
winsock.h
Main header of the Winsock OWL subsystem.
include
owl
wsksockm.h
Generated by
1.18.0