Line data Source code
1 : /* 2 : * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef vnsw_agent_segment_health_check_hpp 6 : #define vnsw_agent_segment_health_check_hpp 7 : 8 : #include "diag/diag.h" 9 : #include "diag/diag_types.h" 10 : #include "pkt/control_interface.h" 11 : 12 : class HealthCheckInstanceService; 13 : 14 : class SegmentHealthCheckPkt: public DiagEntry { 15 : public: 16 : enum Status { 17 : SUCCESS, 18 : FAILURE 19 : }; 20 : static const int kBufferSize = 1024; 21 : 22 : SegmentHealthCheckPkt(HealthCheckInstanceService *service, 23 : DiagTable *diag_table); 24 : virtual ~SegmentHealthCheckPkt(); 25 : 26 : virtual void SendRequest(); 27 : void RequestTimedOut(uint32_t seqno); 28 : virtual void HandleReply(DiagPktHandler *handler); 29 : virtual void Retry(); 30 0 : virtual bool IsDone() { 31 : /* Keep sending health-check packets until this object is removed. 32 : * We remove this object when an explicit delete request is received 33 : */ 34 0 : return false; 35 : } 36 0 : virtual bool ResendOnTimerExpiry() { return false; } 37 0 : void set_service(HealthCheckInstanceService *svc) { 38 0 : service_ = svc; 39 0 : } 40 : void StopDelayTimer(); 41 : void UpdateService(HealthCheckInstanceService *service); 42 : 43 : private: 44 : void FillDiagHeader(AgentDiagPktData *data) const; 45 : void Notify(Status status); 46 : bool RetryHandler(); 47 : int GetTimeout(const HealthCheckInstanceService *svc) const; 48 : int GetDelay(const HealthCheckInstanceService *svc) const; 49 : 50 : HealthCheckInstanceService *service_; 51 : Status state_; 52 : int delay_msecs_; //delay/interval in milliseconds 53 : Timer *delay_timer_; // 54 : }; 55 : 56 : #endif