NetSurf
Data Fields
gui_fetch_table Struct Reference

function table for fetcher operations. More...

#include <fetch.h>

Data Fields

const char *(* filetype )(const char *unix_path)
 Determine the MIME type of a local file. More...
 
struct nsurl *(* get_resource_url )(const char *path)
 Translate resource to full url. More...
 
nserror(* get_resource_data )(const char *path, const uint8_t **data, size_t *data_len)
 Translate resource to source data. More...
 
nserror(* release_resource_data )(const uint8_t *data)
 Releases source data. More...
 
char *(* mimetype )(const char *ro_path)
 Find a MIME type for a local file. More...
 
int(* socket_open )(int domain, int type, int protocol)
 Open a socket. More...
 
int(* socket_close )(int socket)
 Close a socket. More...
 

Detailed Description

function table for fetcher operations.

Definition at line 33 of file fetch.h.

Field Documentation

◆ filetype

const char *(* gui_fetch_table::filetype) (const char *unix_path)

Determine the MIME type of a local file.

Note
used in file fetcher
Parameters
unix_pathUnix style path to file on disk
Returns
Pointer to MIME type string (should not be freed) - invalidated on next call to fetch_filetype.

Definition at line 45 of file fetch.h.

Referenced by fetch_file_process_plain(), fetch_resource_data_handler(), gui_default_mimetype(), process_dir_ent(), and verify_fetch_register().

◆ get_resource_data

nserror(* gui_fetch_table::get_resource_data) (const char *path, const uint8_t **data, size_t *data_len)

Translate resource to source data.

Note
Only used in resource fetcher

Obtains the data for a resource directly

Parameters
pathThe path of the resource to locate.
dataPointer to recive data into
data_lenPointer to length of returned data
Returns
NSERROR_OK and the data and length values updated else appropriate error code.

Definition at line 77 of file fetch.h.

Referenced by fetch_resource_initialise(), and verify_fetch_register().

◆ get_resource_url

struct nsurl *(* gui_fetch_table::get_resource_url) (const char *path)

Translate resource to full url.

Note
Only used in resource protocol fetcher

Transforms a resource protocol path into a full URL. The returned URL is used as the target for a redirect. The caller takes ownership of the returned nsurl including unrefing it when finished with it.

Parameters
pathThe path of the resource to locate.
Returns
A netsurf url object containing the full URL of the resource path or NULL if a suitable resource URL can not be generated.

Definition at line 45 of file fetch.h.

Referenced by fetch_resource_initialise(), and verify_fetch_register().

◆ mimetype

char *(* gui_fetch_table::mimetype) (const char *ro_path)

Find a MIME type for a local file.

Note
only used in curl fetcher in form file controls on RISC OS otherwise its a strdup of a filetype call.
Parameters
ro_pathRISC OS style path to file on disk
Returns
MIME type string (on heap, caller should free), or NULL

Definition at line 100 of file fetch.h.

Referenced by fetch_curl_postdata_convert(), and verify_fetch_register().

◆ release_resource_data

nserror(* gui_fetch_table::release_resource_data) (const uint8_t *data)

Releases source data.

Note
Only used in resource fetcher

Releases source data obtained from get_resource_data()

Parameters
dataThe value returned from a previous get_resource_data call
Returns
NSERROR_OK on success else appropriate error code.

Definition at line 89 of file fetch.h.

Referenced by fetch_resource_finalise(), and verify_fetch_register().

◆ socket_close

int(* gui_fetch_table::socket_close) (int socket)

Close a socket.

Parameters
socketSocket descriptor
Returns
0 on success, -1 on error and errno set

Definition at line 118 of file fetch.h.

Referenced by fetch_curl_socket_close(), and verify_fetch_register().

◆ socket_open

int(* gui_fetch_table::socket_open) (int domain, int type, int protocol)

Open a socket.

Parameters
domainCommunication domain
typeSocket type
protocolProtocol
Returns
Socket descriptor on success, -1 on error and errno set

Definition at line 110 of file fetch.h.

Referenced by fetch_curl_socket_open(), and verify_fetch_register().


The documentation for this struct was generated from the following file: