⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xsupgui_request.h

📁 linux 下通过802.1认证的安装包
💻 H
📖 第 1 页 / 共 2 页
字号:
/**
 * \file xsupgui_request.h
 *
 * \author chris@open1x.org
 *
 * Windows specific IPC implementation for Xsupplicant.
 *
 * \note This header file covers xsupgui_request.h, xsupgui_request2.h, etc.
 *
 * This code is released under both the GPL version 2 and BSD licenses.
 * Either license may be used.  The respective licenses are found below.
 *
 * Copyright (C) 2006-2007 Chris Hessing
 * All Rights Reserved
 *
 * --- GPL Version 2 License ---
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * --- BSD License ---
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  - Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *  - Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  - All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *       This product includes software developed by the University of
 *       Maryland at College Park and its contributors.
 *  - Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _XSUPGUI_REQUEST_H_
#define _XSUPGUI_REQUEST_H_


#include "../libxsupconfig/xsupconfig_structs.h"
#include <libxml/parser.h>

#ifndef TRUE
#define TRUE   1
#endif

#ifndef FALSE
#define FALSE  0
#endif

/**
 *  Result values.
 **/
#define REQUEST_TIMEOUT                   -1
#define REQUEST_FAILURE                   -2
#define REQUEST_SUCCESS                    0    // Anything >= this is a success.
#define REQUEST_NOT_IMPLEMENTED           -3

/**
 * Event classes that the supplicant might send us.
 **/
#define IPC_EVENT_LOG            1
#define IPC_EVENT_ERROR          2
#define IPC_EVENT_STATEMACHINE   3
#define IPC_EVENT_SCAN_COMPLETE  4
#define IPC_EVENT_REQUEST_PWD    5
#define IPC_EVENT_UI             6
#define IPC_EVENT_TNC_UI         7
#define IPC_EVENT_TNC_UI_REQUEST 8
#define IPC_EVENT_TNC_UI_BATCH_REQUEST 9
#define IPC_EVENT_COM_BROKEN     10  // The communication with the supplicant has been broken.  (The supplicant probably crashed.)

/**
 *  Error codes (and their meanings) that can be sent over the IPC channel.
 *
 *  Since these error codes will usually be used as a return value of a function,
 *  we want to start them at 100 to allow plenty of room for other error space.
 **/
#define IPC_ERROR_NONE                300   // No error.
#define IPC_ERROR_CANT_ALLOCATE_NODE  301   // Unable the allocate a node in the XML tree.
#define IPC_ERROR_UNKNOWN_REQUEST     302   // Requested information we know nothing about.
#define IPC_ERROR_CANT_LOCATE_NODE    303   // Couldn't find the node we needed in a request.
#define IPC_ERROR_INVALID_INTERFACE   304   // Couldn't locate the interface that was requested.
#define IPC_ERROR_INVALID_CONTEXT     305   // The context requested didn't contain all of the 
											//    information we needed.
#define IPC_ERROR_INVALID_BSSID       306   // We don't know a valid BSSID.  (The card is probably
											// not associated!)
