| 
    OpenSDN source code
    
   | 
 
#include <ksync_sock_user.h>


Public Types | |
| enum | KSyncSockEntryType { KSYNC_FLOW_ENTRY_TYPE = 0 , KSYNC_MAX_ENTRY_TYPE } | 
| typedef std::map< int, vr_nexthop_req > | ksync_map_nh | 
| typedef boost::unordered_map< int, vr_flow_req > | ksync_map_flow | 
| typedef std::map< int, vr_interface_req > | ksync_map_if | 
| typedef std::set< vr_route_req, TestRouteCmp > | ksync_rt_tree | 
| typedef std::map< int, vr_mpls_req > | ksync_map_mpls | 
| typedef std::map< int, vr_mirror_req > | ksync_map_mirror | 
| typedef std::set< vr_vrf_assign_req, TestVrfAssignCmp > | ksync_vrf_assign_tree | 
| typedef std::map< int, vr_vrf_stats_req > | ksync_map_vrf_stats | 
| typedef std::map< int, vr_vxlan_req > | ksync_map_vxlan | 
| typedef std::map< int, vr_vrf_req > | ksync_map_vrf | 
| typedef std::queue< KSyncUserSockContext * > | ksync_map_ctx_queue | 
  Public Types inherited from KSyncSock | |
| typedef std::map< uint32_t, KSyncBulkMsgContext > | WaitTree | 
| typedef std::pair< uint32_t, KSyncBulkMsgContext > | WaitTreePair | 
| typedef boost::function< void(const boost::system::error_code &, size_t)> | HandlerCb | 
| typedef WorkQueue< KSyncRxData > | KSyncReceiveQueue | 
| typedef WorkQueue< KSyncRxQueueData > | KSyncRxWorkQueue | 
Public Member Functions | |
| KSyncSockTypeMap (boost::asio::io_context &ios) | |
| ~KSyncSockTypeMap () | |
| virtual uint32_t | GetSeqno (char *data) | 
| virtual bool | IsMoreData (char *data) | 
| virtual bool | BulkDecoder (char *data, KSyncBulkSandeshContext *ctxt) | 
| virtual bool | Decoder (char *data, AgentSandeshContext *ctxt) | 
| virtual bool | Validate (char *data) | 
| virtual void | AsyncReceive (boost::asio::mutable_buffers_1, HandlerCb) | 
| virtual void | AsyncSendTo (KSyncBufferList *iovec, uint32_t seq_no, HandlerCb cb) | 
| virtual std::size_t | SendTo (KSyncBufferList *iovec, uint32_t seq_no) | 
| virtual void | Receive (boost::asio::mutable_buffers_1) | 
| void | PurgeTxBuffer () | 
| void | ProcessSandesh (const uint8_t *, std::size_t, KSyncUserSockContext *) | 
| vr_bridge_entry * | BridgeMmapAlloc (int size) | 
| void | BridgeMmapFree () | 
| vr_bridge_entry * | GetBridgeEntry (int idx) | 
| void | SetBridgeEntry (uint32_t idx, vr_route_req *req, bool set) | 
| void | UpdateBridgeEntryInactiveFlag (int idx, bool set) | 
| void | SetBlockMsgProcessing (bool enable) | 
| bool | IsBlockMsgProcessing () | 
| void | set_is_incremental_index (bool incremental) | 
| bool | is_incremental_index () | 
| void | SetKSyncError (KSyncSockEntryType type, int ksync_error) | 
| int | GetKSyncError (KSyncSockEntryType type) | 
| void | AddNetlinkTxBuff (struct nl_client *cl) | 
| void | InitNetlinkDoneMsg (struct nlmsghdr *nlh, uint32_t seq_num) | 
| void | DisableReceiveQueue (bool disable) | 
  Public Member Functions inherited from KSyncSock | |
