Linux ns8.secondary29.go.th 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64
Apache/2.2.15 (CentOS)
: 122.154.134.11 | : 122.154.134.9
Cant Read [ /etc/named.conf ]
5.6.40
apache
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
db4-devel-4.7.25 /
ref /
am_misc /
[ HOME SHELL ]
Name
Size
Permission
Action
align.html
1.92
KB
-rw-r--r--
dbsizes.html
2.96
KB
-rw-r--r--
diskspace.html
8.67
KB
-rw-r--r--
error.html
3.51
KB
-rw-r--r--
faq.html
7.77
KB
-rw-r--r--
get_bulk.html
7.87
KB
-rw-r--r--
partial.html
5.5
KB
-rw-r--r--
perm.html
2.85
KB
-rw-r--r--
stability.html
3.74
KB
-rw-r--r--
struct.html
3.67
KB
-rw-r--r--
tune.html
8.3
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : struct.html
<!--$Id: struct.so,v 10.8 2002/12/22 20:42:09 bostic Exp $--> <!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Storing C/C++ structures/objects</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td><b><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></b></td> <td align=right><a href="../am_misc/partial.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../am_misc/perm.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p align=center><b>Storing C/C++ structures/objects</b></p> <p>Berkeley DB can store any kind of data, that is, it is entirely 8-bit clean. How you use this depends, to some extent, on the application language you are using. In the C/C++ languages, there are a couple of different ways to store structures and objects.</p> <p>First, you can do some form of run-length encoding and copy your structure into another piece of memory before storing it:</p> <blockquote><pre>struct { char *data1; u_int32_t data2; ... } info; size_t len; u_int8_t *p, data_buffer[1024]; <p> p = &data_buffer[0]; len = strlen(info.data1); memcpy(p, &len, sizeof(len)); p += sizeof(len); memcpy(p, info.data1, len); p += len; memcpy(p, &info.data2, sizeof(info.data2)); p += sizeof(info.data2); ...</pre></blockquote> <p>and so on, until all the fields of the structure have been loaded into the byte array. If you want more examples, see the Berkeley DB logging routines (for example, btree/btree_auto.c:__bam_split_log()). This technique is generally known as "marshalling". If you use this technique, you must then un-marshall the data when you read it back:</p> <blockquote><pre>struct { char *data1; u_int32_t data2; ... } info; size_t len; u_int8_t *p; <p> p = &data_buffer[0]; memcpy(&len, p, sizeof(len)); p += sizeof(len); info.data1 = malloc(len); memcpy(info.data1, p, len); p += len; memcpy(&info.data2, p, sizeof(info.data2)); p += sizeof(info.data2); ...</pre></blockquote> <p>and so on.</p> <p>The second way to solve this problem only works if you have just one variable length field in the structure. In that case, you can declare the structure as follows:</p> <blockquote><pre>struct { int a, b, c; u_int8_t buf[1]; } info;</pre></blockquote> <p>Then, let's say you have a string you want to store in this structure. When you allocate the structure, you allocate it as:</p> <blockquote><pre>malloc(sizeof(struct info) + strlen(string));</pre></blockquote> <p>Since the allocated memory is contiguous, you can the initialize the structure as:</p> <blockquote><pre>info.a = 1; info.b = 2; info.c = 3; memcpy(&info.buf[0], string, strlen(string) + 1);</pre></blockquote> <p>and give it to Berkeley DB to store, with a length of:</p> <blockquote><pre>sizeof(struct info) + strlen(string);</pre></blockquote> <p>In this case, the structure can be copied out of the database and used without any additional work.</p> <table width="100%"><tr><td><br></td><td align=right><a href="../am_misc/partial.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../am_misc/perm.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> </body> </html>
Close