actube/src/cw/connlist.h
7u83@mail.ru 871822c613 Functions to get conn by session ID.
FossilOrigin-Name: 7c99abc44308c62f551283f93ecde1e36ed2d3033f3ff86d9e2a44e37291ddcd
2016-04-10 13:54:25 +00:00

33 lines
828 B
C

#ifndef __CONLIST_H
#define __CONLIST_H
#include "conn.h"
#include "mavl.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);
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