-
Notifications
You must be signed in to change notification settings - Fork 156
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
Added TCP LinkLayer to socktap #191
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.
I like the addition of a TCP link layer, this is cool stuff!
Please have a look at my comments which I would like to sort out before merging. Thanks!
std::string tcp_ip; | ||
unsigned short tcp_port, tcp_ip_len; | ||
|
||
if (vm.count("tcp-connect")) { |
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 am not sure if vm.count
is necessary: An empty vector of string would be just fine.
tools/socktap/tcp_link.hpp
Outdated
|
||
private: | ||
std::list<TcpSocket*> sockets_; | ||
std::map<boost::asio::ip::tcp::endpoint, boost::asio::ip::tcp::acceptor*> acceptors_; |
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.
Same here, storing acceptor
objects instead of pointers simplifies memory management.
Nice! Let me give it a final try, I will merge it then. |
I've just encountered some issues with it today. |
@riebl I have resolved the issues. |
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 have just noticed that there is no frame delimiter in the TCP stream. Your implementation cannot cope with situations where the IP stack transmits/receives data in chunks of different sizes than your socket calls pass/expect.
Thanks a lot for your patience while contributing your TCP link layer! |
I've added TCP to socktap.
To accept incoming connections, use
--tcp-accept 127.0.0.1:12345
.To connect to another service, use
--tcp-connect 127.0.0.1:12345
.