+++ /dev/null
-/* -*-c-*-
- *
- * Generic endpoint abstraction
- *
- * (c) 1999 Straylight/Edgeware
- */
-
-/*----- Licensing notice --------------------------------------------------*
- *
- * This file is part of the `fw' port forwarder.
- *
- * `fw' is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * `fw' is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with `fw'; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef ENDPT_H
-#define ENDPT_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/*----- Header files ------------------------------------------------------*/
-
-#ifndef REFFD_H
-# include "reffd.h"
-#endif
-
-/*----- Data structures ---------------------------------------------------*/
-
-/* --- Basic endpoint structure --- */
-
-typedef struct endpt {
- struct endpt_ops *ops; /* Pointer to operations table */
- struct endpt *other; /* Pointer to sibling endpoint */
- unsigned f; /* Various flags */
- struct tango *t; /* Private data structure */
- reffd *in, *out; /* File descriptors */
-} endpt;
-
-/* --- Endpoint flags --- */
-
-#define EPF_PENDING 1u /* Endpoint creation in progress */
-#define EPF_FILE 2u /* Endpoint smells like a file */
-
-/* --- Endpoint operations table --- */
-
-typedef struct endpt_ops {
-
- /* --- @attach@ --- *
- *
- * Arguments: @endpt *e@ = pointer to endpoint to be attached
- * @reffd *in, *out@ = input and output file descriptors
- *
- * Returns: ---
- *
- * Use: Instructs a non-file endpoint to attach itself to a pair of
- * files.
- */
-
- void (*attach)(endpt */*e*/, reffd */*in*/, reffd */*out*/);
-
- /* --- @file@ --- *
- *
- * Arguments: @endpt *e@ = pointer to endpoint in question
- * @endpt *f@ = pointer to a file endpoint
- *
- * Returns: ---
- *
- * Use: Informs a non-file endpoint of a file endpoint which will
- * want to be closed when it's finished with. At that time, the
- * endpoint should arrange to have both itself and its partner
- * closed. If no file is registered, the endpoint manager will
- * close both endpoints itself.
- */
-
- void (*file)(endpt */*e*/, endpt */*f*/);
-
- /* --- @wclose@ --- *
- *
- * Arguments: @endpt *e@ = endpoint to be partially closed
- *
- * Returns: ---
- *
- * Use: Announces that the endpoint will not be written to any more.
- */
-
- void (*wclose)(endpt */*e*/);
-
- /* --- @close@ --- *
- *
- * Arguments: @endpt *e@ = endpoint to be closed
- *
- * Returns: ---
- *
- * Use: Completely closes an endpoint. The endpoint's data may be
- * freed, although some endpoints may wish to delay freeing for
- * some reason.
- */
-
- void (*close)(endpt */*e*/);
-
-} endpt_ops;
-
-/*----- Functions provided ------------------------------------------------*/
-
-/* --- @endpt_kill@ --- *
- *
- * Arguments: @endpt *a@ = an endpoint
- *
- * Returns: ---
- *
- * Use: Kills an endpoint. If the endpoint is joined to another, the
- * other endpoint is also killed, as is the connection between
- * them (and that's the tricky bit).
- */
-
-extern void endpt_kill(endpt */*a*/);
-
-/* --- @endpt_killall@ --- *
- *
- * Arguments: ---
- *
- * Returns: ---
- *
- * Use: Destroys all current endpoint connections. Used when
- * shutting down.
- */
-
-extern void endpt_killall(void);
-
-/* --- @endpt_join@ --- *
- *
- * Arguments: @endpt *a@ = pointer to first endpoint
- * @endpt *b@ = pointer to second endpoint
- *
- * Returns: ---
- *
- * Use: Joins two endpoints together.
- */
-
-extern void endpt_join(endpt */*a*/, endpt */*b*/);
-
-/*----- That's all, folks -------------------------------------------------*/
-
-#ifdef __cplusplus
- }
-#endif
-
-#endif