adding c implementation of handshake detection and matching