libphish: phish.h File Reference

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

# phish.h File Reference

Go to the source code of this file.

## Data Structures
struct | phish_url_data_t
## Typedefs
typedef int | phish_result_t
typedef phish_safelist_t | phish_safe_list_t
typedef phish_safelist_entry_t | phish_safe_list_entry_t
## Enumerations
enum | phish_mode_t { PHISH_ONLINE_MODE, PHISH_OFFLINE_MODE }
enum | phish_risk_t { PHISH_RISK_UNKNOWN, PHISH_RISK_NONE, PHISH_RISK_LOW, PHISH_RISK_MEDIUM, PHISH_RISK_HIGH }
## Functions
phish_result_t | phish_init (const char *user_agent, const char *client_version)
phish_result_t | phish_shutdown ()
phish_result_t | phish_checkURL (const char *url, phish_url_data_t *results)
phish_result_t | phish_checkCountry (const char *url, phish_url_data_t *results)
phish_result_t | phish_deleteURLData (phish_url_data_t *url_data)
phish_result_t | phish_checkSafeList (const char *url, int *reply)
phish_result_t | phish_downloadDBAsXML ()
phish_result_t | phish_getReportingURL (const char *url, char **result)
phish_result_t | phish_getSafeListFirst (phish_safe_list_entry_t **entry)
phish_result_t | phish_getSafeListNext (phish_safe_list_entry_t *entry, phish_safe_list_entry_t **next)
phish_result_t | phish_getSafeListData (phish_safe_list_entry_t *entry, const char **url)
phish_result_t | phish_addToCurrentSafeList (const char *url)
phish_result_t | phish_newSafeList (phish_safe_list_t **list)
phish_result_t | phish_addToSafeList (phish_safe_list_t *list, const char *url)
phish_result_t | phish_setSafeList (phish_safe_list_t *list)
phish_result_t | phish_saveSafeList ()
phish_result_t | phish_saveSettings ()
phish_result_t | phish_runningMode (phish_mode_t *result)
phish_result_t | phish_siteQueryURL (const char **result)
phish_result_t | phish_countryQueryURL (const char **result)
phish_result_t | phish_reportSiteURL (const char **result)
phish_result_t | phish_remoteXMLURL (const char **result)
phish_result_t | phish_localXMLFile (const char **result)
phish_result_t | phish_safeListFile (const char **result)
phish_result_t | phish_setRunningMode (phish_mode_t mode)
phish_result_t | phish_setSiteQueryURL (const char *url)
phish_result_t | phish_setCountryQueryURL (const char *url)
phish_result_t | phish_setReportSiteURL (const char *url)
phish_result_t | phish_setRemoteXMLURL (const char *url)
phish_result_t | phish_setLocalXMLFile (const char *path)
phish_result_t | phish_setSafeListFile (const char *path)

## Typedef Documentation

typedef int phish_result_t

| All library functions return this type, which indicates whether the function succeeded or the type of error that occurred.

typedef struct phish_safelist_t phish_safe_list_t

| The safe list

typedef struct phish_safelist_entry_t phish_safe_list_entry_t

| An entry in the safe list

## Enumeration Type Documentation

enum phish_mode_t

  | Possible running modes for checking URLs. Enumerator:
  PHISH_ONLINE_MODE |
  PHISH_OFFLINE_MODE |

enum phish_risk_t

  | Risk level indication. Enumerator:
  PHISH_RISK_UNKNOWN |
  PHISH_RISK_NONE |
  PHISH_RISK_LOW |
  PHISH_RISK_MEDIUM |
  PHISH_RISK_HIGH |

## Function Documentation

