#include <errno.h>#include <stdlib.h>#include <string.h>#include <sys/socket.h>#include <unistd.h>#include "common_definitions.h"#include "configuration.h"#include "log.h"#include "net_definitions.h"#include "net_utils.h"#include "socket_helpers.h"#include "ssdp_filter.h"#include "ssdp_cache.h"#include "ssdp_cache_display.h"#include "ssdp_cache_output_format.h"#include "ssdp_common.h"#include "ssdp_listener.h"#include "ssdp_message.h"#include "ssdp_static_defs.h"
Go to the source code of this file.
Macros | |
| #define | LISTEN_QUEUE_LENGTH 5 |
| #define | SSDP_PASSIVE_LISTENER_TIMEOUT 10 |
| #define | SSDP_ACTIVE_LISTENER_TIMEOUT 2 |
Functions | |
| static int | ssdp_listener_init (ssdp_listener_s *listener, configuration_s *conf, BOOL is_active, int port, int recv_timeout) |
| int | ssdp_passive_listener_init (ssdp_listener_s *listener, configuration_s *conf) |
| int | ssdp_active_listener_init (ssdp_listener_s *listener, configuration_s *conf, int port) |
| void | ssdp_listener_close (ssdp_listener_s *listener) |
| void | ssdp_listener_read (ssdp_listener_s *listener, ssdp_recv_node_s *recv_node) |
| int | ssdp_listener_start (ssdp_listener_s *listener, configuration_s *conf) |
| void | ssdp_listener_stop (ssdp_listener_s *listener) |
Create, manage and delete a SSDP listener.
Definition in file ssdp_listener.c.
| #define LISTEN_QUEUE_LENGTH 5 |
The queue length for the listener (how many queued connections)
Definition at line 29 of file ssdp_listener.c.
| #define SSDP_ACTIVE_LISTENER_TIMEOUT 2 |
The timeout after which the active SSDP listener will stop waiting for nodes to answer a SEARCH probe/message.
Definition at line 39 of file ssdp_listener.c.
| #define SSDP_PASSIVE_LISTENER_TIMEOUT 10 |
The timeout after which the passive SSDP listener will stop a connection to a discovered node when fetching ewxtra information.
Definition at line 34 of file ssdp_listener.c.
| int ssdp_active_listener_init | ( | ssdp_listener_s * | listener, |
| configuration_s * | conf, | ||
| int | port | ||
| ) |
Create an active (unicast) SSDP listener. This type of listener is used to listen to SSDP query responses. Sets errno to the error number on failure.
| listener | The listener to init. |
| conf | The global configuration. |
| port | The port to listen at. |
Definition at line 111 of file ssdp_listener.c.
| void ssdp_listener_close | ( | ssdp_listener_s * | listener | ) |
Destroy the passed SSDP listener.
| listener | The SSDP listener to destroy. |
Definition at line 118 of file ssdp_listener.c.
|
static |
Initialize a SSDP listener. This parses and sets the forwarder address, creates a socket and sets all applicable configuration values to it.
| listener | The listener to initialize. |
| conf | The configuration to use. |
| active | TRUE if an active SSDP listener is to be initialized. |
| port | The port to listen on. 0 will set the port to the SSDP port. |
| recv_timeout | The timeout to set for receiveing/waiting for SSDP nodes to respond to a SEARCH query. |
Definition at line 54 of file ssdp_listener.c.
| void ssdp_listener_read | ( | ssdp_listener_s * | listener, |
| ssdp_recv_node_s * | recv_node | ||
| ) |
Read from the listener. Blocks untill timeout if no data to read.
| listener | The listener to read from. |
| recv_node | Information about the node (client) that sent data. |
Definition at line 127 of file ssdp_listener.c.
| int ssdp_listener_start | ( | ssdp_listener_s * | listener, |
| configuration_s * | conf | ||
| ) |
Tells the SSDP listener to start listening to SSDP messages. This function should not be called on an active SSDP listener (call ssdp_listener_read() after ssdp_active_listener_init() instead).
| listener | The SSDP listener to start. |
| conf | The global configuration to use. |
Non-0 value on error. This function does not return if no error ocurrs.
Definition at line 144 of file ssdp_listener.c.
| void ssdp_listener_stop | ( | ssdp_listener_s * | listener | ) |
Tells the SSDP listener to stop listening.
| The | listener to stop. |
Definition at line 287 of file ssdp_listener.c.
| int ssdp_passive_listener_init | ( | ssdp_listener_s * | listener, |
| configuration_s * | conf | ||
| ) |
Create a passive (multicast) SSDP listener. This type of listener is used to passively listen to SSDP messages sent over a network. Sets errno to the error number on failure.
| listener | The listener to init. |
| conf | the global configuration. |
Definition at line 104 of file ssdp_listener.c.
1.8.8