Some links you might find useful:
irda specs
openobex
ultra/esquirt

The rest is left to the reader as an exercise.