File: network.h

package info (click to toggle)
muroard 0.1.0-5
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 356 kB
  • ctags: 307
  • sloc: ansic: 2,017; sh: 340; makefile: 83
file content (59 lines) | stat: -rw-r--r-- 1,697 bytes parent folder | download
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
57
58
59
//network.h:

/*
 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
 *
 *  This file is part of RoarD,
 *  a sound server daemon for using the RoarAudio protocol.
 *  See README for details.
 *
 *  This file is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 3
 *  or (at your option) any later version as published by
 *  the Free Software Foundation.
 *
 *  RoarAudio 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 software; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 *  Boston, MA 02110-1301, USA.
 *
 */

#ifndef _MUROARD_NETWORK_H_
#define _MUROARD_NETWORK_H_

#define NETWORK_TYPE_UNIX      1
#define NETWORK_TYPE_INET      2

int network_init(void);
int network_free(void);
int network_prefree(void);

int network_listen(int type, char * addr, int port);

int network_nonblock(int fh);

int network_check(void);

#ifdef __WIN32
#define network_read(fh,buf,len)  recv((fh), (buf), (len), 0)
#define network_write(fh,buf,len) send((fh), (buf), (len), 0)
#define network_close(fh)         closesocket((fh))
#else
#define network_read(fh,buf,len)  read((fh), (buf), (len))
#define network_write(fh,buf,len) write((fh), (buf), (len))
#define network_close(fh)         close((fh))
#endif

#ifdef MUROAR_FEATURE_CMD_PASSFH
int network_recvfh(int fh);
#endif

#endif

//ll