Smart Home firewall
Profile-based Smart Home firewall
ssdp.h
Go to the documentation of this file.
1 
10 #ifndef _PROTOCOL_PARSERS_SSDP_
11 #define _PROTOCOL_PARSERS_SSDP_
12 
13 #include <stdlib.h>
14 #include <stdio.h>
15 #include <stdint.h>
16 #include <stdbool.h>
17 #include <arpa/inet.h>
18 #include "packet_utils.h"
19 
20 #define SSDP_METHOD_MAX_LEN 8 // Maximum length of a SSDP method
21 #define SSDP_MULTICAST_ADDR "239.255.255.250" // SSDP multicast group address
22 
26 typedef enum {
27  SSDP_M_SEARCH,
28  SSDP_NOTIFY,
29  SSDP_UNKNOWN
31 
35 typedef struct ssdp_message {
36  bool is_request; // True if the message is a request, false if it is a response
37  ssdp_method_t method; // SSDP method (M-SEARCH or NOTIFY)
39 
40 
42 
44 
52 ssdp_message_t ssdp_parse_message(uint8_t *data, uint32_t dst_addr);
53 
54 
56 
63 char *ssdp_method_to_str(ssdp_method_t method);
64 
71 
72 
73 #endif /* _PROTOCOL_PARSERS_SSDP_ */
Utilitaries for payload manipulation and display.
ssdp_message_t ssdp_parse_message(uint8_t *data, uint32_t dst_addr)
Parse the method and URI of SSDP message.
Definition: ssdp.c:52
char * ssdp_method_to_str(ssdp_method_t method)
Converts a SSDP method from enum value to character string.
Definition: ssdp.c:69
void ssdp_print_message(ssdp_message_t message)
Print the method and URI of a SSDP message.
Definition: ssdp.c:87
struct ssdp_message ssdp_message_t
ssdp_method_t
Definition: ssdp.h:26
Definition: ssdp.h:35