46#include "httpreadwrite.h"
58 #include <netinet/in_systm.h>
59 #include <netinet/ip.h>
60 #include <netinet/ip_icmp.h>
77#define BUFSIZE (size_t)2500
78#define SSDP_IP "239.255.255.250"
79#define SSDP_IPV6_LINKLOCAL "FF02::C"
80#define SSDP_IPV6_SITELOCAL "FF05::C"
82#define SSDP_PORT_STR "1900"
84#define THREAD_LIMIT 50
85#define COMMAND_LEN 300
95 #define X_USER_AGENT "redsonic"
99#define NO_ERROR_FOUND 0
100#define E_REQUEST_INVALID -3
101#define E_RES_EXPIRED -4
102#define E_MEM_ALLOC -5
103#define E_HTTP_SYNTEX -6
106#define RQST_TIMEOUT 20
116 char DeviceType[LINE_SIZE];
118 char ServiceType[LINE_SIZE];
119 char Location[LINE_SIZE];
120 char HostAddr[LINE_SIZE];
123 char Date[LINE_SIZE];
124 struct sockaddr *DestAddr;
135 struct sockaddr_storage DestAddr;
142 struct sockaddr_storage dest_addr;
163 struct sockaddr_storage dest_addr;
168#ifdef INCLUDE_CLIENT_APIS
169extern SOCKET gSsdpReqSocket4;
170 #ifdef UPNP_ENABLE_IPV6
171extern SOCKET gSsdpReqSocket6;
174typedef int (*ParserFun)(
char *,
SsdpEvent *);
195 struct sockaddr *DestAddr,
277 struct sockaddr_storage *dest_addr,
331#ifdef INCLUDE_DEVICE_APIS
336 struct sockaddr_storage *dest_addr);
342 struct sockaddr_storage *dest_addr)
371 int RegistrationState);
381 struct sockaddr *DestAddr,
399 int RegistrationState);
409 struct sockaddr *DestAddr,
425 int RegistrationState);
449 int RegistrationState);
459 struct sockaddr *DestAddr,
473 int RegistrationState);
497 int RegistrationState);
523 int RegistrationState);
#define UPNP_INLINE
Declares an inline function.
Definition: UpnpGlobal.h:119
Provides a platform independent way to include TCP/IP types and functions.
int SearchByTarget(int Hnd, int Mx, char *St, void *Cookie)
Creates and send the search request for a specific URL.
Definition: ssdp_ctrlpt.c:573
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...
Definition: ssdp_device.c:984
int AdvertiseAndReply(int AdFlag, UpnpDevice_Handle Hnd, enum SsdpSearchType SearchType, struct sockaddr *DestAddr, char *DeviceType, char *DeviceUDN, char *ServiceType, int Exp)
Sends SSDP advertisements, replies and shutdown messages.
Definition: ssdp_server.c:90
int ssdp_request_type(char *cmd, SsdpEvent *Evt)
Starts filling the SSDP event structure based upon the request received.
Definition: ssdp_server.c:650
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 c...
Definition: ssdp_device.c:772
struct SsdpEventStruct SsdpEvent
int get_ssdp_sockets(MiniServerSockArray *out)
Creates the IPv4 and IPv6 ssdp sockets required by the control point and device operation.
Definition: ssdp_server.c:1471
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 RequestHan...
Definition: ssdp_device.c:1246
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 s...
Definition: ssdp_device.c:80
enum SsdpSearchType SType
enum SsdpSearchType ssdp_request_type1(char *cmd)
This function figures out the type of the SSDP search in the in the request.
Definition: ssdp_server.c:635
void advertiseAndReplyThread(void *data)
Wrapper function to reply the search request coming from the control point.
Definition: ssdp_device.c:64
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.
Definition: ssdp_device.c:1074
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 RequestH...
Definition: ssdp_device.c:1179
void ssdp_handle_ctrlpt_msg(http_message_t *hmsg, struct sockaddr_storage *dest_addr, int timeout)
This function handles the ssdp messages from the devices. These messages includes the search replies,...
Definition: ssdp_ctrlpt.c:76
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...
Definition: ssdp_device.c:892
int unique_service_name(char *cmd, SsdpEvent *Evt)
Fills the fields of the event structure like DeviceType, Device UDN and Service Type.
Definition: ssdp_server.c:543
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.
Definition: ssdp_device.c:1141
SsdpSearchType
Definition: ssdplib.h:67
int readFromSSDPSocket(SOCKET socket)
This function reads the data from the ssdp socket.
Definition: ssdp_server.c:808
@ SSDP_SERROR
Definition: ssdplib.h:69
int SOCKET
Definition: UpnpInet.h:48
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition: upnp.h:439
Definition: miniserver.h:46
Definition: ssdplib.h:110
Definition: ssdplib.h:131
Definition: httpparser.h:182
Definition: httpparser.h:217
Definition: ssdplib.h:161
Definition: ssdplib.h:147
Definition: ssdplib.h:155
Definition: ssdplib.h:139