pike.git / lib / modules / Protocols.pmod / DNS.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/DNS.pmod:872:    destruct(port);    }    }   }      //! Base class for implementing a Domain Name Service (DNS) server operating   //! over UDP.   //!   //! This class is typically used by inheriting it,   //! and overloading @[reply_query()] and @[handle_response()]. + //! + //! @seealso + //! @[dual_server]   class server   {    //!    inherit server_base;       //inherit Stdio.UDP : udp;       protected void send_reply(mapping r, mapping q, mapping m, Stdio.UDP udp) {    udp->send(m->ip, m->port, low_send_reply(r, q, m));    }
pike.git/lib/modules/Protocols.pmod/DNS.pmod:1089:    }       protected void destroy()    {    foreach (connections; Connection con;) {    destruct(con);    }       ::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();    }   }         #define RETRIES 12   #define RETRY_DELAY 5