Less include file mess and doxygenation.

This commit is contained in:
Marcelo Roberto Jimenez 2010-12-19 19:02:42 -02:00
parent 04d64a893b
commit f67ed1949b
12 changed files with 109 additions and 216 deletions

View File

@ -2,6 +2,10 @@
#define UPNPINET_H
/*!
* \addtogroup Sock
*
* @{
*
* \file
*
* \brief Provides a platform independent way to include TCP/IP types and functions.
@ -17,21 +21,34 @@
#define UpnpCloseSocket closesocket
#else /* WIN32 */
#include <sys/param.h>
#if (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__)
#if defined(__sun)
#include <fcntl.h>
#include <sys/sockio.h>
#elif (defined(BSD) && BSD >= 199306) || defined (__FreeBSD_kernel__)
#include <ifaddrs.h>
/* Do not move or remove the include below for "sys/socket"!
* Will break FreeBSD builds. */
#include <sys/socket.h>
#endif
#include <arpa/inet.h> /* for inet_pton() */
#include <net/if.h>
#include <netinet/in.h>
/* SOCKET is unsigned and is not a file descriptor on win32. */
#define SOCKET int
/* INVALID_SOCKET is unsigned on win32. */
/*! This typedef makes the code slightly more WIN32 tolerant.
* On WIN32 systems, SOCKET is unsigned and is not a file
* descriptor. */
typedef int SOCKET;
/*! INVALID_SOCKET is unsigned on win32. */
#define INVALID_SOCKET (-1)
/* select() returns SOCKET_ERROR on win32. */
/*! select() returns SOCKET_ERROR on win32. */
#define SOCKET_ERROR (-1)
/*! Alias to close() to make code more WIN32 tolerant. */
#define UpnpCloseSocket close
#endif /* WIN32 */
/* @} Sock */
#endif /* UPNPINET_H */

View File

