Logo Search packages:      
Sourcecode: libupnp4 version File versions  Download package

upnpapi.c File Reference


Detailed Description

Definition in file upnpapi.c.

#include "config.h"
#include <sys/stat.h>
#include <assert.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include "upnpapi.h"
#include "httpreadwrite.h"
#include "membuffer.h"
#include "ssdplib.h"
#include "soaplib.h"
#include "ThreadPool.h"
#include "sysdep.h"
#include "uuid.h"
#include "gena.h"
#include "miniserver.h"
#include "service_table.h"

Go to the source code of this file.

Functions

int FreeHandle (int Upnp_Handle)
 Free handle.
Upnp_FunPtr GetCallBackFn (UpnpClient_Handle Hnd)
 Schedule async functions in threadpool.
Upnp_Handle_Type GetClientHandleInfo (UpnpClient_Handle *client_handle_out, struct Handle_Info **HndInfo)
 Get client handle info.
static int GetDescDocumentAndURL (Upnp_DescType descriptionType, char *description, unsigned int bufferLen, int config_baseURL, int AddressFamily, IXML_Document **xmlDoc, char *descURL)
 Fills the sockadr_in with miniserver information.
Upnp_Handle_Type GetDeviceHandleInfo (const int AddressFamily, UpnpDevice_Handle *device_handle_out, struct Handle_Info **HndInfo)
 Retrieves the device handle and information of the first device of the address family spcified.
int GetFreeHandle ()
 Get a free handle.
Upnp_Handle_Type GetHandleInfo (UpnpClient_Handle Hnd, struct Handle_Info **HndInfo)
 Get handle information.
int getlocalhostname (char *out, const int out_len)
 Get local IP address.
void InitHandleList ()
 Initialize handle table.
int PrintHandleInfo (UpnpClient_Handle Hnd)
 Print handle info.
static void printNodes (IXML_Node *tmpRoot, int depth)
 Print the node names and values of a XML tree.
int UpnpAddVirtualDir (const char *newDirName)
 Adds a virtual directory mapping.
int UpnpCancelHttpGet (void *Handle)
 Set the cancel flag of the handle parameter.
int UpnpCloseHttpGet (void *Handle)
 Closes the connection and frees memory that was allocated for the handle parameter.
int UpnpCloseHttpPost (void *handle, int *httpStatus, int timeout)
 Sends and receives any pending data, closes the connection with the server, and frees memory allocated during the UpnpOpenHttpPost call.
int UpnpDownloadUrlItem (const char *url, char **outBuf, char *contentType)
 Downloads a file specified in a URL.
int UpnpDownloadXmlDoc (const char *url, IXML_Document **xmlDoc)
 Downloads an XML document specified in a URL.
int UpnpEnableWebserver (int enable)
 Enables or disables the webserver.
int UpnpFinish ()
 Terminates the Linux SDK for UPnP Devices.
int UpnpGetIfInfo (const char *IfName)
 Retrieve interface information and keep it in global variables. If NULL, we'll find the first suitable interface for operation.
char * UpnpGetServerIp6Address ()
 Returns the local IPv6 listening ip address.
char * UpnpGetServerIpAddress ()
 Returns the local IPv4 listening ip address.
unsigned short UpnpGetServerPort ()
 Returns the internal server IPv4 UPnP listening port.
unsigned short UpnpGetServerPort6 ()
 Returns the internal server IPv6 UPnP listening port.
int UpnpHttpGetProgress (void *Handle, unsigned int *length, unsigned int *total)
 Retrieve progress information of a http-get transfer.
int UpnpInit (const char *HostIP, unsigned short DestPort)
 Initializes the Linux SDK for UPnP Devices.
int UpnpInit2 (const char *IfName, unsigned short DestPort)
 Initializes the Linux SDK for UPnP Devices.
int UpnpInitMutexes ()
 Initializes the global mutexes used by the UPnP SDK.
int UpnpInitPreamble ()
 (Windows Only) Initializes the Windows Winsock library.
