cUPnPServer Class Reference

#include <server.h>

Collaboration diagram for cUPnPServer:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 cUPnPServer ()
virtual ~cUPnPServer ()
void enable (bool enabled)
bool start (void)
bool restart (void)
void stop (void)
bool autoDetectSettings (void)
sockaddr_in * getServerAddress (void)
const char * getInterface (void) const
bool setServerPort (unsigned short port)
bool setInterface (const char *Interface)
bool setAddress (const char *Address)
bool setAutoDetection (bool enable)
bool isEnabled (void) const
bool isRunning (void) const
bool isAutoDetectionEnabled ()

Friends

class cPluginUpnp


Detailed Description

The UPnP Server

This is the core of the UPnP server. This handles all the components which are needed for a UPnP media server. Incoming messages are passed through it and it determines what to do.


Constructor & Destructor Documentation

cUPnPServer::cUPnPServer (  ) 

Constructor

This will create a new server and initializes the main functionalities The server has to be started manually by invoking cUPnPServer::start().

cUPnPServer::~cUPnPServer (  )  [virtual]

Destructor

This will destroy the server object. Open ports and connections will be closed.


Member Function Documentation

bool cUPnPServer::autoDetectSettings ( void   ) 

Automatically detect settings

This will automatically detect the network settings if the autodetection is turned on.

Returns:
returns
  • true, if autoDetection was successful
  • false, otherwise

void cUPnPServer::enable ( bool  enabled  ) 

Enable the server

This switch indicates if the server is startable or not

If it is set to false, any invocation of start() will do nothing.

Parameters:
enabled if true, the server will be enabled. If false it is disabled.

const char* cUPnPServer::getInterface ( void   )  const [inline]

Get the interface the server listens to

Returns:
the network interface

sockaddr_in * cUPnPServer::getServerAddress ( void   ) 

Get the server address

Returns a server address structure including IP address and port

Returns:
The server socket address

bool cUPnPServer::isAutoDetectionEnabled (  )  [inline]

Is auto detection enabled or not

Returns true or false if auto detection is enabled or not

Returns:
returns
  • true, if autodetection is enabled
  • false, otherwise

bool cUPnPServer::isEnabled ( void   )  const [inline]

Checks if the server is enabled

This indicates if the server is currently enabled.

Returns:
returns
  • true, if the server is enabled
  • false, otherwise

bool cUPnPServer::isRunning ( void   )  const [inline]

Checks if the server is running

If the server is enabled, this indicates if it is running.

Returns:
returns
  • true if the server is running
  • false, otherwise

bool cUPnPServer::restart ( void   ) 

Restart the server

When the server is not operating properly it can be restarted. It will stop the server functionalities, clear everything and start it again.

Returns:
returns
  • true, when the server restarted successfully
  • false, otherwise

bool cUPnPServer::setAddress ( const char *  Address  ) 

Set the server address

Specifies the servers IP address. The server needs to restart when the IP is changed. However, it's not possible to detect changes through the system.

This method should only be used in cases of fixed IP addresses for example when no DHCP server is available.

Parameters:
Address The address of the server
Returns:
returns
  • true, if the new server address is set
  • false, otherwise

bool cUPnPServer::setAutoDetection ( bool  enable  ) 

Enables oder Disables auto detection mode

If this is set to true, the setup will get it's information via auto detection

Parameters:
enable true enables and false disables the auto detection
Returns:
returns
  • true, if the new server address is set
  • false, otherwise

bool cUPnPServer::setInterface ( const char *  Interface  ) 

The Interface to listen on

Sets the listener interface, for instance 'eth1' or 'wlan0'

Parameters:
Interface The interface of the server
Returns:
returns
  • true, if the new server address is set
  • false, otherwise

bool cUPnPServer::setServerPort ( unsigned short  port  ) 

Set the server port

The port must be in the scope of user definied ports (49152 - 65535). If the port is 0, it is autoassigned. You can retrieve the actual port by calling getServerAddress(), which will give you a structure with the port in it.

The server must be restarted if the IP or port changes.

Returns 1 when the port is valid, 0 otherwise

Parameters:
port The port of the server
Returns:
returns
  • true, if the new server port is set
  • false, otherwise

bool cUPnPServer::start ( void   ) 

Start the UPnP server

This will start the UPnP server activities as a background task.

Returns:
returns
  • true, when the server started successfully
  • false, otherwise

void cUPnPServer::stop ( void   ) 

Stop the server

This will stop the server. This means that open connections to any clients and open ports will be closed.


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

Generated on Sun Nov 8 15:44:09 2009 for UPnP/DLNA plugin for VDR by  doxygen 1.5.8