activemq-cpp-3.9.5
DatagramPacket.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_NET_DATAGRAMPACKET_H_
19#define _DECAF_NET_DATAGRAMPACKET_H_
20
21#include <decaf/util/Config.h>
22
25
29
31
32namespace decaf {
33namespace net {
34
43 class DatagramPacket {
44 private:
45
46 unsigned char* buffer;
47 int size;
48 int offset;
49 int length;
50
51 InetAddress* address;
52 int port;
53
55
56 private:
57
58 DatagramPacket( const DatagramPacket& );
59 DatagramPacket& operator= ( const DatagramPacket& );
60
61 public:
62
76 DatagramPacket( unsigned char* bytes, int size, int length );
77
94 DatagramPacket( unsigned char* bytes, int size, int offset, int length );
95
117 DatagramPacket( unsigned char* bytes, int size, int offset, int length, const InetAddress& address, int port );
118
137 DatagramPacket( unsigned char* bytes, int size, int length, const InetAddress& address, int port );
138
155 DatagramPacket( unsigned char* bytes, int size, int length, const SocketAddress& address );
156
175 DatagramPacket( unsigned char* bytes, int size, int offset, int length, const SocketAddress& address );
176
178
179 public:
180
185
192 void setAddress( const InetAddress& address );
193
201
211 void setSocketAddress( const SocketAddress& address );
212
216 int getPort() const;
217
226 void setPort( int port );
227
231 int getOffset() const;
232
242 void setOffset( int offset );
243
247 int getLength() const;
248
260 void setLength( int length );
261
266 unsigned char* getData() const;
267
271 int getSize() const;
272
284 void setData( unsigned char* buffer, int size );
285
301 void setData( unsigned char* buffer, int size, int offset, int length );
302
303 };
304
305}}
306
307#endif /* _DECAF_NET_DATAGRAMPACKET_H_ */
void setSocketAddress(const SocketAddress &address)
Sets the SocketAddress (usually IP address + port number) of the remote host to which this datagram i...
DatagramPacket(unsigned char *bytes, int size, int offset, int length, const InetAddress &address, int port)
Creates a new DatagramPacket for use in sending a packet of the given length starting at the specifie...
void setLength(int length)
Set the length for this packet.
DatagramPacket(unsigned char *bytes, int size, int offset, int length, const SocketAddress &address)
Creates a new DatagramPacket for use in sending a packet of the given length starting at the specifie...
void setData(unsigned char *buffer, int size, int offset, int length)
Set the data buffer for this packet.
void setData(unsigned char *buffer, int size)
Set the data buffer for this packet.
SocketAddress * getSocketAddress() const
Gets the SocketAddress (usually IP address + port number) of the remote host that this packet is bein...
void setOffset(int offset)
Sets the offset into the data buffer where data to sent is to be read from or where the data that is ...
void setAddress(const InetAddress &address)
Sets the IP address of the machine to which this datagram is being sent.
DatagramPacket(unsigned char *bytes, int size, int length, const SocketAddress &address)
Creates a new DatagramPacket for use in sending a packet of the given length into the buffer to the s...
InetAddress * getAddress() const
unsigned char * getData() const
DatagramPacket(unsigned char *bytes, int size, int length, const InetAddress &address, int port)
Creates a new DatagramPacket for use in sending a packet of the given length to the specified host on...
DatagramPacket(unsigned char *bytes, int size, int offset, int length)
Creates a new DatagramPacket for use in receiving a packet of the given length starting at the specif...
void setPort(int port)
Sets the port number on the remote host to which this datagram is being sent.
DatagramPacket(unsigned char *bytes, int size, int length)
Creates a new DatagramPacket for use in receiving a packet of the given length.
Represents an IP address.
Definition InetAddress.h:33
Base class for protocol specific Socket addresses.
Definition SocketAddress.h:32
Mutex object that offers recursive support on all platforms as well as providing the ability to use t...
Definition Mutex.h:39
Definition URLStreamHandlerManager.h:26
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25