/**
 * Autogenerated by Thrift Compiler (0.13.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
#ifndef Extension_H
#define Extension_H

#include "osquery_types.h"
#include <memory>
#include <thrift/TDispatchProcessor.h>
#include <thrift/async/TConcurrentClientSyncInfo.h>

namespace osquery { namespace extensions {

#ifdef _MSC_VER
  #pragma warning( push )
  #pragma warning (disable : 4250 ) //inheriting methods via dominance 
#endif

class ExtensionIf {
 public:
  virtual ~ExtensionIf() {}
  virtual void ping(ExtensionStatus& _return) = 0;
  virtual void call(ExtensionResponse& _return, const std::string& registry, const std::string& item, const ExtensionPluginRequest& request) = 0;
  virtual void shutdown() = 0;
};

class ExtensionIfFactory {
 public:
  typedef ExtensionIf Handler;

  virtual ~ExtensionIfFactory() {}

  virtual ExtensionIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
  virtual void releaseHandler(ExtensionIf* /* handler */) = 0;
};

class ExtensionIfSingletonFactory : virtual public ExtensionIfFactory {
 public:
  ExtensionIfSingletonFactory(const ::std::shared_ptr<ExtensionIf>& iface)
      : iface_(iface) {}
  virtual ~ExtensionIfSingletonFactory() {}

  virtual ExtensionIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
    return iface_.get();
  }
  virtual void releaseHandler(ExtensionIf* /* handler */) {}

 protected:
  ::std::shared_ptr<ExtensionIf> iface_;
};

class ExtensionNull : virtual public ExtensionIf {
 public:
  virtual ~ExtensionNull() {}
  void ping(ExtensionStatus& /* _return */) {
    return;
  }
  void call(ExtensionResponse& /* _return */, const std::string& /* registry */, const std::string& /* item */, const ExtensionPluginRequest& /* request */) {
    return;
  }
  void shutdown() {
    return;
  }
};


class Extension_ping_args {
 public:

  Extension_ping_args(const Extension_ping_args&);
  Extension_ping_args(Extension_ping_args&&);
  Extension_ping_args& operator=(const Extension_ping_args&);
  Extension_ping_args& operator=(Extension_ping_args&&);
  Extension_ping_args() {
  }

  virtual ~Extension_ping_args() noexcept;

  bool operator == (const Extension_ping_args & /* rhs */) const
  {
    return true;
  }
  bool operator != (const Extension_ping_args &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const Extension_ping_args & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};


class Extension_ping_pargs {
 public:
  virtual ~Extension_ping_pargs() noexcept;

  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};

typedef struct _Extension_ping_result__isset {
  _Extension_ping_result__isset() : success(false) {}
  bool success :1;
} _Extension_ping_result__isset;

class Extension_ping_result {
 public:

  Extension_ping_result(const Extension_ping_result&);
  Extension_ping_result(Extension_ping_result&&);
  Extension_ping_result& operator=(const Extension_ping_result&);
  Extension_ping_result& operator=(Extension_ping_result&&);
  Extension_ping_result() {
  }

  virtual ~Extension_ping_result() noexcept;
  ExtensionStatus success;

  _Extension_ping_result__isset __isset;

  void __set_success(const ExtensionStatus& val);

  bool operator == (const Extension_ping_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const Extension_ping_result &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const Extension_ping_result & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};

typedef struct _Extension_ping_presult__isset {
  _Extension_ping_presult__isset() : success(false) {}
  bool success :1;
} _Extension_ping_presult__isset;

class Extension_ping_presult {
 public:
  virtual ~Extension_ping_presult() noexcept;
  ExtensionStatus* success;

  _Extension_ping_presult__isset __isset;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);

};

typedef struct _Extension_call_args__isset {
  _Extension_call_args__isset() : registry(false), item(false), request(false) {}
  bool registry :1;
  bool item :1;
  bool request :1;
} _Extension_call_args__isset;

class Extension_call_args {
 public:

  Extension_call_args(const Extension_call_args&);
  Extension_call_args(Extension_call_args&&);
  Extension_call_args& operator=(const Extension_call_args&);
  Extension_call_args& operator=(Extension_call_args&&);
  Extension_call_args() : registry(), item() {
  }

  virtual ~Extension_call_args() noexcept;
  std::string registry;
  std::string item;
  ExtensionPluginRequest request;

  _Extension_call_args__isset __isset;

  void __set_registry(const std::string& val);

  void __set_item(const std::string& val);

  void __set_request(const ExtensionPluginRequest& val);