#define IPC_ERROR_INVALID_SIGNAL_STRENGTH  307  // The signal strength value isn't available.
#define IPC_ERROR_INVALID_REQUEST     308   // The request didn't contain the information needed.
#define IPC_ERROR_INTERFACE_NOT_FOUND 310   // The interface requested was not found.
#define IPC_ERROR_COULDNT_CHANGE_UPW  311   // The username and/or password couldn't be changed.
#define IPC_ERROR_INVALID_ROOT_NODE   312   // The root node in the request was invalid.
#define IPC_ERROR_INVALID_CONN_NAME   313   // The connection name requested was invalid.
#define IPC_ERROR_INVALID_PROF_NAME   314   // The profile name requested was invalid.
#define IPC_ERROR_INT_NOT_WIRELESS    315   // The requested interface is not wireless.
#define IPC_ERROR_CANT_GET_IP         316   // Couldn't obtain the IP address for requested interface!
#define IPC_ERROR_CANT_GET_NETMASK    317   // Couldn't obtain the netmask for requested interface.
#define IPC_ERROR_CANT_GET_GATEWAY    318   // Couldn't obtain the default gateway for requested interface.
#define IPC_ERROR_CANT_FIND_SSID      319   // Couldn't locate the requested SSID in the SSID cache.
#define IPC_ERROR_NO_INTERFACES       320   // The supplicant is not currently managing any interfaces.
#define IPC_ERROR_INVALID_FILE        321   // The filename requested is invalid.
#define IPC_ERROR_CANT_WRITE_CONFIG   322   // Couldn't write the configuration file!
#define IPC_ERROR_INVALID_NODE        323   // Couldn't locate node %s!
#define IPC_ERROR_CANT_GET_CONFIG     324   // Couldn't get requested configuration information!
#define IPC_ERROR_INVALID_OU_NAME     325   // Couldn't locate the requested OU.
#define IPC_ERROR_INVALID_TRUSTED_SVR 326   // Couldn't locate the requested trusted server.
#define IPC_ERROR_PARSING             327   // Attempt to parse requested configuration block failed.
#define IPC_ERROR_MALLOC              328   // Failed to allocate memory!
#define IPC_ERROR_CANT_CHANGE_CONFIG  329   // Failed to change requested configuration data.
#define IPC_ERROR_CANT_PASSIVE_SCAN   330   // The OS doesn't know how to passive scan, or the interface won't allow it.
#define IPC_ERROR_UNKNOWN_SCAN_ERROR  331   // An unhandled error occurred while attempting to scan.
#define IPC_ERROR_CERT_STORE_ERROR    332   // An error occurred obtaining access to the certificate store.
#define IPC_ERROR_CANT_GET_CERT_INFO  333   // Unable to locate the certificate information requested.
#define IPC_ERROR_BAD_TNC_UI_RESPONSE 334   // The attempt to trigger the response to a TNC UI request failed.
#define IPC_ERROR_INTERFACE_IN_USE    335   // The requested interface is already in use.
#define IPC_ERROR_NO_CONNECTION       336   // The interface doesn't have a connection assigned.
#define IPC_ERROR_NEW_ERRORS_IN_QUEUE 337   // There are errors to be read from the error queue.
#define IPC_ERROR_CANT_DEL_CONN_IN_USE 338  // Cannot delete the connection.  It is currently in use.
#define IPC_ERROR_CANT_GET_SYS_UPTIME 339   // Unable to determine the system uptime.
#define IPC_ERROR_NEED_USERNAME       340   // No username was provided for an EAP authentication.
#define IPC_ERROR_NEED_PASSWORD       341   // No password was provided for the authentication.
#define IPC_ERROR_CANT_RENAME         342   // Unable to rename connection/profile/trusted server.
#define IPC_ERROR_STILL_IN_USE        343   // The profile/trusted server is still in use and cannot be deleted.
#define IPC_ERROR_NAME_IN_USE         344   // The connection/profile/trusted server name is already in use.
#define IPC_ERROR_GEN_TROUBLE_TICKET  345   // An unrecoverable error occurred while generating trouble tickets.
#define IPC_ERROR_FILE_EXISTS         346   // A request was made to overwrite a file that already exists.

// Error messages that can be generated by xsupgui internal calls.
#define IPC_ERROR_CANT_FIND_RESPONSE  1000  // The required response header was not found in the response message.
#define IPC_ERROR_CANT_CREATE_REQUEST 1001  // The XML request document couldn't be created.
#define IPC_ERROR_CANT_CREATE_REQ_HDR 1002  // Unable to create the XML document framework.
#define IPC_ERROR_UNSPEC_REQ_FAILURE  1003  // The request failed for an unspecified reason.
#define IPC_ERROR_BAD_RESPONSE        1004  // The response XML document was invalid.
#define IPC_ERROR_CANT_FIND_REQ_ROOT_NODE 1005  // The root node in the request document couldn't be located.
#define IPC_ERROR_CANT_CREATE_INT_NODE 1006 // The <Interface> node couldn't be created for the request.
#define IPC_ERROR_CANT_FIND_RESP_ROOT_NODE 1007 // The root node in the response document couldn't be located.
#define IPC_ERROR_INVALID_PARAMETERS  1008  // The parameters passed in to the function were invalid.
#define IPC_ERROR_NULL_DOCUMENT       1009  // The document presented to the function is NULL.
#define IPC_ERROR_NO_ERROR_CODE       1010  // Got an error document that didn't contain an error code node.
#define IPC_ERROR_NULL_RESPONSE       1011  // The response document from the supplicant was NULL or didn't contain valid information.
#define IPC_ERROR_NULL_REQUEST        1012  // The request document was NULL or invalid after conversion.
#define IPC_ERROR_BAD_RESPONSE_DATA   1013  // The data included in the response document was invalid, or could not be parsed.
#define IPC_ERROR_CANT_ALLOCATE_MEMORY 1014  // Unable to allocate memory to store response data.
#define IPC_ERROR_NOT_ACK             1015  // The response was not the ACK that was expected.
#define IPC_ERROR_NOT_PONG            1016  // The response to a PING request was not a PONG.
#define IPC_ERROR_INVALID_RESP_DATA   1017  // The response data didn't pass validation tests.
#define IPC_ERROR_CANT_ADD_NODE       1018  // The function was unable to add the newly created node to the existing tree.
#define IPC_ERROR_INVALID_NUMBER_OF_EVENTS 1019 // The number of events specified in the return document was invalid.
#define IPC_ERROR_CANT_SEND_IPC_MSG   1020  // Unable to send IPC message to the supplicant.
#define IPC_ERROR_SEND_SIZE_MISMATCH  1021  // The data to send was a different size than the data that was sent.
#define IPC_ERROR_UNABLE_TO_READ      1022  // Data appeared to be ready, but couldn't be read.
#define IPC_ERROR_RECV_IPC_RUNT       1023  // Received an IPC runt fragment.
#define IPC_ERROR_CANT_MALLOC_LOCAL   1024  // Unable to malloc memory in the local process.
#define IPC_ERROR_NOT_INITIALIZED     1025  // A variable was not properly initialized.
#define IPC_ERROR_STALE_BUFFER_DATA   1026  // There was stale data in the event buffer.
#define IPC_ERROR_CTRL_ALREADY_CONNECTED 1027 // The IPC control channel was already connected.
#define IPC_ERROR_CTRL_NOT_CONNECTED  1028  // The IPC control channel is not connected.
#define IPC_ERROR_EVT_ALREADY_CONNECTED 1029 // The event channel was already connected.
#define IPC_ERROR_EVT_NOT_CONNECTED   1030  // The event channel is not connected.
#define IPC_ERROR_RUNT_RESPONSE       1031  // The response data was not large enough to be a valid response.
#define IPC_ERROR_READ_DEFAULT_FAILURE 1032 // There was an unknown reason that the overlapped I/O completed.