| KSyncSock () | |
| virtual | ~KSyncSock () | 
| void | SendAsync (KSyncEntry *entry, int msg_len, char *msg, KSyncEntry::KSyncEvent event) | 
| std::size_t | BlockingSend (char *msg, int msg_len) | 
| bool | BlockingRecv () | 
| void | GenericSend (IoContext *ctx) | 
| uint32_t | AllocSeqNo (IoContext::Type type) | 
| uint32_t | AllocSeqNo (IoContext::Type type, uint32_t instance) | 
| KSyncReceiveQueue * | GetReceiveQueue (IoContext::Type type, uint32_t instance) | 
| KSyncReceiveQueue * | GetReceiveQueue (uint32_t seqno) | 
| KSyncBulkMsgContext * | LocateBulkContext (uint32_t seqno, IoContext::Type io_context_type, uint32_t work_queue_index) | 
| int | SendBulkMessage (KSyncBulkMsgContext *bulk_context, uint32_t seqno) | 
| bool | TryAddToBulk (KSyncBulkMsgContext *bulk_context, IoContext *ioc) | 
| void | OnEmptyQueue (bool done) | 
| int | tx_count () const | 
| const KSyncTxQueue * | send_queue () const | 
| const KSyncReceiveQueue * | get_receive_work_queue (uint16_t index) const | 
| KSyncReceiveQueue * | AllocQueue (KSyncBulkSandeshContext ctxt[], uint32_t task_id, uint32_t instance, const char *name) | 
| uint32_t | WaitTreeSize () const | 
| void | SetSeqno (uint32_t seq) | 
| void | SetMeasureQueueDelay (bool val) | 
| void | reset_use_wait_tree () | 
| void | set_process_data_inline () | 
| void | EnqueueRxProcessData (KSyncEntry *entry, KSyncEntry::KSyncEvent event) | 
Static Public Member Functions | |
| static void | set_error_code (int code) | 
| static int | error_code () | 
| static void | SimulateResponse (uint32_t, int, int) | 
| static void | SendNetlinkDoneMsg (uint32_t seq_num) | 
| static void | IfDumpResponse (uint32_t) | 
| static void | IfNetlinkMsgSend (uint32_t seq_num, ksync_map_if::const_iterator it) | 
| static void | IfStatsUpdate (int, int, int, int, int, int, int) | 
| static void | IfStatsSet (int, int, int, int, int, int, int) | 
| static void | InterfaceAdd (int id, int flags=0, int mac_size=6) | 
| static void | InterfaceDelete (int id) | 
| static void | NHAdd (int id, int flags=0) | 
| static void | NHDelete (int id) | 
| static void | MplsAdd (int id) | 
| static void | MplsDelete (int id) | 
| static void | MirrorAdd (int id) | 
| static void | MirrorDelete (int id) | 
| static void | RouteAdd (vr_route_req &req) | 
| static void | RouteDelete (vr_route_req &req) | 
| static void | VrfAssignAdd (vr_vrf_assign_req &req) | 
| static void | VrfAssignDelete (vr_vrf_assign_req &req) | 
| static void | VrfAdd (vr_vrf_req &req) | 
| static void | VrfDelete (vr_vrf_req &req) | 
| static void | VrfStatsAdd (int vrf_id) | 
| static void | VrfStatsUpdate (int vrf_id, const vr_vrf_stats_req &req) | 
| static void | VrfStatsDelete (int vrf_id) | 
| static void | VxlanAdd (int id) | 
| static void | VxlanDelete (int id) | 
| static void | SetDropStats (const vr_drop_stats_req &req) | 
| static void | SetVRouterOps (const vrouter_ops &req) | 
| static int | IfCount () | 
| static int | NHCount () | 
| static int | MplsCount () | 
| static int | RouteCount () | 
| static int | VxLanCount () | 
| static KSyncSockTypeMap * | GetKSyncSockTypeMap () | 
| static void | Init (boost::asio::io_context &ios) | 
| static void | Shutdown () | 
| static vr_flow_entry * | FlowMmapAlloc (int size) | 
| static void | FlowMmapFree () | 
| static vr_flow_entry * | GetFlowEntry (int idx) | 
| static void | SetFlowEntry (vr_flow_req *req, bool set) | 
| static void | IncrFlowStats (int idx, int pkts, int bytes) | 
| static void | SetTcpFlag (int idx, uint32_t flags) | 
| static void | SetOFlowStats (int idx, uint8_t pkts, uint16_t bytes) | 
| static void | SetFlowTcpFlags (int idx, uint16_t flags) | 
| static void | SetEvictedFlag (int idx) | 
| static void | ResetEvictedFlag (int idx) | 
| static void | FlowNatResponse (uint32_t seq_num, vr_flow_req *req, int code=0) | 
| static void | SetUnderlaySourcePort (int idx, int port) | 
  Static Public Member Functions inherited from KSyncSock | |
