#include <vector>#include <stdlib.h>#include <sys/types.h>#include "util.h"Include dependency graph for BroString.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Classes | |
| class | BroString |
| struct | data_chunk_t |
Typedefs | |
| typedef u_char * | byte_vec |
Functions | |
| int | Bstr_eq (const BroString *s1, const BroString *s2) |
| int | Bstr_cmp (const BroString *s1, const BroString *s2) |
| BroString * | concatenate (std::vector< data_chunk_t > &v) |
| BroString * | concatenate (std::vector< const BroString * > &v) |
| void | delete_strings (std::vector< const BroString * > &v) |
|
|
||||||||||||
|
Definition at line 151 of file BroString.cc. References BroString::Bytes(), BroString::Len(), and min.
00152 {
00153 int n = min(s1->Len(), s2->Len());
00154 int cmp = memcmp(s1->Bytes(), s2->Bytes(), n);
00155
00156 if ( cmp || s1->Len() == s2->Len() )
00157 return cmp;
00158
00159 // Compared equal, but one was shorter than the other. Treat
00160 // it as less than the other.
00161 if ( s1->Len() < s2->Len() )
00162 return -1;
00163 else
00164 return 1;
00165 }
|
|
||||||||||||
|
Definition at line 143 of file BroString.cc. References BroString::Bytes(), and BroString::Len(). Referenced by DNS_Mgr::CompareMappings(), and same_atomic_val().
|
|
|
Definition at line 189 of file BroString.cc. References BroString, byte_vec, and len. Referenced by HTTP_Message::DeliverEntityData(), MIME_Mail::EndEntity(), MIME_Multiline::get_concatenated_line(), and MIME_Mail::SubmitAllData().
00190 {
00191 int n = v.size();
00192 int len = 0;
00193 int i;
00194 for ( i = 0; i < n; ++i )
00195 len += v[i]->Len();
00196
00197 char* data = new char[len+1];
00198
00199 char* b = data;
00200 for ( i = 0; i < n; ++i )
00201 {
00202 memcpy(b, v[i]->Bytes(), v[i]->Len());
00203 b += v[i]->Len();
00204 }
00205 *b = '\0';
00206
00207 return new BroString(1, (byte_vec) data, len);
00208 }
|
|
|
Definition at line 167 of file BroString.cc. References BroString, byte_vec, and len.
00168 {
00169 int n = v.size();
00170 int len = 0;
00171 int i;
00172 for ( i = 0; i < n; ++i )
00173 len += v[i].length;
00174
00175 char* data = new char[len+1];
00176
00177 char* b = data;
00178 for ( i = 0; i < n; ++i )
00179 {
00180 memcpy(b, v[i].data, v[i].length);
00181 b += v[i].length;
00182 }
00183
00184 *b = '\0';
00185
00186 return new BroString(1, (byte_vec) data, len);
00187 }
|
|
|
Definition at line 210 of file BroString.cc. Referenced by HTTP_Message::DeliverEntityData(), HTTP_Message::Done(), MIME_Mail::EndEntity(), MIME_Mail::SubmitAllData(), MIME_Mail::~MIME_Mail(), and MIME_Multiline::~MIME_Multiline().
00211 {
00212 for ( unsigned int i = 0; i < v.size(); ++i )
00213 delete v[i];
00214 v.clear();
00215 }
|
1.3.5