?? upnp.h
字號:
/////////////////////////////////////////////////////////////////////////////// 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 *///@{#include <stdio.h>#include "ixml.h"#include "config.h"#define max(a, b) (((a)>(b))? (a):(b))#define min(a, b) (((a)<(b))? (a):(b))#define UpnpCloseSocket close#define UPNP_SOCKETERROR -1#define UPNP_INVALID_SOCKET -1#define SOCKET int#include <netinet/in.h>#define NUM_HANDLE 200#define LINE_SIZE 180#define NAME_SIZE 100#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}). *///@{#define UPNP_E_SOCKET_BIND -203//@}/** @name UPNP_E_SOCKET_CONNECT [-204] * {\tt UPNP_E_SOCKET_CONNECT} signifies that the SDK had a problem * connecting to a remote host. 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_CONNECT -204//@}/** @name UPNP_E_OUTOF_SOCKET [-205] * {\tt UPNP_E_OUTOF_SOCKET} signifies that the SDK cannot create any * more sockets. 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_OUTOF_SOCKET -205//@}/** @name UPNP_E_LISTEN [-206] * {\tt UPNP_E_LISTEN} signifies that the SDK had a problem setting the * socket to listen for incoming connections. This error only happens during * initialization (i.e. {\bf UpnpInit}). *///@{#define UPNP_E_LISTEN -206//@}/** @name UPNP_E_TIMEDOUT [-207] * {\tt UPNP_E_TIMEDOUT} signifies that too much time elapsed before the * required number of bytes were sent or received over a socket. This error * can be returned by any function that performs network operations. *///@{#define UPNP_E_TIMEDOUT -207//@}/** @name UPNP_E_SOCKET_ERROR [-208] * {\tt UPNP_E_SOCKET_ERROR} is the generic socket error code for * conditions not covered by other error codes. This error can be returned * by any functions that performs network operations. *///@{#define UPNP_E_SOCKET_ERROR -208//@}#define UPNP_E_FILE_WRITE_ERROR -209#define UPNP_E_EVENT_PROTOCOL -300/** @name UPNP_E_SUBSCRIBE_UNACCEPTED [-301] * {\tt UPNP_E_SUBSCRIBE_UNACCEPTED} signifies that a subscription * request was rejected from the remote side. */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -