root / trunk / src / dot / proxy / off.h

Revision 7618, 2.4 kB (checked in by BradNeuberg, 22 months ago)

Local and remote SVN repositories somehow became out of sync and corrupted -- re-adding these in

Line 
1#ifndef __off_h
2#ifndef NO_OFFLINE_SUPPORT /* Compiles out offline support */
3
4/**
5        This file contains the implementation for offline
6        access for web applications.
7       
8        Author: Brad Neuberg, bkn3@columbia.edu
9*/
10
11/*
12    The JavaScript callback function name that will receive
13    the results of a call to the offline API. Two arguments
14    will be given: the API function that was called, such as
15    "isRunning", and the results of this call, which is call
16    dependent. If an unknown method was called then the
17    method name is "UnknownMethod".
18
19    Example:
20
21      window.offlineCacheCallback("isRunning", true);
22*/
23#define OFF_JAVASCRIPT_CALLBACK "window.offlineCacheCallback"
24
25/*
26    The version of our offline system. This is not the same as
27    our Polipo version, since the offline architecture could
28    potentially include other components such as SQLite.
29*/
30#define OFF_OFFLINE_VERSION "0.01"
31
32
33/**
34        We save our list of offline-enabled web apps
35        in a link list, with each list link entry being
36        the string host name with a pointer to the next
37        entry.
38*/
39
40struct offline_list_entry{
41        char *host_ptr;
42        struct offline_list_entry *next_ptr;
43} *offline_list_ptr;
44
45void preinitOffline(void);
46
47/**
48        Initializes the offline web app support.
49*/
50void initOffline(void);
51
52/**
53        Makes the given host offline-enabled.
54       
55        Returns 1 if the host was added successfully,
56        0 otherwise.
57*/
58int addOfflineHost(char host[]);
59
60/**
61        Removes the given host from being offline-enabled.
62
63        Returns 1 if the host was remove successfully,
64        0 otherwise.
65*/
66int removeOfflineHost(char host[]);
67
68/**
69        Returns 1 if the given host is offline-enabled, 0 otherwise.
70*/
71int isHostAvailableOffline(char host[]);
72
73/** Saves our list of offline-enabled sites. */
74int saveOfflineList(void);
75
76/** Loads our list of offline-enabled sites. */
77int loadOfflineList(void);
78
79/**
80        Sets our the path + filename to our list of offline-enabled web sites,
81        such as "/Users/foobar/.polipo/offline_list.txt".
82*/
83void setOfflineFileName(char *name_ptr);
84
85/*
86        Goes online; note that this just sets a flag
87        whether we are online or not -- it does not
88        attempt to see if we actually have a network
89        available.
90*/
91void goOnline(void);
92
93/* Goes offline */
94void goOffline(void);
95
96/*
97        Returns 1 if we are in online mode, 0 otherwise.
98        Note that this doesn't attempt to see if we are
99        really on the network, it just sees if our
100        goOnline() or goOffline() have been
101        called.
102*/
103int isOnline(void);
104
105#endif /* NO_OFFLINE_SUPPORT */
106#endif /* __off_h */
Note: See TracBrowser for help on using the browser.