libnetservices.a: Put the experimental API into BPrivate::Network namespace

In order to prevent classes between libnetapi.so with the legacy API and
applications using the libnetservices.a library, the latter will have the
classes in a distinct namespace.

In the implementation, both libbnetapi.so and libnetservices.a will use the
same header and source files. If LIBNETAPI_DEPRECATED is defined during build,
the headers and source will have binary compatible behavior. Otherwise, the
classes and other objects will be put in the HaikuExt namespace.

In order to build the libbnetapi.so and libnetservices.a with the proper
build configuration, there is a stub `src/kits/net/libnetapi_deprecated` folder
that applies the special configuration to the source files.

Currently HaikuDepot, Webpositive, libshared.a and the http_streamer add on
use the compatible API in libbnetapi.so.

Change-Id: Ic73e9f271ef75749adda46f6f72e9a0b2851b461
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3667
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Niels Sascha Reedijk
2021-01-27 19:53:11 +00:00
parent 1b133b90fd
commit ce64ffdb90
50 changed files with 405 additions and 53 deletions
+12
View File
@@ -15,6 +15,12 @@
#include <UrlRequest.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BDataRequest: public BUrlRequest {
public:
const BUrlResult& Result() const;
@@ -30,4 +36,10 @@ private:
BUrlResult fResult;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
+11
View File
@@ -13,6 +13,12 @@
#include <UrlProtocolRoster.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BFileRequest : public BUrlRequest {
public:
virtual ~BFileRequest();
@@ -32,5 +38,10 @@ private:
BUrlResult fResult;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_FILE_REQUEST_H_
@@ -12,6 +12,12 @@
#include <UrlProtocolRoster.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BGopherRequest : public BNetworkRequest {
public:
virtual ~BGopherRequest();
@@ -45,5 +51,10 @@ private:
BUrlResult fResult;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_GOPHER_REQUEST_H_
@@ -10,6 +10,13 @@
#include <String.h>
#include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
// HTTP authentication method
enum BHttpAuthenticationMethod {
B_HTTP_AUTHENTICATION_NONE = 0,
@@ -98,4 +105,10 @@ private:
mutable BLocker fLock;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_AUTHENTICATION_H_
+12
View File
@@ -12,6 +12,12 @@
#include <map>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
enum form_type {
B_HTTP_FORM_URL_ENCODED,
B_HTTP_FORM_MULTIPART
@@ -188,4 +194,10 @@ private:
BHttpFormData* fPrevElement;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_FORM_H_
+12
View File
@@ -11,6 +11,12 @@
#include <String.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BHttpHeader {
public:
BHttpHeader();
@@ -87,4 +93,10 @@ private:
BList fHeaderList;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_HEADERS_H_
+12
View File
@@ -23,6 +23,12 @@ namespace BPrivate {
};
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BHttpRequest : public BNetworkRequest {
public:
virtual ~BHttpRequest();
@@ -237,4 +243,10 @@ enum http_status_code {
// HTTP default User-Agent
#define B_HTTP_PROTOCOL_USER_AGENT_FORMAT "ServicesKit (%s)"
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_HTTP_H_
+11
View File
@@ -14,6 +14,12 @@
#include <UrlResult.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest;
@@ -55,5 +61,10 @@ private:
BString fStatusString;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_RESULT_H_
+9 -1
View File
@@ -12,6 +12,10 @@
namespace BPrivate {
#ifndef LIBNETAPI_DEPRECATED
namespace Network {
#endif
enum {
B_HTTP_TIME_FORMAT_PARSED = -1,
B_HTTP_TIME_FORMAT_RFC1123 = 0,
@@ -43,5 +47,9 @@ private:
int8 fDateFormat;
};
}
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
#endif
} // namespace BPrivate
#endif // _B_HTTP_TIME_H_
@@ -13,6 +13,12 @@
#include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkCookie : public BArchivable {
public:
BNetworkCookie(const char* name,
@@ -110,5 +116,11 @@ private:
bool fSessionCookie;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_NETWORK_COOKIE_H_
@@ -16,6 +16,12 @@
#include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkCookieList: public BObjectList<const BNetworkCookie> {
public:
BNetworkCookieList();
@@ -158,4 +164,10 @@ private:
BUrl fUrl;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_NETWORK_COOKIE_JAR_
@@ -14,6 +14,12 @@
class BAbstractSocket;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkRequest: public BUrlRequest
{
public:
@@ -39,5 +45,10 @@ protected:
BNetBuffer fInputBuffer;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
+13
View File
@@ -14,6 +14,12 @@
#include <Referenceable.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlContext: public BReferenceable {
public:
BUrlContext();
@@ -49,4 +55,11 @@ private:
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_CONTEXT_H_
@@ -10,6 +10,11 @@
#include <Message.h>
#include <UrlProtocolDispatchingListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlProtocolAsynchronousListener : public BHandler,
public BUrlProtocolListener {
@@ -28,6 +33,12 @@ private:
BUrlProtocolDispatchingListener*
fSynchronousListener;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_
@@ -10,6 +10,11 @@
#include <Message.h>
#include <UrlProtocolListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
//! To be in AppTypes.h
enum {
@@ -71,5 +76,11 @@ private:
BMessenger fMessenger;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_
@@ -13,6 +13,13 @@
class BCertificate;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest;
@@ -52,4 +59,10 @@ public:
const char* message);
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_LISTENER_H_
@@ -11,6 +11,13 @@
class BUrl;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlContext;
class BUrlProtocolListener;
class BUrlRequest;
@@ -22,4 +29,10 @@ public:
BUrlContext* context = NULL);
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
+11
View File
@@ -14,6 +14,12 @@
#include <Referenceable.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest {
public:
BUrlRequest(const BUrl& url,
@@ -66,5 +72,10 @@ protected:
BString fProtocol;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_REQUEST_H_
+12
View File
@@ -10,6 +10,12 @@
#include <String.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlResult: public BArchivable {
public:
BUrlResult();
@@ -31,4 +37,10 @@ private:
size_t fLength;
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif
@@ -10,6 +10,12 @@
#include <UrlProtocolListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlSynchronousRequest : public BUrlRequest, public BUrlProtocolListener {
public:
BUrlSynchronousRequest(BUrlRequest& asynchronousRequest);
@@ -43,4 +49,10 @@ protected:
};
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_SYNCHRONOUS_REQUEST_H_