* Moved DatagramSocket::Socket() up to its parent.
* Some cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37645 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2009, Haiku, Inc. All Rights Reserved.
|
* Copyright 2007-2010, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -51,20 +51,29 @@ public:
|
|||||||
status_t Open();
|
status_t Open();
|
||||||
|
|
||||||
SocketAddress LocalAddress()
|
SocketAddress LocalAddress()
|
||||||
{ return SocketAddress(fDomain->address_module, &fSocket->address); }
|
{ return SocketAddress(
|
||||||
|
fDomain->address_module,
|
||||||
|
&fSocket->address); }
|
||||||
ConstSocketAddress LocalAddress() const
|
ConstSocketAddress LocalAddress() const
|
||||||
{ return ConstSocketAddress(fDomain->address_module,
|
{ return ConstSocketAddress(
|
||||||
|
fDomain->address_module,
|
||||||
&fSocket->address); }
|
&fSocket->address); }
|
||||||
|
|
||||||
SocketAddress PeerAddress()
|
SocketAddress PeerAddress()
|
||||||
{ return SocketAddress(fDomain->address_module, &fSocket->peer); }
|
{ return SocketAddress(
|
||||||
|
fDomain->address_module,
|
||||||
|
&fSocket->peer); }
|
||||||
ConstSocketAddress PeerAddress() const
|
ConstSocketAddress PeerAddress() const
|
||||||
{ return ConstSocketAddress(fDomain->address_module, &fSocket->peer); }
|
{ return ConstSocketAddress(
|
||||||
|
fDomain->address_module,
|
||||||
|
&fSocket->peer); }
|
||||||
|
|
||||||
net_domain* Domain() const { return fDomain; }
|
net_domain* Domain() const { return fDomain; }
|
||||||
net_address_module_info* AddressModule() const
|
net_address_module_info* AddressModule() const
|
||||||
{ return fDomain->address_module; }
|
{ return fDomain->address_module; }
|
||||||
|
|
||||||
|
net_socket* Socket() const { return fSocket; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
net_socket* fSocket;
|
net_socket* fSocket;
|
||||||
net_domain* fDomain;
|
net_domain* fDomain;
|
||||||
@@ -97,7 +106,8 @@ template<typename LockingBase = MutexLocking,
|
|||||||
typename ModuleBundle = NetModuleBundleGetter>
|
typename ModuleBundle = NetModuleBundleGetter>
|
||||||
class DatagramSocket : public ProtocolSocket {
|
class DatagramSocket : public ProtocolSocket {
|
||||||
public:
|
public:
|
||||||
DatagramSocket(const char* name, net_socket* socket);
|
DatagramSocket(const char* name,
|
||||||
|
net_socket* socket);
|
||||||
virtual ~DatagramSocket();
|
virtual ~DatagramSocket();
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
@@ -109,14 +119,13 @@ public:
|
|||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
status_t SocketEnqueue(net_buffer* buffer);
|
status_t SocketEnqueue(net_buffer* buffer);
|
||||||
status_t SocketDequeue(uint32 flags, net_buffer** _buffer);
|
status_t SocketDequeue(uint32 flags,
|
||||||
|
net_buffer** _buffer);
|
||||||
|
|
||||||
ssize_t AvailableData() const;
|
ssize_t AvailableData() const;
|
||||||
|
|
||||||
void WakeAll();
|
void WakeAll();
|
||||||
|
|
||||||
net_socket* Socket() const { return fSocket; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual status_t _SocketStatus() const;
|
virtual status_t _SocketStatus() const;
|
||||||
|
|
||||||
@@ -150,7 +159,8 @@ protected:
|
|||||||
|
|
||||||
DECL_DATAGRAM_SOCKET(inline)::DatagramSocket(const char* name,
|
DECL_DATAGRAM_SOCKET(inline)::DatagramSocket(const char* name,
|
||||||
net_socket* socket)
|
net_socket* socket)
|
||||||
: ProtocolSocket(socket), fCurrentBytes(0)
|
:
|
||||||
|
ProtocolSocket(socket), fCurrentBytes(0)
|
||||||
{
|
{
|
||||||
status_t status = LockingBase::Init(&fLock, name);
|
status_t status = LockingBase::Init(&fLock, name);
|
||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
@@ -356,4 +366,5 @@ DECL_DATAGRAM_SOCKET(inline bigtime_t)::_SocketTimeout(uint32 flags) const
|
|||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // PROTOCOL_UTILITIES_H
|
#endif // PROTOCOL_UTILITIES_H
|
||||||
|
|||||||
Reference in New Issue
Block a user