on start
{
dword socket;
long association;
dword addressCount;
ip_Address adapterAddress[1];
ip_Endpoint localEndpoint;
// add a policy
IpSecPolicyDatabaseAdd(ip_Endpoint(0.0.0.0:0), 0, ip_Endpoint(192.168.1.10:0), 24, "any", "out ipsec ah/transport//require");
// create a security association in the database from the current node to the node 192.168.1.10
ipGetAdapterAddress(1, adapterAddress, addressCount);
localEndpoint.Address = adapterAddress[0];
association = ipsecAssociationDatabaseGetSpi(localEndpoint, ip_Endpoint(192.168.1.10), "ah", "any");
// set the ah algorithm and key
ipsecAssociationSetParameter(association, "ahalgorithm", "sha");
ipsecAssociationSetParameter(association, "ahkey", "0123456789ABCDEF");
// update the security association in the database
ipsecAssociationDatabaseUpdate(association);
// release the association object when it isn't needed anymore
ipsecAssociationRelease(association);
// send data which matches the policy
socket = udpOpen(ip_Endpoint(0.0.0.0:0));
udpSendTo(socket, ip_Endpoint(192.168.1.10:23), "hello world", 11);
}