-
Notifications
You must be signed in to change notification settings - Fork 381
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
Add RAW Socket support for ACE #2065
Conversation
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.
Not a complete review, just a quick scan
ACE/ace/RAW_Socket.cpp
Outdated
}; | ||
#endif | ||
|
||
#define SEND_EXCEPTION_RETURN() do{\ |
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.
Prefix with ACE_
so that they don't clash with any other define
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.
OK
ACE/ace/RAW_Socket.cpp
Outdated
|
||
} | ||
|
||
static inline ssize_t using_common_recv(const ACE_RAW_SOCKET& raw, void *buf, size_t n, ACE_INET_Addr &addr, int flags) |
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 static?
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.
I want the function is inside the module and can not be referred by others
ACE/ace/RAW_Socket.cpp
Outdated
{ | ||
ACE_TRACE ("ACE_RAW_SOCKET::recv"); | ||
|
||
RECV_EXCEPTION_RETURN(); |
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.
I don't like the macros for this, makes it very hard to see what is checked
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.
The checking conditions are unlikely and trivial, so need not care what is the exceptions .
The common macro trick can return the flow in place without any further if statement and can reduce the cyclomatic complexity
ACE/ace/RAW_Socket.cpp
Outdated
#endif /* ACE_HAS_SOCKADDR_MSG_NAME */ | ||
send_msg.msg_namelen = addr.get_size (); | ||
|
||
#if defined (ACE_HAS_4_4BSD_SENDMSG_RECVMSG) |
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.
Use nullptr for pointers
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.
Firstly I use nullptr according to the ACE developer guideline.
But when I migrated the RAW Socket into ACE 6.5.x version and compiled the ACE lib on CentOS7 with gcc4.8, I got some compiling error about nullptr, so I modify them to NULL keyword :(
ACE/ace/RAW_Socket.cpp
Outdated
if (this->get_handle () != ACE_INVALID_HANDLE) | ||
return -1; | ||
|
||
const int protocol_family = local.get_type (); |
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.
ACE uses east const, so int const
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.
ok
ACE/ace/RAW_Socket.h
Outdated
* - Setting the protocol para to be IPPROTO_SCTP will filter all SCTP protocol packages with the destination is its bound address. | ||
* It can form the basis of a user-space SCTP protocol stack in more general platforms. | ||
* | ||
* - Setting the protocol para to be IPPROTO_RAW will make it as a send only socket for any customized package formed from IP header to be send. |
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.
parameter
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.
Do you mean the 'para' word needed to be fixed ?
ACE/tests/RAW_Socket_Test.cpp
Outdated
run_option_test () | ||
{ | ||
|
||
ACE_DEBUG ((LM_INFO, "%s begin to run ...\n", __func__)); |
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.
Logging ascii is %C
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.
OK
So I relaunch the review flow :) |
Please don't try to assign me as reviewer, my free time for unsponsored work is very limited, you have to wait until I have time, no idea when I have time for a full review. |
OK :( Can you assign other team member to review ? |
When someone has time they will have a look, no guarantees, see https://github.com/DOCGroup/ACE_TAO/wiki/ACE-and-TAO-Commercial-support when you need guarantees, including @RemedyIT, the company I work for |
We do appreciate your contribution! It is only that our time is very limited at this moment. |
I will add other features to I will launch the PR lately based on a special branch :) |
I have completed the work of RAW Socket by referring ACE_ICMP_Socket & ACE_Sock_Dgram classes, these are provided by ACE long time ago.
I have tested the api of RAW Socket on Linux platforms, such as Ubuntu 20.04 and CentOS 7.
On windows platform , there exist some surprise maybe for OS limits, RAW_Socket_Test case can not pass through.
For considering the fact the applications using RAW Socket almost run on Unix* or Linux* platforms, this fail is trivial!
So I decide to launch the PR :)