2015-04-10 17:16:33 +02:00
|
|
|
#ifndef __ACIPRIORITYLIST_H
|
|
|
|
#define __ACIPRIORITYLIST_H
|
|
|
|
|
2015-04-24 07:13:54 +02:00
|
|
|
#include "mavl.h"
|
2015-04-26 08:41:12 +02:00
|
|
|
#include "mbag.h"
|
2015-04-10 17:16:33 +02:00
|
|
|
|
2016-03-05 08:05:46 +01:00
|
|
|
/**
|
|
|
|
* Used to store AC Name With Priority elements.
|
|
|
|
*/
|
2015-04-10 17:16:33 +02:00
|
|
|
struct cw_acprio{
|
2016-03-05 08:05:46 +01:00
|
|
|
/**
|
|
|
|
* AC Name
|
|
|
|
*/
|
2015-04-10 17:16:33 +02:00
|
|
|
char *name;
|
2016-03-05 08:05:46 +01:00
|
|
|
/**
|
|
|
|
* IP of AC
|
|
|
|
*/
|
2015-04-26 08:41:12 +02:00
|
|
|
struct sockaddr_storage * addr;
|
2016-03-05 08:05:46 +01:00
|
|
|
/**
|
|
|
|
* Priority
|
|
|
|
*/
|
2015-04-10 17:16:33 +02:00
|
|
|
uint8_t prio;
|
|
|
|
};
|
|
|
|
|
2015-04-26 08:41:12 +02:00
|
|
|
extern const struct mbag_typedef mbag_type_acprio;
|
|
|
|
|
|
|
|
#define MBAG_ACPRIO (&mbag_type_acprio)
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-04-10 17:16:33 +02:00
|
|
|
typedef struct cw_acprio cw_acprio_t;
|
2015-04-24 07:13:54 +02:00
|
|
|
typedef struct mavl * cw_acpriolist_t;
|
2015-04-10 17:16:33 +02:00
|
|
|
|
|
|
|
extern cw_acpriolist_t cw_acpriolist_create();
|
|
|
|
cw_acprio_t * cw_acpriolist_add(cw_acpriolist_t l, const char *name,int name_len, uint8_t prio);
|
|
|
|
|
|
|
|
static inline int cw_acpriolist_get(cw_acpriolist_t l, char * acname){
|
|
|
|
cw_acprio_t ps,*pf;
|
|
|
|
ps.name=acname;
|
|
|
|
|
2015-04-24 07:13:54 +02:00
|
|
|
pf=mavl_get(l,&ps);
|
2015-04-10 17:16:33 +02:00
|
|
|
if (!pf)
|
|
|
|
return 256;
|
|
|
|
return pf->prio;
|
|
|
|
}
|
|
|
|
|
2015-04-24 07:13:54 +02:00
|
|
|
#define cw_acpriolist_del(l,s) mavl_del(l,s)
|
2015-04-10 17:16:33 +02:00
|
|
|
#define cw_acpriolist_set(l,n,nl,p) cw_acpriolist_add(l,n,nl,p)
|
|
|
|
|
|
|
|
#endif
|