4580615 [rkeene@sledge /home/rkeene/devel/libopennet-0.9.9]$ cat -n opennet.h
 1 /*
 2  * Copyright (C) 2001, 2002, and 2003  Roy Keene
 3  *
 4  * This program is free software; you can redistribute it and/or
 5  * modify it under the terms of the GNU Lesser General Public License
 6  * as published by the Free Software Foundation; either version 2.1
 7  * of the License, or (at your option) any later version.
 8  *
 9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17  *
18  *      email: libopennet@rkeene.org
19  */
20 
21 #ifndef _OPENNET_H 
22 #define _OPENNET_H
23 #include <sys/types.h>
24 #include <unistd.h>
25 #include <stdio.h>
26 
27 
28 #ifdef  __cplusplus
29 extern "C" {
30 #endif
31 
32 typedef struct {
33     int fd;
34     char *buf;
35     char *buf_s;
36     unsigned long bufsize;
37     unsigned long bufsize_s;
38     unsigned long bufused;
39     int eof;
40     int socket;
41     off_t pos;
42     off_t length;
43     char *url;
44     int free_buf;
45 } NETFILE;
46 
47 
48 /* Open a URL.  Same syntax as POSIX open(), except `mode' is required. */
49 int open_net(const char *pathname, int flags, mode_t mode);
50 
51 /* Seek in a file or stream.  Same syntax as POSIX lseek(). */
52 off_t lseek_net(int filedes, off_t offset, int whence);
53 
54 /* A more deterministic POSIX read(). */
55 ssize_t read_net(int fd, void *buf, size_t count);
56 
57 /* ANSI fopen() clone. */
58 NETFILE *fopen_net(const char *path, const char *mode);
59 
60 /* ANSI fgets() clone */
61 char *fgets_net(char *s, int size, NETFILE *stream);
62 
63 /* ANSI feof() clone */
64 int feof_net(NETFILE *stream);
65 
66 /* ANSI fread() clone */
67 size_t fread_net(void *ptr, size_t size, size_t nmemb, NETFILE *stream);
68 
69 /* ANSI fseek() clone. */
70 int fseek_net(NETFILE *stream, long offset, int whence);
71 
72 /* ANSI ftell() clone. */
73 long ftell_net(NETFILE *stream);
74 
75 /* ANSI fclose() clone */
76 int fclose_net(NETFILE *stream);
77 
78 /* ANSI fseeko() clone */
79 int fseeko_net(NETFILE *stream, off_t offset, int whence);
80 
81 /* ANSI ftello() clone */
82 off_t ftello_net(NETFILE *stream);
83 
84 /* ANSI setvbuf() clone */
85 int setvbuf_net(NETFILE *stream, char *buf, int mode, size_t size);
86 
87 /* Return the length of a stream, if possible. ((off_t) -1) if not available */
88 off_t flength_net(NETFILE *stream);
89 
90 #ifdef  __cplusplus
91 }
92 #endif
93 
94 #endif
4580616 [rkeene@sledge /home/rkeene/devel/libopennet-0.9.9]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2006-10-12 22:36:24