1/*
2 * $Id: mnc.h,v 1.4 2004/09/22 14:07:10 colmmacc Exp $
3 *
4 * mnc.h -- Multicast NetCat
5 *
6 * Colm MacCarthaigh, <colm@apache.org>
7 *
8 * Copyright (c) 2007, Colm MacCarthaigh.
9 * Copyright (c) 2004 - 2006, HEAnet Ltd.
10 *
11 * This software is an open source.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * Redistributions of source code must retain the above copyright notice,
18 * this list of conditions and the following disclaimer.
19 *
20 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials provided with the distribution.
23 *
24 * Neither the name of the HEAnet Ltd. nor the names of its contributors may
25 * be used to endorse or promote products derived from this software without
26 * specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
32 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 * POSSIBILITY OF SUCH DAMAGE.
39 *
40 */
41
42#ifndef _MNC_H_
43#define _MNC_H_
44
45#ifndef WINDOWS
46
47#include <sys/types.h>
48#include <sys/socket.h>
49#include <netdb.h>
50
51#else
52
53#include <winsock2.h>
54#include <ws2tcpip.h>
55
56#endif
57
58/* The UDP port MNC will use by default */
59#define MNC_DEFAULT_PORT    	"1234"
60
61struct mnc_configuration
62{
63	/* Are we sending or recieving ? */
64	enum {SENDER, LISTENER}	mode;
65
66	/* What UDP port are we using ? */
67	char	*		port;
68
69	/* The group-id */
70	struct addrinfo	*	group;
71
72	/* The source */
73	struct addrinfo *	source;
74
75	/* An interface index for listening */
76	char	*		iface;
77};
78
79
80/* Functions in mnc_opts.c */
81void 				usage(void);
82struct mnc_configuration * 	parse_arguments(int argc, char **argv);
83
84/* Functions in mnc_multicast.c */
85int multicast_setup_listen(int, struct addrinfo *, struct addrinfo *, char *);
86int multicast_setup_send(int, struct addrinfo *, struct addrinfo *);
87
88/* Functions in mnc_error.c */
89void mnc_warning(char * string, ...);
90void mnc_error(char * string, ...);
91
92#endif /* _MNC_H_ */
93