libUPnP 1.14.19
Macros | Functions
ssdp_device.c File Reference
#include "config.h"
#include "ThreadPool.h"
#include "UpnpInet.h"
#include "httpparser.h"
#include "httpreadwrite.h"
#include "ssdplib.h"
#include "statcodes.h"
#include "unixutil.h"
#include "upnpapi.h"
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "posix_overwrites.h"
Include dependency graph for ssdp_device.c:

Macros

#define MSGTYPE_SHUTDOWN   0
 
#define MSGTYPE_ADVERTISEMENT   1
 
#define MSGTYPE_REPLY   2
 
#define MX_FUDGE_FACTOR   10
 

Functions

static int NewRequestHandler (struct sockaddr *DestAddr, int NumPacket, char **RqPacket)
 Works as a request handler which passes the HTTP request string to multicast channel.
 
static int extractIPv6address (char *url, char *address)
 
static int isUrlV6UlaGua (char *descdocUrl)
 
static void CreateServicePacket (int msg_type, const char *nt, char *usn, char *location, int duration, char **packet, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
 Creates a HTTP request packet. Depending on the input parameter, it either creates a service advertisement request or service shutdown request etc.
 
SSDP Device Functions
void advertiseAndReplyThread (void *data)
 Wrapper function to reply the search request coming from the control point.
 
void ssdp_handle_device_request (http_message_t *hmsg, struct sockaddr_storage *dest_addr)
 Handles the search request. It does the sanity checks of the request and then schedules a thread to send a random time reply (random within maximum time given by the control point to reply).
 
int DeviceAdvertisement (char *DevType, int RootDev, char *Udn, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
 Creates the device advertisement request based on the input parameter, and send it to the multicast channel.
 
int SendReply (struct sockaddr *DestAddr, char *DevType, int RootDev, char *Udn, char *Location, int Duration, int ByType, int PowerState, int SleepPeriod, int RegistrationState)
 Creates the reply packet based on the input parameter, and send it to the client addesss given in its input parameter DestAddr.
 
int DeviceReply (struct sockaddr *DestAddr, char *DevType, int RootDev, char *Udn, char *Location, int Duration, int PowerState, int SleepPeriod, int RegistrationState)
 Creates the reply packet based on the input parameter, and send it to the client address given in its input parameter DestAddr.
 
int ServiceAdvertisement (char *Udn, char *ServType, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
 Creates the advertisement packet based on the input parameter, and send it to the multicast channel.
 
int ServiceReply (struct sockaddr *DestAddr, char *ServType, char *Udn, char *Location, int Duration, int PowerState, int SleepPeriod, int RegistrationState)
 Creates the advertisement packet based on the input parameter, and send it to the multicast channel.
 
int ServiceShutdown (char *Udn, char *ServType, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
 Creates a HTTP service shutdown request packet and sends it to the multicast channel through RequestHandler.
 
int DeviceShutdown (char *DevType, int RootDev, char *Udn, char *Location, int Duration, int AddressFamily, int PowerState, int SleepPeriod, int RegistrationState)
 Creates a HTTP device shutdown request packet and send it to the multicast channel through RequestHandler.