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