Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared » !JFShared/ISvcs/h/iservices

!JFShared/ISvcs/h/iservices

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-02 B.adf » JFShared
Filename: !JFShared/ISvcs/h/iservices
Read OK:
File size: 0838 bytes
Load address: 0000
Exec address: 0000
File contents
/*******************************************************************
 File:     IServices.h
 Purpose:  Internet services veneer
 Author:   Justin Fletcher
 Date:     02 Dec 1992
 ******************************************************************/

#ifndef __ISERVICES_H
#define __ISERVICES_H
#define Internet_GetServiceByPort 0x46440
#define Internet_GetServiceByName 0x46441
#define Internet_DecodeError      0x46442

typedef struct servent {
  char *servname;
  char **aliases;
  int  port;
  char *protocol; /* tcp or udp usually */
} servent;

/*********************************************** <c> Gerph *********
 Function:     getservbyport
 Description:  Reads the servent block for a service, given it's port
               This block is not guarenteed to remain constant, so
               copy it quickly.
 Parameters:   port = port number
               proto-> protocol name (tcp/udp), or 0 for default
 Returns:      pointer to servent block, or 0 if not known
 ******************************************************************/
servent *getservbyport(int port,char *proto);

/*********************************************** <c> Gerph *********
 Function:     getservbyname
 Description:  Reads the servent block for a service, given it's name
               This block is not guarenteed to remain constant, so
               copy it quickly.
 Parameters:   name-> name of the service (textual, or numeric)
               proto-> protocol name (tcp/udp), or 0 for default
 Returns:      pointer to servent block, or 0 if not known
 ******************************************************************/
servent *getservbyname(char *name,char *proto);

/*********************************************** <c> Gerph *********
 Function:     decodeerror
 Description:  Returns the textual version of the errno variable
               This should not be modified.
 Parameters:   errno = errno value
 Returns:      pointer to the textual version of the error, or 0
               if not known
 ******************************************************************/
   char *decodeerror(int errno);