  bool operator == (const Extension_call_args & rhs) const
  {
    if (!(registry == rhs.registry))
      return false;
    if (!(item == rhs.item))
      return false;
    if (!(request == rhs.request))
      return false;
    return true;
  }
  bool operator != (const Extension_call_args &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const Extension_call_args & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};


class Extension_call_pargs {
 public:
  virtual ~Extension_call_pargs() noexcept;
  const std::string* registry;
  const std::string* item;
  const ExtensionPluginRequest* request;

  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};

typedef struct _Extension_call_result__isset {
  _Extension_call_result__isset() : success(false) {}
  bool success :1;
} _Extension_call_result__isset;

class Extension_call_result {
 public:

  Extension_call_result(const Extension_call_result&);
  Extension_call_result(Extension_call_result&&);
  Extension_call_result& operator=(const Extension_call_result&);
  Extension_call_result& operator=(Extension_call_result&&);
  Extension_call_result() {
  }

  virtual ~Extension_call_result() noexcept;
  ExtensionResponse success;

  _Extension_call_result__isset __isset;

  void __set_success(const ExtensionResponse& val);

  bool operator == (const Extension_call_result & rhs) const
  {
    if (!(success == rhs.success))
      return false;
    return true;
  }
  bool operator != (const Extension_call_result &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const Extension_call_result & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};

typedef struct _Extension_call_presult__isset {
  _Extension_call_presult__isset() : success(false) {}
  bool success :1;
} _Extension_call_presult__isset;

class Extension_call_presult {
 public:
  virtual ~Extension_call_presult() noexcept;
  ExtensionResponse* success;

  _Extension_call_presult__isset __isset;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);

};


class Extension_shutdown_args {
 public:

  Extension_shutdown_args(const Extension_shutdown_args&);
  Extension_shutdown_args(Extension_shutdown_args&&);
  Extension_shutdown_args& operator=(const Extension_shutdown_args&);
  Extension_shutdown_args& operator=(Extension_shutdown_args&&);
  Extension_shutdown_args() {
  }

  virtual ~Extension_shutdown_args() noexcept;

  bool operator == (const Extension_shutdown_args & /* rhs */) const
  {
    return true;
  }
  bool operator != (const Extension_shutdown_args &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const Extension_shutdown_args & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};


class Extension_shutdown_pargs {
 public:
  virtual ~Extension_shutdown_pargs() noexcept;

  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};


class Extension_shutdown_result {
 public:

  Extension_shutdown_result(const Extension_shutdown_result&);
  Extension_shutdown_result(Extension_shutdown_result&&);
  Extension_shutdown_result& operator=(const Extension_shutdown_result&);
  Extension_shutdown_result& operator=(Extension_shutdown_result&&);
  Extension_shutdown_result() {
  }

  virtual ~Extension_shutdown_result() noexcept;

  bool operator == (const Extension_shutdown_result & /* rhs */) const
  {
    return true;
  }
  bool operator != (const Extension_shutdown_result &rhs) const {
    return !(*this == rhs);
  }

  bool operator < (const Extension_shutdown_result & ) const;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
  uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;

};


class Extension_shutdown_presult {
 public:
  virtual ~Extension_shutdown_presult() noexcept;

  uint32_t read(::apache::thrift::protocol::TProtocol* iprot);

};

class ExtensionClient : virtual public ExtensionIf {
 public:
  ExtensionClient(std::shared_ptr<::apache::thrift::protocol::TProtocol> prot) {
    setProtocol(prot);
  }
  ExtensionClient(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> iprot,
      std::shared_ptr<::apache::thrift::protocol::TProtocol> oprot) {
    setProtocol(iprot,oprot);
  }

 private:
  void setProtocol(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> prot) {
    setProtocol(prot, prot);
  }
  void setProtocol(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> iprot,
      std::shared_ptr<::apache::thrift::protocol::TProtocol> oprot) {
    piprot_=iprot;
    poprot_=oprot;
    iprot_ = iprot.get();
    oprot_ = oprot.get();
  }

