From 18f52af5be3a9a0c73811706108f790d65ee9c67 Mon Sep 17 00:00:00 2001 From: "kali kaneko (leap communications)" Date: Mon, 29 Nov 2021 01:46:27 +0100 Subject: [pkg] update vendor --- .../github.com/pion/sdp/v3/session_description.go | 146 +++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 vendor/github.com/pion/sdp/v3/session_description.go (limited to 'vendor/github.com/pion/sdp/v3/session_description.go') diff --git a/vendor/github.com/pion/sdp/v3/session_description.go b/vendor/github.com/pion/sdp/v3/session_description.go new file mode 100644 index 0000000..c4aaf5f --- /dev/null +++ b/vendor/github.com/pion/sdp/v3/session_description.go @@ -0,0 +1,146 @@ +package sdp + +import ( + "fmt" + "net/url" + "strconv" +) + +// SessionDescription is a a well-defined format for conveying sufficient +// information to discover and participate in a multimedia session. +type SessionDescription struct { + // v=0 + // https://tools.ietf.org/html/rfc4566#section-5.1 + Version Version + + // o= + // https://tools.ietf.org/html/rfc4566#section-5.2 + Origin Origin + + // s= + // https://tools.ietf.org/html/rfc4566#section-5.3 + SessionName SessionName + + // i= + // https://tools.ietf.org/html/rfc4566#section-5.4 + SessionInformation *Information + + // u= + // https://tools.ietf.org/html/rfc4566#section-5.5 + URI *url.URL + + // e= + // https://tools.ietf.org/html/rfc4566#section-5.6 + EmailAddress *EmailAddress + + // p= + // https://tools.ietf.org/html/rfc4566#section-5.6 + PhoneNumber *PhoneNumber + + // c= + // https://tools.ietf.org/html/rfc4566#section-5.7 + ConnectionInformation *ConnectionInformation + + // b=: + // https://tools.ietf.org/html/rfc4566#section-5.8 + Bandwidth []Bandwidth + + // https://tools.ietf.org/html/rfc4566#section-5.9 + // https://tools.ietf.org/html/rfc4566#section-5.10 + TimeDescriptions []TimeDescription + + // z= ... + // https://tools.ietf.org/html/rfc4566#section-5.11 + TimeZones []TimeZone + + // k= + // k=: + // https://tools.ietf.org/html/rfc4566#section-5.12 + EncryptionKey *EncryptionKey + + // a= + // a=: + // https://tools.ietf.org/html/rfc4566#section-5.13 + Attributes []Attribute + + // https://tools.ietf.org/html/rfc4566#section-5.14 + MediaDescriptions []*MediaDescription +} + +// Attribute returns the value of an attribute and if it exists +func (s *SessionDescription) Attribute(key string) (string, bool) { + for _, a := range s.Attributes { + if a.Key == key { + return a.Value, true + } + } + return "", false +} + +// Version describes the value provided by the "v=" field which gives +// the version of the Session Description Protocol. +type Version int + +func (v Version) String() string { + return strconv.Itoa(int(v)) +} + +// Origin defines the structure for the "o=" field which provides the +// originator of the session plus a session identifier and version number. +type Origin struct { + Username string + SessionID uint64 + SessionVersion uint64 + NetworkType string + AddressType string + UnicastAddress string +} + +func (o Origin) String() string { + return fmt.Sprintf( + "%v %d %d %v %v %v", + o.Username, + o.SessionID, + o.SessionVersion, + o.NetworkType, + o.AddressType, + o.UnicastAddress, + ) +} + +// SessionName describes a structured representations for the "s=" field +// and is the textual session name. +type SessionName string + +func (s SessionName) String() string { + return string(s) +} + +// EmailAddress describes a structured representations for the "e=" line +// which specifies email contact information for the person responsible for +// the conference. +type EmailAddress string + +func (e EmailAddress) String() string { + return string(e) +} + +// PhoneNumber describes a structured representations for the "p=" line +// specify phone contact information for the person responsible for the +// conference. +type PhoneNumber string + +func (p PhoneNumber) String() string { + return string(p) +} + +// TimeZone defines the structured object for "z=" line which describes +// repeated sessions scheduling. +type TimeZone struct { + AdjustmentTime uint64 + Offset int64 +} + +func (z TimeZone) String() string { + return strconv.FormatUint(z.AdjustmentTime, 10) + " " + strconv.FormatInt(z.Offset, 10) +} -- cgit v1.2.3