BIND 10 #2916: define asiolink::IOSocketLocal
BIND 10 Development
do-not-reply at isc.org
Fri Apr 12 07:37:08 UTC 2013
#2916: define asiolink::IOSocketLocal
-------------------------------------+-------------------------------------
Reporter: | Owner:
jinmei | Status: new
Type: task | Milestone:
Priority: | Keywords:
medium | Sensitive: 0
Component: data | Sub-Project: DNS
source | Estimated Difficulty: 0
CVSS Scoring: | Total Hours: 0
Defect Severity: N/A |
Feature Depending on Ticket: |
shared memory data source |
Add Hours to Ticket: 0 |
Internal?: 0 |
-------------------------------------+-------------------------------------
To support http://bind10.isc.org/ticket/2861#comment:4 we need
a wrapper for AF_UNIX (local) socket in the form of
`asiolink::IOSocket`. We could alternatively use asio definitions
directly, but I'd like to avoid that as including asio.hpp has caused
many troubles (we cannot completely avoid that but it's better to hide
it in some wrapper).
My suggestion is something like this:
{{{#!cpp
namespace isc {
namespace asiolink {
class IOSocketLocal : public IOSocket /* probably noncopyable */ {
public:
// Allow construction from a file descriptor
IOSocketLocal(IOService& io_service, int fd);
// wait until buf_len size of data arrived on the socket, at which
point
// callback will be called. passed buf will have the data. in case
// an error happens, error would contain asio::error.message();
otherwise
// it will be empty.
void asyncRead(boost::function<void(const std::string& error)>
callback,
void* buf, size_t buf_len);
};
}
}
}}}
For the purpose of #2861 it doesn't actually have to be derived from
`IOSocket`, but it may be convenient if and when we want to extend it
for other types of AF_UNIX sockets, such as for CC communication.
For #2861, the auth main thread will use a socketpair(2) and pass one
of the socket FD to the constructor.
--
Ticket URL: <http://bind10.isc.org/ticket/2916>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list