| static void | Start (bool read_inline) | 
| static void | Shutdown () | 
| static KSyncSock * | Get (DBTablePartBase *partition) | 
| static KSyncSock * | Get (int partition_id) | 
| static uint32_t | GetPid () | 
| static int | GetNetlinkFamilyId () | 
| static void | SetNetlinkFamilyId (int id) | 
| static AgentSandeshContext * | GetAgentSandeshContext (uint32_t type) | 
| static void | SetAgentSandeshContext (AgentSandeshContext *ctx, uint32_t idx) | 
Public Attributes | |
| ksync_map_nh | nh_map | 
| ksync_map_flow | flow_map | 
| ksync_map_if | if_map | 
| ksync_rt_tree | rt_tree | 
| ksync_map_mpls | mpls_map | 
| ksync_map_mirror | mirror_map | 
| ksync_vrf_assign_tree | vrf_assign_tree | 
| ksync_map_vrf_stats | vrf_stats_map | 
| vr_drop_stats_req | drop_stats | 
| vrouter_ops | ksync_vrouter_ops | 
| ksync_map_vxlan | vxlan_map | 
| ksync_map_vrf | vrf_map | 
| ksync_map_ctx_queue | ctx_queue_ | 
| tbb::mutex | ctx_queue_lock_ | 
Private Member Functions | |
| void | PurgeBlockedMsg () | 
| DISALLOW_COPY_AND_ASSIGN (KSyncSockTypeMap) | |
Private Attributes | |
| udp::socket | sock_ | 
| udp::endpoint | local_ep_ | 
| int | ksync_error_ [KSYNC_MAX_ENTRY_TYPE] | 
| bool | block_msg_processing_ | 
| bool | is_incremental_index_ | 
| vr_bridge_entry * | bridge_table_ | 
| std::vector< struct nl_client > | tx_buff_list_ | 
Static Private Attributes | |
| static KSyncSockTypeMap * | singleton_ | 
| static vr_flow_entry * | flow_table_ | 
| static int | error_code_ | 
Friends | |
| class | MockDumpHandlerBase | 
| class | RouteDumpHandler | 
| class | VrfAssignDumpHandler | 
| class | VrfDumpHandler | 
Additional Inherited Members | |
  Static Public Attributes inherited from KSyncSock | |
| static const int | kRxWorkQueueCount = 2 | 
| static const int | kMsgGrowSize = 16 | 
| static const unsigned | kBufLen = (4*1024) | 
| static const unsigned | kMaxBulkMsgCount = 16 | 
| static const unsigned | kInvalidBulkSeqNo = 0xFFFFFFFF | 
  Protected Member Functions inherited from KSyncSock | |
| bool | ValidateAndEnqueue (char *data, KSyncBulkMsgContext *context) | 
| KSyncBulkSandeshContext * | GetBulkSandeshContext (uint32_t seqno) | 
| void | ProcessDataInline (char *data) | 
  Static Protected Member Functions inherited from KSyncSock | |
| static void | Init (bool use_work_queue, const std::string &cpu_pin_policy) | 
| static void | SetSockTableEntry (KSyncSock *sock) | 
  Protected Attributes inherited from KSyncSock | |
