2 * Copyright 2020-2021 Niklas Ekström
5 #include <exec/types.h>
6 #include <exec/lists.h>
8 // Used to store received data until application asks for it using a A314_READ.
11 struct QueuedData *next;
16 // Socket flags, these are bit masks, can have many of them.
17 #define SOCKET_RCVD_EOS_FROM_APP 0x0004
18 #define SOCKET_RCVD_EOS_FROM_RPI 0x0008
19 #define SOCKET_SENT_EOS_TO_APP 0x0010
20 #define SOCKET_SENT_EOS_TO_RPI 0x0020
21 #define SOCKET_CLOSED 0x0040
22 #define SOCKET_SHOULD_SEND_RESET 0x0080
23 #define SOCKET_IN_SEND_QUEUE 0x0100
37 struct A314_IORequest *pending_connect;
38 struct A314_IORequest *pending_read;
39 struct A314_IORequest *pending_write;
41 struct Socket *next_in_send_queue;
42 UWORD send_queue_required_length;
44 // Data that is received on the stream, but the application didn't read yet.
45 struct QueuedData *rq_head;
46 struct QueuedData *rq_tail;
49 extern struct Socket *send_queue_head;
50 extern struct Socket *send_queue_tail;
52 extern void init_sockets();
54 extern struct Socket *create_socket(struct Task *task, ULONG id);
55 extern void delete_socket(struct Socket *s);
57 extern struct Socket *find_socket(void *sig_task, ULONG socket);
58 extern struct Socket *find_socket_by_stream_id(UBYTE stream_id);
60 extern void add_to_send_queue(struct Socket *s, UWORD required_length);
61 extern void remove_from_send_queue(struct Socket *s);