00001 00002 // 00003 // Copyright (c) 2000-2003 Intel Corporation 00004 // All rights reserved. 00005 // 00006 // Redistribution and use in source and binary forms, with or without 00007 // modification, are permitted provided that the following conditions are met: 00008 // 00009 // * Redistributions of source code must retain the above copyright notice, 00010 // this list of conditions and the following disclaimer. 00011 // * Redistributions in binary form must reproduce the above copyright notice, 00012 // this list of conditions and the following disclaimer in the documentation 00013 // and/or other materials provided with the distribution. 00014 // * Neither name of Intel Corporation nor the names of its contributors 00015 // may be used to endorse or promote products derived from this software 00016 // without specific prior written permission. 00017 // 00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00020 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00021 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR 00022 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00025 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00026 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00027 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 // 00031 00032 #ifndef _CLIENT_TABLE 00033 #define _CLIENT_TABLE 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 #include "upnp.h" 00040 00041 #include <stdio.h> 00042 #include <stdlib.h> 00043 #include <time.h> 00044 #include "uri.h" 00045 #include "service_table.h" 00046 00047 #include "TimerThread.h" 00048 #include "upnp_timeout.h" 00049 00050 extern TimerThread gTimerThread; 00051 00052 CLIENTONLY( 00053 typedef struct CLIENT_SUBSCRIPTION { 00054 Upnp_SID sid; 00055 char * ActualSID; 00056 char * EventURL; 00057 int RenewEventId; 00058 struct CLIENT_SUBSCRIPTION * next; 00059 } client_subscription; 00060 00061 /************************************************************************ 00062 * Function : copy_client_subscription 00063 * 00064 * Parameters : 00065 * client_subscription * in ; - source client subscription 00066 * client_subscription * out ; - destination client subscription 00067 * 00068 * Description : Make a copy of the client subscription data 00069 * 00070 * Return : int ; 00071 * UPNP_E_OUTOF_MEMORY - On Failure to allocate memory 00072 * HTTP_SUCCESS - On Success 00073 * 00074 * Note : 00075 ************************************************************************/ 00076 int copy_client_subscription(client_subscription * in, client_subscription * out); 00077 00078 /************************************************************************ 00079 * Function : free_client_subscription 00080 * 00081 * Parameters : 00082 * client_subscription * sub ; - Client subscription to be freed 00083 * 00084 * Description : Free memory allocated for client subscription data. 00085 * Remove timer thread associated with this subscription event. 00086 * 00087 * Return : void ; 00088 * 00089 * Note : 00090 ************************************************************************/ 00091 void free_client_subscription(client_subscription * sub); 00092 00093 00094 /************************************************************************ 00095 * Function : freeClientSubList 00096 * 00097 * Parameters : 00098 * client_subscription * list ; Client subscription 00099 * 00100 * Description : Free the client subscription table. 00101 * 00102 * Return : void ; 00103 * 00104 * Note : 00105 ************************************************************************/ 00106 void freeClientSubList(client_subscription * list); 00107 00108 /************************************************************************ 00109 * Function : RemoveClientSubClientSID 00110 * 00111 * Parameters : 00112 * client_subscription **head ; Head of the subscription list 00113 * const Upnp_SID sid ; Subscription ID to be mactched 00114 * 00115 * Description : Remove the client subscription matching the 00116 * subscritpion id represented by the const Upnp_SID sid parameter 00117 * from the table and update the table. 00118 * 00119 * Return : void ; 00120 * 00121 * Note : 00122 ************************************************************************/ 00123 void RemoveClientSubClientSID(client_subscription **head, 00124 const Upnp_SID sid); 00125 00126 /************************************************************************ 00127 * Function : GetClientSubClientSID 00128 * 00129 * Parameters : 00130 * client_subscription *head ; Head of the subscription list 00131 * const Upnp_SID sid ; Subscription ID to be matched 00132 * 00133 * Description : Return the client subscription from the client table 00134 * that matches const Upnp_SID sid subscrition id value. 00135 * 00136 * Return : client_subscription * ; The matching subscription 00137 * 00138 * Note : 00139 ************************************************************************/ 00140 client_subscription * GetClientSubClientSID(client_subscription *head 00141 , const Upnp_SID sid); 00142 00143 /************************************************************************ 00144 * Function : GetClientSubActualSID 00145 * 00146 * Parameters : 00147 * client_subscription *head ; Head of the subscription list 00148 * token * sid ; Subscription ID to be matched 00149 * 00150 * Description : Returns the client subscription from the client 00151 * subscription table that has the matching token * sid buffer 00152 * value. 00153 * 00154 * Return : client_subscription * ; The matching subscription 00155 * 00156 * Note : 00157 ************************************************************************/ 00158 client_subscription * GetClientSubActualSID(client_subscription *head 00159 , token * sid); 00160 ) 00161 00162 #ifdef __cplusplus 00163 } 00164 #endif 00165 00166 #endif /* _CLIENT_TABLE */
1.6.1