Project

General

Profile

Files » libupnp-1.6.6-customHeader.0.0.3.diff

methodus, 01/06/2010 07:42 PM

View differences:

libupnp-1.6.6-dlna/upnp/inc/upnp.h 2010-01-02 18:54:31.252250635 +0100
*
******************************************************************************/
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: upnp.h 1698 2008-02-23 20:48:30Z lww $
*/
#ifndef UPNP_H
#define UPNP_H
......
#include <sys/types.h>
/**
* Custom Header functions are implemented in this library.
* @see UpnpAddCustomHTTPHeader
*/
#define UPNP_HAVE_CUSTOMHEADERS
#define NUM_HANDLE 200
#define LINE_SIZE 180
#define NAME_SIZE 256
#define HEADER_SIZE 256
#define MNFT_NAME_SIZE 64
#define MODL_NAME_SIZE 32
#define SERL_NUMR_SIZE 64
......
/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */
struct Upnp_Discovery
{
/** The result code of the {\bf UpnpSearchAsync} call. */
......
DOMString content_type;
/** A header to be added to the HTTP response. The header will be
* automatically terminated with \r\n by the SDK. This string needs
* to be allocated by the caller using {\bf ixmlCloneDOMString}.
* When finished with it, the SDK frees the {\bf DOMString}. */
DOMString http_header;
};
/* The type of handle returned by the web server for open requests. */
......
char dirName[NAME_SIZE];
} virtualDirList;
typedef struct user_HTTP_Header_List
{
struct user_HTTP_Header_List *next;
char header[HEADER_SIZE];
} userHTTPHeaderList;
/** All callback functions share the same prototype, documented below.
* Note that any memory passed to the callback function
* is valid only during the callback and should be copied if it
......
server. */
);
/** {\bf UpnpAddHTTPHeader} add a custom header to
* the internal web server. All HTTP responses will contain the
* specified header.
*
* @return [int] An integer representing one of the following:
* \begin{itemize}
* \item {\tt UPPN_E_SUCCESS}: The operation completed successfully.
* \item {\tt UPNP_E_INVALID_ARGUMENT}: {\bf header_string} is empty.
* \end{itemize}
*/
EXPORT_SPEC int UpnpAddCustomHTTPHeader(
IN const char* header_string /** Header to add (\r\n termination not needed) */
);
/** {\bf UpnpRemoveHTTPHeader} removes a header that was previously added
* with {\bf UpnpAddHTTPHeader}.
*
* @return [int] An integer representing one of the following:
* \begin{itemize}
* \item {\tt UPPN_E_SUCCESS}: The operation completed successfully.
* \item {\tt UPNP_E_INVALID_ARGUMENT}: {\bf dirName} is not valid.
* \end{itemize}
*/
EXPORT_SPEC int UpnpRemoveCustomHTTPHeader(
IN const char* header_string /** Name of the header to remove */
);
/** {\bf UpnpRemoveAll} removes all virtual directory mappings.
*
* @return [void] This function does not return a value.
*
*/
EXPORT_SPEC void UpnpRemoveAllCustomHTTPHeaders( );
/** {\bf UpnpSetVirtualDirCallbacks} sets the callback function to be used to
* access a virtual directory. Refer to the description of
* {\bf UpnpVirtualDirCallbacks} for a description of the functions.
libupnp-1.6.6-dlna/upnp/src/api/upnpapi.c 2010-01-01 18:37:34.705077528 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: ThreadPool.h 1698 2008-02-23 20:48:30Z lww $
*/
#include "config.h"
......
#endif
membuffer_init( &gDocumentRootDir );
membuffer_init( &gUserHTTPHeaders );
srand( time( NULL ) ); // needed by SSDP or other parts
......
// remove all virtual dirs
UpnpRemoveAllVirtualDirs();
UpnpRemoveAllCustomHTTPHeaders();
membuffer_destroy(&gUserHTTPHeaders);
// allow static linking
#ifdef WIN32
......
}
/**************************************************************************
* Function: UpnpAddHTTPHeader
*
* Parameters:
* IN const char *header: string to be added to the HTTP response
*
* Description:
* This function adds a HTTP header to the response.
* For example "X-User-Agent: something" (\r\n termination is done
* automatically.
*
* Return Values: int
* UPNP_E_SUCCESS if successful else returns appropriate error
***************************************************************************/
int
UpnpAddCustomHTTPHeader( IN const char *header_string )
{
userHTTPHeaderList *pNewHeader,
*pLast;
userHTTPHeaderList *pCurrentHeader;
char header[HEADER_SIZE];
if( UpnpSdkInit != 1 ) {
// SDK is not initialized
return UPNP_E_FINISH;
}
if( ( header_string == NULL ) || ( strlen( header_string ) == 0 ) ||
( strlen(header_string) > HEADER_SIZE )) {
return UPNP_E_INVALID_PARAM;
}
strncpy( header, header_string, HEADER_SIZE);
pCurrentHeader = pUserHTTPHeaderList;
while( pCurrentHeader != NULL ) {
// already has this entry
if( strcmp( pCurrentHeader->header, header ) == 0 ) {
return UPNP_E_SUCCESS;
}
pCurrentHeader = pCurrentHeader->next;
}
pNewHeader =
( userHTTPHeaderList * ) malloc( sizeof( userHTTPHeaderList ) );
if( pNewHeader == NULL ) {
return UPNP_E_OUTOF_MEMORY;
}
pNewHeader->next = NULL;
strncpy( pNewHeader->header, header, HEADER_SIZE );
*( pNewHeader->header + strlen( header ) ) = 0;
if( pUserHTTPHeaderList == NULL ) { // first virtual dir
pUserHTTPHeaderList = pNewHeader;
} else {
pLast = pUserHTTPHeaderList;
while( pLast->next != NULL ) {
pLast = pLast->next;
}
pLast->next = pNewHeader;
}
if (gUserHTTPHeaders.length > 0)
membuffer_append(&gUserHTTPHeaders, "\r\n", 2);
membuffer_append(&gUserHTTPHeaders, header_string, strlen(header_string));
return UPNP_E_SUCCESS;
}
/**************************************************************************
* Function: UpnpRemoveHTTPHeader
*
* Parameters:
* IN const char *header:The header string to remove.
*
* Description:
* This function removes a virtual directory mapping.
*
* Return Values: int
* UPNP_E_SUCCESS if successful else returns appropriate error
***************************************************************************/
int
UpnpRemoveCustomHTTPHeader( IN const char *header_string)
{
userHTTPHeaderList *pPrev;
userHTTPHeaderList *pCur;
int found = 0;
if( UpnpSdkInit != 1 ) {
return UPNP_E_FINISH;
}
if( header_string == NULL ) {
return UPNP_E_INVALID_PARAM;
}
if( pUserHTTPHeaderList == NULL ) {
return UPNP_E_INVALID_PARAM;
}
//
// Handle the special case where the directory that we are
// removing is the first and only one in the list.
//
if( ( pUserHTTPHeaderList->next == NULL ) &&
( strcmp( pUserHTTPHeaderList->header, header_string ) == 0 ) ) {
free( pUserHTTPHeaderList );
pUserHTTPHeaderList = NULL;
found = 1;
}
if (!found)
{
pCur = pUserHTTPHeaderList;
pPrev = pCur;
while( pCur != NULL ) {
if( strcmp( pCur->header, header_string ) == 0 ) {
pPrev->next = pCur->next;
// Jin: we are deleting the first element in the list,
// update the global variable!
if (pCur == pUserHTTPHeaderList)
pUserHTTPHeaderList = pCur->next;
free( pCur );
found = 1;
break;
} else {
pPrev = pCur;
pCur = pCur->next;
}
}
}
if( found == 1 )
{
membuffer_delete(&gUserHTTPHeaders, 0, gUserHTTPHeaders.length);
pCur = pUserHTTPHeaderList;
while (pCur != NULL)
{
if (gUserHTTPHeaders.length > 0)
membuffer_append(&gUserHTTPHeaders, "\r\n", 2);
membuffer_append(&gUserHTTPHeaders, pCur->header, strlen(pCur->header));
}
return UPNP_E_SUCCESS;
}
else
return UPNP_E_INVALID_PARAM;
}
/**************************************************************************
* Function: UpnpRemoveAllCustomHTTPHeaders
*
* Parameters: VOID
*
* Description:
* This function removes all the virtual directory mappings.
*
* Return Values: VOID
*
***************************************************************************/
void
UpnpRemoveAllCustomHTTPHeaders( )
{
userHTTPHeaderList *pCur;
userHTTPHeaderList *pNext;
if( UpnpSdkInit != 1 ) {
return;
}
pCur = pUserHTTPHeaderList;
while( pCur != NULL ) {
pNext = pCur->next;
free( pCur );
pCur = pNext;
}
pUserHTTPHeaderList = NULL;
membuffer_delete(&gUserHTTPHeaders, 0, gUserHTTPHeaders.length);
}
/**************************************************************************
* Function: UpnpEnableWebserver
*
libupnp-1.6.6-dlna/upnp/src/gena/gena_device.c 2010-01-03 11:11:54.161799059 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: ThreadPool.h 1698 2008-02-23 20:48:30Z lww $
*/
#include "config.h"
#if EXCLUDE_GENA == 0
......
response.size_inc = 30;
if( http_MakeMessage(
&response, major, minor,
"R" "D" "S" "N" "Xc" "ssc" "scc",
"R" "D" "S" "N" "AXc" "ssc" "scc",
HTTP_OK,
(off_t)0,
gUserHTTPHeaders.buf,
X_USER_AGENT,
"SID: ", sub->sid,
timeout_str ) != 0 ) {
libupnp-1.6.6-dlna/upnp/src/genlib/net/http/httpreadwrite.c 2010-01-03 11:08:37.808828577 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: ThreadPool.h 1698 2008-02-23 20:48:30Z lww $
*/
/************************************************************************
* Purpose: This file defines the functionality making use of the http
......
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
* 'U': (no args) appends HTTP USER-AGENT: header
* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
* 'H': arg = *userHTTPHeaderList
* 'A': arg = const char* C_string
* adds a custom HTTP header to a specific response (filled out
* by the user in the File_Info struct), may be NULL
*
* Return: int
* 0 - On Success
......
uri_type url;
uri_type *uri_ptr;
int error_code = UPNP_E_OUTOF_MEMORY;
userHTTPHeaderList *pCurUserHTTPHeaderList;
va_list argp;
char tempbuf[200];
......
if( membuffer_append( buf, s, strlen( s ) ) != 0 ) {
goto error_handler;
}
} else if( c == 'A' ) { // C string
s = ( char * )va_arg( argp, char * );
if (s)
{
UpnpPrintf(UPNP_ALL,HTTP,__FILE__,__LINE__,"Adding a string : %s\n", s);
if( membuffer_append( buf, s, strlen( s ) ) != 0 )
{
goto error_handler;
}
if( membuffer_append( buf, "\r\n", 2 ) != 0 )
{
goto error_handler;
}
}
} else if( c == 'K' ) {
// Add Chunky header
if( membuffer_append
......
bignum = strlen( tempbuf );
if (http_MakeMessage(
buf, http_major_version, http_minor_version,
"NTcs",
"NTAcs",
bignum, // content-length
"text/html", // content-type
gUserHTTPHeaders.buf, // custom headers
tempbuf ) != 0 // body
) {
goto error_handler;
......
"CONTENT-TYPE: ", temp_str ) != 0 ) {
goto error_handler;
}
} else if( c == 'H' ) { // header list
pCurUserHTTPHeaderList =
( userHTTPHeaderList * )va_arg( argp, userHTTPHeaderList * );
if (pCurUserHTTPHeaderList != NULL)
{
while (pCurUserHTTPHeaderList != NULL)
{
if( membuffer_append
( buf, pCurUserHTTPHeaderList->header,
strlen( pCurUserHTTPHeaderList->header) ) != 0 )
{
goto error_handler;
}
if( membuffer_append( buf, "\r\n", 2 ) != 0 )
{
goto error_handler;
}
pCurUserHTTPHeaderList = pCurUserHTTPHeaderList->next;
}
}
} else {
assert( 0 );
}
libupnp-1.6.6-dlna/upnp/src/genlib/net/http/webserver.c 2010-01-05 22:36:00.423130041 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: ThreadPool.h 1698 2008-02-23 20:48:30Z lww $
*/
/******************************************************************************
* Purpose: This file defines the Web Server and has functions to carry out
......
rc = get_content_type( filename, &info->content_type );
info->http_header = NULL;
UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
"file info: %s, length: %lld, last_mod=%s readable=%d\n",
filename, (long long)info->file_length,
......
info->is_readable = TRUE;
info->is_directory = FALSE;
info->last_modified = alias->last_modified;
info->http_header = NULL;
}
return cmp == 0;
......
// init
request_doc = NULL;
finfo.content_type = NULL;
finfo.http_header = NULL;
alias_grabbed = FALSE;
err_code = HTTP_INTERNAL_SERVER_ERROR; // default error
using_virtual_dir = FALSE;
......
// Transfer-Encoding: chunked
if (http_MakeMessage(
headers, resp_major, resp_minor,
"R" "T" "GKD" "s" "tcS" "XcCc",
"R" "T" "GKD" "s" "tcS" "AAXcCc",
HTTP_PARTIAL_CONTENT, // status code
finfo.content_type, // content type
RespInstr, // range info
"LAST-MODIFIED: ",
&finfo.last_modified,
finfo.http_header,
gUserHTTPHeaders.buf,
X_USER_AGENT) != 0 ) {
goto error_handler;
}
......
// Transfer-Encoding: chunked
if (http_MakeMessage(
headers, resp_major, resp_minor,
"R" "N" "T" "GD" "s" "tcS" "XcCc",
"R" "N" "T" "GD" "s" "tcS" "AAXcCc",
HTTP_PARTIAL_CONTENT, // status code
RespInstr->ReadSendSize, // content length
finfo.content_type, // content type
RespInstr, // range info
"LAST-MODIFIED: ",
&finfo.last_modified,
finfo.http_header,
gUserHTTPHeaders.buf,
X_USER_AGENT) != 0 ) {
goto error_handler;
}
......
// Transfer-Encoding: chunked
if (http_MakeMessage(
headers, resp_major, resp_minor,
"RK" "TD" "s" "tcS" "XcCc",
"RK" "TD" "s" "tcS" "AAXcCc",
HTTP_OK, // status code
finfo.content_type, // content type
"LAST-MODIFIED: ",
&finfo.last_modified,
finfo.http_header,
gUserHTTPHeaders.buf,
X_USER_AGENT) != 0 ) {
goto error_handler;
}
......
// Transfer-Encoding: chunked
if (http_MakeMessage(
headers, resp_major, resp_minor,
"R" "N" "TD" "s" "tcS" "XcCc",
"R" "N" "TD" "s" "tcS" "AAXcCc",
HTTP_OK, // status code
RespInstr->ReadSendSize, // content length
finfo.content_type, // content type
"LAST-MODIFIED: ",
&finfo.last_modified,
finfo.http_header,
gUserHTTPHeaders.buf,
X_USER_AGENT) != 0 ) {
goto error_handler;
}
......
// Transfer-Encoding: chunked
if (http_MakeMessage(
headers, resp_major, resp_minor,
"R" "TD" "s" "tcS" "XcCc",
"R" "TD" "s" "tcS" "AAXcCc",
HTTP_OK, // status code
finfo.content_type, // content type
"LAST-MODIFIED: ",
&finfo.last_modified,
finfo.http_header,
gUserHTTPHeaders.buf,
X_USER_AGENT) != 0 ) {
goto error_handler;
}
......
error_handler:
free( request_doc );
ixmlFreeDOMString( finfo.content_type );
if (finfo.http_header)
ixmlFreeDOMString( finfo.http_header);
if( err_code != UPNP_E_SUCCESS && alias_grabbed ) {
alias_release( alias );
}
......
http_MakeMessage(
&headers, 1, 1,
"RTDSXcCc",
"RTDSAXcCc",
ret,
"text/html",
gUserHTTPHeaders.buf,
X_USER_AGENT );
http_SendMessage( info, &timeout, "b", headers.buf,
libupnp-1.6.6-dlna/upnp/src/inc/config.h 2009-12-31 15:26:47.694951746 +0100
*/
//@{
#define JOBS_PER_THREAD 10
#define JOBS_PER_THREAD 1
//@}
/** @name MIN_THREADS
......
*/
//@{
#define MIN_THREADS 2
#define MIN_THREADS 10
//@}
/** @name MAX_THREADS
......
*/
//@{
#define MAX_THREADS 12
#define MAX_THREADS 16
//@}
/** @name MAX_JOBS_TOTAL
libupnp-1.6.6-dlna/upnp/src/inc/httpreadwrite.h 2010-01-01 18:38:55.153109823 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: ThreadPool.h 1698 2008-02-23 20:48:30Z lww $
*/
#ifndef GENLIB_NET_HTTP_HTTPREADWRITE_H
#define GENLIB_NET_HTTP_HTTPREADWRITE_H
......
* 't': arg = time_t * gmt_time // appends time in RFC 1123 fmt
* 'U': (no args) appends HTTP USER-AGENT: header
* 'X': arg = const char useragent; "redsonic" HTTP X-User-Agent: useragent
* 'H': arg = *userHTTPHeaderList
* 'A': arg = const char* C_string
* adds a custom HTTP header to a specific response (filled out
* by the user in the File_Info struct), may be NULL
*
* Return: int
* 0 - On Success
libupnp-1.6.6-dlna/upnp/src/inc/upnpapi.h 2010-01-02 10:55:24.207256914 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: upnpapi.h 1698 2008-02-23 20:48:30Z lww $
*/
// File : upnpapi.h
......
#include "upnp.h"
#include "client_table.h"
#include "membuffer.h"
//#include "../ssdp/ssdplib.h"
#define MAX_INTERFACES 256
......
void AutoAdvertise(void *input);
int getlocalhostname(char *out);
userHTTPHeaderList *pUserHTTPHeaderList;
// concatenated list of custom http headers
membuffer gUserHTTPHeaders;
extern WebServerState bWebServerState;
#endif
libupnp-1.6.6-dlna/upnp/src/soap/soap_device.c 2010-01-02 10:21:39.067251698 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: soap_device.c 1698 2008-02-23 20:48:30Z lww $
*/
#include "config.h"
#ifdef INCLUDE_DEVICE_APIS
......
membuffer_init( &headers );
if (http_MakeMessage(
&headers, major, minor,
"RNsDsSXcc" "sssss",
"RNsDsSAXcc" "sssss",
500,
content_length,
ContentTypeHeader,
"EXT:\r\n",
gUserHTTPHeaders.buf,
X_USER_AGENT,
start_body, err_code_str, mid_body, err_msg,
end_body ) != 0 ) {
......
if (http_MakeMessage(
&response, major, minor,
"RNsDsSXcc" "sss",
"RNsDsSAXcc" "sss",
HTTP_OK,
content_length,
ContentTypeHeader,
"EXT:\r\n",
gUserHTTPHeaders.buf,
X_USER_AGENT,
start_body, var_value, end_body ) != 0 ) {
membuffer_destroy( &response );
......
// make headers
if (http_MakeMessage(
&headers, major, minor,
"RNsDsSXcc",
"RNsDsSAXcc",
HTTP_OK, // status code
content_length,
ContentTypeHeader,
"EXT:\r\n",
gUserHTTPHeaders.buf,
X_USER_AGENT) != 0 ) {
goto error_handler;
}
libupnp-1.6.6-dlna/upnp/src/ssdp/ssdp_device.c 2010-01-02 10:21:01.571251088 +0100
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*TU*
TombUPnP - a library for developing UPnP applications.
Copyright (C) 2006-2008 Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
$Id: ssdp_device.c 1698 2008-02-23 20:48:30Z lww $
*/
#include "config.h"
......
if( msg_type == MSGTYPE_REPLY ) {
ret_code = http_MakeMessage(
&buf, 1, 1,
"R" "sdc" "D" "sc" "ssc" "S" "Xc" "ssc" "sscc",
"R" "sdc" "D" "sc" "ssc" "S" "AXc" "ssc" "sscc",
HTTP_OK,
"CACHE-CONTROL: max-age=", duration,
"EXT:",
"LOCATION: ", location,
gUserHTTPHeaders.buf,
X_USER_AGENT,
"ST: ", nt,
"USN: ", usn);
......
ret_code = http_MakeMessage(
&buf, 1, 1,
"Q" "sssdc" "sdc" "ssc" "ssc" "ssc" "S" "Xc" "sscc",
"Q" "sssdc" "sdc" "ssc" "ssc" "ssc" "S" "AXc" "sscc",
HTTPMETHOD_NOTIFY, "*", (size_t)1,
"HOST: ", SSDP_IP, ":", SSDP_PORT,
"CACHE-CONTROL: max-age=", duration,
"LOCATION: ", location,
"NT: ", nt,
"NTS: ", nts,
gUserHTTPHeaders.buf,
X_USER_AGENT,
"USN: ", usn );
if( ret_code != 0 ) {
(3-3/3)