Files
webrtc/internal/network/network.go
Sean DuBois 78b6a76cc5 Revert "Move ICE package from public to internal folder structure"
ICE Package needs to be public for peerConnection.OnICEConnectionStateChange

This reverts commit b831f87d28.
2018-08-16 10:10:29 -07:00

54 lines
1.5 KiB
Go

package network
import (
"github.com/pions/webrtc/pkg/datachannel"
"github.com/pions/webrtc/pkg/ice"
"github.com/pions/webrtc/pkg/rtp"
)
// BufferTransportGenerator generates a new channel for the associated SSRC
// This channel is used to send RTP packets to users of pion-WebRTC
type BufferTransportGenerator func(uint32, uint8) chan<- *rtp.Packet
// ICENotifier notifies the RTCPeerConnection if ICE state has changed
type ICENotifier func(ice.ConnectionState)
// DataChannelEventHandler notifies the RTCPeerConnection of events relating to DataChannels
type DataChannelEventHandler func(DataChannelEvent)
// DataChannelEventType is the enum used to represent different types of DataChannelEvent
type DataChannelEventType int
// Enums for DataChannelEventType
const (
NewDataChannel int = iota + 1
NewMessage
)
// DataChannelEvent is the interface for all events that flow across the DataChannelEventHandler
type DataChannelEvent interface {
StreamIdentifier() uint16
}
// DataChannelCreated is emitted when a new DataChannel is created
type DataChannelCreated struct {
Label string
streamIdentifier uint16
}
// StreamIdentifier returns the streamIdentifier
func (d *DataChannelCreated) StreamIdentifier() uint16 {
return d.streamIdentifier
}
// DataChannelMessage is emitted when a DataChannel receives a message
type DataChannelMessage struct {
Payload datachannel.Payload
streamIdentifier uint16
}
// StreamIdentifier returns the streamIdentifier
func (d *DataChannelMessage) StreamIdentifier() uint16 {
return d.streamIdentifier
}