Posts

Showing posts from January, 2010

Clipboard sniffer

Yes clipboard, not keyboard. I've made a clipboard sniffer for X called ClipSniff. It periodically saves whatever is in the clipboard (both the "PRIMARY" and the "CLIPBOARD") into a sqlite database. git clone http://github.com/ThomasHabets/clipsniff.git It wasn't that hard when you knew where to look. You just: Connect to the X server. XOpenDisplay() Create a window (you don't need to display it). XCreateSimpleWindow() Ask the X server who owns the PRIMARY and CLIPBOARD atoms, and ask that window to send you the data. XInternAtom() , XConvertSelection() Wait for the reply event. Loop of NextEvent() Helpful links when coding Xlib Minimal XGetWindowProperty Example Xlib Programming Manual (O'Reilly & Associates, Inc.) X Selections, Cut Buffers, and Kill Rings (jwz) X Windows Copy-Paste mini HOWTO (Stelios Xathakis)

Shaping and policing on Cisco

Image
This post is about policing and shaping on Cisco routers and switches. This is a very big topic so don't expect this post to cover everything. What I'm attempting to to is cover some things that I found aren't explained very well by books or the Internets, while still being readable for someone who hasn't read all the other stuff. With QoS stuff there are always small differences in practice between the hardware implementations but I won't go into that here. Buckets In both policers and shapers traffic that "conforms" is traffic that will be allowed through. It will be allowed to go out to the interface (or in to it, if configured for incoming traffic) if there are as many tokens in the Bc bucket as there are bytes in the packet. If there are enough tokens then those tokens are removed from the bucket and the packet is allowed through immediately. If there aren't enough tokens in the bucket then the packet is n...