int UpnpInitStartServers (unsigned short DestPort)
 Finishes initializing the UPnP SDK.
int UpnpInitThreadPools ()
 Initializes the global threadm pools used by the UPnP SDK.
int UpnpIsWebserverEnabled ()
 Checks if the webserver is enabled or disabled.
int UpnpOpenHttpGet (const char *url_str, void **Handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
 Gets a file specified in a URL.
int UpnpOpenHttpGetEx (const char *url_str, void **Handle, char **contentType, int *contentLength, int *httpStatus, int lowRange, int highRange, int timeout)
 Gets specified number of bytes from a file specified in the URL.
int UpnpOpenHttpGetProxy (const char *url_str, const char *proxy_str, void **Handle, char **contentType, int *contentLength, int *httpStatus, int timeout)
 Gets a file specified in a URL through the specified proxy.
int UpnpOpenHttpPost (const char *url, void **handle, const char *contentType, int contentLength, int timeout)
 Makes an HTTP POST request message, opens a connection to the server and sends the POST request to the server if the connection to the server succeeds.
int UpnpReadHttpGet (void *Handle, char *buf, unsigned int *size, int timeout)
 Gets specified number of bytes from a file specified in a URL.
void UpnpRemoveAllVirtualDirs ()
 Removes all virtual directory mappings.
int UpnpRemoveVirtualDir (const char *dirName)
 Removes a virtual directory mapping made with UpnpAddVirtualDir.
int UpnpSetContentLength (UpnpClient_Handle Hnd, int contentLength)
int UpnpSetMaxContentLength (size_t contentLength)
 Sets the maximum content-length that the SDK will process on an incoming SOAP requests or responses.
int UpnpVirtualDir_set_CloseCallback (VDCallback_Close callback)
 Sets the close callback function to be used to access a virtual directory.
int UpnpVirtualDir_set_GetInfoCallback (VDCallback_GetInfo callback)
 Sets the get_info callback function to be used to access a virtual directory.
int UpnpVirtualDir_set_OpenCallback (VDCallback_Open callback)
 Sets the open callback function to be used to access a virtual directory.
int UpnpVirtualDir_set_ReadCallback (VDCallback_Read callback)
 Sets the read callback function to be used to access a virtual directory.
int UpnpVirtualDir_set_SeekCallback (VDCallback_Seek callback)
 Sets the seek callback function to be used to access a virtual directory.
int UpnpVirtualDir_set_WriteCallback (VDCallback_Write callback)
 Sets the write callback function to be used to access a virtual directory.
int UpnpWriteHttpPost (void *handle, char *buf, unsigned int *size, int timeout)
 Sends a request to a server to copy the contents of a buffer to the URI specified in the UpnpOpenHttpPost call.

Variables

WebServerState bWebServerState = WEB_SERVER_DISABLED
size_t g_maxContentLength = DEFAULT_SOAP_CONTENT_LENGTH
membuffer gDocumentRootDir
int gIF_INDEX = -1
char gIF_IPV4 [22] = { '\0' }
char gIF_IPV6 [65] = { '\0' }
char gIF_NAME [LINE_SIZE] = { '\0' }
ithread_rwlock_t GlobalHndRWLock
ThreadPool gMiniServerThreadPool
ThreadPool gRecvThreadPool
ithread_mutex_t gSDKInitMutex = PTHREAD_MUTEX_INITIALIZER
ThreadPool gSendThreadPool
TimerThread gTimerThread
Upnp_SID gUpnpSdkNLSuuid
ithread_mutex_t gUUIDMutex
void * HandleTable [NUM_HANDLE]
unsigned short LOCAL_PORT_V4
unsigned short LOCAL_PORT_V6
virtualDirList * pVirtualDirList
int UpnpSdkClientRegistered = 0
int UpnpSdkDeviceRegisteredV4 = 0
int UpnpSdkDeviceregisteredV6 = 0
int UpnpSdkInit = 0
struct VirtualDirCallbacks virtualDirCallback


Generated by  Doxygen 1.6.0   Back to index