package gapi-ocaml

  1. Overview
  2. Docs
A simple OCaml client for Google Services

Install

Dune Dependency

Authors

Maintainers

Sources

v0.4.6.tar.gz
sha256=b84b680528a5e050014103a8e7a60a5d43efd5fefc3f838310bd46769775ab48
md5=8ee26acf1f6c6f5e24c7b57fa070a0a2

doc/gapi-ocaml.netstring-local/Netsockaddr/index.html

Module NetsockaddrSource

Parsing of socket addresses

Sourcetype socksymbol = [
  1. | `Inet of Unix.inet_addr * int
  2. | `Inet_byname of string * int
  3. | `Unix of string
]

Symbolic socket names:

  • `Inet(ip,port): An internet socket with IP ip and the given port
  • `Inet_byname(n,port): An internet socket with the IP resulting from the resolution of the name n, and with the given port
  • `Unix p: A Unix Domain socket with the path p

Use Uq_resolver.sockaddr_of_socksymbol to convert to a Unix.sockaddr (and resolve names).

Sourceval socksymbol_of_string : string -> socksymbol

Parses designations of the forms:

  • <IPv4>:port
  • [<IPv4_or_IPv6]:port
  • <name>:port
  • /path
  • ./path

Raises Failure on parse error.

Sourceval string_of_socksymbol : socksymbol -> string

The reverse function

Sourceval norm_socksymbol : socksymbol -> socksymbol

Normalizes numeric IP addresses: if the address is an IPv4 address mapped to the IPv6 address space, the real IPv4 address is returned. This also works for numeric addresses in string form, whose writing is also normalized.

E.g.

  • norm_socksymbol (`Inet_by_name("::ffff:127.0.0.1", 80)) returns `Inet_by_name("127.0.0.1",80)
  • norm_socksymbol (`Inet_by_name("0::1",80)) returns `Inet_by_name("::1", 80)
Sourceval ipv6_socksymbol : socksymbol -> socksymbol

IPv6-ification of numeric IP addresses: IPv4 addresses are mapped to the IPv6 address space. This also works for numeric addresses in string form, whose writing is also normalized.

E.g.

  • norm_socksymbol (`Inet_by_name("127.0.0.1", 80)) returns `Inet_by_name("::ffff:127.0.0.1",80)
  • norm_socksymbol (`Inet_by_name("0::1",80)) returns `Inet_by_name("::1", 80)
OCaml

Innovation. Community. Security.