| tbb::mutex | mutex_ | 
| nl_client * | nl_client_ | 
| WaitTree | wait_tree_ | 
| KSyncTxQueue | send_queue_ | 
| KSyncReceiveQueue * | uve_rx_queue [kRxWorkQueueCount] | 
| KSyncReceiveQueue * | ksync_rx_queue [kRxWorkQueueCount] | 
| uint32_t | max_bulk_msg_count_ | 
| uint32_t | max_bulk_buf_size_ | 
| uint32_t | bulk_seq_no_ | 
| uint32_t | bulk_buf_size_ | 
| uint32_t | bulk_msg_count_ | 
| uint32_t | bmca_prod_ | 
| uint32_t | bmca_cons_ | 
| KSyncBulkMsgContext * | bulk_mctx_arr_ [KSYNC_BMC_ARR_SIZE] | 
Definition at line 86 of file ksync_sock_user.h.
| typedef std::queue<KSyncUserSockContext *> KSyncSockTypeMap::ksync_map_ctx_queue | 
Definition at line 131 of file ksync_sock_user.h.
| typedef boost::unordered_map<int, vr_flow_req> KSyncSockTypeMap::ksync_map_flow | 
Definition at line 111 of file ksync_sock_user.h.
| typedef std::map<int, vr_interface_req> KSyncSockTypeMap::ksync_map_if | 
Definition at line 113 of file ksync_sock_user.h.
| typedef std::map<int, vr_mirror_req> KSyncSockTypeMap::ksync_map_mirror | 
Definition at line 119 of file ksync_sock_user.h.
| typedef std::map<int, vr_mpls_req> KSyncSockTypeMap::ksync_map_mpls | 
Definition at line 117 of file ksync_sock_user.h.
| typedef std::map<int, vr_nexthop_req> KSyncSockTypeMap::ksync_map_nh | 
Definition at line 109 of file ksync_sock_user.h.
| typedef std::map<int, vr_vrf_req> KSyncSockTypeMap::ksync_map_vrf | 
Definition at line 129 of file ksync_sock_user.h.
| typedef std::map<int, vr_vrf_stats_req> KSyncSockTypeMap::ksync_map_vrf_stats | 
Definition at line 123 of file ksync_sock_user.h.
| typedef std::map<int, vr_vxlan_req> KSyncSockTypeMap::ksync_map_vxlan | 
Definition at line 127 of file ksync_sock_user.h.
| typedef std::set<vr_route_req, TestRouteCmp> KSyncSockTypeMap::ksync_rt_tree | 
Definition at line 115 of file ksync_sock_user.h.
| typedef std::set<vr_vrf_assign_req, TestVrfAssignCmp> KSyncSockTypeMap::ksync_vrf_assign_tree | 
Definition at line 121 of file ksync_sock_user.h.
| Enumerator | |
|---|---|
| KSYNC_FLOW_ENTRY_TYPE | |
| KSYNC_MAX_ENTRY_TYPE | |
Definition at line 88 of file ksync_sock_user.h.
      
  | 
  inline | 
Definition at line 93 of file ksync_sock_user.h.
      
  | 
  inline | 
Definition at line 97 of file ksync_sock_user.h.
| void KSyncSockTypeMap::AddNetlinkTxBuff | ( | struct nl_client * | cl | ) | 
Definition at line 51 of file ksync_sock_user.cc.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 592 of file ksync_sock_user.cc.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 570 of file ksync_sock_user.cc.

| vr_bridge_entry * KSyncSockTypeMap::BridgeMmapAlloc | ( | int | size | ) | 
Definition at line 708 of file ksync_sock_user.cc.
| void KSyncSockTypeMap::BridgeMmapFree | ( | ) | 
Definition at line 714 of file ksync_sock_user.cc.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 530 of file ksync_sock_user.cc.

      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 536 of file ksync_sock_user.cc.

| void KSyncSockTypeMap::DisableReceiveQueue | ( | bool | disable | ) | 
Definition at line 227 of file ksync_sock_user.cc.
      
  | 
  private | 
      
  | 
  inlinestatic | 
Definition at line 149 of file ksync_sock_user.h.
      
  | 
  static | 
Definition at line 601 of file ksync_sock_user.cc.
      
  | 
  static | 
Definition at line 606 of file ksync_sock_user.cc.
      
  | 
  static | 
| vr_bridge_entry * KSyncSockTypeMap::GetBridgeEntry | ( | int | idx | ) | 
Definition at line 721 of file ksync_sock_user.cc.
      
  | 
  static | 
Definition at line 613 of file ksync_sock_user.cc.
      
  | 
  inline | 
Definition at line 223 of file ksync_sock_user.h.
      
  | 
  inlinestatic | 
Definition at line 183 of file ksync_sock_user.h.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 519 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
Definition at line 671 of file ksync_sock_user.cc.
      
  | 
  static | 
| void KSyncSockTypeMap::InitNetlinkDoneMsg | ( | struct nlmsghdr * | nlh, | 
| uint32_t | seq_num | ||
| ) | 
Definition at line 195 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  inline | 
Definition at line 217 of file ksync_sock_user.h.
      
  | 
  inline | 
Definition at line 208 of file ksync_sock_user.h.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 524 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
| void KSyncSockTypeMap::ProcessSandesh | ( | const uint8_t * | , | 
| std::size_t | , | ||
| KSyncUserSockContext * | |||
| ) | 
      
  | 
  private | 