 public:
  std::shared_ptr<::apache::thrift::protocol::TProtocol> getInputProtocol() {
    return piprot_;
  }
  std::shared_ptr<::apache::thrift::protocol::TProtocol> getOutputProtocol() {
    return poprot_;
  }
  void ping(ExtensionStatus& _return);
  void send_ping();
  void recv_ping(ExtensionStatus& _return);
  void call(ExtensionResponse& _return, const std::string& registry, const std::string& item, const ExtensionPluginRequest& request);
  void send_call(const std::string& registry, const std::string& item, const ExtensionPluginRequest& request);
  void recv_call(ExtensionResponse& _return);
  void shutdown();
  void send_shutdown();
  void recv_shutdown();
 protected:
  std::shared_ptr<::apache::thrift::protocol::TProtocol> piprot_;
  std::shared_ptr<::apache::thrift::protocol::TProtocol> poprot_;
  ::apache::thrift::protocol::TProtocol* iprot_;
  ::apache::thrift::protocol::TProtocol* oprot_;
};

class ExtensionProcessor : public ::apache::thrift::TDispatchProcessor {
 protected:
  ::std::shared_ptr<ExtensionIf> iface_;
  virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext);
 private:
  typedef  void (ExtensionProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*);
  typedef std::map<std::string, ProcessFunction> ProcessMap;
  ProcessMap processMap_;
  void process_ping(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_call(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
  void process_shutdown(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
 public:
  ExtensionProcessor(::std::shared_ptr<ExtensionIf> iface) : iface_(iface) {
    processMap_["ping"] = &ExtensionProcessor::process_ping;
    processMap_["call"] = &ExtensionProcessor::process_call;
    processMap_["shutdown"] = &ExtensionProcessor::process_shutdown;
  }

  virtual ~ExtensionProcessor() {}
};

class ExtensionProcessorFactory : public ::apache::thrift::TProcessorFactory {
 public:
  ExtensionProcessorFactory(
      const ::std::shared_ptr<ExtensionIfFactory>& handlerFactory)
      : handlerFactory_(handlerFactory) {}

  ::std::shared_ptr<::apache::thrift::TProcessor> getProcessor(
      const ::apache::thrift::TConnectionInfo& connInfo);

 protected:
  ::std::shared_ptr<ExtensionIfFactory> handlerFactory_;
};

class ExtensionMultiface : virtual public ExtensionIf {
 public:
  ExtensionMultiface(std::vector<std::shared_ptr<ExtensionIf>>& ifaces)
      : ifaces_(ifaces) {}
  virtual ~ExtensionMultiface() {}
 protected:
  std::vector<std::shared_ptr<ExtensionIf>> ifaces_;
  ExtensionMultiface() {}
  void add(::std::shared_ptr<ExtensionIf> iface) {
    ifaces_.push_back(iface);
  }

 public:
  void ping(ExtensionStatus& _return) {
    size_t sz = ifaces_.size();
    size_t i = 0;
    for (; i < (sz - 1); ++i) {
      ifaces_[i]->ping(_return);
    }
    ifaces_[i]->ping(_return);
    return;
  }

  void call(ExtensionResponse& _return, const std::string& registry, const std::string& item, const ExtensionPluginRequest& request) {
    size_t sz = ifaces_.size();
    size_t i = 0;
    for (; i < (sz - 1); ++i) {
      ifaces_[i]->call(_return, registry, item, request);
    }
    ifaces_[i]->call(_return, registry, item, request);
    return;
  }

  void shutdown() {
    size_t sz = ifaces_.size();
    size_t i = 0;
    for (; i < (sz - 1); ++i) {
      ifaces_[i]->shutdown();
    }
    ifaces_[i]->shutdown();
  }

};

// The 'concurrent' client is a thread safe client that correctly handles
// out of order responses.  It is slower than the regular client, so should
// only be used when you need to share a connection among multiple threads
class ExtensionConcurrentClient : virtual public ExtensionIf {
 public:
  ExtensionConcurrentClient(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> prot,
      std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync)
      : sync_(sync) {
    setProtocol(prot);
  }
  ExtensionConcurrentClient(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> iprot,
      std::shared_ptr<::apache::thrift::protocol::TProtocol> oprot,
      std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync)
      : sync_(sync) {
    setProtocol(iprot,oprot);
  }

 private:
  void setProtocol(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> prot) {
    setProtocol(prot, prot);
  }
  void setProtocol(
      std::shared_ptr<::apache::thrift::protocol::TProtocol> iprot,
      std::shared_ptr<::apache::thrift::protocol::TProtocol> oprot) {
    piprot_=iprot;
    poprot_=oprot;
    iprot_ = iprot.get();
    oprot_ = oprot.get();
  }

 public:
  std::shared_ptr<::apache::thrift::protocol::TProtocol> getInputProtocol() {
    return piprot_;
  }
  std::shared_ptr<::apache::thrift::protocol::TProtocol> getOutputProtocol() {
    return poprot_;
  }
  void ping(ExtensionStatus& _return);
  int32_t send_ping();
  void recv_ping(ExtensionStatus& _return, const int32_t seqid);
  void call(ExtensionResponse& _return, const std::string& registry, const std::string& item, const ExtensionPluginRequest& request);
  int32_t send_call(const std::string& registry, const std::string& item, const ExtensionPluginRequest& request);
  void recv_call(ExtensionResponse& _return, const int32_t seqid);
  void shutdown();
  int32_t send_shutdown();
  void recv_shutdown(const int32_t seqid);
 protected:
  std::shared_ptr<::apache::thrift::protocol::TProtocol> piprot_;
  std::shared_ptr<::apache::thrift::protocol::TProtocol> poprot_;
  ::apache::thrift::protocol::TProtocol* iprot_;
  ::apache::thrift::protocol::TProtocol* oprot_;
  std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync_;
};

#ifdef _MSC_VER
  #pragma warning( pop )
#endif

}} // namespace

#endif
