summaryrefslogtreecommitdiff
path: root/gopherfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'gopherfs.h')
-rw-r--r--gopherfs.h65
1 files changed, 25 insertions, 40 deletions
diff --git a/gopherfs.h b/gopherfs.h
index d71037a1c..376bec482 100644
--- a/gopherfs.h
+++ b/gopherfs.h
@@ -32,44 +32,35 @@
#include <hurd/hurd_types.h>
#define GOPHER_SERVER_NAME "gopherfs"
#define GOPHER_SERVER_VERSION "0.1.2"
-/* declaration of global config parapeters */
-extern char *gopherfs_root_server;
-extern unsigned short gopherfs_root_port;
-extern char *gopherfs_server_dir;
-extern int debug_flag;
+#include "debug.h"
+
extern volatile struct mapped_time_value *gopherfs_maptime;
+/* gopherfs parameters. */
+struct gopherfs_params
+{
+ char *server; /* Server host name. */
+ unsigned short port; /* Port number. */
+ char *dir; /* Root directory. */
+};
-/* handle all initial parameter parsing */
-error_t gopherfs_parse_args (int argc, char **argv);
+#include "gopher.h"
/* private data per `struct node' */
struct netnode
{
- char *name;
- char *selector;
- char *server;
- unsigned short port;
- enum
- {
- GPHR_FILE = '0', /* Item is a file */
- GPHR_DIR = '1', /* Item is a directory */
- GPHR_CSOPH = '2', /* Item is a CSO phone-book server */
- GPHR_ERROR = '3', /* Error */
- GPHR_BINHEX = '4', /* Item is a BinHexed Macintosh file */
- GPHR_DOSBIN = '5', /* Item is DOS binary archive of some sort */
- GPHR_UUENC = '6', /* Item is a UNIX uuencoded file */
- GPHR_SEARCH = '7', /* Item is an Index-Search server */
- GPHR_TELNET = '8', /* Item points to a text-based telnet session */
- GPHR_BIN = '9' /* Item is a binary file */
- }
- type;
+ /* Gopher parameters (type, name, selector, server, port). */
+ struct gopher_entry *e;
+
+ /* The directory entry for this node. */
+ struct node *dir;
/* directory entries if this is a directory */
struct node *ents;
boolean_t noents;
unsigned int num_ents;
+
/* XXX cache reference ? */
};
@@ -83,33 +74,27 @@ struct gopherfs
gid_t gid;
ino_t next_inode;
/* some kind of cache thingy */
+
+ struct gopherfs_params *params;
};
+
/* global pointer to the filesystem */
extern struct gopherfs *gopherfs;
-/* do a DNS lookup for NAME and store result in *ENT */
-error_t lookup_host (char *name, struct hostent **ent);
-
-/* store the remote socket in *FD after writing a gopher selector
- to it */
-error_t open_selector (struct netnode *node, int *fd);
-
-/* make an instance of `struct netnode' with the specified parameters,
- return NULL on error */
-struct netnode *gopherfs_make_netnode (char type, char *name, char *selector,
- char *server, unsigned short port);
+/* handle all initial parameter parsing */
+error_t gopherfs_parse_args (int argc, char **argv, struct gopherfs_params *params);
/* fetch a directory node from the gopher server
DIR should already be locked */
-error_t fill_dirnode (struct netnode *dir);
+error_t fill_dirnode (struct node *dir);
/* free an instance of `struct netnode' */
void free_netnode (struct netnode *node);
-/* make an instance of `struct node' with the specified parameters,
+/* make an instance of `struct node' in DIR with the parameters in ENTRY,
return NULL on error */
-struct node *gopherfs_make_node (char type, char *name, char *selector,
- char *server, unsigned short port);
+struct node *gopherfs_make_node (struct gopher_entry *entry,
+ struct node *dir);
/* free an instance of `struct node' */
void free_node (struct node *node);