pike.git/
lib/
modules/
Protocols.pmod/
DNS.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2013-04-05
2013-04-05 18:26:23 by Tobias S. Josefowitz <tobij@tobij.de>
0a5172a1bd39a37167a0be81d30fcfc1c14e379d (
31
lines) (+
31
/-
0
)
[
Show
|
Annotate
]
Branch:
7.9
Protocols.DNS.dual_server: A DNS server operating in UDP and TCP mode.
879:
//! //! This class is typically used by inheriting it, //! and overloading @[reply_query()] and @[handle_response()].
+
//!
+
//! @seealso
+
//! @[dual_server]
class server { //!
1096:
::destroy(); }
+
}
-
+
//! This is both a @[server] and @[tcp_server].
+
class dual_server {
+
inherit server : UDP;
+
inherit tcp_server : TCP;
+
+
protected void send_reply(mapping r, mapping q, mapping m,
+
Connection|Stdio.UDP con) {
+
string rpl = low_send_reply(r, q, m);
+
+
if (!con->tcp_connection) {
+
if (sizeof(rpl) > 512) {
+
rpl = sprintf("%s%8c", rpl[..3], 0); // truncate after header and
+
// send empty response
+
// ("dnscache strategy")
+
rpl[2] |= 2; // set TC bit
+
}
+
con->send(m->ip, m->port, rpl);
+
} else
+
con->send(rpl);
+
}
+
+
protected void create(int|string|void arg1, string|int ... args)
+
{
+
::create(arg1, @args);
+
}
+
protected void destroy() { ::destroy();