Include file reorganization.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@419 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2008-06-06 21:32:51 +00:00
parent 9fc2c364fa
commit 37ecd99305
12 changed files with 166 additions and 159 deletions

View File

@ -14,6 +14,11 @@
*/
#include "ixml.h" /* for IXML_Document */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -25,13 +30,6 @@ extern "C" {
typedef struct s_UpnpActionComplete UpnpActionComplete;
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#include "ixml.h" /* for IXML_Document */
/*!
* \brief Constructor.
*

View File

@ -14,6 +14,12 @@
*/
#include "ixml.h" /* for IXML_Document */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -23,18 +29,6 @@ extern "C" {
typedef struct s_UpnpActionRequest UpnpActionRequest;
#include "ixml.h" /* for IXML_Document */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef WIN32
#include <ws2tcpip.h>
#else
#include <netinet/in.h> /* for sockaddr, sockaddr_storage */
#endif
/*! Constructor */
EXPORT_SPEC UpnpActionRequest *UpnpActionRequest_new();

View File

@ -14,6 +14,11 @@
*/
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -23,17 +28,6 @@ extern "C" {
typedef struct s_UpnpDiscovery UpnpDiscovery;
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef WIN32
#include <ws2tcpip.h>
#else
#include <netinet/in.h> /* for sockaddr, sockaddr_storage */
#endif
/** Constructor */
EXPORT_SPEC UpnpDiscovery *UpnpDiscovery_new();

View File

@ -14,6 +14,11 @@
*/
#include "ixml.h" /* for IXML_Document */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -23,11 +28,6 @@ extern "C" {
typedef struct s_UpnpEvent UpnpEvent;
#include "ixml.h" /* for IXML_Document */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
/** Constructor */
EXPORT_SPEC UpnpEvent *UpnpEvent_new();

View File

@ -14,6 +14,10 @@
*/
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -24,10 +28,6 @@ extern "C" {
typedef struct s_UpnpEventSubscribe UpnpEventSubscribe;
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
/** Constructor */
EXPORT_SPEC UpnpEventSubscribe *UpnpEventSubscribe_new();

View File

@ -14,6 +14,14 @@
*/
#include "ixml.h" /* for DOMString */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include <sys/types.h> /* for off_t */
#include <time.h> /* for time_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -23,14 +31,6 @@ extern "C" {
typedef struct s_UpnpFileInfo UpnpFileInfo;
#include "ixml.h" /* for DOMString */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include <sys/types.h> /* for off_t */
#include <time.h> /* for time_t */
/** Constructor */
EXPORT_SPEC UpnpFileInfo *UpnpFileInfo_new();

View File

@ -14,6 +14,11 @@
*/
#include "ixml.h" /* for DOMString */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -24,13 +29,6 @@ extern "C" {
typedef struct s_UpnpStateVarComplete UpnpStateVarComplete;
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#include "ixml.h" /* for DOMString */
/** Constructor */
EXPORT_SPEC UpnpStateVarComplete *UpnpStateVarComplete_new();

View File

@ -14,6 +14,12 @@
*/
#include "ixml.h" /* for DOMString */
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpInet.h" /* for sockaddr, sockaddr_storage */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -24,20 +30,6 @@ extern "C" {
typedef struct s_UpnpStateVarRequest UpnpStateVarRequest;
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#include "ixml.h" /* for DOMString */
#ifdef WIN32
#include <ws2tcpip.h>
#else
#include <netinet/in.h> /* for sockaddr, sockaddr_storage */
#endif
/** Constructor */
EXPORT_SPEC UpnpStateVarRequest *UpnpStateVarRequest_new();

View File

@ -14,6 +14,10 @@
*/
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@ -23,10 +27,6 @@ extern "C" {
typedef struct s_UpnpSubscriptionRequest UpnpSubscriptionRequest;
#include "UpnpGlobal.h" /* for EXPORT_SPEC */
#include "UpnpString.h"
/** Constructor */
EXPORT_SPEC UpnpSubscriptionRequest *UpnpSubscriptionRequest_new();

15
upnp/inc/UpnpInet.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef UPNPINET_H
#define UPNPINET_H
#ifdef WIN32
#include <Ws2tcpip.h>
#else
#include <netinet/in.h>
#endif
#endif /* UPNPINET_H */

View File

@ -46,13 +46,23 @@
#include "ixml.h"
#include "upnpconfig.h"
#include "UpnpGlobal.h"
#include "UpnpInet.h"
#include <stdio.h>
#include <sys/types.h>
#if (defined(BSD) && BSD >= 199306)
/*
* \todo Document the exact reason of these include files and solve this
* include mess in an include file like UpnpTime.h
*/
#ifdef WIN32
#include <time.h>
#elif (defined(BSD) && BSD >= 199306)
#include <time.h>
#else
/* Other systems ??? */
#endif
@ -64,14 +74,7 @@
#ifdef WIN32
#define UpnpCloseSocket closesocket
#define fseeko fseek
#else
#define UpnpCloseSocket close
#endif
#ifdef WIN32
#include <iphlpapi.h>
#else
#define SOCKET int
#define INVALID_SOCKET (SOCKET)(~0)
@ -79,17 +82,13 @@
#ifdef WIN32
#include <Ws2tcpip.h>
#include <iphlpapi.h>
#include <time.h>
#define UpnpCloseSocket closesocket
#define fseeko fseek
#else
#include <netinet/in.h>
#define UpnpCloseSocket close
#endif
#include <sys/types.h>
#define NUM_HANDLE 200
#define LINE_SIZE 180
#define NAME_SIZE 256

View File

@ -1,42 +1,44 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2000-2003 Intel Corporation
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither name of Intel Corporation nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
/*******************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************/
#ifndef HTTP_CLIENT_H
#define HTTP_CLIENT_H
#ifndef _http_client_h_
#define _http_client_h_
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C
#endif
#include "genlib/closesocket/upnpclosesocket.h"
#include "tools/config.h"
#include "upnp.h"
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
@ -50,9 +52,11 @@
#include <unistd.h>
#include <netdb.h>
#include <sys/time.h>
#include "tools/config.h"
#include "upnp.h"
//#include "upnp_debug.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define HTTP_DATE_LENGTH 37 // length for HTTP DATE:
@ -77,10 +81,12 @@
#define RESPONSE_TIMEOUT 30
#define SOCKET_BUFFER_SIZE 5000
enum hostType { HOSTNAME, IPv4address };
enum pathType { ABS_PATH, REL_PATH, OPAQUE_PART };
enum uriType { ABSOLUTE, RELATIVE };
//Buffer used to store data read from
//a socket during an http transfer
//in function read_bytes.
@ -158,64 +164,64 @@ typedef struct HTTP_MESSAGE {
} http_message;
EXTERN_C int transferHTTP( char * request, char * toSend,
int transferHTTP( char * request, char * toSend,
int toSendSize, char **out, char * Url);
EXTERN_C int transferHTTPRaw( char * toSend, int toSendSize,
int transferHTTPRaw( char * toSend, int toSendSize,
char **out, char *URL);
//helper function
EXTERN_C int transferHTTPparsedURL( char * request,
int transferHTTPparsedURL( char * request,
char * toSend, int toSendSize,
char **out, uri_type *URL);
//assumes that char * out has enough space ( 38 characters)
//outputs the current time in the following null terminated string:
// "DATE: Sun, Jul 06 2000 08:53:01 GMT\r\n"
EXTERN_C void currentTmToHttpDate(char *out);
void currentTmToHttpDate(char *out);
//returns dynamic memory or NULL on error
EXTERN_C char * resolve_rel_url( char * base_url, char * rel_url);
char * resolve_rel_url( char * base_url, char * rel_url);
EXTERN_C int parse_uri( char * in, int max, uri_type * out);
int parse_uri( char * in, int max, uri_type * out);
EXTERN_C int token_cmp( token *in1, token *in2);
int token_cmp( token *in1, token *in2);
EXTERN_C int token_string_casecmp( token * in1, char * in2);
int token_string_casecmp( token * in1, char * in2);
EXTERN_C int token_string_cmp( token * in1, char * in2);
int token_string_cmp( token * in1, char * in2);
EXTERN_C int parse_http_response( char * in, http_message * out,
int parse_http_response( char * in, http_message * out,
int max_len);
EXTERN_C int parse_http_request( char * in, http_message *out,
int parse_http_request( char * in, http_message *out,
int max_len);
EXTERN_C int search_for_header( http_message * in,
int search_for_header( http_message * in,
char * header, token *out_value);
EXTERN_C int parse_hostport( char* in, int max, hostport_type *out );
int parse_hostport( char* in, int max, hostport_type *out );
EXTERN_C size_t write_bytes(int fd, char * bytes, size_t n,
size_t write_bytes(int fd, char * bytes, size_t n,
int timeout);
EXTERN_C void free_http_message(http_message * message);
EXTERN_C int copy_URL_list( URL_list *in, URL_list *out);
EXTERN_C void free_URL_list(URL_list * list);
EXTERN_C int parse_port(int max, char * port, unsigned short int * out);
void free_http_message(http_message * message);
int copy_URL_list( URL_list *in, URL_list *out);
void free_URL_list(URL_list * list);
int parse_port(int max, char * port, unsigned short int * out);
EXTERN_C int parse_http_line( char * in, int max_size);
EXTERN_C int parse_not_LWS( char *in, token *out, int max_size);
EXTERN_C int parse_LWS( char * in, int max_size);
EXTERN_C int parse_token( char * in, token * out, int max_size);
EXTERN_C ssize_t readLine(int fd, char *out, int max, int *timeout);
EXTERN_C int remove_dots(char * in, int size);
int parse_http_line( char * in, int max_size);
int parse_not_LWS( char *in, token *out, int max_size);
int parse_LWS( char * in, int max_size);
int parse_token( char * in, token * out, int max_size);
ssize_t readLine(int fd, char *out, int max, int *timeout);
int remove_dots(char * in, int size);
#ifdef DEBUG
EXTERN_C void print_http_request(
void print_http_request(
http_message *message,
Upnp_LogLevel DLevel,
Dbg_Module Module,
@ -230,8 +236,9 @@ static inline void print_http_request(
int DbgLineNo) {}
#endif
#ifdef DEBUG
EXTERN_C void print_http_response(
void print_http_response(
http_message *message,
Upnp_LogLevel DLevel,
Dbg_Module Module,
@ -246,8 +253,9 @@ static inline void print_http_response(
int DbgLineNo) {}
#endif
#ifdef DEBUG
EXTERN_C void print_token(
void print_token(
token *in,
Upnp_LogLevel DLevel,
Dbg_Module Module,
@ -262,8 +270,9 @@ static inline void print_token(
int DbgLineNo) {}
#endif
#ifdef DEBUG
EXTERN_C void print_status_line(
void print_status_line(
http_status *in,
Upnp_LogLevel DLevel,
Dbg_Module Module,
@ -278,8 +287,9 @@ static inline void print_status_line(
int DbgLineNo) {}
#endif
#ifdef DEBUG
EXTERN_C void print_request_line(
void print_request_line(
http_request *in,
Upnp_LogLevel DLevel,
Dbg_Module Module,
@ -294,8 +304,9 @@ static inline void print_request_line(
int DbgLineNo) {}
#endif
#ifdef DEBUG
EXTERN_C void print_uri(
void print_uri(
uri_type *in,
Upnp_LogLevel DLevel,
Dbg_Module Module,
@ -310,5 +321,11 @@ static inline void print_uri(
int DbgLineNo) {}
#endif
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* HTTP_CLIENT_H */