UPnPsdk 0.1
Universal Plug and Play +, Software Development Kit
 
Loading...
Searching...
No Matches
ssdp_common.hpp File Reference

Manage "Step 1: Discovery" of the UPnP+™ specification with SSDP. More...

#include <miniserver.hpp>
+ Include dependency graph for ssdp_common.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SsdpEvent
 Structure to store the SSDP information. More...
 
struct  ThreadData
 thread data. More...
 
struct  SsdpSearchReply
 SSDP search reply. More...
 
struct  SsdpSearchExpArg
 SSDP search exp argument. More...
 
struct  ssdp_thread_data
 SSDP thread data. More...
 

Macros

#define RQST_TIMEOUT   20
 timeout
 
SSDP constants.
#define BUFSIZE   (size_t)2500
 constant
 
#define SSDP_IP   "239.255.255.250"
 constant
 
#define SSDP_IPV6_LINKLOCAL   "FF02::C"
 constant
 
#define SSDP_IPV6_SITELOCAL   "FF05::C"
 constant
 
#define SSDP_PORT   1900
 constant
 
#define NUM_TRY   3
 constant
 
#define THREAD_LIMIT   50
 constant
 
#define COMMAND_LEN   300
 constant
 
SSDP Error codes.
#define NO_ERROR_FOUND   0
 error code
 
#define E_REQUEST_INVALID   -3
 error code
 
#define E_RES_EXPIRED   -4
 error code
 
#define E_MEM_ALLOC   -5
 error code
 
#define E_HTTP_SYNTEX   -6
 error code
 
#define E_SOCKET   -7
 error code
 

Typedefs

typedef void(* SsdpFunPtr) (SsdpEvent *)
 Maybe a callback function?
 
typedef int(* ParserFun) (char *, SsdpEvent *)
 Maybe a callback function?
 

Enumerations

enum  SsdpSearchType {
  SSDP_SERROR = -1 , SSDP_ALL , SSDP_ROOTDEVICE , SSDP_DEVICEUDN ,
  SSDP_DEVICETYPE , SSDP_SERVICE
}
 Enumeration to define all different types of ssdp searches. More...
 

Functions

int unique_service_name (char *cmd, SsdpEvent *Evt)
 Fills the fields of the event structure like DeviceType, Device UDN and Service Type.
 
SsdpSearchType ssdp_request_type1 (char *cmd)
 This function figures out the type of the SSDP search in the request.
 
int ssdp_request_type (char *cmd, SsdpEvent *Evt)
 Starts filling the SSDP event structure based upon the request received.
 
int readFromSSDPSocket (SOCKET socket)
 This function reads the data from the ssdp socket.
 
int get_ssdp_sockets (MiniServerSockArray *out)
 Creates the IPv4 and IPv6 ssdp sockets required by the control point and device operation.
 

Variables

constexpr size_t ERROR_BUFFER_LEN {256}
 Size of the errorBuffer variable, passed to the strerror_r() function.
 
SOCKET gSsdpReqSocket4
 If control point API is compiled in, this is the global IPv4 socket for it.
 
SOCKET gSsdpReqSocket6
 If control point API is compiled in, this is the global IPv6 socket for it.
 

Detailed Description

Manage "Step 1: Discovery" of the UPnP+™ specification with SSDP.

Definition in file ssdp_common.hpp.


Class Documentation

◆ SsdpEvent

struct SsdpEvent

Structure to store the SSDP information.

Definition at line 100 of file ssdp_common.hpp.

Class Members
enum SsdpSearchType RequestType Part of SSDP Event.
int ErrCode Part of SSDP Event.
int MaxAge Part of SSDP Event.
int Mx Part of SSDP Event.
char UDN[LINE_SIZE] Part of SSDP Event.
char DeviceType[LINE_SIZE] Part of SSDP Event.
char ServiceType[LINE_SIZE] Part of SSDP Event.
char Location[LINE_SIZE] Part of SSDP Event.
char HostAddr[LINE_SIZE] Part of SSDP Event.
char Os[LINE_SIZE] Part of SSDP Event.
char Ext[LINE_SIZE] Part of SSDP Event.
char Date[LINE_SIZE] Part of SSDP Event.
struct sockaddr * DestAddr Part of SSDP Event.
void * Cookie Part of SSDP Event.

◆ ThreadData

struct ThreadData

thread data.

Definition at line 125 of file ssdp_common.hpp.

Class Members
int Mx part of thread data
void * Cookie part of thread data
char * Data part of thread data
struct sockaddr_storage DestAddr part of thread data

◆ SsdpSearchReply

