Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (

require (
git.pubmatic.com/PubMatic/go-common v0.0.0-20250114170528-cb2fb632c358
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20240104092757-5d6f15e25fe3
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20250624062228-8abe69b422f0
git.pubmatic.com/vastunwrap v0.0.0-00010101000000-000000000000
github.com/PubMatic-OpenWrap/fastxml v0.0.0-20250413102522-1b08a22c067a
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3f
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.pubmatic.com/PubMatic/go-common v0.0.0-20250114170528-cb2fb632c358 h1:A+ohfTqsSCfiLybo+tRQ+YXqCPTYiBp0U9lA8gv8MS8=
git.pubmatic.com/PubMatic/go-common v0.0.0-20250114170528-cb2fb632c358/go.mod h1:I6yt+Te6PaQdUW+pq7/LHNWZ6/+5SSlExknAr3Mfv58=
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20240104092757-5d6f15e25fe3 h1:zQUpPJOjTBGu2fIydrfRWphH7EWLlBE/Qgn64BSoccI=
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20240104092757-5d6f15e25fe3/go.mod h1:w733mqJnHt0hLR9mIFMzyDR0D94qzc7mFHsuE0tFQho=
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20250624062228-8abe69b422f0 h1:BhQaKVrdBvDKt+/4UtpRyFdtcPciCqTsEw9k4nOvaEI=
git.pubmatic.com/PubMatic/go-netacuity-client v0.0.0-20250624062228-8abe69b422f0/go.mod h1:w733mqJnHt0hLR9mIFMzyDR0D94qzc7mFHsuE0tFQho=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20250413103331-eb94f23db3f9 h1:7Py1K7/++5Ob85kvPSIJSwfUo4Zyb4KgueRFK05lqHk=
git.pubmatic.com/PubMatic/vastunwrap v0.0.0-20250413103331-eb94f23db3f9/go.mod h1:pKlYgzQa/b4uwwik5ilkiwRRgF6cV00bBj5mAPqaebk=
github.com/51Degrees/device-detection-go/v4 v4.4.35 h1:qhP2tzoXhGE1aYY3NftMJ+ccxz0+2kM8aF4SH7fTyuA=
Expand Down
85 changes: 85 additions & 0 deletions modules/pubmatic/openwrap/geodb/netacuity/include/NaDbAccessor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//============================================================================
// Program : C++ NetAcuity Embedded API
// Author : Digital Envoy
// Version : 7.0.0.1
// Date : 2023-DEC-08
// Copyright : Copyright 2000-2023, Digital Envoy, Inc. All rights reserved.
//============================================================================

#ifndef NA_DB_ACCESSOR_H_
#define NA_DB_ACCESSOR_H_

#include <stdexcept>
#include "netacuity.h"
#include "NaDbDef.h"
#include "NaDbUtil.h"

namespace netacuity {

class NaDbAccessor {

public:
NaDbAccessor(int featureCode, std::string directory);

virtual ~NaDbAccessor();

//--------------- Public MetaData Getters ----------------
int getFeatureCode() const;

std::string getDirectory() const;

int getDbVersion() const;

std::string getBuildDateString() const;

StringList getFieldNameList() const;

StringList getDefaultResponseList() const;

std::string getDefaultRawResponse() const;


//--------------- Public Raw Query Functions ----------------

/// Retrieve the raw response for the specified IPv4 number.
std::string queryRawResponseIpv4(u_int32_t ipNum);

/// Retrieve the raw response for the specified IPv6 network number.
/// The network number is the half of the IPv6 address which contains the most significant-bits.
std::string queryRawResponseIpv6(u_int64_t numNetwork);

/// Retrieve the raw response for the specified IPv6 full network and interface numbers.
/// The network number is the half of the IPv6 address which contains the most significant bits.
/// The interface number is the half of the IPv6 address which contains the least significant bits.
std::string queryRawResponseIpv6(u_int64_t numNetwork, u_int64_t numInterface);

/// Retrieve the raw response for the specified IPv4 address.
std::string queryRawResponseIpv4(in_addr ipv4);

/// Retrieve the raw response for the specified IPv6 address.
std::string queryRawResponseIpv6(in6_addr ipv6);

/// Retrieve the raw response for the specified IP "dotted" presentation address, IPv4 or IPv6.
std::string queryRawResponse(const char *ipAddress);

/// Prints some interesting meta-data to the specified output stream. Useful for testing or debugging.
void printMetaData(std::ostream &out) const;

protected:
int featureCode;
std::string directory;
NaDbHandle handle;

int dbVersion;
std::string buildDateString;
std::string defaultResponse;
StringList fieldNameList;
StringList defaultResponseList;

void setupMetadata();

std::runtime_error getNaDbError();
};

}
#endif /* NA_DB_ACCESSOR_H_ */
148 changes: 0 additions & 148 deletions modules/pubmatic/openwrap/geodb/netacuity/include/NaDbBaseAccessor.h

This file was deleted.

100 changes: 6 additions & 94 deletions modules/pubmatic/openwrap/geodb/netacuity/include/NaDbDef.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//============================================================================
// Program : NetAcuity C++ Embedded API
// Program : C++ NetAcuity Embedded API
// Author : Digital Envoy
// Version : 6.4.1.3
// Date : 25-Jun-2019
// Copyright : Copyright 2000-2019, Digital Envoy, Inc. All rights reserved.
// Version : 7.0.0.1
// Date : 2023-DEC-08
// Copyright : Copyright 2000-2023, Digital Envoy, Inc. All rights reserved.
//============================================================================


Expand All @@ -13,97 +13,9 @@
#include <string>
#include <list>
#include <map>
#include <stdlib.h>
#include <stdint.h>

namespace netacuity {

typedef std::list<std::string> StringList;
typedef std::map<std::string, std::string> ResponseMap;

static const unsigned long MAX_IPV4_NUM = 0xFFffFFffUL;
static const unsigned long long MAX_IPV6_NETWORK_NUM = 0xFFFFffffFFFFffffULL;
static const unsigned long long MAX_IPV6_INTERFACE_NUM = MAX_IPV6_NETWORK_NUM;

typedef enum RangeRecordIpv6Type_enum {
RANGE_RECORD_IPV6_NONE = 0,
RANGE_RECORD_IPV6_NETWORK_ONLY = 20,
RANGE_RECORD_IPV6_NETWORK_AND_INTERFACE = 36
}
RangeRecordIpv6Type;


typedef struct RangeRecordIpv4_struct {
RangeRecordIpv4_struct() : startNum(0), endNum(0), offset(0) {}
//all these byte-orders are little-endian
uint32_t startNum;
uint32_t endNum;
uint32_t offset;
}
__attribute__((__packed__))
RangeRecordIpv4;


typedef struct RangeRecordIpv6_struct {
RangeRecordIpv6_struct() : startNetwork(0), startInterface(0), endNetwork(0), endInterface(0), offset(0) {}
//all these byte-orders are little-endian
uint64_t startNetwork;
uint64_t startInterface;
uint64_t endNetwork;
uint64_t endInterface;
uint32_t offset;
}
__attribute__((__packed__))
RangeRecordIpv6;


typedef struct RangeRecordIpv6NetworkOnly_struct {
RangeRecordIpv6NetworkOnly_struct() : startNetwork(0), endNetwork(0), offset(0) {}
//all these byte-orders are little-endian
uint64_t startNetwork;
uint64_t endNetwork;
uint32_t offset;
}
__attribute__((__packed__))
RangeRecordIpv6NetworkOnly;


typedef struct ExtendedRangeRecordIpv4_struct {
ExtendedRangeRecordIpv4_struct() : startNum(0), endNum(0), offset(0), offsetExtended(0) {}
//all these byte-orders are little-endian
uint32_t startNum;
uint32_t endNum;
uint32_t offset;
uint8_t offsetExtended; //most-significant byte of offset occurs last in little-endian order
}
__attribute__((__packed__))
ExtendedRangeRecordIpv4;


typedef struct ExtendedRangeRecordIpv6_struct {
ExtendedRangeRecordIpv6_struct() : startNetwork(0), startInterface(0), endNetwork(0), endInterface(0), offset(0), offsetExtended(0) {}
//all these byte-orders are little-endian
uint64_t startNetwork;
uint64_t startInterface;
uint64_t endNetwork;
uint64_t endInterface;
uint32_t offset;
uint8_t offsetExtended; //most-significant byte of offset occurs last in little-endian order
}
__attribute__((__packed__))
ExtendedRangeRecordIpv6;


typedef struct ExtendedRangeRecordIpv6NetworkOnly_struct {
ExtendedRangeRecordIpv6NetworkOnly_struct() : startNetwork(0), endNetwork(0), offset(0), offsetExtended(0) {}
//all these byte-orders are little-endian
uint64_t startNetwork;
uint64_t endNetwork;
uint32_t offset;
uint8_t offsetExtended; //most-significant byte of offset occurs last in little-endian order
}
__attribute__((__packed__))
ExtendedRangeRecordIpv6NetworkOnly;

typedef std::list<std::string> StringList;
typedef std::map<std::string, std::string> ResponseMap;
}
#endif /* NA_DB_DEF_H_ */
Loading
Loading