![]() |
![]() |
dbm-server.pl
from Snert . Com |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A Simple DBM Server
| dbm-client.pl
| dbm-server.pl
| mod_watch
| Syntaxdbm-server.pl [-d|-k][-p port][-h hosts]
DescriptionThe DBM API model allows for only one "writer" or many "readers", but not both at the same time on the same database. This limitation means that processes that wish to read & write to a DBM file, must pass through an intermediate server who has sole control of the DBM file. The server waits on a given port for a TCP connection. Once a connection is establish, the client has sole control of the DBM file and should maintain the connection for the shortest time possible, because DBM files can only be written to by one process at a time, the DBM server must remain single threaded. During the time the client has the connection, it can make one or more requests such as get, set, delete, close, and quit. The assumptions here are that DBM databases have far less overhead than more prowerful SQL servers, that the server will be simple and therefore fast, and that client connections are short and simple. Any request, other than quit, will open or create the named database found in the database directory, if not already opened. Once opened a database will remain open until either the server terminates or a close request is received. A simple (and not to secure) authentication scheme is used. Every request must supply a database specific secret. When a request is made for a non-existant database, the database is created and the key DATABASE-SECRET is assigned the secret of that request. All future requests for that database must use the same secret to access it. The secret can be changed by a set request of the DATABASE-SECRET key. A RequestA request has the following format:
where
The command codes are:
An invalid command code or invalid field length will quit and close the connection, and respond with "END". A ResponseA response has the following format:
where
The status codes are :
LicenseThis source distribution is made freely available and there is no charge for its use, provided you retain this notice, disclaimers, author's copyright, and credits. DisclaimerTHIS SOFTWARE IS PROVIDE "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO WAY SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| dbm-client.pl
| dbm-server.pl
| mod_watch
|
|