This commit is contained in:
Wolfgang Hottgenroth 2007-11-12 11:17:52 +01:00
parent da2bc88c59
commit 57a658bf5c
2 changed files with 0 additions and 1851 deletions

View File

@ -1,914 +0,0 @@
%!PS-Adobe-3.0
%%Title: yadyn
%%For: Wolfgang Hottgenroth
%%Creator: a2ps version 4.13
%%CreationDate: Sat Nov 10 10:08:03 2007
%%BoundingBox: 24 24 588 768
%%DocumentData: Clean7Bit
%%Orientation: Landscape
%%Pages: 1
%%PageOrder: Ascend
%%DocumentMedia: Letter 612 792 0 () ()
%%DocumentNeededResources: font Courier
%%+ font Courier-Bold
%%+ font Courier-BoldOblique
%%+ font Courier-Oblique
%%+ font Helvetica
%%+ font Helvetica-Bold
%%+ font Symbol
%%+ font Times-Bold
%%+ font Times-Roman
%%DocumentProcessColors: Black
%%DocumentSuppliedResources: procset a2ps-a2ps-hdr
%%+ procset a2ps-black+white-Prolog
%%+ encoding ISO-8859-1Encoding
%%EndComments
/a2psdict 200 dict def
a2psdict begin
%%BeginProlog
%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
% Check PostScript language level.
/languagelevel where {
pop /gs_languagelevel languagelevel def
} {
/gs_languagelevel 1 def
} ifelse
% EPSF import as in the Red Book
/BeginInclude {
/b4_Inc_state save def % Save state for cleanup
/dict_count countdictstack def % Count objects on dict stack
/op_count count 1 sub def % Count objects on operand stack
userdict begin
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
gs_languagelevel 1 ne {
false setstrokeadjust false setoverprint
} if
} bind def
/EndInclude {
count op_count sub { pos } repeat % Clean up stacks
countdictstack dict_count sub { end } repeat
b4_Inc_state restore
} bind def
/BeginEPSF {
BeginInclude
/showpage { } def
} bind def
/EndEPSF {
EndInclude
} bind def
% Page prefeed
/page_prefeed { % bool -> -
statusdict /prefeed known {
statusdict exch /prefeed exch put
} {
pop
} ifelse
} bind def
/deffont {
findfont exch scalefont def
} bind def
/reencode_font {
findfont reencode 2 copy definefont pop def
} bind def
% Function c-show (str => -)
% centers text only according to x axis.
/c-show {
dup stringwidth pop
2 div neg 0 rmoveto
show
} bind def
% Function l-show (str => -)
% prints texts so that it ends at currentpoint
/l-show {
dup stringwidth pop neg
0
rmoveto show
} bind def
% center-fit show (str w => -)
% show centered, and scale currentfont so that the width is less than w
/cfshow {
exch dup stringwidth pop
% If the title is too big, try to make it smaller
3 2 roll 2 copy
gt
{ % if, i.e. too big
exch div
currentfont exch scalefont setfont
} { % ifelse
pop pop
}
ifelse
c-show % center title
} bind def
% Return the y size of the current font
% - => fontsize
/currentfontsize {
currentfont /FontMatrix get 3 get 1000 mul
} bind def
% reencode the font
% <encoding-vector> <fontdict> -> <newfontdict>
/reencode
{
dup length 5 add dict begin
{ % <vector> <key> <val>
1 index /FID ne
{ def }{ pop pop } ifelse
} forall
/Encoding exch def % -
% Use the font's bounding box to determine the ascent, descent,
% and overall height; don't forget that these values have to be
% transformed using the font's matrix. We use `load' because sometimes
% BBox is executable, sometimes not. Since we need 4 numbers an not
% an array avoid BBox from being executed
/FontBBox load aload pop
FontMatrix transform /Ascent exch def pop
FontMatrix transform /Descent exch def pop
/FontHeight Ascent Descent sub def
% Get the underline position and thickness if they're defined.
% Use 1 if they are not defined.
currentdict /FontInfo 2 copy known
{ get
/UnderlinePosition 2 copy % <FontInfo> /UP <FontInfo> /UP
2 copy known
{ get }{ pop pop 1} ifelse
0 exch FontMatrix transform exch pop
def % <FontInfo>
/UnderlineThickness 2 copy % <FontInfo> /UT <FontInfo> /UT
2 copy known
{ get }{ pop pop 1} ifelse
0 exch FontMatrix transform exch pop
def % <FontInfo>
pop % -
}{ pop pop
} ifelse
currentdict
end
} bind def
% Function print line number (<string> # -)
/# {
gsave
sx cw mul neg 2 div 0 rmoveto
f# setfont
c-show
grestore
} bind def
% -------- Some routines to enlight plain b/w printings ---------
% Underline
% width --
/dounderline {
currentpoint
gsave
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
0 rlineto
stroke
grestore
} bind def
% Underline a string
% string --
/dounderlinestring {
stringwidth pop
dounderline
} bind def
/UL {
/ul exch store
} bind def
% Draw a box of WIDTH wrt current font
% width --
/dobox {
currentpoint
gsave
newpath
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
dup 0 rlineto
0 currentfont /FontHeight get currentfontsize mul rlineto
neg 0 rlineto
closepath
stroke
grestore
} bind def
/BX {
/bx exch store
} bind def
% Box a string
% string --
/doboxstring {
stringwidth pop
dobox
} bind def
%
% ------------- Color routines ---------------
%
/FG /setrgbcolor load def
% Draw the background
% width --
/dobackground {
currentpoint
gsave
newpath
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
dup 0 rlineto
0 currentfont /FontHeight get currentfontsize mul rlineto
neg 0 rlineto
closepath
bgcolor aload pop setrgbcolor
fill
grestore
} bind def
% Draw bg for a string
% string --
/dobackgroundstring {
stringwidth pop
dobackground
} bind def
/BG {
dup /bg exch store
{ mark 4 1 roll ] /bgcolor exch store } if
} bind def
/Show {
bg { dup dobackgroundstring } if
ul { dup dounderlinestring } if
bx { dup doboxstring } if
show
} bind def
% Function T(ab), jumps to the n-th tabulation in the current line
/T {
cw mul x0 add
bg { dup currentpoint pop sub dobackground } if
ul { dup currentpoint pop sub dounderline } if
bx { dup currentpoint pop sub dobox } if
y0 moveto
} bind def
% Function n: move to the next line
/n {
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
% Function N: show and move to the next line
/N {
Show
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
/S {
Show
} bind def
%%BeginResource: procset a2ps-a2ps-hdr 2.0 2
%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
% Function title: prints page header.
% <ct> <rt> <lt> are passed as argument
/title {
% 1. Draw the background
x v get y v get moveto
gsave
0 th 2 div neg rmoveto
th setlinewidth
0.95 setgray
pw 0 rlineto stroke
grestore
% 2. Border it
gsave
0.7 setlinewidth
pw 0 rlineto
0 th neg rlineto
pw neg 0 rlineto
closepath stroke
grestore
% stk: ct rt lt
x v get y v get th sub 1 add moveto
%%IncludeResource: font Helvetica
fHelvetica fnfs 0.8 mul scalefont setfont
% 3. The left title
gsave
dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
fnfs 0.8 mul hm rmoveto
show % left title
grestore
exch
% stk: ct ltw rt
% 4. the right title
gsave
dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
dup
pw exch stringwidth pop fnfs 0.8 mul add sub
hm
rmoveto
show % right title
grestore
% stk: ct ltw rtw
% 5. the center title
gsave
pw 3 1 roll
% stk: ct pw ltw rtw
3 copy
% Move to the center of the left room
sub add 2 div hm rmoveto
% What is the available space in here?
add sub fnfs 0.8 mul sub fnfs 0.8 mul sub
% stk: ct space_left
%%IncludeResource: font Helvetica-Bold
fHelvetica-Bold fnfs scalefont setfont
cfshow
grestore
} bind def
% Function border: prints virtual page border
/border { %def
gsave % print four sides
0 setgray
x v get y v get moveto
0.7 setlinewidth % of the square
pw 0 rlineto
0 ph neg rlineto
pw neg 0 rlineto
closepath stroke
grestore
} bind def
% Function water: prints a water mark in background
/water { %def
gsave
scx scy moveto rotate
%%IncludeResource: font Times-Bold
fTimes-Bold 100 scalefont setfont
.97 setgray
dup stringwidth pop 2 div neg -50 rmoveto
show
grestore
} bind def
% Function rhead: prints the right header
/rhead { %def
lx ly moveto
fHelvetica fnfs 0.8 mul scalefont setfont
l-show
} bind def
% Function footer (cf rf lf -> -)
/footer {
fHelvetica fnfs 0.8 mul scalefont setfont
dx dy moveto
show
snx sny moveto
l-show
fnx fny moveto
c-show
} bind def
%%EndResource
%%BeginResource: procset a2ps-black+white-Prolog 2.0 1
% Function T(ab), jumps to the n-th tabulation in the current line
/T {
cw mul x0 add y0 moveto
} bind def
% Function n: move to the next line
/n { %def
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
% Function N: show and move to the next line
/N {
Show
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
/S {
Show
} bind def
/p {
false UL
false BX
fCourier bfs scalefont setfont
Show
} bind def
/sy {
false UL
false BX
fSymbol bfs scalefont setfont
Show
} bind def
/k {
false UL
false BX
fCourier-Oblique bfs scalefont setfont
Show
} bind def
/K {
false UL
false BX
fCourier-Bold bfs scalefont setfont
Show
} bind def
/c {
false UL
false BX
fCourier-Oblique bfs scalefont setfont
Show
} bind def
/C {
false UL
false BX
fCourier-BoldOblique bfs scalefont setfont
Show
} bind def
/l {
false UL
false BX
fHelvetica bfs scalefont setfont
Show
} bind def
/L {
false UL
false BX
fHelvetica-Bold bfs scalefont setfont
Show
} bind def
/str{
false UL
false BX
fTimes-Roman bfs scalefont setfont
Show
} bind def
/e{
false UL
true BX
fHelvetica-Bold bfs scalefont setfont
Show
} bind def
%%EndResource
%%EndProlog
%%BeginSetup
%%IncludeResource: font Courier
%%IncludeResource: font Courier-Oblique
%%IncludeResource: font Courier-Bold
%%IncludeResource: font Times-Roman
%%IncludeResource: font Symbol
%%IncludeResource: font Courier-BoldOblique
%%BeginResource: encoding ISO-8859-1Encoding
/ISO-8859-1Encoding [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus /comma /minus /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /less /equal /greater /question
/at /A /B /C /D /E /F /G
/H /I /J /K /L /M /N /O
/P /Q /R /S /T /U /V /W
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
/quoteleft /a /b /c /d /e /f /g
/h /i /j /k /l /m /n /o
/p /q /r /s /t /u /v /w
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclamdown /cent /sterling /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /bullet
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
] def
%%EndResource
% Initialize page description variables.
/sh 612 def
/sw 792 def
/llx 24 def
/urx 768 def
/ury 588 def
/lly 24 def
/#copies 1 def
/th 15.000000 def
/fnfs 11 def
/bfs 6.000000 def
/cw 3.600000 def
% Dictionary for ISO-8859-1 support
/iso1dict 8 dict begin
/fCourier ISO-8859-1Encoding /Courier reencode_font
/fCourier-Bold ISO-8859-1Encoding /Courier-Bold reencode_font
/fCourier-BoldOblique ISO-8859-1Encoding /Courier-BoldOblique reencode_font
/fCourier-Oblique ISO-8859-1Encoding /Courier-Oblique reencode_font
/fHelvetica ISO-8859-1Encoding /Helvetica reencode_font
/fHelvetica-Bold ISO-8859-1Encoding /Helvetica-Bold reencode_font
/fTimes-Bold ISO-8859-1Encoding /Times-Bold reencode_font
/fTimes-Roman ISO-8859-1Encoding /Times-Roman reencode_font
currentdict end def
/bgcolor [ 0 0 0 ] def
/bg false def
/ul false def
/bx false def
% The font for line numbering
/f# /Helvetica findfont bfs .6 mul scalefont def
/fSymbol /Symbol findfont def
/hm fnfs 0.25 mul def
/pw
cw 101.400000 mul
def
/ph
520.200000 th add
def
/pmw urx llx sub pw 2 mul sub 1 div def
/pmh 0 def
/v 0 def
/x [
0
dup pmw add pw add
] def
/y [
pmh ph add 0 mul ph add
dup
] def
/scx sw 2 div def
/scy sh 2 div def
/snx urx def
/sny lly 2 add def
/dx llx def
/dy sny def
/fnx scx def
/fny dy def
/lx snx def
/ly ury fnfs 0.8 mul sub def
/sx 0 def
/tab 8 def
/x0 0 def
/y0 0 def
%%EndSetup
%%Page: (1-2) 1
%%BeginPageSetup
/pagesave save def
sh 0 translate 90 rotate
%%EndPageSetup
iso1dict begin
gsave
llx lly 12 add translate
/v 0 store
/x0 x v get 2.520000 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
(#!/usr/bin/python) c n
() p n
(import) K
( socket) p n
(import) K
( Queue) p n
(import) K
( threading) p n
(import) K
( md5) p n
(import) K
( time) p n
() N
(class) K
( Entry\(object\):) p n
( ) S
(def) K
( __init__\(self, dynid, sharedSecret, name\):) p n
( self.dynid = dynid) N
( self.sharedSecret = sharedSecret) N
( self.name = name) N
( self.lastEventTime = 0) N
( self.address = '') N
() N
(class) K
( IllegalEventException\(Exception\):) p n
( ) S
(def) K
( __init__\(self, msg\):) p n
( self.msg = msg) N
() N
() N
(class) K
( Event\(object\):) p n
( ) S
(def) K
( __init__\(self, address, data, receiveTime\):) p n
( self.address = address) N
( self.data = data) N
( self.receiveTime = receiveTime) N
() N
( ) S
(def) K
( prepare\(self\):) p n
( self.port = self.address[1]) N
( self.address = self.address[0]) N
( \(self.dynid, self.msgTime, self.checksum\) = self.data.split\(') S
( ) str
('\)) p n
( self.msgTime = int\(self.msgTime\)) N
( self.prepared = True) N
() N
( ) S
(def) K
( process\(self\):) p n
( ) S
(if) K
( ) p
(not) K
( self.prepared:) p n
( self.prepare\(\)) N
() N
( ) S
(if) K
( ) p
(not) K
( ENTRIES.has_key\(self.dynid\):) p n
( ) S
(raise) K
( IllegalEventException\(") p
(unknown dynid in event %s) str
(" % str\(self\)\)) p n
( entry = ENTRIES[self.dynid]) N
() N
( ) S
(if) K
( self.msgTime + MSG_TIME_CORRIDOR < self.receiveTime:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(event too old %s) str
(" % str\(self\)\)) p n
( ) S
(if) K
( self.msgTime - MSG_TIME_CORRIDOR > self.receiveTime:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(event too young %s) str
(" % str\(self\)\)) p n
() N
() N
( ) S
(if) K
( entry.lastEventTime >= self.msgTime:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(timing sequence failure in event, possibly replay %s) str
(" % str\(self\)\)) p n
() N
( di = ") S
(%s %s %d) str
(" % \(self.dynid, entry.sharedSecret, self.msgTime\)) p n
( d = md5.new\(di\).hexdigest\(\)) N
( ) S
(print) K
( ") p
(%s, received: %s, calculated: %s) str
(" % \(di, self.checksum, d\)) p n
( ) S
(if) K
( d != self.checksum:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(wrong checksum for event %s) str
(" % str\(self\)\)) p n
() N
( entry.lastEventTime = self.msgTime) N
() N
( ) S
(if) K
( entry.address == self.address:) p n
( ) S
(print) K
( ") p
(Same address, nothing to do.) str
(") p n
( ) S
(else) K
(:) p n
( entry.address = self.address) N
( ) S
(print) K
( ") p
(Set in DNS: %s -> %s) str
(" % \(entry.name, entry.address\)) p n
() N
() N
( ) S
(def) K
( __str__\(self\):) p n
( ) S
(if) K
( ) p
(not) K
( self.prepared:) p n
( self.prepare\(\)) N
( ) S
(return) K
( ") p
(%s from %s:%d) str
(" % \(self.data, self.address, self.port\)) p n
() N
(class) K
( Handler\(threading.Thread\):) p n
( ) S
(def) K
( __init__\(self, queue\):) p n
( threading.Thread.__init__\(self\)) N
( self.q = queue) N
( self.setDaemon\(True\)) N
() N
( ) S
(def) K
( run\(self\):) p n
( ) S
(while) K
( True:) p n
( event = self.q.get\(\)) N
( ) S
(try) K
(:) p n
( event.prepare\(\)) N
( ) S
(print) K
( ") p
(Processing event %s) str
(" % str\(event\)) p n
( event.process\(\)) N
( ) S
(except) K
( IllegalEventException, e:) p n
( ) S
(print) K
( ") p
(Some failure: %s) str
(" % e.msg) p n
(yadyn) (Seite 1/2) (Nov 09, 07 13:31) title
border
/v 1 store
/x0 x v get 2.520000 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
() p n
(class) K
( Expirer\(threading.Thread\):) p n
( ) S
(def) K
( __init__\(self\):) p n
( threading.Thread.__init__\(self\)) N
( self.setDaemon\(True\)) N
() N
( ) S
(def) K
( run\(self\):) p n
( ) S
(while) K
( True:) p n
( ) S
(print) K
( ") p
(Expiring ...) str
(") p n
( currentTime = int\(time.time\(\)\)) N
( ) S
(for) K
( entry ) p
(in) K
( ENTRIES.values\(\):) p n
( ) S
(if) K
( entry.lastEventTime != 0 ) p
(and) K
( entry.lastEventTime + EVENT_LIFE_TIME < currentTime:) p n
( ) S
(print) K
( ") p
(Entry %s expired) str
(" % entry.dynid) p n
( entry.lastEventTime = 0) N
( entry.address = NULL_ADDRESS) N
( ) S
(print) K
( ") p
(Set in DNS: %s -> %s) str
(" % \(entry.name, entry.address\)) p n
( time.sleep\(10\)) N
( ) N
() N
(ENTRIES = {) N
( ') S
(testhost) str
(': Entry\(') p
(testhost,) str
(', ') p
(test123) str
(', ') p
(test.test.de) str
('\),) p n
( }) N
(MSG_TIME_CORRIDOR = 5) N
(EVENT_LIFE_TIME = 10) N
(NULL_ADDRESS = ') S
(0.0.0.0) str
(') p n
() N
(q = Queue.Queue\(\)) N
() N
(handler = Handler\(q\)) N
(handler.start\(\)) N
() N
(expirer = Expirer\(\)) N
(expirer.start\(\)) N
() N
(s = socket.socket\(socket.AF_INET, socket.SOCK_DGRAM\)) N
(s.bind\(\("", 9090\)\)) N
() N
(while) K
( True:) p n
( data, address = s.recvfrom\(256\)) N
( ) S
(try) K
(:) p n
( q.put_nowait\(Event\(address, data, int\(time.time\(\)\)\)\)) N
( ) S
(except) K
( Queue.Full:) p n
( ) S
(print) K
( ") p
(Event %s from %s dropped) str
(" % \(data, str\(address\)\)) p n
() N
(yadyn) (Seite 2/2) (Nov 09, 07 13:31) title
border
grestore
(Gedruckt von Wolfgang Hottgenroth) rhead
(yadyn) (1/1) (Samstag November 10, 2007) footer
end % of iso1dict
pagesave restore
showpage
%%Trailer
end
%%EOF

View File

@ -1,937 +0,0 @@
%!PS-Adobe-3.0
%%Title: yadyn
%%For: Wolfgang Hottgenroth
%%Creator: a2ps version 4.13
%%CreationDate: Sat Nov 10 10:07:58 2007
%%BoundingBox: 24 24 588 768
%%DocumentData: Clean7Bit
%%Orientation: Landscape
%%Pages: 2
%%PageOrder: Ascend
%%DocumentMedia: Letter 612 792 0 () ()
%%DocumentNeededResources: font Courier
%%+ font Courier-Bold
%%+ font Courier-BoldOblique
%%+ font Courier-Oblique
%%+ font Helvetica
%%+ font Helvetica-Bold
%%+ font Symbol
%%+ font Times-Bold
%%+ font Times-Roman
%%DocumentProcessColors: Black
%%DocumentSuppliedResources: procset a2ps-a2ps-hdr
%%+ procset a2ps-black+white-Prolog
%%+ encoding ISO-8859-1Encoding
%%EndComments
/a2psdict 200 dict def
a2psdict begin
%%BeginProlog
%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
% Check PostScript language level.
/languagelevel where {
pop /gs_languagelevel languagelevel def
} {
/gs_languagelevel 1 def
} ifelse
% EPSF import as in the Red Book
/BeginInclude {
/b4_Inc_state save def % Save state for cleanup
/dict_count countdictstack def % Count objects on dict stack
/op_count count 1 sub def % Count objects on operand stack
userdict begin
0 setgray 0 setlinecap
1 setlinewidth 0 setlinejoin
10 setmiterlimit [ ] 0 setdash newpath
gs_languagelevel 1 ne {
false setstrokeadjust false setoverprint
} if
} bind def
/EndInclude {
count op_count sub { pos } repeat % Clean up stacks
countdictstack dict_count sub { end } repeat
b4_Inc_state restore
} bind def
/BeginEPSF {
BeginInclude
/showpage { } def
} bind def
/EndEPSF {
EndInclude
} bind def
% Page prefeed
/page_prefeed { % bool -> -
statusdict /prefeed known {
statusdict exch /prefeed exch put
} {
pop
} ifelse
} bind def
/deffont {
findfont exch scalefont def
} bind def
/reencode_font {
findfont reencode 2 copy definefont pop def
} bind def
% Function c-show (str => -)
% centers text only according to x axis.
/c-show {
dup stringwidth pop
2 div neg 0 rmoveto
show
} bind def
% Function l-show (str => -)
% prints texts so that it ends at currentpoint
/l-show {
dup stringwidth pop neg
0
rmoveto show
} bind def
% center-fit show (str w => -)
% show centered, and scale currentfont so that the width is less than w
/cfshow {
exch dup stringwidth pop
% If the title is too big, try to make it smaller
3 2 roll 2 copy
gt
{ % if, i.e. too big
exch div
currentfont exch scalefont setfont
} { % ifelse
pop pop
}
ifelse
c-show % center title
} bind def
% Return the y size of the current font
% - => fontsize
/currentfontsize {
currentfont /FontMatrix get 3 get 1000 mul
} bind def
% reencode the font
% <encoding-vector> <fontdict> -> <newfontdict>
/reencode
{
dup length 5 add dict begin
{ % <vector> <key> <val>
1 index /FID ne
{ def }{ pop pop } ifelse
} forall
/Encoding exch def % -
% Use the font's bounding box to determine the ascent, descent,
% and overall height; don't forget that these values have to be
% transformed using the font's matrix. We use `load' because sometimes
% BBox is executable, sometimes not. Since we need 4 numbers an not
% an array avoid BBox from being executed
/FontBBox load aload pop
FontMatrix transform /Ascent exch def pop
FontMatrix transform /Descent exch def pop
/FontHeight Ascent Descent sub def
% Get the underline position and thickness if they're defined.
% Use 1 if they are not defined.
currentdict /FontInfo 2 copy known
{ get
/UnderlinePosition 2 copy % <FontInfo> /UP <FontInfo> /UP
2 copy known
{ get }{ pop pop 1} ifelse
0 exch FontMatrix transform exch pop
def % <FontInfo>
/UnderlineThickness 2 copy % <FontInfo> /UT <FontInfo> /UT
2 copy known
{ get }{ pop pop 1} ifelse
0 exch FontMatrix transform exch pop
def % <FontInfo>
pop % -
}{ pop pop
} ifelse
currentdict
end
} bind def
% Function print line number (<string> # -)
/# {
gsave
sx cw mul neg 2 div 0 rmoveto
f# setfont
c-show
grestore
} bind def
% -------- Some routines to enlight plain b/w printings ---------
% Underline
% width --
/dounderline {
currentpoint
gsave
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
0 rlineto
stroke
grestore
} bind def
% Underline a string
% string --
/dounderlinestring {
stringwidth pop
dounderline
} bind def
/UL {
/ul exch store
} bind def
% Draw a box of WIDTH wrt current font
% width --
/dobox {
currentpoint
gsave
newpath
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
dup 0 rlineto
0 currentfont /FontHeight get currentfontsize mul rlineto
neg 0 rlineto
closepath
stroke
grestore
} bind def
/BX {
/bx exch store
} bind def
% Box a string
% string --
/doboxstring {
stringwidth pop
dobox
} bind def
%
% ------------- Color routines ---------------
%
/FG /setrgbcolor load def
% Draw the background
% width --
/dobackground {
currentpoint
gsave
newpath
moveto
0 currentfont /Descent get currentfontsize mul rmoveto
dup 0 rlineto
0 currentfont /FontHeight get currentfontsize mul rlineto
neg 0 rlineto
closepath
bgcolor aload pop setrgbcolor
fill
grestore
} bind def
% Draw bg for a string
% string --
/dobackgroundstring {
stringwidth pop
dobackground
} bind def
/BG {
dup /bg exch store
{ mark 4 1 roll ] /bgcolor exch store } if
} bind def
/Show {
bg { dup dobackgroundstring } if
ul { dup dounderlinestring } if
bx { dup doboxstring } if
show
} bind def
% Function T(ab), jumps to the n-th tabulation in the current line
/T {
cw mul x0 add
bg { dup currentpoint pop sub dobackground } if
ul { dup currentpoint pop sub dounderline } if
bx { dup currentpoint pop sub dobox } if
y0 moveto
} bind def
% Function n: move to the next line
/n {
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
% Function N: show and move to the next line
/N {
Show
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
/S {
Show
} bind def
%%BeginResource: procset a2ps-a2ps-hdr 2.0 2
%%Copyright: (c) 1988, 89, 90, 91, 92, 93 Miguel Santana
%%Copyright: (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana
% Function title: prints page header.
% <ct> <rt> <lt> are passed as argument
/title {
% 1. Draw the background
x v get y v get moveto
gsave
0 th 2 div neg rmoveto
th setlinewidth
0.95 setgray
pw 0 rlineto stroke
grestore
% 2. Border it
gsave
0.7 setlinewidth
pw 0 rlineto
0 th neg rlineto
pw neg 0 rlineto
closepath stroke
grestore
% stk: ct rt lt
x v get y v get th sub 1 add moveto
%%IncludeResource: font Helvetica
fHelvetica fnfs 0.8 mul scalefont setfont
% 3. The left title
gsave
dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
fnfs 0.8 mul hm rmoveto
show % left title
grestore
exch
% stk: ct ltw rt
% 4. the right title
gsave
dup stringwidth pop fnfs 0.8 mul add exch % leave space took on stack
dup
pw exch stringwidth pop fnfs 0.8 mul add sub
hm
rmoveto
show % right title
grestore
% stk: ct ltw rtw
% 5. the center title
gsave
pw 3 1 roll
% stk: ct pw ltw rtw
3 copy
% Move to the center of the left room
sub add 2 div hm rmoveto
% What is the available space in here?
add sub fnfs 0.8 mul sub fnfs 0.8 mul sub
% stk: ct space_left
%%IncludeResource: font Helvetica-Bold
fHelvetica-Bold fnfs scalefont setfont
cfshow
grestore
} bind def
% Function border: prints virtual page border
/border { %def
gsave % print four sides
0 setgray
x v get y v get moveto
0.7 setlinewidth % of the square
pw 0 rlineto
0 ph neg rlineto
pw neg 0 rlineto
closepath stroke
grestore
} bind def
% Function water: prints a water mark in background
/water { %def
gsave
scx scy moveto rotate
%%IncludeResource: font Times-Bold
fTimes-Bold 100 scalefont setfont
.97 setgray
dup stringwidth pop 2 div neg -50 rmoveto
show
grestore
} bind def
% Function rhead: prints the right header
/rhead { %def
lx ly moveto
fHelvetica fnfs 0.8 mul scalefont setfont
l-show
} bind def
% Function footer (cf rf lf -> -)
/footer {
fHelvetica fnfs 0.8 mul scalefont setfont
dx dy moveto
show
snx sny moveto
l-show
fnx fny moveto
c-show
} bind def
%%EndResource
%%BeginResource: procset a2ps-black+white-Prolog 2.0 1
% Function T(ab), jumps to the n-th tabulation in the current line
/T {
cw mul x0 add y0 moveto
} bind def
% Function n: move to the next line
/n { %def
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
% Function N: show and move to the next line
/N {
Show
/y0 y0 bfs sub store
x0 y0 moveto
} bind def
/S {
Show
} bind def
/p {
false UL
false BX
fCourier bfs scalefont setfont
Show
} bind def
/sy {
false UL
false BX
fSymbol bfs scalefont setfont
Show
} bind def
/k {
false UL
false BX
fCourier-Oblique bfs scalefont setfont
Show
} bind def
/K {
false UL
false BX
fCourier-Bold bfs scalefont setfont
Show
} bind def
/c {
false UL
false BX
fCourier-Oblique bfs scalefont setfont
Show
} bind def
/C {
false UL
false BX
fCourier-BoldOblique bfs scalefont setfont
Show
} bind def
/l {
false UL
false BX
fHelvetica bfs scalefont setfont
Show
} bind def
/L {
false UL
false BX
fHelvetica-Bold bfs scalefont setfont
Show
} bind def
/str{
false UL
false BX
fTimes-Roman bfs scalefont setfont
Show
} bind def
/e{
false UL
true BX
fHelvetica-Bold bfs scalefont setfont
Show
} bind def
%%EndResource
%%EndProlog
%%BeginSetup
%%IncludeResource: font Courier
%%IncludeResource: font Courier-Oblique
%%IncludeResource: font Courier-Bold
%%IncludeResource: font Times-Roman
%%IncludeResource: font Symbol
%%IncludeResource: font Courier-BoldOblique
%%BeginResource: encoding ISO-8859-1Encoding
/ISO-8859-1Encoding [
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclam /quotedbl /numbersign /dollar /percent /ampersand /quoteright
/parenleft /parenright /asterisk /plus /comma /minus /period /slash
/zero /one /two /three /four /five /six /seven
/eight /nine /colon /semicolon /less /equal /greater /question
/at /A /B /C /D /E /F /G
/H /I /J /K /L /M /N /O
/P /Q /R /S /T /U /V /W
/X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
/quoteleft /a /b /c /d /e /f /g
/h /i /j /k /l /m /n /o
/p /q /r /s /t /u /v /w
/x /y /z /braceleft /bar /braceright /asciitilde /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
/space /exclamdown /cent /sterling /currency /yen /brokenbar /section
/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen /registered /macron
/degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph /bullet
/cedilla /onesuperior /ordmasculine /guillemotright /onequarter /onehalf /threequarters /questiondown
/Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
/Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis
/Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply
/Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls
/agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla
/egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis
/eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide
/oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis
] def
%%EndResource
% Initialize page description variables.
/sh 612 def
/sw 792 def
/llx 24 def
/urx 768 def
/ury 588 def
/lly 24 def
/#copies 1 def
/th 15.000000 def
/fnfs 11 def
/bfs 8.000000 def
/cw 4.800000 def
% Dictionary for ISO-8859-1 support
/iso1dict 8 dict begin
/fCourier ISO-8859-1Encoding /Courier reencode_font
/fCourier-Bold ISO-8859-1Encoding /Courier-Bold reencode_font
/fCourier-BoldOblique ISO-8859-1Encoding /Courier-BoldOblique reencode_font
/fCourier-Oblique ISO-8859-1Encoding /Courier-Oblique reencode_font
/fHelvetica ISO-8859-1Encoding /Helvetica reencode_font
/fHelvetica-Bold ISO-8859-1Encoding /Helvetica-Bold reencode_font
/fTimes-Bold ISO-8859-1Encoding /Times-Bold reencode_font
/fTimes-Roman ISO-8859-1Encoding /Times-Roman reencode_font
currentdict end def
/bgcolor [ 0 0 0 ] def
/bg false def
/ul false def
/bx false def
% The font for line numbering
/f# /Helvetica findfont bfs .6 mul scalefont def
/fSymbol /Symbol findfont def
/hm fnfs 0.25 mul def
/pw
cw 75.400000 mul
def
/ph
517.600000 th add
def
/pmw urx llx sub pw 2 mul sub 1 div def
/pmh 0 def
/v 0 def
/x [
0
dup pmw add pw add
] def
/y [
pmh ph add 0 mul ph add
dup
] def
/scx sw 2 div def
/scy sh 2 div def
/snx urx def
/sny lly 2 add def
/dx llx def
/dy sny def
/fnx scx def
/fny dy def
/lx snx def
/ly ury fnfs 0.8 mul sub def
/sx 0 def
/tab 8 def
/x0 0 def
/y0 0 def
%%EndSetup
%%Page: (1-2) 1
%%BeginPageSetup
/pagesave save def
sh 0 translate 90 rotate
%%EndPageSetup
iso1dict begin
gsave
llx lly 12 add translate
/v 0 store
/x0 x v get 3.360000 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
(#!/usr/bin/python) c n
() p n
(import) K
( socket) p n
(import) K
( Queue) p n
(import) K
( threading) p n
(import) K
( md5) p n
(import) K
( time) p n
() N
(class) K
( Entry\(object\):) p n
( ) S
(def) K
( __init__\(self, dynid, sharedSecret, name\):) p n
( self.dynid = dynid) N
( self.sharedSecret = sharedSecret) N
( self.name = name) N
( self.lastEventTime = 0) N
( self.address = '') N
() N
(class) K
( IllegalEventException\(Exception\):) p n
( ) S
(def) K
( __init__\(self, msg\):) p n
( self.msg = msg) N
() N
() N
(class) K
( Event\(object\):) p n
( ) S
(def) K
( __init__\(self, address, data, receiveTime\):) p n
( self.address = address) N
( self.data = data) N
( self.receiveTime = receiveTime) N
() N
( ) S
(def) K
( prepare\(self\):) p n
( self.port = self.address[1]) N
( self.address = self.address[0]) N
( \(self.dynid, self.msgTime, self.checksum\) = self.data.split\(') S
( ) str
('\)) p n
( self.msgTime = int\(self.msgTime\)) N
( self.prepared = True) N
() N
( ) S
(def) K
( process\(self\):) p n
( ) S
(if) K
( ) p
(not) K
( self.prepared:) p n
( self.prepare\(\)) N
() N
( ) S
(if) K
( ) p
(not) K
( ENTRIES.has_key\(self.dynid\):) p n
( ) S
(raise) K
( IllegalEventException\(") p
(unknown dynid in event %s) str
(" % str\(self\)\)) p n
( entry = ENTRIES[self.dynid]) N
() N
( ) S
(if) K
( self.msgTime + MSG_TIME_CORRIDOR < self.receiveTime:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(event too old %s) str
(" % str\(self\)\)) p n
( ) S
(if) K
( self.msgTime - MSG_TIME_CORRIDOR > self.receiveTime:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(event too young %s) str
(" % str\(self\)\)) p n
() N
() N
( ) S
(if) K
( entry.lastEventTime >= self.msgTime:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(timing sequence failure in event, possibly replay ) str n
(%s) S
(" % str\(self\)\)) p n
() N
( di = ") S
(%s %s %d) str
(" % \(self.dynid, entry.sharedSecret, self.msgTime\)) p n
( d = md5.new\(di\).hexdigest\(\)) N
( ) S
(print) K
( ") p
(%s, received: %s, calculated: %s) str
(" % \(di, self.checksum, d\)) p n
( ) S
(if) K
( d != self.checksum:) p n
( ) S
(raise) K
( IllegalEventException\(") p
(wrong checksum for event %s) str
(" % str\(self) p n
(\)\)) N
() N
( entry.lastEventTime = self.msgTime) N
() N
( ) S
(if) K
( entry.address == self.address:) p n
( ) S
(print) K
( ") p
(Same address, nothing to do.) str
(") p n
( ) S
(else) K
(:) p n
(yadyn) (Seite 1/3) (Nov 09, 07 13:31) title
border
/v 1 store
/x0 x v get 3.360000 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
( entry.address = self.address) p n
( ) S
(print) K
( ") p
(Set in DNS: %s -> %s) str
(" % \(entry.name, entry.address\)) p n
() N
() N
( ) S
(def) K
( __str__\(self\):) p n
( ) S
(if) K
( ) p
(not) K
( self.prepared:) p n
( self.prepare\(\)) N
( ) S
(return) K
( ") p
(%s from %s:%d) str
(" % \(self.data, self.address, self.port\)) p n
() N
(class) K
( Handler\(threading.Thread\):) p n
( ) S
(def) K
( __init__\(self, queue\):) p n
( threading.Thread.__init__\(self\)) N
( self.q = queue) N
( self.setDaemon\(True\)) N
() N
( ) S
(def) K
( run\(self\):) p n
( ) S
(while) K
( True:) p n
( event = self.q.get\(\)) N
( ) S
(try) K
(:) p n
( event.prepare\(\)) N
( ) S
(print) K
( ") p
(Processing event %s) str
(" % str\(event\)) p n
( event.process\(\)) N
( ) S
(except) K
( IllegalEventException, e:) p n
( ) S
(print) K
( ") p
(Some failure: %s) str
(" % e.msg) p n
() N
(class) K
( Expirer\(threading.Thread\):) p n
( ) S
(def) K
( __init__\(self\):) p n
( threading.Thread.__init__\(self\)) N
( self.setDaemon\(True\)) N
() N
( ) S
(def) K
( run\(self\):) p n
( ) S
(while) K
( True:) p n
( ) S
(print) K
( ") p
(Expiring ...) str
(") p n
( currentTime = int\(time.time\(\)\)) N
( ) S
(for) K
( entry ) p
(in) K
( ENTRIES.values\(\):) p n
( ) S
(if) K
( entry.lastEventTime != 0 ) p
(and) K
( entry.lastEventTime + EVEN) p n
(T_LIFE_TIME < currentTime:) N
( ) S
(print) K
( ") p
(Entry %s expired) str
(" % entry.dynid) p n
( entry.lastEventTime = 0) N
( entry.address = NULL_ADDRESS) N
( ) S
(print) K
( ") p
(Set in DNS: %s -> %s) str
(" % \(entry.name, entry.address\)) p n
( time.sleep\(10\)) N
( ) N
() N
(ENTRIES = {) N
( ') S
(testhost) str
(': Entry\(') p
(testhost,) str
(', ') p
(test123) str
(', ') p
(test.test.de) str
('\),) p n
( }) N
(MSG_TIME_CORRIDOR = 5) N
(EVENT_LIFE_TIME = 10) N
(NULL_ADDRESS = ') S
(0.0.0.0) str
(') p n
() N
(q = Queue.Queue\(\)) N
() N
(handler = Handler\(q\)) N
(handler.start\(\)) N
() N
(expirer = Expirer\(\)) N
(expirer.start\(\)) N
() N
(s = socket.socket\(socket.AF_INET, socket.SOCK_DGRAM\)) N
(s.bind\(\("", 9090\)\)) N
() N
(while) K
( True:) p n
( data, address = s.recvfrom\(256\)) N
(yadyn) (Seite 2/3) (Nov 09, 07 13:31) title
border
grestore
(Gedruckt von Wolfgang Hottgenroth) rhead
(yadyn) (1/2) (Samstag November 10, 2007) footer
end % of iso1dict
pagesave restore
showpage
%%Page: (3) 2
%%BeginPageSetup
/pagesave save def
sh 0 translate 90 rotate
%%EndPageSetup
iso1dict begin
gsave
llx lly 12 add translate
/v 0 store
/x0 x v get 3.360000 add sx cw mul add store
/y0 y v get bfs th add sub store
x0 y0 moveto
( ) p
(try) K
(:) p n
( q.put_nowait\(Event\(address, data, int\(time.time\(\)\)\)\)) N
( ) S
(except) K
( Queue.Full:) p n
( ) S
(print) K
( ") p
(Event %s from %s dropped) str
(" % \(data, str\(address\)\)) p n
() N
(yadyn) (Seite 3/3) (Nov 09, 07 13:31) title
border
grestore
(Gedruckt von Wolfgang Hottgenroth) rhead
(yadyn) (2/2) (Samstag November 10, 2007) footer
end % of iso1dict
pagesave restore
showpage
%%Trailer
end
%%EOF