libassa
3.5.1
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
assa
xdrIOBuffer.h
Go to the documentation of this file.
1
// -*- c++ -*-
2
//------------------------------------------------------------------------------
3
// xdrIOBuffer.h
4
//------------------------------------------------------------------------------
5
// Copyright (c) 2000,2005 by Vladislav Grinchenko
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//------------------------------------------------------------------------------
12
// Created: 04/03/2000
13
//------------------------------------------------------------------------------
14
15
#ifndef XDR_IO_BUFFER_H
16
#define XDR_IO_BUFFER_H
17
18
#include "
assa/Assure.h
"
19
#include "
assa/Socket.h
"
20
#include "
assa/IPv4Socket.h
"
21
22
#include <string>
23
24
namespace
ASSA {
25
55
class
xdrIOBuffer
56
{
57
public
:
60
enum
state_t
{
61
waiting
,
62
xmitted
,
63
parsed
,
64
error
65
};
66
69
xdrIOBuffer
(
u_int
len_);
70
73
~xdrIOBuffer
();
74
77
xdrIOBuffer
(
const
xdrIOBuffer
& rhs_);
78
81
xdrIOBuffer
&
operator=
(
const
xdrIOBuffer
& rhs_);
82
86
friend
Socket
&
operator>>
(
Socket
& src_,
xdrIOBuffer
& dest_);
87
90
xdrIOBuffer
&
operator>>
(std::string&);
91
94
xdrIOBuffer
&
operator>>
(
int
&);
95
98
xdrIOBuffer
&
operator>>
(
float
&);
99
102
operator
void
*()
const
;
103
106
string
get_state
()
const
;
107
112
int
size
()
const
;
113
116
int
buffer_size
()
const
;
117
120
const
char
*
str
()
const
;
121
125
void
reset
();
126
129
void
dump
()
const
;
130
131
protected
:
133
void
copy
(
const
xdrIOBuffer
&);
134
135
private
:
137
char
*
m_buf
;
138
140
int
m_sz
;
141
143
char
*
m_ptr
;
144
146
state_t
m_state
;
147
};
148
149
inline
150
xdrIOBuffer::
151
xdrIOBuffer
(
const
xdrIOBuffer
& rhs_)
152
{
153
trace_with_mask
(
"xdrIOBuffer::xdrIOBuffer(xdrIOBuffer&)"
,
XDRBUFTRACE
);
154
155
copy
(rhs_);
156
}
157
158
inline
159
xdrIOBuffer::
160
operator
void
*()
const
161
{
162
trace_with_mask
(
"xdrIOBuffer::opt void*()"
,
XDRBUFTRACE
);
163
164
return
(m_state == waiting || m_state == parsed)
165
? (
void
*)0
// bad state
166
: (
void
*)(-1);
// good state
167
}
168
169
inline
int
170
xdrIOBuffer::
171
size
()
const
172
{
173
return
(
m_ptr
-
m_buf
);
174
}
175
176
inline
int
177
xdrIOBuffer::
178
buffer_size
()
const
179
{
180
return
(
m_sz
);
181
}
182
183
inline
const
char
*
184
xdrIOBuffer::
185
str
()
const
186
{
187
return
((
const
char
*)
m_buf
);
188
}
189
190
}
// end namespace ASSA
191
192
#endif
/* XDR_IO_BUFFER_H */
Generated on Tue Jun 19 2012 08:07:24 for libassa by
1.8.1.1