C AMQP Protocol Engine API  0.5
proton/ssl.h
Go to the documentation of this file.
00001 #ifndef PROTON_SSL_H
00002 #define PROTON_SSL_H 1
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  *
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 
00025 #include <proton/import_export.h>
00026 #include <sys/types.h>
00027 #ifndef __cplusplus
00028 #include <stdbool.h>
00029 #endif
00030 #include <proton/engine.h>
00031 
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035 
00079 typedef struct pn_ssl_domain_t pn_ssl_domain_t;
00080 typedef struct pn_ssl_t pn_ssl_t;
00081 
00083 typedef enum {
00084   PN_SSL_MODE_CLIENT=1, 
00085   PN_SSL_MODE_SERVER    
00086 } pn_ssl_mode_t;
00087 
00089 typedef enum {
00090   PN_SSL_RESUME_UNKNOWN,        
00091   PN_SSL_RESUME_NEW,            
00092   PN_SSL_RESUME_REUSED          
00093 } pn_ssl_resume_status_t;
00094 
00105 PN_EXTERN pn_ssl_domain_t *pn_ssl_domain( pn_ssl_mode_t mode);
00106 
00112 PN_EXTERN void pn_ssl_domain_free( pn_ssl_domain_t *domain );
00113 
00134 PN_EXTERN int pn_ssl_domain_set_credentials( pn_ssl_domain_t *domain,
00135                                const char *certificate_file,
00136                                const char *private_key_file,
00137                                const char *password);
00138 
00153 PN_EXTERN int pn_ssl_domain_set_trusted_ca_db(pn_ssl_domain_t *domain,
00154                                 const char *certificate_db);
00155 
00169 typedef enum {
00170   PN_SSL_VERIFY_NULL=0,   
00171   PN_SSL_VERIFY_PEER,     
00172   PN_SSL_ANONYMOUS_PEER,  
00173   PN_SSL_VERIFY_PEER_NAME 
00174 } pn_ssl_verify_mode_t;
00175 
00198 PN_EXTERN int pn_ssl_domain_set_peer_authentication(pn_ssl_domain_t *domain,
00199                                           const pn_ssl_verify_mode_t mode,
00200                                           const char *trusted_CAs);
00201 
00211 PN_EXTERN int pn_ssl_domain_allow_unsecured_client(pn_ssl_domain_t *domain);
00212 
00222 PN_EXTERN pn_ssl_t *pn_ssl(pn_transport_t *transport);
00223 
00236 PN_EXTERN int pn_ssl_init( pn_ssl_t *ssl,
00237                  pn_ssl_domain_t *domain,
00238                  const char *session_id);
00239 
00251 PN_EXTERN bool pn_ssl_get_cipher_name(pn_ssl_t *ssl, char *buffer, size_t size);
00252 
00264 PN_EXTERN bool pn_ssl_get_protocol_name(pn_ssl_t *ssl, char *buffer, size_t size);
00265 
00278 PN_EXTERN pn_ssl_resume_status_t pn_ssl_resume_status( pn_ssl_t *ssl );
00279 
00297 PN_EXTERN int pn_ssl_set_peer_hostname( pn_ssl_t *ssl, const char *hostname);
00298 
00299 
00312 PN_EXTERN int pn_ssl_get_peer_hostname( pn_ssl_t *ssl, char *hostname, size_t *bufsize );
00313 
00314 #ifdef __cplusplus
00315 }
00316 #endif
00317 
00318 #endif /* ssl.h */