Line data Source code
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 115 : 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 115 : GetServer()->ProcessControlPacket(local_endpoint, remote_endpoint, 30 : session_index, recv_buffer, 31 : bytes_transferred, error); 32 115 : } 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_