ogg_afh.c: Fix a memory leak.
[paraslash.git] / net.h
1 /*
2  * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
3  *
4  * Licensed under the GPL v2. For licencing details see COPYING.
5  */
6
7 /** \file net.h exported symbols from net.c */
8
9 /**
10  * the buffer size of the sun_path component of struct sockaddr_un
11  *
12  * While glibc doesn't define \p UNIX_PATH_MAX, it
13  * documents it has being limited to 108 bytes.
14  */
15 #ifndef UNIX_PATH_MAX
16 #define UNIX_PATH_MAX 108
17 #endif
18
19 /** used to crypt the communication between para_server and para_client */
20 typedef void crypt_function(unsigned long len,
21         const unsigned char *indata, unsigned char *outdata, void *private_data);
22
23 #include <netdb.h> /* hostent */
24 int get_host_info(char *host, struct hostent **ret);
25 int get_socket(void);
26 void init_sockaddr(struct sockaddr_in*, int, const struct hostent*);
27 int para_connect(int, struct sockaddr_in *);
28 int send_buffer(int, const char *);
29 int send_bin_buffer(int, const char *, size_t);
30 __printf_2_3 int send_va_buffer(int fd, const char *fmt, ...);
31 int recv_buffer(int fd, char *buf, size_t size);
32 int recv_bin_buffer(int fd, char *buf, size_t size);
33 int para_accept(int, void *addr, socklen_t size);
34 int create_local_socket(const char *name, struct sockaddr_un *unix_addr,
35         mode_t mode);
36 int init_unix_addr(struct sockaddr_un *, const char *);
37 int recv_cred_buffer(int, char *, size_t);
38 ssize_t send_cred_buffer(int, char*);
39 int recv_pattern(int fd, const char *pattern, size_t bufsize);
40 int init_tcp_socket(int port);
41 void enable_crypt(int fd, crypt_function *recv_f, crypt_function *send_f,
42         void *private_data);
43 void disable_crypt(int fd);
44