/* -*-c-*-
*
- * $Id: endpt.c,v 1.1 1999/07/26 23:33:01 mdw Exp $
- *
* Generic endpoint abstraction
*
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of the `fw' port forwarder.
*
* 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.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: endpt.c,v $
- * Revision 1.1 1999/07/26 23:33:01 mdw
- * Infrastructure for the new design.
- *
- */
-
-/*----- Header files ------------------------------------------------------*/
-
-#include "config.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "chan.h"
-#include "endpt.h"
+#include "fw.h"
/*----- Data structures ---------------------------------------------------*/
e = a; a = b; b = e;
}
- /* --- Attach the non-file endpoint to the file and run away --- */
+ /* --- Attach the non-file endpoint to the file and run away --- *
+ *
+ * Leave it as the non-file's responsibility to close the other endpoint
+ * when it's ready. It should also close itself at that time.
+ */
b->ops->attach(b, a->in, a->out);
- a->ops->close(a);
- b->ops->close(b);
+ b->ops->file(b, a);
if (t->next)
t->next->prev = t->prev;
if (t->prev)
chan_open(&t->c->ab, a->in->fd, b->out->fd, doneab, t);
chan_open(&t->c->ba, b->in->fd, a->out->fd, doneba, t);
return;
-}
+}
/*----- That's all, folks -------------------------------------------------*/