UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / include / nis.h
blob8ccea1321638fcd85c1e059148d52e2f1a9555dc
1 /*
2 * nis.h
4 * Include file for nis.c definitions
5 */
7 /*
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General
10 * Public License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 * MA 02111-1307, USA.
23 /*
24 * Receive a message from the other end. Each message consists of
25 * two packets. The first is a header that contains the size
26 * of the data that follows in the second packet.
28 * Returns number of bytes read
29 * Returns 0 on end of file
30 * Returns -1 on error
32 int net_recv(int sockfd, char *buff, int maxlen);
35 * Send a message over the network. The send consists of
36 * two network packets. The first is sends a short containing
37 * the length of the data packet which follows.
39 * Returns number of bytes sent
40 * Returns -1 on error
42 int net_send(int sockfd, const char *buff, int len);
44 /*
45 * Open a TCP connection to the UPS network server
47 * Returns -1 on error
48 * Returns socket file descriptor otherwise
50 int net_open(const char *host, char *service, int port);
52 /* Close the network connection */
53 void net_close(int sockfd);
55 /* Wait for and accept a new TCP connection */
56 int net_accept(int fd, struct sockaddr_in *cli_addr);