* More MSVC fixes, using XINLINE instead of inline, MSVC has troubles
with inline. Thanks to David Maass for reporting. * Changed XINLINE to UPNP_INLINE. * Lots of white space changes. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@192 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
d8ba182d85
commit
81635d74c1
@ -2,6 +2,11 @@
|
|||||||
Version 1.4.7
|
Version 1.4.7
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2007-05-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* More MSVC fixes, using XINLINE instead of inline, MSVC has troubles
|
||||||
|
with inline. Thanks to David Maass for reporting.
|
||||||
|
* Changed XINLINE to UPNP_INLINE.
|
||||||
|
|
||||||
2007-05-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-05-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Added the file build/inc/msvc/inttypes.h. This file is for use with
|
* Added the file build/inc/msvc/inttypes.h. This file is for use with
|
||||||
MSVC only, because it does not provide C99 compatibility.
|
MSVC only, because it does not provide C99 compatibility.
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
#define MAXVAL( a, b ) ( (a) > (b) ? (a) : (b) )
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define XINLINE inline
|
#define UPNP_INLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MEMBUF_DEF_SIZE_INC 20
|
#define MEMBUF_DEF_SIZE_INC 20
|
||||||
|
@ -65,20 +65,35 @@
|
|||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
#ifdef UPNP_USE_MSVCPP // define some things the M$ VC++ doesn't know
|
#ifdef UPNP_USE_MSVCPP
|
||||||
|
// define some things the M$ VC++ doesn't know
|
||||||
|
#define UPNP_INLINE
|
||||||
typedef __int64 int64_t;
|
typedef __int64 int64_t;
|
||||||
#define PRId64 "I64d"
|
#define PRId64 "I64d"
|
||||||
#define PRIzu "lu"
|
#define PRIzu "lu"
|
||||||
#endif
|
#endif
|
||||||
#ifdef UPNP_USE_BCBPP // define some things Borland Builder doesn't know
|
#ifdef UPNP_USE_BCBPP
|
||||||
|
// define some things Borland Builder doesn't know
|
||||||
|
#define UPNP_INLINE inline
|
||||||
typedef __int64 int64_t;
|
typedef __int64 int64_t;
|
||||||
|
#warning The Borland C compiler is probably broken on PRId64, please someone provide a proper fix here
|
||||||
|
#define PRId64 "I64d"
|
||||||
#define PRIzu "zu"
|
#define PRIzu "zu"
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
|
#define UPNP_INLINE inline
|
||||||
|
// Invented this macro so that we can live a little longer with MSVC lack of C99.
|
||||||
#define PRIzu "zu"
|
#define PRIzu "zu"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Defining this macro here gives some interesting information about unused
|
||||||
|
// functions in the code. Of course, this should never go uncommented on a
|
||||||
|
// release.
|
||||||
|
//
|
||||||
|
//#define inline
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define UpnpCloseSocket close
|
#define UpnpCloseSocket close
|
||||||
|
@ -100,12 +100,13 @@ typedef enum Upnp_LogLevel_e {
|
|||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpInitLog
|
* Function : UpnpInitLog
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* Parameters: void
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This functions initializes the log files
|
* This functions initializes the log files
|
||||||
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* -1 : If fails
|
* -1 : If fails
|
||||||
* UPNP_E_SUCCESS : if success
|
* UPNP_E_SUCCESS : if success
|
||||||
@ -113,7 +114,7 @@ typedef enum Upnp_LogLevel_e {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int UpnpInitLog();
|
int UpnpInitLog();
|
||||||
#else
|
#else
|
||||||
static inline int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
static UPNP_INLINE int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for backward compatibility
|
// for backward compatibility
|
||||||
@ -132,7 +133,7 @@ static inline int UpnpInitLog() { return UPNP_E_SUCCESS; }
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
void UpnpSetLogLevel(Upnp_LogLevel log_level);
|
||||||
#else
|
#else
|
||||||
static inline void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
static UPNP_INLINE void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ static inline void UpnpSetLogLevel(Upnp_LogLevel log_level) {}
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void UpnpCloseLog();
|
void UpnpCloseLog();
|
||||||
#else
|
#else
|
||||||
static inline void UpnpCloseLog() {}
|
static UPNP_INLINE void UpnpCloseLog() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// for backward compatibility
|
// for backward compatibility
|
||||||
@ -174,7 +175,7 @@ void UpnpSetLogFileNames(
|
|||||||
const char *ErrFileName,
|
const char *ErrFileName,
|
||||||
const char *InfoFileName);
|
const char *InfoFileName);
|
||||||
#else
|
#else
|
||||||
static inline void UpnpSetLogFileNames(
|
static UPNP_INLINE void UpnpSetLogFileNames(
|
||||||
const char *ErrFileName,
|
const char *ErrFileName,
|
||||||
const char *InfoFileName) {}
|
const char *InfoFileName) {}
|
||||||
#endif
|
#endif
|
||||||
@ -202,7 +203,7 @@ static inline void UpnpSetLogFileNames(
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module);
|
FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static inline FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
static UPNP_INLINE FILE *UpnpGetDebugFile(Upnp_LogLevel level, Dbg_Module module)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -232,7 +233,7 @@ int DebugAtThisLevel(
|
|||||||
IN Upnp_LogLevel DLevel,
|
IN Upnp_LogLevel DLevel,
|
||||||
IN Dbg_Module Module);
|
IN Dbg_Module Module);
|
||||||
#else
|
#else
|
||||||
static inline int DebugAtThisLevel(
|
static UPNP_INLINE int DebugAtThisLevel(
|
||||||
IN Upnp_LogLevel DLevel,
|
IN Upnp_LogLevel DLevel,
|
||||||
IN Dbg_Module Module) { return 0; }
|
IN Dbg_Module Module) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
@ -269,7 +270,7 @@ void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module,
|
|||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
#else
|
#else
|
||||||
static inline void UpnpPrintf(
|
static UPNP_INLINE void UpnpPrintf(
|
||||||
Upnp_LogLevel DLevel,
|
Upnp_LogLevel DLevel,
|
||||||
Dbg_Module Module,
|
Dbg_Module Module,
|
||||||
const char* DbgFileName,
|
const char* DbgFileName,
|
||||||
@ -300,7 +301,7 @@ void UpnpDisplayBanner(
|
|||||||
size_t size,
|
size_t size,
|
||||||
int starlength);
|
int starlength);
|
||||||
#else
|
#else
|
||||||
static inline void UpnpDisplayBanner(
|
static UPNP_INLINE void UpnpDisplayBanner(
|
||||||
FILE *fd,
|
FILE *fd,
|
||||||
const char **lines,
|
const char **lines,
|
||||||
size_t size,
|
size_t size,
|
||||||
@ -328,7 +329,7 @@ void UpnpDisplayFileAndLine(
|
|||||||
const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
int DbgLineNo);
|
int DbgLineNo);
|
||||||
#else
|
#else
|
||||||
static inline void UpnpDisplayFileAndLine(
|
static UPNP_INLINE void UpnpDisplayFileAndLine(
|
||||||
FILE *fd,
|
FILE *fd,
|
||||||
const char *DbgFileName,
|
const char *DbgFileName,
|
||||||
int DbgLineNo) {}
|
int DbgLineNo) {}
|
||||||
|
@ -88,18 +88,19 @@ UpnpSetLogFileNames ( IN const char *ErrFileName,
|
|||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Function : UpnpInitLog
|
* Function : UpnpInitLog
|
||||||
*
|
*
|
||||||
* Parameters: void
|
* Parameters: void
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This functions initializes the log files
|
* This functions initializes the log files
|
||||||
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* -1 : If fails
|
* -1 : If fails
|
||||||
* UPNP_E_SUCCESS : if success
|
* UPNP_E_SUCCESS : if success
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int
|
int
|
||||||
UpnpInitLog( )
|
UpnpInitLog()
|
||||||
{
|
{
|
||||||
ithread_mutex_init( &GlobalDebugMutex, NULL );
|
ithread_mutex_init( &GlobalDebugMutex, NULL );
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ UpnpSetLogLevel (Upnp_LogLevel log_level)
|
|||||||
* Returns: void
|
* Returns: void
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void
|
void
|
||||||
UpnpCloseLog( )
|
UpnpCloseLog()
|
||||||
{
|
{
|
||||||
if( DEBUG_TARGET == 1 ) {
|
if( DEBUG_TARGET == 1 ) {
|
||||||
fflush( ErrFileHnd );
|
fflush( ErrFileHnd );
|
||||||
|
@ -188,7 +188,7 @@ free_notify_struct( IN notify_thread_struct * input )
|
|||||||
*
|
*
|
||||||
* Note : called by genaNotify
|
* Note : called by genaNotify
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
notify_send_and_recv( IN uri_type * destination_url,
|
notify_send_and_recv( IN uri_type * destination_url,
|
||||||
IN membuffer * mid_msg,
|
IN membuffer * mid_msg,
|
||||||
IN char *propertySet,
|
IN char *propertySet,
|
||||||
|
@ -215,7 +215,7 @@ dispatch_request( IN SOCKINFO * info,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
handle_error( IN SOCKINFO * info,
|
handle_error( IN SOCKINFO * info,
|
||||||
int http_error_code,
|
int http_error_code,
|
||||||
int major,
|
int major,
|
||||||
@ -333,7 +333,7 @@ handle_request( void *args )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
schedule_request_job( IN int connfd,
|
schedule_request_job( IN int connfd,
|
||||||
IN struct sockaddr_in *clientAddr )
|
IN struct sockaddr_in *clientAddr )
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES] = {
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
scanner_init( OUT scanner_t * scanner,
|
scanner_init( OUT scanner_t * scanner,
|
||||||
IN membuffer * bufptr )
|
IN membuffer * bufptr )
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ scanner_init( OUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
is_separator_char( IN char c )
|
is_separator_char( IN char c )
|
||||||
{
|
{
|
||||||
return strchr( " \t()<>@,;:\\\"/[]?={}", c ) != NULL;
|
return strchr( " \t()<>@,;:\\\"/[]?={}", c ) != NULL;
|
||||||
@ -160,7 +160,7 @@ is_separator_char( IN char c )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
is_identifier_char( IN char c )
|
is_identifier_char( IN char c )
|
||||||
{
|
{
|
||||||
return ( c >= 32 && c <= 126 ) && !is_separator_char( c );
|
return ( c >= 32 && c <= 126 ) && !is_separator_char( c );
|
||||||
@ -178,7 +178,7 @@ is_identifier_char( IN char c )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
is_control_char( IN char c )
|
is_control_char( IN char c )
|
||||||
{
|
{
|
||||||
return ( ( c >= 0 && c <= 31 ) || ( c == 127 ) );
|
return ( ( c >= 0 && c <= 31 ) || ( c == 127 ) );
|
||||||
@ -196,7 +196,7 @@ is_control_char( IN char c )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
is_qdtext_char( IN char cc )
|
is_qdtext_char( IN char cc )
|
||||||
{
|
{
|
||||||
unsigned char c = ( unsigned char )cc;
|
unsigned char c = ( unsigned char )cc;
|
||||||
@ -375,7 +375,7 @@ scanner_get_token( INOUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE char *
|
static UPNP_INLINE char *
|
||||||
scanner_get_str( IN scanner_t * scanner )
|
scanner_get_str( IN scanner_t * scanner )
|
||||||
{
|
{
|
||||||
return scanner->msg->buf + scanner->cursor;
|
return scanner->msg->buf + scanner->cursor;
|
||||||
@ -395,7 +395,9 @@ scanner_get_str( IN scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
#warning The only use of the function 'scanner_pushback()' in the code is commented out.
|
||||||
|
#warning 'scanner_pushback()' is a good candidate for removal.
|
||||||
|
static UPNP_INLINE void
|
||||||
scanner_pushback( INOUT scanner_t * scanner,
|
scanner_pushback( INOUT scanner_t * scanner,
|
||||||
IN size_t pushback_bytes )
|
IN size_t pushback_bytes )
|
||||||
{
|
{
|
||||||
@ -614,7 +616,7 @@ httpmsg_find_hdr( IN http_message_t * msg,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
skip_blank_lines( INOUT scanner_t * scanner )
|
skip_blank_lines( INOUT scanner_t * scanner )
|
||||||
{
|
{
|
||||||
memptr token;
|
memptr token;
|
||||||
@ -651,7 +653,7 @@ skip_blank_lines( INOUT scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
skip_lws( INOUT scanner_t * scanner )
|
skip_lws( INOUT scanner_t * scanner )
|
||||||
{
|
{
|
||||||
memptr token;
|
memptr token;
|
||||||
@ -698,7 +700,7 @@ skip_lws( INOUT scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Description : Match a string without whitespace or CRLF (%S)
|
* Description : Match a string without whitespace or CRLF (%S)
|
||||||
*
|
*
|
||||||
* Return : XINLINE parse_status_t ;
|
* Return : UPNP_INLINE parse_status_t ;
|
||||||
* PARSE_OK
|
* PARSE_OK
|
||||||
* PARSE_NO_MATCH
|
* PARSE_NO_MATCH
|
||||||
* PARSE_FAILURE
|
* PARSE_FAILURE
|
||||||
@ -706,7 +708,7 @@ skip_lws( INOUT scanner_t * scanner )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
match_non_ws_string( INOUT scanner_t * scanner,
|
match_non_ws_string( INOUT scanner_t * scanner,
|
||||||
OUT memptr * str )
|
OUT memptr * str )
|
||||||
{
|
{
|
||||||
@ -772,7 +774,7 @@ match_non_ws_string( INOUT scanner_t * scanner,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
match_raw_value( INOUT scanner_t * scanner,
|
match_raw_value( INOUT scanner_t * scanner,
|
||||||
OUT memptr * raw_value )
|
OUT memptr * raw_value )
|
||||||
{
|
{
|
||||||
@ -863,7 +865,7 @@ match_raw_value( INOUT scanner_t * scanner,
|
|||||||
* PARSE_FAILURE -- bad input
|
* PARSE_FAILURE -- bad input
|
||||||
* PARSE_INCOMPLETE
|
* PARSE_INCOMPLETE
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
match_int( INOUT scanner_t * scanner,
|
match_int( INOUT scanner_t * scanner,
|
||||||
IN int base,
|
IN int base,
|
||||||
OUT int *value )
|
OUT int *value )
|
||||||
@ -922,7 +924,7 @@ match_int( INOUT scanner_t * scanner,
|
|||||||
* PARSE_FAILURE
|
* PARSE_FAILURE
|
||||||
* PARSE_INCOMPLETE
|
* PARSE_INCOMPLETE
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
read_until_crlf( INOUT scanner_t * scanner,
|
read_until_crlf( INOUT scanner_t * scanner,
|
||||||
OUT memptr * str )
|
OUT memptr * str )
|
||||||
{
|
{
|
||||||
@ -963,7 +965,9 @@ read_until_crlf( INOUT scanner_t * scanner,
|
|||||||
* PARSE_FAILURE
|
* PARSE_FAILURE
|
||||||
* PARSE_INCOMPLETE
|
* PARSE_INCOMPLETE
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
#warning There are currently no uses of the function 'skip_to_end_of_header()' in the code.
|
||||||
|
#warning 'skip_to_end_of_header()' is a good candidate for removal.
|
||||||
|
static UPNP_INLINE int
|
||||||
skip_to_end_of_header( INOUT scanner_t * scanner )
|
skip_to_end_of_header( INOUT scanner_t * scanner )
|
||||||
{
|
{
|
||||||
memptr dummy_raw_value;
|
memptr dummy_raw_value;
|
||||||
@ -990,7 +994,7 @@ skip_to_end_of_header( INOUT scanner_t * scanner )
|
|||||||
* PARSE_NO_MATCH
|
* PARSE_NO_MATCH
|
||||||
* PARSE_INCOMPLETE
|
* PARSE_INCOMPLETE
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
match_char( INOUT scanner_t * scanner,
|
match_char( INOUT scanner_t * scanner,
|
||||||
IN char c,
|
IN char c,
|
||||||
IN xboolean case_sensitive )
|
IN xboolean case_sensitive )
|
||||||
@ -1337,7 +1341,7 @@ matchstr( IN char *str,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
parser_init( OUT http_parser_t * parser )
|
parser_init( OUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
memset( parser, 0, sizeof( http_parser_t ) );
|
memset( parser, 0, sizeof( http_parser_t ) );
|
||||||
@ -1872,7 +1876,7 @@ parser_parse_headers_old( INOUT http_parser_t * parser )
|
|||||||
* PARSE_FAILURE -- entity length > content-length value
|
* PARSE_FAILURE -- entity length > content-length value
|
||||||
* PARSE_SUCCESS
|
* PARSE_SUCCESS
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
//int entity_length;
|
//int entity_length;
|
||||||
@ -1919,7 +1923,7 @@ parser_parse_entity_using_clen( INOUT http_parser_t * parser )
|
|||||||
* PARSE_FAILURE -- entity length > content-length value
|
* PARSE_FAILURE -- entity length > content-length value
|
||||||
* PARSE_SUCCESS
|
* PARSE_SUCCESS
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
parser_parse_chunky_body( INOUT http_parser_t * parser )
|
parser_parse_chunky_body( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
parse_status_t status;
|
parse_status_t status;
|
||||||
@ -1964,7 +1968,7 @@ parser_parse_chunky_body( INOUT http_parser_t * parser )
|
|||||||
* PARSE_FAILURE -- entity length > content-length value
|
* PARSE_FAILURE -- entity length > content-length value
|
||||||
* PARSE_SUCCESS
|
* PARSE_SUCCESS
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
parser_parse_chunky_headers( INOUT http_parser_t * parser )
|
parser_parse_chunky_headers( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
parse_status_t status;
|
parse_status_t status;
|
||||||
@ -2004,7 +2008,7 @@ parser_parse_chunky_headers( INOUT http_parser_t * parser )
|
|||||||
* PARSE_SUCCESS
|
* PARSE_SUCCESS
|
||||||
* PARSE_CONTINUE_1
|
* PARSE_CONTINUE_1
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
parser_parse_chunky_entity( INOUT http_parser_t * parser )
|
parser_parse_chunky_entity( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
scanner_t *scanner = &parser->scanner;
|
scanner_t *scanner = &parser->scanner;
|
||||||
@ -2055,7 +2059,7 @@ parser_parse_chunky_entity( INOUT http_parser_t * parser )
|
|||||||
* Returns:
|
* Returns:
|
||||||
* PARSE_INCOMPLETE_ENTITY
|
* PARSE_INCOMPLETE_ENTITY
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE parse_status_t
|
static UPNP_INLINE parse_status_t
|
||||||
parser_parse_entity_until_close( INOUT http_parser_t * parser )
|
parser_parse_entity_until_close( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
size_t cursor;
|
size_t cursor;
|
||||||
@ -2090,7 +2094,7 @@ parser_parse_entity_until_close( INOUT http_parser_t * parser )
|
|||||||
* PARSE_FAILURE
|
* PARSE_FAILURE
|
||||||
* PARSE_COMPLETE -- no more reading to do
|
* PARSE_COMPLETE -- no more reading to do
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
XINLINE parse_status_t
|
UPNP_INLINE parse_status_t
|
||||||
parser_get_entity_read_method( INOUT http_parser_t * parser )
|
parser_get_entity_read_method( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
http_message_t *hmsg = &parser->msg;
|
http_message_t *hmsg = &parser->msg;
|
||||||
@ -2195,7 +2199,7 @@ parser_get_entity_read_method( INOUT http_parser_t * parser )
|
|||||||
* PARSE_FAILURE
|
* PARSE_FAILURE
|
||||||
* PARSE_COMPLETE -- no more reading to do
|
* PARSE_COMPLETE -- no more reading to do
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
XINLINE parse_status_t
|
UPNP_INLINE parse_status_t
|
||||||
parser_parse_entity( INOUT http_parser_t * parser )
|
parser_parse_entity( INOUT http_parser_t * parser )
|
||||||
{
|
{
|
||||||
parse_status_t status = PARSE_OK;
|
parse_status_t status = PARSE_OK;
|
||||||
|
@ -2343,7 +2343,7 @@ http_OpenHttpGetEx( IN const char *url_str,
|
|||||||
* Description : Returns the server information for the operating
|
* Description : Returns the server information for the operating
|
||||||
* system
|
* system
|
||||||
*
|
*
|
||||||
* Return : XINLINE void
|
* Return : UPNP_INLINE void
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
@ -118,7 +118,7 @@ static xboolean gInitialized = FALSE;
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
init_table( IN const char *encoded_str,
|
init_table( IN const char *encoded_str,
|
||||||
OUT const char *table[],
|
OUT const char *table[],
|
||||||
IN int tbl_size )
|
IN int tbl_size )
|
||||||
@ -144,7 +144,7 @@ init_table( IN const char *encoded_str,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
init_tables( void )
|
init_tables( void )
|
||||||
{
|
{
|
||||||
init_table( Http1xxStr, Http1xxCodes, NUM_1XX_CODES );
|
init_table( Http1xxStr, Http1xxCodes, NUM_1XX_CODES );
|
||||||
|
@ -205,7 +205,7 @@ extern str_int_entry Http_Header_Names[NUM_HTTP_HEADER_NAMES];
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
media_list_init( void )
|
media_list_init( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -243,7 +243,7 @@ media_list_init( void )
|
|||||||
* 0 on success;
|
* 0 on success;
|
||||||
* -1 on error
|
* -1 on error
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
search_extension( IN const char *extension,
|
search_extension( IN const char *extension,
|
||||||
OUT const char **con_type,
|
OUT const char **con_type,
|
||||||
OUT const char **con_subtype )
|
OUT const char **con_subtype )
|
||||||
@ -290,7 +290,7 @@ search_extension( IN const char *extension,
|
|||||||
* 0 - On Sucess
|
* 0 - On Sucess
|
||||||
* UPNP_E_OUTOF_MEMORY - on memory allocation failures
|
* UPNP_E_OUTOF_MEMORY - on memory allocation failures
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
XINLINE int
|
UPNP_INLINE int
|
||||||
get_content_type( IN const char *filename,
|
get_content_type( IN const char *filename,
|
||||||
OUT DOMString * content_type )
|
OUT DOMString * content_type )
|
||||||
{
|
{
|
||||||
@ -348,7 +348,7 @@ get_content_type( IN const char *filename,
|
|||||||
* Returns:
|
* Returns:
|
||||||
* void
|
* void
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
glob_alias_init( void )
|
glob_alias_init( void )
|
||||||
{
|
{
|
||||||
struct xml_alias_t *alias = &gAliasDoc;
|
struct xml_alias_t *alias = &gAliasDoc;
|
||||||
@ -370,7 +370,7 @@ glob_alias_init( void )
|
|||||||
* Returns:
|
* Returns:
|
||||||
* BOOLEAN
|
* BOOLEAN
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
is_valid_alias( IN const struct xml_alias_t *alias )
|
is_valid_alias( IN const struct xml_alias_t *alias )
|
||||||
{
|
{
|
||||||
return alias->doc.buf != NULL;
|
return alias->doc.buf != NULL;
|
||||||
@ -700,7 +700,7 @@ web_server_set_root_dir( IN const char *root_dir )
|
|||||||
* TRUE - On Success
|
* TRUE - On Success
|
||||||
* FALSE if request is not an alias
|
* FALSE if request is not an alias
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
get_alias( IN const char *request_file,
|
get_alias( IN const char *request_file,
|
||||||
OUT struct xml_alias_t *alias,
|
OUT struct xml_alias_t *alias,
|
||||||
OUT struct File_Info *info )
|
OUT struct File_Info *info )
|
||||||
|
@ -171,7 +171,7 @@ memptr_cmp_nocase( IN memptr * m,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
membuffer_initialize( INOUT membuffer * m )
|
membuffer_initialize( INOUT membuffer * m )
|
||||||
{
|
{
|
||||||
m->buf = NULL;
|
m->buf = NULL;
|
||||||
|
@ -491,7 +491,7 @@ const char* method_to_str( IN http_method_t method );
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_http_headers( IN http_message_t *hmsg );
|
void print_http_headers( IN http_message_t *hmsg );
|
||||||
#else
|
#else
|
||||||
static inline void print_http_headers( IN http_message_t *hmsg ) {}
|
static UPNP_INLINE void print_http_headers( IN http_message_t *hmsg ) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -269,7 +269,7 @@ void printService(
|
|||||||
Dbg_Level level,
|
Dbg_Level level,
|
||||||
Dbg_Module module);
|
Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static inline void printService(
|
static UPNP_INLINE void printService(
|
||||||
service_info *service,
|
service_info *service,
|
||||||
Dbg_Level level,
|
Dbg_Level level,
|
||||||
Dbg_Module module) {}
|
Dbg_Module module) {}
|
||||||
@ -296,7 +296,7 @@ void printServiceList(
|
|||||||
Dbg_Level level,
|
Dbg_Level level,
|
||||||
Dbg_Module module);
|
Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static inline void printServiceList(
|
static UPNP_INLINE void printServiceList(
|
||||||
service_info *service,
|
service_info *service,
|
||||||
Dbg_Level level,
|
Dbg_Level level,
|
||||||
Dbg_Module module) {}
|
Dbg_Module module) {}
|
||||||
@ -324,7 +324,7 @@ void printServiceTable(
|
|||||||
Dbg_Level level,
|
Dbg_Level level,
|
||||||
Dbg_Module module);
|
Dbg_Module module);
|
||||||
#else
|
#else
|
||||||
static inline void printServiceTable(
|
static UPNP_INLINE void printServiceTable(
|
||||||
service_table *table,
|
service_table *table,
|
||||||
Dbg_Level level,
|
Dbg_Level level,
|
||||||
Dbg_Module module) {}
|
Dbg_Module module) {}
|
||||||
|
@ -184,12 +184,12 @@ typedef int (*ParserFun)(char *, Event *);
|
|||||||
//int AnalyzeCommand(char * szCommand, Event * Evt);
|
//int AnalyzeCommand(char * szCommand, Event * Evt);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : Make_Socket_NoBlocking
|
* Function : Make_Socket_NoBlocking
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN int sock: socket
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Parameters:
|
||||||
|
* IN int sock: socket
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
* This function to make ssdp socket non-blocking.
|
* This function to make ssdp socket non-blocking.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
@ -198,12 +198,12 @@ typedef int (*ParserFun)(char *, Event *);
|
|||||||
int Make_Socket_NoBlocking (int sock);
|
int Make_Socket_NoBlocking (int sock);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_handle_device_request
|
* Function : ssdp_handle_device_request
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN void *data:
|
* IN void *data:
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function handles the search request. It do the sanity checks of
|
* This function handles the search request. It do the sanity checks of
|
||||||
* the request and then schedules a thread to send a random time reply (
|
* the request and then schedules a thread to send a random time reply (
|
||||||
* random within maximum time given by the control point to reply).
|
* random within maximum time given by the control point to reply).
|
||||||
@ -222,18 +222,18 @@ static inline void ssdp_handle_device_request(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_handle_ctrlpt_msg
|
* Function : ssdp_handle_ctrlpt_msg
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN http_message_t* hmsg: SSDP message from the device
|
* IN http_message_t* hmsg: SSDP message from the device
|
||||||
* IN struct sockaddr_in* dest_addr: Address of the device
|
* IN struct sockaddr_in* dest_addr: Address of the device
|
||||||
* IN xboolean timeout: timeout kept by the control point while sending
|
* IN xboolean timeout: timeout kept by the control point while sending
|
||||||
* search message
|
* search message
|
||||||
* IN void* cookie: Cookie stored by the control point application.
|
* IN void* cookie: Cookie stored by the control point application.
|
||||||
* This cookie will be returned to the control point
|
* This cookie will be returned to the control point
|
||||||
* in the callback
|
* in the callback
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function handles the ssdp messages from the devices. These
|
* This function handles the ssdp messages from the devices. These
|
||||||
* messages includes the search replies, advertisement of device coming
|
* messages includes the search replies, advertisement of device coming
|
||||||
* alive and bye byes.
|
* alive and bye byes.
|
||||||
@ -241,20 +241,21 @@ static inline void ssdp_handle_device_request(
|
|||||||
* Returns: void
|
* Returns: void
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void ssdp_handle_ctrlpt_msg( IN http_message_t* hmsg,
|
void ssdp_handle_ctrlpt_msg(
|
||||||
IN struct sockaddr_in* dest_addr,
|
IN http_message_t* hmsg,
|
||||||
IN xboolean timeout,
|
IN struct sockaddr_in* dest_addr,
|
||||||
IN void* cookie );
|
IN xboolean timeout,
|
||||||
|
IN void* cookie );
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : unique_service_name
|
* Function : unique_service_name
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN char *cmd: Service Name string
|
|
||||||
* OUT SsdpEvent *Evt: The SSDP event structure partially filled
|
|
||||||
* by all the function.
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Parameters:
|
||||||
|
* IN char *cmd: Service Name string
|
||||||
|
* OUT SsdpEvent *Evt: The SSDP event structure partially filled
|
||||||
|
* by all the function.
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
* This function fills the fields of the event structure like DeviceType,
|
* This function fills the fields of the event structure like DeviceType,
|
||||||
* Device UDN and Service Type
|
* Device UDN and Service Type
|
||||||
*
|
*
|
||||||
@ -265,12 +266,12 @@ int unique_service_name(char * cmd, SsdpEvent * Evt);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : get_ssdp_sockets
|
* Function : get_ssdp_sockets
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* OUT MiniServerSockArray *out: Arrays of SSDP sockets
|
* OUT MiniServerSockArray *out: Arrays of SSDP sockets
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the ssdp sockets. It set their option to listen
|
* This function creates the ssdp sockets. It set their option to listen
|
||||||
* for multicast traffic.
|
* for multicast traffic.
|
||||||
*
|
*
|
||||||
@ -281,12 +282,12 @@ int get_ssdp_sockets(MiniServerSockArray *out);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : readFromSSDPSocket
|
* Function : readFromSSDPSocket
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN SOCKET socket: SSDP socket
|
* IN SOCKET socket: SSDP socket
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function reads the data from the ssdp socket.
|
* This function reads the data from the ssdp socket.
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
@ -296,13 +297,13 @@ void readFromSSDPSocket(SOCKET socket);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_request_type1
|
* Function : ssdp_request_type1
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *cmd: command came in the ssdp request
|
* IN char *cmd: command came in the ssdp request
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function figures out the type of the SSDP search in the
|
* This function figures out the type of the SSDP search in the
|
||||||
* in the request.
|
* in the request.
|
||||||
*
|
*
|
||||||
* Returns: enum SsdpSearchType
|
* Returns: enum SsdpSearchType
|
||||||
@ -312,14 +313,14 @@ enum SsdpSearchType ssdp_request_type1(IN char *cmd);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ssdp_request_type
|
* Function : ssdp_request_type
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *cmd: command came in the ssdp request
|
* IN char *cmd: command came in the ssdp request
|
||||||
* OUT SsdpEvent *Evt: The event structure partially filled by
|
* OUT SsdpEvent *Evt: The event structure partially filled by
|
||||||
* this function.
|
* this function.
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function starts filling the SSDP event structure based upon the
|
* This function starts filling the SSDP event structure based upon the
|
||||||
* request received.
|
* request received.
|
||||||
*
|
*
|
||||||
@ -330,17 +331,15 @@ int ssdp_request_type(IN char * cmd, OUT SsdpEvent * Evt);
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SearchByTarget
|
* Function : SearchByTarget
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN int Mx:Number of seconds to wait, to collect all the
|
|
||||||
* responses.
|
|
||||||
* char *St: Search target.
|
|
||||||
* void *Cookie: cookie provided by control point application. This
|
|
||||||
* cokie will be returned to application in the
|
|
||||||
* callback.
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Parameters:
|
||||||
|
* IN int Mx:Number of seconds to wait, to collect all the responses.
|
||||||
|
* char *St: Search target.
|
||||||
|
* void *Cookie: cookie provided by control point application. This
|
||||||
|
* cokie will be returned to application in the callback.
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
* This function creates and send the search request for a specific URL.
|
* This function creates and send the search request for a specific URL.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
@ -349,214 +348,224 @@ int ssdp_request_type(IN char * cmd, OUT SsdpEvent * Evt);
|
|||||||
int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
int SearchByTarget(IN int Mx, IN char *St, IN void *Cookie);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceAdvertisement
|
* Function : DeviceAdvertisement
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN char * DevType : type of the device
|
|
||||||
* IN int RootDev: flag to indicate if the device is root device
|
|
||||||
* IN char * nt : value of NT
|
|
||||||
* IN char * usn :
|
|
||||||
* IN char * location :Location URL.
|
|
||||||
* IN int duration :Service duration in sec.
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Parameters:
|
||||||
* This function creates the device advertisement request based on
|
* IN char *DevType : type of the device
|
||||||
|
* IN int RootDev : flag to indicate if the device is root device
|
||||||
|
* IN char *Udn :
|
||||||
|
* IN char *Location: Location URL.
|
||||||
|
* IN int Duration : Service duration in sec.
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* This function creates the device advertisement request based on
|
||||||
* the input parameter, and send it to the multicast channel.
|
* the input parameter, and send it to the multicast channel.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceAdvertisement(IN char * DevType, int RootDev,char * Udn,
|
int DeviceAdvertisement(
|
||||||
IN char * Location, IN int Duration);
|
IN char *DevType,
|
||||||
|
IN int RootDev,
|
||||||
|
IN char *Udn,
|
||||||
|
IN char *Location,
|
||||||
|
IN int Duration);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceShutdown
|
* Function : DeviceShutdown
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char *DevType: Device Type.
|
* IN char *DevType: Device Type.
|
||||||
* IN int RootDev:1 means root device.
|
* IN int RootDev:1 means root device.
|
||||||
* IN char * Udn: Device UDN
|
* IN char *Udn: Device UDN
|
||||||
* IN char *_Server:
|
* IN char *_Server:
|
||||||
* IN char * Location: Location URL
|
* IN char *Location: Location URL
|
||||||
* IN int Duration :Device duration in sec.
|
* IN int Duration :Device duration in sec.
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates a HTTP device shutdown request packet
|
* This function creates a HTTP device shutdown request packet
|
||||||
* and sent it to the multicast channel through RequestHandler.
|
* and sent it to the multicast channel through RequestHandler.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceShutdown( IN char * DevType,
|
int DeviceShutdown(
|
||||||
IN int RootDev,
|
IN char *DevType,
|
||||||
IN char * Udn,
|
IN int RootDev,
|
||||||
IN char * _Server,
|
IN char *Udn,
|
||||||
IN char * Location,
|
IN char *_Server,
|
||||||
IN int Duration );
|
IN char *Location,
|
||||||
|
IN int Duration);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : DeviceReply
|
* Function : DeviceReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr_in * DestAddr:destination IP address.
|
* IN struct sockaddr_in * DestAddr:destination IP address.
|
||||||
* IN char *DevType: Device type
|
* IN char *DevType: Device type
|
||||||
* IN int RootDev: 1 means root device 0 means embedded device.
|
* IN int RootDev: 1 means root device 0 means embedded device.
|
||||||
* IN char * Udn: Device UDN
|
* IN char *Udn: Device UDN
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char *Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the reply packet based on the input parameter,
|
* This function creates the reply packet based on the input parameter,
|
||||||
* and send it to the client address given in its input parameter DestAddr.
|
* and send it to the client address given in its input parameter DestAddr.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int DeviceReply(IN struct sockaddr_in * DestAddr,
|
int DeviceReply(
|
||||||
IN char *DevType,
|
IN struct sockaddr_in * DestAddr,
|
||||||
IN int RootDev,
|
IN char *DevType,
|
||||||
IN char * Udn,
|
IN int RootDev,
|
||||||
IN char * Location, IN int Duration);
|
IN char *Udn,
|
||||||
|
IN char *Location, IN int Duration);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : SendReply
|
* Function : SendReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr_in * DestAddr:destination IP address.
|
* IN struct sockaddr_in * DestAddr:destination IP address.
|
||||||
* IN char *DevType: Device type
|
* IN char *DevType: Device type
|
||||||
* IN int RootDev: 1 means root device 0 means embedded device.
|
* IN int RootDev: 1 means root device 0 means embedded device.
|
||||||
* IN char * Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *_Server:
|
* IN char *_Server:
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char *Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
* IN int ByType:
|
* IN int ByType:
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the reply packet based on the input parameter,
|
* This function creates the reply packet based on the input parameter,
|
||||||
* and send it to the client addesss given in its input parameter DestAddr.
|
* and send it to the client addesss given in its input parameter DestAddr.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int SendReply(IN struct sockaddr_in * DestAddr,
|
int SendReply(
|
||||||
IN char *DevType,
|
IN struct sockaddr_in * DestAddr,
|
||||||
IN int RootDev,
|
IN char *DevType,
|
||||||
IN char * Udn,
|
IN int RootDev,
|
||||||
IN char * Location,
|
IN char *Udn,
|
||||||
IN int Duration,
|
IN char *Location,
|
||||||
IN int ByType );
|
IN int Duration,
|
||||||
|
IN int ByType );
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceAdvertisement
|
* Function : ServiceAdvertisement
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char * Udn: Device UDN
|
* IN char * Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char * Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the advertisement packet based
|
* This function creates the advertisement packet based
|
||||||
* on the input parameter, and send it to the multicast channel.
|
* on the input parameter, and send it to the multicast channel.
|
||||||
|
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceAdvertisement( IN char * Udn,
|
int ServiceAdvertisement(
|
||||||
IN char * ServType,
|
IN char *Udn,
|
||||||
IN char * Location,
|
IN char *ServType,
|
||||||
IN int Duration);
|
IN char *Location,
|
||||||
|
IN int Duration);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceReply
|
* Function : ServiceReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN struct sockaddr_in *DestAddr:
|
* IN struct sockaddr_in *DestAddr:
|
||||||
* IN char * Udn: Device UDN
|
* IN char *Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char *Server: Not used
|
* IN char *Server: Not used
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char *Location: Location of Device description document.
|
||||||
* IN int Duration :Life time of this device.
|
* IN int Duration :Life time of this device.
|
||||||
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates the advertisement packet based
|
* This function creates the advertisement packet based
|
||||||
* on the input parameter, and send it to the multicast channel.
|
* on the input parameter, and send it to the multicast channel.
|
||||||
|
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceReply(IN struct sockaddr_in *DestAddr,
|
int ServiceReply(
|
||||||
IN char * ServType,
|
IN struct sockaddr_in *DestAddr,
|
||||||
IN char * Udn,
|
IN char *ServType,
|
||||||
IN char * Location,
|
IN char *Udn,
|
||||||
IN int Duration);
|
IN char *Location,
|
||||||
|
IN int Duration);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : ServiceShutdown
|
* Function : ServiceShutdown
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN char * Udn: Device UDN
|
* IN char *Udn: Device UDN
|
||||||
* IN char *ServType: Service Type.
|
* IN char *ServType: Service Type.
|
||||||
* IN char * Location: Location of Device description document.
|
* IN char *Location: Location of Device description document.
|
||||||
* IN int Duration :Service duration in sec.
|
* IN int Duration :Service duration in sec.
|
||||||
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function creates a HTTP service shutdown request packet
|
* This function creates a HTTP service shutdown request packet
|
||||||
* and sent it to the multicast channel through RequestHandler.
|
* and sent it to the multicast channel through RequestHandler.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int ServiceShutdown( IN char * Udn, IN char * ServType,
|
int ServiceShutdown(
|
||||||
IN char * Location,
|
IN char *Udn,
|
||||||
IN int Duration);
|
IN char *ServType,
|
||||||
|
IN char *Location,
|
||||||
|
IN int Duration);
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : advertiseAndReplyThread
|
* Function : advertiseAndReplyThread
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN void *data: Structure containing the search request
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Parameters:
|
||||||
|
* IN void *data: Structure containing the search request
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
* This function is a wrapper function to reply the search request
|
* This function is a wrapper function to reply the search request
|
||||||
* coming from the control point.
|
* coming from the control point.
|
||||||
*
|
*
|
||||||
* Returns: void *
|
* Returns: void *
|
||||||
* always return NULL
|
* always return NULL
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
void * advertiseAndReplyThread(IN void * data);
|
void *advertiseAndReplyThread(IN void * data);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : AdvertiseAndReply
|
* Function : AdvertiseAndReply
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN int AdFlag: -1 = Send shutdown, 0 = send reply,
|
* IN int AdFlag: -1 = Send shutdown,
|
||||||
* 1 = Send Advertisement
|
* 0 = send reply,
|
||||||
|
* 1 = Send Advertisement
|
||||||
* IN UpnpDevice_Handle Hnd: Device handle
|
* IN UpnpDevice_Handle Hnd: Device handle
|
||||||
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
* IN enum SsdpSearchType SearchType:Search type for sending replies
|
||||||
* IN struct sockaddr_in *DestAddr:Destination address
|
* IN struct sockaddr_in *DestAddr:Destination address
|
||||||
* IN char *DeviceType:Device type
|
* IN char *DeviceType:Device type
|
||||||
* IN char *DeviceUDN:Device UDN
|
* IN char *DeviceUDN:Device UDN
|
||||||
* IN char *ServiceType:Service type
|
* IN char *ServiceType:Service type
|
||||||
* IN int Exp:Advertisement age
|
* IN int Exp:Advertisement age
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function to send SSDP advertisements, replies and shutdown messages.
|
* This function to send SSDP advertisements, replies and shutdown messages.
|
||||||
*
|
*
|
||||||
* Returns: int
|
* Returns: int
|
||||||
* UPNP_E_SUCCESS if successful else appropriate error
|
* UPNP_E_SUCCESS if successful else appropriate error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
int AdvertiseAndReply(IN int AdFlag,
|
int AdvertiseAndReply(
|
||||||
IN UpnpDevice_Handle Hnd,
|
IN int AdFlag,
|
||||||
IN enum SsdpSearchType SearchType,
|
IN UpnpDevice_Handle Hnd,
|
||||||
IN struct sockaddr_in *DestAddr,
|
IN enum SsdpSearchType SearchType,
|
||||||
IN char *DeviceType,
|
IN struct sockaddr_in *DestAddr,
|
||||||
IN char *DeviceUDN,
|
IN char *DeviceType,
|
||||||
IN char *ServiceType, int Exp);
|
IN char *DeviceUDN,
|
||||||
|
IN char *ServiceType, int Exp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,12 +36,11 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#else
|
#else
|
||||||
#define XINLINE
|
typedef int socklen_t;
|
||||||
|
#define EAFNOSUPPORT 97
|
||||||
typedef int socklen_t;
|
|
||||||
#define EAFNOSUPPORT 97
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // GENLIB_NET_UNIXUTIL_H
|
#endif // GENLIB_NET_UNIXUTIL_H
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ void free_URL_list(URL_list * list);
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_uri(uri_type *in);
|
void print_uri(uri_type *in);
|
||||||
#else
|
#else
|
||||||
static inline void print_uri(uri_type *in) {}
|
static UPNP_INLINE void print_uri(uri_type *in) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -208,7 +208,7 @@ static inline void print_uri(uri_type *in) {}
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void print_token(token *in);
|
void print_token(token *in);
|
||||||
#else
|
#else
|
||||||
static inline void print_token(token * in) {}
|
static UPNP_INLINE void print_token(token * in) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -136,31 +136,28 @@ void linecopylen( OUT char dest[LINE_SIZE], IN const char* src, IN size_t srclen
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
|
|
||||||
// C specific
|
// C specific
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifdef WIN32
|
||||||
#define XINLINE inline
|
#ifndef S_ISREG
|
||||||
#else
|
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISREG
|
#ifndef S_ISDIR
|
||||||
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISDIR
|
|
||||||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define EADDRINUSE WSAEADDRINUSE
|
#define EADDRINUSE WSAEADDRINUSE
|
||||||
|
|
||||||
#define strcasecmp stricmp
|
#define strcasecmp stricmp
|
||||||
#define strncasecmp strnicmp
|
#define strncasecmp strnicmp
|
||||||
|
|
||||||
#define sleep(a) Sleep((a)*1000)
|
#define sleep(a) Sleep((a)*1000)
|
||||||
#define usleep(a) Sleep((a)/1000)
|
#define usleep(a) Sleep((a)/1000)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif /* GENLIB_UTIL_UTIL_H */
|
#endif /* GENLIB_UTIL_UTIL_H */
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ get_node_value( IN IXML_Node * node )
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
get_host_and_path( IN char *ctrl_url,
|
get_host_and_path( IN char *ctrl_url,
|
||||||
OUT const memptr *host,
|
OUT const memptr *host,
|
||||||
OUT const memptr *path,
|
OUT const memptr *path,
|
||||||
@ -277,7 +277,7 @@ get_host_and_path( IN char *ctrl_url,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
get_action_name( IN char *action,
|
get_action_name( IN char *action,
|
||||||
OUT memptr * name )
|
OUT memptr * name )
|
||||||
{
|
{
|
||||||
@ -303,7 +303,7 @@ get_action_name( IN char *action,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
add_man_header( INOUT membuffer * headers )
|
add_man_header( INOUT membuffer * headers )
|
||||||
{
|
{
|
||||||
char *soap_action_hdr;
|
char *soap_action_hdr;
|
||||||
|
@ -85,7 +85,7 @@ const char *ContentTypeHeader =
|
|||||||
* 0 if successful else returns appropriate error.
|
* 0 if successful else returns appropriate error.
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
get_request_type( IN http_message_t * request,
|
get_request_type( IN http_message_t * request,
|
||||||
OUT memptr * action_name )
|
OUT memptr * action_name )
|
||||||
{
|
{
|
||||||
@ -262,7 +262,7 @@ send_error_response( IN SOCKINFO * info,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
send_var_query_response( IN SOCKINFO * info,
|
send_var_query_response( IN SOCKINFO * info,
|
||||||
IN const char *var_value,
|
IN const char *var_value,
|
||||||
IN http_message_t * hmsg )
|
IN http_message_t * hmsg )
|
||||||
@ -326,12 +326,12 @@ send_var_query_response( IN SOCKINFO * info,
|
|||||||
* Description : This function separates the action node from
|
* Description : This function separates the action node from
|
||||||
* the root DOM node.
|
* the root DOM node.
|
||||||
*
|
*
|
||||||
* Return : static XINLINE int
|
* Return : static UPNP_INLINE int
|
||||||
* 0 if successful, or -1 if fails.
|
* 0 if successful, or -1 if fails.
|
||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
get_action_node( IN IXML_Document * TempDoc,
|
get_action_node( IN IXML_Document * TempDoc,
|
||||||
IN char *NodeName,
|
IN char *NodeName,
|
||||||
OUT IXML_Document ** RespNode )
|
OUT IXML_Document ** RespNode )
|
||||||
@ -681,7 +681,7 @@ get_device_info( IN http_message_t * request,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
send_action_response( IN SOCKINFO * info,
|
send_action_response( IN SOCKINFO * info,
|
||||||
IN IXML_Document * action_resp,
|
IN IXML_Document * action_resp,
|
||||||
IN http_message_t * request )
|
IN http_message_t * request )
|
||||||
@ -769,7 +769,7 @@ error_handler:
|
|||||||
* returns 0 if successful else returns -1.
|
* returns 0 if successful else returns -1.
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
get_var_name( IN IXML_Document * TempDoc,
|
get_var_name( IN IXML_Document * TempDoc,
|
||||||
OUT char *VarName )
|
OUT char *VarName )
|
||||||
{
|
{
|
||||||
@ -840,7 +840,7 @@ error_handler:
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
handle_query_variable( IN SOCKINFO * info,
|
handle_query_variable( IN SOCKINFO * info,
|
||||||
IN http_message_t * request,
|
IN http_message_t * request,
|
||||||
IN IXML_Document * xml_doc )
|
IN IXML_Document * xml_doc )
|
||||||
|
@ -55,12 +55,12 @@
|
|||||||
|
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : send_search_result
|
* Function : send_search_result
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN void *data: Search reply from the device
|
* IN void *data: Search reply from the device
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function sends a callback to the control point application with
|
* This function sends a callback to the control point application with
|
||||||
* a SEARCH result
|
* a SEARCH result
|
||||||
*
|
*
|
||||||
@ -125,16 +125,16 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
|
|
||||||
// we are assuming that there can be only one client supported at a time
|
// we are assuming that there can be only one client supported at a time
|
||||||
|
|
||||||
HandleLock( );
|
HandleLock();
|
||||||
|
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// copy
|
// copy
|
||||||
ctrlpt_callback = ctrlpt_info->Callback;
|
ctrlpt_callback = ctrlpt_info->Callback;
|
||||||
ctrlpt_cookie = ctrlpt_info->Cookie;
|
ctrlpt_cookie = ctrlpt_info->Cookie;
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
|
|
||||||
// search timeout
|
// search timeout
|
||||||
if( timeout ) {
|
if( timeout ) {
|
||||||
@ -268,9 +268,9 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
return; // bad reply
|
return; // bad reply
|
||||||
}
|
}
|
||||||
//check each current search
|
//check each current search
|
||||||
HandleLock( );
|
HandleLock();
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node = ListHead( &ctrlpt_info->SsdpSearchList );
|
node = ListHead( &ctrlpt_info->SsdpSearchList );
|
||||||
@ -344,28 +344,30 @@ ssdp_handle_ctrlpt_msg( IN http_message_t * hmsg,
|
|||||||
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
//ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, ¶m, cookie );
|
//ctrlpt_callback( UPNP_DISCOVERY_SEARCH_RESULT, ¶m, cookie );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : process_reply
|
* 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:
|
* 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
|
* This function processes reply recevied from a search
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static XINLINE void
|
#warning There are currently no uses of the function 'process_reply()' in the code.
|
||||||
|
#warning 'process_reply()' is a good candidate for removal.
|
||||||
|
static UPNP_INLINE void
|
||||||
process_reply( IN char *request_buf,
|
process_reply( IN char *request_buf,
|
||||||
IN int buf_len,
|
IN int buf_len,
|
||||||
IN struct sockaddr_in *dest_addr,
|
IN struct sockaddr_in *dest_addr,
|
||||||
@ -388,17 +390,17 @@ process_reply( IN char *request_buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : CreateClientRequestPacket
|
* Function : CreateClientRequestPacket
|
||||||
*
|
|
||||||
* Parameters:
|
|
||||||
* IN char * RqstBuf:Output string in HTTP format.
|
|
||||||
* IN char *SearchTarget:Search Target
|
|
||||||
* IN int Mx dest_addr: Number of seconds to wait to
|
|
||||||
* collect all the responses
|
|
||||||
*
|
*
|
||||||
* Description:
|
* Parameters:
|
||||||
|
* IN char * RqstBuf:Output string in HTTP format.
|
||||||
|
* IN char *SearchTarget:Search Target
|
||||||
|
* IN int Mx dest_addr: Number of seconds to wait to
|
||||||
|
* collect all the responses
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
* This function creates a HTTP search request packet
|
* This function creates a HTTP search request packet
|
||||||
* depending on the input parameter.
|
* depending on the input parameter.
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
*
|
*
|
||||||
@ -430,12 +432,12 @@ CreateClientRequestPacket( IN char *RqstBuf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Function : searchExpired
|
* Function : searchExpired
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* IN void * arg:
|
* IN void * arg:
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function
|
* This function
|
||||||
*
|
*
|
||||||
* Returns: void
|
* Returns: void
|
||||||
@ -456,13 +458,13 @@ searchExpired( void *arg )
|
|||||||
void *cookie = NULL;
|
void *cookie = NULL;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
HandleLock( );
|
HandleLock();
|
||||||
|
|
||||||
//remove search target from search list
|
//remove search target from search list
|
||||||
|
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
free( id );
|
free( id );
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +485,7 @@ searchExpired( void *arg )
|
|||||||
}
|
}
|
||||||
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
node = ListNext( &ctrlpt_info->SsdpSearchList, node );
|
||||||
}
|
}
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
|
|
||||||
if( found ) {
|
if( found ) {
|
||||||
ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie );
|
ctrlpt_callback( UPNP_DISCOVERY_SEARCH_TIMEOUT, NULL, cookie );
|
||||||
@ -558,9 +560,9 @@ SearchByTarget( IN int Mx,
|
|||||||
FD_SET( gSsdpReqSocket, &wrSet );
|
FD_SET( gSsdpReqSocket, &wrSet );
|
||||||
|
|
||||||
//add search criteria to list
|
//add search criteria to list
|
||||||
HandleLock( );
|
HandleLock();
|
||||||
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
if( GetClientHandleInfo( &handle, &ctrlpt_info ) != HND_CLIENT ) {
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
free( ReqBuf );
|
free( ReqBuf );
|
||||||
return UPNP_E_INTERNAL_ERROR;
|
return UPNP_E_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
@ -581,7 +583,7 @@ SearchByTarget( IN int Mx,
|
|||||||
newArg->timeoutEventId = ( *id );
|
newArg->timeoutEventId = ( *id );
|
||||||
|
|
||||||
ListAddTail( &ctrlpt_info->SsdpSearchList, newArg );
|
ListAddTail( &ctrlpt_info->SsdpSearchList, newArg );
|
||||||
HandleUnlock( );
|
HandleUnlock();
|
||||||
|
|
||||||
setsockopt( gSsdpReqSocket, IPPROTO_IP, IP_MULTICAST_IF,
|
setsockopt( gSsdpReqSocket, IPPROTO_IP, IP_MULTICAST_IF,
|
||||||
( char * )&addr, sizeof( addr ) );
|
( char * )&addr, sizeof( addr ) );
|
||||||
|
@ -641,7 +641,7 @@ free_ssdp_event_handler_data( void *the_data )
|
|||||||
* Returns: xboolean
|
* Returns: xboolean
|
||||||
* returns TRUE if msg is valid else FALSE
|
* returns TRUE if msg is valid else FALSE
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static XINLINE xboolean
|
static UPNP_INLINE xboolean
|
||||||
valid_ssdp_msg( IN http_message_t * hmsg )
|
valid_ssdp_msg( IN http_message_t * hmsg )
|
||||||
{
|
{
|
||||||
memptr hdr_value;
|
memptr hdr_value;
|
||||||
@ -683,7 +683,7 @@ valid_ssdp_msg( IN http_message_t * hmsg )
|
|||||||
* Returns: int
|
* Returns: int
|
||||||
* 0 if successful -1 if error
|
* 0 if successful -1 if error
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
start_event_handler( void *Data )
|
start_event_handler( void *Data )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE void
|
static UPNP_INLINE void
|
||||||
addrToString( IN const struct sockaddr_in *addr,
|
addrToString( IN const struct sockaddr_in *addr,
|
||||||
OUT char ipaddr_port[] )
|
OUT char ipaddr_port[] )
|
||||||
{
|
{
|
||||||
@ -87,7 +87,7 @@ addrToString( IN const struct sockaddr_in *addr,
|
|||||||
*
|
*
|
||||||
* Note : 'newAlias' should be freed using free()
|
* Note : 'newAlias' should be freed using free()
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
calc_alias( IN const char *alias,
|
calc_alias( IN const char *alias,
|
||||||
IN const char *rootPath,
|
IN const char *rootPath,
|
||||||
OUT char **newAlias )
|
OUT char **newAlias )
|
||||||
@ -148,7 +148,7 @@ calc_alias( IN const char *alias,
|
|||||||
*
|
*
|
||||||
* Note :
|
* Note :
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
static XINLINE int
|
static UPNP_INLINE int
|
||||||
calc_descURL( IN const char *ipPortStr,
|
calc_descURL( IN const char *ipPortStr,
|
||||||
IN const char *alias,
|
IN const char *alias,
|
||||||
OUT char descURL[LINE_SIZE] )
|
OUT char descURL[LINE_SIZE] )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user