This code will add BLE Security Manager Protocol(SMP) support.
This will enable userland to create SMP connection and wait connection for underlying HCI connection to be encrypted.
To create SMP connection, set sockaddr_l2cap::l2cap_cid member as NG_L2CAP_SMP_CID.
To wait until HCI connection encrypted, do following:
enc = 1;
setsockopt( s, SOL_L2CAP, SO_L2CAP_ENCRYPTED, &enc, sizeof(enc));
Some example is in http://www.init-main.com/blesmpexample.tar.gz