⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upnp.h

📁 原来由英特尔制定的UPnP SDK的
💻 H
📖 第 1 页 / 共 5 页
字号:
/******************************************************************************* * * 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 UPNP_H#define UPNP_H/** @name The API *//*! @{ */#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64	#if defined __GNUC__		#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE	#else		#error  libupnp requires largefile mode - use AC_SYS_LARGEFILE	#endif#endif #include <stdio.h>#ifndef WIN32	#include <sys/param.h>#endif#if (defined(BSD) && BSD >= 199306)	#include <time.h>#endif#include "ixml.h"#include "upnpconfig.h"#ifdef WIN32	#ifndef UPNP_STATIC_LIB		#ifdef LIBUPNP_EXPORTS			/* set up declspec for dll export to make functions visible to library users */			#define EXPORT_SPEC __declspec(dllexport)		#else			#define EXPORT_SPEC __declspec(dllimport)		#endif	#else		#define EXPORT_SPEC	#endif	#ifdef UPNP_USE_MSVCPP		/* define some things the M$ VC++ doesn't know */		#define UPNP_INLINE		typedef __int64 int64_t;		#define PRId64 "I64d"		#define PRIzu "lu"	#endif	#ifdef UPNP_USE_BCBPP		/* define some things Borland Builder doesn't know */		#define UPNP_INLINE inline		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"	#endif#else	#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"#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	#define UpnpCloseSocket close#else	#define UpnpCloseSocket closesocket	#define fseeko fseek#endif#ifndef WIN32	#define SOCKET int#endif#ifndef WIN32	#include <netinet/in.h>#else	#include <winsock2.h>	#include <time.h>#endif#include <sys/types.h>#define NUM_HANDLE 200#define LINE_SIZE  180#define NAME_SIZE  256#define MNFT_NAME_SIZE  64#define MODL_NAME_SIZE  32#define SERL_NUMR_SIZE  64#define MODL_DESC_SIZE  64#define UPNP_INFINITE -1#define UPNP_USING_CHUNKED			-3#define UPNP_UNTIL_CLOSE			-4/** @name Error codes  *  The functions in the SDK API can return a variety of error  *  codes to describe problems encountered during execution.  This section  *  lists the error codes and provides a brief description of what each error  *  code means.  Refer to the documentation for each function for a  *  description of what an error code means in that context. *//*! @{ *//** @name UPNP_E_SUCCESS [0] *  {\tt UPNP_E_SUCCESS} signifies that the operation completed successfully. *  For asynchronous functions, this only means that the packet generated by  *  the operation was successfully transmitted on the network.  The result of  *  the entire operation comes as part of the callback for that operation. *//*! @{ */#define UPNP_E_SUCCESS          0/*! @} *//** @name UPNP_E_INVALID_HANDLE [-100] *  {\tt UPNP_E_INVALID_HANDLE} signifies that the handle passed to a  *  function is not a recognized as a valid handle. *//*! @{ */#define UPNP_E_INVALID_HANDLE   -100/*! @} *//** @name UPNP_E_INVALID_PARAM [-101] *  {\tt UPNP_E_INVALID_PARAM} signifies that one or more of the parameters  *  passed to the function is not valid.  Refer to the documentation for each  *  function for more information on the valid ranges of the parameters. *//*! @{ */#define UPNP_E_INVALID_PARAM    -101/*! @} *//** @name UPNP_E_OUTOF_HANDLE [-102] *  {\tt UPNP_E_OUTOF_HANDLE} signifies that the SDK does not have any *  more space for additional handles.  The SDK allocates space for only  *  a few handles in order to conserve memory. *//*! @{ */#define UPNP_E_OUTOF_HANDLE     -102/*! @} */#define UPNP_E_OUTOF_CONTEXT    -103/** @name UPNP_E_OUTOF_MEMORY [-104] *  {\tt UPNP_E_OUTOF_MEMORY} signifies that not enough resources are  *  currently available to complete the operation.  Most operations require  *  some free memory in order to complete their work. *//*! @{ */#define UPNP_E_OUTOF_MEMORY     -104/*! @} *//** @name UPNP_E_INIT [-105] *  {\tt UPNP_E_INIT} signifies that the SDK has already been  *  initialized.  The SDK needs to be initialied only once per process. *  Any additional initialization attempts simply return this error with *  no other ill effects. *//*! @{ */#define UPNP_E_INIT             -105/*! @} */#define UPNP_E_BUFFER_TOO_SMALL -106/** @name UPNP_E_INVALID_DESC [-107] *  {\tt UPNP_E_INVALID_DESC} signifies that the description document passed *  to {\bf UpnpRegisterRootDevice} or {\bf UpnpRegisterRootDevice2} is an  *  invalid description document.   *//*! @{ */#define UPNP_E_INVALID_DESC     -107/*! @} *//** @name UPNP_E_INVALID_URL [-108] *  {\tt UPNP_E_INVALID_URL} signifies that a URL passed into the function *  is invalid.  The actual cause is function specific, but in general, the *  URL itself might be malformed (e.g. have invalid characters in it) or *  the host might be unreachable. *//*! @{ */#define UPNP_E_INVALID_URL      -108/*! @} */#define UPNP_E_INVALID_SID      -109#define UPNP_E_INVALID_DEVICE   -110/** @name UPNP_E_INVALID_SERVICE [-111] *  {\tt UPNP_E_INVALID_SERVICE} is returned only by {\bf UpnpNotify},  *  {\bf UpnpNotifyExt}, {\bf UpnpAcceptSubscription}, and  *  {\bf UpnpAcceptSubscriptionExt} to signify that the device ID/service *  ID pair does not refer to a valid service. *//*! @{ */#define UPNP_E_INVALID_SERVICE  -111/*! @} *//** @name UPNP_E_BAD_RESPONSE [-113] *  {\tt UPNP_E_BAD_RESPONSE} signifies that the response received from the  *  remote side of a connection is not correct for the protocol.  This applies *  to the GENA, SOAP, and HTTP protocols. *//*! @{ */#define UPNP_E_BAD_RESPONSE     -113/*! @} */#define UPNP_E_BAD_REQUEST      -114/** @name UPNP_E_INVALID_ACTION [-115] *  {\tt UPNP_E_INVALID_ACTION} signifies that the SOAP action message is  *  invalid.  This can be because the DOM document passed to the function was *  malformed or the action message is not correct for the given action. *//*! @{ */#define UPNP_E_INVALID_ACTION   -115/*! @} *//** @name UPNP_E_FINISH [-116] *  {\tt UPNP_E_FINISH} signifies that {\bf UpnpInit} has not been called, or *  that {\bf UpnpFinish} has already been called.  None of the API functions  *  operate until {\bf UpnpInit} successfully completes. *//*! @{ */#define UPNP_E_FINISH           -116/*! @} *//** @name UPNP_E_INIT_FAILED [-117] *  {\tt UPNP_E_INIT_FAILED} signifies that {\bf UpnpInit} cannot complete.   *  The typical reason is failure to allocate sufficient resources. *//*! @{ */#define UPNP_E_INIT_FAILED      -117/*! @} *//** @name UPNP_E_URL_TOO_BIG [-118] *  {\tt UPNP_E_URL_TOO_BIG} signifies that the URL passed into a function  *  is too long.  The SDK limits URLs to 180 characters in length.   */#define UPNP_E_URL_TOO_BIG      -118/** @name UPNP_E_BAD_HTTPMSG [-119] *  {\tt UPNP_E_BAD_HTTPMSG} signifies that the HTTP message contains invalid *  message headers.  The error always refers to the HTTP message header  *  received from the remote host.  The main areas where this occurs are in *  SOAP control messages (e.g. {\bf UpnpSendAction}), GENA subscription *  message (e.g. {\bf UpnpSubscribe}), GENA event notifications (e.g. {\bf *  UpnpNotify}), and HTTP transfers (e.g. {\bf UpnpDownloadXmlDoc}). *//*! @{ */#define UPNP_E_BAD_HTTPMSG      -119/*! @} *//** @name UPNP_E_ALREADY_REGISTERED [-120] *  {\tt UPNP_E_ALREADY_REGISTERED} signifies that a client or a device is *  already registered.  The SDK currently has a limit of one registered  *  client and one registered device per process. *//*! @{ */#define UPNP_E_ALREADY_REGISTERED -120/*! @} *//** @name UPNP_E_NETWORK_ERROR [-200] *  {\tt UPNP_E_NETWORK_ERROR} signifies that a network error occurred.  It  *  is the generic error code for network problems that are not covered under  *  one of the more specific error codes.  The typical meaning is the SDK  *  failed to read the local IP address or had problems configuring one of *  the sockets. *//*! @{ */#define UPNP_E_NETWORK_ERROR    -200/*! @} *//** @name UPNP_E_SOCKET_WRITE [-201] *  {\tt UPNP_E_SOCKET_WRITE} signifies an error writing to a socket.  This *  occurs in any function that makes network connections, such  *  as discovery (e.g. {\bf UpnpSearchAsync} or {\bf UpnpSendAdvertisement}),  *  control (e.g. {\bf UpnpSendAction}), eventing (e.g. {\bf UpnpNotify}),  *  and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}). *//*! @{ */#define UPNP_E_SOCKET_WRITE     -201/*! @} *//** @name UPNP_E_SOCKET_READ [-202] *  {\tt UPNP_E_SOCKET_READ} signifies an error reading from a socket.  This *  occurs in any function that makes network connections, such  *  as discovery (e.g. {\bf UpnpSearchAsync} or {\bf UpnpSendAdvertisement}),  *  control (e.g. {\bf UpnpSendAction}), eventing (e.g. {\bf UpnpNotify}),  *  and HTTP functions (e.g. {\bf UpnpDownloadXmlDoc}). *//*! @{ */#define UPNP_E_SOCKET_READ      -202/*! @} *//** @name UPNP_E_SOCKET_BIND [-203] *  {\tt UPNP_E_SOCKET_BIND} signifies that the SDK had a problem binding *  a socket to a network interface.  This occurs in any function that makes  *  network connections, such as discovery (e.g. {\bf UpnpSearchAsync} or  *  {\bf UpnpSendAdvertisement}), control (e.g. {\bf UpnpSendAction}), eventing  *  (e.g. {\bf UpnpNotify}), and HTTP functions (e.g.  *  {\bf UpnpDownloadXmlDoc}). */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -