45#include "httpreadwrite.h"
58 #include <netinet/in_systm.h>
59 #include <netinet/ip.h>
60 #include <netinet/ip_icmp.h>
76#define BUFSIZE (size_t)2500
77#define SSDP_IP "239.255.255.250"
78#define SSDP_IPV6_LINKLOCAL "FF02::C"
79#define SSDP_IPV6_SITELOCAL "FF05::C"
82#define THREAD_LIMIT 50
83#define COMMAND_LEN 300
93 #define X_USER_AGENT "redsonic"
97#define NO_ERROR_FOUND 0
98#define E_REQUEST_INVALID -3
99#define E_RES_EXPIRED -4
100#define E_MEM_ALLOC -5
101#define E_HTTP_SYNTEX -6
104#define RQST_TIMEOUT 20
113 char DeviceType[LINE_SIZE];
115 char ServiceType[LINE_SIZE];
116 char Location[LINE_SIZE];
117 char HostAddr[LINE_SIZE];
120 char Date[LINE_SIZE];
121 struct sockaddr *DestAddr;
132 struct sockaddr_storage DestAddr;
139 struct sockaddr_storage dest_addr;
160 struct sockaddr_storage dest_addr;
165#ifdef INCLUDE_CLIENT_APIS
166 extern SOCKET gSsdpReqSocket4;
167 #ifdef UPNP_ENABLE_IPV6
168 extern SOCKET gSsdpReqSocket6;
171typedef int (*ParserFun)(
char *,
SsdpEvent *);
192 struct sockaddr *DestAddr,
272 struct sockaddr_storage *dest_addr,
326#ifdef INCLUDE_DEVICE_APIS
331 struct sockaddr_storage *dest_addr);
337 struct sockaddr_storage *dest_addr) {}
364 int RegistrationState);
374 struct sockaddr *DestAddr,
392 int RegistrationState);
402 struct sockaddr *DestAddr,
418 int RegistrationState);
442 int RegistrationState);
452 struct sockaddr *DestAddr,
466 int RegistrationState);
490 int RegistrationState);
516 int RegistrationState);
#define UPNP_INLINE
Declares an inline function.
Definition UpnpGlobal.h:99
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:545
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:643
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:92
int ssdp_request_type(char *cmd, SsdpEvent *Evt)
Starts filling the SSDP event structure based upon the request received.
Definition ssdp_server.c:548
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:495
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:1165
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:834
void readFromSSDPSocket(SOCKET socket)
This function reads the data from the ssdp socket.
Definition ssdp_server.c:694
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:533
void advertiseAndReplyThread(void *data)
Wrapper function to reply the search request coming from the control point.
Definition ssdp_device.c:67
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:706
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:783
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:78
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:579
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:447
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:757
SsdpSearchType
Definition ssdplib.h:66
@ SSDP_SERROR
Definition ssdplib.h:68
int SOCKET
Definition UpnpInet.h:48
int UpnpDevice_Handle
Returned when a device application registers with UpnpRegisterRootDevice, UpnpRegisterRootDevice2,...
Definition upnp.h:436
Definition miniserver.h:45
Definition httpparser.h:179
Definition httpparser.h:213