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 /* 00126 * This function is provided by the transport modules. 00127 * Called by Axis engine when it needs to get SOAP 00128 * message. This function may be called several times. 00129 * @param 00130 * 1st - pointer to buffer pointer to which the transport's buffer is set 00131 * 2nd - pointer to an int to which the number of bytes read is set 00132 * 3rd - Ax_soapstream object which act like a thread id 00133 * @return 00134 * TRANSPORT_FINISHED - No any more message bytes to be received. 00135 * If a buffer is present it is the last 00136 * buffer. 00137 * TRANSPORT_IN_PROGRESS - There may be more message bytes to be received. 00138 * Axis Engine may call this 00139 * function again to get any subsequent message 00140 * buffers. Buffer should be present. 00141 * TRANSPORT_FAILED - Transport has failed and no use of trying to get any 00142 * more bytes. Better to abort. 00143 00144 typedef AXIS_TRANSPORT_STATUS 00145 (AXISCALL * AXIS_MODULE_CALLBACK_GET_MESSAGE_BYTES) 00146 (const char**, int*, const void*); 00147 */ 00148 00149 /* 00150 * This function is provided by the transport modules. 00151 * Called by Axis engine when it needs to say the 00152 * transport module that the engine is no longer using the buffer 00153 * and can be re-used. 00154 * @param 00155 * 1st - buffer that Axis got from the transport layer. 00156 * 2nd - Ax_soapstream object which act like a thread id 00157 00158 typedef void (AXISCALL * AXIS_MODULE_CALLBACK_RELEASE_RECEIVE_BUFFER) 00159 (const char*, const void*); 00160 */ 00161 00176 /* 00177 * This function is provided by the transport modules. 00178 * Called by Axis engine when it needs to get any 00179 * transport information such as http headers. 00180 * This function can be called only once. 00181 * @param 00182 * 1st - Transport information type to get 00183 * 2nd - Ax_soapstream object which act like a thread id 00184 00185 typedef const char* (AXISCALL * AXIS_MODULE_CALLBACK_GET_TRANSPORT_INFORMATION) 00186 (AXIS_TRANSPORT_INFORMATION_TYPE, const void*); 00187 */ 00188 /* 00189 * Function pointer definitions for axis call backs 00190 */ 00191 00192 /* 00193 * This function is provided by the Axis Engine. 00194 * Called by transport module when it needs to say that 00195 * a message buffer passed to it is no longer being used by the transport 00196 * and can be re-used by the 00197 * Axis engine.This function should be called for each buffer 00198 * if AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES 00199 * returned TRANSPORT_IN_PROGRESS. 00200 * @param 00201 * 1st - buffer that Axis gave to the transport layer 00202 * 2nd - buffer id which uniquely identifies the buffer 00203 * 3rd - Ax_soapstream object which act like a thread id 00204 */ 00205 typedef void (AXISCALL * AXIS_ENGINE_CALLBACK_RELEASE_SEND_BUFFER) 00206 (const char*, const void*); 00207 00208 /* 00209 * Each transport module on the server side should populate following struct with 00210 * their transport function pointers in order for the Axis Engine to work properly. 00211 */ 00212 /*typedef struct 00213 { 00214 AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES pSendFunct; 00215 AXIS_MODULE_CALLBACK_GET_MESSAGE_BYTES pGetFunct; 00216 AXIS_MODULE_CALLBACK_RELEASE_RECEIVE_BUFFER pRelBufFunct; 00217 AXIS_MODULE_CALLBACK_SET_TRANSPORT_INFORMATION pSetTrtFunct; 00218 AXIS_MODULE_CALLBACK_GET_TRANSPORT_INFORMATION pGetTrtFunct; 00219 AXIS_ENGINE_CALLBACK_RELEASE_SEND_BUFFER pRelSendBufFunct; 00220 } Ax_transport; 00221 00222 typedef struct 00223 { 00224 Ax_soapcontent so; 00225 Ax_iostream str; 00226 char* sessionid; 00227 AXIS_PROTOCOL_TYPE trtype; 00228 Ax_transport transport; 00229 void* reserved1; 00230 void* reserved2; 00231 } Ax_soapstream; 00232 */ 00233 typedef struct 00234 { 00235 const void* pBufferId; 00236 const char* pcBuffer; 00237 } BufferInfo; 00238 00239 /* NO_OF_SERIALIZE_BUFFERS should be equal to the corresponding 00240 * value in the axis configuration file 00241 */ 00242 #define NO_OF_SERIALIZE_BUFFERS 20 00243 00244 #ifdef __cplusplus 00245 extern "C" 00246 { 00247 #endif 00248 /* 00249 * Functions to manipulate Ax_soapstream object. Implemented in Packet.cpp 00250 * 00251 */ 00252 /* 00253 STORAGE_CLASS_INFO int set_property(Ax_soapstream* stream, char * pchkey, 00254 char * pchvalue); 00255 STORAGE_CLASS_INFO const char* get_property(const Ax_soapstream* stream, 00256 const char* pchkey); 00257 STORAGE_CLASS_INFO void remove_all_properties(Ax_soapstream* stream); 00258 */ 00259 /* 00260 * This function is implemented in axis and should be called ONCE to 00261 * uninitialize Axis Engine when the 00262 * Axis SOAP processor shuts down. 00263 */ 00264 STORAGE_CLASS_INFO int uninitialize_module(); 00265 00266 /* 00267 * This function is implemented in axis and should be called ONCE to 00268 * initialize Axis Engine. 00269 */ 00270 STORAGE_CLASS_INFO int initialize_module(int bServer); 00271 00272 /* 00273 * This callback function is implemented in axis and should be called by the 00274 * transport module in order to 00275 * start processing a SOAP message. 00276 * @param 00277 * stream - Ax_soapstream object contains information about the SOAP stream 00278 * and the message. This also should be populated with the 00279 * transport module. 00280 */ 00281 STORAGE_CLASS_INFO int process_request(void* stream); 00282 00283 /* 00284 * This callback function is implemented in axis and should be called by 00285 * the transport module. 00286 * @param 00287 * buffer - Buffer passed to transport by calling transport's 00288 * AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES 00289 * callback 00290 * bufferid - Id of the buffer passed to transport by calling transport's 00291 * AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES callback 00292 * stream - Ax_soapstream object passed to transport by calling 00293 * transport's AXIS_MODULE_CALLBACK_SEND_MESSAGE_BYTES callback 00294 */ 00295 STORAGE_CLASS_INFO void axis_buffer_release(const char* buffer, 00296 const void* bufferid, 00297 const void* stream); 00298 00299 #ifdef __cplusplus 00300 } 00301 #endif 00302 00303 #endif 00304 00305 00306 00307