1libinn_clientlib(3)       InterNetNews Documentation       libinn_clientlib(3)
2
3
4

NAME

6       clientlib - NNTP clientlib part of InterNetNews library
7

SYNOPSIS

9           #include <inn/libinn.h>
10
11           extern FILE *ser_rd_fp;
12           extern FILE *ser_wr_fp;
13           extern char ser_line[];
14
15           extern char *getserverbyfile(char *file UNUSED);
16           extern int server_init(char *host, int port);
17           extern int handle_server_response(int response, char *host);
18           extern void put_server(const char *text);
19           extern int get_server(char *buff, int buffsize);
20           extern void close_server(void);
21

DESCRIPTION

23       The routines described in this manual page are part of the InterNetNews
24       library, libinn(3).  They are replacements for the clientlib part of
25       the NNTP distribution, and are intended to be used in building news
26       clients.
27
28       The getserverbyfile function retrieves the value of the server
29       parameter in inn.conf (or the value of the "NNTPSERVER" environment
30       variable if set) as the name of the local NNTP server.  It returns a
31       pointer to static space.  The file parameter is ignored (inn.conf is
32       forced).
33
34       The server_init function opens a connection to the NNTP server at the
35       specified host, in reader mode.  It returns the server's response code
36       or "-1" on error.  If a connection was made, then ser_rd_fp and
37       ser_wr_fp can be used to read from and write to the server,
38       respectively, and ser_line will contain the server's response (though
39       you should use the more convenient put_server and get_server functions
40       instead).
41
42       The handle_server_response function decodes the response code, which
43       comes from the server on host.  If the client is authorized, it returns
44       0.  A client that is only allowed to read is authorized, but
45       handle_server_response will print a message on the standard output.  If
46       the client is not authorized to talk to the server, then a message is
47       printed and the routine returns "-1".
48
49       The put_server function sends text to the server, adding the necessary
50       NNTP line terminators, and flushing the I/O buffer.
51
52       The get_server function reads a line of text from the server into buff,
53       reading at most buffsize characters.  Any trailing "\r\n" terminators
54       are stripped off.  get_server returns "-1" on error, 0 on success.
55
56       The close_server function sends a "QUIT" command to the server and
57       closes the connection.
58

HISTORY

60       Written by Rich $alz <rsalz@uunet.uu.net> for InterNetNews.  Rewritten
61       into POD by Julien Elie.
62

SEE ALSO

64       libinn(3).
65
66
67
68INN 2.6.5                         2022-02-18               libinn_clientlib(3)
Impressum