Add parseIpPort, ADDRESS, & ADDRESS_SHARED to utils.

This commit is contained in:
Arthur Britto
2012-06-20 13:37:01 -07:00
parent 75f85ae519
commit 3ccf91ffe0
2 changed files with 43 additions and 6 deletions

View File

@@ -8,9 +8,11 @@
#include "types.h"
#define nothing() do {} while (0)
#define fallthru() do {} while (0)
#define NUMBER(x) (sizeof(x)/sizeof((x)[0]))
#define nothing() do {} while (0)
#define fallthru() do {} while (0)
#define NUMBER(x) (sizeof(x)/sizeof((x)[0]))
#define ADDRESS(p) strHex(uint64( ((char*) p) - ((char*) 0)))
#define ADDRESS_SHARED(p) strHex(uint64( ((char*) (p).get()) - ((char*) 0)))
#ifndef MAX
#define MAX(x,y) ((x) < (y) ? (y) : (x))
@@ -36,7 +38,7 @@ int strIPtoInt(std::string& ipStr);
template<class Iterator>
std::string strJoin(Iterator first, Iterator last, std::string strSeperator)
{
std::ostringstream ossValues;
std::ostringstream ossValues;
for (Iterator start = first; first != last; first++)
{
@@ -104,6 +106,8 @@ std::vector<unsigned char> strUnHex(const std::string& strSrc);
std::vector<unsigned char> strCopy(const std::string& strSrc);
std::string strCopy(const std::vector<unsigned char>& vucSrc);
bool parseIpPort(const std::string& strSource, std::string& strIP, int& iPort);
DH* DH_der_load(const std::string& strDer);
std::string DH_der_gen(int iKeyLength);