MumbleKit
 All Classes Functions
Instance Methods | List of all members
MKConnection Class Reference

#import <MumbleKit/MKConnection.h>

Inheritance diagram for MKConnection:

Instance Methods

(id) - init
 Initialize a new MKConnection object.
 
(void) - dealloc
 Deallocate a MKConnection object.
 
(void) - connectToHost:port:
 
(void) - reconnect
 
(void) - disconnect
 Disconnect from the server.
 
(BOOL) - connected
 
(NSString *) - hostname
 The hostname that the MKConnection is currently connected to.
 
(NSUInteger) - port
 The port number on the host that the MKConnection is currently connected to.
 
(void) - setCertificateChain:
 
(NSArray *) - certificateChain
 Returns the certificate chain that is to be presented to the server during the next connection attempt.
 
(NSString *) - serverVersion
 
(NSString *) - serverRelease
 
(NSString *) - serverOSName
 
(NSString *) - serverOSVersion
 
Authenticating with the server


(void) - authenticateWithUsername:password:accessTokens:
 
Message Handler


(void) - setMessageHandler:
 
(id) - messageHandler
 
Delegate


(void) - setDelegate:
 
(id) - delegate
 
TLS connection state


(void) - setIgnoreSSLVerification:
 
(NSArray *) - peerCertificates
 
(BOOL) - peerCertificateChainTrusted
 
Forced TCP mode


(void) - setForceTCP:
 
(BOOL) - forceTCP
 
Sending data to the remote server


(void) - sendMessageWithType:data:
 
(void) - sendVoiceData:
 
Codec Information


(NSUInteger) - alphaCodec
 The current elected alpha codec, as determined by the server through a mojority vote.
 
(NSUInteger) - betaCodec
 The currently elected beta codec, as determined by the server through a majority vote.
 
(BOOL) - preferAlphaCodec
 
(BOOL) - shouldUseOpus
 Returns whether ot not the connected client should use the Opus codec.
 

Detailed Description

MKConnection represents a connection to a Mumble server. It is mostly used together with MKServerModel which translates the wire protocol to Objective-C delegate callbacks.

Method Documentation

- (void) authenticateWithUsername: (NSString *)  user
password: (NSString *)  pass
accessTokens: (NSArray *)  tokens 

Once a connection has been established (that is, once the connectionOpened: delegate method has been called), this method must be used to authenticate with the remote Mumble server.

Parameters
userThe username of the user that the MKConnection should authenticate itself as. This can be a registered user, or a new user that is currently not registered.
passThe password to authenticate with. If the specified username is that of a registered user, the password will be treated as a user password. Otherwise, it will be treated as a server password.
tokensThe initial set of access tokens for the user we are connecting as, in the form of an NSArray of NSStrings. This parameter may be nil if the user does not have any access tokens.
- (BOOL) connected

The current status of the connection.

Returns
Returns YES if the MKConnection is currently connected to a server. Returns NO otherwise.
- (void) connectToHost: (NSString *)  hostName
port: (NSUInteger)  port 

Establish a connection to the given host and port.

Parameters
hostNameThe hostname to connect to.
portThe port on hostname to connect to.
- (BOOL) forceTCP

Returns the current Forced-TCP status of the MKConnection object.

Returns
Returns YES if all UDP trafic to and from the remote server is being tunelled through a TCP connection. Returns NO otherwise.
- (BOOL) peerCertificateChainTrusted

Once a connection is established, this method returns the system's trust status of the server's certificate chain. This trust is based on the system's list of root certificate authorities.

- (NSArray *) peerCertificates

Once a connection is established, this method returns an array containing the TLS certificate chain of the remote server.

Certificates in the chain are represented by MKCertificate objects.

- (BOOL) preferAlphaCodec

Returns whether or not clients should prefer the alpha codec over the beta codec (if at all possible).

- (void) reconnect

Re-establish the connection. This is often used together with the setIgnoreSSLVerification: method to implement an "Are You Sure?" dialog for self-signed certificates.

- (void) sendMessageWithType: (MKMessageType)  messageType
data: (NSData *)  data 

Transmits a blob of data (presumed to be a message encoded as expected by the Mumble server) using the given messageType as the token used for identifying how the contents of the message are to be handled by the remote server.

Parameters
messageTypeA MKMessageType describing the kind of message that is to be transmitted.
dataThe raw data to be sent to the remote server. This is presumed to be a message encoded as expected by the remote server. (That is, MKConnection will not attempt to serialize the passed-in data).
- (void) sendVoiceData: (NSData *)  data

Send a voice packet to the remote server. The voice packet will be transported to the server using UDP, unless the forceTCP property has been changed to force all UDP trafic to be tunelled through TCP.

Parameters
dataA raw Mumble voice packet.
- (NSString *) serverOSName

A textual description of the operating system that powers the Mumble server that the MKConnection object is currently connected to.

- (NSString *) serverOSVersion

A textual description of the version of the operating system that powers the Mumble server that the MKConnection object is currently connected to.

- (NSString *) serverRelease

A textual description of the release name of the Mumble server that the MKConnection object is currently connected to.

- (NSString *) serverVersion

A textual description of the version number of the Mumble server that the MKConnection object is currently connected to.

- (void) setCertificateChain: (NSArray *)  chain

Set a certificate chain to be used for the MKConnection. This property is only used during connection establishment, and as such, chaning this value while the MKConnection object is a conncted to a server has no effect.

Parameters
chainA NSArray containing a SecIdentityRef as its first item, and SecCertificateRefs subsequently.
- (void) setForceTCP: (BOOL)  shouldForceTCP

Set whether or not the server should force all UDP trafic to be tunelled through TCP. If at all possible, this should be kept as NO (which is also the default value).

Parameters
shouldForceTCPShould be YES if the connection shall tunnel all UDP trafic through TCP.
- (void) setIgnoreSSLVerification: (BOOL)  shouldIgnoreVerification

Signals to the MKConnection that it should ignore most verification errors that happen while verifying the server's certificate chain during the TLS handshake.

This is used to implement user trust of servers with self-signed (or perhaps shady) certificates.

Parameters
shouldIgnoreVerificationShould be YES if the connection should ignore TLS certificate chain verification errors. By default this is set to NO.

The documentation for this class was generated from the following file: