Harry, this already exists in C++ class form and also in a single C header file. nonlib/NSM/Client.{CH} and nonlib/nsm.h, respectively.
Brilliant, thanks for the pointer. I've not played with implementing NSM yet, but its steadily working up the TODO list.. And your note is now attached :) -Harry