//@C Copyright Notice //@C ================ //@C This file is part of CPSW. It is subject to the license terms in the LICENSE.txt //@C file found in the top-level directory of this distribution and at //@C https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. //@C //@C No part of CPSW, including this file, may be copied, modified, propagated, or //@C distributed except according to the terms contained in the LICENSE.txt file. #ifndef CPSW_PROTO_MOD_SRP_MUX_H #define CPSW_PROTO_MOD_SRP_MUX_H #include #include class CProtoModSRPMux; typedef shared_ptr ProtoModSRPMux; class CSRPPort; typedef shared_ptr SRPPort; class CProtoModSRPMux : public CProtoModByteMux { private: INetIODev::ProtocolVersion protoVersion_; protected: CProtoModSRPMux(const CProtoModSRPMux &orig, Key &k) : CProtoModByteMux(orig, k), protoVersion_(orig.protoVersion_) { } SRPPort newPort(int dest, unsigned queueDepth); public: CProtoModSRPMux(Key &k, INetIODev::ProtocolVersion protoVersion, int threadPriority) : CProtoModByteMux(k, "SRP VC Demux", threadPriority), protoVersion_(protoVersion) { } SRPPort createPort(int dest, unsigned queueDepth) { return addPort(dest, newPort(dest, queueDepth)); } // range of bits in TID that the downstream user may occupy virtual int getTidLsb() { return 0; } virtual int getTidNumBits() { return 24; } virtual int extractDest(BufChain); virtual INetIODev::ProtocolVersion getProtoVersion() { return protoVersion_; } virtual CProtoModSRPMux *clone(Key k) { return new CProtoModSRPMux( *this, k ); } virtual const char *getName() const { return "SRP VC Demux"; } virtual ~CProtoModSRPMux() {} }; class CSRPPort : public CByteMuxPort { private: unsigned queueDepth_; protected: CSRPPort(const CSRPPort &orig, Key k) : CByteMuxPort(orig, k) { } virtual BufChain processOutput(BufChain *bc); virtual int iMatch(ProtoPortMatchParams *cmp); public: CSRPPort(Key &k, ProtoModSRPMux owner, int dest, unsigned queueDepth) : CByteMuxPort(k, owner, dest, queueDepth), queueDepth_(queueDepth) { } virtual void dumpYaml(YAML::Node &) const; virtual INetIODev::ProtocolVersion getProtoVersion(); virtual CSRPPort *clone(Key k) { return new CSRPPort( *this, k ); } }; #endif