phish_result_t phish_init | ( | const char * | user_agent,
|  | const char * | client_version
| ) |

  | Initialise the library. This function must be called before any other library function can be called. Functions will return PHISH_ERR_NOT_INITIALISED if called without having the library initialised. Parameters:
  | user_agent | user agent string of client (browser) used to identify itself
  | client_version | version string of client (e.g. anti-phishing toolbar version

phish_result_t phish_shutdown | ( |  | ) |

| Saves settings and shuts the library down. This function should be called when you're finished using the library.

phish_result_t phish_checkURL | ( | const char * | url,
|  | phish_url_data_t * | results
| ) |

  | Checks a URL. The checking resource (i.e. server or local XML file) is determined according to the settings. Parameters:
  | url | complete URL to check
  | results | pointer to results structure which will be filled with results of checking the URL

phish_result_t phish_checkCountry | ( | const char * | url,
|  | phish_url_data_t * | results
| ) |

  | Checks only the country of a site. Useful for checking a site's country in offline mode, where the other URL data is obtained from the local XML file which was previsouly downloaded. Parameters:
  | url | complete URL to check
  | results | pointer to results structure whose country field will be filled with the country of the given URL

phish_result_t phish_deleteURLData | ( | phish_url_data_t * | url_data | ) |

  | Deallocates memory associated with URL data structure. Parameters:
  | url_data | pointer to URL data structure to free.

phish_result_t phish_checkSafeList | ( | const char * | url,
|  | int * | reply
| ) |

  | Checks if a URL is in the safe list. Parameters:
  | url | complete URL to check
  | reply | pointer to integer which will be assigned 1 if the URL is in the safe list, 0 otherwise

phish_result_t phish_downloadDBAsXML | ( |  | ) |

| Download the sites database as an XML file from the server. If the database hasn't been modified since the last download, no download will happen. Returns: PHISH_SUCCESS if the database was updated and the XML file was downloaded and saved successfully, PHISH_XML_NOT_MODIFIED if the database hasn't been modified.

phish_result_t phish_getReportingURL | ( | const char * | url,
|  | char ** | result
| ) |

  | Given a URL of a site to report, return a URL that the client should go to which contains the data required to submit a site report. Use this when you want to report a site by pointing browser to returned URL. Parameters:
  | url | URL of site to report
  | result | pointer to string which will be allocated and filled with URL to point client to in order to submit the report for this site

phish_result_t phish_getSafeListFirst | ( | phish_safe_list_entry_t ** | entry | ) |

  | Returns the first entry in the safe list. Parameters:
  | entry | will be assigned with pointer to first entry in safe list

phish_result_t phish_getSafeListNext | ( | phish_safe_list_entry_t * | entry,
|  | phish_safe_list_entry_t ** | next
| ) |

  | Returns the next entry in the safe list. Parameters:
  | entry | entry before the entry that will be returned
  | next | will be assigned with pointer to entry after entry given above

phish_result_t phish_getSafeListData | ( | phish_safe_list_entry_t * | entry,
|  | const char ** | url
| ) |

  | Returns the URL associated with a safe list entry. Parameters:
  | entry | entry whose URL is requested
  | url | will be assigned with URL of safe list entry

phish_result_t phish_addToCurrentSafeList | ( | const char * | url | ) |

  | Adds a URL to the currently used safe list. Parameters:
  | url | URL to add

phish_result_t phish_newSafeList | ( | phish_safe_list_t ** | list | ) |

  | Creates a new, empty safe list. Parameters:
  | list | will be assigned with newly created safe list

phish_result_t phish_addToSafeList | ( | phish_safe_list_t * | list,
|  | const char * | url
| ) |

  | Adds a URL to a safe list. Parameters:
  | list | safe list to add URL to
  | url | URL to add

phish_result_t phish_setSafeList | ( | phish_safe_list_t * | list | ) |

  | Sets the safe list to a new one. Parameters:
  | list | new safe list to use

phish_result_t phish_saveSafeList | ( |  | ) |

| Saves the safe list to the safe list file.

phish_result_t phish_saveSettings | ( |  | ) |

| Saves the settings to the settings file.

phish_result_t phish_runningMode | ( | phish_mode_t * | result | ) |

  | Returns the running mode. Parameters:
  | result | will be assigned with current running mode

phish_result_t phish_siteQueryURL | ( | const char ** | result | ) |

  | Returns the URL used for site queries on the server. Parameters:
  | result | will be assigned with current site query URL

phish_result_t phish_countryQueryURL | ( | const char ** | result | ) |

  | Returns the URL used for country queries on the server. Parameters:
  | result | will be assigned with current country query URL

phish_result_t phish_reportSiteURL | ( | const char ** | result | ) |

  | Returns the URL used for reporting sites on the server. Parameters:
  | result | will be assigned with current site reporting URL

phish_result_t phish_remoteXMLURL | ( | const char ** | result | ) |

  | Returns the URL to the XML file to download on the server Parameters:
  | result | will be assigned with current URL of the XML file

phish_result_t phish_localXMLFile | ( | const char ** | result | ) |

  | Returns the name of the local XML file. Parameters:
  | result | will be assigned with current name of the local XML file

phish_result_t phish_safeListFile | ( | const char ** | result | ) |

  | Returns the name of the safe list file. Parameters:
  | result | will be assigned with current name of the safe list file

phish_result_t phish_setRunningMode | ( | phish_mode_t | mode | ) |

  | Sets the running mode. Parameters:
  | mode | new mode to use

phish_result_t phish_setSiteQueryURL | ( | const char * | url | ) |

  | Sets the site queries URL. Parameters:
  | url | new URL to use

phish_result_t phish_setCountryQueryURL | ( | const char * | url | ) |

  | Sets the country queries URL. Parameters:
  | url | new URL to use

phish_result_t phish_setReportSiteURL | ( | const char * | url | ) |

  | Sets the site reporting URL. Parameters:
  | url | new URL to use

phish_result_t phish_setRemoteXMLURL | ( | const char * | url | ) |

  | Sets the remote XML file URL. Parameters:
  | url | new URL to use

phish_result_t phish_setLocalXMLFile | ( | const char * | path | ) |

  | Sets the local XML file name. Parameters:
  | path | new file name to use

phish_result_t phish_setSafeListFile | ( | const char * | path | ) |

  | Sets the safe list file name. Parameters:
  | path | new file name to use