libphish: phish.h Source File

Main Page | Data Structures | File List | Data Fields | Globals

# phish.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005 Meni Livne <livne@kde.org>                         *
    00003  *   Copyright (C) 2005 Boaz Anin <boazanin@gmail.com>                     *
    00004  *   Copyright (C) 2005 Shahar Karin <shaharka@post.tau.ac.il>             *
    00005  *                                                                         *
    00006  *   This program is free software; you can redistribute it and/or modify  *
    00007  *   it under the terms of the GNU General Public License as published by  *
    00008  *   the Free Software Foundation; either version 2 of the License, or     *
    00009  *   (at your option) any later version.                                   *
    00010  *                                                                         *
    00011  *   This program is distributed in the hope that it will be useful,       *
    00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
    00014  *   GNU General Public License for more details.                          *
    00015  *                                                                         *
    00016  *   You should have received a copy of the GNU General Public License     *
    00017  *   along with this program; if not, write to the                         *
    00018  *   Free Software Foundation, Inc.,                                       *
    00019  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
    00020  ***************************************************************************/
    00021
    00022 #ifndef __PHISH_H
    00023 #define __PHISH_H
    00024
    00025
    00026 #ifdef __cplusplus
    00027 extern "C" {
    00028 #endif
    00029
    00030
    00031 #define PHISH_LIB_NAME "libphish"
    00032 #define PHISH_LIB_VERSION "0.1.0"
    00033
    00034
    00035 #include <sys/types.h>
    00036
    00038 #define PHISH_SUCCESS 0
    00039
    00040 #define PHISH_ERR_NOT_INITIALISED 1
    00041
    00042 #define PHISH_ERR_MEMORY 2
    00043
    00044 #define PHISH_ERR_SETTINGS 3
    00045
    00047 #define PHISH_ERR_MALFORMED_URL 11
    00048
    00050 #define PHISH_ERR_TCP_CONNECT 21
    00051
    00052 #define PHISH_ERR_SOCK_READ 22
    00053
    00054 #define PHISH_ERR_SOCK_WRITE 23
    00055
    00056 #define PHISH_ERR_RESOLVE 24
    00057
    00059 #define PHISH_ERR_HTTP_BAD_HEADER 25
    00060
    00061 #define PHISH_ERR_HTTP_BAD_STATUS 26
    00062
    00064 #define PHISH_ERR_FILE 31
    00065
    00066 #define PHISH_ERR_FILE_WRITE 32
    00067
    00069 #define PHISH_XML_READ_ERROR 41
    00070
    00071 #define PHISH_XML_PARSE_ERROR 42
    00072
    00074 #define PHISH_ERR_OPDB_BAD_REPLY 51
    00075
    00077 #define PHISH_XML_NOT_MODIFIED 61
    00078
    00079
    00080 #define PHISH_URL_LENGTH_LIMIT 4192
    00081
    00082
    00086 typedef int phish_result_t;
    00087
    00089 typedef enum { PHISH_ONLINE_MODE, PHISH_OFFLINE_MODE } phish_mode_t;
    00090
    00092 typedef enum { PHISH_RISK_UNKNOWN, PHISH_RISK_NONE,
    00093                PHISH_RISK_LOW, PHISH_RISK_MEDIUM,
    00094                PHISH_RISK_HIGH } phish_risk_t;
    00095
    00099 typedef struct
    00100 {
    00102   phish_risk_t risk_level;
    00103
    00105   int server;
    00106
    00108   int ip;
    00109
    00111   int path;
    00112
    00114   int domain;
    00115
    00119   char country[3];
    00120
    00122   size_t comments_length;
    00123
    00125   char *comments;
    00126
    00128   int user_scheme;
    00129
    00134   int suspicious_host;
    00135
    00136 } phish_url_data_t;
    00137
    00138
    00140 typedef struct phish_safelist_t phish_safe_list_t;
    00141
    00143 typedef struct phish_safelist_entry_t phish_safe_list_entry_t;
    00144
    00145
    00154 phish_result_t phish_init(const char *user_agent,
    00155                           const char *client_version);
    00156
    00160 phish_result_t phish_shutdown();
    00161
    00168 phish_result_t phish_checkURL(const char *url, phish_url_data_t *results);
    00169
    00177 phish_result_t phish_checkCountry(const char *url, phish_url_data_t *results);
    00178
    00182 phish_result_t phish_deleteURLData(phish_url_data_t *url_data);
    00183
    00189 phish_result_t phish_checkSafeList(const char *url, int *reply);
    00190
    00198 phish_result_t phish_downloadDBAsXML();
    00199
    00208 phish_result_t phish_getReportingURL(const char *url, char **result);
    00209
    00213 phish_result_t phish_getSafeListFirst(phish_safe_list_entry_t **entry);
    00214
    00219 phish_result_t phish_getSafeListNext(phish_safe_list_entry_t *entry,
    00220                                      phish_safe_list_entry_t **next);
    00221
    00226 phish_result_t phish_getSafeListData(phish_safe_list_entry_t *entry,
    00227                                      const char **url);
    00228
    00232 phish_result_t phish_addToCurrentSafeList(const char *url);
    00233
    00237 phish_result_t phish_newSafeList(phish_safe_list_t **list);
    00238
    00243 phish_result_t phish_addToSafeList(phish_safe_list_t *list, const char *url);
    00244
    00248 phish_result_t phish_setSafeList(phish_safe_list_t *list);
    00249
    00252 phish_result_t phish_saveSafeList();
    00253
    00256 phish_result_t phish_saveSettings();
    00257
    00258
    00262 phish_result_t phish_runningMode(phish_mode_t *result);
    00263
    00267 phish_result_t phish_siteQueryURL(const char **result);
    00268
    00272 phish_result_t phish_countryQueryURL(const char **result);
    00273
    00277 phish_result_t phish_reportSiteURL(const char **result);
    00278
    00282 phish_result_t phish_remoteXMLURL(const char **result);
    00283
    00287 phish_result_t phish_localXMLFile(const char **result);
    00288
    00292 phish_result_t phish_safeListFile(const char **result);
    00293
    00297 phish_result_t phish_setRunningMode(phish_mode_t mode);
    00298
    00302 phish_result_t phish_setSiteQueryURL(const char *url);
    00303
    00307 phish_result_t phish_setCountryQueryURL(const char *url);
    00308
    00312 phish_result_t phish_setReportSiteURL(const char *url);
    00313
    00317 phish_result_t phish_setRemoteXMLURL(const char *url);
    00318
    00322 phish_result_t phish_setLocalXMLFile(const char *path);
    00323
    00327 phish_result_t phish_setSafeListFile(const char *path);
    00328
    00329
    00330 #ifdef __cplusplus
    00331 }
    00332 #endif
    00333
    00334 #endif /* __PHISH_H */
    00335