// State machines that we may get state machine events for. 
#define IPC_STATEMACHINE_PHYSICAL                              1   ///< Identify the physical state machine
#define IPC_STATEMACHINE_8021X                                 2   ///< Identify the 802.1X primary state machine
#define IPC_STATEMACHINE_8021X_BACKEND                         3   ///< Identify the 802.1X back end state machine
#define IPC_STATEMACHINE_EAP                                   4   ///< Identify the EAP state machine.

// Different types of authentication that are allowed.
#define AUTH_UNKNOWN               0
#define AUTH_NONE                  1
#define AUTH_PSK                   2
#define AUTH_EAP                   3

// Data type that will be returned for an enum_ints request.
typedef struct {
	char *name;
	char *desc;
	unsigned char is_wireless;
} int_enum;

typedef struct {
	char *mac;
	char *desc;
	unsigned char is_wireless;
	char *default_connection;
} int_config_enum;

typedef struct {
	char *name;
	char *desc;
} namedesc_enum;

typedef struct {
	char *ou;
} managed_nets_enum;

typedef struct _cert_enum {
	char *storetype;
	char *certname;
	char *friendlyname;
	char *issuer;
	char *commonname;
	char *location;
	uint16_t month;
	uint16_t day;
	uint16_t year;
} cert_enum;

typedef struct {
	char *name;
} profile_enum;

#define CONNECTION_ENC_NONE     1   ///< Configuration information says we will have no encryption enabled.
#define CONNECTION_ENC_ENABLED  2   ///< Configuration information says we will have encryption enabled.  (i.e. It is 802.1X with dynamic WEP, or some variation of WPA/WPA2)
#define CONNECTION_ENC_UNKNOWN  3   ///< We can't determine if encryption will be used or not from the information in the config file.

typedef struct {
	char *name;
	char *ssid;
	char *dev_desc;               // Device description.  You need to feed this in to 
								  // xsupgui_request_get_devname() to get the OS level device
	char encryption;              ///< Can be one of the CONNECTION_ENC_*.
	int priority;
	int auth_type;                ///< Will be one of the AUTH_* values above.
	int assoc_type;               ///< Will be one of the ASSOC_TYPE_* values below.
								
} conn_enum;

// Flags that indicate status for possible connections.
#define POSS_CONN_INT_AVAIL     0x01  ///< Set to 1 if the interface needed for a connection is available.
#define POSS_CONN_IS_WIRELESS   0x02  ///< Set to 1 if the interface is wireless
#define POSS_CONN_IS_HIDDEN     0x04  ///< Set to 1 if the SSID is configured as Hidden in the configuration.
#define POSS_CONN_SSID_KNOWN    0x08  ///< Set to 1 if the SSID was found in the scan cache.
#define POSS_CONN_INT_UNKNOWN   0x10  ///< Set to 1 if the interface isn't found in the live cache, or the configuration.  (Should almost NEVER happen!)
#define POSS_CONN_LINK_STATE    0x20  ///< Set to 1 if the link is up, set to 0 if it is down.

typedef struct {
	char *name;
	char *ssid;
	int   flags;                  ///< Flags for this connection as defined by POSS_CONN_* above.
								  ///<  *NOTE* : This will be set to 1 if the SSID is found in the SSID cache for the interface this connection is bound to.  It is possible, though unlikely, that the SSID may be seen by another interface.  In that case, this will still show 0!
	char *dev_desc;               // Device description.  You need to feed this in to 
								  // xsupgui_request_get_devname() to get the OS level device
	char encryption;              ///< Can be one of the CONNECTION_ENC_*.
	int priority;
	int auth_type;                ///< Will be one of the AUTH_* values above.
								
} poss_conn_enum;

typedef struct {
	char *name;
} trusted_servers_enum;

typedef struct {
	char *name;
	unsigned char num;
} eap_enum;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -