Own traffic shaping policy



I cannot find informations how to write my own traffic shaping policy - like example htb,sfq.
Does anyone know where i can find such an inforamtion ????
Simple example maybe ???

Thanks
.