@ -33,11 +33,11 @@
******************************************************************************/
/*!
* \file
*
* \defgroup UPnPAPI UPnP API
*
* @{
*
* \file
*/
#include "ixml.h"
@ -381,19 +381,6 @@
/* @} ErrorCodes */
#ifndef OUT
#define OUT
#endif
#ifndef IN
#define IN
#endif
#ifndef INOUT
#define INOUT
#endif
#if UPNP_VERSION >= 10800
/*
* Opaque data structures. The following includes are data structures that
@ -612,7 +599,6 @@ enum Upnp_DescType_e {
typedef enum Upnp_DescType_e Upnp_DescType;
#if UPNP_VERSION < 10800
/** Returned as part of a {\bf UPNP_CONTROL_ACTION_COMPLETE} callback. */
@ -813,7 +799,6 @@ struct Upnp_Subscription_Request
};
struct File_Info
{
/** The length of the file. A length less than 0 indicates the size
@ -840,7 +825,6 @@ struct File_Info
};
#endif /* UPNP_VERSION < 10800 */
/*!
* All callback functions share the same prototype, documented below.
* Note that any memory passed to the callback function
@ -876,19 +860,16 @@ typedef int (*Upnp_FunPtr)(
/* @} Constants and Types */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*!
* \name Initialization and Registration
*
* @{
*/
/*!
* \brief Initializes the Linux SDK for UPnP Devices (IPv4 only).
*
@ -930,7 +911,6 @@ EXPORT_SPEC int UpnpInit(
* \c NULL will pick an arbitrary free port. */
unsigned short DestPort);
/*!
* \brief Initializes the Linux SDK for UPnP Devices (IPv4 or IPv6).
*
@ -974,7 +954,6 @@ EXPORT_SPEC int UpnpInit2(
unsigned short DestPort);
#endif
/*!
* \brief Terminates the Linux SDK for UPnP Devices.
*
@ -996,7 +975,6 @@ EXPORT_SPEC int UpnpInit2(
*/
EXPORT_SPEC int UpnpFinish(void);
/*!
* \brief Returns the internal server IPv4 UPnP listening port.
*
@ -1010,7 +988,6 @@ EXPORT_SPEC int UpnpFinish(void);
*/
EXPORT_SPEC unsigned short UpnpGetServerPort(void);
/*!
* \brief Returns the internal server IPv6 UPnP listening port.
*
@ -1038,7 +1015,6 @@ EXPORT_SPEC unsigned short UpnpGetServerPort6(void);
*/
EXPORT_SPEC char *UpnpGetServerIpAddress(void);
/*!
* \brief Returns the local IPv6 listening ip address.
*
@ -1190,7 +1166,6 @@ EXPORT_SPEC int UpnpRegisterRootDevice2(
/*! [out] Pointer to a variable to store the new device handle. */
UpnpDevice_Handle* Hnd);
/*!
* \brief Registers a device application for a specific address family with
* the UPnP library.
@ -1240,7 +1215,6 @@ EXPORT_SPEC int UpnpRegisterRootDevice3(
* AF_INET6 for an IPv6 device. Defaults to AF_INET. */
const int AddressFamily);
/*!
* \brief Unregisters a root device registered with \b UpnpRegisterRootDevice or
* \b UpnpRegisterRootDevice2.
@ -1260,7 +1234,6 @@ EXPORT_SPEC int UpnpUnRegisterRootDevice(
/*! [in] The handle of the root device instance to unregister. */
UpnpDevice_Handle Hnd);
/*!
* \brief Registers a control point application with the UPnP Library.
*
@ -1287,7 +1260,6 @@ EXPORT_SPEC int UpnpRegisterClient(
/*! [out] Pointer to a variable to store the new control point handle. */
UpnpClient_Handle *Hnd);
/*!
* \brief Unregisters a control point application, unsubscribing all active
* subscriptions.
@ -1308,7 +1280,6 @@ EXPORT_SPEC int UpnpUnRegisterClient(
/*! [in] The handle of the control point instance to unregister. */
UpnpClient_Handle Hnd);
/*!
* \deprecated Use \b UpnpSetMaxContentLength instead.
*
@ -1322,7 +1293,6 @@ EXPORT_SPEC int UpnpSetContentLength(
/*! [in] Permissible content length */
size_t contentLength);
/*!
* \brief Sets the maximum content-length that the SDK will process on an
* incoming SOAP requests or responses.
@ -1344,10 +1314,8 @@ EXPORT_SPEC int UpnpSetMaxContentLength(
* in bytes. */
size_t contentLength);
/* @} Initialization and Registration */
/******************************************************************************
******************************************************************************
* *
@ -1356,14 +1324,12 @@ EXPORT_SPEC int UpnpSetMaxContentLength(
******************************************************************************
******************************************************************************/
/*!
* \name Discovery
*
* @{
*/
/*!
* \brief Searches for devices matching the given search target.
*
@ -1422,10 +1388,8 @@ EXPORT_SPEC int UpnpSendAdvertisement(
/*! The expiration age, in seconds, of the announcements. */
int Exp);
/* @} Discovery */
/******************************************************************************
******************************************************************************
* *
@ -1434,14 +1398,12 @@ EXPORT_SPEC int UpnpSendAdvertisement(
******************************************************************************
******************************************************************************/
/*!
* \name Control
*
* @{
*/
/*!
* \brief Queries the state of a state variable of a service on another device.
*
@ -1479,7 +1441,6 @@ EXPORT_SPEC int UpnpGetServiceVarStatus(
* \b ixmlFreeDOMString. */
DOMString *StVarVal);
/*!
* \brief Queries the state of a variable of a service, generating a callback
* when the operation is complete.
@ -1510,7 +1471,6 @@ EXPORT_SPEC int UpnpGetServiceVarStatusAsync(
/*! [in] Pointer to user data to pass to the callback function when invoked. */
const void *Cookie);
/*!
* \brief Sends a message to change a state variable in a service.
*
@ -1549,7 +1509,6 @@ EXPORT_SPEC int UpnpSendAction(
* this document and the caller needs to free it. */
IXML_Document **RespNode);
/*!
* \brief Sends a message to change a state variable in a service.
*
@ -1591,7 +1550,6 @@ EXPORT_SPEC int UpnpSendActionEx(
* this document and the caller needs to free it. */
IXML_Document **RespNode);
/*!
* \brief Sends a message to change a state variable in a service, generating a
* callback when the operation is complete.
@ -1631,7 +1589,6 @@ EXPORT_SPEC int UpnpSendActionAsync(
* invoked. */
const void *Cookie);
/*!
* \brief Sends a message to change a state variable in a service, generating a
* callback when the operation is complete.
@ -1674,10 +1631,8 @@ EXPORT_SPEC int UpnpSendActionExAsync(
* invoked. */
const void *Cookie);
/*! @} Control */
/******************************************************************************
******************************************************************************
* *
@ -1686,14 +1641,12 @@ EXPORT_SPEC int UpnpSendActionExAsync(
******************************************************************************
******************************************************************************/
/*!
* \name Eventing
*
* @{
*/
/*!
* \brief Accepts a subscription request and sends out the current state of the
* eventable variables for a service.
@ -1735,7 +1688,6 @@ EXPORT_SPEC int UpnpAcceptSubscription(
/*! [in] The subscription ID of the newly registered control point. */
const Upnp_SID SubsId);
/*!
* \brief Similar to \b UpnpAcceptSubscription() except that it takes a DOM
* document for the variables to event rather than an array of strings.
@ -1772,7 +1724,6 @@ EXPORT_SPEC int UpnpAcceptSubscriptionExt(
/*! [in] The subscription ID of the newly registered control point. */
Upnp_SID SubsId);
/*!
* \brief Sends out an event change notification to all control points
* subscribed to a particular service.
@ -1808,7 +1759,6 @@ EXPORT_SPEC int UpnpNotify(
/*! [in] The count of variables included in this notification. */
int cVariables);
/*!
* \brief Similar to \b UpnpNotify except that it takes a DOM document for the
* event rather than an array of strings.
@ -1842,7 +1792,6 @@ EXPORT_SPEC int UpnpNotifyExt(
* Plug and Play Device Architecture specification. */
IXML_Document *PropSet);
/*!
* \brief Renews a subscription that is about to expire.
*
@ -1880,7 +1829,6 @@ EXPORT_SPEC int UpnpRenewSubscription(
/*! [in] The ID for the subscription to renew. */
const Upnp_SID SubsId);
/*!
* \brief Renews a subscription that is about to expire, generating a callback
* when the operation is complete.
@ -1942,7 +1890,6 @@ EXPORT_SPEC int UpnpRenewSubscriptionAsync(
/*! [in] Pointer to user data passed to the callback function when invoked. */
const void *Cookie);
/*!
* \brief Sets the maximum number of subscriptions accepted per service.
*
@ -1963,7 +1910,6 @@ EXPORT_SPEC int UpnpSetMaxSubscriptions(
/*! The maximum number of subscriptions to be allowed per service. */
int MaxSubscriptions);
/*!
* \brief Sets the maximum time-out accepted for a subscription request or
* renewal.
@ -1985,7 +1931,6 @@ EXPORT_SPEC int UpnpSetMaxSubscriptionTimeOut(
/*! The maximum subscription time-out to be accepted. */
int MaxSubscriptionTimeOut);
/*!
* \brief Registers a control point to receive event notifications from another
* device.
@ -2027,7 +1972,6 @@ EXPORT_SPEC int UpnpSubscribe(
/*! [out] Pointer to a variable to receive the subscription ID (SID). */
Upnp_SID SubsId);
/*!
* \brief Performs the same operation as \b UpnpSubscribe, but returns
* immediately and calls the registered callback function when the operation
@ -2089,7 +2033,6 @@ EXPORT_SPEC int UpnpSubscribeAsync(
/*! A user data value passed to the callback function when invoked. */
const void *Cookie);
/*!
* \brief Removes the subscription of a control point from a service previously
* subscribed to using \b UpnpSubscribe or \b UpnpSubscribeAsync.
@ -2125,7 +2068,6 @@ EXPORT_SPEC int UpnpUnSubscribe(
/*! [in] The ID returned when the control point subscribed to the service. */
const Upnp_SID SubsId);
/*!
* \brief Removes a subscription of a control point from a service previously
* subscribed to using \b UpnpSubscribe or \b UpnpSubscribeAsync, generating
@ -2183,11 +2125,9 @@ EXPORT_SPEC int UpnpUnSubscribeAsync(
/*! [in] Pointer to user data to pass to the callback function when invoked. */
const void *Cookie);
/*! @} Eventing */
/******************************************************************************
******************************************************************************
* *
@ -2237,7 +2177,6 @@ EXPORT_SPEC int UpnpDownloadUrlItem(
* \c LINE_SIZE bytes in size. */
char *contentType);
/*!
* \brief Gets a file specified in a URL.
*
@ -2282,7 +2221,6 @@ EXPORT_SPEC int UpnpOpenHttpGet(
* back to the user. */
int timeout);
/*!
* \brief Gets a file specified in a URL through the specified proxy.
*
@ -2329,7 +2267,6 @@ EXPORT_SPEC int UpnpOpenHttpGetProxy(
* back to the user. */
int timeout);
/*!
* \brief Gets specified number of bytes from a file specified in the URL.
*
@ -2380,7 +2317,6 @@ EXPORT_SPEC int UpnpOpenHttpGetEx(
* to the user. */
int timeout);
/*!
* \brief Gets specified number of bytes from a file specified in a URL.
*
@ -2410,7 +2346,6 @@ EXPORT_SPEC int UpnpReadHttpGet(
* the user. */
int timeout);
/*!
* \brief Retrieve progress information of a http-get transfer.
*
@ -2427,7 +2362,6 @@ EXPORT_SPEC int UpnpHttpGetProgress(
/*! [out] The content length. */
size_t *total);
/*!
* \brief Set the cancel flag of the \b handle parameter.
*
@ -2453,7 +2387,6 @@ EXPORT_SPEC int UpnpCloseHttpGet(
* \b UpnpOpenHttpGet. */
void *handle);
/*!
* \brief Makes an HTTP POST request message, opens a connection to the server
* and sends the POST request to the server if the connection to the server
@ -2493,7 +2426,6 @@ EXPORT_SPEC int UpnpOpenHttpPost(
* is expected from the receiver, failing which, an error is reported. */
int timeout);
/*!
* \brief Sends a request to a server to copy the contents of a buffer to the
* URI specified in the \b UpnpOpenHttpPost call.
@ -2519,7 +2451,6 @@ EXPORT_SPEC int UpnpWriteHttpPost(
* expected from the server, failing which, an error is reported. */
int timeout);
/*!
* \brief Sends and receives any pending data, closes the connection with the
* server, and frees memory allocated during the \b UpnpOpenHttpPost call.
@ -2542,7 +2473,6 @@ EXPORT_SPEC int UpnpCloseHttpPost(
/*! [in] A time out value sent with the request during which a response is
* expected from the server, failing which, an error is reported. */
int timeout);
/*!
* \brief Downloads an XML document specified in a URL.
@ -2577,7 +2507,6 @@ EXPORT_SPEC int UpnpDownloadXmlDoc(
/*! [out] A pointer in which to store the XML document. */
IXML_Document **xmlDoc);
/*! @} Control Point HTTP API */
/******************************************************************************
@ -2614,13 +2543,11 @@ EXPORT_SPEC int UpnpSetWebServerRootDir(
/*! [in] Path of the root directory of the web server. */
const char *rootDir);
/*!
* \brief The type of handle returned by the web server for open requests.
*/
typedef void *UpnpWebFileHandle;
/*!
* \brief Get-info callback function prototype.
*/
@ -2635,7 +2562,6 @@ typedef int (*VDCallback_GetInfo)(
#endif /* UPNP_VERSION < 10800 */
);
/*!
* \brief Sets the get_info callback function to be used to access a virtual
* directory.
@ -2646,7 +2572,6 @@ typedef int (*VDCallback_GetInfo)(
*/
EXPORT_SPEC int UpnpVirtualDir_set_GetInfoCallback(VDCallback_GetInfo callback);
/*!
* \brief Open callback function prototype.
*/
@ -2657,7 +2582,6 @@ typedef UpnpWebFileHandle (*VDCallback_Open)(
* Valid values are \c UPNP_READ or \c UPNP_WRITE. */
enum UpnpOpenFileMode Mode);
/*!
* \brief Sets the open callback function to be used to access a virtual
* directory.
@ -2668,7 +2592,6 @@ typedef UpnpWebFileHandle (*VDCallback_Open)(
*/
EXPORT_SPEC int UpnpVirtualDir_set_OpenCallback(VDCallback_Open callback);
/*!
* \brief Read callback function prototype.
*/
@ -2680,7 +2603,6 @@ typedef int (*VDCallback_Read)(
/*! [in] The size of the buffer (i.e. the number of bytes to read). */
size_t buflen);
/*!
* \brief Sets the read callback function to be used to access a virtual
* directory.
@ -2691,7 +2613,6 @@ typedef int (*VDCallback_Read)(
*/
EXPORT_SPEC int UpnpVirtualDir_set_ReadCallback(VDCallback_Read callback);
/*!
* \brief Write callback function prototype.
*/
@ -2703,7 +2624,6 @@ typedef int (*VDCallback_Write)(
/*! [in] The number of bytes to write. */
size_t buflen);
/*!
* \brief Sets the write callback function to be used to access a virtual
* directory.
@ -2714,7 +2634,6 @@ typedef int (*VDCallback_Write)(
*/
EXPORT_SPEC int UpnpVirtualDir_set_WriteCallback(VDCallback_Write callback);
/*!
* \brief Seek callback function prototype.
*/
@ -2731,7 +2650,6 @@ typedef int (*VDCallback_Seek) (
* specify an absolute offset. */
int origin);
/*!
* \brief Sets the seek callback function to be used to access a virtual
* directory.
@ -2742,7 +2660,6 @@ typedef int (*VDCallback_Seek) (
*/
EXPORT_SPEC int UpnpVirtualDir_set_SeekCallback(VDCallback_Seek callback);
/*!
* \brief Close callback function prototype.
*/
@ -2750,7 +2667,6 @@ typedef int (*VDCallback_Close)(
/*! [in] The handle of the file to close. */
UpnpWebFileHandle fileHnd);
/*!
* \brief Sets the close callback function to be used to access a virtual
* directory.
@ -2761,7 +2677,6 @@ typedef int (*VDCallback_Close)(
*/
EXPORT_SPEC int UpnpVirtualDir_set_CloseCallback(VDCallback_Close callback);
/*!
* \brief Enables or disables the webserver.
*
@ -2773,7 +2688,6 @@ EXPORT_SPEC int UpnpEnableWebserver(
/*! [in] \c TRUE to enable, \c FALSE to disable. */
int enable);
/*!
* \brief Returns \c TRUE if the webserver is enabled, or \c FALSE if it is not.
*
@ -2783,7 +2697,6 @@ EXPORT_SPEC int UpnpEnableWebserver(
*/
EXPORT_SPEC int UpnpIsWebserverEnabled(void);
/*!
* \brief Adds a virtual directory mapping.
*
@ -2802,7 +2715,6 @@ EXPORT_SPEC int UpnpAddVirtualDir(
/*! [in] The name of the new directory mapping to add. */
const char *dirName);
/*!
* \brief Removes a virtual directory mapping made with \b UpnpAddVirtualDir.
*
@ -2814,24 +2726,17 @@ EXPORT_SPEC int UpnpRemoveVirtualDir(
/*! [in] The name of the virtual directory mapping to remove. */
const char *dirName);
/*!
* \brief Removes all virtual directory mappings.
*/
EXPORT_SPEC void UpnpRemoveAllVirtualDirs(void);
/* @} Web Server API */
#ifdef __cplusplus
}
#endif /* __cplusplus */
/* @} UPnPAPI UPnP API */
#endif /* UPNP_H */

