libUPnP 22.2.2
ssdp_ctrlpt.c File Reference
#include "Callback.h"
#include "LinkedList.h"
#include "TimerThread.h"
#include "UpnpDiscovery.h"
#include "UpnpString.h"
#include "config.h"
#include "ithread.h"
#include "membuffer.h"
#include "upnp.h"
#include "upnpdebug.h"
#include "upnpdebug_internal.h"
#include "upnputil.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <poll.h>
#include "SSDPResultData.h"
#include "SSDPResultDataCallback.h"
#include "ThreadPool.h"
#include "UpnpInet.h"
#include "httpparser.h"
#include "ssdplib.h"
#include "statcodes.h"
#include "upnpapi.h"
#include <stdio.h>
#include "posix_overwrites.h"
Include dependency graph for ssdp_ctrlpt.c:

Data Structures

struct  SearchResultJob
struct  ctrlpt_cb

Macros

#define _poll(fds, nfds, timeout)

Typedefs

typedef struct ctrlpt_cb CtrlptCallback

Functions

static void ctrlpt_callback_enter (CtrlptCallback *self, int handle, int searchId)
 Marks a discovery callback as running. Called with the handle lock held, so whoever ends the search or unregisters the client afterwards waits for the callback.
static void ctrlpt_callback_leave (CtrlptCallback *self)
 Marks a discovery callback as finished.
static void free_search_result (void *arg)
static void send_search_result (void *arg)
 Sends a callback to the control point application with a SEARCH result, unless the search ended or the client unregistered after the result was queued.
static int CreateClientRequestPacket (char *RqstBuf, size_t RqstBufSize, int Mx, char *SearchTarget, int AddressFamily)
 Creates a HTTP search request packet depending on the input parameter.
static void searchExpired (void *arg)
SSDP Control Point Functions
void ssdp_wait_ctrlpt_callbacks (int handle, int searchId)
 Waits until no discovery callback of the given client is running: search results of the given search, or with searchId -1 every search result and advertisement. Returns at once when called from such a callback. The caller must not hold the handle lock.
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, advertisement of device coming alive and bye byes.
int SearchByTarget (int Hnd, int Mx, char *St, void *Cookie)
 Creates and send the search request for a specific URL.

Variables

static ithread_mutex_t gCtrlptCbMutex = PTHREAD_MUTEX_INITIALIZER
static ithread_cond_t gCtrlptCbCond = PTHREAD_COND_INITIALIZER
static CtrlptCallback * gCtrlptCbs = NULL