OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bfd_connection.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 CodiLime, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_BFD_BFD_CONNECTION_H_
6 #define SRC_BFD_BFD_CONNECTION_H_
7 
8 #include <boost/asio.hpp>
9 #include <boost/asio/ip/address.hpp>
10 #include "bfd/bfd_server.h"
11 
12 namespace BFD {
13 struct ControlPacket;
14 class Server;
15 
16 class Connection {
17 public:
18  virtual void SendPacket(
19  const boost::asio::ip::udp::endpoint &local_endpoint,
20  const boost::asio::ip::udp::endpoint &remote_endpoint,
21  const SessionIndex &session_index,
22  const boost::asio::mutable_buffer &packet, int pktSize) = 0;
23  virtual void HandleReceive(const boost::asio::const_buffer &recv_buffer,
24  const boost::asio::ip::udp::endpoint &local_endpoint,
25  const boost::asio::ip::udp::endpoint &remote_endpoint,
26  const SessionIndex &session_index,
27  std::size_t bytes_transferred,
28  const boost::system::error_code& error) {
29  GetServer()->ProcessControlPacket(local_endpoint, remote_endpoint,
30  session_index, recv_buffer,
31  bytes_transferred, error);
32  }
33  virtual void NotifyStateChange(const SessionKey &key, const bool &up) = 0;
34  virtual Server *GetServer() const = 0;
35  virtual void SetServer(Server *server) = 0;
36 };
37 
38 } // namespace BFD
39 
40 #endif // SRC_BFD_BFD_CONNECTION_H_
virtual void SendPacket(const boost::asio::ip::udp::endpoint &local_endpoint, const boost::asio::ip::udp::endpoint &remote_endpoint, const SessionIndex &session_index, const boost::asio::mutable_buffer &packet, int pktSize)=0
void ProcessControlPacket(const boost::asio::ip::udp::endpoint &local_endpoint, const boost::asio::ip::udp::endpoint &remote_endpoint, const SessionIndex &session_index, const boost::asio::const_buffer &recv_buffer, std::size_t bytes_transferred, const boost::system::error_code &error)
Definition: bfd_server.cc:178
virtual void NotifyStateChange(const SessionKey &key, const bool &up)=0
virtual void HandleReceive(const boost::asio::const_buffer &recv_buffer, const boost::asio::ip::udp::endpoint &local_endpoint, const boost::asio::ip::udp::endpoint &remote_endpoint, const SessionIndex &session_index, std::size_t bytes_transferred, const boost::system::error_code &error)
virtual void SetServer(Server *server)=0
virtual Server * GetServer() const =0