static const char *kBackendId = "[PIPEBackend]";
-CoWrapper::CoWrapper(const string &command, int timeout)
+CoWrapper::CoWrapper(const string &command, int timeout, int abiVersion)
{
d_cp=0;
d_command=command;
d_timeout=timeout;
- d_abiVersion = ::arg().asNum("pipebackend-abi-version");
+ d_abiVersion = abiVersion;
launch(); // let exceptions fall through - if initial launch fails, we want to die
// I think
}
signal(SIGCHLD, SIG_IGN);
setArgPrefix("pipe"+suffix);
try {
- d_coproc=shared_ptr<CoWrapper>(new CoWrapper(getArg("command"), getArgAsNum("timeout")));
+ d_coproc=shared_ptr<CoWrapper>(new CoWrapper(getArg("command"), getArgAsNum("timeout"), getArgAsNum("abi-version")));
d_regex=getArg("regex").empty() ? 0 : new Regex(getArg("regex"));
d_regexstr=getArg("regex");
d_abiVersion = getArgAsNum("abi-version");
realRemote = pkt_p->getRealRemote();
remoteIP = pkt_p->getRemote();
}
- // pipebackend-abi-version = 1
+ // abi-version = 1
// type qname qclass qtype id remote-ip-address
query<<"Q\t"<<qname.toStringNoDot()<<"\tIN\t"<<qtype.getName()<<"\t"<<zoneId<<"\t"<<remoteIP;
- // add the local-ip-address if pipebackend-abi-version is set to 2
+ // add the local-ip-address if abi-version is set to 2
if (d_abiVersion >= 2)
query<<"\t"<<localIP;
if(d_abiVersion >= 3)
class CoWrapper
{
public:
- CoWrapper(const string &command, int timeout=0);
+ CoWrapper(const string &command, int timeout, int abiVersion);
~CoWrapper();
void send(const string &line);
void receive(string &line);
void loadMainConfig(const std::string& configdir)
{
::arg().set("config-dir","Location of configuration directory (pdns.conf)")=configdir;
- ::arg().set("pipebackend-abi-version","Version of the pipe backend ABI")="1";
::arg().set("default-ttl","Seconds a result is valid if not set otherwise")="3600";
::arg().set("launch","Which backends to launch");
::arg().set("dnssec","if we should do dnssec")="true";