server

package
v0.0.0-...-a34aaee Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright (c) Facebook, Inc. and its affiliates.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSendWorker

func NewSendWorker(i int, c *Config, st stats.Stats) *sendWorker

Types

type Config

type Config struct {
	DSCP           int
	Interface      string
	IP             net.IP
	LogLevel       string
	MaxSubDuration time.Duration
	MetricInterval time.Duration
	MinSubInterval time.Duration
	MonitoringPort int
	SHM            bool
	TimestampType  string
	UTCOffset      time.Duration
	SendWorkers    int
	RecvWorkers    int
	QueueSize      int
	// contains filtered or unexported fields
}

Config is a server config structure

func (*Config) IfaceHasIP

func (c *Config) IfaceHasIP() (bool, error)

IfaceHasIP checks if selected IP is on interface

func (*Config) SetUTCOffsetFromSHM

func (c *Config) SetUTCOffsetFromSHM() error

SetUTCOffsetFromSHM reads SHM and if valid sets UTC offset

type Server

type Server struct {
	Config *Config
	Stats  stats.Stats
	// contains filtered or unexported fields
}

Server is PTP unicast server

func (*Server) Start

func (s *Server) Start() error

Start the workers send bind to event and general UDP ports

type SubscriptionClient

type SubscriptionClient struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SubscriptionClient is sending subscriptionType messages periodically

func NewSubscriptionClient

func NewSubscriptionClient(q chan *SubscriptionClient, eclisa, gclisa unix.Sockaddr, st ptp.MessageType, sc *Config, i time.Duration, e time.Time) *SubscriptionClient

NewSubscriptionClient gets minimal required arguments to create a subscription

func (*SubscriptionClient) Announce

func (sc *SubscriptionClient) Announce() *ptp.Announce

Announce returns ptp Announce packet

func (*SubscriptionClient) DelayResp

func (sc *SubscriptionClient) DelayResp() *ptp.DelayResp

DelayResp returns ptp Delay Response packet

func (*SubscriptionClient) Expired

func (sc *SubscriptionClient) Expired() bool

Expired checks if the subscription expired or not

func (*SubscriptionClient) Followup

func (sc *SubscriptionClient) Followup() *ptp.FollowUp

Followup returns ptp Follow Up packet

func (*SubscriptionClient) Grant

func (sc *SubscriptionClient) Grant() *ptp.Signaling

Grant returns ptp Signaling packet granting the requested subscription

func (*SubscriptionClient) IncSequenceID

func (sc *SubscriptionClient) IncSequenceID()

IncSequenceID adds 1 to a sequence id

func (*SubscriptionClient) Once

func (sc *SubscriptionClient) Once()

Once adds itself to the worker queue once

func (*SubscriptionClient) Running

func (sc *SubscriptionClient) Running() bool

Running returns the running bool

func (*SubscriptionClient) Start

func (sc *SubscriptionClient) Start()

Start launches the subscription timers and exit on expire

func (*SubscriptionClient) Stop

func (sc *SubscriptionClient) Stop()

Stop stops the subscription

func (*SubscriptionClient) Sync

func (sc *SubscriptionClient) Sync() *ptp.SyncDelayReq

Sync returns ptp Sync packet

func (*SubscriptionClient) UpdateAnnounce

func (sc *SubscriptionClient) UpdateAnnounce()

UpdateAnnounce updates ptp Announce packet

func (*SubscriptionClient) UpdateDelayResp

func (sc *SubscriptionClient) UpdateDelayResp(h *ptp.Header, received time.Time)

UpdateDelayResp updates ptp Delay Response packet

func (*SubscriptionClient) UpdateFollowup

func (sc *SubscriptionClient) UpdateFollowup(hwts time.Time)

UpdateFollowup updates ptp Follow Up packet

func (*SubscriptionClient) UpdateGrant

func (sc *SubscriptionClient) UpdateGrant(sg *ptp.Signaling, mt ptp.UnicastMsgTypeAndFlags, interval ptp.LogInterval, duration uint32)

UpdateGrant updates ptp Signaling packet granting the requested subscription

func (*SubscriptionClient) UpdateSync

func (sc *SubscriptionClient) UpdateSync()

UpdateSync updates ptp Sync packet

Jump to

Keyboard shortcuts

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