| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- /**
- * @file StreamRecvConnector.h
- * @author Ambroz Bizjak <ambrop7@gmail.com>
- *
- * @section LICENSE
- *
- * This file is part of BadVPN.
- *
- * BadVPN is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * BadVPN 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 this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * @section DESCRIPTION
- *
- * A {@link StreamRecvInterface} layer which allows the input to be
- * connected and disconnected on the fly.
- */
- #ifndef BADVPN_FLOW_STREAMRECVCONNECTOR_H
- #define BADVPN_FLOW_STREAMRECVCONNECTOR_H
- #include <stdint.h>
- #include <misc/dead.h>
- #include <system/DebugObject.h>
- #include <system/BPending.h>
- #include <flow/StreamRecvInterface.h>
- /**
- * A {@link StreamRecvInterface} layer which allows the input to be
- * connected and disconnected on the fly.
- */
- typedef struct {
- DebugObject d_obj;
- dead_t dead;
- StreamRecvInterface output;
- int out_avail;
- uint8_t *out;
- StreamRecvInterface *input;
- dead_t input_dead;
- int in_blocking;
- BPending continue_job;
- } StreamRecvConnector;
- /**
- * Initializes the object.
- * The object is initialized in not connected state.
- *
- * @param o the object
- * @param pg pending group
- */
- void StreamRecvConnector_Init (StreamRecvConnector *o, BPendingGroup *pg);
- /**
- * Frees the object.
- *
- * @param o the object
- */
- void StreamRecvConnector_Free (StreamRecvConnector *o);
- /**
- * Returns the output interface.
- *
- * @param o the object
- * @return output interface
- */
- StreamRecvInterface * StreamRecvConnector_GetOutput (StreamRecvConnector *o);
- /**
- * Connects input.
- * The object must be in not connected state.
- * The object enters connected state.
- *
- * @param o the object
- * @param output input to connect
- */
- void StreamRecvConnector_ConnectInput (StreamRecvConnector *o, StreamRecvInterface *input);
- /**
- * Disconnects input.
- * The object must be in connected state.
- * The object enters not connected state.
- *
- * @param o the object
- */
- void StreamRecvConnector_DisconnectInput (StreamRecvConnector *o);
- #endif
|