OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / mico / transport / udp.h
1 // -*- c++ -*-
2 /*
3  *  MICO --- an Open Source CORBA implementation
4  *  Copyright (c) 1997-2001 by The Mico Team
5  *
6  *  This library is free software; you can redistribute it and/or
7  *  modify it under the terms of the GNU Library General Public
8  *  License as published by the Free Software Foundation; either
9  *  version 2 of the License, or (at your option) any later version.
10  *
11  *  This library is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  *  Library General Public License for more details.
15  *
16  *  You should have received a copy of the GNU Library General Public
17  *  License along with this library; if not, write to the Free
18  *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  *  For more information, visit the MICO Home Page at
21  *  http://www.mico.org/
22  */
23
24 #ifndef __mico_transport_udp_h__
25 #define __mico_transport_udp_h__
26
27 namespace MICO {
28
29 class UDPTransport : public SocketTransport {
30
31     InetAddress local_addr, peer_addr;
32     CORBA::Buffer dgram;
33     CORBA::Boolean is_established;
34     CORBA::Boolean is_connected;
35     CORBA::Boolean is_bound;
36     struct sockaddr_in *peer_sin, *addr_sin;
37
38     CORBA::Long collect_replies (CORBA::Long tmout);
39 public:
40     UDPTransport()
41     {}
42
43     CORBA::Boolean bind (const CORBA::Address *);
44     CORBA::Boolean connect (const CORBA::Address *);
45
46     void open(CORBA::Long fd = -1);
47     void close ();
48     
49     CORBA::Long read (void *, CORBA::Long len);
50     CORBA::Long write (const void *, CORBA::Long len);
51     
52     const CORBA::Address *addr ();
53     const CORBA::Address *peer ();
54     
55     CORBA::Boolean bind_server (const CORBA::Address *);
56     CORBA::Boolean connect_server (const CORBA::Address *);
57     CORBA::Long read_dgram (CORBA::Buffer &buf);
58 };
59
60
61 class UDPTransportServer : public SocketTransportServer {
62
63     InetAddress local_addr;
64     CORBA::Boolean is_bound;
65     struct sockaddr_in *addr_sin;
66
67     void __clean_up();
68 public:
69     UDPTransportServer ();
70     
71     CORBA::Boolean bind (const CORBA::Address *);
72     void close ();
73     
74     CORBA::Transport *accept ();
75     const CORBA::Address *addr ();
76     
77 };
78
79 }
80
81 #endif // __mico_transport_udp_h__