1 | /* |
2 | * librdkafka - The Apache Kafka C/C++ library |
3 | * |
4 | * Copyright (c) 2015 Magnus Edenhill |
5 | * All rights reserved. |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions are met: |
9 | * |
10 | * 1. Redistributions of source code must retain the above copyright notice, |
11 | * this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
13 | * this list of conditions and the following disclaimer in the documentation |
14 | * and/or other materials provided with the distribution. |
15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
28 | |
29 | #ifndef _RDKAFKA_SASL_INT_H_ |
30 | #define _RDKAFKA_SASL_INT_H_ |
31 | |
32 | struct rd_kafka_sasl_provider { |
33 | const char *name; |
34 | |
35 | /**< Per client-instance (rk) initializer */ |
36 | int (*init) (rd_kafka_t *rk, char *errstr, size_t errstr_size); |
37 | |
38 | /**< Per client-instance (rk) destructor */ |
39 | void (*term) (rd_kafka_t *rk); |
40 | |
41 | /**< Returns rd_true if provider is ready to be used, else rd_false */ |
42 | rd_bool_t (*ready) (rd_kafka_t *rk); |
43 | |
44 | int (*client_new) (rd_kafka_transport_t *rktrans, |
45 | const char *hostname, |
46 | char *errstr, size_t errstr_size); |
47 | |
48 | int (*recv) (struct rd_kafka_transport_s *s, |
49 | const void *buf, size_t size, |
50 | char *errstr, size_t errstr_size); |
51 | void (*close) (struct rd_kafka_transport_s *); |
52 | |
53 | void (*broker_init) (rd_kafka_broker_t *rkb); |
54 | void (*broker_term) (rd_kafka_broker_t *rkb); |
55 | |
56 | int (*conf_validate) (rd_kafka_t *rk, |
57 | char *errstr, size_t errstr_size); |
58 | }; |
59 | |
60 | #ifdef _MSC_VER |
61 | extern const struct rd_kafka_sasl_provider rd_kafka_sasl_win32_provider; |
62 | #endif |
63 | |
64 | #if WITH_SASL_CYRUS |
65 | extern const struct rd_kafka_sasl_provider rd_kafka_sasl_cyrus_provider; |
66 | void rd_kafka_sasl_cyrus_global_term (void); |
67 | int rd_kafka_sasl_cyrus_global_init (void); |
68 | #endif |
69 | |
70 | extern const struct rd_kafka_sasl_provider rd_kafka_sasl_plain_provider; |
71 | |
72 | #if WITH_SASL_SCRAM |
73 | extern const struct rd_kafka_sasl_provider rd_kafka_sasl_scram_provider; |
74 | #endif |
75 | |
76 | #if WITH_SASL_OAUTHBEARER |
77 | extern const struct rd_kafka_sasl_provider rd_kafka_sasl_oauthbearer_provider; |
78 | #endif |
79 | |
80 | void rd_kafka_sasl_auth_done (rd_kafka_transport_t *rktrans); |
81 | int rd_kafka_sasl_send (rd_kafka_transport_t *rktrans, |
82 | const void *payload, int len, |
83 | char *errstr, size_t errstr_size); |
84 | |
85 | #endif /* _RDKAFKA_SASL_INT_H_ */ |
86 | |