#include "../config.h"
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include "buf.h"
#include "dbapi.h"
Include dependency graph for d_xpath_f.c:
Go to the source code of this file.
Data Structures | |
struct | DBConnection_XPath |
The XPath-specific database connection structure. More... | |
Defines | |
#define | XMLFILE "XML File" |
Text for filename input field. | |
#define | FLD_COUNT 4 |
Number of emulated table fields. | |
Enumerations | |
enum | { FLD_TYPE = 0, FLD_NAME, FLD_ATTRIB, FLD_CONTENT } |
The predefined columns for the emulated database. More... | |
Functions | |
void * | xpath_query (DBConnection *dbc, char *xpstr) |
Run a query against the XML file. | |
DBConnection * | xpath_dbconnection_free (DBConnection *c) |
Free the connection structure. | |
char * | xpath_error () |
Return the last xpath error string. | |
char * | xp_DBget_field_value_type (xmlNodePtr node) |
Return the text description of the field type field. | |
char * | xp_DBget_field_value_attrib (xmlNodePtr node) |
Return the text description of the field attributes. | |
char * | xp_DBget_field_value_content (xmlNodePtr node) |
Return the text description of the field content field. | |
void | xp_DBurl_to_form (Form *frm, char *url) |
Copy the login variables from a text URL to a form. | |
char * | xp_DBform_to_url (Form *frm) |
DBConnection * | xpath_dbconnection_new () |
Allocate a new XPath DBConnection. | |
void | dbconnection_xpath_set_filename (DBConnection *dbc, char *fn) |
Set the filename for the connection. | |
void | xpath_set_error (DBConnection_XPath *dbc, char *s) |
Set the current error string. | |
int | dbconnection_xpath_open_doc (DBConnection *dbc, char *fn) |
Open a connection to an XML document. | |
DBConnector * | register_XPath (void(*error_dialog)(char *, char *)) |
Register the XPath driver with the application. | |
Variables | |
enum { ... } | FldTypes |
The predefined columns for the emulated database. |
<report version="1.3"> <info> <nessusd> <version>1.2.7</version> <libnasl>1.2.7</libnasl> <libnessus>1.2.7</libnessus> <thread>fork</thread> </nessusd> <host> <name>localhost</name> <osvers>2.4.18-18.8.0</osvers> </host> (followed by the actuall report results).
Type Name Attributes Content NODE name Not Implemented localhost NODE osname Not implemented Linux NODE osvers Not implemented 2.4.18-18.8.0
Obviously the 'Attributes' part is not implemented yet! What would be a good SQL syntax for this? Something like "Select * from //report/info/ *" seems the best I think. This needs more work.
Another option is to have more than one emulated table, each table could present the output slightly differently.
-Implement a basic SQL SELECT parser.
Definition in file d_xpath_f.c.
|
The predefined columns for the emulated database.
Definition at line 111 of file d_xpath_f.c. |
|
Open a connection to an XML document.
Definition at line 816 of file d_xpath_f.c. References dbconnection_xpath_set_filename(), DBConnection_XPath::doc, db_conn::pvt, and xpath_set_error(). |
|
Set the filename for the connection.
Definition at line 781 of file d_xpath_f.c. References DBConnection_XPath::filename, and db_conn::pvt. Referenced by dbconnection_xpath_open_doc(). |
|
Register the XPath driver with the application.
Definition at line 892 of file d_xpath_f.c. References _dbconnector::app_error_dialog, _dbconnector::db_connect_callback, _dbconnector::db_frm, dbconnector_new(), _dbconnector::dbtype, fld_set_relevance(), fld_set_tip(), fld_set_type(), _dbconnector::form_to_url, FR_REQUIRED, frm_add_field(), frm_new(), frm_set_title(), FT_FILENAME, _dbconnector::url_to_form, XMLFILE, xp_DBform_to_url(), and xp_DBurl_to_form(). |
|
Definition at line 648 of file d_xpath_f.c. References _a_buf::b_dat, buf_check(), buf_strcat(), frm_get_value_by_name(), and XMLFILE. Referenced by register_XPath(). |
|
Return the text description of the field attributes.
Definition at line 389 of file d_xpath_f.c. References _a_buf::b_dat, buf_check(), buf_strcat(), and buf_strcpy(). |
|
Return the text description of the field content field.
Definition at line 432 of file d_xpath_f.c. References _a_buf::b_dat, buf_strcat(), buf_strcpy(), and trimtext(). |
|
Return the text description of the field type field.
Definition at line 329 of file d_xpath_f.c. |
|
Copy the login variables from a text URL to a form. URL format is "xpath://filename"
Definition at line 538 of file d_xpath_f.c. References frm_clear_fields(), frm_set_value_by_name(), and XMLFILE. Referenced by register_XPath(). |
|
Free the connection structure.
Definition at line 180 of file d_xpath_f.c. References DBConnection_XPath::filename, keywords_remove_all(), and db_conn::pvt. |
|
Allocate a new XPath DBConnection.
Definition at line 740 of file d_xpath_f.c. References add_keyword(), db_conn::DBclear_result, db_conn::DBdisconnect, db_conn::DBexecute_query, db_conn::DBfree_table_def, db_conn::DBget_db_name, db_conn::DBget_error_message, db_conn::DBget_field_name, db_conn::DBget_field_number, db_conn::DBget_field_value, db_conn::DBget_query_status, db_conn::DBget_record_number, db_conn::DBget_table, db_conn::DBget_table_def, db_conn::DBget_table_num, db_conn::keylist, KEYWORD_SQL, db_conn::pvt, and db_conn::pvtlen. |
|
Return the last xpath error string.
Definition at line 196 of file d_xpath_f.c. |
|
Run a query against the XML file.
Definition at line 142 of file d_xpath_f.c. References DBConnection_XPath::doc, db_conn::pvt, DBConnection_XPath::result, and DBConnection_XPath::status. |
|
Set the current error string.
Definition at line 801 of file d_xpath_f.c. References DBConnection_XPath::errmsg. Referenced by dbconnection_xpath_open_doc(). |