Line data Source code
1 : /* 2 : * Copyright (c) 2014 CodiLime, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef SRC_BFD_BFD_CONTROL_PACKET_H_ 6 : #define SRC_BFD_BFD_CONTROL_PACKET_H_ 7 : 8 : #include <string> 9 : #include <boost/asio/ip/address.hpp> 10 : #include <base/parse_object.h> 11 : 12 : #include "bfd/bfd_common.h" 13 : 14 : class ParseContext; 15 : class EncodeContext; 16 : 17 : namespace BFD { 18 : struct ControlPacket : public ParseObject { 19 244 : ControlPacket() : 20 244 : final(false), 21 244 : control_plane_independent(false), 22 244 : authentication_present(false), 23 244 : demand(false), 24 244 : multipoint(false), 25 244 : length(kMinimalPacketLength), 26 244 : diagnostic(kNoDiagnostic), 27 244 : required_min_echo_rx_interval(boost::posix_time::microseconds(0)) { 28 244 : } 29 : 30 : std::string toString() const; 31 : ResultCode Verify() const; 32 : 33 : bool poll; 34 : bool final; 35 : bool control_plane_independent; 36 : bool authentication_present; 37 : bool demand; 38 : bool multipoint; 39 : int detection_time_multiplier; 40 : int length; 41 : 42 : BFD::Discriminator sender_discriminator; 43 : BFD::Discriminator receiver_discriminator; 44 : BFD::Diagnostic diagnostic; 45 : BFD::BFDState state; 46 : 47 : TimeInterval desired_min_tx_interval; 48 : TimeInterval required_min_rx_interval; 49 : TimeInterval required_min_echo_rx_interval; 50 : 51 : SessionIndex session_index; 52 : boost::asio::ip::udp::endpoint local_endpoint; 53 : boost::asio::ip::udp::endpoint remote_endpoint; 54 : }; 55 : 56 : ControlPacket* ParseControlPacket(const uint8_t *data, size_t size); 57 : int EncodeControlPacket(const ControlPacket *msg, uint8_t *data, size_t size); 58 : 59 : bool operator==(const ControlPacket &p1, const ControlPacket &p2); 60 : } // namespace BFD 61 : 62 : #endif // SRC_BFD_BFD_CONTROL_PACKET_H_