View File

@ -29,49 +29,24 @@
*
******************************************************************************/
#include "config.h"
/*!
* \addtogroup UPnPAPI
*
* @{
*
* \file
*/
#include <sys/stat.h>
#include <assert.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
/* Do not include these files */
#else
#include <sys/param.h>
#if defined(__sun)
#include <fcntl.h>
#include <sys/sockio.h>
#elif defined(BSD) && BSD >= 199306
#include <ifaddrs.h>
/* Do not move or remove the include below for "sys/socket"!
* Will break FreeBSD builds. */
#include <sys/socket.h>
#endif
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/types.h>
#endif
#include "config.h"
#include "upnpapi.h"
#include "httpreadwrite.h"
#include "membuffer.h"
#include "ssdplib.h"
#include "soaplib.h"
#include "ThreadPool.h"
#include "sysdep.h"
#include "ThreadPool.h"
#include "UpnpStdInt.h"
#include "UpnpUniStd.h" /* for close() */
#include "uuid.h"
@ -87,6 +62,21 @@
#include "webserver.h"
#endif /* INTERNAL_WEB_SERVER */
#include <sys/stat.h>
#include <assert.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
/* Do not include these files */
#else
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/types.h>
#endif
#ifndef IN6_IS_ADDR_GLOBAL
#define IN6_IS_ADDR_GLOBAL(a) \
(((((__const uint8_t *) (a))[0] & htonl(0xff000000)) <= htonl(0x3f000000) \
@ -3982,3 +3972,4 @@ int UpnpSetMaxContentLength(size_t contentLength)
return errCode;
}
/* @} UPnPAPI */

View File

@ -61,7 +61,6 @@
#else
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/utsname.h>

View File

@ -30,6 +30,10 @@
**************************************************************************/
/*!
* \addtogroup Sock
*
* @{
*
* \file
*
* \brief Implements the sockets functionality.
@ -52,7 +56,7 @@
#define MSG_NOSIGNAL 0
#endif
int sock_init(OUT SOCKINFO *info, IN SOCKET sockfd)
int sock_init(SOCKINFO *info, SOCKET sockfd)
{
assert(info);
@ -62,8 +66,8 @@ int sock_init(OUT SOCKINFO *info, IN SOCKET sockfd)
return UPNP_E_SUCCESS;
}
int sock_init_with_ip(OUT SOCKINFO *info, IN SOCKET sockfd,
IN struct sockaddr *foreign_sockaddr)
int sock_init_with_ip(SOCKINFO *info, SOCKET sockfd,
struct sockaddr *foreign_sockaddr)
{
int ret;
@ -78,7 +82,7 @@ int sock_init_with_ip(OUT SOCKINFO *info, IN SOCKET sockfd,
return UPNP_E_SUCCESS;
}
int sock_destroy(INOUT SOCKINFO *info, int ShutdownMethod)
int sock_destroy(SOCKINFO *info, int ShutdownMethod)
{
int ret = UPNP_E_SUCCESS;
@ -103,16 +107,16 @@ int sock_destroy(INOUT SOCKINFO *info, int ShutdownMethod)
* \li \c UPNP_E_SOCKET_ERROR - Error on socket calls
*/
static int sock_read_write(
/*! Socket Information Object. */
IN SOCKINFO *info,
/*! Buffer to get data to or send data from. */
OUT char *buffer,
/*! Size of the buffer. */
IN int bufsize,
/*! timeout value. */
IN int *timeoutSecs,
/*! Boolean value specifying read or write option. */
IN int bRead)
/*! [in] Socket Information Object. */
SOCKINFO *info,
/*! [out] Buffer to get data to or send data from. */
char *buffer,
/*! [in] Size of the buffer. */
int bufsize,
/*! [in] timeout value. */
int *timeoutSecs,
/*! [in] Boolean value specifying read or write option. */
int bRead)
{
int retCode;
fd_set readSet;
@ -196,15 +200,14 @@ static int sock_read_write(
return (int)numBytes;
}
int sock_read(IN SOCKINFO *info, OUT char *buffer, IN int bufsize,
INOUT int *timeoutSecs)
int sock_read(SOCKINFO *info, char *buffer, int bufsize, int *timeoutSecs)
{
return sock_read_write(info, buffer, bufsize, timeoutSecs, TRUE);
}
int sock_write(IN SOCKINFO *info, IN const char *buffer, IN int bufsize,
INOUT int *timeoutSecs)
int sock_write(SOCKINFO *info, const char *buffer, int bufsize, int *timeoutSecs)
{
/* Consciently removing constness. */
return sock_read_write(info, (char *)buffer, bufsize, timeoutSecs, FALSE);
}
@ -240,3 +243,5 @@ int sock_make_no_blocking(SOCKET sock)
#endif /* WIN32 */
return 0;
}
/* @} Sock */

