2 * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
19 /** \file net.h exported symbols from net.c */
22 * the buffer size of the sun_path component of struct sockaddr_un
24 * While glibc doesn't define \p UNIX_PATH_MAX, it
25 * documents it has being limited to 108 bytes.
28 #define UNIX_PATH_MAX 108
31 /** used to crypt the communication between para_server and para_client */
32 typedef void crypt_function(unsigned long len,
33 const unsigned char *indata, unsigned char *outdata, void *private_data);
35 #include <netdb.h> /* hostent */
36 int get_host_info(char *host, struct hostent **ret);
38 void init_sockaddr(struct sockaddr_in*, int, const struct hostent*);
39 int para_connect(int, struct sockaddr_in *);
40 int send_buffer(int, const char *);
41 int send_bin_buffer(int, const char *, size_t);
42 int send_va_buffer(int, const char *, ...);
43 int recv_buffer(int, char *, ssize_t);
44 int recv_bin_buffer(int, char *, ssize_t);
45 int para_accept(int, void *addr, socklen_t size);
46 int create_pf_socket(const char *, struct sockaddr_un *, int mod);
47 int init_unix_addr(struct sockaddr_un *, const char *);
48 int recv_cred_buffer(int, char *, size_t);
49 ssize_t send_cred_buffer(int, char*);
50 int recv_pattern(int fd, const char *pattern, size_t bufsize);
51 int init_tcp_socket(int port);
52 void enable_crypt(int fd, crypt_function *recv_f, crypt_function *send_f,
54 void disable_crypt(int fd);