| 150 | } |
| 151 | |
| 152 | void |
| 153 | output_encoder_stream_data(FILE *fd, TestQUICStream *stream) |
| 154 | { |
| 155 | uint8_t buf[1024]; |
| 156 | |
| 157 | // Write StreamId (0) |
| 158 | uint64_t stream_id = 0; |
| 159 | fwrite(reinterpret_cast<uint8_t *>(&stream_id), 8, 1, fd); |
| 160 | |
| 161 | // Skip 32 bits for Length |
| 162 | fseek(fd, 4, SEEK_CUR); |
| 163 | |
| 164 | // Write QPACKData |
| 165 | uint64_t total, nread; |
| 166 | total = 0; |
| 167 | while ((nread = stream->read(buf, sizeof(buf))) > 0) { |
| 168 | fwrite(buf, nread, 1, fd); |
| 169 | total += nread; |
| 170 | } |
| 171 | |
| 172 | // Back to the position for Length |
| 173 | fseek(fd, -(total + 4), SEEK_CUR); |
| 174 | |
| 175 | // Write Length |
| 176 | uint32_t len = htobe32(total); |
| 177 | fwrite(reinterpret_cast<uint8_t *>(&len), 4, 1, fd); |
| 178 | |
| 179 | // Back to the tail |
| 180 | fseek(fd, 0, SEEK_END); |
| 181 | } |
| 182 | |
| 183 | void |
| 184 | output_encoded_data(FILE *fd, uint64_t stream_id, IOBufferReader *header_block_reader) |
no test coverage detected