* Fixed build of libnetapi.so - it probably won't work for now, though, have a look
at the comment in r5_compatibility.h. * Intentionally broke source compatibility and removed all that outdated Nettle stuff. * Also, I took the liberty of making m_init private and rename it to fInit - again, this will only affect source compatibility. * Rewrote NetEndpoint.h * Fixed quite a few small bugs around the code that I touched, for example in NetAddress, SetTo() never set fInit, and therefore could be wrong. * Some cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18680 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+42
-86
@@ -1,105 +1,61 @@
|
||||
/*=--------------------------------------------------------------------------=*
|
||||
* NetAddress.h -- Interface definition for the BNetAddress class.
|
||||
*
|
||||
* Written by S.T. Mansfield ([email protected])
|
||||
*=--------------------------------------------------------------------------=*
|
||||
* Copyright (c) 2002, The OpenBeOS project.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*=--------------------------------------------------------------------------=*
|
||||
/*
|
||||
* Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef H_NETADDRESS
|
||||
#define H_NETADDRESS
|
||||
|
||||
#ifndef _NETADDRESS_H
|
||||
#define _NETADDRESS_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Archivable.h>
|
||||
#include <socket.h>
|
||||
|
||||
/*
|
||||
* Empty forward declaration to satisfy the GetImpl method.
|
||||
*/
|
||||
class NLAddress;
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
class BNetAddress : public BArchivable
|
||||
{
|
||||
public:
|
||||
BNetAddress( BMessage* archive );
|
||||
virtual ~BNetAddress();
|
||||
|
||||
virtual status_t Archive( BMessage* into, bool deep = true ) const;
|
||||
static BArchivable* Instantiate( BMessage* archive );
|
||||
class BNetAddress : public BArchivable {
|
||||
public:
|
||||
BNetAddress(BMessage* archive);
|
||||
virtual ~BNetAddress();
|
||||
|
||||
BNetAddress( const char* hostname = 0, unsigned short port = 0 );
|
||||
BNetAddress( const struct sockaddr_in& sa );
|
||||
BNetAddress( in_addr addr, int port = 0 );
|
||||
BNetAddress( uint32 addr, int port = 0 );
|
||||
BNetAddress( const BNetAddress& refparam );
|
||||
BNetAddress( const char* hostname, const char* protocol, const char* service );
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
|
||||
BNetAddress& operator=( const BNetAddress& );
|
||||
BNetAddress(const char* hostname = 0, unsigned short port = 0);
|
||||
BNetAddress(const struct sockaddr_in& addr);
|
||||
BNetAddress(in_addr addr, int port = 0);
|
||||
BNetAddress(uint32 addr, int port = 0);
|
||||
BNetAddress(const BNetAddress& other);
|
||||
BNetAddress(const char* hostname, const char* protocol, const char* service);
|
||||
|
||||
status_t InitCheck();
|
||||
BNetAddress& operator=(const BNetAddress&);
|
||||
|
||||
status_t SetTo( const char* hostname, const char* protocol, const char* service );
|
||||
status_t SetTo( const char* hostname = NULL, unsigned short port = 0 );
|
||||
status_t SetTo( const struct sockaddr_in& sa );
|
||||
status_t SetTo( in_addr addr, int port = 0 );
|
||||
status_t SetTo( uint32 addr = INADDR_ANY, int port = 0 );
|
||||
status_t InitCheck();
|
||||
|
||||
status_t GetAddr( char* hostname = NULL, unsigned short* port = NULL ) const;
|
||||
status_t GetAddr( struct sockaddr_in& sa ) const;
|
||||
status_t GetAddr( in_addr& addr, unsigned short* port = NULL ) const;
|
||||
status_t SetTo(const char* hostname, const char* protocol, const char* service);
|
||||
status_t SetTo(const char* hostname = NULL, unsigned short port = 0);
|
||||
status_t SetTo(const struct sockaddr_in& addr);
|
||||
status_t SetTo(in_addr addr, int port = 0);
|
||||
status_t SetTo(uint32 addr = INADDR_ANY, int port = 0);
|
||||
|
||||
inline NLAddress *GetImpl() const;
|
||||
status_t GetAddr(char* hostname = NULL, unsigned short* port = NULL) const;
|
||||
status_t GetAddr(struct sockaddr_in& addr) const;
|
||||
status_t GetAddr(in_addr& addr, unsigned short* port = NULL) const;
|
||||
|
||||
protected:
|
||||
status_t m_init;
|
||||
private:
|
||||
virtual void _ReservedBNetAddressFBCCruft1();
|
||||
virtual void _ReservedBNetAddressFBCCruft2();
|
||||
virtual void _ReservedBNetAddressFBCCruft3();
|
||||
virtual void _ReservedBNetAddressFBCCruft4();
|
||||
virtual void _ReservedBNetAddressFBCCruft5();
|
||||
virtual void _ReservedBNetAddressFBCCruft6();
|
||||
|
||||
private:
|
||||
virtual void _ReservedBNetAddressFBCCruft1();
|
||||
virtual void _ReservedBNetAddressFBCCruft2();
|
||||
virtual void _ReservedBNetAddressFBCCruft3();
|
||||
virtual void _ReservedBNetAddressFBCCruft4();
|
||||
virtual void _ReservedBNetAddressFBCCruft5();
|
||||
virtual void _ReservedBNetAddressFBCCruft6();
|
||||
|
||||
// Private copy helper.
|
||||
status_t clone( const BNetAddress& RefParam );
|
||||
|
||||
int32 fFamily; // Encapsulation of sockaddr::sin_family
|
||||
int32 fPort; // Encapsulation of sockaddr::sin_port
|
||||
int32 fAddress; // Encapsulation of sockaddr::sin_addr.s_addr
|
||||
|
||||
// Not used, here to maintain R5 binary compatiblilty.
|
||||
int32 fPrivateData[6];
|
||||
status_t fInit;
|
||||
int32 fFamily;
|
||||
int32 fPort;
|
||||
int32 fAddress;
|
||||
int32 fPrivateData[6];
|
||||
};
|
||||
|
||||
|
||||
inline NLAddress* BNetAddress::GetImpl( void ) const
|
||||
{
|
||||
return NULL; // No Nettle backward compatibility
|
||||
}
|
||||
|
||||
#endif // <-- #ifndef _NETADDRESS_H
|
||||
|
||||
|
||||
/*=------------------------------------------------------------------- End -=*/
|
||||
|
||||
#endif // H_NETADDRESS
|
||||
|
||||
Reference in New Issue
Block a user