* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* -------------------------------------------------------------------------
*
* sctp_lqueue.h
*
* IDENTIFICATION
* src/gausskernel/cbb/communication/sctp_utils/sctp_lqueue.h
*
* -------------------------------------------------------------------------
*/
#ifndef _UTILS_MC_LQUEUE_H_
#define _UTILS_MC_LQUEUE_H_
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <sys/uio.h>
#include "libcomm_common.h"
#include "libcomm_list.h"
typedef struct iovec* element_ptr;
struct mc_2int_item {
int nid;
int sid;
struct mc_list_item item;
};
struct mc_lqueue_element {
element_ptr data;
void add(element_ptr e)
{
data = e;
}
};
struct mc_lqueue_item {
struct mc_lqueue_element element;
struct mc_list_item item;
};
struct mc_lqueue {
int8 is_empty;
int8 is_full;
uint32 count;
mc_list list;
unsigned long size;
unsigned long u_size;
};
inline int mc_lqueue_item_size(struct mc_lqueue_item*);
int mc_lqueue_item_size(struct mc_list_item*);
int mc_lqueue_add(struct mc_lqueue* q, struct mc_lqueue_item* element);
struct mc_lqueue_item* mc_lqueue_remove(struct mc_lqueue* q, struct mc_lqueue_item* element);
struct mc_lqueue* mc_lqueue_init(unsigned long size);
struct mc_lqueue* mc_lqueue_clear(struct mc_lqueue* q);
void mc_lqueue_print(int n, struct mc_lqueue* q);
#endif