2 Copyright (C) 1998-2010 Paul Barton-Davis
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef __libmidi_ipmidi_port_h__
20 #define __libmidi_ipmidi_port_h__
26 #elif defined(__FREE_BSD__)
27 #include <netinet/in.h>
28 #include <sys/socket.h>
29 #include <sys/_sockaddr_storage.h>
30 #include <arpa/inet.h>
31 #include <netinet/ip_carp.h>
32 #include <sys/types.h>
34 #include <sys/socket.h>
36 #include <net/route.h>
38 #include <arpa/inet.h>
42 #include <glibmm/threads.h>
44 #include "pbd/xml++.h"
45 #include "pbd/crossthread.h"
46 #include "pbd/signals.h"
47 #include "pbd/ringbuffer.h"
49 #include "midi++/types.h"
50 #include "midi++/parser.h"
51 #include "midi++/port.h"
55 class IPMIDIPort : public Port {
57 IPMIDIPort (int base_port = lowest_ipmidi_port_default, const std::string& ifname = std::string());
58 IPMIDIPort (const XMLNode&);
61 XMLNode& get_state () const;
62 void set_state (const XMLNode&);
64 int write (const byte *msg, size_t msglen, timestamp_t timestamp);
65 int read (byte *buf, size_t bufsize);
66 void parse (framecnt_t timestamp);
67 int selectable () const;
69 static const int lowest_ipmidi_port_default = 21928;
74 struct sockaddr_in addrout;
75 Glib::Threads::Mutex write_lock;
77 bool open_sockets (int base_port, const std::string& ifname);
78 void close_sockets ();
80 void init (std::string const &, Flags);
85 #endif // __libmidi_ipmidi_port_h__