xref: /haiku/headers/os/net/DatagramSocket.h (revision 635d2ac485786b0a69bed604bbbb64a6e2123018)
1 /*
2  * Copyright 2011, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _DATAGRAM_SOCKET_H
6 #define _DATAGRAM_SOCKET_H
7 
8 
9 #include <AbstractSocket.h>
10 
11 
12 class BDatagramSocket : public BAbstractSocket {
13 public:
14 								BDatagramSocket();
15 								BDatagramSocket(const BNetworkAddress& peer,
16 									bigtime_t timeout = -1);
17 								BDatagramSocket(const BDatagramSocket& other);
18 	virtual						~BDatagramSocket();
19 
20 	virtual	status_t			Bind(const BNetworkAddress& peer);
21 	virtual	status_t			Connect(const BNetworkAddress& peer,
22 									bigtime_t timeout = B_INFINITE_TIMEOUT);
23 
24 			status_t			SetBroadcast(bool broadcast);
25 			void				SetPeer(const BNetworkAddress& peer);
26 
27 	virtual	size_t				MaxTransmissionSize() const;
28 
29 	virtual	ssize_t				SendTo(const BNetworkAddress& address,
30 									const void* buffer, size_t size);
31 	virtual	ssize_t				ReceiveFrom(void* buffer, size_t bufferSize,
32 									BNetworkAddress& from);
33 
34 	// BDataIO implementation
35 
36 	virtual ssize_t				Read(void* buffer, size_t size);
37 	virtual ssize_t				Write(const void* buffer, size_t size);
38 };
39 
40 
41 #endif	// _DATAGRAM_SOCKET_H
42