C AMQP Protocol Engine API  0.5
proton/sasl.h
Go to the documentation of this file.
00001 #ifndef PROTON_SASL_H
00002 #define PROTON_SASL_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 
00046 typedef struct pn_sasl_t pn_sasl_t;
00047 
00049 typedef enum {
00050   PN_SASL_NONE=-1,  
00051   PN_SASL_OK=0,     
00052   PN_SASL_AUTH=1,   
00053   PN_SASL_SYS=2,    
00054   PN_SASL_PERM=3,   
00055   PN_SASL_TEMP=4    
00056 } pn_sasl_outcome_t;
00057 
00059 typedef enum {
00060   PN_SASL_CONF,    
00061   PN_SASL_IDLE,    
00062   PN_SASL_STEP,    
00063   PN_SASL_PASS,    
00064   PN_SASL_FAIL     
00065 } pn_sasl_state_t;
00066 
00071 PN_EXTERN pn_sasl_t *pn_sasl(pn_transport_t *transport);
00072 
00078 PN_EXTERN pn_sasl_state_t pn_sasl_state(pn_sasl_t *sasl);
00079 
00086 PN_EXTERN void pn_sasl_mechanisms(pn_sasl_t *sasl, const char *mechanisms);
00087 
00094 PN_EXTERN const char *pn_sasl_remote_mechanisms(pn_sasl_t *sasl);
00095 
00103 PN_EXTERN void pn_sasl_client(pn_sasl_t *sasl);
00104 
00112 PN_EXTERN void pn_sasl_server(pn_sasl_t *sasl);
00113 
00125 PN_EXTERN void pn_sasl_plain(pn_sasl_t *sasl, const char *username, const char *password);
00126 
00134 PN_EXTERN size_t pn_sasl_pending(pn_sasl_t *sasl);
00135 
00145 PN_EXTERN ssize_t pn_sasl_recv(pn_sasl_t *sasl, char *bytes, size_t size);
00146 
00154 PN_EXTERN ssize_t pn_sasl_send(pn_sasl_t *sasl, const char *bytes, size_t size);
00155 
00162 PN_EXTERN void pn_sasl_done(pn_sasl_t *sasl, pn_sasl_outcome_t outcome);
00163 
00168 PN_EXTERN pn_sasl_outcome_t pn_sasl_outcome(pn_sasl_t *sasl);
00169 
00170 #ifdef __cplusplus
00171 }
00172 #endif
00173 
00174 #endif /* sasl.h */