View File

@ -33,20 +33,15 @@
**************************************************************************/
/*!
* \file
*
* \defgroup Sock Network Socket Library
*
* @{
*
* \file
*/
#include "upnputil.h"
#ifdef WIN32
/* Do not #include <netinet/in.h> */
#else
#include <netinet/in.h>
#endif
#include "UpnpInet.h" /* for SOCKET, netinet/in */
#include "UpnpGlobal.h" /* for UPNP_INLINE */
/* The following are not defined under winsock.h */
#ifndef SD_RECEIVE
@ -95,10 +90,10 @@ static UPNP_INLINE int sock_close(
* \li \c UPNP_E_SOCKET_ERROR
*/
int sock_init(
/*! Socket Information Object. */
OUT SOCKINFO *info,
/*! Socket Descriptor. */
IN SOCKET sockfd);
/*! [out] Socket Information Object. */
SOCKINFO *info,
/*! [in] Socket Descriptor. */
SOCKET sockfd);
/*!
* \brief Calls the sock_init function and assigns the passed in IP address
@ -110,12 +105,12 @@ int sock_init(
* \li \c UPNP_E_SOCKET_ERROR
*/
int sock_init_with_ip(
/*! Socket Information Object. */
OUT SOCKINFO* info,
/*! Socket Descriptor. */
IN SOCKET sockfd,
/*! Remote socket address. */
IN struct sockaddr *foreign_sockaddr);
/*! [out] Socket Information Object. */
SOCKINFO* info,
/*! [in] Socket Descriptor. */
SOCKET sockfd,
/*! [in] Remote socket address. */
struct sockaddr *foreign_sockaddr);
/*!
* \brief Shutsdown the socket using the ShutdownMethod to indicate whether
@ -129,9 +124,9 @@ int sock_init_with_ip(
* \li \c UPNP_E_SUCCESS on success.
*/
int sock_destroy(
/*! Socket Information Object. */
INOUT SOCKINFO* info,
/*! How to shutdown the socket. Used by sockets's shutdown(). */
/*! [in,out] Socket Information Object. */
SOCKINFO* info,
/*! [in] How to shutdown the socket. Used by sockets's shutdown(). */
int ShutdownMethod);
/*!
@ -143,14 +138,14 @@ int sock_destroy(
* \li \c UPNP_E_SOCKET_ERROR - Error on socket calls.
*/
int sock_read(
/*! Socket Information Object. */
IN SOCKINFO *info,
/*! Buffer to get data to. */
OUT char* buffer,
/*! Size of the buffer. */
IN int bufsize,
/*! timeout value. */
INOUT int *timeoutSecs);
/*! [in] Socket Information Object. */
SOCKINFO *info,
/*! [out] Buffer to get data to. */
char* buffer,
/*! [in] Size of the buffer. */
int bufsize,
/*! [in,out] timeout value. */
int *timeoutSecs);
/*!
* \brief Writes data on the socket in sockinfo.
@ -161,14 +156,14 @@ int sock_read(
* \li \c UPNP_E_SOCKET_ERROR - Error on socket calls.
*/
int sock_write(
/*! Socket Information Object. */
IN SOCKINFO *info,
/*! Buffer to send data from. */
IN const char *buffer,
/*! Size of the buffer. */
IN int bufsize,
/*! timeout value. */
INOUT int *timeoutSecs);
/*! [in] Socket Information Object. */
SOCKINFO *info,
/*! [in] Buffer to send data from. */
const char *buffer,
/*! [in] Size of the buffer. */
int bufsize,
/*! [in,out] timeout value. */
int *timeoutSecs);
/*!
* \brief Make socket blocking.

View File

@ -53,7 +53,6 @@
#ifdef WIN32
#else /* WIN32 */
#include <syslog.h>
#include <sys/socket.h>
#ifndef __APPLE__
#include <netinet/in_systm.h>
#include <netinet/ip.h>

