diff options
Diffstat (limited to 'code/jasmine/tcp-queue.h')
-rwxr-xr-x | code/jasmine/tcp-queue.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/code/jasmine/tcp-queue.h b/code/jasmine/tcp-queue.h new file mode 100755 index 00000000..4f096f85 --- /dev/null +++ b/code/jasmine/tcp-queue.h @@ -0,0 +1,35 @@ +/*############################################################################## +# Copyright (c) 2017 ZTE Coreporation and others. +# hu.zhijiang@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +##############################################################################*/ + +#ifndef _MCAST_TCP_QUEUE_H +#define _MCAST_TCP_QUEUE_H + +struct tcpq { + struct qmsg *head, *tail; + long count; /* message count in a queue */ + long size; /* Total data size of a queue */ +}; + +struct qmsg { + struct qmsg *next; + void *data; + long size; +}; + +struct tcpq * tcpq_queue_init(void); +void tcpq_queue_free(struct tcpq *q); +long tcpq_queue_dsize(struct tcpq *q); +void tcpq_queue_tail(struct tcpq *q, void *data, long size); +void tcpq_queue_head(struct tcpq *q, void *data, long size); +void * tcpq_dequeue_head(struct tcpq *q, long *size); +void * tcpq_queue_peek(struct tcpq *q, long *size); +void * tcpq_dqueue_flat(struct tcpq *q, long *size); +void * tcpq_queue_flat_peek(struct tcpq *q, long *size); + +#endif |