2016-04-09 18:13:32 +02:00
|
|
|
#ifndef __CONLIST_H
|
|
|
|
#define __CONLIST_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "conn.h"
|
|
|
|
#include "mavl.h"
|
2018-02-26 18:28:12 +01:00
|
|
|
#include "pthread.h"
|
2016-04-09 18:13:32 +02:00
|
|
|
|
|
|
|
struct connlist {
|
|
|
|
/* struct conn ** connlist; */
|
|
|
|
|
2016-04-10 15:54:25 +02:00
|
|
|
struct mavl *by_addr;
|
|
|
|
struct mavl *by_session_id;
|
|
|
|
|
|
|
|
|
2016-04-09 18:13:32 +02:00
|
|
|
int len;
|
|
|
|
pthread_mutex_t connlist_mutex;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-04-02 01:39:08 +02:00
|
|
|
struct connlist *connlist_create(int len, int cmpports);
|
2016-04-09 18:13:32 +02:00
|
|
|
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);
|
|
|
|
|
2016-04-10 15:54:25 +02:00
|
|
|
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);
|
|
|
|
|
2016-04-09 18:13:32 +02:00
|
|
|
#endif
|