Compare commits
2 Commits
tags/mozbo
...
M15-patch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53866ece4f | ||
|
|
350be55313 |
105
mozilla/java/dom/jni/javaDOMGlobals.h
Normal file
105
mozilla/java/dom/jni/javaDOMGlobals.h
Normal file
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
The contents of this file are subject to the Mozilla Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
except in compliance with the License. You may obtain a copy of
|
||||
the License at http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS
|
||||
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
The Original Code is mozilla.org code.
|
||||
|
||||
The Initial Developer of the Original Code is Sun Microsystems,
|
||||
Inc. Portions created by Sun are
|
||||
Copyright (C) 1999 Sun Microsystems, Inc. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __JavaDOMGlobals_h__
|
||||
#define __JavaDOMGlobals_h__
|
||||
|
||||
#include "jni.h"
|
||||
#include "prclist.h"
|
||||
#include "nsError.h"
|
||||
|
||||
#ifdef ERROR
|
||||
#undef ERROR
|
||||
#endif
|
||||
|
||||
class nsISupports;
|
||||
class nsIDOMNode;
|
||||
struct PRLogModuleInfo;
|
||||
struct PRLock;
|
||||
|
||||
class JavaDOMGlobals {
|
||||
|
||||
public:
|
||||
static jclass attrClass;
|
||||
static jclass cDataSectionClass;
|
||||
static jclass commentClass;
|
||||
static jclass documentClass;
|
||||
static jclass documentFragmentClass;
|
||||
static jclass documentTypeClass;
|
||||
static jclass domImplementationClass;
|
||||
static jclass elementClass;
|
||||
static jclass entityClass;
|
||||
static jclass entityReferenceClass;
|
||||
static jclass namedNodeMapClass;
|
||||
static jclass nodeClass;
|
||||
static jclass nodeListClass;
|
||||
static jclass notationClass;
|
||||
static jclass processingInstructionClass;
|
||||
static jclass textClass;
|
||||
|
||||
static jfieldID nodePtrFID;
|
||||
static jfieldID nodeListPtrFID;
|
||||
static jfieldID domImplementationPtrFID;
|
||||
|
||||
static jfieldID nodeTypeAttributeFID;
|
||||
static jfieldID nodeTypeCDataSectionFID;
|
||||
static jfieldID nodeTypeCommentFID;
|
||||
static jfieldID nodeTypeDocumentFragmentFID;
|
||||
static jfieldID nodeTypeDocumentFID;
|
||||
static jfieldID nodeTypeDocumentTypeFID;
|
||||
static jfieldID nodeTypeElementFID;
|
||||
static jfieldID nodeTypeEntityFID;
|
||||
static jfieldID nodeTypeEntityReferenceFID;
|
||||
static jfieldID nodeTypeNotationFID;
|
||||
static jfieldID nodeTypeProcessingInstructionFID;
|
||||
static jfieldID nodeTypeTextFID;
|
||||
|
||||
static jclass domExceptionClass;
|
||||
static jmethodID domExceptionInitMID;
|
||||
static jclass runtimeExceptionClass;
|
||||
static jmethodID runtimeExceptionInitMID;
|
||||
|
||||
static const char* const DOM_EXCEPTION_MESSAGE[];
|
||||
|
||||
typedef enum ExceptionType { EXCEPTION_RUNTIME,
|
||||
EXCEPTION_DOM } ExceptionType;
|
||||
|
||||
static PRLogModuleInfo* log;
|
||||
static PRCList garbage;
|
||||
static PRLock* garbageLock;
|
||||
|
||||
static PRInt32 javaMaxInt;
|
||||
|
||||
static void Initialize(JNIEnv *env);
|
||||
static void Destroy(JNIEnv *env);
|
||||
static jobject CreateNodeSubtype(JNIEnv *env,
|
||||
nsIDOMNode *node);
|
||||
|
||||
static void AddToGarbage(nsISupports* domObject);
|
||||
static void TakeOutGarbage();
|
||||
|
||||
static void ThrowException(JNIEnv *env,
|
||||
const char * message = NULL,
|
||||
nsresult rv = NS_OK,
|
||||
ExceptionType exceptionType = EXCEPTION_RUNTIME);
|
||||
};
|
||||
|
||||
#endif /* __JavaDOMGlobals_h__ */
|
||||
@@ -1,2 +0,0 @@
|
||||
This is the source code for the "mozbot" robot that hangs out on the #mozilla
|
||||
irc channel (server irc.mozilla.org).
|
||||
@@ -1,101 +0,0 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Harrison Page <harrison@netscape.com>
|
||||
# Terry Weissman <terry@mozilla.org>
|
||||
|
||||
# harrison@netscape.com
|
||||
#
|
||||
# 1.0 10/16/98
|
||||
|
||||
package Tinderbox;
|
||||
|
||||
require Exporter;
|
||||
|
||||
use strict 'vars';
|
||||
use vars qw (@ISA @EXPORT $VERSION);
|
||||
use LWP::Simple;
|
||||
# use HTML::Parse;
|
||||
use Carp;
|
||||
|
||||
@ISA = qw (Exporter);
|
||||
@EXPORT = qw (status statuz);
|
||||
|
||||
my $VERSION = "1.0";
|
||||
|
||||
# status wants a reference to a list of tinderbox trees
|
||||
# and a url ending with tree=, default to mozilla.org's
|
||||
# server if not provided. status returns two references
|
||||
# to hashes. the first contains tree names as key,
|
||||
# tree status as value. second hash contains trees to
|
||||
# whether or tree is open or closed.
|
||||
#
|
||||
# tree status can be horked or success.
|
||||
#
|
||||
# barf.
|
||||
|
||||
sub status
|
||||
{
|
||||
my $trees = shift;
|
||||
my $url = shift;
|
||||
my %info; my %tree_state;
|
||||
|
||||
# maybe this is too helpful
|
||||
|
||||
if (ref ($trees) ne "ARRAY")
|
||||
{
|
||||
carp "status method wants a reference to a list, not a " . ref ($trees);
|
||||
return;
|
||||
}
|
||||
|
||||
$url = $url || "http://tinderbox.mozilla.org/" .
|
||||
"showbuilds.cgi?quickparse=1&tree=";
|
||||
|
||||
my $output = get $url . join ',', @$trees;
|
||||
return if (! $output);
|
||||
|
||||
my @qp = split /\n/, $output;
|
||||
|
||||
# loop through quickparse output
|
||||
|
||||
foreach my $op (@qp)
|
||||
{
|
||||
my ($type, $tree, $build, $state) = split /\|/, $op;
|
||||
|
||||
if ($type eq "State")
|
||||
{
|
||||
$tree_state{$tree} = $state;
|
||||
}
|
||||
elsif ($type eq "Build")
|
||||
{
|
||||
if ($state =~ /success/i) {
|
||||
$state = "Success";
|
||||
} elsif ($state =~ /testfailed/i) {
|
||||
$state = "Test Failed";
|
||||
} else {
|
||||
$state = "Horked";
|
||||
}
|
||||
$info{$tree}{$build} = $state;
|
||||
}
|
||||
}
|
||||
|
||||
return (\%info, \%tree_state);
|
||||
}
|
||||
|
||||
1;
|
||||
@@ -1,160 +0,0 @@
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
||||
#
|
||||
#
|
||||
#
|
||||
# Most of this module is rudely swiped from infobot. Here are the various
|
||||
# licensing words I found with it:
|
||||
# --
|
||||
#
|
||||
# The license for this stuff is yet to be written.
|
||||
# Please don't do anything good with it without at
|
||||
# least mentioning this work, perhaps the author (Kevin
|
||||
# Lenzo, lenzo@cs.cmu.edu), and the Carnegie Mellon
|
||||
# University, which supports my study.
|
||||
#
|
||||
# Also, there is work being done on various bits of this
|
||||
# now by various people; if you have any corrections
|
||||
# or contributions, please send them to me. Flat
|
||||
# ascii files of databases, made with dump_db, are
|
||||
# wonderful things to share, and a repository will be
|
||||
# set up.
|
||||
#
|
||||
# ---
|
||||
#
|
||||
# This program is copyright Jonathan Feinberg 1999.
|
||||
#
|
||||
# This program is distributed under the same terms as infobot.
|
||||
#
|
||||
# Jonathan Feinberg
|
||||
# jdf@pobox.com
|
||||
# http://pobox.com/~jdf/
|
||||
#
|
||||
# Version 1.0
|
||||
# First public release.
|
||||
#
|
||||
# ---------------------- (End of licensing words) ------------------------
|
||||
|
||||
|
||||
package babel;
|
||||
use strict;
|
||||
use diagnostics;
|
||||
|
||||
my $no_babel;
|
||||
|
||||
BEGIN {
|
||||
eval "use URI::Escape"; # utility functions for encoding the
|
||||
if ($@) { $no_babel++}; # babelfish request
|
||||
eval "use LWP::UserAgent";
|
||||
if ($@) { $no_babel++};
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
# Translate some feasible abbreviations into the ones babelfish
|
||||
# expects.
|
||||
use vars qw!%lang_code $lang_regex!;
|
||||
%lang_code = (
|
||||
fr => 'fr',
|
||||
sp => 'es',
|
||||
po => 'pt',
|
||||
pt => 'pt',
|
||||
it => 'it',
|
||||
ge => 'de',
|
||||
de => 'de',
|
||||
gr => 'de',
|
||||
en => 'en'
|
||||
);
|
||||
|
||||
# Here's how we recognize the language you're asking for. It looks
|
||||
# like RTSL saves you a few keystrokes in #perl, huh?
|
||||
$lang_regex = join '|', keys %lang_code;
|
||||
}
|
||||
|
||||
|
||||
sub babelfish {
|
||||
return '' if $no_babel;
|
||||
my ($direction, $lang, $phrase) = @_;
|
||||
|
||||
$lang = $lang_code{$lang};
|
||||
|
||||
my $ua = new LWP::UserAgent;
|
||||
$ua->timeout(4);
|
||||
|
||||
my $req =
|
||||
HTTP::Request->new('POST',
|
||||
'http://babelfish.altavista.digital.com/cgi-bin/translate');
|
||||
$req->content_type('application/x-www-form-urlencoded');
|
||||
|
||||
my $tolang = "en_$lang";
|
||||
my $toenglish = "${lang}_en";
|
||||
|
||||
if ($direction eq 'to') {
|
||||
return translate($phrase, $tolang, $req, $ua);
|
||||
}
|
||||
elsif ($direction eq 'from') {
|
||||
return translate($phrase, $toenglish, $req, $ua);
|
||||
}
|
||||
|
||||
my $last_english = $phrase;
|
||||
my $last_lang;
|
||||
my %results = ();
|
||||
my $i = 0;
|
||||
while ($i++ < 7) {
|
||||
last if $results{$phrase}++;
|
||||
$last_lang = $phrase = translate($phrase, $tolang, $req, $ua);
|
||||
last if $results{$phrase}++;
|
||||
$last_english = $phrase = translate($phrase, $toenglish, $req, $ua);
|
||||
}
|
||||
return $last_english;
|
||||
}
|
||||
|
||||
|
||||
sub translate {
|
||||
return '' if $no_babel;
|
||||
my ($phrase, $languagepair, $req, $ua) = @_;
|
||||
|
||||
my $urltext = uri_escape($phrase);
|
||||
$req->content("urltext=$urltext&lp=$languagepair&doit=done");
|
||||
|
||||
my $res = $ua->request($req);
|
||||
|
||||
if ($res->is_success) {
|
||||
my $html = $res->content;
|
||||
# This method subject to change with the whims of Altavista's design
|
||||
# staff.
|
||||
my ($translated) =
|
||||
($html =~ m{<br>
|
||||
\s+
|
||||
<font\ face="arial,\ helvetica">
|
||||
\s*
|
||||
(?:\*\*\s+time\ out\s+\*\*)?
|
||||
\s*
|
||||
([^<]*)
|
||||
}sx);
|
||||
$translated =~ s/\n/ /g;
|
||||
$translated =~ s/\s*$//;
|
||||
return $translated;
|
||||
} else {
|
||||
return ":("; # failure
|
||||
}
|
||||
}
|
||||
|
||||
"Hello. I'm a true value.";
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,17 +0,0 @@
|
||||
CFLAGS=-g
|
||||
|
||||
OBJS=md5.o token.o main.o
|
||||
|
||||
all: $(OBJS) uuidgen
|
||||
|
||||
uuidgen: $(OBJS)
|
||||
gcc -o uuidgen $(OBJS)
|
||||
|
||||
md5.o: md5.c md5.h
|
||||
|
||||
token.o: token.c token.h
|
||||
|
||||
main.o: main.c
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ core uuidgen
|
||||
@@ -1,17 +0,0 @@
|
||||
/* copyright? hah! it's 10 lines of code! */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "token.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
uuid_state state;
|
||||
uuid_t uuid;
|
||||
char output[1024];
|
||||
|
||||
create_uuid_state(&state);
|
||||
create_token(&state, &uuid);
|
||||
format_token(output, &uuid);
|
||||
|
||||
printf("%s\n", output);
|
||||
|
||||
}
|
||||
@@ -1,263 +0,0 @@
|
||||
/*
|
||||
* This code implements the MD5 message-digest algorithm.
|
||||
* The algorithm is due to Ron Rivest. This code was
|
||||
* written by Colin Plumb in 1993, no copyright is claimed.
|
||||
* This code is in the public domain; do with it what you wish.
|
||||
*
|
||||
* Equivalent code is available from RSA Data Security, Inc.
|
||||
* This code has been tested against that, and is equivalent,
|
||||
* except that you don't need to include two pages of legalese
|
||||
* with every copy.
|
||||
*
|
||||
* To compute the message digest of a chunk of bytes, declare an
|
||||
* MD5Context structure, pass it to MD5Init, call MD5Update as
|
||||
* needed on buffers full of bytes, and then call MD5Final, which
|
||||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
/* Brutally hacked by John Walker back from ANSI C to K&R (no
|
||||
prototypes) to maintain the tradition that Netfone will compile
|
||||
with Sun's original "cc". */
|
||||
|
||||
#include <memory.h> /* for memcpy() */
|
||||
#include "md5.h"
|
||||
|
||||
#ifdef sgi
|
||||
#define HIGHFIRST
|
||||
#endif
|
||||
|
||||
#ifdef sun
|
||||
#define HIGHFIRST
|
||||
#endif
|
||||
|
||||
#ifndef HIGHFIRST
|
||||
#define byteReverse(buf, len) /* Nothing */
|
||||
#else
|
||||
/*
|
||||
* Note: this code is harmless on little-endian machines.
|
||||
*/
|
||||
void byteReverse(buf, longs)
|
||||
unsigned char *buf; unsigned longs;
|
||||
{
|
||||
uint32 t;
|
||||
do {
|
||||
t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
|
||||
((unsigned) buf[1] << 8 | buf[0]);
|
||||
*(uint32 *) buf = t;
|
||||
buf += 4;
|
||||
} while (--longs);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
|
||||
* initialization constants.
|
||||
*/
|
||||
void MD5Init(ctx)
|
||||
struct MD5Context *ctx;
|
||||
{
|
||||
ctx->buf[0] = 0x67452301;
|
||||
ctx->buf[1] = 0xefcdab89;
|
||||
ctx->buf[2] = 0x98badcfe;
|
||||
ctx->buf[3] = 0x10325476;
|
||||
|
||||
ctx->bits[0] = 0;
|
||||
ctx->bits[1] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Update context to reflect the concatenation of another buffer full
|
||||
* of bytes.
|
||||
*/
|
||||
void MD5Update(ctx, buf, len)
|
||||
struct MD5Context *ctx; unsigned char *buf; unsigned len;
|
||||
{
|
||||
uint32 t;
|
||||
|
||||
/* Update bitcount */
|
||||
|
||||
t = ctx->bits[0];
|
||||
if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
|
||||
ctx->bits[1]++; /* Carry from low to high */
|
||||
ctx->bits[1] += len >> 29;
|
||||
|
||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||
|
||||
/* Handle any leading odd-sized chunks */
|
||||
|
||||
if (t) {
|
||||
unsigned char *p = (unsigned char *) ctx->in + t;
|
||||
|
||||
t = 64 - t;
|
||||
if (len < t) {
|
||||
memcpy(p, buf, len);
|
||||
return;
|
||||
}
|
||||
memcpy(p, buf, t);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
/* Process data in 64-byte chunks */
|
||||
|
||||
while (len >= 64) {
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
|
||||
/* Handle any remaining bytes of data. */
|
||||
|
||||
memcpy(ctx->in, buf, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Final wrapup - pad to 64-byte boundary with the bit pattern
|
||||
* 1 0* (64-bit count of bits processed, MSB-first)
|
||||
*/
|
||||
void MD5Final(digest, ctx)
|
||||
unsigned char digest[16]; struct MD5Context *ctx;
|
||||
{
|
||||
unsigned count;
|
||||
unsigned char *p;
|
||||
|
||||
/* Compute number of bytes mod 64 */
|
||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||
|
||||
/* Set the first char of padding to 0x80. This is safe since there is
|
||||
always at least one byte free */
|
||||
p = ctx->in + count;
|
||||
*p++ = 0x80;
|
||||
|
||||
/* Bytes of padding needed to make 64 bytes */
|
||||
count = 64 - 1 - count;
|
||||
|
||||
/* Pad out to 56 mod 64 */
|
||||
if (count < 8) {
|
||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||
memset(p, 0, count);
|
||||
byteReverse(ctx->in, 16);
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
memset(ctx->in, 0, 56);
|
||||
} else {
|
||||
/* Pad block to 56 bytes */
|
||||
memset(p, 0, count - 8);
|
||||
}
|
||||
byteReverse(ctx->in, 14);
|
||||
|
||||
/* Append length in bits and transform */
|
||||
((uint32 *) ctx->in)[14] = ctx->bits[0];
|
||||
((uint32 *) ctx->in)[15] = ctx->bits[1];
|
||||
|
||||
MD5Transform(ctx->buf, (uint32 *) ctx->in);
|
||||
byteReverse((unsigned char *) ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
#define F3(x, y, z) (x ^ y ^ z)
|
||||
#define F4(x, y, z) (y ^ (x | ~z))
|
||||
|
||||
/* This is the central step in the MD5 algorithm. */
|
||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||
|
||||
/*
|
||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||
* the data and converts bytes into longwords for this routine.
|
||||
*/
|
||||
void MD5Transform(buf, in)
|
||||
uint32 buf[4]; uint32 in[16];
|
||||
{
|
||||
register uint32 a, b, c, d;
|
||||
|
||||
a = buf[0];
|
||||
b = buf[1];
|
||||
c = buf[2];
|
||||
d = buf[3];
|
||||
|
||||
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
buf[0] += a;
|
||||
buf[1] += b;
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
#ifdef __alpha
|
||||
typedef unsigned int uint32;
|
||||
#else
|
||||
typedef unsigned long uint32;
|
||||
#endif
|
||||
|
||||
struct MD5Context {
|
||||
uint32 buf[4];
|
||||
uint32 bits[2];
|
||||
unsigned char in[64];
|
||||
};
|
||||
|
||||
extern void MD5Init();
|
||||
extern void MD5Update();
|
||||
extern void MD5Final();
|
||||
extern void MD5Transform();
|
||||
|
||||
/*
|
||||
* This is needed to make RSAREF happy on some MS-DOS compilers.
|
||||
*/
|
||||
typedef struct MD5Context MD5_CTX;
|
||||
|
||||
#endif /* !MD5_H */
|
||||
@@ -1,356 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 1998-1999 Greg Stein. All Rights Reserved.
|
||||
**
|
||||
** By using this file, you agree to the terms and conditions set forth in
|
||||
** the LICENSE.html file which can be found at the top level of the mod_dav
|
||||
** distribution or at http://www.webdav.org/mod_dav/license-1.html.
|
||||
**
|
||||
** Contact information:
|
||||
** Greg Stein, PO Box 3151, Redmond, WA, 98073
|
||||
** gstein@lyra.org, http://www.webdav.org/mod_dav/
|
||||
*/
|
||||
|
||||
/*
|
||||
** DAV opaquelocktoken scheme implementation
|
||||
**
|
||||
** Written 5/99 by Keith Wannamaker, wannamak@us.ibm.com
|
||||
** Adapted from ISO/DCE RPC spec and a former Internet Draft
|
||||
** by Leach and Salz:
|
||||
** http://www.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uuids-guids-01
|
||||
**
|
||||
** Portions of the code are covered by the following license:
|
||||
**
|
||||
** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
||||
** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
|
||||
** Digital Equipment Corporation, Maynard, Mass.
|
||||
** Copyright (c) 1998 Microsoft.
|
||||
** To anyone who acknowledges that this file is provided "AS IS"
|
||||
** without any express or implied warranty: permission to use, copy,
|
||||
** modify, and distribute this file for any purpose is hereby
|
||||
** granted without fee, provided that the above copyright notices and
|
||||
** this notice appears in all source code copies, and that none of
|
||||
** the names of Open Software Foundation, Inc., Hewlett-Packard
|
||||
** Company, or Digital Equipment Corporation be used in advertising
|
||||
** or publicity pertaining to distribution of the software without
|
||||
** specific, written prior permission. Neither Open Software
|
||||
** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
|
||||
** Corporation makes any representations about the suitability of
|
||||
** this software for any purpose.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "md5.h"
|
||||
#include "token.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#endif
|
||||
|
||||
/* set the following to the number of 100ns ticks of the actual resolution of
|
||||
your system's clock */
|
||||
#define UUIDS_PER_TICK 1024
|
||||
|
||||
/* Set this to what your compiler uses for 64 bit data type */
|
||||
#ifdef WIN32
|
||||
#define unsigned64_t unsigned __int64
|
||||
#define I64(C) C
|
||||
#else
|
||||
#define unsigned64_t unsigned long long
|
||||
#define I64(C) C##LL
|
||||
#endif
|
||||
|
||||
typedef unsigned64_t uuid_time_t;
|
||||
|
||||
const uuid_t null_locktoken = {0};
|
||||
|
||||
static void format_uuid_v1(uuid_t * uuid, unsigned16 clockseq, uuid_time_t timestamp, uuid_node_t node);
|
||||
static void get_current_time(uuid_time_t * timestamp);
|
||||
static unsigned16 true_random(void);
|
||||
static void get_pseudo_node_identifier(uuid_node_t *node);
|
||||
static void get_system_time(uuid_time_t *uuid_time);
|
||||
static void get_random_info(unsigned char seed[16]);
|
||||
|
||||
|
||||
/* dav_create_opaquelocktoken - generates a UUID version 1 token.
|
||||
* Clock_sequence and node_address set to pseudo-random
|
||||
* numbers during init.
|
||||
*
|
||||
* Should postpend pid to account for non-seralized creation?
|
||||
*/
|
||||
int create_token(uuid_state *st, uuid_t *u)
|
||||
{
|
||||
uuid_time_t timestamp;
|
||||
|
||||
get_current_time(×tamp);
|
||||
format_uuid_v1(u, st->cs, timestamp, st->node);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* dav_create_uuid_state - seed UUID state with pseudorandom data
|
||||
*/
|
||||
void create_uuid_state(uuid_state *st)
|
||||
{
|
||||
st->cs = true_random();
|
||||
get_pseudo_node_identifier(&st->node);
|
||||
}
|
||||
|
||||
/*
|
||||
* dav_format_opaquelocktoken - generates a text representation
|
||||
* of an opaquelocktoken
|
||||
*/
|
||||
void format_token(char *target, const uuid_t *u)
|
||||
{
|
||||
sprintf(target, "%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
u->time_low, u->time_mid, u->time_hi_and_version,
|
||||
u->clock_seq_hi_and_reserved, u->clock_seq_low,
|
||||
u->node[0], u->node[1], u->node[2],
|
||||
u->node[3], u->node[4], u->node[5]);
|
||||
}
|
||||
|
||||
/* convert a pair of hex digits to an integer value [0,255] */
|
||||
static int dav_parse_hexpair(const char *s)
|
||||
{
|
||||
int result;
|
||||
int temp;
|
||||
|
||||
result = s[0] - '0';
|
||||
if (result > 48)
|
||||
result = (result - 39) << 4;
|
||||
else if (result > 16)
|
||||
result = (result - 7) << 4;
|
||||
else
|
||||
result = result << 4;
|
||||
|
||||
temp = s[1] - '0';
|
||||
if (temp > 48)
|
||||
result |= temp - 39;
|
||||
else if (temp > 16)
|
||||
result |= temp - 7;
|
||||
else
|
||||
result |= temp;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* dav_parse_locktoken: Parses string produced from
|
||||
* dav_format_opaquelocktoken back into a uuid_t
|
||||
* structure. On failure, return DAV_IF_ERROR_PARSE,
|
||||
* else DAV_IF_ERROR_NONE.
|
||||
*/
|
||||
int parse_token(const char *char_token, uuid_t *bin_token)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 36; ++i) {
|
||||
char c = char_token[i];
|
||||
if (!isxdigit(c) &&
|
||||
!(c == '-' && (i == 8 || i == 13 || i == 18 || i == 23)))
|
||||
return -1;
|
||||
}
|
||||
if (char_token[36] != '\0')
|
||||
return -1;
|
||||
|
||||
bin_token->time_low =
|
||||
(dav_parse_hexpair(&char_token[0]) << 24) |
|
||||
(dav_parse_hexpair(&char_token[2]) << 16) |
|
||||
(dav_parse_hexpair(&char_token[4]) << 8) |
|
||||
dav_parse_hexpair(&char_token[6]);
|
||||
|
||||
bin_token->time_mid =
|
||||
(dav_parse_hexpair(&char_token[9]) << 8) |
|
||||
dav_parse_hexpair(&char_token[11]);
|
||||
|
||||
bin_token->time_hi_and_version =
|
||||
(dav_parse_hexpair(&char_token[14]) << 8) |
|
||||
dav_parse_hexpair(&char_token[16]);
|
||||
|
||||
bin_token->clock_seq_hi_and_reserved = dav_parse_hexpair(&char_token[19]);
|
||||
bin_token->clock_seq_low = dav_parse_hexpair(&char_token[21]);
|
||||
|
||||
for (i = 6; i--;)
|
||||
bin_token->node[i] = dav_parse_hexpair(&char_token[i*2+24]);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* dav_compare_opaquelocktoken:
|
||||
* < 0 : a < b
|
||||
* == 0 : a = b
|
||||
* > 0 : a > b
|
||||
*/
|
||||
int compare_token(const uuid_t a, const uuid_t b)
|
||||
{
|
||||
return memcmp(&a, &b, sizeof(uuid_t));
|
||||
}
|
||||
|
||||
/* format_uuid_v1 -- make a UUID from the timestamp, clockseq, and node ID */
|
||||
static void format_uuid_v1(uuid_t * uuid, unsigned16 clock_seq,
|
||||
uuid_time_t timestamp, uuid_node_t node)
|
||||
{
|
||||
/* Construct a version 1 uuid with the information we've gathered
|
||||
* plus a few constants. */
|
||||
uuid->time_low = (unsigned long)(timestamp & 0xFFFFFFFF);
|
||||
uuid->time_mid = (unsigned short)((timestamp >> 32) & 0xFFFF);
|
||||
uuid->time_hi_and_version = (unsigned short)((timestamp >> 48) & 0x0FFF);
|
||||
uuid->time_hi_and_version |= (1 << 12);
|
||||
uuid->clock_seq_low = clock_seq & 0xFF;
|
||||
uuid->clock_seq_hi_and_reserved = (clock_seq & 0x3F00) >> 8;
|
||||
uuid->clock_seq_hi_and_reserved |= 0x80;
|
||||
memcpy(&uuid->node, &node, sizeof uuid->node);
|
||||
}
|
||||
|
||||
/* get-current_time -- get time as 60 bit 100ns ticks since whenever.
|
||||
Compensate for the fact that real clock resolution is less than 100ns. */
|
||||
static void get_current_time(uuid_time_t * timestamp)
|
||||
{
|
||||
uuid_time_t time_now;
|
||||
static uuid_time_t time_last;
|
||||
static unsigned16 uuids_this_tick;
|
||||
static int inited = 0;
|
||||
|
||||
if (!inited) {
|
||||
get_system_time(&time_now);
|
||||
uuids_this_tick = UUIDS_PER_TICK;
|
||||
inited = 1;
|
||||
};
|
||||
|
||||
while (1) {
|
||||
get_system_time(&time_now);
|
||||
|
||||
/* if clock reading changed since last UUID generated... */
|
||||
if (time_last != time_now) {
|
||||
/* reset count of uuids gen'd with this clock reading */
|
||||
uuids_this_tick = 0;
|
||||
break;
|
||||
};
|
||||
if (uuids_this_tick < UUIDS_PER_TICK) {
|
||||
uuids_this_tick++;
|
||||
break;
|
||||
}; /* going too fast for our clock; spin */
|
||||
}; /* add the count of uuids to low order bits of the clock reading */
|
||||
|
||||
*timestamp = time_now + uuids_this_tick;
|
||||
}
|
||||
|
||||
/* true_random -- generate a crypto-quality random number.
|
||||
This sample doesn't do that. */
|
||||
static unsigned16 true_random(void)
|
||||
{
|
||||
uuid_time_t time_now;
|
||||
|
||||
get_system_time(&time_now);
|
||||
time_now = time_now/UUIDS_PER_TICK;
|
||||
srand((unsigned int)(((time_now >> 32) ^ time_now)&0xffffffff));
|
||||
|
||||
return rand();
|
||||
}
|
||||
|
||||
/* This sample implementation generates a random node ID *
|
||||
* in lieu of a system dependent call to get IEEE node ID. */
|
||||
static void get_pseudo_node_identifier(uuid_node_t *node)
|
||||
{
|
||||
unsigned char seed[16];
|
||||
|
||||
get_random_info(seed);
|
||||
seed[0] |= 0x80;
|
||||
memcpy(node, seed, sizeof(*node));
|
||||
}
|
||||
|
||||
/* system dependent call to get the current system time.
|
||||
Returned as 100ns ticks since Oct 15, 1582, but resolution may be
|
||||
less than 100ns. */
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
static void get_system_time(uuid_time_t *uuid_time)
|
||||
{
|
||||
ULARGE_INTEGER time;
|
||||
|
||||
GetSystemTimeAsFileTime((FILETIME *)&time);
|
||||
|
||||
/* NT keeps time in FILETIME format which is 100ns ticks since
|
||||
Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
|
||||
The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
|
||||
+ 18 years and 5 leap days. */
|
||||
|
||||
time.QuadPart +=
|
||||
(unsigned __int64) (1000*1000*10) // seconds
|
||||
* (unsigned __int64) (60 * 60 * 24) // days
|
||||
* (unsigned __int64) (17+30+31+365*18+5); // # of days
|
||||
*uuid_time = time.QuadPart;
|
||||
}
|
||||
|
||||
static void get_random_info(unsigned char seed[16])
|
||||
{
|
||||
MD5_CTX c;
|
||||
struct {
|
||||
MEMORYSTATUS m;
|
||||
SYSTEM_INFO s;
|
||||
FILETIME t;
|
||||
LARGE_INTEGER pc;
|
||||
DWORD tc;
|
||||
DWORD l;
|
||||
char hostname[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
|
||||
} r;
|
||||
|
||||
MD5Init(&c); /* memory usage stats */
|
||||
GlobalMemoryStatus(&r.m); /* random system stats */
|
||||
GetSystemInfo(&r.s); /* 100ns resolution (nominally) time of day */
|
||||
GetSystemTimeAsFileTime(&r.t); /* high resolution performance counter */
|
||||
QueryPerformanceCounter(&r.pc); /* milliseconds since last boot */
|
||||
r.tc = GetTickCount();
|
||||
r.l = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
|
||||
GetComputerName(r.hostname, &r.l );
|
||||
MD5Update(&c, (const unsigned char *) &r, sizeof(r));
|
||||
MD5Final(seed, &c);
|
||||
}
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
static void get_system_time(uuid_time_t *uuid_time)
|
||||
{
|
||||
struct timeval tp;
|
||||
|
||||
gettimeofday(&tp, (struct timezone *)0);
|
||||
|
||||
/* Offset between UUID formatted times and Unix formatted times.
|
||||
UUID UTC base time is October 15, 1582.
|
||||
Unix base time is January 1, 1970. */
|
||||
*uuid_time = (tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
|
||||
I64(0x01B21DD213814000);
|
||||
}
|
||||
|
||||
static void get_random_info(unsigned char seed[16])
|
||||
{
|
||||
MD5_CTX c;
|
||||
/* Leech & Salz use Linux-specific struct sysinfo;
|
||||
* replace with pid/tid for portability (in the spirit of mod_unique_id) */
|
||||
struct {
|
||||
/* Add thread id here, if applicable, when we get to pthread or apr */
|
||||
pid_t pid;
|
||||
struct timeval t;
|
||||
char hostname[257];
|
||||
|
||||
} r;
|
||||
|
||||
MD5Init(&c);
|
||||
r.pid = getpid();
|
||||
gettimeofday(&r.t, (struct timezone *)0);
|
||||
gethostname(r.hostname, 256);
|
||||
MD5Update(&c, (const unsigned char *)&r, sizeof(r));
|
||||
MD5Final(seed, &c);
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 1998-1999 Greg Stein. All Rights Reserved.
|
||||
**
|
||||
** By using this file, you agree to the terms and conditions set forth in
|
||||
** the LICENSE.html file which can be found at the top level of the mod_dav
|
||||
** distribution or at http://www.webdav.org/mod_dav/license-1.html.
|
||||
**
|
||||
** Contact information:
|
||||
** Greg Stein, PO Box 3151, Redmond, WA, 98073
|
||||
** gstein@lyra.org, http://www.webdav.org/mod_dav/
|
||||
*/
|
||||
|
||||
/*
|
||||
** DAV opaquelocktoken scheme implementation
|
||||
**
|
||||
** Written 5/99 by Keith Wannamaker, wannamak@us.ibm.com
|
||||
** Adapted from ISO/DCE RPC spec and a former Internet Draft
|
||||
** by Leach and Salz:
|
||||
** http://www.ics.uci.edu/pub/ietf/webdav/uuid-guid/draft-leach-uuids-guids-01
|
||||
**
|
||||
** Portions of the code are covered by the following license:
|
||||
**
|
||||
** Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
||||
** Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
|
||||
** Digital Equipment Corporation, Maynard, Mass.
|
||||
** Copyright (c) 1998 Microsoft.
|
||||
** To anyone who acknowledges that this file is provided "AS IS"
|
||||
** without any express or implied warranty: permission to use, copy,
|
||||
** modify, and distribute this file for any purpose is hereby
|
||||
** granted without fee, provided that the above copyright notices and
|
||||
** this notice appears in all source code copies, and that none of
|
||||
** the names of Open Software Foundation, Inc., Hewlett-Packard
|
||||
** Company, or Digital Equipment Corporation be used in advertising
|
||||
** or publicity pertaining to distribution of the software without
|
||||
** specific, written prior permission. Neither Open Software
|
||||
** Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital Equipment
|
||||
** Corporation makes any representations about the suitability of
|
||||
** this software for any purpose.
|
||||
*/
|
||||
|
||||
#ifndef _TOKEN_H_
|
||||
#define _TOKEN_H_
|
||||
|
||||
typedef unsigned long unsigned32;
|
||||
typedef unsigned short unsigned16;
|
||||
typedef unsigned char unsigned8;
|
||||
|
||||
typedef struct {
|
||||
char nodeID[6];
|
||||
} uuid_node_t;
|
||||
|
||||
#undef uuid_t
|
||||
|
||||
typedef struct _uuid_t
|
||||
{
|
||||
unsigned32 time_low;
|
||||
unsigned16 time_mid;
|
||||
unsigned16 time_hi_and_version;
|
||||
unsigned8 clock_seq_hi_and_reserved;
|
||||
unsigned8 clock_seq_low;
|
||||
unsigned8 node[6];
|
||||
} uuid_t;
|
||||
|
||||
/* data type for UUID generator persistent state */
|
||||
|
||||
typedef struct {
|
||||
uuid_node_t node; /* saved node ID */
|
||||
unsigned16 cs; /* saved clock sequence */
|
||||
} uuid_state;
|
||||
|
||||
extern const uuid_t null_locktoken;
|
||||
|
||||
/* in dav_opaquelock.c */
|
||||
int create_token(uuid_state *st, uuid_t *u);
|
||||
void create_uuid_state(uuid_state *st);
|
||||
void format_token(char *target, const uuid_t *u);
|
||||
int compare_token(const uuid_t a, const uuid_t b);
|
||||
int parse_token(const char *char_token, uuid_t *bin_token);
|
||||
|
||||
#endif /* _TOKEN_H_ */
|
||||
Reference in New Issue
Block a user