File: 12-upstream-tunnel-h-doc.patch

package info (click to toggle)
httptunnel 3.3%2Bdfsg-6
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,500 kB
  • sloc: ansic: 4,754; makefile: 26; sh: 4
file content (116 lines) | stat: -rw-r--r-- 4,100 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From: Teemu Hukkanen <tjhukkan@iki.fi>
Date: Sat, 16 Mar 2024 16:04:36 +0200
Subject: Document tunnel programming interface

Origin: upstream
Forwarded: not-needed
---
 ChangeLog |  5 +++++
 tunnel.h  | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 56 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b09452a..cbc3287 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-06-12  lars brinkhoff  <lars@nocrew.org>
+
+	* tunnel.h: Improved documentation for tunnel programming
+	inteface.
+
 2001-05-10  lars brinkhoff  <lars@nocrew.org>
 
 	* common.c (log_level): Where possible, use fputs and fputc
diff --git a/tunnel.h b/tunnel.h
index 628127b..8e770f8 100644
--- a/tunnel.h
+++ b/tunnel.h
@@ -14,14 +14,13 @@ Tunnel *tunnel_new_client (const char *host, int host_port,
 
   Create a new HTTP tunnel client.
 
-Tunnel *tunnel_new_server (const char *host,
-                           int port,
+Tunnel *tunnel_new_server (const char *host, int port,
 			   size_t content_length);
 
-  Create a new HTTP tunnel server.  If LENGTH is 0, the Content-Length
-  of the HTTP GET response will be determined automatically in some way.
-  If HOST is not NULL, use it to bind the server socket to a specific
-  network interface.
+  Create a new HTTP tunnel server.  If CONTENT_LENGTH is 0, the
+  Content-Length of the HTTP GET response will be determined
+  automatically in some way.  If HOST is not NULL, use it to bind the
+  server socket to a specific network interface.
 
 int tunnel_connect (Tunnel *tunnel);
 
@@ -39,8 +38,8 @@ int tunnel_pollin_fd (Tunnel *tunnel);
 ssize_t tunnel_read (Tunnel *tunnel, void *data, size_t length);
 ssize_t tunnel_write (Tunnel *tunnel, void *data, size_t length);
 
-  Read or write to the tunnel.  Same semantics as with read() and
-  write().  Watch out for return values less than LENGTH.
+  Read or write to the tunnel.  Same semantics as read() and write().
+  Watch out for return values less than LENGTH.
 
 int tunnel_padding (Tunnel *tunnel, size_t length);
 
@@ -50,12 +49,55 @@ int tunnel_maybe_pad (Tunnel *tunnel, size_t length);
 
   Pad to nearest even multiple of LENGTH.
 
+int tunnel_setopt (Tunnel *tunnel, const char *opt, void *data);
+int tunnel_getopt (Tunnel *tunnel, const char *opt, void *data);
+
+  Set or get a tunnel option.  Valid options are:
+
+  * strict_content_length
+
+    DATA must be a pointer to an int.  If the int is nonzero, the
+    tunnel will always honor Content-Length.  Otherwise, less than
+    Content-Length bytes may be sent in a request.
+
+  * keep_alive
+
+    DATA must be a pointer to an int.  If the int is nonzero,
+    keep-alive bytes will be sent when the connection is idle.
+    Otherwise, no keep-alive bytes will be sent.
+
+  * max_connection_age
+
+    DATA must be a pointer to an int.  The int specifies the maximum
+    time a connection will be kept open, in seconds.
+
+  * proxy_authorization
+
+    DATA must be a pointer to a char pointer.  The char pointer
+    specifies the proxy authorization string, or NULL if no proxy
+    authorization string is to be used.  When this option is set, the
+    string will be copied into a newly malloced memory region.
+    Likewise, when the option is read, the returned string is copied
+    into a newly malloced memory region which the caller must accept
+    responsibility to manage.
+
+  * user_agent
+
+    DATA must be a pointer to a char pointer.  The char pointer
+    specifies the User-Agent field to be used in HTTP request headers,
+    or is NULL is no User-Agent field is to be used.  When this option
+    is set, the string will be copied into a newly malloced memory
+    region.  Likewise, when the option is read, the returned string is
+    copied into a newly malloced memory region which the caller must
+    accept responsibility to manage.
+
 int tunnel_close (Tunnel *tunnel);
 
   Close the tunnel.
 
 void tunnel_destroy (Tunnel *tunnel);
-*/
+
+  Free all resources associated with the tunnel object.  */
 
 #ifndef TUNNEL_H
 #define TUNNEL_H