xref: /dflybsd-src/crypto/openssh/dispatch.h (revision 664f47636b7e6e9e2c54a4799ca4884a9c628df5)
1*664f4763Szrj /* $OpenBSD: dispatch.h,v 1.15 2019/01/19 21:45:31 djm Exp $ */
218de8d7fSPeter Avalos 
318de8d7fSPeter Avalos /*
418de8d7fSPeter Avalos  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
518de8d7fSPeter Avalos  *
618de8d7fSPeter Avalos  * Redistribution and use in source and binary forms, with or without
718de8d7fSPeter Avalos  * modification, are permitted provided that the following conditions
818de8d7fSPeter Avalos  * are met:
918de8d7fSPeter Avalos  * 1. Redistributions of source code must retain the above copyright
1018de8d7fSPeter Avalos  *    notice, this list of conditions and the following disclaimer.
1118de8d7fSPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
1218de8d7fSPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
1318de8d7fSPeter Avalos  *    documentation and/or other materials provided with the distribution.
1418de8d7fSPeter Avalos  *
1518de8d7fSPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1618de8d7fSPeter Avalos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1718de8d7fSPeter Avalos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1818de8d7fSPeter Avalos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1918de8d7fSPeter Avalos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2018de8d7fSPeter Avalos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2118de8d7fSPeter Avalos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2218de8d7fSPeter Avalos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2318de8d7fSPeter Avalos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2418de8d7fSPeter Avalos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2518de8d7fSPeter Avalos  */
2618de8d7fSPeter Avalos 
27e9778795SPeter Avalos #ifndef DISPATCH_H
28e9778795SPeter Avalos #define DISPATCH_H
29e9778795SPeter Avalos 
30e9778795SPeter Avalos #define DISPATCH_MAX	255
3118de8d7fSPeter Avalos 
3218de8d7fSPeter Avalos enum {
3318de8d7fSPeter Avalos 	DISPATCH_BLOCK,
3418de8d7fSPeter Avalos 	DISPATCH_NONBLOCK
3518de8d7fSPeter Avalos };
3618de8d7fSPeter Avalos 
37e9778795SPeter Avalos struct ssh;
3818de8d7fSPeter Avalos 
39ce74bacaSMatthew Dillon typedef int dispatch_fn(int, u_int32_t, struct ssh *);
40e9778795SPeter Avalos 
41ce74bacaSMatthew Dillon int	dispatch_protocol_error(int, u_int32_t, struct ssh *);
42ce74bacaSMatthew Dillon int	dispatch_protocol_ignore(int, u_int32_t, struct ssh *);
43e9778795SPeter Avalos void	ssh_dispatch_init(struct ssh *, dispatch_fn *);
44e9778795SPeter Avalos void	ssh_dispatch_set(struct ssh *, int, dispatch_fn *);
45e9778795SPeter Avalos void	ssh_dispatch_range(struct ssh *, u_int, u_int, dispatch_fn *);
46ce74bacaSMatthew Dillon int	ssh_dispatch_run(struct ssh *, int, volatile sig_atomic_t *);
47ce74bacaSMatthew Dillon void	ssh_dispatch_run_fatal(struct ssh *, int, volatile sig_atomic_t *);
48e9778795SPeter Avalos 
49e9778795SPeter Avalos #endif
50