From 16c2a9b64baf308a74641c49f34776e3ddb4e1df Mon Sep 17 00:00:00 2001 From: prufer Date: Mon, 25 Dec 2023 23:25:13 -0800 Subject: [PATCH] EOS SDK v2.22.5 (EOS 4.31.1F) --- Dockerfile | 2 +- EosSdk.i | 1 + Includes.i | 10 +- SdkImpl.h | 4 +- eos/inline/types/nexthop_group.h | 9 + eos/inline/types/nexthop_group_impl.h | 27 +- eos/types/nexthop_group.h | 6 + eos/types/nexthop_group_impl.h | 7 + eos/version.h | 4 +- examples/EosThrift_constants.cpp | 17 + examples/EosThrift_constants.h | 24 + examples/EosThrift_types.cpp | 50 + examples/EosThrift_types.h | 50 + examples/SimpleBfdAgent.py | 53 + examples/ThriftSdk.cpp | 1907 +++++++++++++++++++++++++ examples/ThriftSdk.h | 776 ++++++++++ examples/thriftconfig.h | 3 + version.m4 | 2 +- 18 files changed, 2937 insertions(+), 15 deletions(-) create mode 100644 examples/EosThrift_constants.cpp create mode 100644 examples/EosThrift_constants.h create mode 100644 examples/EosThrift_types.cpp create mode 100644 examples/EosThrift_types.h create mode 100644 examples/SimpleBfdAgent.py create mode 100644 examples/ThriftSdk.cpp create mode 100644 examples/ThriftSdk.h create mode 100644 examples/thriftconfig.h diff --git a/Dockerfile b/Dockerfile index aa4e929..36df504 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ #----------------------------------------------------------------------------------- FROM centos:7 -ARG version=2.22.3 +ARG version=2.22.5 ARG arch="m32" # Set eossdk version as label and environ variable. diff --git a/EosSdk.i b/EosSdk.i index fa4cf48..a74fdde 100644 --- a/EosSdk.i +++ b/EosSdk.i @@ -355,6 +355,7 @@ void throw_py_error(error const& err) { %template() std::pair; %template() std::unordered_set; %template() std::unordered_set; +%template() std::unordered_set; %template() std::map; %template() std::list; %template() std::vector; diff --git a/Includes.i b/Includes.i index a5b5403..cc956cb 100644 --- a/Includes.i +++ b/Includes.i @@ -19,7 +19,6 @@ %include "eos/types/macsec.h" %include "eos/types/mpls.h" %include "eos/types/mpls_vrf_label.h" -%include "eos/types/nexthop_group.h" %include "eos/types/structured_filter.h" %include "eos/types/vrf.h" %include "eos/types/subintf.h" @@ -38,6 +37,8 @@ %include "eos/types/mpls_route.h" %include "eos/types/neighbor_table.h" %include "eos/types/nexthop_group_tunnel.h" +%include "eos/bfd.h" +%include "eos/types/nexthop_group.h" %include "eos/acl.h" %include "eos/types/policy_map.h" %include "eos/ip_route.h" @@ -78,13 +79,11 @@ %include "eos/inline/types/macsec.h" %include "eos/inline/types/mpls.h" %include "eos/inline/types/mpls_vrf_label.h" -%include "eos/inline/types/nexthop_group.h" %include "eos/inline/types/structured_filter.h" %include "eos/inline/types/vrf.h" %include "eos/sdk.h" %include "eos/vrf.h" %include "eos/xcvr.h" -%include "eos/bfd.h" %include "eos/eth_intf.h" %include "eos/eth_phy_intf.h" %include "eos/inline/hardware_table.h" @@ -96,7 +95,6 @@ %include "eos/lldp.h" %include "eos/macsec.h" %include "eos/mlag.h" -%include "eos/nexthop_group.h" %include "eos/subintf.h" %include "eos/system.h" %include "eos/aresolve.h" @@ -112,7 +110,6 @@ %include "eos/inline/lldp.h" %include "eos/inline/macsec.h" %include "eos/inline/mlag.h" -%include "eos/inline/nexthop_group.h" %include "eos/inline/system.h" %include "eos/inline/types/aresolve.h" %include "eos/inline/types/bgp.h" @@ -139,8 +136,11 @@ %include "eos/inline/mpls_route.h" %include "eos/inline/neighbor_table.h" %include "eos/inline/nexthop_group_tunnel.h" +%include "eos/inline/types/nexthop_group.h" %include "eos/inline/types/policy_map.h" +%include "eos/nexthop_group.h" %include "eos/fib.h" +%include "eos/inline/nexthop_group.h" %include "eos/inline/policy_map.h" %include "eos/inline/types/fib.h" %include "eos/inline/types/route_map.h" diff --git a/SdkImpl.h b/SdkImpl.h index 89f7403..67f63f4 100644 --- a/SdkImpl.h +++ b/SdkImpl.h @@ -336,7 +336,6 @@ inline eth_phy_intf_mgr * sdk::SdkImpl::get_eth_phy_intf_mgr() { inline eth_phy_intf_counter_mgr * sdk::SdkImpl::get_eth_phy_intf_counter_mgr() { eos::print_profiles::add_profile("IntfMgrHelper"); - eos::print_profiles::add_profile("eth_phy_intf"); GET_NO_MOUNT_MGR(eth_phy_intf_counter) } @@ -368,7 +367,8 @@ inline intf_mgr * sdk::SdkImpl::get_intf_mgr() { } inline intf_counter_mgr * sdk::SdkImpl::get_intf_counter_mgr() { - eos::print_profiles::add_profile("intf"); + eos::print_profiles::add_profile( "IntfMgrHelper" ); + eos::print_profiles::add_profile( "intf" ); GET_NO_MOUNT_MGR(intf_counter) } diff --git a/eos/inline/types/nexthop_group.h b/eos/inline/types/nexthop_group.h index e905b24..565c156 100644 --- a/eos/inline/types/nexthop_group.h +++ b/eos/inline/types/nexthop_group.h @@ -280,6 +280,15 @@ void nexthop_group_entry_t::intf_is(intf_id_t const & intf) { pimpl->intf_is(intf); } +sbfd_echo_session_key_t +nexthop_group_entry_t::sbfd_session_key() const { + return pimpl->sbfd_session_key(); +} +void +nexthop_group_entry_t::sbfd_session_key_is( + sbfd_echo_session_key_t const & sbfd_session_key) { + pimpl->sbfd_session_key_is(sbfd_session_key); +} std::string nexthop_group_entry_t::child_nexthop_group() const { return pimpl->child_nexthop_group(); diff --git a/eos/inline/types/nexthop_group_impl.h b/eos/inline/types/nexthop_group_impl.h index 43969fc..02d63a7 100644 --- a/eos/inline/types/nexthop_group_impl.h +++ b/eos/inline/types/nexthop_group_impl.h @@ -212,22 +212,25 @@ operator<<(std::ostream& os, const nexthop_group_entry_counter_impl_t& obj) { nexthop_group_entry_impl_t::nexthop_group_entry_impl_t() : - mpls_action_(), nexthop_(), intf_(), child_nexthop_group_() { + mpls_action_(), nexthop_(), intf_(), sbfd_session_key_(), + child_nexthop_group_() { } nexthop_group_entry_impl_t::nexthop_group_entry_impl_t( ip_addr_t const & nexthop) : - mpls_action_(), nexthop_(nexthop), intf_(), child_nexthop_group_() { + mpls_action_(), nexthop_(nexthop), intf_(), sbfd_session_key_(), + child_nexthop_group_() { } nexthop_group_entry_impl_t::nexthop_group_entry_impl_t( ip_addr_t const & nexthop, intf_id_t const & intf) : - mpls_action_(), nexthop_(nexthop), intf_(intf), child_nexthop_group_() { + mpls_action_(), nexthop_(nexthop), intf_(intf), sbfd_session_key_(), + child_nexthop_group_() { } nexthop_group_entry_impl_t::nexthop_group_entry_impl_t( std::string const & child_nexthop_group) : - mpls_action_(), nexthop_(), intf_(), + mpls_action_(), nexthop_(), intf_(), sbfd_session_key_(), child_nexthop_group_(child_nexthop_group) { } @@ -274,6 +277,17 @@ nexthop_group_entry_impl_t::intf_is(intf_id_t const & intf) { intf_ = intf; } +sbfd_echo_session_key_t +nexthop_group_entry_impl_t::sbfd_session_key() const { + return sbfd_session_key_; +} + +void +nexthop_group_entry_impl_t::sbfd_session_key_is( + sbfd_echo_session_key_t const & sbfd_session_key) { + sbfd_session_key_ = sbfd_session_key; +} + std::string nexthop_group_entry_impl_t::child_nexthop_group() const { return child_nexthop_group_; @@ -297,6 +311,7 @@ nexthop_group_entry_impl_t::operator==(nexthop_group_entry_impl_t const & other) return mpls_action_ == other.mpls_action_ && nexthop_ == other.nexthop_ && intf_ == other.intf_ && + sbfd_session_key_ == other.sbfd_session_key_ && child_nexthop_group_ == other.child_nexthop_group_; } @@ -315,6 +330,8 @@ nexthop_group_entry_impl_t::operator<(nexthop_group_entry_impl_t const & other) return nexthop_ < other.nexthop_; } else if(intf_ != other.intf_) { return intf_ < other.intf_; + } else if(sbfd_session_key_ != other.sbfd_session_key_) { + return sbfd_session_key_ < other.sbfd_session_key_; } else if(child_nexthop_group_ != other.child_nexthop_group_) { return child_nexthop_group_ < other.child_nexthop_group_; } @@ -333,6 +350,7 @@ nexthop_group_entry_impl_t::mix_me(hash_mix & h) const { h.mix(mpls_action_); // nexthop_group_mpls_action_t h.mix(nexthop_); // ip_addr_t h.mix(intf_); // intf_id_t + h.mix(sbfd_session_key_); // sbfd_echo_session_key_t h.mix(child_nexthop_group_); // std::string } @@ -343,6 +361,7 @@ nexthop_group_entry_impl_t::to_string() const { ss << "mpls_action=" << mpls_action_; ss << ", nexthop=" << nexthop_; ss << ", intf=" << intf_; + ss << ", sbfd_session_key=" << sbfd_session_key_; ss << ", child_nexthop_group='" << child_nexthop_group_ << "'"; ss << ")"; return ss.str(); diff --git a/eos/types/nexthop_group.h b/eos/types/nexthop_group.h index 63eacb8..37b2c4b 100644 --- a/eos/types/nexthop_group.h +++ b/eos/types/nexthop_group.h @@ -4,6 +4,7 @@ #ifndef EOS_TYPES_NEXTHOP_GROUP_H #define EOS_TYPES_NEXTHOP_GROUP_H +#include #include #include #include @@ -198,6 +199,11 @@ class EOS_SDK_PUBLIC nexthop_group_entry_t { /** Setter for 'intf'. */ void intf_is(intf_id_t const & intf); + /** Getter for 'sbfd_session_key': the optional key to an sBFD session. */ + sbfd_echo_session_key_t sbfd_session_key() const; + /** Setter for 'sbfd_session_key'. */ + void sbfd_session_key_is(sbfd_echo_session_key_t const & sbfd_session_key); + /** Getter for 'child_nexthop_group': the name of next level nexthop-group. */ std::string child_nexthop_group() const; /** Setter for 'child_nexthop_group'. */ diff --git a/eos/types/nexthop_group_impl.h b/eos/types/nexthop_group_impl.h index 4e27d99..25bbecb 100644 --- a/eos/types/nexthop_group_impl.h +++ b/eos/types/nexthop_group_impl.h @@ -4,6 +4,7 @@ #ifndef EOS_TYPES_NEXTHOP_GROUP_IMPL_H #define EOS_TYPES_NEXTHOP_GROUP_IMPL_H +#include #include #include #include @@ -136,6 +137,11 @@ class EOS_SDK_PUBLIC nexthop_group_entry_impl_t { /** Setter for 'intf'. */ void intf_is(intf_id_t const & intf); + /** Getter for 'sbfd_session_key': the optional key to an sBFD session. */ + sbfd_echo_session_key_t sbfd_session_key() const; + /** Setter for 'sbfd_session_key'. */ + void sbfd_session_key_is(sbfd_echo_session_key_t const & sbfd_session_key); + /** Getter for 'child_nexthop_group': the name of next level nexthop-group. */ std::string child_nexthop_group() const; /** Setter for 'child_nexthop_group'. */ @@ -161,6 +167,7 @@ class EOS_SDK_PUBLIC nexthop_group_entry_impl_t { nexthop_group_mpls_action_t mpls_action_; ip_addr_t nexthop_; intf_id_t intf_; + sbfd_echo_session_key_t sbfd_session_key_; std::string child_nexthop_group_; }; diff --git a/eos/version.h b/eos/version.h index d565ab9..0636e56 100644 --- a/eos/version.h +++ b/eos/version.h @@ -24,10 +24,10 @@ #include -#define EOSSDK_VERSION "2.22.4" +#define EOSSDK_VERSION "2.22.5" #define EOSSDK_MAJOR 2 #define EOSSDK_MINOR 22 -#define EOSSDK_PATCH 4 +#define EOSSDK_PATCH 5 namespace eos { diff --git a/examples/EosThrift_constants.cpp b/examples/EosThrift_constants.cpp new file mode 100644 index 0000000..fc9d357 --- /dev/null +++ b/examples/EosThrift_constants.cpp @@ -0,0 +1,17 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include "EosThrift_constants.h" + +namespace eos { + +const EosThriftConstants g_EosThrift_constants; + +EosThriftConstants::EosThriftConstants() { +} + +} // namespace + diff --git a/examples/EosThrift_constants.h b/examples/EosThrift_constants.h new file mode 100644 index 0000000..08d8366 --- /dev/null +++ b/examples/EosThrift_constants.h @@ -0,0 +1,24 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef EosThrift_CONSTANTS_H +#define EosThrift_CONSTANTS_H + +#include "EosThrift_types.h" + +namespace eos { + +class EosThriftConstants { + public: + EosThriftConstants(); + +}; + +extern const EosThriftConstants g_EosThrift_constants; + +} // namespace + +#endif diff --git a/examples/EosThrift_types.cpp b/examples/EosThrift_types.cpp new file mode 100644 index 0000000..fc74dc8 --- /dev/null +++ b/examples/EosThrift_types.cpp @@ -0,0 +1,50 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include "EosThrift_types.h" + +#include +#include + +#include + +namespace eos { + +int _kOperStatusValues[] = { + OperStatus::UNKNOWN, + OperStatus::UP, + OperStatus::DOWN +}; +const char* _kOperStatusNames[] = { + "UNKNOWN", + "UP", + "DOWN" +}; +const std::map _OperStatus_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kOperStatusValues, _kOperStatusNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +int _kInterfaceTypeValues[] = { + InterfaceType::UNKNOWN, + InterfaceType::OTHER, + InterfaceType::ETH, + InterfaceType::VLAN, + InterfaceType::MANAGEMENT, + InterfaceType::LOOPBACK, + InterfaceType::LAG, + InterfaceType::NULL0 +}; +const char* _kInterfaceTypeNames[] = { + "UNKNOWN", + "OTHER", + "ETH", + "VLAN", + "MANAGEMENT", + "LOOPBACK", + "LAG", + "NULL0" +}; +const std::map _InterfaceType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(8, _kInterfaceTypeValues, _kInterfaceTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); + +} // namespace diff --git a/examples/EosThrift_types.h b/examples/EosThrift_types.h new file mode 100644 index 0000000..4d8ee91 --- /dev/null +++ b/examples/EosThrift_types.h @@ -0,0 +1,50 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef EosThrift_TYPES_H +#define EosThrift_TYPES_H + +#include + +#include +#include +#include +#include +#include + +#include + + +namespace eos { + +struct OperStatus { + enum type { + UNKNOWN = 0, + UP = 1, + DOWN = 2 + }; +}; + +extern const std::map _OperStatus_VALUES_TO_NAMES; + +struct InterfaceType { + enum type { + UNKNOWN = 0, + OTHER = 1, + ETH = 2, + VLAN = 3, + MANAGEMENT = 4, + LOOPBACK = 5, + LAG = 6, + NULL0 = 7 + }; +}; + +extern const std::map _InterfaceType_VALUES_TO_NAMES; + +} // namespace + +#endif diff --git a/examples/SimpleBfdAgent.py b/examples/SimpleBfdAgent.py new file mode 100644 index 0000000..a195cc7 --- /dev/null +++ b/examples/SimpleBfdAgent.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +# Copyright (c) 2023 Arista Networks, Inc. All rights reserved. +# Arista Networks, Inc. Confidential and Proprietary. + +import argparse +import sys +import eossdk + + +class BfdAgent( eossdk.AgentHandler, eossdk.BfdSessionHandler ): + def __init__( self, agentMgr, bfdSessionMgr, peerIp, intf ): + self.agentMgr = agentMgr + self.bfdSessionMgr = bfdSessionMgr + self.peerIp = peerIp + self.intf = intf + ipAddr = eossdk.IpAddr( self.peerIp ) + intfId = eossdk.IntfId( self.intf ) + self.peer = eossdk.BfdSessionKey( + ipAddr, "default", eossdk.BFD_SESSION_TYPE_NORMAL, intfId ) + self.tracer = eossdk.Tracer( "BfdAgent" ) + eossdk.AgentHandler.__init__( self, self.agentMgr ) + eossdk.BfdSessionHandler.__init__( self, self.bfdSessionMgr ) + self.tracer.trace0( "Constructed" ) + + def on_initialized( self ): + self.tracer.trace0( "Initialized" ) + self.bfdSessionMgr.session_set( self.peer ) + self.watch_bfd_session( self.peer, True ) + self.tracer.trace0( "BFD session created" ) + + def on_agent_enabled( self, enabled ): + self.tracer.trace0( f"Agent enabled: {enabled}" ) + if not enabled: + self.watch_bfd_session( self.peer, False ) + self.bfdSessionMgr.session_del( self.peer ) + self.tracer.trace0( "BFD session deleted" ) + self.agentMgr.agent_shutdown_complete_is( True ) + + def on_bfd_session_status( self, key, status ): + self.tracer.trace0( f"{key.to_string()} {status}" ) + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument( '--peer-ip', help="Peer's IP address", required=True ) + parser.add_argument( '--intf', help="Interface name", required=True ) + args, _ = parser.parse_known_args( sys.argv ) + sdk = eossdk.Sdk() + _ = BfdAgent( + sdk.get_agent_mgr(), + sdk.get_bfd_session_mgr(), + args.peer_ip, + args.intf ) + sdk.main_loop( sys.argv ) diff --git a/examples/ThriftSdk.cpp b/examples/ThriftSdk.cpp new file mode 100644 index 0000000..d2777ff --- /dev/null +++ b/examples/ThriftSdk.cpp @@ -0,0 +1,1907 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include "ThriftSdk.h" + +namespace eos { + + +ThriftSdk_exists_args::~ThriftSdk_exists_args() throw() { +} + + +uint32_t ThriftSdk_exists_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->intf); + this->__isset.intf = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_exists_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_exists_args"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->intf); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_exists_pargs::~ThriftSdk_exists_pargs() throw() { +} + + +uint32_t ThriftSdk_exists_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_exists_pargs"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->intf))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_exists_result::~ThriftSdk_exists_result() throw() { +} + + +uint32_t ThriftSdk_exists_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_exists_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftSdk_exists_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 0); + xfer += oprot->writeBool(this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_exists_presult::~ThriftSdk_exists_presult() throw() { +} + + +uint32_t ThriftSdk_exists_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + +ThriftSdk_adminEnabled_args::~ThriftSdk_adminEnabled_args() throw() { +} + + +uint32_t ThriftSdk_adminEnabled_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->intf); + this->__isset.intf = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_adminEnabled_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_adminEnabled_args"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->intf); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_adminEnabled_pargs::~ThriftSdk_adminEnabled_pargs() throw() { +} + + +uint32_t ThriftSdk_adminEnabled_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_adminEnabled_pargs"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->intf))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_adminEnabled_result::~ThriftSdk_adminEnabled_result() throw() { +} + + +uint32_t ThriftSdk_adminEnabled_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_adminEnabled_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftSdk_adminEnabled_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_BOOL, 0); + xfer += oprot->writeBool(this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_adminEnabled_presult::~ThriftSdk_adminEnabled_presult() throw() { +} + + +uint32_t ThriftSdk_adminEnabled_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + +ThriftSdk_adminEnabledIs_args::~ThriftSdk_adminEnabledIs_args() throw() { +} + + +uint32_t ThriftSdk_adminEnabledIs_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->intf); + this->__isset.intf = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->enabled); + this->__isset.enabled = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_adminEnabledIs_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_adminEnabledIs_args"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->intf); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("enabled", ::apache::thrift::protocol::T_BOOL, 2); + xfer += oprot->writeBool(this->enabled); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_adminEnabledIs_pargs::~ThriftSdk_adminEnabledIs_pargs() throw() { +} + + +uint32_t ThriftSdk_adminEnabledIs_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_adminEnabledIs_pargs"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->intf))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("enabled", ::apache::thrift::protocol::T_BOOL, 2); + xfer += oprot->writeBool((*(this->enabled))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_adminEnabledIs_result::~ThriftSdk_adminEnabledIs_result() throw() { +} + + +uint32_t ThriftSdk_adminEnabledIs_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + xfer += iprot->skip(ftype); + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_adminEnabledIs_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftSdk_adminEnabledIs_result"); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_adminEnabledIs_presult::~ThriftSdk_adminEnabledIs_presult() throw() { +} + + +uint32_t ThriftSdk_adminEnabledIs_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + xfer += iprot->skip(ftype); + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + +ThriftSdk_descriptionIs_args::~ThriftSdk_descriptionIs_args() throw() { +} + + +uint32_t ThriftSdk_descriptionIs_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->intf); + this->__isset.intf = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->description); + this->__isset.description = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_descriptionIs_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_descriptionIs_args"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->intf); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("description", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->description); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_descriptionIs_pargs::~ThriftSdk_descriptionIs_pargs() throw() { +} + + +uint32_t ThriftSdk_descriptionIs_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_descriptionIs_pargs"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->intf))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("description", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->description))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_descriptionIs_result::~ThriftSdk_descriptionIs_result() throw() { +} + + +uint32_t ThriftSdk_descriptionIs_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + xfer += iprot->skip(ftype); + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_descriptionIs_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftSdk_descriptionIs_result"); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_descriptionIs_presult::~ThriftSdk_descriptionIs_presult() throw() { +} + + +uint32_t ThriftSdk_descriptionIs_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + xfer += iprot->skip(ftype); + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + + +ThriftSdk_operStatus_args::~ThriftSdk_operStatus_args() throw() { +} + + +uint32_t ThriftSdk_operStatus_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->intf); + this->__isset.intf = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_operStatus_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_operStatus_args"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->intf); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_operStatus_pargs::~ThriftSdk_operStatus_pargs() throw() { +} + + +uint32_t ThriftSdk_operStatus_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ThriftSdk_operStatus_pargs"); + + xfer += oprot->writeFieldBegin("intf", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->intf))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_operStatus_result::~ThriftSdk_operStatus_result() throw() { +} + + +uint32_t ThriftSdk_operStatus_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast0; + xfer += iprot->readI32(ecast0); + this->success = (OperStatus::type)ecast0; + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftSdk_operStatus_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftSdk_operStatus_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I32, 0); + xfer += oprot->writeI32((int32_t)this->success); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +ThriftSdk_operStatus_presult::~ThriftSdk_operStatus_presult() throw() { +} + + +uint32_t ThriftSdk_operStatus_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast1; + xfer += iprot->readI32(ecast1); + (*(this->success)) = (OperStatus::type)ecast1; + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +bool ThriftSdkClient::exists(const std::string& intf) +{ + send_exists(intf); + return recv_exists(); +} + +void ThriftSdkClient::send_exists(const std::string& intf) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("exists", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_exists_pargs args; + args.intf = &intf; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +bool ThriftSdkClient::recv_exists() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("exists") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + bool _return; + ThriftSdk_exists_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + return _return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "exists failed: unknown result"); +} + +bool ThriftSdkClient::adminEnabled(const std::string& intf) +{ + send_adminEnabled(intf); + return recv_adminEnabled(); +} + +void ThriftSdkClient::send_adminEnabled(const std::string& intf) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("adminEnabled", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_adminEnabled_pargs args; + args.intf = &intf; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +bool ThriftSdkClient::recv_adminEnabled() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("adminEnabled") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + bool _return; + ThriftSdk_adminEnabled_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + return _return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "adminEnabled failed: unknown result"); +} + +void ThriftSdkClient::adminEnabledIs(const std::string& intf, const bool enabled) +{ + send_adminEnabledIs(intf, enabled); + recv_adminEnabledIs(); +} + +void ThriftSdkClient::send_adminEnabledIs(const std::string& intf, const bool enabled) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("adminEnabledIs", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_adminEnabledIs_pargs args; + args.intf = &intf; + args.enabled = &enabled; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void ThriftSdkClient::recv_adminEnabledIs() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("adminEnabledIs") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + ThriftSdk_adminEnabledIs_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + return; +} + +void ThriftSdkClient::descriptionIs(const std::string& intf, const std::string& description) +{ + send_descriptionIs(intf, description); + recv_descriptionIs(); +} + +void ThriftSdkClient::send_descriptionIs(const std::string& intf, const std::string& description) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("descriptionIs", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_descriptionIs_pargs args; + args.intf = &intf; + args.description = &description; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void ThriftSdkClient::recv_descriptionIs() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("descriptionIs") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + ThriftSdk_descriptionIs_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + return; +} + +OperStatus::type ThriftSdkClient::operStatus(const std::string& intf) +{ + send_operStatus(intf); + return recv_operStatus(); +} + +void ThriftSdkClient::send_operStatus(const std::string& intf) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("operStatus", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_operStatus_pargs args; + args.intf = &intf; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +OperStatus::type ThriftSdkClient::recv_operStatus() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("operStatus") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + OperStatus::type _return; + ThriftSdk_operStatus_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + return _return; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "operStatus failed: unknown result"); +} + +bool ThriftSdkProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { + ProcessMap::iterator pfn; + pfn = processMap_.find(fname); + if (pfn == processMap_.end()) { + iprot->skip(::apache::thrift::protocol::T_STRUCT); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); + oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return true; + } + (this->*(pfn->second))(seqid, iprot, oprot, callContext); + return true; +} + +void ThriftSdkProcessor::process_exists(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftSdk.exists", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftSdk.exists"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftSdk.exists"); + } + + ThriftSdk_exists_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftSdk.exists", bytes); + } + + ThriftSdk_exists_result result; + try { + result.success = iface_->exists(args.intf); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftSdk.exists"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("exists", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftSdk.exists"); + } + + oprot->writeMessageBegin("exists", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftSdk.exists", bytes); + } +} + +void ThriftSdkProcessor::process_adminEnabled(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftSdk.adminEnabled", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftSdk.adminEnabled"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftSdk.adminEnabled"); + } + + ThriftSdk_adminEnabled_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftSdk.adminEnabled", bytes); + } + + ThriftSdk_adminEnabled_result result; + try { + result.success = iface_->adminEnabled(args.intf); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftSdk.adminEnabled"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("adminEnabled", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftSdk.adminEnabled"); + } + + oprot->writeMessageBegin("adminEnabled", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftSdk.adminEnabled", bytes); + } +} + +void ThriftSdkProcessor::process_adminEnabledIs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftSdk.adminEnabledIs", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftSdk.adminEnabledIs"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftSdk.adminEnabledIs"); + } + + ThriftSdk_adminEnabledIs_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftSdk.adminEnabledIs", bytes); + } + + ThriftSdk_adminEnabledIs_result result; + try { + iface_->adminEnabledIs(args.intf, args.enabled); + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftSdk.adminEnabledIs"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("adminEnabledIs", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftSdk.adminEnabledIs"); + } + + oprot->writeMessageBegin("adminEnabledIs", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftSdk.adminEnabledIs", bytes); + } +} + +void ThriftSdkProcessor::process_descriptionIs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftSdk.descriptionIs", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftSdk.descriptionIs"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftSdk.descriptionIs"); + } + + ThriftSdk_descriptionIs_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftSdk.descriptionIs", bytes); + } + + ThriftSdk_descriptionIs_result result; + try { + iface_->descriptionIs(args.intf, args.description); + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftSdk.descriptionIs"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("descriptionIs", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftSdk.descriptionIs"); + } + + oprot->writeMessageBegin("descriptionIs", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftSdk.descriptionIs", bytes); + } +} + +void ThriftSdkProcessor::process_operStatus(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("ThriftSdk.operStatus", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ThriftSdk.operStatus"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "ThriftSdk.operStatus"); + } + + ThriftSdk_operStatus_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "ThriftSdk.operStatus", bytes); + } + + ThriftSdk_operStatus_result result; + try { + result.success = iface_->operStatus(args.intf); + result.__isset.success = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "ThriftSdk.operStatus"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("operStatus", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "ThriftSdk.operStatus"); + } + + oprot->writeMessageBegin("operStatus", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "ThriftSdk.operStatus", bytes); + } +} + +::boost::shared_ptr< ::apache::thrift::TProcessor > ThriftSdkProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { + ::apache::thrift::ReleaseHandler< ThriftSdkIfFactory > cleanup(handlerFactory_); + ::boost::shared_ptr< ThriftSdkIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new ThriftSdkProcessor(handler)); + return processor; +} + +bool ThriftSdkConcurrentClient::exists(const std::string& intf) +{ + int32_t seqid = send_exists(intf); + return recv_exists(seqid); +} + +int32_t ThriftSdkConcurrentClient::send_exists(const std::string& intf) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("exists", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_exists_pargs args; + args.intf = &intf; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +bool ThriftSdkConcurrentClient::recv_exists(const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("exists") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + bool _return; + ThriftSdk_exists_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + sentry.commit(); + return _return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "exists failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +bool ThriftSdkConcurrentClient::adminEnabled(const std::string& intf) +{ + int32_t seqid = send_adminEnabled(intf); + return recv_adminEnabled(seqid); +} + +int32_t ThriftSdkConcurrentClient::send_adminEnabled(const std::string& intf) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("adminEnabled", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_adminEnabled_pargs args; + args.intf = &intf; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +bool ThriftSdkConcurrentClient::recv_adminEnabled(const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("adminEnabled") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + bool _return; + ThriftSdk_adminEnabled_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + sentry.commit(); + return _return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "adminEnabled failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +void ThriftSdkConcurrentClient::adminEnabledIs(const std::string& intf, const bool enabled) +{ + int32_t seqid = send_adminEnabledIs(intf, enabled); + recv_adminEnabledIs(seqid); +} + +int32_t ThriftSdkConcurrentClient::send_adminEnabledIs(const std::string& intf, const bool enabled) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("adminEnabledIs", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_adminEnabledIs_pargs args; + args.intf = &intf; + args.enabled = &enabled; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void ThriftSdkConcurrentClient::recv_adminEnabledIs(const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("adminEnabledIs") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + ThriftSdk_adminEnabledIs_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + sentry.commit(); + return; + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +void ThriftSdkConcurrentClient::descriptionIs(const std::string& intf, const std::string& description) +{ + int32_t seqid = send_descriptionIs(intf, description); + recv_descriptionIs(seqid); +} + +int32_t ThriftSdkConcurrentClient::send_descriptionIs(const std::string& intf, const std::string& description) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("descriptionIs", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_descriptionIs_pargs args; + args.intf = &intf; + args.description = &description; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void ThriftSdkConcurrentClient::recv_descriptionIs(const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("descriptionIs") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + ThriftSdk_descriptionIs_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + sentry.commit(); + return; + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +OperStatus::type ThriftSdkConcurrentClient::operStatus(const std::string& intf) +{ + int32_t seqid = send_operStatus(intf); + return recv_operStatus(seqid); +} + +int32_t ThriftSdkConcurrentClient::send_operStatus(const std::string& intf) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("operStatus", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftSdk_operStatus_pargs args; + args.intf = &intf; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +OperStatus::type ThriftSdkConcurrentClient::recv_operStatus(const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("operStatus") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + OperStatus::type _return; + ThriftSdk_operStatus_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + sentry.commit(); + return _return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "operStatus failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +} // namespace + diff --git a/examples/ThriftSdk.h b/examples/ThriftSdk.h new file mode 100644 index 0000000..14da5d9 --- /dev/null +++ b/examples/ThriftSdk.h @@ -0,0 +1,776 @@ +/** + * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef ThriftSdk_H +#define ThriftSdk_H + +#include +#include +#include "EosThrift_types.h" + +namespace eos { + +#ifdef _WIN32 + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + +class ThriftSdkIf { + public: + virtual ~ThriftSdkIf() {} + virtual bool exists(const std::string& intf) = 0; + virtual bool adminEnabled(const std::string& intf) = 0; + virtual void adminEnabledIs(const std::string& intf, const bool enabled) = 0; + virtual void descriptionIs(const std::string& intf, const std::string& description) = 0; + virtual OperStatus::type operStatus(const std::string& intf) = 0; +}; + +class ThriftSdkIfFactory { + public: + typedef ThriftSdkIf Handler; + + virtual ~ThriftSdkIfFactory() {} + + virtual ThriftSdkIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; + virtual void releaseHandler(ThriftSdkIf* /* handler */) = 0; +}; + +class ThriftSdkIfSingletonFactory : virtual public ThriftSdkIfFactory { + public: + ThriftSdkIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + virtual ~ThriftSdkIfSingletonFactory() {} + + virtual ThriftSdkIf* getHandler(const ::apache::thrift::TConnectionInfo&) { + return iface_.get(); + } + virtual void releaseHandler(ThriftSdkIf* /* handler */) {} + + protected: + boost::shared_ptr iface_; +}; + +class ThriftSdkNull : virtual public ThriftSdkIf { + public: + virtual ~ThriftSdkNull() {} + bool exists(const std::string& /* intf */) { + bool _return = false; + return _return; + } + bool adminEnabled(const std::string& /* intf */) { + bool _return = false; + return _return; + } + void adminEnabledIs(const std::string& /* intf */, const bool /* enabled */) { + return; + } + void descriptionIs(const std::string& /* intf */, const std::string& /* description */) { + return; + } + OperStatus::type operStatus(const std::string& /* intf */) { + OperStatus::type _return = (OperStatus::type)0; + return _return; + } +}; + +typedef struct _ThriftSdk_exists_args__isset { + _ThriftSdk_exists_args__isset() : intf(false) {} + bool intf :1; +} _ThriftSdk_exists_args__isset; + +class ThriftSdk_exists_args { + public: + + ThriftSdk_exists_args(const ThriftSdk_exists_args&); + ThriftSdk_exists_args& operator=(const ThriftSdk_exists_args&); + ThriftSdk_exists_args() : intf() { + } + + virtual ~ThriftSdk_exists_args() throw(); + std::string intf; + + _ThriftSdk_exists_args__isset __isset; + + void __set_intf(const std::string& val); + + bool operator == (const ThriftSdk_exists_args & rhs) const + { + if (!(intf == rhs.intf)) + return false; + return true; + } + bool operator != (const ThriftSdk_exists_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_exists_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_exists_pargs { + public: + + + virtual ~ThriftSdk_exists_pargs() throw(); + const std::string* intf; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftSdk_exists_result__isset { + _ThriftSdk_exists_result__isset() : success(false) {} + bool success :1; +} _ThriftSdk_exists_result__isset; + +class ThriftSdk_exists_result { + public: + + ThriftSdk_exists_result(const ThriftSdk_exists_result&); + ThriftSdk_exists_result& operator=(const ThriftSdk_exists_result&); + ThriftSdk_exists_result() : success(0) { + } + + virtual ~ThriftSdk_exists_result() throw(); + bool success; + + _ThriftSdk_exists_result__isset __isset; + + void __set_success(const bool val); + + bool operator == (const ThriftSdk_exists_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const ThriftSdk_exists_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_exists_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftSdk_exists_presult__isset { + _ThriftSdk_exists_presult__isset() : success(false) {} + bool success :1; +} _ThriftSdk_exists_presult__isset; + +class ThriftSdk_exists_presult { + public: + + + virtual ~ThriftSdk_exists_presult() throw(); + bool* success; + + _ThriftSdk_exists_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftSdk_adminEnabled_args__isset { + _ThriftSdk_adminEnabled_args__isset() : intf(false) {} + bool intf :1; +} _ThriftSdk_adminEnabled_args__isset; + +class ThriftSdk_adminEnabled_args { + public: + + ThriftSdk_adminEnabled_args(const ThriftSdk_adminEnabled_args&); + ThriftSdk_adminEnabled_args& operator=(const ThriftSdk_adminEnabled_args&); + ThriftSdk_adminEnabled_args() : intf() { + } + + virtual ~ThriftSdk_adminEnabled_args() throw(); + std::string intf; + + _ThriftSdk_adminEnabled_args__isset __isset; + + void __set_intf(const std::string& val); + + bool operator == (const ThriftSdk_adminEnabled_args & rhs) const + { + if (!(intf == rhs.intf)) + return false; + return true; + } + bool operator != (const ThriftSdk_adminEnabled_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_adminEnabled_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_adminEnabled_pargs { + public: + + + virtual ~ThriftSdk_adminEnabled_pargs() throw(); + const std::string* intf; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftSdk_adminEnabled_result__isset { + _ThriftSdk_adminEnabled_result__isset() : success(false) {} + bool success :1; +} _ThriftSdk_adminEnabled_result__isset; + +class ThriftSdk_adminEnabled_result { + public: + + ThriftSdk_adminEnabled_result(const ThriftSdk_adminEnabled_result&); + ThriftSdk_adminEnabled_result& operator=(const ThriftSdk_adminEnabled_result&); + ThriftSdk_adminEnabled_result() : success(0) { + } + + virtual ~ThriftSdk_adminEnabled_result() throw(); + bool success; + + _ThriftSdk_adminEnabled_result__isset __isset; + + void __set_success(const bool val); + + bool operator == (const ThriftSdk_adminEnabled_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const ThriftSdk_adminEnabled_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_adminEnabled_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftSdk_adminEnabled_presult__isset { + _ThriftSdk_adminEnabled_presult__isset() : success(false) {} + bool success :1; +} _ThriftSdk_adminEnabled_presult__isset; + +class ThriftSdk_adminEnabled_presult { + public: + + + virtual ~ThriftSdk_adminEnabled_presult() throw(); + bool* success; + + _ThriftSdk_adminEnabled_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftSdk_adminEnabledIs_args__isset { + _ThriftSdk_adminEnabledIs_args__isset() : intf(false), enabled(false) {} + bool intf :1; + bool enabled :1; +} _ThriftSdk_adminEnabledIs_args__isset; + +class ThriftSdk_adminEnabledIs_args { + public: + + ThriftSdk_adminEnabledIs_args(const ThriftSdk_adminEnabledIs_args&); + ThriftSdk_adminEnabledIs_args& operator=(const ThriftSdk_adminEnabledIs_args&); + ThriftSdk_adminEnabledIs_args() : intf(), enabled(0) { + } + + virtual ~ThriftSdk_adminEnabledIs_args() throw(); + std::string intf; + bool enabled; + + _ThriftSdk_adminEnabledIs_args__isset __isset; + + void __set_intf(const std::string& val); + + void __set_enabled(const bool val); + + bool operator == (const ThriftSdk_adminEnabledIs_args & rhs) const + { + if (!(intf == rhs.intf)) + return false; + if (!(enabled == rhs.enabled)) + return false; + return true; + } + bool operator != (const ThriftSdk_adminEnabledIs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_adminEnabledIs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_adminEnabledIs_pargs { + public: + + + virtual ~ThriftSdk_adminEnabledIs_pargs() throw(); + const std::string* intf; + const bool* enabled; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_adminEnabledIs_result { + public: + + ThriftSdk_adminEnabledIs_result(const ThriftSdk_adminEnabledIs_result&); + ThriftSdk_adminEnabledIs_result& operator=(const ThriftSdk_adminEnabledIs_result&); + ThriftSdk_adminEnabledIs_result() { + } + + virtual ~ThriftSdk_adminEnabledIs_result() throw(); + + bool operator == (const ThriftSdk_adminEnabledIs_result & /* rhs */) const + { + return true; + } + bool operator != (const ThriftSdk_adminEnabledIs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_adminEnabledIs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_adminEnabledIs_presult { + public: + + + virtual ~ThriftSdk_adminEnabledIs_presult() throw(); + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftSdk_descriptionIs_args__isset { + _ThriftSdk_descriptionIs_args__isset() : intf(false), description(false) {} + bool intf :1; + bool description :1; +} _ThriftSdk_descriptionIs_args__isset; + +class ThriftSdk_descriptionIs_args { + public: + + ThriftSdk_descriptionIs_args(const ThriftSdk_descriptionIs_args&); + ThriftSdk_descriptionIs_args& operator=(const ThriftSdk_descriptionIs_args&); + ThriftSdk_descriptionIs_args() : intf(), description() { + } + + virtual ~ThriftSdk_descriptionIs_args() throw(); + std::string intf; + std::string description; + + _ThriftSdk_descriptionIs_args__isset __isset; + + void __set_intf(const std::string& val); + + void __set_description(const std::string& val); + + bool operator == (const ThriftSdk_descriptionIs_args & rhs) const + { + if (!(intf == rhs.intf)) + return false; + if (!(description == rhs.description)) + return false; + return true; + } + bool operator != (const ThriftSdk_descriptionIs_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_descriptionIs_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_descriptionIs_pargs { + public: + + + virtual ~ThriftSdk_descriptionIs_pargs() throw(); + const std::string* intf; + const std::string* description; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_descriptionIs_result { + public: + + ThriftSdk_descriptionIs_result(const ThriftSdk_descriptionIs_result&); + ThriftSdk_descriptionIs_result& operator=(const ThriftSdk_descriptionIs_result&); + ThriftSdk_descriptionIs_result() { + } + + virtual ~ThriftSdk_descriptionIs_result() throw(); + + bool operator == (const ThriftSdk_descriptionIs_result & /* rhs */) const + { + return true; + } + bool operator != (const ThriftSdk_descriptionIs_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_descriptionIs_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_descriptionIs_presult { + public: + + + virtual ~ThriftSdk_descriptionIs_presult() throw(); + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftSdk_operStatus_args__isset { + _ThriftSdk_operStatus_args__isset() : intf(false) {} + bool intf :1; +} _ThriftSdk_operStatus_args__isset; + +class ThriftSdk_operStatus_args { + public: + + ThriftSdk_operStatus_args(const ThriftSdk_operStatus_args&); + ThriftSdk_operStatus_args& operator=(const ThriftSdk_operStatus_args&); + ThriftSdk_operStatus_args() : intf() { + } + + virtual ~ThriftSdk_operStatus_args() throw(); + std::string intf; + + _ThriftSdk_operStatus_args__isset __isset; + + void __set_intf(const std::string& val); + + bool operator == (const ThriftSdk_operStatus_args & rhs) const + { + if (!(intf == rhs.intf)) + return false; + return true; + } + bool operator != (const ThriftSdk_operStatus_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_operStatus_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftSdk_operStatus_pargs { + public: + + + virtual ~ThriftSdk_operStatus_pargs() throw(); + const std::string* intf; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftSdk_operStatus_result__isset { + _ThriftSdk_operStatus_result__isset() : success(false) {} + bool success :1; +} _ThriftSdk_operStatus_result__isset; + +class ThriftSdk_operStatus_result { + public: + + ThriftSdk_operStatus_result(const ThriftSdk_operStatus_result&); + ThriftSdk_operStatus_result& operator=(const ThriftSdk_operStatus_result&); + ThriftSdk_operStatus_result() : success((OperStatus::type)0) { + } + + virtual ~ThriftSdk_operStatus_result() throw(); + OperStatus::type success; + + _ThriftSdk_operStatus_result__isset __isset; + + void __set_success(const OperStatus::type val); + + bool operator == (const ThriftSdk_operStatus_result & rhs) const + { + if (!(success == rhs.success)) + return false; + return true; + } + bool operator != (const ThriftSdk_operStatus_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftSdk_operStatus_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftSdk_operStatus_presult__isset { + _ThriftSdk_operStatus_presult__isset() : success(false) {} + bool success :1; +} _ThriftSdk_operStatus_presult__isset; + +class ThriftSdk_operStatus_presult { + public: + + + virtual ~ThriftSdk_operStatus_presult() throw(); + OperStatus::type* success; + + _ThriftSdk_operStatus_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +class ThriftSdkClient : virtual public ThriftSdkIf { + public: + ThriftSdkClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + ThriftSdkClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + bool exists(const std::string& intf); + void send_exists(const std::string& intf); + bool recv_exists(); + bool adminEnabled(const std::string& intf); + void send_adminEnabled(const std::string& intf); + bool recv_adminEnabled(); + void adminEnabledIs(const std::string& intf, const bool enabled); + void send_adminEnabledIs(const std::string& intf, const bool enabled); + void recv_adminEnabledIs(); + void descriptionIs(const std::string& intf, const std::string& description); + void send_descriptionIs(const std::string& intf, const std::string& description); + void recv_descriptionIs(); + OperStatus::type operStatus(const std::string& intf); + void send_operStatus(const std::string& intf); + OperStatus::type recv_operStatus(); + protected: + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; +}; + +class ThriftSdkProcessor : public ::apache::thrift::TDispatchProcessor { + protected: + boost::shared_ptr 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 (ThriftSdkProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); + typedef std::map ProcessMap; + ProcessMap processMap_; + void process_exists(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_adminEnabled(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_adminEnabledIs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_descriptionIs(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_operStatus(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + public: + ThriftSdkProcessor(boost::shared_ptr iface) : + iface_(iface) { + processMap_["exists"] = &ThriftSdkProcessor::process_exists; + processMap_["adminEnabled"] = &ThriftSdkProcessor::process_adminEnabled; + processMap_["adminEnabledIs"] = &ThriftSdkProcessor::process_adminEnabledIs; + processMap_["descriptionIs"] = &ThriftSdkProcessor::process_descriptionIs; + processMap_["operStatus"] = &ThriftSdkProcessor::process_operStatus; + } + + virtual ~ThriftSdkProcessor() {} +}; + +class ThriftSdkProcessorFactory : public ::apache::thrift::TProcessorFactory { + public: + ThriftSdkProcessorFactory(const ::boost::shared_ptr< ThriftSdkIfFactory >& handlerFactory) : + handlerFactory_(handlerFactory) {} + + ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + + protected: + ::boost::shared_ptr< ThriftSdkIfFactory > handlerFactory_; +}; + +class ThriftSdkMultiface : virtual public ThriftSdkIf { + public: + ThriftSdkMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + } + virtual ~ThriftSdkMultiface() {} + protected: + std::vector > ifaces_; + ThriftSdkMultiface() {} + void add(boost::shared_ptr iface) { + ifaces_.push_back(iface); + } + public: + bool exists(const std::string& intf) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->exists(intf); + } + return ifaces_[i]->exists(intf); + } + + bool adminEnabled(const std::string& intf) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->adminEnabled(intf); + } + return ifaces_[i]->adminEnabled(intf); + } + + void adminEnabledIs(const std::string& intf, const bool enabled) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->adminEnabledIs(intf, enabled); + } + ifaces_[i]->adminEnabledIs(intf, enabled); + } + + void descriptionIs(const std::string& intf, const std::string& description) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->descriptionIs(intf, description); + } + ifaces_[i]->descriptionIs(intf, description); + } + + OperStatus::type operStatus(const std::string& intf) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->operStatus(intf); + } + return ifaces_[i]->operStatus(intf); + } + +}; + +// 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 ThriftSdkConcurrentClient : virtual public ThriftSdkIf { + public: + ThriftSdkConcurrentClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + ThriftSdkConcurrentClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + bool exists(const std::string& intf); + int32_t send_exists(const std::string& intf); + bool recv_exists(const int32_t seqid); + bool adminEnabled(const std::string& intf); + int32_t send_adminEnabled(const std::string& intf); + bool recv_adminEnabled(const int32_t seqid); + void adminEnabledIs(const std::string& intf, const bool enabled); + int32_t send_adminEnabledIs(const std::string& intf, const bool enabled); + void recv_adminEnabledIs(const int32_t seqid); + void descriptionIs(const std::string& intf, const std::string& description); + int32_t send_descriptionIs(const std::string& intf, const std::string& description); + void recv_descriptionIs(const int32_t seqid); + OperStatus::type operStatus(const std::string& intf); + int32_t send_operStatus(const std::string& intf); + OperStatus::type recv_operStatus(const int32_t seqid); + protected: + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _WIN32 + #pragma warning( pop ) +#endif + +} // namespace + +#endif diff --git a/examples/thriftconfig.h b/examples/thriftconfig.h new file mode 100644 index 0000000..51208d7 --- /dev/null +++ b/examples/thriftconfig.h @@ -0,0 +1,3 @@ +/* Define for version 0.14.0+. */ +/* #undef HAVE_RECENT_THRIFT */ + diff --git a/version.m4 b/version.m4 index a42304c..36e65b1 100644 --- a/version.m4 +++ b/version.m4 @@ -1,2 +1,2 @@ m4_define([_NAME_],[EosSdk]) -m4_define([_VERSION_],[2.22.4]) \ No newline at end of file +m4_define([_VERSION_],[2.22.5]) \ No newline at end of file