actube/src/cw/connlist.h
7u83@mail.ru fb7331173e work on dtls
FossilOrigin-Name: 8b02ed99e3287eaa044a4f4c6c8b61ab6f1a14983db99accb43b5be8425befe8
2018-04-01 23:39:08 +00:00

34 lines
863 B
C

#ifndef __CONLIST_H
#define __CONLIST_H
#include "conn.h"
#include "mavl.h"
#include "pthread.h"
struct connlist {
/* struct conn ** connlist; */
struct mavl *by_addr;
struct mavl *by_session_id;
int len;
pthread_mutex_t connlist_mutex;
};
struct connlist *connlist_create(int len, int cmpports);
void connlist_lock(struct connlist *cl);
void connlist_unlock(struct connlist *cl);
void conlist_destroy(struct connlist *cl);
struct conn *connlist_get(struct connlist *cl, const struct sockaddr *addr);
struct conn *connlist_add(struct connlist *cl, struct conn *conn);
void connlist_remove(struct connlist *cl, struct conn *conn);
void connlist_destroy(struct connlist *cl);
struct conn * connlist_get_by_session_id(struct connlist *cl, struct conn * conn);
struct conn * connlist_add_by_session_id(struct connlist * cl, struct conn * conn);
#endif