Add socket alloc and free function to proto struct.