Definition at line 780 of file ksync_sock_user.cc.
| void KSyncSockTypeMap::PurgeTxBuffer | ( | ) | 
Definition at line 84 of file ksync_sock_user.cc.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 597 of file ksync_sock_user.cc.
      
  | 
  static | 
Definition at line 663 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 581 of file ksync_sock_user.cc.

      
  | 
  inlinestatic | 
Definition at line 148 of file ksync_sock_user.h.
      
  | 
  inline | 
Definition at line 213 of file ksync_sock_user.h.
| void KSyncSockTypeMap::SetBlockMsgProcessing | ( | bool | enable | ) | 
Definition at line 789 of file ksync_sock_user.cc.
| void KSyncSockTypeMap::SetBridgeEntry | ( | uint32_t | idx, | 
| vr_route_req * | req, | ||
| bool | set | ||
| ) | 
Definition at line 725 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
Definition at line 656 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
Definition at line 686 of file ksync_sock_user.cc.
      
  | 
  inline | 
Definition at line 219 of file ksync_sock_user.h.
      
  | 
  static | 
Definition at line 700 of file ksync_sock_user.cc.
      
  | 
  static | 
Definition at line 679 of file ksync_sock_user.cc.
      
  | 
  static | 
Definition at line 693 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
Definition at line 775 of file ksync_sock_user.cc.
      
  | 
  static | 
| void KSyncSockTypeMap::UpdateBridgeEntryInactiveFlag | ( | int | idx, | 
| bool | set | ||
| ) | 
Definition at line 750 of file ksync_sock_user.cc.
      
  | 
  virtual | 
Implements KSyncSock.
Definition at line 541 of file ksync_sock_user.cc.
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  friend | 
Definition at line 203 of file ksync_sock_user.h.
      
  | 
  friend | 
Definition at line 204 of file ksync_sock_user.h.
      
  | 
  friend | 
Definition at line 205 of file ksync_sock_user.h.
      
  | 
  friend | 
Definition at line 206 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 236 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 240 of file ksync_sock_user.h.
| ksync_map_ctx_queue KSyncSockTypeMap::ctx_queue_ | 
Definition at line 132 of file ksync_sock_user.h.
| tbb::mutex KSyncSockTypeMap::ctx_queue_lock_ | 
Definition at line 133 of file ksync_sock_user.h.
| vr_drop_stats_req KSyncSockTypeMap::drop_stats | 
Definition at line 125 of file ksync_sock_user.h.
      
  | 
  staticprivate | 
Definition at line 241 of file ksync_sock_user.h.
| ksync_map_flow KSyncSockTypeMap::flow_map | 
Definition at line 112 of file ksync_sock_user.h.
      
  | 
  staticprivate | 
Definition at line 239 of file ksync_sock_user.h.
| ksync_map_if KSyncSockTypeMap::if_map | 
Definition at line 114 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 237 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 235 of file ksync_sock_user.h.
| vrouter_ops KSyncSockTypeMap::ksync_vrouter_ops | 
Definition at line 126 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 234 of file ksync_sock_user.h.
| ksync_map_mirror KSyncSockTypeMap::mirror_map | 
Definition at line 120 of file ksync_sock_user.h.
| ksync_map_mpls KSyncSockTypeMap::mpls_map | 
Definition at line 118 of file ksync_sock_user.h.
| ksync_map_nh KSyncSockTypeMap::nh_map | 
Definition at line 110 of file ksync_sock_user.h.
| ksync_rt_tree KSyncSockTypeMap::rt_tree | 
Definition at line 116 of file ksync_sock_user.h.
      
  | 
  staticprivate | 
Definition at line 238 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 233 of file ksync_sock_user.h.
      
  | 
  private | 
Definition at line 245 of file ksync_sock_user.h.
| ksync_vrf_assign_tree KSyncSockTypeMap::vrf_assign_tree | 
Definition at line 122 of file ksync_sock_user.h.
| ksync_map_vrf KSyncSockTypeMap::vrf_map | 
Definition at line 130 of file ksync_sock_user.h.
| ksync_map_vrf_stats KSyncSockTypeMap::vrf_stats_map | 
Definition at line 124 of file ksync_sock_user.h.
| ksync_map_vxlan KSyncSockTypeMap::vxlan_map | 
Definition at line 128 of file ksync_sock_user.h.