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> #include <UrlRequest.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BDataRequest: public BUrlRequest { class BDataRequest: public BUrlRequest {
public: public:
const BUrlResult& Result() const; const BUrlResult& Result() const;
@@ -30,4 +36,10 @@ private:
BUrlResult fResult; BUrlResult fResult;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif #endif
+11
View File
@@ -13,6 +13,12 @@
#include <UrlProtocolRoster.h> #include <UrlProtocolRoster.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BFileRequest : public BUrlRequest { class BFileRequest : public BUrlRequest {
public: public:
virtual ~BFileRequest(); virtual ~BFileRequest();
@@ -32,5 +38,10 @@ private:
BUrlResult fResult; BUrlResult fResult;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_FILE_REQUEST_H_ #endif // _B_FILE_REQUEST_H_
@@ -12,6 +12,12 @@
#include <UrlProtocolRoster.h> #include <UrlProtocolRoster.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BGopherRequest : public BNetworkRequest { class BGopherRequest : public BNetworkRequest {
public: public:
virtual ~BGopherRequest(); virtual ~BGopherRequest();
@@ -45,5 +51,10 @@ private:
BUrlResult fResult; BUrlResult fResult;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_GOPHER_REQUEST_H_ #endif // _B_GOPHER_REQUEST_H_
@@ -10,6 +10,13 @@
#include <String.h> #include <String.h>
#include <Url.h> #include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
// HTTP authentication method // HTTP authentication method
enum BHttpAuthenticationMethod { enum BHttpAuthenticationMethod {
B_HTTP_AUTHENTICATION_NONE = 0, B_HTTP_AUTHENTICATION_NONE = 0,
@@ -98,4 +105,10 @@ private:
mutable BLocker fLock; mutable BLocker fLock;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_AUTHENTICATION_H_ #endif // _B_HTTP_AUTHENTICATION_H_
+12
View File
@@ -12,6 +12,12 @@
#include <map> #include <map>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
enum form_type { enum form_type {
B_HTTP_FORM_URL_ENCODED, B_HTTP_FORM_URL_ENCODED,
B_HTTP_FORM_MULTIPART B_HTTP_FORM_MULTIPART
@@ -188,4 +194,10 @@ private:
BHttpFormData* fPrevElement; BHttpFormData* fPrevElement;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_FORM_H_ #endif // _B_HTTP_FORM_H_
+12
View File
@@ -11,6 +11,12 @@
#include <String.h> #include <String.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BHttpHeader { class BHttpHeader {
public: public:
BHttpHeader(); BHttpHeader();
@@ -87,4 +93,10 @@ private:
BList fHeaderList; BList fHeaderList;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_HTTP_HEADERS_H_ #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 { class BHttpRequest : public BNetworkRequest {
public: public:
virtual ~BHttpRequest(); virtual ~BHttpRequest();
@@ -237,4 +243,10 @@ enum http_status_code {
// HTTP default User-Agent // HTTP default User-Agent
#define B_HTTP_PROTOCOL_USER_AGENT_FORMAT "ServicesKit (%s)" #define B_HTTP_PROTOCOL_USER_AGENT_FORMAT "ServicesKit (%s)"
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_HTTP_H_ #endif // _B_URL_PROTOCOL_HTTP_H_
+11
View File
@@ -14,6 +14,12 @@
#include <UrlResult.h> #include <UrlResult.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest; class BUrlRequest;
@@ -55,5 +61,10 @@ private:
BString fStatusString; BString fStatusString;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_RESULT_H_ #endif // _B_URL_RESULT_H_
+9 -1
View File
@@ -12,6 +12,10 @@
namespace BPrivate { namespace BPrivate {
#ifndef LIBNETAPI_DEPRECATED
namespace Network {
#endif
enum { enum {
B_HTTP_TIME_FORMAT_PARSED = -1, B_HTTP_TIME_FORMAT_PARSED = -1,
B_HTTP_TIME_FORMAT_RFC1123 = 0, B_HTTP_TIME_FORMAT_RFC1123 = 0,
@@ -43,5 +47,9 @@ private:
int8 fDateFormat; int8 fDateFormat;
}; };
} #ifndef LIBNETAPI_DEPRECATED
} // namespace Network
#endif
} // namespace BPrivate
#endif // _B_HTTP_TIME_H_ #endif // _B_HTTP_TIME_H_
@@ -13,6 +13,12 @@
#include <Url.h> #include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkCookie : public BArchivable { class BNetworkCookie : public BArchivable {
public: public:
BNetworkCookie(const char* name, BNetworkCookie(const char* name,
@@ -110,5 +116,11 @@ private:
bool fSessionCookie; bool fSessionCookie;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_NETWORK_COOKIE_H_ #endif // _B_NETWORK_COOKIE_H_
@@ -16,6 +16,12 @@
#include <Url.h> #include <Url.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkCookieList: public BObjectList<const BNetworkCookie> { class BNetworkCookieList: public BObjectList<const BNetworkCookie> {
public: public:
BNetworkCookieList(); BNetworkCookieList();
@@ -158,4 +164,10 @@ private:
BUrl fUrl; BUrl fUrl;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_NETWORK_COOKIE_JAR_ #endif // _B_NETWORK_COOKIE_JAR_
@@ -14,6 +14,12 @@
class BAbstractSocket; class BAbstractSocket;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BNetworkRequest: public BUrlRequest class BNetworkRequest: public BUrlRequest
{ {
public: public:
@@ -39,5 +45,10 @@ protected:
BNetBuffer fInputBuffer; BNetBuffer fInputBuffer;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif #endif
+13
View File
@@ -14,6 +14,12 @@
#include <Referenceable.h> #include <Referenceable.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlContext: public BReferenceable { class BUrlContext: public BReferenceable {
public: public:
BUrlContext(); BUrlContext();
@@ -49,4 +55,11 @@ private:
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_CONTEXT_H_ #endif // _B_URL_CONTEXT_H_
@@ -10,6 +10,11 @@
#include <Message.h> #include <Message.h>
#include <UrlProtocolDispatchingListener.h> #include <UrlProtocolDispatchingListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlProtocolAsynchronousListener : public BHandler, class BUrlProtocolAsynchronousListener : public BHandler,
public BUrlProtocolListener { public BUrlProtocolListener {
@@ -28,6 +33,12 @@ private:
BUrlProtocolDispatchingListener* BUrlProtocolDispatchingListener*
fSynchronousListener; fSynchronousListener;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_ #endif // _B_URL_PROTOCOL_ASYNCHRONOUS_LISTENER_H_
@@ -10,6 +10,11 @@
#include <Message.h> #include <Message.h>
#include <UrlProtocolListener.h> #include <UrlProtocolListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
//! To be in AppTypes.h //! To be in AppTypes.h
enum { enum {
@@ -71,5 +76,11 @@ private:
BMessenger fMessenger; BMessenger fMessenger;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_ #endif // _B_URL_PROTOCOL_DISPATCHING_LISTENER_H_
@@ -13,6 +13,13 @@
class BCertificate; class BCertificate;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest; class BUrlRequest;
@@ -52,4 +59,10 @@ public:
const char* message); const char* message);
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_PROTOCOL_LISTENER_H_ #endif // _B_URL_PROTOCOL_LISTENER_H_
@@ -11,6 +11,13 @@
class BUrl; class BUrl;
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlContext; class BUrlContext;
class BUrlProtocolListener; class BUrlProtocolListener;
class BUrlRequest; class BUrlRequest;
@@ -22,4 +29,10 @@ public:
BUrlContext* context = NULL); BUrlContext* context = NULL);
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif #endif
+11
View File
@@ -14,6 +14,12 @@
#include <Referenceable.h> #include <Referenceable.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlRequest { class BUrlRequest {
public: public:
BUrlRequest(const BUrl& url, BUrlRequest(const BUrl& url,
@@ -66,5 +72,10 @@ protected:
BString fProtocol; BString fProtocol;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_REQUEST_H_ #endif // _B_URL_REQUEST_H_
+12
View File
@@ -10,6 +10,12 @@
#include <String.h> #include <String.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlResult: public BArchivable { class BUrlResult: public BArchivable {
public: public:
BUrlResult(); BUrlResult();
@@ -31,4 +37,10 @@ private:
size_t fLength; size_t fLength;
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif #endif
@@ -10,6 +10,12 @@
#include <UrlProtocolListener.h> #include <UrlProtocolListener.h>
#ifndef LIBNETAPI_DEPRECATED
namespace BPrivate {
namespace Network {
#endif
class BUrlSynchronousRequest : public BUrlRequest, public BUrlProtocolListener { class BUrlSynchronousRequest : public BUrlRequest, public BUrlProtocolListener {
public: public:
BUrlSynchronousRequest(BUrlRequest& asynchronousRequest); BUrlSynchronousRequest(BUrlRequest& asynchronousRequest);
@@ -43,4 +49,10 @@ protected:
}; };
#ifndef LIBNETAPI_DEPRECATED
} // namespace Network
} // namespace BPrivate
#endif
#endif // _B_URL_SYNCHRONOUS_REQUEST_H_ #endif // _B_URL_SYNCHRONOUS_REQUEST_H_
@@ -3,6 +3,9 @@ SubDir HAIKU_TOP src add-ons media plugins http_streamer ;
UsePrivateHeaders media netservices shared ; UsePrivateHeaders media netservices shared ;
UsePrivateHeaders [ FDirName media experimental ] ; UsePrivateHeaders [ FDirName media experimental ] ;
# Use the deprecated libnetapi.so classes
SubDirC++Flags [ FDefines LIBNETAPI_DEPRECATED ] ;
local architectureObject ; local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] { for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) { on $(architectureObject) {
+3
View File
@@ -229,6 +229,9 @@ local generatedReferenceParserSourceFiles =
DumpExportReferenceJsonListener.cpp DumpExportReferenceJsonListener.cpp
; ;
# Use the deprecated libnetapi.so network classes
SubDirC++Flags [ FDefines LIBNETAPI_DEPRECATED ] ;
Application HaikuDepot Application HaikuDepot
: :
$(applicationSources) $(applicationSources)
+3
View File
@@ -3,6 +3,9 @@ SubDir HAIKU_TOP src apps webpositive ;
SubDirC++Flags $(defines) -Wno-error=sequence-point -Wno-error=format-truncation ; SubDirC++Flags $(defines) -Wno-error=sequence-point -Wno-error=format-truncation ;
SubDirCcFlags $(defines) -Wno-error=sequence-point -Wno-error=format-truncation ; SubDirCcFlags $(defines) -Wno-error=sequence-point -Wno-error=format-truncation ;
# Use the deprecated libnetapi.so classes
SubDirC++Flags [ FDefines LIBNETAPI_DEPRECATED ] ;
# source directories # source directories
local sourceDirs = local sourceDirs =
autocompletion autocompletion
+1
View File
@@ -1,4 +1,5 @@
SubDir HAIKU_TOP src kits network ; SubDir HAIKU_TOP src kits network ;
SubInclude HAIKU_TOP src kits network libnetapi ; SubInclude HAIKU_TOP src kits network libnetapi ;
SubInclude HAIKU_TOP src kits network libnetapi_deprecated ;
SubInclude HAIKU_TOP src kits network libnetservices ; SubInclude HAIKU_TOP src kits network libnetservices ;
@@ -0,0 +1,3 @@
SubDir HAIKU_TOP src kits network libnetapi_deprecated ;
include [ FDirName $(HAIKU_TOP) src kits network libnetservices JamCommon ] ;
@@ -15,6 +15,11 @@
#include <stdio.h> #include <stdio.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
BDataRequest::BDataRequest(const BUrl& url, BUrlProtocolListener* listener, BDataRequest::BDataRequest(const BUrl& url, BUrlProtocolListener* listener,
BUrlContext* context) BUrlContext* context)
: BUrlRequest(url, listener, context, "data URL parser", "data"), : BUrlRequest(url, listener, context, "data URL parser", "data"),
@@ -17,6 +17,10 @@
#include <Path.h> #include <Path.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
BFileRequest::BFileRequest(const BUrl& url, BUrlProtocolListener* listener, BFileRequest::BFileRequest(const BUrl& url, BUrlProtocolListener* listener,
BUrlContext* context) BUrlContext* context)
: :
@@ -23,6 +23,11 @@
#include <String.h> #include <String.h>
#include <StringList.h> #include <StringList.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
/* /*
* TODO: fix '+' in selectors, cf. gopher://gophernicus.org/1/doc/gopher/ * TODO: fix '+' in selectors, cf. gopher://gophernicus.org/1/doc/gopher/
* TODO: add proper favicon * TODO: add proper favicon
@@ -15,6 +15,11 @@
#include <AutoLocker.h> #include <AutoLocker.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
#if DEBUG > 0 #if DEBUG > 0
#define PRINT(x) printf x #define PRINT(x) printf x
#else #else
@@ -23,6 +23,9 @@ static int32 kBoundaryRandomSize = 16;
using namespace std; using namespace std;
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
// #pragma mark - BHttpFormData // #pragma mark - BHttpFormData
@@ -15,6 +15,10 @@
#include <HttpHeaders.h> #include <HttpHeaders.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
// #pragma mark -- BHttpHeader // #pragma mark -- BHttpHeader
@@ -34,6 +34,11 @@
static const int32 kHttpBufferSize = 4096; static const int32 kHttpBufferSize = 4096;
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
namespace BPrivate { namespace BPrivate {
class CheckedSecureSocket: public BSecureSocket class CheckedSecureSocket: public BSecureSocket
@@ -15,6 +15,10 @@
using std::ostream; using std::ostream;
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
BHttpResult::BHttpResult(const BUrl& url) BHttpResult::BHttpResult(const BUrl& url)
: :
@@ -47,7 +47,11 @@ static const char* kDateFormats[] = {
"%a %d %b %H:%M:%S %Y" "%a %d %b %H:%M:%S %Y"
}; };
#ifdef LIBNETAPI_DEPRECATED
using namespace BPrivate; using namespace BPrivate;
#else
using namespace BPrivate::Network;
#endif
BHttpTime::BHttpTime() BHttpTime::BHttpTime()
+61
View File
@@ -0,0 +1,61 @@
# This module is built as an independent static library, and as a (deprecated)
# part of libnetapi.so. In the latter case LIBNETAPI_DEPRECATED will be defined
# to ensure binary compatibility.
UsePrivateHeaders net netservices shared support ;
local sources =
# FUTURE: The HTTP stuff should all go into an add-on. It needs
# linking against libcrypto.so and only the add-on should link
# against it.
DataRequest.cpp
HttpAuthentication.cpp
HttpHeaders.cpp
HttpForm.cpp
HttpRequest.cpp
HttpResult.cpp
# FUTURE: another add-on for file:// (a much simpler one)
FileRequest.cpp
# FUTURE: another add-on for gopher://
GopherRequest.cpp
HttpTime.cpp
NetworkCookie.cpp
NetworkCookieJar.cpp
NetworkRequest.cpp
UrlContext.cpp
UrlProtocolAsynchronousListener.cpp
UrlProtocolDispatchingListener.cpp
UrlProtocolListener.cpp
UrlProtocolRoster.cpp
UrlRequest.cpp
UrlResult.cpp
UrlSynchronousRequest.cpp
;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ;
if $(SUBDIR:B) = libnetapi_deprecated {
SubDirC++Flags [ FDefines LIBNETAPI_DEPRECATED ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src kits network libnetservices ] : false ;
MergeObject <libnetapi!$(architecture)>netservices.o :
$(sources)
: <$(architecture)>libshared.a
;
} else {
StaticLibrary [ MultiArchDefaultGristFiles libnetservices.a ] :
$(sources)
;
}
SEARCH on [ FGristFiles $(sources) ]
= [ FDirName $(HAIKU_TOP) src kits network libnetservices ] ;
}
}
+1 -49
View File
@@ -1,51 +1,3 @@
SubDir HAIKU_TOP src kits network libnetservices ; SubDir HAIKU_TOP src kits network libnetservices ;
UsePrivateHeaders net netservices shared support ; include [ FDirName $(HAIKU_TOP) src kits network libnetservices JamCommon ] ;
local sources =
# FUTURE: The HTTP stuff should all go into an add-on. It needs
# linking against libcrypto.so and only the add-on should link
# against it.
DataRequest.cpp
HttpAuthentication.cpp
HttpHeaders.cpp
HttpForm.cpp
HttpRequest.cpp
HttpResult.cpp
# FUTURE: another add-on for file:// (a much simpler one)
FileRequest.cpp
# FUTURE: another add-on for gopher://
GopherRequest.cpp
HttpTime.cpp
NetworkCookie.cpp
NetworkCookieJar.cpp
NetworkRequest.cpp
UrlContext.cpp
UrlProtocolAsynchronousListener.cpp
UrlProtocolDispatchingListener.cpp
UrlProtocolListener.cpp
UrlProtocolRoster.cpp
UrlRequest.cpp
UrlResult.cpp
UrlSynchronousRequest.cpp
;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) {
local architecture = $(TARGET_PACKAGING_ARCH) ;
MergeObject <libnetapi!$(architecture)>netservices.o :
$(sources)
: <$(architecture)>libshared.a
;
StaticLibrary <$(architecture)>libnetservices.a :
$(sources)
;
}
}
@@ -20,9 +20,12 @@
#include <HttpTime.h> #include <HttpTime.h>
#include <NetworkCookie.h> #include <NetworkCookie.h>
#ifdef LIBNETAPI_DEPRECATED
using BPrivate::BHttpTime; using BPrivate::BHttpTime;
using BPrivate::B_HTTP_TIME_FORMAT_COOKIE;
#else
using namespace BPrivate::Network;
#endif
static const char* kArchivedCookieName = "be:cookie.name"; static const char* kArchivedCookieName = "be:cookie.name";
static const char* kArchivedCookieValue = "be:cookie.value"; static const char* kArchivedCookieValue = "be:cookie.value";
@@ -380,7 +383,7 @@ BNetworkCookie::ExpirationString() const
BHttpTime date(fExpiration); BHttpTime date(fExpiration);
if (!fExpirationStringValid) { if (!fExpirationStringValid) {
fExpirationString = date.ToString(BPrivate::B_HTTP_TIME_FORMAT_COOKIE); fExpirationString = date.ToString(B_HTTP_TIME_FORMAT_COOKIE);
fExpirationStringValid = true; fExpirationStringValid = true;
} }
@@ -19,6 +19,10 @@
#include "NetworkCookieJarPrivate.h" #include "NetworkCookieJarPrivate.h"
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
// #define TRACE_COOKIE // #define TRACE_COOKIE
#ifdef TRACE_COOKIE #ifdef TRACE_COOKIE
# define TRACE(x...) printf(x) # define TRACE(x...) printf(x)
@@ -9,6 +9,13 @@
#include <HashMap.h> #include <HashMap.h>
#ifndef LIBNETAPI_DEPRECATED
using BPrivate::Network::BNetworkCookie;
using BPrivate::Network::BNetworkCookieJar;
using BPrivate::Network::BNetworkCookieList;
#endif
typedef BPrivate::SynchronizedHashMap<HashString, BNetworkCookieList*> typedef BPrivate::SynchronizedHashMap<HashString, BNetworkCookieList*>
BNetworkCookieHashMap; BNetworkCookieHashMap;
@@ -14,6 +14,10 @@
#include <AbstractSocket.h> #include <AbstractSocket.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
BNetworkRequest::BNetworkRequest(const BUrl& url, BUrlProtocolListener* listener, BNetworkRequest::BNetworkRequest(const BUrl& url, BUrlProtocolListener* listener,
BUrlContext* context, const char* threadName, const char* protocolName) BUrlContext* context, const char* threadName, const char* protocolName)
: :
@@ -16,6 +16,10 @@
#include <HashString.h> #include <HashString.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
class BUrlContext::BHttpAuthenticationMap : public class BUrlContext::BHttpAuthenticationMap : public
SynchronizedHashMap<BPrivate::HashString, BHttpAuthentication*> {}; SynchronizedHashMap<BPrivate::HashString, BHttpAuthentication*> {};
@@ -19,6 +19,11 @@
#include <UrlResult.h> #include <UrlResult.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
extern const char* kUrlProtocolMessageType; extern const char* kUrlProtocolMessageType;
extern const char* kUrlProtocolCaller; extern const char* kUrlProtocolCaller;
@@ -16,6 +16,10 @@
#include <assert.h> #include <assert.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
const char* kUrlProtocolMessageType = "be:urlProtocolMessageType"; const char* kUrlProtocolMessageType = "be:urlProtocolMessageType";
const char* kUrlProtocolCaller = "be:urlProtocolCaller"; const char* kUrlProtocolCaller = "be:urlProtocolCaller";
@@ -15,6 +15,9 @@
using namespace std; using namespace std;
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
void void
BUrlProtocolListener::ConnectionOpened(BUrlRequest*) BUrlProtocolListener::ConnectionOpened(BUrlRequest*)
@@ -18,6 +18,9 @@
#include <HttpRequest.h> #include <HttpRequest.h>
#include <UrlRequest.h> #include <UrlRequest.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
/* static */ BUrlRequest* /* static */ BUrlRequest*
BUrlProtocolRoster::MakeRequest(const BUrl& url, BUrlProtocolRoster::MakeRequest(const BUrl& url,
@@ -12,6 +12,10 @@
#include <stdio.h> #include <stdio.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
static BReference<BUrlContext> gDefaultContext = new(std::nothrow) BUrlContext(); static BReference<BUrlContext> gDefaultContext = new(std::nothrow) BUrlContext();
@@ -10,6 +10,10 @@
#include <UrlResult.h> #include <UrlResult.h>
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
BUrlResult::BUrlResult() BUrlResult::BUrlResult()
: :
BArchivable(), BArchivable(),
@@ -12,6 +12,9 @@
#define PRINT(x) printf x; #define PRINT(x) printf x;
#ifndef LIBNETAPI_DEPRECATED
using namespace BPrivate::Network;
#endif
BUrlSynchronousRequest::BUrlSynchronousRequest(BUrlRequest& request) BUrlSynchronousRequest::BUrlSynchronousRequest(BUrlRequest& request)
: :
+3
View File
@@ -13,6 +13,9 @@ UsePrivateHeaders
; ;
UsePrivateSystemHeaders ; UsePrivateSystemHeaders ;
# Use the deprecated libnetapi.so classes
SubDirC++Flags [ FDefines LIBNETAPI_DEPRECATED ] ;
HPKG_SOURCES = HPKG_SOURCES =
AttributeDataReader.cpp AttributeDataReader.cpp
BlockBufferPool.cpp BlockBufferPool.cpp
+3
View File
@@ -9,6 +9,9 @@ if [ Glob $(SUBDIR) : DefaultGeolocationServiceKey.h ] {
SubDirC++Flags [ FDefines HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY ] ; SubDirC++Flags [ FDefines HAVE_DEFAULT_GEOLOCATION_SERVICE_KEY ] ;
} }
# Use the deprecated libnetapi.so classes
SubDirC++Flags [ FDefines LIBNETAPI_DEPRECATED ] ;
local architectureObject ; local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] { for architectureObject in [ MultiArchSubDirSetup ] {
on $(architectureObject) { on $(architectureObject) {