Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef __VNSW_SERVICES_INIT__ 6 : #define __VNSW_SERVICES_INIT__ 7 : 8 : #include <sandesh/sandesh_trace.h> 9 : #include <pkt/proto.h> 10 : #include <services/icmp_error_proto.h> 11 : #include <services/icmpv6_error_proto.h> 12 : #include <services/arp_proto.h> 13 : 14 : #define MPLS_OVER_UDP_OLD_DEST_PORT 51234 15 : #define MPLS_OVER_UDP_NEW_DEST_PORT 6635 16 : #define VXLAN_UDP_DEST_PORT 4789 17 : 18 : class MetadataProxy; 19 : 20 : class ServicesModule { 21 : public: 22 : enum ServiceList { 23 : ArpService, 24 : DhcpService, 25 : Dhcpv6Service, 26 : DnsService, 27 : }; 28 : ServicesModule(Agent *agent, const std::string &metadata_secret); 29 : ~ServicesModule(); 30 : 31 0 : Agent *agent() { return agent_; } 32 0 : MetadataProxy *metadataproxy() { return metadata_proxy_.get(); } 33 : 34 : void Init(bool run_with_vrouter); 35 : void ConfigInit(); 36 : void Shutdown(); 37 : void IoShutdown(); 38 0 : IcmpErrorProto *icmp_error_proto() const { 39 0 : return icmp_error_proto_.get(); 40 : } 41 : 42 : ArpProto *arp_proto() const { 43 : return arp_proto_.get(); 44 : } 45 : void ReserveLocalPorts(); 46 : void FreeLocalPortBindings(); 47 : 48 : private: 49 : bool AllocateFd(uint16_t port_number, uint8_t ip_proto); 50 : Agent *agent_; 51 : std::string metadata_secret_key_; 52 : boost::scoped_ptr<DhcpProto> dhcp_proto_; 53 : boost::scoped_ptr<Dhcpv6Proto> dhcpv6_proto_; 54 : boost::scoped_ptr<DnsProto> dns_proto_; 55 : boost::scoped_ptr<ArpProto> arp_proto_; 56 : boost::scoped_ptr<BfdProto> bfd_proto_; 57 : boost::scoped_ptr<IcmpProto> icmp_proto_; 58 : boost::scoped_ptr<Icmpv6Proto> icmpv6_proto_; 59 : boost::scoped_ptr<IcmpErrorProto> icmp_error_proto_; 60 : boost::scoped_ptr<Icmpv6ErrorProto> icmpv6_error_proto_; 61 : boost::scoped_ptr<IgmpProto> igmp_proto_; 62 : boost::scoped_ptr<MetadataProxy> metadata_proxy_; 63 : std::vector<int> reserved_port_fd_list_; 64 : }; 65 : 66 : extern SandeshTraceBufferPtr DhcpTraceBuf; 67 : extern SandeshTraceBufferPtr Dhcpv6TraceBuf; 68 : extern SandeshTraceBufferPtr Icmpv6TraceBuf; 69 : extern SandeshTraceBufferPtr ArpTraceBuf; 70 : extern SandeshTraceBufferPtr MetadataTraceBuf; 71 : extern SandeshTraceBufferPtr BfdTraceBuf; 72 : extern SandeshTraceBufferPtr IgmpTraceBuf; 73 : 74 : #endif