1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 // MARKER(update_precomp.py): autogen include statement, do not remove 23 #include "precompiled_ucb.hxx" 24 25 #include "SerfCallbacks.hxx" 26 27 #include "SerfSession.hxx" 28 #include "SerfRequestProcessor.hxx" 29 30 using namespace http_dav_ucp; 31 32 extern "C" apr_status_t Serf_ConnectSetup( apr_socket_t *skt, 33 serf_bucket_t **read_bkt, 34 serf_bucket_t **write_bkt, 35 void *setup_baton, 36 apr_pool_t *pool ) 37 { 38 SerfSession* pSerfSession = static_cast< SerfSession* >( setup_baton ); 39 return pSerfSession->setupSerfConnection( skt, 40 read_bkt, 41 write_bkt, 42 pool ); 43 } 44 45 extern "C" apr_status_t Serf_Credentials( char **username, 46 char **password, 47 serf_request_t *request, 48 void *baton, 49 int code, 50 const char *authn_type, 51 const char *realm, 52 apr_pool_t *pool ) 53 { 54 SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( baton ); 55 return pReqProc->provideSerfCredentials( username, 56 password, 57 request, 58 code, 59 authn_type, 60 realm, 61 pool ); 62 } 63 64 extern "C" apr_status_t Serf_CertificateChainValidation( 65 void* pSerfSession, 66 int nFailures, 67 int nErrorCode, 68 const serf_ssl_certificate_t * const * pCertificateChainBase64Encoded, 69 apr_size_t nCertificateChainLength) 70 { 71 return static_cast<SerfSession*>(pSerfSession) 72 ->verifySerfCertificateChain(nFailures, pCertificateChainBase64Encoded, nCertificateChainLength); 73 } 74 75 extern "C" apr_status_t Serf_SetupRequest( serf_request_t *request, 76 void *setup_baton, 77 serf_bucket_t **req_bkt, 78 serf_response_acceptor_t *acceptor, 79 void **acceptor_baton, 80 serf_response_handler_t *handler, 81 void **handler_baton, 82 apr_pool_t * pool ) 83 { 84 SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( setup_baton ); 85 return pReqProc->setupSerfRequest( request, 86 req_bkt, 87 acceptor, 88 acceptor_baton, 89 handler, 90 handler_baton, 91 pool ); 92 } 93 94 extern "C" serf_bucket_t* Serf_AcceptResponse( serf_request_t *request, 95 serf_bucket_t *stream, 96 void *acceptor_baton, 97 apr_pool_t *pool ) 98 { 99 SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( acceptor_baton ); 100 return pReqProc->acceptSerfResponse( request, 101 stream, 102 pool ); 103 } 104 105 extern "C" apr_status_t Serf_HandleResponse( serf_request_t *request, 106 serf_bucket_t *response, 107 void *handler_baton, 108 apr_pool_t *pool ) 109 { 110 SerfRequestProcessor* pReqProc = static_cast< SerfRequestProcessor* >( handler_baton ); 111 return pReqProc->handleSerfResponse( request, 112 response, 113 pool ); 114 } 115 116