1 #include "proto-interactive.h"
2 #include "unusedparm.h"
3 #include "util-malloc.h"
4 #include <stdlib.h>
5 
6 /*
7  * TODO: we need to track thie memory used for this better than with malloc(), such
8  * as usuing a preallocated array of packet buffers. But for now, I'm just using
9  * malloc() 'cause I'm a lazy programmer.
10  */
11 unsigned char *
tcp_transmit_alloc(struct InteractiveData * more,size_t length)12 tcp_transmit_alloc(struct InteractiveData *more, size_t length)
13 {
14     /* Note using this parameter yet, but in the future, we are going to have
15      * memory pools instead of heap malloc(), which will use this parameter */
16     UNUSEDPARM(more);
17 
18     return MALLOC(length);
19 }
20 
21 void
tcp_close(struct InteractiveData * more)22 tcp_close(struct InteractiveData *more)
23 {
24     if (more == NULL)
25         return;
26     more->is_closing = 1;
27 }
28 
29 /*
30  * This doesn't actually transmit right now. Instead, marks the payload as ready
31  * to transmit, which will be transmitted later
32  */
33 void
tcp_transmit(struct InteractiveData * more,const void * payload,size_t length,unsigned flags)34 tcp_transmit(struct InteractiveData *more, const void *payload, size_t length, unsigned flags)
35 {
36     more->m_payload = payload;
37     more->m_length = (unsigned)length;
38 
39     if (flags & TCPTRAN_DYNAMIC)
40         more->is_payload_dynamic = 1;
41 }
42