Property definitions

socket $ NativeSocketAddrIn :: defaultinit
# Socket address in the Internet namespace, pointer to a `struct sockaddr_in`
extern class NativeSocketAddrIn `{ struct sockaddr_in* `}

	# `NULL` pointer
	new nul `{ return NULL; `}

	# `malloc` a new instance
	new `{
		struct sockaddr_in *sai = NULL;
		sai = malloc(sizeof(struct sockaddr_in));
		return sai;
	`}

	# Set `address` and `family` from `hostent` (to use with `Sys::gethostbyname`)
	fun fill_from_hostent(hostent: NativeSocketHostent) `{
		self->sin_family = hostent->h_addrtype;
		memcpy((char*)&self->sin_addr.s_addr,
		       (char*)hostent->h_addr,
			   hostent->h_length);
	`}

	# Internet address as then IPV4 numbers-and-dots notation
	fun address: CString `{ return (char*)inet_ntoa(self->sin_addr); `}

	# Set `address` to `INADDR_ANY`
	fun address_any `{ self->sin_addr.s_addr = INADDR_ANY; `}

	# Set `address` to `INADDR_BROADCAST`
	fun address_broadcast `{ self->sin_addr.s_addr = INADDR_BROADCAST; `}

	# Address family
	fun family: NativeSocketAddressFamilies `{ return self->sin_family; `}

	# Address family
	fun family=(value: NativeSocketAddressFamilies) `{ self->sin_family = value; `}

	# Port
	fun port: Int `{ return ntohs(self->sin_port); `}

	# Port
	fun port=(value: Int) `{ self->sin_port = htons(value); `}
end
lib/socket/socket_c.nit:273,1--314,3