Documentation ¶
Index ¶
- Constants
- func AssignMTMSN(rq *DirectIPRequest)
- func FlushMTQueue(rq *DirectIPRequest)
- func HighPriorityMessage(rq *DirectIPRequest)
- func NewService(log log15.Logger, address string, h Handler, proxyprotocol bool) error
- func SendRingAlertNoMTM(rq *DirectIPRequest)
- func UpdateSSDLocation(rq *DirectIPRequest)
- type Confirmation
- type DIPHandler
- type DIPServer
- type DirectIPHeader
- type DirectIPRequest
- type DirectOption
- type ElementID
- type Handler
- type HandlerFunc
- type Header
- type InformationBucket
- type InformationElement
- type Location
- type LocationData
- type MOConfirmationMessage
- type MODirectIPHeader
- type MOLocationInformation
- type MOPayload
- type MessageHeader
- type Orientation
- type SessionStatus
Constants ¶
const ( // SBD Session Status StCompleted = SessionStatus(0) StMTTooLarge = SessionStatus(1) StLocationUnacceptable = SessionStatus(2) StTimeout = SessionStatus(10) StIMEITooLarge = SessionStatus(12) StRFLinkLoss = SessionStatus(13) StIMEIProtocolAnomaly = SessionStatus(14) StIMEIProhibitedGateway = SessionStatus(15) NE = Orientation(0) NW = Orientation(1) SE = Orientation(2) SW = Orientation(3) )
Variables ¶
This section is empty.
Functions ¶
func AssignMTMSN ¶
func AssignMTMSN(rq *DirectIPRequest)
AssignMTMSN sets the corresponding disposition flag.
func FlushMTQueue ¶
func FlushMTQueue(rq *DirectIPRequest)
FlushMTQueue sets the corresponding disposition flag.
func HighPriorityMessage ¶
func HighPriorityMessage(rq *DirectIPRequest)
HighPriorityMessage sets the corresponding disposition flag.
func NewService ¶
NewService starts a listener on the given *address* and dispatches every short burst data packet to the given handler. If the handler returns a non-nil error, the service will send a negative response, otherwise the responsestatus will be ok.
func SendRingAlertNoMTM ¶
func SendRingAlertNoMTM(rq *DirectIPRequest)
SendRingAlertNoMTM sets the corresponding disposition flag.
func UpdateSSDLocation ¶
func UpdateSSDLocation(rq *DirectIPRequest)
UpdateSSDLocation sets the corresponding disposition flag.
Types ¶
type Confirmation ¶
type Confirmation struct { UniqueClientMsgID [4]byte `json:"uniqueclientmsgid` IMEI [15]byte `json:"imei"` AutoIDReference uint32 `json:"autoidreference"` MessageStatus int16 `json:"messagestatus"` }
A Confirmation is returned when a directip call is invoked.
type DIPHandler ¶
type DIPHandler func(mg *MessageHeader, dih *DirectIPHeader, payload []byte, priority *int) Confirmation
type DIPServer ¶
type DIPServer struct { Handle DIPHandler OnError func(error) // contains filtered or unexported fields }
A DIPServer is a server which can listen on an given tcp address and parses the incoming directip messages. Set the Handler-Field to implement your wanted behaviour. The default is simply logging.
func NewDIPServer ¶
NewDIPServer returns a new directip server listening on the given address.
type DirectIPHeader ¶
type DirectIPRequest ¶
type DirectIPRequest struct {
// contains filtered or unexported fields
}
A DirectIPRequest encapsulates the data needed for a directip message.
func NewRequest ¶
func NewRequest() *DirectIPRequest
NewRequest returns a new request to the given address.
func (*DirectIPRequest) Do ¶
func (rq *DirectIPRequest) Do(serverAddress string) (*Confirmation, error)
func (*DirectIPRequest) With ¶
func (rq *DirectIPRequest) With(opts ...DirectOption) *DirectIPRequest
With can be used to set some request options.
type DirectOption ¶
type DirectOption func(rq *DirectIPRequest)
DirectOption is the type for configuring the request
func ClientMsgID ¶
func ClientMsgID(msg string) DirectOption
ClientMsgID sets the clientmsgi in the header. only the first 4 bytes are used!
func Payload ¶
func Payload(payload []byte) DirectOption
Payload sets payload, so a payload information element will be added.
func PriorityLevel ¶
func PriorityLevel(lvl int) DirectOption
PriorityLevel sets the prio level so a priority information element will be added.
type ElementID ¶
type ElementID byte
func (ElementID) TargetType ¶
func (eid ElementID) TargetType() interface{}
type Handler ¶
type Handler interface {
Handle(data *InformationBucket) error
}
A Handler is called by the service when a new *Short Burst Data* packet comes in. The handler will get an *InformationBucket* where all the packet data is bundled. If this handler returns nil, the server will send a positiv acknowledge back otherwise the packet will not be acknowledged.
type HandlerFunc ¶
type HandlerFunc func(data *InformationBucket) error
A HandlerFunc makes a handler from a function.
func (HandlerFunc) Handle ¶
func (f HandlerFunc) Handle(data *InformationBucket) error
Handle implements the required interface for *Handler*.
type Header ¶
An Header is sent before every information element and specifies the ID (aka type) and length of the element.
type InformationBucket ¶
type InformationBucket struct { Header *MODirectIPHeader `json:"header"` Payload []byte `json:"payload"` Location *MOLocationInformation `json:"location"` Position *Location `json:"position"` }
InformationElements is a wrapper type for the InformationElement's which are in a bundled bucket
func GetElements ¶
func GetElements(in io.Reader) (*InformationBucket, error)
GetElements parses the given stream and returns an array of found elements.
type InformationElement ¶
type InformationElement struct { Header `json:"header"` Data interface{} `json:"data"` }
An InformationElement contains a header and the data which can have different types. You have to inspect the header's ID field to get the type.
func NewPayload ¶
func NewPayload(b []byte) *InformationElement
NewPayload returns an element which contains the given bytes as payload.
func (*InformationElement) UnmarshalJSON ¶
func (u *InformationElement) UnmarshalJSON(data []byte) error
type LocationData ¶
type LocationData struct { OrientationCode Orientation `json:"orientationcode"` LatDegree byte `json:"latdegree"` LatMinute uint16 `json:"latminute"` LngDegree byte `json:"lngdegree"` LngMinute uint16 `json:"lngminute"` }
LocationData contains an orientation as well as the latitude and longitude in degree's and minutes.
type MOConfirmationMessage ¶
type MOConfirmationMessage struct {
Status byte `json:"status"`
}
A MOConfirmationMessage contains the confirmation status.
func (*MOConfirmationMessage) Success ¶
func (ch *MOConfirmationMessage) Success() bool
Success checks if the confirmation was successfull.
type MODirectIPHeader ¶
type MODirectIPHeader struct { CDRReference uint32 `json:"cdrreference"` IMEI [15]byte `json:"imei"` SessionStatus SessionStatus `json:"sessionstatus"` MOMSN uint16 `json:"momsn"` MTMSN uint16 `json:"mtmsn"` TimeOfSession uint32 `json:"timeofsession"` }
The MODirectIPHeader contains some information about the message itself.
func (*MODirectIPHeader) GetIMEI ¶
func (dih *MODirectIPHeader) GetIMEI() string
GetIMEI returns the imei as a string
func (*MODirectIPHeader) GetTime ¶
func (dih *MODirectIPHeader) GetTime() time.Time
GetTime returns the time which is specified by the TimeOfSession field
func (*MODirectIPHeader) MarshalJSON ¶
func (u *MODirectIPHeader) MarshalJSON() ([]byte, error)
func (*MODirectIPHeader) UnmarshalJSON ¶
func (u *MODirectIPHeader) UnmarshalJSON(data []byte) error
type MOLocationInformation ¶
type MOLocationInformation struct { Position LocationData `json:"position"` CEPRadius uint32 `json:"cepradius"` }
MOLocationInformation contains location information and the cep radius in km.
func (*MOLocationInformation) GetCEPRadius ¶
func (loc *MOLocationInformation) GetCEPRadius() int
GetCEPRadius simply returns the radius as an int value
func (*MOLocationInformation) GetLatLng ¶
func (loc *MOLocationInformation) GetLatLng() (float64, float64)
GetLatLng converts the location information to latitude/longitude values which can be used by other systems. The orientiation is used to convert the values to positive or negative vals.
type MOPayload ¶
type MOPayload struct {
Payload []byte `json:"payload"`
}
MOPayload is a wrapper around some blob data.
type MessageHeader ¶
A MessageHeader defines the revision and the whole message length.
type Orientation ¶
type Orientation byte
type SessionStatus ¶
type SessionStatus byte
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package mux provides a service to split incoming directip messages to backend HTTP services.
|
Package mux provides a service to split incoming directip messages to backend HTTP services. |