]> git.decadent.org.uk Git - ap-utils.git/blobdiff - lib/ap-utils.h
Update description to cover all current utilities
[ap-utils.git] / lib / ap-utils.h
index 0936d4012cd125caf68c99b4eeb04f2799e54e3f..cd9c8c1610a2cb56d6b3a70c0a90329275de072b 100644 (file)
@@ -76,6 +76,9 @@ typedef unsigned int uint32_t;
 #define rshort(a)      ((a) = swap2(a))
 #define wshort(a)      ((a) = swap2(a))
 
+#define dbmconv(x)     (ap_type == ATMEL410 && ap_vendorext == SBRIDGES) ? \
+                           (int)(-95 + x * (float)2.125) : -96 + x
+
 #define MAC _("MAC address: ")
 #define TRAPS _("[S] SNMP traps: ")
 
@@ -100,34 +103,38 @@ typedef unsigned int uint32_t;
 #define BASIC _("Basic")
 
 #define ANY_KEY _("Press any key to continue.")
-#define QT_HELP _("Q - quit to menu. T - toggle polling mode, Other key - force update.")
+#define QT_HELP _("Q - quit to menu. T - toggle polling mode, Other key - force update")
 
 #define ERR_SET _("Unable to write data to AP. Press any key to continue.")
 #define ERR_RET _("Unable to retrieve (valid) data from AP. Press any key to continue.")
-#define WAIT_RET _("Trying to retrieve data from AP. Please wait...")
+#define WAIT_RET _("Trying to retrieve data from AP - please wait (or press Q to quit).")
 #define WAIT_SET _("Writing data to AP. Please wait...")
 #define DONE_SET _("Configuration written to the AP. Press any key to continue.")
-#define SELECT _("select() function error. Press any key.")
+#define ERR_SELECT _("select() function error. Press any key.")
+#define ERR_SOCKET _("socket() or bind() function error. Press any key.")
 
-#define CREATE_SOCKET_ERROR _("Create socket error. Press any key.")
-#define BIND_SOCKET_ERROR _("Bind socket error. Press any key.")
+#define ERR_WRITING_APCONF _("Unable to write AP list file ~/.ap-config. Press any key.")
+#define DONE_WRITING_APCONF _("AP list file ~/.ap-config successfully written. Press any key.")
 
 #define MAIN_MENU _("Back to main menu")
 #define MENU_EXIT _("Exit program")
 #define MENU_SHELL _("Run subshell. To return type 'exit'.")
+#define MENU_POLLING _("Change polling mode interval")
 #define MENU_ABOUT _("Short info about program")
 #define MENU_SEARCH _("Find connected Access Points")
 #define MENU_CONNECT _("Set connection options: ip and community")
 #define MENU_ENCRYPT _("Set encryption; edit WEP keys")
-#define MENU_MAC _("Set MAC authorization; edit MAC authorization table")
+#define MENU_AUTH _("Set authorization; edit MAC authorization table")
 #define MENU_COMMUNITY _("Set SNMP community/password for access to the AP")
 #define MENU_SYSINFO _("Get info about AP hardware and firmware")
 #define MENU_WIRELESS _("Get wireless port statistics")
 #define MENU_STAS _("Get list of currently associated stations (Access Point clients)")
+#define MENU_APLINK _("Get link status in APclient mode")
 #define MENU_INFO _("Get info and statistics from AP")
 #define MENU_CONFIG _("Set various configuration options")
 
-#define TITLE_STAS _("Associated stations")
+#define ST_TITLE _("Associated stations")
+#define AP_TITLE _("AP Client link state")
 
 #define POLL_ON _("Polling: on")
 #define POLL_OFF _("Polling: off")
@@ -169,8 +176,8 @@ typedef unsigned int uint32_t;
 /* Numbering with respect to order in ap_vendorexts */
 #define NONE 0
 #define SBRIDGES 1
