Skip to content

Instantly share code, notes, and snippets.

@l1x
Created February 20, 2011 23:41
Show Gist options
  • Select an option

  • Save l1x/836426 to your computer and use it in GitHub Desktop.

Select an option

Save l1x/836426 to your computer and use it in GitHub Desktop.
inet in erlang
-type hostname() :: atom() | string().
-type ip4_address() :: {0..255,0..255,0..255,0..255}.
-type ip6_address() :: {0..65535,0..65535,0..65535,0..65535,
0..65535,0..65535,0..65535,0..65535}.
-type ip_address() :: ip4_address() | ip6_address().
-type ip_port() :: 0..65535.
-record(hostent,
{
h_name :: hostname(), %% offical name of host
h_aliases = [] :: [hostname()], %% alias list
h_addrtype :: 'inet' | 'inet6', %% host address type
h_length :: non_neg_integer(), %% length of address
h_addr_list = [] :: [ip_address()] %% list of addresses from name server
}).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment