/[resiprocate]/main/reTurn/DataBuffer.hxx
ViewVC logotype

Contents of /main/reTurn/DataBuffer.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10137 - (show annotations) (download)
Sun Apr 28 18:43:19 2013 UTC (6 years, 6 months ago) by sgodin
File MIME type: text/plain
File size: 2525 byte(s)
-merge work from b-counterpath-recon-20130424 with some changes
 - upped receive buffer size from 2048 to 4096
 - added setOnBeforeSocketClosedFp to AsyncSocketBase - Provides an opportunity
   for the app to clean up, e.g., QoS-related data or resources just before 
   the socket is closed
 - OS level Udp socket receive buffer size set to 66560
 - TurnAsyncSocketBase - use dispatch instead of post for send API for
   increased efficiency
 - TurnAsyncSocket - new client side APIs
   - setLocalPassword for checking integrity of incoming STUN messages
   - connectivityCheck for ICE connectivity checks 
   - setOnBeforeSocketClosedFp for QOS cleanup (windows)
   - send API now split into send(To)Framed and send(To)Unframed
   - Queue of guards modified to use a weak functor template instead
   - onBindFailure and onBindSuccess now return the Tuple that failed or succeeded
 - DataBuffer improvements
 - StunMessage - added ice attributes

1 #ifndef DATA_BUFFER_HXX
2 #define DATA_BUFFER_HXX
3
4 namespace reTurn {
5
6 void ArrayDeallocator(char* data);
7
8 class DataBuffer
9 {
10 public:
11 typedef void(*deallocator)(char*);
12
13 DataBuffer(const char* data, unsigned int size, deallocator dealloc=ArrayDeallocator);
14 DataBuffer(unsigned int size, deallocator dealloc=ArrayDeallocator);
15 ~DataBuffer();
16
17 static DataBuffer* own(char* data, unsigned int size, deallocator dealloc=ArrayDeallocator);
18
19 const char* data();
20 unsigned int size();
21 char& operator[](unsigned int p);
22 char operator[](unsigned int p) const;
23
24 unsigned int truncate(unsigned int newSize);
25 unsigned int offset(unsigned int bytes);
26
27 char* mutableData();
28 unsigned int& mutableSize();
29
30 private:
31 char* mBuffer;
32 unsigned int mSize;
33 char* mStart;
34 deallocator mDealloc;
35 };
36
37 }
38
39 #endif
40
41
42 /* ====================================================================
43
44 Copyright (c) 2007-2008, Plantronics, Inc.
45 All rights reserved.
46
47 Redistribution and use in source and binary forms, with or without
48 modification, are permitted provided that the following conditions are
49 met:
50
51 1. Redistributions of source code must retain the above copyright
52 notice, this list of conditions and the following disclaimer.
53
54 2. Redistributions in binary form must reproduce the above copyright
55 notice, this list of conditions and the following disclaimer in the
56 documentation and/or other materials provided with the distribution.
57
58 3. Neither the name of Plantronics nor the names of its contributors
59 may be used to endorse or promote products derived from this
60 software without specific prior written permission.
61
62 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
63 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
64 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
65 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
66 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
67 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
68 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
69 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
70 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
71 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
72 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
73
74 ==================================================================== */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27