struct SsdpSearchReply

SSDP search reply.

Definition at line 136 of file ssdp_common.hpp.

+ Collaboration diagram for SsdpSearchReply:
Class Members
int MaxAge part of search reply
UpnpDevice_Handle handle part of search reply
struct sockaddr_storage dest_addr part of search reply
SsdpEvent event part of search reply

◆ SsdpSearchExpArg

struct SsdpSearchExpArg

SSDP search exp argument.

Definition at line 147 of file ssdp_common.hpp.

Class Members
int handle handle
int timeoutEventId timeout event id

◆ ssdp_thread_data

struct ssdp_thread_data

SSDP thread data.

Definition at line 153 of file ssdp_common.hpp.

+ Collaboration diagram for ssdp_thread_data:
Class Members
http_parser_t parser parser
sockaddr_storage dest_addr destination socket address

Macro Definition Documentation

◆ BUFSIZE

#define BUFSIZE   (size_t)2500

constant

Definition at line 54 of file ssdp_common.hpp.

◆ SSDP_IP

#define SSDP_IP   "239.255.255.250"

constant

Definition at line 56 of file ssdp_common.hpp.

◆ SSDP_IPV6_LINKLOCAL

#define SSDP_IPV6_LINKLOCAL   "FF02::C"

constant

Definition at line 58 of file ssdp_common.hpp.

◆ SSDP_IPV6_SITELOCAL

#define SSDP_IPV6_SITELOCAL   "FF05::C"

constant

Definition at line 60 of file ssdp_common.hpp.

◆ SSDP_PORT

#define SSDP_PORT   1900

constant

Definition at line 62 of file ssdp_common.hpp.

◆ NUM_TRY

#define NUM_TRY   3

constant

Definition at line 64 of file ssdp_common.hpp.

◆ THREAD_LIMIT

#define THREAD_LIMIT   50

constant

Definition at line 66 of file ssdp_common.hpp.

◆ COMMAND_LEN

#define COMMAND_LEN   300

constant

Definition at line 68 of file ssdp_common.hpp.

◆ NO_ERROR_FOUND

#define NO_ERROR_FOUND   0

error code

Definition at line 73 of file ssdp_common.hpp.

◆ E_REQUEST_INVALID

#define E_REQUEST_INVALID   -3

error code

Definition at line 75 of file ssdp_common.hpp.

◆ E_RES_EXPIRED

#define E_RES_EXPIRED   -4

error code

Definition at line 77 of file ssdp_common.hpp.

◆ E_MEM_ALLOC

#define E_MEM_ALLOC   -5

error code

Definition at line 79 of file ssdp_common.hpp.

◆ E_HTTP_SYNTEX

#define E_HTTP_SYNTEX   -6

error code

Definition at line 81 of file ssdp_common.hpp.

◆ E_SOCKET

#define E_SOCKET   -7

error code

Definition at line 83 of file ssdp_common.hpp.

◆ RQST_TIMEOUT

#define RQST_TIMEOUT   20

timeout

Definition at line 87 of file ssdp_common.hpp.

Typedef Documentation

◆ SsdpFunPtr

typedef void(* SsdpFunPtr) (SsdpEvent *)

Maybe a callback function?

Definition at line 122 of file ssdp_common.hpp.

◆ ParserFun

typedef int(* ParserFun) (char *, SsdpEvent *)

Maybe a callback function?

Definition at line 170 of file ssdp_common.hpp.

Enumeration Type Documentation

◆ SsdpSearchType

Enumeration to define all different types of ssdp searches.

Enumerator
SSDP_SERROR 

Unknown search command.

SSDP_ALL 

Part of SType.

SSDP_ROOTDEVICE 

Part of SType.

SSDP_DEVICEUDN 

Part of SType.

SSDP_DEVICETYPE 

Part of SType.

SSDP_SERVICE 

Part of SType.

Definition at line 90 of file ssdp_common.hpp.

Variable Documentation

◆ ERROR_BUFFER_LEN

constexpr size_t ERROR_BUFFER_LEN {256}
inlineconstexpr

Size of the errorBuffer variable, passed to the strerror_r() function.

Definition at line 49 of file ssdp_common.hpp.

◆ gSsdpReqSocket4

SOCKET gSsdpReqSocket4
inline

If control point API is compiled in, this is the global IPv4 socket for it.

Definition at line 162 of file ssdp_common.hpp.

◆ gSsdpReqSocket6

SOCKET gSsdpReqSocket6
inline

If control point API is compiled in, this is the global IPv6 socket for it.

Definition at line 166 of file ssdp_common.hpp.