#endif
00000000  2f 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/***************|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 2a 0a 20 46 69  6c 65 3a 20 20 20 20 20  |****. File:     |
00000050  49 53 65 72 76 69 63 65  73 2e 68 0a 20 50 75 72  |IServices.h. Pur|
00000060  70 6f 73 65 3a 20 20 49  6e 74 65 72 6e 65 74 20  |pose:  Internet |
00000070  73 65 72 76 69 63 65 73  20 76 65 6e 65 65 72 0a  |services veneer.|
00000080  20 41 75 74 68 6f 72 3a  20 20 20 4a 75 73 74 69  | Author:   Justi|
00000090  6e 20 46 6c 65 74 63 68  65 72 0a 20 44 61 74 65  |n Fletcher. Date|
000000a0  3a 20 20 20 20 20 30 32  20 44 65 63 20 31 39 39  |:     02 Dec 199|
000000b0  32 0a 20 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |2. *************|
000000c0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000000f0  2a 2a 2a 2a 2a 2f 0a 0a  23 69 66 6e 64 65 66 20  |*****/..#ifndef |
00000100  5f 5f 49 53 45 52 56 49  43 45 53 5f 48 0a 23 64  |__ISERVICES_H.#d|
00000110  65 66 69 6e 65 20 5f 5f  49 53 45 52 56 49 43 45  |efine __ISERVICE|
00000120  53 5f 48 0a 23 64 65 66  69 6e 65 20 49 6e 74 65  |S_H.#define Inte|
00000130  72 6e 65 74 5f 47 65 74  53 65 72 76 69 63 65 42  |rnet_GetServiceB|
00000140  79 50 6f 72 74 20 30 78  34 36 34 34 30 0a 23 64  |yPort 0x46440.#d|
00000150  65 66 69 6e 65 20 49 6e  74 65 72 6e 65 74 5f 47  |efine Internet_G|
00000160  65 74 53 65 72 76 69 63  65 42 79 4e 61 6d 65 20  |etServiceByName |
00000170  30 78 34 36 34 34 31 0a  23 64 65 66 69 6e 65 20  |0x46441.#define |
00000180  49 6e 74 65 72 6e 65 74  5f 44 65 63 6f 64 65 45  |Internet_DecodeE|
00000190  72 72 6f 72 20 20 20 20  20 20 30 78 34 36 34 34  |rror      0x4644|
000001a0  32 0a 0a 74 79 70 65 64  65 66 20 73 74 72 75 63  |2..typedef struc|
000001b0  74 20 73 65 72 76 65 6e  74 20 7b 0a 20 20 63 68  |t servent {.  ch|
000001c0  61 72 20 2a 73 65 72 76  6e 61 6d 65 3b 0a 20 20  |ar *servname;.  |
000001d0  63 68 61 72 20 2a 2a 61  6c 69 61 73 65 73 3b 0a  |char **aliases;.|
000001e0  20 20 69 6e 74 20 20 70  6f 72 74 3b 0a 20 20 63  |  int  port;.  c|
000001f0  68 61 72 20 2a 70 72 6f  74 6f 63 6f 6c 3b 20 2f  |har *protocol; /|
00000200  2a 20 74 63 70 20 6f 72  20 75 64 70 20 75 73 75  |* tcp or udp usu|
00000210  61 6c 6c 79 20 2a 2f 0a  7d 20 73 65 72 76 65 6e  |ally */.} serven|
00000220  74 3b 0a 0a 2f 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |t;../***********|
00000230  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000250  2a 2a 2a 2a 20 3c 63 3e  20 47 65 72 70 68 20 2a  |**** <c> Gerph *|
00000260  2a 2a 2a 2a 2a 2a 2a 2a  0a 20 46 75 6e 63 74 69  |********. Functi|
00000270  6f 6e 3a 20 20 20 20 20  67 65 74 73 65 72 76 62  |on:     getservb|
00000280  79 70 6f 72 74 0a 20 44  65 73 63 72 69 70 74 69  |yport. Descripti|
00000290  6f 6e 3a 20 20 52 65 61  64 73 20 74 68 65 20 73  |on:  Reads the s|
000002a0  65 72 76 65 6e 74 20 62  6c 6f 63 6b 20 66 6f 72  |ervent block for|
000002b0  20 61 20 73 65 72 76 69  63 65 2c 20 67 69 76 65  | a service, give|
000002c0  6e 20 69 74 27 73 20 70  6f 72 74 0a 20 20 20 20  |n it's port.    |
000002d0  20 20 20 20 20 20 20 20  20 20 20 54 68 69 73 20  |           This |
000002e0  62 6c 6f 63 6b 20 69 73  20 6e 6f 74 20 67 75 61  |block is not gua|
000002f0  72 65 6e 74 65 65 64 20  74 6f 20 72 65 6d 61 69  |renteed to remai|
00000300  6e 20 63 6f 6e 73 74 61  6e 74 2c 20 73 6f 0a 20  |n constant, so. |
00000310  20 20 20 20 20 20 20 20  20 20 20 20 20 20 63 6f  |              co|
00000320  70 79 20 69 74 20 71 75  69 63 6b 6c 79 2e 0a 20  |py it quickly.. |
00000330  50 61 72 61 6d 65 74 65  72 73 3a 20 20 20 70 6f  |Parameters:   po|
00000340  72 74 20 3d 20 70 6f 72  74 20 6e 75 6d 62 65 72  |rt = port number|
00000350  0a 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |.               |
00000360  70 72 6f 74 6f 2d 3e 20  70 72 6f 74 6f 63 6f 6c  |proto-> protocol|
00000370  20 6e 61 6d 65 20 28 74  63 70 2f 75 64 70 29 2c  | name (tcp/udp),|
00000380  20 6f 72 20 30 20 66 6f  72 20 64 65 66 61 75 6c  | or 0 for defaul|
00000390  74 0a 20 52 65 74 75 72  6e 73 3a 20 20 20 20 20  |t. Returns:     |
000003a0  20 70 6f 69 6e 74 65 72  20 74 6f 20 73 65 72 76  | pointer to serv|
000003b0  65 6e 74 20 62 6c 6f 63  6b 2c 20 6f 72 20 30 20  |ent block, or 0 |
000003c0  69 66 20 6e 6f 74 20 6b  6e 6f 77 6e 0a 20 2a 2a  |if not known. **|
000003d0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000410  2f 0a 73 65 72 76 65 6e  74 20 2a 67 65 74 73 65  |/.servent *getse|
00000420  72 76 62 79 70 6f 72 74  28 69 6e 74 20 70 6f 72  |rvbyport(int por|
00000430  74 2c 63 68 61 72 20 2a  70 72 6f 74 6f 29 3b 0a  |t,char *proto);.|
00000440  0a 2f 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |./**************|
00000450  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000470  2a 20 3c 63 3e 20 47 65  72 70 68 20 2a 2a 2a 2a  |* <c> Gerph ****|
00000480  2a 2a 2a 2a 2a 0a 20 46  75 6e 63 74 69 6f 6e 3a  |*****. Function:|
00000490  20 20 20 20 20 67 65 74  73 65 72 76 62 79 6e 61  |     getservbyna|
000004a0  6d 65 0a 20 44 65 73 63  72 69 70 74 69 6f 6e 3a  |me. Description:|
000004b0  20 20 52 65 61 64 73 20  74 68 65 20 73 65 72 76  |  Reads the serv|
000004c0  65 6e 74 20 62 6c 6f 63  6b 20 66 6f 72 20 61 20  |ent block for a |
000004d0  73 65 72 76 69 63 65 2c  20 67 69 76 65 6e 20 69  |service, given i|
000004e0  74 27 73 20 6e 61 6d 65  0a 20 20 20 20 20 20 20  |t's name.       |
000004f0  20 20 20 20 20 20 20 20  54 68 69 73 20 62 6c 6f  |        This blo|
00000500  63 6b 20 69 73 20 6e 6f  74 20 67 75 61 72 65 6e  |ck is not guaren|
00000510  74 65 65 64 20 74 6f 20  72 65 6d 61 69 6e 20 63  |teed to remain c|
00000520  6f 6e 73 74 61 6e 74 2c  20 73 6f 0a 20 20 20 20  |onstant, so.    |
00000530  20 20 20 20 20 20 20 20  20 20 20 63 6f 70 79 20  |           copy |
00000540  69 74 20 71 75 69 63 6b  6c 79 2e 0a 20 50 61 72  |it quickly.. Par|
00000550  61 6d 65 74 65 72 73 3a  20 20 20 6e 61 6d 65 2d  |ameters:   name-|
00000560  3e 20 6e 61 6d 65 20 6f  66 20 74 68 65 20 73 65  |> name of the se|
00000570  72 76 69 63 65 20 28 74  65 78 74 75 61 6c 2c 20  |rvice (textual, |
00000580  6f 72 20 6e 75 6d 65 72  69 63 29 0a 20 20 20 20  |or numeric).    |
00000590  20 20 20 20 20 20 20 20  20 20 20 70 72 6f 74 6f  |           proto|
000005a0  2d 3e 20 70 72 6f 74 6f  63 6f 6c 20 6e 61 6d 65  |-> protocol name|
000005b0  20 28 74 63 70 2f 75 64  70 29 2c 20 6f 72 20 30  | (tcp/udp), or 0|
000005c0  20 66 6f 72 20 64 65 66  61 75 6c 74 0a 20 52 65  | for default. Re|
000005d0  74 75 72 6e 73 3a 20 20  20 20 20 20 70 6f 69 6e  |turns:      poin|
000005e0  74 65 72 20 74 6f 20 73  65 72 76 65 6e 74 20 62  |ter to servent b|
000005f0  6c 6f 63 6b 2c 20 6f 72  20 30 20 69 66 20 6e 6f  |lock, or 0 if no|
00000600  74 20 6b 6e 6f 77 6e 0a  20 2a 2a 2a 2a 2a 2a 2a  |t known. *******|
00000610  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000640  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2f 0a 73 65 72  |***********/.ser|
00000650  76 65 6e 74 20 2a 67 65  74 73 65 72 76 62 79 6e  |vent *getservbyn|
00000660  61 6d 65 28 63 68 61 72  20 2a 6e 61 6d 65 2c 63  |ame(char *name,c|
00000670  68 61 72 20 2a 70 72 6f  74 6f 29 3b 0a 0a 2f 2a  |har *proto);../*|
00000680  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
000006a0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 20 3c  |************** <|
000006b0  63 3e 20 47 65 72 70 68  20 2a 2a 2a 2a 2a 2a 2a  |c> Gerph *******|
000006c0  2a 2a 0a 20 46 75 6e 63  74 69 6f 6e 3a 20 20 20  |**. Function:   |
000006d0  20 20 64 65 63 6f 64 65  65 72 72 6f 72 0a 20 44  |  decodeerror. D|
000006e0  65 73 63 72 69 70 74 69  6f 6e 3a 20 20 52 65 74  |escription:  Ret|
000006f0  75 72 6e 73 20 74 68 65  20 74 65 78 74 75 61 6c  |urns the textual|
00000700  20 76 65 72 73 69 6f 6e  20 6f 66 20 74 68 65 20  | version of the |
00000710  65 72 72 6e 6f 20 76 61  72 69 61 62 6c 65 0a 20  |errno variable. |
00000720  20 20 20 20 20 20 20 20  20 20 20 20 20 20 54 68  |              Th|
00000730  69 73 20 73 68 6f 75 6c  64 20 6e 6f 74 20 62 65  |is should not be|
00000740  20 6d 6f 64 69 66 69 65  64 2e 0a 20 50 61 72 61  | modified.. Para|
00000750  6d 65 74 65 72 73 3a 20  20 20 65 72 72 6e 6f 20  |meters:   errno |
00000760  3d 20 65 72 72 6e 6f 20  76 61 6c 75 65 0a 20 52  |= errno value. R|
00000770  65 74 75 72 6e 73 3a 20  20 20 20 20 20 70 6f 69  |eturns:      poi|
00000780  6e 74 65 72 20 74 6f 20  74 68 65 20 74 65 78 74  |nter to the text|
00000790  75 61 6c 20 76 65 72 73  69 6f 6e 20 6f 66 20 74  |ual version of t|
000007a0  68 65 20 65 72 72 6f 72  2c 20 6f 72 20 30 0a 20  |he error, or 0. |
000007b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 69 66  |              if|
000007c0  20 6e 6f 74 20 6b 6e 6f  77 6e 0a 20 2a 2a 2a 2a  | not known. ****|
000007d0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000800  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2f 0a  |**************/.|
00000810  20 20 20 63 68 61 72 20  2a 64 65 63 6f 64 65 65  |   char *decodee|
00000820  72 72 6f 72 28 69 6e 74  20 65 72 72 6e 6f 29 3b  |rror(int errno);|
00000830  0a 23 65 6e 64 69 66 0a                           |.#endif.|
00000838