package main // Very experimental implementation of XEP-0166: Jingle // https://xmpp.org/extensions/xep-0166.html import ( "encoding/xml" "gosrc.io/xmpp/stanza" ) type Jingle struct { XMLName xml.Name `xml:"urn:xmpp:jingle:1 jingle"` Action string `xml:"action,attr"` Initiator string `xml:"initiator,attr,omitempty"` Responder string `xml:"responder,attr,omitempty"` Sid string `xml:"sid,attr"` Reason *JingleReason `xml:"reason,omitempty"` } type JingleReason struct { XMLName xml.Name `xml:"reason"` AlternativeSession *string `xml:"alternative-session,omitempty"` Busy *string `xml:"busy,omitempty"` Cancelled *string `xml:"cancelled,omitempty"` Decline *string `xml:"decline,omitempty"` FailedTransport *string `xml:"failed-transport,omitempty"` GeneralError *string `xml:"general-error,omitempty"` IncompatibleParameters *string `xml:"incompatible-parameters,omitempty"` SecurityError *string `xml:"security-error,omitempty"` } type JingleContent struct { XMLName xml.Name `xml:"content"` Name string `xml:"name,attr"` Creator string `xml:"creator,attr"` Description JingleContentDescription `xml:"description"` Transport JingleContentTransport `xml:"transport"` } type JingleContentDescription struct { XMLName xml.Name `xml:"urn:xmpp:jingle:apps:rtp:1 description"` Media string `xml:"media,attr"` Payloads []JingleContentDescriptionPayload `xml:"payload-type"` } type JingleContentDescriptionPayload struct { XMLName xml.Name `xml:"payload-type"` ID int `xml:"id,attr"` Name string `xml:"name,attr"` ClockRate int `xml:"clockrate,attr,omitempty"` Channels int `xml:"channels,attr,omitempty"` } type JingleContentTransport struct { XMLName xml.Name `xml:"urn:xmpp:jingle:transports:ice-udp:1 transport"` Ufrag string `xml:"ufrag,attr"` Pwd string `xml:"pwd,attr"` Candidates []JingleContentTransportCandidate `xml:"candidate"` } type JingleContentTransportCandidate struct { XMLName xml.Name `xml:"candidate"` ID string `xml:"id,attr"` Component int `xml:"component,attr"` Foundation string `xml:"foundation,attr"` Generation int `xml:"generation,attr"` IP string `xml:"ip,attr"` Port int `xml:"port,attr"` Priority int `xml:"priority,attr"` Protocol string `xml:"protocol,attr"` Type string `xml:"type,attr"` } func init() { stanza.TypeRegistry.MapExtension(stanza.PKTIQ, xml.Name{Space: "urn:xmpp:jingle:1", Local: "jingle"}, Jingle{}) }