/*! * \brief This function is a thread that handles SSDP requests. */ static void ssdp_event_handler_thread( /*! [] ssdp_thread_data structure. This structure contains SSDP * request message. */ void *the_data) { ssdp_thread_data *data = (ssdp_thread_data *) the_data; http_message_t *hmsg = &data->parser.msg; if (start_event_handler(the_data) != 0) return; /* send msg to device or ctrlpt */ if (hmsg->method == (http_method_t)HTTPMETHOD_NOTIFY || hmsg->request_method == (http_method_t)HTTPMETHOD_MSEARCH) { #ifdef INCLUDE_CLIENT_APIS ssdp_handle_ctrlpt_msg(hmsg, &data->dest_addr, FALSE, NULL); #endif /* INCLUDE_CLIENT_APIS */ } else { ssdp_handle_device_request(hmsg, &data->dest_addr); } /* free data */ free_ssdp_event_handler_data(data); }
/************************************************************************ * Function : process_reply * * Parameters: * IN char* request_buf: the response came from the device * IN int buf_len: The length of the response buffer * IN struct sockaddr_in* dest_addr: The address of the device * IN void *cookie : cookie passed by the control point application * at the time of sending search message * * Description: * This function processes reply recevied from a search * * Returns: void * ***************************************************************************/ static XINLINE void process_reply( IN char *request_buf, IN int buf_len, IN struct sockaddr_in *dest_addr, IN void *cookie ) { http_parser_t parser; parser_response_init( &parser, HTTPMETHOD_MSEARCH ); // parse if( parser_append( &parser, request_buf, buf_len ) != PARSE_SUCCESS ) { httpmsg_destroy( &parser.msg ); return; } // handle reply ssdp_handle_ctrlpt_msg( &parser.msg, dest_addr, FALSE, cookie ); // done httpmsg_destroy( &parser.msg ); }