gsasl  2.2.1
callback.c
Go to the documentation of this file.
1 /* callback.c --- Callback handling.
2  * Copyright (C) 2002-2024 Simon Josefsson
3  *
4  * This file is part of GNU SASL Library.
5  *
6  * GNU SASL Library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation; either version 2.1 of
9  * the License, or (at your option) any later version.
10  *
11  * GNU SASL Library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License License along with GNU SASL Library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include <config.h>
24 #include "internal.h"
25 
44 void
46 {
47  ctx->cb = cb;
48 }
49 
70 int
72 {
73  if (ctx == NULL && sctx == NULL)
74  return GSASL_NO_CALLBACK;
75 
76  if (ctx == NULL)
77  ctx = sctx->ctx;
78 
79  if (ctx->cb)
80  return ctx->cb (ctx, sctx, prop);
81 
82  return GSASL_NO_CALLBACK;
83 }
84 
99 void
100 gsasl_callback_hook_set (Gsasl *ctx, void *hook)
101 {
102  ctx->application_hook = hook;
103 }
104 
119 void *
121 {
122  return ctx->application_hook;
123 }
124 
139 void
141 {
142  sctx->application_hook = hook;
143 }
144 
159 void *
161 {
162  return sctx->application_hook;
163 }
void gsasl_callback_set(Gsasl *ctx, Gsasl_callback_function cb)
Definition: callback.c:45
void gsasl_session_hook_set(Gsasl_session *sctx, void *hook)
Definition: callback.c:140
void * gsasl_callback_hook_get(Gsasl *ctx)
Definition: callback.c:120
void * gsasl_session_hook_get(Gsasl_session *sctx)
Definition: callback.c:160
int gsasl_callback(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop)
Definition: callback.c:71
void gsasl_callback_hook_set(Gsasl *ctx, void *hook)
Definition: callback.c:100
int(* Gsasl_callback_function)(Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop)
Definition: gsasl.h:286
@ GSASL_NO_CALLBACK
Definition: gsasl.h:142
Gsasl_property
Definition: gsasl.h:222
void * application_hook
Definition: internal.h:54
Gsasl * ctx
Definition: internal.h:50
Definition: internal.h:37
void * application_hook
Definition: internal.h:44
Gsasl_callback_function cb
Definition: internal.h:43