2 This file is part of GNUnet.
3 (C) 2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file stream/stream_protocol.h
23 * @brief P2P protocol for the stream connections
24 * @author Sree Harsha Totakura
27 #ifndef STREAM_PROTOCOL_H
28 #define STREAM_PROTOCOL_H
33 #if 0 /* keep Emacsens' auto-indent happy */
38 #include <sys/types.h>
40 #include "gnunet_stream_lib.h"
41 #include "gnunet_mesh_service.h"
45 * Stream message types
47 enum GNUNET_STREAM_MessageType
50 * Message containing data
52 GNUNET_STREAM_MESSAGE_DATA,
57 GNUNET_STREAM_MESSAGE_ACK,
60 * Handshake hello message
62 GNUNET_STREAM_MESSAGE_HELLO,
65 * Handshake hello acknowledgement message
67 GNUNET_STREAM_MESSAGE_HELLO_ACK,
70 * Transmit close message (data transmission no longer possible after this
73 GNUNET_STREAM_MESSAGE_TRANSMIT_CLOSE,
76 * Transmit close acknowledgement message
78 GNUNET_STREAM_MESSAGE_TRANSMIT_CLOSE_ACK,
81 * Receive close message (data is no loger read by the receiver after this
84 GNUNET_STREAM_MESSAGE_RECEIVE_CLOSE,
87 * Receive close acknowledgement message
89 GNUNET_STREAM_MESSAGE_RECEIVE_CLOSE_ACK,
92 * Stream close message (data is no longer sent or read after this message)
94 GNUNET_STREAM_MESSAGE_CLOSE,
97 * Close acknowledgement message
99 GNUNET_STREAM_MESSAGE_CLOSE_ACK
104 * The stream message header
106 * The message can be of Data, Acknowledgement or both
108 struct GNUNET_STREAM_MessageHeader
111 * The GNUNET message header
113 struct GNUNET_MessageHeader header;
116 * A number which identifies a session
122 * ? Should we rather use the type field in GNUNET_MessageHeader ?
124 enum GNUNET_STREAM_MessageType type;
130 * The Data message, should be prefixed with stream header with its type set to
133 struct GNUNET_STREAM_DataMessage
136 * Sequence number; Always starts with 0 and should wrap around.
137 * Immune to Sequence Prediction Attack as we take cover under GNUNET's secure
143 * number of milliseconds to the soft deadline for sending acknowledgement
144 * measured from the time this message is received. It is optimal for the
145 * communication to send the ack within the soft deadline
147 uint16_t ack_deadline;
150 * The data should be appended here
155 * The Selective Acknowledgement Bitmap
157 * ? WARNING ? Possibility for Denial of Service ??
158 * ? Receiver may force the sender to mantain a buffer of ~ 64*64k !??
160 typedef uint64_t GNUNET_STREAM_AckBitmap;
164 * The Acknowledgment Message, should be prefixed with Stream Message header
165 * with its type set to GNUNET_STREAM_MESSAGE_ACK
167 struct GNUNET_STREAM_AckMessage
170 * The sequence number of the Data Message upto which the receiver has filled
171 * its buffer without any missing packets
176 * The Selective Acknowledgement Bitmap. Computed relative to the base_seq
177 * (bit n corresponds to the Data message with sequence number base_seq+n)
179 GNUNET_STREAM_AckBitmap bitmap;
183 #if 0 /** keep Emacsens' auto-indent happy */
190 #endif /* STREAM_PROTOCOL_H */