Branch: Tag:

2013-04-05

2013-04-05 18:26:23 by Tobias S. Josefowitz <tobij@tobij.de>

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();