summaryrefslogtreecommitdiff
path: root/src/MESA_list.h
blob: 524fc611c7ea392b43b015d92e7b10f2aff3d62b (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef _MESA_LIST_NEW_H_
#define _MESA_LIST_NEW_H_

#ifdef __cplusplus
extern "C"
{
#endif

#define MESA_LIST_CHECK (1) /* 0:no check; 1:quick check; 2:careful check */

typedef struct list_index {
	struct list_index	*nextele;
	struct list_index	*preele;
	unsigned char	    *quiddity;
	int					pktlen;
}MESA_list_index_t;

typedef struct list_index MESA_queue_head_t;

/* MESA_fixed_queue implement */

typedef struct fixed_qelem{
	void *data;		
	long datalen; 
}MESA_fixed_qelem_t;

typedef struct list_index MESA_fixed_q_t;
/*
    ��һ��ʹ��MESA_fixed_qģ��ʱ��������ô˳�ʼ��ģ��!!!
*/
int MESA_fixed_q_init(MESA_fixed_q_t *head, long total_elem_num, long max_elem_len);
void MESA_fixed_q_destroy(MESA_fixed_q_t *__head);
long MESA_fixed_q_count(const MESA_fixed_q_t *head);
MESA_fixed_qelem_t *MESA_fixed_q_read_head(MESA_fixed_q_t *head);
MESA_fixed_qelem_t *MESA_fixed_q_get_head(MESA_fixed_q_t *head);

/* In MESA_fixed_queue module, the memory of "data" can not be allocated by malloc, stack memory is alright! */
MESA_fixed_qelem_t *MESA_fixed_q_join_tail(MESA_fixed_q_t *head, void *data, long datalen);


/*
    ��һ��ʹ��MESA_listģ��ʱ��������ô˳�ʼ��ģ��!!!
*/
int MESA_list_init(MESA_queue_head_t *head);

long MESA_get_list_count(const MESA_queue_head_t *head);
MESA_list_index_t *MESA_q_read_head(const MESA_queue_head_t *qhead_obj);
MESA_list_index_t *MESA_q_get_head(MESA_queue_head_t *qhead_obj);
MESA_list_index_t *MESA_q_get_tail(MESA_queue_head_t *qhead_obj);
MESA_list_index_t *MESA_q_join_tail(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lindex_obj);
MESA_list_index_t *MESA_q_join_head(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lindex_obj);
MESA_list_index_t *MESA_q_leave_list(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lindex_obj);
MESA_list_index_t *MESA_q_move_head(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lindex_obj);
MESA_list_index_t *MESA_q_move_tail(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lindex_obj);

#if 0 /* do do, ��δʵ�� */
MESA_list_index_t *MESA_q_join_list_n(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lobj_next, MESA_list_index_t *lindex_obj);
MESA_list_index_t *MESA_q_join_list_p(MESA_queue_head_t *qhead_obj, MESA_list_index_t *lobj_pre, MESA_list_index_t *lindex_obj);
#endif


#ifdef __cplusplus
}
#endif

#endif