Monero
Loading...
Searching...
No Matches
Macros | Functions
minissdpc.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <strings.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <net/if.h>
#include "miniupnpc_socketdef.h"
#include "minissdpc.h"
#include "miniupnpc.h"
#include "receivedata.h"
#include "codelength.h"
Include dependency graph for minissdpc.c:

Macros

#define closesocket   close
 
#define HAS_IP_MREQN
 
#define READ_BYTE_BUFFER(c)
 
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define READ_COPY_BUFFER(dst, len)
 
#define READ_DISCARD_BUFFER(len)
 
#define SSDP_PORT   1900
 
#define XSTR(s)   STR(s)
 
#define STR(s)   #s
 
#define UPNP_MCAST_ADDR   "239.255.255.250"
 
#define UPNP_MCAST_LL_ADDR   "FF02::C" /* link-local */
 
#define UPNP_MCAST_SL_ADDR   "FF05::C" /* site-local */
 

Functions

struct UPNPDevgetDevicesFromMiniSSDPD (const char *devtype, const char *socketpath, int *error)
 
int connectToMiniSSDPD (const char *socketpath)
 
int disconnectFromMiniSSDPD (int s)
 
int requestDevicesFromMiniSSDPD (int s, const char *devtype)
 
struct UPNPDevreceiveDevicesFromMiniSSDPD (int s, int *error)
 
static void parseMSEARCHReply (const char *reply, int size, const char **location, int *locationsize, const char **st, int *stsize, const char **usn, int *usnsize)
 
static int upnp_gettimeofday (struct timeval *tv)
 
struct UPNPDevssdpDiscoverDevices (const char *const deviceTypes[], int delay, const char *multicastif, int localport, int ipv6, unsigned char ttl, int *error, int searchalltypes)
 

Macro Definition Documentation

◆ closesocket

#define closesocket   close

◆ HAS_IP_MREQN

#define HAS_IP_MREQN

◆ MIN

#define MIN ( a,
b )   (((a) < (b)) ? (a) : (b))

◆ READ_BYTE_BUFFER

#define READ_BYTE_BUFFER ( c)
Value:
if((int)bufferindex >= n) { \
n = read(s, buffer, sizeof(buffer)); \
if(n<=0) break; \
bufferindex = 0; \
} \
c = buffer[bufferindex++];
#define s(x, c)
Definition aesb.c:47
const T buffer
Definition byte_slice.cpp:83

◆ READ_COPY_BUFFER

#define READ_COPY_BUFFER ( dst,
len )
Value:
for(l = len, p = (unsigned char *)dst; l > 0; ) { \
unsigned int lcopy; \
if((int)bufferindex >= n) { \
n = read(s, buffer, sizeof(buffer)); \
if(n<=0) break; \
bufferindex = 0; \
} \
lcopy = MIN(l, (n - bufferindex)); \
memcpy(p, buffer + bufferindex, lcopy); \
l -= lcopy; \
p += lcopy; \
bufferindex += lcopy; \
}
void * memcpy(void *a, const void *b, size_t c)
Definition glibc_compat.cpp:16
#define MIN(a, b)
Definition minissdpc.c:134

◆ READ_DISCARD_BUFFER

#define READ_DISCARD_BUFFER ( len)
Value:
for(l = len; l > 0; ) { \
unsigned int lcopy; \
if(bufferindex >= n) { \
n = read(s, buffer, sizeof(buffer)); \
if(n<=0) break; \
bufferindex = 0; \
} \
lcopy = MIN(l, (n - bufferindex)); \
l -= lcopy; \
bufferindex += lcopy; \
}

◆ SSDP_PORT

#define SSDP_PORT   1900

◆ STR

#define STR ( s)    #s

◆ UPNP_MCAST_ADDR

#define UPNP_MCAST_ADDR   "239.255.255.250"

◆ UPNP_MCAST_LL_ADDR

#define UPNP_MCAST_LL_ADDR   "FF02::C" /* link-local */

◆ UPNP_MCAST_SL_ADDR

#define UPNP_MCAST_SL_ADDR   "FF05::C" /* site-local */

◆ XSTR

#define XSTR ( s)    STR(s)

Function Documentation

◆ connectToMiniSSDPD()

int connectToMiniSSDPD ( const char * socketpath)

◆ disconnectFromMiniSSDPD()

int disconnectFromMiniSSDPD ( int s)

◆ getDevicesFromMiniSSDPD()

struct UPNPDev * getDevicesFromMiniSSDPD ( const char * devtype,
const char * socketpath,
int * error )

◆ parseMSEARCHReply()

static void parseMSEARCHReply ( const char * reply,
int size,
const char ** location,
int * locationsize,
const char ** st,
int * stsize,
const char ** usn,
int * usnsize )
static

◆ receiveDevicesFromMiniSSDPD()

struct UPNPDev * receiveDevicesFromMiniSSDPD ( int s,
int * error )

◆ requestDevicesFromMiniSSDPD()

int requestDevicesFromMiniSSDPD ( int s,
const char * devtype )

◆ ssdpDiscoverDevices()

struct UPNPDev * ssdpDiscoverDevices ( const char *const deviceTypes[],
int delay,
const char * multicastif,
int localport,
int ipv6,
unsigned char ttl,
int * error,
int searchalltypes )

◆ upnp_gettimeofday()

static int upnp_gettimeofday ( struct timeval * tv)
static