00001 /* 00002 * Copyright 2003-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * 00017 * @author Sanjaya Singharage (sanjayasing@opensource.lk) 00018 * @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com) 00019 * 00020 */ 00021 #ifdef WIN32 00022 #pragma warning (disable : 4786) 00023 #endif 00024 00025 #if !defined(__PACKET_H_OF_AXIS_INCLUDED__) 00026 #define __PACKET_H_OF_AXIS_INCLUDED__ 00027 00028 #include "GDefine.h" 00029 00030 typedef enum 00031 { 00032 SOAPACTION_HEADER, 00033 SERVICE_URI, 00034 OPERATION_NAME, 00035 SOAP_MESSAGE_LENGTH 00036 } AXIS_TRANSPORT_INFORMATION_TYPE; 00037 00038 /* 00039 * This structure is supposed to keep the streaming objects of the transport 00040 * such as iostream in c++, request_rec in apache module etc 00041 */ 00042 /*typedef struct 00043 { 00044 const void* ip_stream; 00045 const void* op_stream; 00046 } Ax_iostream; 00047 */ 00048 typedef enum 00049 { 00050 AXIS_HTTP_GET, 00051 AXIS_HTTP_POST, 00052 AXIS_HTTP_UNSUPPORTED 00053 } AXIS_HTTP_METHOD; 00054 00055 /* 00056 * This structure is used to keep string key/value pairs such as 00057 * http headers. set_header 00058 * function can be used to add headers to a Ax_soapstream 00059 */ 00060 typedef struct 00061 { 00062 char* headername; 00063 char* headervalue; 00064 } Ax_header; 00065 00066 /* 00067 typedef struct 00068 { 00069 char* uri_path; 00070 Ax_header* ip_headers; 00071 int ip_headercount; 00072 Ax_header* op_headers; 00073 int op_headercount; 00074 AXIS_HTTP_METHOD ip_method; 00075 AXIS_HTTP_METHOD op_method; 00076 } Ax_stream_http, Ax_stream_https; 00077 00078 typedef struct 00079 { 00080 int dummy; 00081 } Ax_stream_smtp; 00082 00083 typedef union 00084 { 00085 Ax_stream_http* http; 00086 Ax_stream_https* https; 00087 Ax_stream_smtp* smtp; 00088 void* other; 00089 } Ax_soapcontent; 00090 */ 00091 typedef enum 00092 { 00093 TRANSPORT_FINISHED=0, 00094 TRANSPORT_IN_PROGRESS, 00095 TRANSPORT_FAILED 00096 } AXIS_TRANSPORT_STATUS; 00097 00098 /* 00099 * Function pointer definitions for axis trasport module call backs 00100 */ 00101 00102 /* 00103 * This function is provided by the transport modules. 00104 * Called by Axis engine when it needs to send SOAP 00105 * message. This function may be called several times. 00106 * @param 00107 * 1st - null terminated character buffer to be sent 00108 * 2nd - buffer id which identifies the buffer 00109 * 3rd - Ax_soapstream object which act like a thread id 00110 * @return 00111 * TRANSPORT_FINISHED - Transport done and buffer is free to re-use. 00112 * TRANSPORT_IN_PROGRESS - Transport is in progress and buffer 00113 * cannot be re-used yet. 00114 * TRANSPORT_FAILED - Transport has failed and no use of trying to 00115 * send any more bytes. Better to abort. 00116 * Note: if the bufferid is NULL that indicates the buffer is a 00117 * temporary buffer and should not be retained. 00118 * So in this case the buffer should be immediately sent. 00119 */ 00120 typedef AXIS_TRANSPORT_STATUS 00121 (AXISCALL * AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES) 00122 (const char*, const void*, const void*); 00123 00124 /* 00125 * This function is provided by the transport modules. 00126 * Called by Axis engine when it needs to get SOAP 00127 * message. This function may be called several times. 00128 * @param 00129 * 1st - pointer to buffer pointer to which the transport's buffer is set 00130 * 2nd - pointer to an int to which the number of bytes read is set 00131 * 3rd - Ax_soapstream object which act like a thread id 00132 * @return 00133 * TRANSPORT_FINISHED - No any more message bytes to be received. 00134 * If a buffer is present it is the last 00135 * buffer. 00136 * TRANSPORT_IN_PROGRESS - There may be more message bytes to be received. 00137 * Axis Engine may call this 00138 * function again to get any subsequent message 00139 * buffers. Buffer should be present. 00140 * TRANSPORT_FAILED - Transport has failed and no use of trying to get any 00141 * more bytes. Better to abort. 00142 */ 00143 typedef AXIS_TRANSPORT_STATUS 00144 (AXISCALL * AXIS_MODULE_CALLBACK_GET_MESSAGE_BYTES) 00145 (const char**, int*, const void*); 00146 00147 /* 00148 * This function is provided by the transport modules. 00149 * Called by Axis engine when it needs to say the 00150 * transport module that the engine is no longer using the buffer 00151 * and can be re-used. 00152 * @param 00153 * 1st - buffer that Axis got from the transport layer. 00154 * 2nd - Ax_soapstream object which act like a thread id 00155 */ 00156 typedef void (AXISCALL * AXIS_MODULE_CALLBACK_RELEASE_RECEIVE_BUFFER) 00157 (const char*, const void*); 00158 00170 typedef void (AXISCALL * AXIS_MODULE_CALLBACK_SET_TRANSPORT_INFORMATION) 00171 (AXIS_TRANSPORT_INFORMATION_TYPE, const char*, const void*); 00172 00173 /* 00174 * This function is provided by the transport modules. 00175 * Called by Axis engine when it needs to get any 00176 * transport information such as http headers. 00177 * This function can be called only once. 00178 * @param 00179 * 1st - Transport information type to get 00180 * 2nd - Ax_soapstream object which act like a thread id 00181 */ 00182 typedef const char* (AXISCALL * AXIS_MODULE_CALLBACK_GET_TRANSPORT_INFORMATION) 00183 (AXIS_TRANSPORT_INFORMATION_TYPE, const void*); 00184 00185 /* 00186 * Function pointer definitions for axis call backs 00187 */ 00188 00189 /* 00190 * This function is provided by the Axis Engine. 00191 * Called by transport module when it needs to say that 00192 * a message buffer passed to it is no longer being used by the transport 00193 * and can be re-used by the 00194 * Axis engine.This function should be called for each buffer 00195 * if AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES 00196 * returned TRANSPORT_IN_PROGRESS. 00197 * @param 00198 * 1st - buffer that Axis gave to the transport layer 00199 * 2nd - buffer id which uniquely identifies the buffer 00200 * 3rd - Ax_soapstream object which act like a thread id 00201 */ 00202 typedef void (AXISCALL * AXIS_ENGINE_CALLBACK_RELEASE_SEND_BUFFER) 00203 (const char*, const void*); 00204 00205 /* 00206 * Each transport module on the server side should populate following struct with 00207 * their transport function pointers in order for the Axis Engine to work properly. 00208 */ 00209 /*typedef struct 00210 { 00211 AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES pSendFunct; 00212 AXIS_MODULE_CALLBACK_GET_MESSAGE_BYTES pGetFunct; 00213 AXIS_MODULE_CALLBACK_RELEASE_RECEIVE_BUFFER pRelBufFunct; 00214 AXIS_MODULE_CALLBACK_SET_TRANSPORT_INFORMATION pSetTrtFunct; 00215 AXIS_MODULE_CALLBACK_GET_TRANSPORT_INFORMATION pGetTrtFunct; 00216 AXIS_ENGINE_CALLBACK_RELEASE_SEND_BUFFER pRelSendBufFunct; 00217 } Ax_transport; 00218 00219 typedef struct 00220 { 00221 Ax_soapcontent so; 00222 Ax_iostream str; 00223 char* sessionid; 00224 AXIS_PROTOCOL_TYPE trtype; 00225 Ax_transport transport; 00226 void* reserved1; 00227 void* reserved2; 00228 } Ax_soapstream; 00229 */ 00230 typedef struct 00231 { 00232 const void* pBufferId; 00233 const char* pcBuffer; 00234 } BufferInfo; 00235 00236 /* NO_OF_SERIALIZE_BUFFERS should be equal to the corresponding 00237 * value in the axis configuration file 00238 */ 00239 #define NO_OF_SERIALIZE_BUFFERS 20 00240 00241 #ifdef __cplusplus 00242 extern "C" 00243 { 00244 #endif 00245 /* 00246 * Functions to manipulate Ax_soapstream object. Implemented in Packet.cpp 00247 * 00248 */ 00249 /* 00250 STORAGE_CLASS_INFO int set_property(Ax_soapstream* stream, char * pchkey, 00251 char * pchvalue); 00252 STORAGE_CLASS_INFO const char* get_property(const Ax_soapstream* stream, 00253 const char* pchkey); 00254 STORAGE_CLASS_INFO void remove_all_properties(Ax_soapstream* stream); 00255 */ 00256 /* 00257 * This function is implemented in axis and should be called ONCE to 00258 * uninitialize Axis Engine when the 00259 * Axis SOAP processor shuts down. 00260 */ 00261 STORAGE_CLASS_INFO int uninitialize_module(); 00262 00263 /* 00264 * This function is implemented in axis and should be called ONCE to 00265 * initialize Axis Engine. 00266 */ 00267 STORAGE_CLASS_INFO int initialize_module(int bServer); 00268 00269 /* 00270 * This callback function is implemented in axis and should be called by the 00271 * transport module in order to 00272 * start processing a SOAP message. 00273 * @param 00274 * stream - Ax_soapstream object contains information about the SOAP stream 00275 * and the message. This also should be populated with the 00276 * transport module. 00277 */ 00278 STORAGE_CLASS_INFO int process_request(void* stream); 00279 00280 /* 00281 * This callback function is implemented in axis and should be called by 00282 * the transport module. 00283 * @param 00284 * buffer - Buffer passed to transport by calling transport's 00285 * AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES 00286 * callback 00287 * bufferid - Id of the buffer passed to transport by calling transport's 00288 * AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES callback 00289 * stream - Ax_soapstream object passed to transport by calling 00290 * transport's AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES callback 00291 */ 00292 STORAGE_CLASS_INFO void axis_buffer_release(const char* buffer, 00293 const void* bufferid, 00294 const void* stream); 00295 00296 #ifdef __cplusplus 00297 } 00298 #endif 00299 00300 #endif 00301 00302 00303 00304