~ubuntu-branches/ubuntu/utopic/edbrowse/utopic

« back to all changes in this revision

Viewing changes to src/tcp.h

  • Committer: Bazaar Package Importer
  • Author(s): Kapil Hari Paranjape
  • Date: 2008-04-09 18:55:23 UTC
  • mfrom: (1.1.4 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080409185523-dqokcloumyn1ibn4
Tags: 3.3.4-1
* New upstream version (3.3.4).
 - Convert between iso8859-1 and utf-8 on the fly.
 - Support reading of pdf using pdftohtml.
 - French translation of html documentation.
 - Old html documentation renamed to usersguide.
 - Additional documentation on philosophy.
* debian/control:
 - Changed homepage to sourcefource site.
 - Moved homepage from description to its own field.
 - Added "poppler-utils | xpdf-utils" to Recommends.
 - Added "www-browser", "mail-reader" and "editor" to Provides. 
 - Removed "XS-" from Vcs-Svn tag.
 - Standards-Version: 3.7.3
* debian/docs: Added new documentation files
  from "doc/" subdirectory.
* debian/watch: Updated to use sourceforge site.
* debian/edbrowse.doc-base:
  - Changed name of upstream provided html documentation from
    "ebdoc.html" to "usersguide.html".
  - Changed section from "net" to "Network/Web Browsing".
* debian/install: Compiled binary is now in "src/".

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* tcp.h: header file for NT/Unix TCP access layer */
 
2
 
 
3
#ifndef TCP_H
 
4
#define TCP_H 1
 
5
 
 
6
#ifdef _WIN32
 
7
#include <windows.h>
 
8
#else
 
9
#include <errno.h>
 
10
/* include this for htons() and its siblings */
 
11
#include <netinet/in.h>
 
12
#endif
 
13
 
 
14
typedef unsigned int IP32bit;
 
15
#define NULL_IP (IP32bit)(-1)
 
16
 
 
17
/* Unix/Linux has a max absolute path length of 256, I think. */
 
18
#define ABSPATH 256
 
19
 
 
20
/* Name of the current machine, as in tuvok.intellivoice.com */
 
21
extern char tcp_thisMachineName[];
 
22
 
 
23
/* IP address of the current machine, packed and displayable. */
 
24
extern char tcp_thisMachineDots[];      /* "192.128.25.1" */
 
25
extern IP32bit tcp_thisMachineIP;       /* pack the above string */
 
26
extern char tcp_farMachineDots[];       /* like the above, but for the far machine */
 
27
extern IP32bit tcp_farMachineIP;
 
28
extern short tcp_farMachinePort;
 
29
 
 
30
/* Set up the TCP stack and initialize the above variables */
 
31
/* Returns 0 (ok) or -1 (with errno set) */
 
32
int tcp_init(void);
 
33
 
 
34
/* routines to convert between names and IP addresses */
 
35
int tcp_isDots(const char *s);
 
36
IP32bit tcp_name_ip(const char *name);
 
37
char *tcp_ip_name(IP32bit packed_ip);
 
38
char *tcp_name_dots(const char *name);
 
39
char *tcp_dots_name(const char *displayable_ip);
 
40
char *tcp_ip_dots(IP32bit packed_ip);
 
41
IP32bit tcp_dots_ip(const char *displayable_ip);
 
42
 
 
43
/* Connect to a far machine.  Use one of the above routines to
 
44
 * convert to the packed IP address of the far machine.
 
45
 * Returns the socket handle, or -1 if there was a problem. */
 
46
int tcp_connect(IP32bit far_ip, int far_portnum, int timeout);
 
47
 
 
48
/* Listen for an incoming connection.
 
49
 * We expect only one such connection at a time.
 
50
 * Returns the socket handle, or -1 if there was a problem. */
 
51
int tcp_listen(int portnum, int once);
 
52
void tcp_unlisten(void);
 
53
 
 
54
/* Read and write data on the socket.
 
55
 * returns the number of bytes read, or -1 if there was a problem. */
 
56
int tcp_read(int handle, char *buf, int buflen);
 
57
int tcp_readFully(int handle, char *buf, int buflen);
 
58
int tcp_write(int handle, const char *buf, int buflen);
 
59
 
 
60
/* Close the socket */
 
61
void tcp_close(int handle);
 
62
 
 
63
/* Routines to establish, read, and write secure sockets. */
 
64
extern char *sslCerts;          /* ssl certificates to validate the secure server */
 
65
extern int verifyCertificates;  /* is a certificate required for the ssl connection? */
 
66
void ssl_init(void);
 
67
void ssl_verify_setting(void);
 
68
int ssl_newbind(int fd);
 
69
void ssl_done(void);
 
70
int ssl_read(char *buf, int len);
 
71
int ssl_write(const char *buf, int len);
 
72
int ssl_readFully(char *buf, int len);
 
73
 
 
74
#endif