Source: strategy.js

monohm.provide ("sensible.Strategy");

/**
 * sensible strategy interface
 *
 * @class
 * @constructor
 */
 
sensible.Strategy = function ()
{
}

/**
 * Subscribe the UDP socket to a multicast address.
 *
 * @param {string} inMulticastAddress - multicast address to join, eg 224.0.0.251 for MDNS
 * @param {function} inCallback - function to call on completion
 */
 
sensible.Strategy.prototype.subscribe = function (inMulticastAddress, inCallback)
{
	throw new Error ("sensible.Strategy.subscribe() called - abstract");
}

/**
 * Open the UDP socket and bind to the specified port.
 * Note only one UDP socket per strategy instance.
 *
 * @param {integer} inPort - port to which to bind, eg 5353 for MDNS
 * @param {function} inCallback - function to call on completion
 */
sensible.Strategy.prototype.open = function (inPort, inCallback)
{
	throw new Error ("sensible.Strategy.open() called - abstract");
}

/**
 * Close the UDP socket and bind to the specified port.
 *
 * @param {integer} inPort - port to which to bind, eg 5353 for MDNS
 * @param {function} inCallback - function to call on completion
 */
sensible.Strategy.prototype.close = function ()
{
	throw new Error ("sensible.Strategy.close() called - abstract");
}

/**
 * Return the host name of the machine.
 *
 * @returns {string} host name
 */
sensible.Strategy.prototype.getHostName = function ()
{
	throw new Error ("sensible.Strategy.getHostName() called - abstract");
}

/**
 * Return the IP address of the machine.
 *
 * @returns {string} IP address
 */
sensible.Strategy.prototype.getIPAddress = function ()
{
	throw new Error ("sensible.Strategy.getIPAddress() called - abstract");
}

/**
 * Listen for packets on the UDP socket.
 *
 * @param {function} inCallback - function to call on reception
 */
sensible.Strategy.prototype.listen = function (inCallback)
{
	throw new Error ("sensible.Strategy.listen() called - abstract");
}

/**
 * Send a packet on the UDP socket.
 *
 * @param {ArrayBuffer} inPacket - packet
 * @param {string} inRemoteAddress - remote address
 * @param {port} inRemotePort - remote port
 */
sensible.Strategy.prototype.send = function (inPacket, inRemoteAddress, inRemotePort)
{
	throw new Error ("sensible.Strategy.send() called - abstract");
}