-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor of IP utils to use exceptions on invalid input. (#1426)
* Changed IpUtils to raise exceptions on invalid input instead of returning nullptr. * Added 'try' methods for extraction of IP address from socket address. * Updated calls to sockaddr2* to try_sockaddr2* to keep current functionality. * Lint * Added overload of sockaddr2string that returns std::string. * Added debug logs about failed extractions. * Lint * Removed 'struct' keywords from function parameters. * Changed C-style cast to Cpp cast * Changed reference to pointer as most usages use pointer. * C cast -> Cpp cast * Added length parameter to sockaddr2string to protect against buffer overflow. * Lint * Removed struct keyword from parameter. * Changed inet_ntop to be passed the actual length of the buffer. Added runtime exception if inet_ntop fails for some reason. * Removed unused function * Changed switch to if statement. * Fixed accidentally removing wrong function. * Update Common++/header/IpUtils.h Removed unused include.
- Loading branch information
Showing
5 changed files
with
121 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters