ping

package
v4.0.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Example (PingWithEvents)
engine := sim.NewSerialEngine()
// agentA := NewPingAgent("AgentA", engine)
agentA := MakeBuilder().WithEngine(engine).Build("AgentA")
// agentB := NewPingAgent("AgentB", engine)
agentB := MakeBuilder().WithEngine(engine).Build("AgentB")
conn := directconnection.MakeBuilder().WithEngine(engine).WithFreq(1 * sim.GHz).Build("Conn")

conn.PlugIn(agentA.OutPort, 1)
conn.PlugIn(agentB.OutPort, 1)

e1 := StartPingEvent{
	EventBase: sim.NewEventBase(1, agentA),
	Dst:       agentB.OutPort,
}
e2 := StartPingEvent{
	EventBase: sim.NewEventBase(3, agentA),
	Dst:       agentB.OutPort,
}
engine.Schedule(e1)
engine.Schedule(e2)

engine.Run()
Output:

Ping 0, 2.00
Ping 1, 2.00

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	Engine sim.Engine
	// contains filtered or unexported fields
}

func MakeBuilder

func MakeBuilder() Builder

func (Builder) Build

func (b Builder) Build(name string) *Comp

func (Builder) WithEngine

func (b Builder) WithEngine(engine sim.Engine) Builder

type Comp

type Comp struct {
	*sim.ComponentBase

	Engine  sim.Engine
	OutPort sim.Port
	// contains filtered or unexported fields
}

func (*Comp) Handle

func (c *Comp) Handle(e sim.Event) error

func (Comp) NotifyPortFree

func (c Comp) NotifyPortFree(_ sim.Port)

func (*Comp) NotifyRecv

func (c *Comp) NotifyRecv(port sim.Port)

func (*Comp) RspPing

func (c *Comp) RspPing(evt RspPingEvent)

func (*Comp) StartPing

func (c *Comp) StartPing(evt StartPingEvent)

type PingReq

type PingReq struct {
	sim.MsgMeta

	SeqID int
}

func (*PingReq) Clone

func (p *PingReq) Clone() sim.Msg

func (*PingReq) GenerateRsp

func (p *PingReq) GenerateRsp() sim.Rsp

func (*PingReq) Meta

func (p *PingReq) Meta() *sim.MsgMeta

type PingRsp

type PingRsp struct {
	sim.MsgMeta

	RspTo string
	SeqID int
}

func (*PingRsp) Clone

func (p *PingRsp) Clone() sim.Msg

func (*PingRsp) GetRspTo

func (p *PingRsp) GetRspTo() string

func (*PingRsp) Meta

func (p *PingRsp) Meta() *sim.MsgMeta

type RspPingEvent

type RspPingEvent struct {
	*sim.EventBase
	// contains filtered or unexported fields
}

type StartPingEvent

type StartPingEvent struct {
	*sim.EventBase
	Dst sim.Port
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL