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

📄 upnp.h

📁 开发upnp 时的底层库,可以运行,主要是实现了upnp的底层协议 !
💻 H
📖 第 1 页 / 共 5 页
字号:
  /** The result of the operation. */  int ErrCode;  /** The control URL for service. */  char CtrlUrl[NAME_SIZE];  /** The DOM document describing the action. */  IXML_Document *ActionRequest;  /** The DOM document describing the result of the action. */  IXML_Document *ActionResult;};/** Represents the request for current value of a state variable in a service *  state table.  */struct Upnp_State_Var_Request{  /** The result of the operation. */  int ErrCode;  /** The socket number of the connection to the requestor. */  int Socket;  /** The error string in case of error. */  char ErrStr[LINE_SIZE];  /** The unique device ID. */  char DevUDN[NAME_SIZE];  /** The  service ID. */  char ServiceID[NAME_SIZE];  /** The name of the variable. */  char StateVarName[NAME_SIZE];  /** IP address of sender requesting the state variable. */  struct in_addr CtrlPtIPAddr;  /** The current value of the variable. This needs to be allocated by    *  the caller.  When finished with it, the SDK frees this {\bf DOMString}. */  DOMString CurrentVal;};/** Represents the reply for the current value of a state variable in an    asynchronous call. */struct Upnp_State_Var_Complete{  /** The result of the operation. */  int ErrCode;  /** The control URL for the service. */  char CtrlUrl[NAME_SIZE];  /** The name of the variable. */  char StateVarName[NAME_SIZE];  /** The current value of the variable or error string in case of error. */  DOMString CurrentVal;};/** Returned along with a {\bf UPNP_EVENT_RECEIVED} callback.  */struct Upnp_Event{  /** The subscription ID for this subscription. */  Upnp_SID Sid;  /** The event sequence number. */  int EventKey;  /** The DOM tree representing the changes generating the event. */  IXML_Document *ChangedVariables;};//// This typedef is required by Doc++ to parse the last entry of the // Upnp_Discovery structure correctly.//typedef struct sockaddr_in SOCKADDRIN;/** Returned in a {\bf UPNP_DISCOVERY_RESULT} callback. */struct Upnp_Discovery{  /** The result code of the {\bf UpnpSearchAsync} call. */  int  ErrCode;                  				       /** The expiration time of the advertisement. */  int  Expires;                                                         /** The unique device identifier. */  char DeviceId[LINE_SIZE];        /** The device type. */  char DeviceType[LINE_SIZE];      /** The service type. */  char ServiceType[LINE_SIZE];  /** The service version. */  char ServiceVer[LINE_SIZE];      /** The URL to the UPnP description document for the device. */  char Location[LINE_SIZE];        /** The operating system the device is running. */  char Os[LINE_SIZE];            				       /** Date when the response was generated. */  char Date[LINE_SIZE];            				       /** Confirmation that the MAN header was understood by the device. */  char Ext[LINE_SIZE];           				       /** The host address of the device responding to the search. */  SOCKADDRIN * DestAddr; };/** Returned along with a {\bf UPNP_EVENT_SUBSCRIBE_COMPLETE} or {\bf * UPNP_EVENT_UNSUBSCRIBE_COMPLETE} callback.  */struct Upnp_Event_Subscribe {  /** The SID for this subscription.  For subscriptions, this only   *  contains a valid SID if the {\bf Upnp_EventSubscribe.result} field   *  contains a {\tt UPNP_E_SUCCESS} result code.  For unsubscriptions,   *  this contains the SID from which the subscription is being   *  unsubscribed.  */  Upnp_SID Sid;              /** The result of the operation. */  int ErrCode;                /** The event URL being subscribed to or removed from. */  char PublisherUrl[NAME_SIZE];   /** The actual subscription time (for subscriptions only). */  int TimeOut;                                            };  /** Returned along with a {\bf UPNP_EVENT_SUBSCRIPTION_REQUEST} *  callback.  */struct Upnp_Subscription_Request{  /** The identifier for the service being subscribed to. */  char *ServiceId;   /** Universal device name. */  char *UDN;         /** The assigned subscription ID for this subscription. */  Upnp_SID Sid;};struct File_Info{  /** The length of the file. A length less than 0 indicates the size    *  is unknown, and data will be sent until 0 bytes are returned from   *  a read call. */  int file_length;  /** The time at which the contents of the file was modified;   *  The time system is always local (not GMT). */  time_t last_modified;  /** If the file is a directory, {\bf is_directory} contains   * a non-zero value. For a regular file, it should be 0. */  int is_directory;  /** If the file or directory is readable, this contains    * a non-zero value. If unreadable, it should be set to 0. */  int is_readable;  /** The content type of the file. This string needs to be allocated    *  by the caller using {\bf ixmlCloneDOMString}.  When finished    *  with it, the SDK frees the {\bf DOMString}. */     DOMString content_type;};/* The type of handle returned by the web server for open requests. */typedef void *UpnpWebFileHandle;/** The {\bf UpnpVirtualDirCallbacks} structure contains the pointers to *  file-related callback functions a device application can register to *  virtualize URLs.   */struct UpnpVirtualDirCallbacks{  /** Called by the web server to query information on a file.  The callback   *  should return 0 on success or -1 on an error. */  int (*get_info) (    IN  const char *filename,     /** The name of the file to query. */    OUT struct File_Info *info    /** Pointer to a structure to store the                                       information on the file. */    );                                    /** Called by the web server to open a file.  The callback should return   *  a valid handle if the file can be opened.  Otherwise, it should return   *  {\tt NULL} to signify an error. */  UpnpWebFileHandle (*open)(    IN const char *filename,       /** The name of the file to open. */     IN enum UpnpOpenFileMode Mode  /** The mode in which to open the file.                                        Valid values are {\tt UPNP_READ} or                                        {\tt UPNP_WRITE}. */    );  /** Called by the web server to perform a sequential read from an open   *  file.  The callback should copy {\bf buflen} bytes from the file into   *  the buffer.   *  @return [int] An integer representing one of the following:   *    \begin{itemize}   *      \item {\tt 0}:  The file contains no more data (EOF).   *      \item {\tt >0}: A successful read of the number of bytes in the    *                      return code.   *      \item {\tt <0}: An error occurred reading the file.   *    \end{itemzie}   */   int (*read) (     IN UpnpWebFileHandle fileHnd,  /** The handle of the file to read. */     OUT char *buf,                 /** The buffer in which to place the 				        data. */     IN size_t buflen               /** The size of the buffer (i.e. the                                         number of bytes to read). */     );  /** Called by the web server to perform a sequential write to an open   *  file.  The callback should write {\bf buflen} bytes into the file from   *  the buffer.  It should return the actual number of bytes written,    *  which might be less than {\bf buflen} in the case of a write error.   */   int (*write) (     IN UpnpWebFileHandle fileHnd, /** The handle of the file to write. */     IN char *buf,                 /** The buffer with the bytes to write. */     IN size_t buflen              /** The number of bytes to write. */     );  /** Called by the web server to move the file pointer, or offset, into   *  an open file.  The {\bf origin} parameter determines where to start   *  moving the file pointer.  A value of {\tt SEEK_CUR} moves the   *  file pointer relative to where it is.  The {\bf offset} parameter can   *  be either positive (move forward) or negative (move backward).     *  {\tt SEEK_END} moves relative to the end of the file.  A positive    *  {\bf offset} extends the file.  A negative {\bf offset} moves backward    *  in the file.  Finally, {\tt SEEK_SET} moves to an absolute position in    *  the file. In this case, {\bf offset} must be positive.  The callback    *  should return 0 on a successful seek or a non-zero value on an error.   */   int (*seek) (     IN UpnpWebFileHandle fileHnd,  /** The handle of the file to move the                                         file pointer. */     IN long offset,                /** The number of bytes to move in the                                         file.  Positive values move foward and                                         negative values move backward.  Note                                         that this must be positive if the                                         {\bf origin} is {\tt SEEK_SET}. */     IN int origin                  /** The position to move relative to.  It                                         can be {\tt SEEK_CUR} to move relative                                         to the current position, 					{\tt SEEK_END} to move relative to 					the end of the file, or {\tt 					SEEK_SET} to specify an absolute 					offset. */     );   /** Called by the web server to close a file opened via the {\bf open}    *  callback.  It should return 0 on success, or a non-zero value on an     *  error.    */   int (*close) (     IN UpnpWebFileHandle fileHnd   /** The handle of the file to close. */     );};typedef struct virtual_Dir_List{    struct virtual_Dir_List *next;    char dirName[NAME_SIZE];} virtualDirList;/** 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 *  needs to persist.  This callback function needs to be thread *  safe.  The context of the callback is always on a valid thread  *  context and standard synchronization methods can be used.  Note,  *  however, because of this the callback cannot call SDK functions *  unless explicitly noted. * *  \begin{verbatim}      int CallbackFxn( Upnp_EventType EventType, void* Event, void* Cookie );    \end{verbatim}  * *  where {\bf EventType} is the event that triggered the callback,  *  {\bf Event} is a structure that denotes event-specific information for that *  event, and {\bf Cookie} is the user data passed when the callback was *  registered. * *  See {\bf Upnp_EventType} for more information on the callback values and *  the associated {\bf Event} parameter.   * *  The return value of the callback is currently ignored.  It may be used *  in the future to communicate results back to the SDK. */typedef int  (*Upnp_FunPtr) (    IN Upnp_EventType EventType,     IN void *Event,     IN void *Cookie    );//@} // Constants, Structures, and Types#ifdef __cplusplusextern "C" {#endif // __cplusplus///@name Initialization and Registration

⌨️ 快捷键说明

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