1 (* wrapsock.def provides access to low level client socket primitives.
3 Copyright (C) 2008-2024 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. *)
27 DEFINITION MODULE wrapsock
;
33 Date : Wed Oct 1 08:40:21 2008
35 Description: provides a set of wrappers to some client side
36 tcp socket primatives.
39 FROM SYSTEM
IMPORT ADDRESS
;
40 FROM ChanConsts
IMPORT OpenResults
;
44 clientInfo
= ADDRESS
;
48 clientOpen - returns an ISO Modula-2 OpenResult.
49 It attempts to connect to: hostname:portNo.
50 If successful then the data structure, c,
51 will have its fields initialized.
54 PROCEDURE clientOpen (c
: clientInfo
;
57 portNo
: CARDINAL) : OpenResults
;
61 clientOpenIP - returns an ISO Modula-2 OpenResult.
62 It attempts to connect to: ipaddress:portNo.
63 If successful then the data structure, c,
64 will have its fields initialized.
67 PROCEDURE clientOpenIP (c
: clientInfo
;
69 portNo
: CARDINAL) : OpenResults
;
73 getClientPortNo - returns the portNo from structure, c.
76 PROCEDURE getClientPortNo (c
: clientInfo
) : CARDINAL ;
80 getClientHostname - fills in the hostname of the server
81 the to which the client is connecting.
84 PROCEDURE getClientHostname (c
: clientInfo
;
85 hostname
: ADDRESS
; high
: CARDINAL) ;
89 getClientSocketFd - returns the sockFd from structure, c.
92 PROCEDURE getClientSocketFd (c
: clientInfo
) : INTEGER ;
96 getClientIP - returns the sockFd from structure, s.
99 PROCEDURE getClientIP (c
: clientInfo
) : CARDINAL ;
103 getPushBackChar - returns TRUE if a pushed back character
107 PROCEDURE getPushBackChar (c
: clientInfo
; VAR ch
: CHAR) : BOOLEAN ;
111 setPushBackChar - returns TRUE if it is able to push back a
115 PROCEDURE setPushBackChar (c
: clientInfo
; ch
: CHAR) : BOOLEAN ;
119 getSizeOfClientInfo - returns the sizeof (opaque data type).
122 PROCEDURE getSizeOfClientInfo () : CARDINAL ;