-#define TELLUS 1
-#define VERNET 2
+#define GEMTEK 1
+#define EZYNET 2
 
 typedef struct {
     unsigned char *oid;
@@ -194,7 +201,7 @@ struct umitems {
        int is_menu;
 };
 
-struct EthernetRxStatistics {
+struct EthRxStatistics_s {
        uint32_t TotalBytesRx;
        uint32_t TotalPacketsRx;
        uint32_t PacketCRCErrorRx;
@@ -213,7 +220,7 @@ struct EthernetRxStatistics {
        uint32_t TotalJabberRx;
 };
 
-struct EthernetTxStatistics {
+struct EthTxStatistics_s {
        uint32_t TotalBytesTx;
        uint32_t TotalPacketsTx;
        uint32_t PacketCRCErrorTx;
@@ -230,7 +237,7 @@ struct EthernetTxStatistics {
        uint32_t TotalCollisionsTx;
 };
 
-struct WirelessStatistics {
+struct wirelessStatistics_s {
        uint32_t UnicastTransmittedPackets;
        uint32_t BroadcastTransmittedPackets;
        uint32_t MulticastTransmittedPackets;
@@ -253,15 +260,15 @@ struct WirelessStatistics {
        uint32_t AgedPackets;
        uint32_t FCSError;
        uint32_t InvalidPLCP;
-       /* following 4 are specific for ATMEL 12350 MIB enhanced by VERNET */
+       /* following 4 are specific for ATMEL 12350 MIB enhanced by EZYNET */
        uint32_t TransmittedPackets_11Mbps;
        uint32_t TransmittedPackets_55Mbps;
        uint32_t TransmittedPackets_2Mbps;
        uint32_t TransmittedPackets_1Mbps;
 };
 
-struct sysDeviceInfo_ATMEL410 {
-    /* sysDeviceInfo OID struct for ATMEL 410 */
+struct sysDeviceInfo_128 {
+    /* sysDeviceInfo OID struct - version 128 bytes long */
     uint32_t StructVersion;
     unsigned char MacAddress[6];
     unsigned short Reserved;
@@ -271,10 +278,16 @@ struct sysDeviceInfo_ATMEL410 {
     uint32_t OEMID;
     unsigned char ProductName[32];
     uint32_t HardwareRevision;
+    /*
+     * NOTE: Although MIBs claim 92 bytes length, it does not need to be true.
+     * 92 bytes seems to be just the 'official' part; the unofficial
+     * (and undocumented) remnant padding the total length to 128 bytes
+     * may or may not eventually appear (resulting in returned length 128 b.).
+     */
 };
 
-struct sysDeviceInfo_ATMEL12350 {
-    /* sysDeviceInfo OID struct for ATMEL 12350 */
+struct sysDeviceInfo_160 {
+    /* sysDeviceInfo OID struct - version 160 bytes long */
     uint32_t StructVersion;
     unsigned char MacAddress[6];
     unsigned char Channel;
@@ -296,6 +309,34 @@ struct sysDeviceInfo_ATMEL12350 {
     unsigned char Reserved3[10];
 };
 
+/* AP mode: Associated stations diagnostics */
+
+struct AssociatedSTAsInfo_ATMEL410 {
+    unsigned short Index;
+    unsigned char  MacAddress[6];
+    /* The rest is only supported by ATMEL410 SBRIDGES MIB */
+    unsigned char  Status;
+    unsigned char  Port;
+    unsigned char  ParentMacAddress[6];
+    unsigned char  RSSI;
+    unsigned char  LinkQuality;
+    unsigned char  IP[4];
+    unsigned char  Reserved1[2];
+};
+
+struct AssociatedSTAsInfo_ATMEL12350 {
+    unsigned short Index;
+    unsigned char  MacAddress[6];
+    /* The rest is only supported by ATMEL12350 EZYNET MIB */
+    unsigned char  Status;
+    unsigned char  Port;
+    unsigned char  ParentMacAddress[6];
+    unsigned char  RSSI;
+    unsigned char  IP[4];
+    unsigned char  Reserved1[3];
+};
+
+/* This structure unifies all the unique members of the 2 structs above */
 struct MacListStat {
     unsigned char addr[6];
     struct MacListStat *next;
@@ -308,6 +349,36 @@ struct MacListStat {
     struct in_addr IP;
 };
 
+/* APClient mode: AP link diagnostics */
+
+/* size: 53 bytes */
+struct NetworkSettings_ATMEL410_SBRIDGES {
+    unsigned short reserved1;
+    unsigned char BSSID[6];
+    unsigned short InfoCapability;
+    unsigned char Rssi;
+    unsigned char Channel;
+    unsigned char reserved2[2];
+    unsigned char LinkQuality;
+    unsigned char reserved3[5];
+    unsigned char ESSID[32];
+    unsigned char ESSLEN;
+};
+
+/* size: 56 bytes */
+struct NetworkSettings_ATMEL12350_EZYNET {
+    unsigned short reserved1;
+    unsigned char BSSID[6];
+    unsigned short InfoCapability;
+    unsigned char Rssi;
+    unsigned char Channel;
+    unsigned char reserved2[2];
+    unsigned char CurrentRate;
+    unsigned char reserved3[5];
+    unsigned char ESSID[32];
+    unsigned long ESSLEN;
+};
+
 /* function prototypes specific/common for both utilites */
 
 /* service */
@@ -338,11 +409,12 @@ extern void get_pass(char *, int, int, int);
 extern int  yes_no(int, int);
 extern int  on_off(int, int);
 extern int  menu_choose(int, int, char **, unsigned int);
-extern int  wait_key(void);
+extern int  wait_key(int);
 extern int  help_ysn(void);
 extern void scroll_rows(struct MacListStat *, int, int, int, int);
 extern void exit_shell(void);
 extern void exit_program(void);
+extern void polling_interval(void);
 extern int  get_opts(void);
 extern void save_Stations(struct MacListStat *);
 extern void uni_menu(struct umitems *umenu, int num);
@@ -353,11 +425,15 @@ extern void bridging(void);
 extern void wep(void);
 extern void WirelessStat(void);
 extern void atmel_stations(void);
+extern void atmel_aplink(void);
 extern void atmel_sysinfo(void);
 extern void atmel_set_oeminfo(void);
 extern void ap_search(void);
 
 /* snmp engine*/
+extern void close_sockfd(void);
+extern int  open_sockfd(void);
+extern int  reopen_sockfd(void);
 extern int snmp(varbind *, int, int);
 extern int ber(char *, varbind *, int, int);
 /* extern unsigned int ber_decode_uint(unsigned char *, int); */
@@ -373,7 +449,7 @@ extern void APs(void);
 extern void power(void);
 extern void test(void);
 extern void atmel_wireless(void);
-extern void atmel_auth_mac(void);
+extern void atmel_auth(void);
 
 /* function prototypes specific for NWN utility */
 extern void latest(void);