File: nis.h

package info (click to toggle)
apcupsd 3.14.12-1.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,676 kB
  • ctags: 8,109
  • sloc: ansic: 36,822; cpp: 9,414; sh: 3,975; makefile: 1,591; tcl: 368; objc: 281; php: 255
file content (56 lines) | stat: -rw-r--r-- 1,684 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * nis.h
 *
 * Include file for nis.c definitions
 */

/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of version 2 of the GNU General
 * Public License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA.
 */

/* 
 * Receive a message from the other end. Each message consists of
 * two packets. The first is a header that contains the size
 * of the data that follows in the second packet.
 *
 * Returns number of bytes read
 * Returns 0 on end of file
 * Returns -1 on error
 */
int net_recv(int sockfd, char *buff, int maxlen);

/*
 * Send a message over the network. The send consists of
 * two network packets. The first is sends a short containing
 * the length of the data packet which follows.
 *
 * Returns number of bytes sent
 * Returns -1 on error
 */
int net_send(int sockfd, const char *buff, int len);

/*     
 * Open a TCP connection to the UPS network server
 *
 * Returns -1 on error
 * Returns socket file descriptor otherwise
 */
int net_open(const char *host, char *service, int port);

/* Close the network connection */
void net_close(int sockfd);

/* Wait for and accept a new TCP connection */
int net_accept(int fd, struct sockaddr_in *cli_addr);