// NetworkPreference property set by operating system/firmware that has // information about connection strength to e.g WIFI router or CELL base towers. // GENERATED_JAVA_ENUM_PACKAGE: org.webrtc
enum class NetworkPreference {
NEUTRAL = 0,
NOT_PREFERRED = -1,
};
// This interface is set onto a socket server, // where only the ip address is known at the time of binding. class NetworkBinderInterface { public: // Binds a socket to the network that is attached to `address` so that all // packets on the socket `socket_fd` will be sent via that network. // This is needed because some operating systems (like Android) require a // special bind call to put packets on a non-default network interface. virtual NetworkBindingResult BindSocketToNetwork(
int socket_fd, const IPAddress& address) = 0; virtual ~NetworkBinderInterface() {}
};
/* *Receivesnetwork-changeeventsvia`OnNetworksChanged`andsignalsthe *networkschangedevent. * *Threadingconsideration: *Itisexpectedthatallupstreamoperations(fromnativetoJava)are *performedfromtheworkerthread.Thisincludescreating,startingand *stoppingthemonitor.Thisavoidsthepotentialraceconditionwhencreating *thesingletonJavaNetworkMonitorclass.Downstreamoperationscanbefrom *anythread,butthisclasswillforwardallthedownstreamoperationsonto *theworkerthread. * *Memoryconsideration: *NetworkMonitorisownedbythecaller(NetworkManager).Theglobalnetwork *monitorfactoryisownedbythePeerConnectionFactory.
*/ // Generic network monitor interface. It starts and stops monitoring network // changes, and fires the SignalNetworksChanged event when networks change. class NetworkMonitorInterface { public: struct InterfaceInfo { // The type of adapter if known.
AdapterType adapter_type;
// The OS/firmware specific preference of this interface.
NetworkPreference network_preference = NetworkPreference::NEUTRAL;
// Is this interface available to use? WebRTC shouldn't attempt to use it if // this returns false. // // It's possible for this status to change, in which case // SignalNetworksChanged will be fired. // // The specific use case this was added for was a phone with two SIM // cards, where attempting to use all interfaces returned from getifaddrs // caused the connection to be dropped. bool available = true;
// Is this network using network slicing.
NetworkSlice slice = NetworkSlice::NO_SLICE;
};
// Get information about an interface. // If the interface is not known, the return struct will have set // `adapter_type` to ADAPTER_TYPE_UNKNOWN and `available` to false. virtual InterfaceInfo GetInterfaceInfo(absl::string_view interface_name) = 0;
// Does `this` NetworkMonitorInterface implement BindSocketToNetwork? // Only Android returns true. virtualbool SupportsBindSocketToNetwork() const { return false; }
// Bind a socket to an interface specified by ip address and/or interface // name. Only implemented on Android. virtual NetworkBindingResult BindSocketToNetwork(
int /* socket_fd */, const IPAddress& /* address */,
absl::string_view /* interface_name */) { return NetworkBindingResult::NOT_IMPLEMENTED;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.