summaryrefslogtreecommitdiffstats
path: root/code/jasmine/tcp-queue.h
blob: 4f096f8516071894006079039fc6ef626ae7138f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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