Branch data Line data Source code
1 : : // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
2 : : //
3 : : // Permission to use, copy, modify, and/or distribute this software for any
4 : : // purpose with or without fee is hereby granted, provided that the above
5 : : // copyright notice and this permission notice appear in all copies.
6 : : //
7 : : // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
8 : : // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9 : : // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
10 : : // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11 : : // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
12 : : // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13 : : // PERFORMANCE OF THIS SOFTWARE.
14 : :
15 : : #ifndef __DUMMY_IO_CB_H
16 : : #define __DUMMY_IO_CB_H
17 : :
18 : : #include <iostream>
19 : :
20 : : #include <asio/error.hpp>
21 : : #include <asio/error_code.hpp>
22 : :
23 : : namespace isc {
24 : : namespace asiolink {
25 : :
26 : : /// \brief Asynchronous I/O Completion Callback
27 : : ///
28 : : /// The two socket classes (UDPSocket and TCPSocket) require that the I/O
29 : : /// completion callback function have an operator() method with the appropriate
30 : : /// signature. The classes are templates, any class with that method and
31 : : /// signature can be passed as the callback object - there is no need for a
32 : : /// base class defining the interface. However, some users of the socket
33 : : /// classes do not use the asynchronous I/O operations, yet have to supply a
34 : : /// template parameter. This is the reason for this class - it is the dummy
35 : : /// template parameter.
36 : :
37 : : class DummyIOCallback {
38 : : public:
39 : :
40 : : /// \brief Asynchronous I/O callback method
41 : : ///
42 : : /// TODO: explain why this method should never be called.
43 : : /// This should be unused.
44 : 0 : void operator()(asio::error_code)
45 : : {
46 : : // TODO: log an error if this method ever gets called.
47 : 0 : }
48 : :
49 : : /// \brief Asynchronous I/O callback method
50 : : ///
51 : : /// TODO: explain why this method should never be called.
52 : : /// This should be unused.
53 : 0 : void operator()(asio::error_code, size_t)
54 : : {
55 : : // TODO: log an error if this method ever gets called.
56 : 0 : }
57 : : };
58 : :
59 : : } // namespace asiolink
60 : : } // namespace isc
61 : :
62 : : #endif // __DUMMY_IO_CB_H
|