| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- /**
- * @file FragmentProtoDisassembler.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
- *
- * Object which encodes packets into packets composed of chunks
- * according to FragmentProto.
- */
- #ifndef BADVPN_FLOW_CCPROTODISASSEMBLER_H
- #define BADVPN_FLOW_CCPROTODISASSEMBLER_H
- #include <stdint.h>
- #include <protocol/fragmentproto.h>
- #include <misc/dead.h>
- #include <system/DebugObject.h>
- #include <system/BReactor.h>
- #include <system/BTime.h>
- #include <flow/PacketPassInterface.h>
- #include <flow/PacketRecvInterface.h>
- /**
- * Object which encodes packets into packets composed of chunks
- * according to FragmentProto.
- *
- * Input is with {@link PacketPassInterface}.
- * Output is with {@link PacketRecvInterface}.
- */
- typedef struct {
- DebugObject d_obj;
- dead_t dead;
- BReactor *reactor;
- int input_mtu;
- int output_mtu;
- int chunk_mtu;
- btime_t latency;
- PacketPassInterface input;
- PacketRecvInterface output;
- BTimer timer;
- int in_len;
- uint8_t *in;
- int in_used;
- uint8_t *out;
- int out_used;
- fragmentproto_frameid frame_id;
- int doing_send;
- int doing_recv;
- } FragmentProtoDisassembler;
- /**
- * Initializes the object.
- *
- * @param o the object
- * @param reactor reactor we live in
- * @param input_mtu maximum input packet size. Must be >=0 and <2^16
- * @param output_mtu maximum output packet size. Must be >sizeof(struct fragmentproto_chunk_header).
- * @param chunk_mtu maximum chunk size. Must be >0, or <0 for no explicit limit.
- * @param latency maximum time a pending output packet with some data can wait for more data
- * before being sent out. If nonnegative, a timer will be used. If negative,
- * packets will always be sent out immediately. If low latency is desired,
- * prefer setting this to zero rather than negative.
- */
- void FragmentProtoDisassembler_Init (FragmentProtoDisassembler *o, BReactor *reactor, int input_mtu, int output_mtu, int chunk_mtu, btime_t latency);
- /**
- * Frees the object.
- *
- * @param o the object
- */
- void FragmentProtoDisassembler_Free (FragmentProtoDisassembler *o);
- /**
- * Returns the input interface.
- *
- * @param o the object
- * @return input interface
- */
- PacketPassInterface * FragmentProtoDisassembler_GetInput (FragmentProtoDisassembler *o);
- /**
- * Returns the output interface.
- *
- * @param o the object
- * @return output interface
- */
- PacketRecvInterface * FragmentProtoDisassembler_GetOutput (FragmentProtoDisassembler *o);
- #endif
|