View File

@ -40,8 +40,6 @@
typedef int socklen_t;
#define EAFNOSUPPORT 97
#else
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#endif

View File

@ -1,3 +1,6 @@
#ifndef UTIL_H
#define UTIL_H
/*******************************************************************************
*
* Copyright (c) 2000-2003 Intel Corporation
@ -29,9 +32,6 @@
*
******************************************************************************/
#ifndef UTIL_H
#define UTIL_H
/*!
* \file
*/

View File

@ -48,16 +48,12 @@
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#if defined(BSD)
#include <sys/socket.h>
#endif
#include <sys/types.h>
#include <time.h>
#ifdef WIN32
#include "inet_pton.h"
#else
#include <arpa/inet.h> /* for inet_pton() */
#include <netdb.h> /* for struct addrinfo */
#endif

View File

@ -36,17 +36,8 @@
#include "UpnpInet.h"
#ifdef WIN32
#else
#include <arpa/inet.h>
#include <sys/socket.h>
#endif
/* functions available only if the web server is included */
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -29,10 +29,12 @@
*
**************************************************************************/
/*!
* \file
*/
#include "config.h"
#include "membuffer.h"
#include "unixutil.h"
#include "upnp.h"
@ -43,19 +45,14 @@
#include "upnputil.h"
#include "webserver.h"
#include <assert.h>
#include <stdio.h>
#ifdef WIN32
#else
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#endif
/************************************************************************
* Function : addrToString
*