Annotation of embedaddon/coova-chilli/src/chilli.h, revision 1.1.1.1

1.1       misho       1: /* 
                      2:  * chilli - A Wireless LAN Access Point Controller
                      3:  * Copyright (C) 2003, 2004, 2005 Mondru AB.
                      4:  * Copyright (c) 2006-2007 David Bird <david@coova.com>
                      5:  *
                      6:  * The contents of this file may be used under the terms of the GNU
                      7:  * General Public License Version 2, provided that the above copyright
                      8:  * notice and this permission notice is included in all copies or
                      9:  * substantial portions of the software.
                     10:  * 
                     11:  * The initial developer of the original code is
                     12:  * Jens Jakobsen <jj@chillispot.org>
                     13:  *
                     14:  */
                     15: 
                     16: #ifndef _CHILLI_H
                     17: #define _CHILLI_H
                     18: 
                     19: /* Authtype defs */
                     20: #define CHAP_DIGEST_MD5   0x05
                     21: #define CHAP_MICROSOFT    0x80
                     22: #define CHAP_MICROSOFT_V2 0x81
                     23: #define PAP_PASSWORD       256
                     24: #define EAP_MESSAGE        257
                     25: 
                     26: #define MPPE_KEYSIZE  16
                     27: #define NT_KEYSIZE    16
                     28: 
                     29: 
                     30: #define DNPROT_NULL       1
                     31: #define DNPROT_DHCP_NONE  2
                     32: #define DNPROT_UAM        3
                     33: #define DNPROT_WPA        4
                     34: #define DNPROT_EAPOL      5
                     35: #define DNPROT_MAC        6
                     36: 
                     37: /* Debug facility */
                     38: #define DEBUG_DHCP        2
                     39: #define DEBUG_RADIUS      4
                     40: #define DEBUG_REDIR       8
                     41: #define DEBUG_CONF       16
                     42: 
                     43: /* Struct information for each connection */
                     44: struct app_conn_t {
                     45:   
                     46:   char is_adminsession;
                     47: 
                     48:   /* Management of connections */
                     49:   int inuse;
                     50:   int unit;
                     51:   struct app_conn_t *next;    /* Next in linked list. 0: Last */
                     52:   struct app_conn_t *prev;    /* Previous in linked list. 0: First */
                     53: 
                     54:   /* Pointers to protocol handlers */
                     55:   void *uplink;                  /* Uplink network interface (Internet) */
                     56:   void *dnlink;                  /* Downlink network interface (Wireless) */
                     57:   int dnprot;                    /* Downlink protocol */
                     58: 
                     59: #if(0)
                     60: #define s_params  params[0]
                     61: #define ss_params params[1]
                     62: #define s_state   state[0]
                     63: #define ss_state  state[1]
                     64:   struct session_params params[2];        /* Session parameters */
                     65:   struct session_state  state[2];         /* Session state */
                     66:   char has_subsession;
                     67: #endif
                     68:   struct session_params s_params;         /* Session parameters */
                     69:   struct session_state  s_state;          /* Session state */
                     70: 
                     71:   /* Radius authentication stuff */
                     72:   /* Parameters are initialised whenever a reply to an access request
                     73:      is received. */
                     74:   uint8_t chal[EAP_LEN];         /* EAP challenge */
                     75:   size_t challen;                /* Length of EAP challenge */
                     76:   uint8_t sendkey[RADIUS_ATTR_VLEN];
                     77:   uint8_t recvkey[RADIUS_ATTR_VLEN];
                     78:   uint8_t lmntkeys[RADIUS_MPPEKEYSSIZE];
                     79:   size_t sendlen;
                     80:   size_t recvlen;
                     81:   size_t lmntlen;
                     82:   uint32_t policy;
                     83:   uint32_t types;
                     84:   uint8_t ms2succ[MS2SUCCSIZE];
                     85:   size_t ms2succlen;
                     86: 
                     87:   /* Radius proxy stuff */
                     88:   /* Parameters are initialised whenever a radius proxy request is received */
                     89:   /* Only one outstanding request allowed at a time */
                     90:   int radiuswait;                /* Radius request in progres */
                     91:   struct sockaddr_in radiuspeer; /* Where to send reply */
                     92:   uint8_t radiusid;              /* ID to reply with */
                     93:   uint8_t authenticator[RADIUS_AUTHLEN];
                     94:   int authtype; /* TODO */
                     95: 
                     96: 
                     97:   /* Parameters for radius accounting */
                     98:   /* These parameters are set when an access accept is sent back to the
                     99:      NAS */
                    100: 
                    101:   uint32_t nasip;              /* Set by access request */
                    102:   uint32_t nasport;            /* Set by access request */
                    103:   uint8_t hismac[PKT_ETH_ALEN];/* His MAC address */
                    104:   uint8_t ourmac[PKT_ETH_ALEN];/* Our MAC address */
                    105:   struct in_addr ourip;        /* IP address to listen to */
                    106:   struct in_addr hisip;        /* Client IP address */
                    107:   struct in_addr reqip;        /* IP requested by client */
                    108:   uint16_t mtu;
                    109: 
                    110:   /* Information for each connection */
                    111:   struct in_addr net;
                    112:   struct in_addr mask;
                    113:   struct in_addr dns1;
                    114:   struct in_addr dns2;
                    115: 
                    116:   /* UAM information */
                    117:   char uamabort; /* should be bit options */
                    118:   char uamexit;
                    119: };
                    120: 
                    121: extern struct app_conn_t *firstfreeconn; /* First free in linked list */
                    122: extern struct app_conn_t *lastfreeconn;  /* Last free in linked list */
                    123: extern struct app_conn_t *firstusedconn; /* First used in linked list */
                    124: extern struct app_conn_t *lastusedconn;  /* Last used in linked list */
                    125: 
                    126: extern struct radius_t *radius;          /* Radius client instance */
                    127: extern struct dhcp_t *dhcp;              /* DHCP instance */
                    128: extern struct tun_t *tun;                /* TUN/TAP instance */
                    129: 
                    130: int printstatus(struct app_conn_t *appconn);
                    131: int terminate_appconn(struct app_conn_t *appconn, int terminate_cause);
                    132: void config_radius_session(struct session_params *params, struct radius_packet_t *pack, int reconfig);
                    133: int cmdsock_init();
                    134: 
                    135: #endif /*_CHILLI_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>