mms

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectAndSubAnonymous added in v0.1.1

func ConnectAndSubAnonymous(ctx context.Context, sender *Agent, receiverAuthenticated *Agent, url string, topic string, dataFileName string)

func ConnectAnonymousWithHandling added in v0.1.1

func ConnectAnonymousWithHandling(ctx context.Context, a *Agent, url string) error

func ConnectWithHandling added in v0.1.1

func ConnectWithHandling(ctx context.Context, a *Agent, url string) error

func DecodeFileName added in v0.1.1

func DecodeFileName(data []byte) (string, []byte)

func DisconnectWithHandling added in v0.1.1

func DisconnectWithHandling(ctx context.Context, a *Agent)

func EncodeFileName added in v0.1.1

func EncodeFileName(fileName string, data []byte) []byte

func PublishDataWithHandling added in v0.1.1

func PublishDataWithHandling(ctx context.Context, a *Agent, subject string, data []byte)

func ReadFile added in v0.1.1

func ReadFile(ctx context.Context, dataFileName string) ([]byte, error)

readFile reads the file into a slice of bytes

func ReceiveWithHandling added in v0.1.1

func ReceiveWithHandling(ctx context.Context, a *Agent) [][]byte

func SendDataOverDirectMessage added in v0.1.1

func SendDataOverDirectMessage(ctx context.Context, sender *Agent, receiver *Agent, dataFileName string)

func SendDataWithHandling added in v0.1.1

func SendDataWithHandling(ctx context.Context, a *Agent, receivingMrn string, data []byte)

func SendTextWithHandling added in v0.1.1

func SendTextWithHandling(ctx context.Context, a *Agent, receivingMrn string, msg string)

func SubAndUnsubscribeTopic added in v0.1.1

func SubAndUnsubscribeTopic(ctx context.Context, sender *Agent, receiver *Agent, subject string)

func SubAndUnsubscribeWithData added in v0.1.1

func SubAndUnsubscribeWithData(ctx context.Context, sender *Agent, receiver *Agent, subject string, dataFileName string)

func SubUnsubReconnection added in v0.1.1

func SubUnsubReconnection(ctx context.Context, sender *Agent, receiver *Agent, subject string, url string)

func SubscribeTopic added in v0.1.1

func SubscribeTopic(ctx context.Context, sender *Agent, receiver *Agent, subject string)

Types

type Agent

type Agent struct {
	Mrn       string                       // the MRN of the Agent
	Interests []string                     // the Interests that the Agent wants to subscribe to
	Messages  map[string]*mmtp.MmtpMessage // the incoming messages for this Agent
	// contains filtered or unexported fields
}

Agent type representing an agent for a connection to an Edge Router

func NewAgent

func NewAgent(mrn string) *Agent

NewAgent initiates a new Agent object

func (*Agent) Authenticate

func (a *Agent) Authenticate(ctx context.Context, certificate *x509.Certificate) (mmtp.ResponseEnum, error)

TODO: implement this function Authenticate imports an MCP cert and does authentication. MRN attribute in the cert will be stored to the MRN of Agent

func (*Agent) ConnectAnonymous

func (a *Agent) ConnectAnonymous(ctx context.Context, url string) (mmtp.ResponseEnum, error)

ConnectAnonymous make connect anonymously to an MMS Edge Router

func (*Agent) ConnectAuthenticated

func (a *Agent) ConnectAuthenticated(ctx context.Context, url string) (mmtp.ResponseEnum, error)

ConnectAuthenticated make connect to an MMS Edge Router

func (*Agent) Disconnect

func (a *Agent) Disconnect(ctx context.Context) (mmtp.ResponseEnum, error)

Disconnect disconnects from the MMS Edge Router

func (*Agent) Discover

func (a *Agent) Discover()

Discover looks up possible MMS Edge Routers

func (*Agent) Publish

func (a *Agent) Publish(ctx context.Context, timeToLive time.Duration, subject string, bytes []byte) (mmtp.ResponseEnum, error)

Publish transfers a message with regard to a subject

func (*Agent) Receive

func (a *Agent) Receive(ctx context.Context, filter *mmtp.Filter) (mmtp.ResponseEnum, [][]byte, error)

Receive fetches a list of messages sent to its own MRN

func (*Agent) ReconnectAnonymous

func (a *Agent) ReconnectAnonymous()

ReconnectAnonymous reconnects anonymously to an MMS Edge Router

func (*Agent) Send

func (a *Agent) Send(ctx context.Context, timeToLive time.Duration, receivingMrn string, bytes []byte) (mmtp.ResponseEnum, error)

Send transfers a message to another Agent with receivingMrn

func (*Agent) Status

func (a *Agent) Status() AgentState

Status returns current status of the MMS Agent

func (*Agent) Subscribe

func (a *Agent) Subscribe(ctx context.Context, subject string) (mmtp.ResponseEnum, error)

func (*Agent) SubscribeMessages

func (a *Agent) SubscribeMessages(ctx context.Context)

func (*Agent) Unsubscribe

func (a *Agent) Unsubscribe(ctx context.Context, subject string) (mmtp.ResponseEnum, error)

func (*Agent) UnsubscribeMessages

func (a *Agent) UnsubscribeMessages(ctx context.Context)

type AgentState

type AgentState int16

AgentState type representing a state of Agent

const (
	AgentState_NOTCONNECTED  AgentState = 0
	AgentState_CONNECTED     AgentState = 1
	AgentState_AUTHENTICATED AgentState = 2
)

Jump to

Keyboard shortcuts

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