-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changing internal representation of ip addresses for reals from string to binary #37
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
#pragma once | ||
|
||
#include <folly/IPAddress.h> | ||
#include <string> | ||
|
||
namespace katran { | ||
|
@@ -33,7 +34,7 @@ struct beaddr { | |
}; | ||
|
||
class IpHelpers { | ||
public: | ||
public: | ||
/** | ||
* @param const string addr address to translate | ||
* @return struct beaddr representation of given address | ||
|
@@ -42,10 +43,13 @@ class IpHelpers { | |
* of beaddr structure. this function could throw, if given string is not | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sentence tho.. |
||
* an ip address. | ||
*/ | ||
static struct beaddr parseAddrToBe( | ||
const std::string& addr, | ||
bool bigendian = true); | ||
static struct beaddr parseAddrToInt(const std::string& addr); | ||
static struct beaddr parseAddrToBe(const std::string &addr, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think all 4 of them can be free functions instead of static functions on the class. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And the two with bigendian params can be in a anonymous namespace so they are impl detail only local to this file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non static non class functions would break public API - do you guys want to do this? (e.g. if anyone already using em otuside of KatranLb.h) |
||
bool bigendian = true); | ||
static struct beaddr parseAddrToInt(const std::string &addr); | ||
|
||
static struct beaddr parseAddrToBe(const folly::IPAddress &addr, | ||
bool bigendian = true); | ||
static struct beaddr parseAddrToInt(const folly::IPAddress &addr); | ||
}; | ||
|
||
} // namespace katran |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove the space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format -i . looks like fb's one is too old