~ubuntu-branches/ubuntu/jaunty/edbrowse/jaunty-security

« back to all changes in this revision

Viewing changes to tcp.h

  • Committer: Bazaar Package Importer
  • Author(s): Kapil Hari Paranjape
  • Date: 2006-10-20 10:47:30 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061020104730-o7vxbrypwaz932dt
Tags: 3.1.2-1
* New upstream version (3.1.2). Closes: #306486.
  - programs now written in C
  - support for javascript.
* debian/control:
  - added Kapil Hari Paranjape to Uploaders.
  - Build-depends on "libssl-dev", "libmozjs-dev", "libpcre3-dev".
  - Standards-Version to 3.7.2. No changes required.
* debian/rules:
  - add "noopt" feature.
  - set CFLAGS and LIBS.
  - Put $(MAKE) into the build rules.
* debian/copyright: Edited to add the current copyright which
  is GPL with the exception for linking with OpenSSL.
* debian/docs: added "README".
* debian/examples: added "jsrt".

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
/* Name of the current machine, as in tuvok.intellivoice.com */
 
15
extern char tcp_thisMachineName[];
 
16
 
 
17
/* IP address of the current machine, packed and displayable. */
 
18
extern char tcp_thisMachineDots[];      /* "192.128.25.1" */
 
19
extern long tcp_thisMachineIP;  /* pack the above string into a long */
 
20
extern char tcp_farMachineDots[];       /* like the above, but for the far machine */
 
21
extern long tcp_farMachineIP;
 
22
extern short tcp_farMachinePort;
 
23
 
 
24
/* Set up the TCP stack and initialize the above variables */
 
25
/* Returns 0 (ok) or -1 (with errno set) */
 
26
int tcp_init();
 
27
 
 
28
/* routines to convert between names and IP addresses */
 
29
int tcp_isDots(const char *s);
 
30
long tcp_name_ip(const char *name);
 
31
char *tcp_ip_name(long packed_ip);
 
32
char *tcp_name_dots(const char *name);
 
33
char *tcp_dots_name(const char *displayable_ip);
 
34
char *tcp_ip_dots(long packed_ip);
 
35
long tcp_dots_ip(const char *displayable_ip);
 
36
 
 
37
/* Connect to a far machine.  Use one of the above routines to
 
38
 * convert to the packed IP address of the far machine.
 
39
 * Returns the socket handle, or -1 if there was a problem. */
 
40
int tcp_connect(long far_ip, int far_portnum, int timeout);
 
41
 
 
42
/* Listen for an incoming connection.
 
43
 * We expect only one such connection at a time.
 
44
 * Returns the socket handle, or -1 if there was a problem. */
 
45
int tcp_listen(int portnum, int once);
 
46
void tcp_unlisten(void);
 
47
 
 
48
/* Read and write data on the socket.
 
49
 * returns the number of bytes read, or -1 if there was a problem. */
 
50
int tcp_read(int handle, char *buf, int buflen);
 
51
int tcp_readFully(int handle, char *buf, int buflen);
 
52
int tcp_write(int handle, const char *buf, int buflen);
 
53
 
 
54
/* Close the socket */
 
55
void tcp_close(int handle);
 
56
 
 
57
#endif