#include <arpa/inet.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "common_definitions.h"
#include "configuration.h"
#include "log.h"
#include "net_utils.h"
#include "socket_helpers.h"
#include "ssdp_message.h"
#include "ssdp_cache.h"
#include "ssdp_cache_output_format.h"
Go to the source code of this file.
|
| static BOOL | create_plain_text_message (char *results, int buffer_size, ssdp_message_s *ssdp_message) |
| |
| static int | send_stuff (const char *url, const char *data, const struct sockaddr_storage *da, int port, int timeout, configuration_s *conf) |
| |
| static void | free_ssdp_cache (ssdp_cache_s **ssdp_cache_pointer) |
| |
| BOOL | add_ssdp_message_to_cache (ssdp_cache_s **ssdp_cache_pointer, ssdp_message_s **ssdp_message_pointer) |
| |
| BOOL | flush_ssdp_cache (configuration_s *conf, ssdp_cache_s **ssdp_cache_pointer, const char *url, struct sockaddr_storage *sockaddr_recipient, int port, int timeout) |
| |
Functions for managing the SSDP cachein the program/lib.
- Copyright
- 2017 Andreas Bank, andre.nosp@m.as.m.nosp@m.ikael.nosp@m..ban.nosp@m.k@gma.nosp@m.il.c.nosp@m.om
Definition in file ssdp_cache.c.
Adds a ssdp message to a ssdp messages list. If the list hasn't been initialized then it is initialized first.
- Parameters
-
| ssdp_cache_pointer | The address of a pointer to a ssdp cache list. |
| ssdp_message_pointer | The ssdp message to be appended to the cache list. |
- Returns
- TRUE on success, exits on failure.
Definition at line 290 of file ssdp_cache.c.
| static BOOL create_plain_text_message |
( |
char * |
results, |
|
|
int |
buffer_size, |
|
|
ssdp_message_s * |
ssdp_message |
|
) |
| |
|
static |
Create a plain-text message.
- Parameters
-
| results | The buffer to store the results in. |
| buffer_size | The size of the buffer 'results'. |
| message | The message to convert. |
Definition at line 30 of file ssdp_cache.c.
| BOOL flush_ssdp_cache |
( |
configuration_s * |
conf, |
|
|
ssdp_cache_s ** |
ssdp_cache_pointer, |
|
|
const char * |
url, |
|
|
struct sockaddr_storage * |
sockaddr_recipient, |
|
|
int |
port, |
|
|
int |
timeout |
|
) |
| |
Send and free the passed SSDP cache.
- Parameters
-
| conf | The configuration to use. |
| ssdp_cache_pointer | The SSDP cache to send and delete (flush). |
| url | The URL (without the protocol and IP) to send the data to. |
| sockaddr_recipient | The socket address to send to. |
| port | The port to send to. |
| timeout | The send-timeout to set. |
- Returns
- TRUE on success, FALSE otherwise.
Definition at line 392 of file ssdp_cache.c.
| static void free_ssdp_cache |
( |
ssdp_cache_s ** |
ssdp_cache_pointer | ) |
|
|
static |
Frees all the elements in the ssdp messages list.
- Parameters
-
| ssdp_cache_pointer | The ssdp cache list to be cleared. |
Definition at line 241 of file ssdp_cache.c.
| static int send_stuff |
( |
const char * |
url, |
|
|
const char * |
data, |
|
|
const struct sockaddr_storage * |
da, |
|
|
int |
port, |
|
|
int |
timeout, |
|
|
configuration_s * |
conf |
|
) |
| |
|
static |
Send the SSDP cache to the given address (aka. forwarder).
- Parameters
-
| url | The URL (without the protocol and IP) to send the data to. |
| data | The data to send. |
| da | The socket address to send to. |
| port | The port to send to. |
| timeout | The send-timeout to set. |
| conf | The configuration to use. |
- Returns
- 0 on success, errno otherwise.
Definition at line 98 of file ssdp_cache.c.