From Fedora Project Wiki
< Networking | Ideas
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Some ideas for name resolution in linux distributions == | == Some ideas for name resolution in linux distributions == | ||
=== Resolve a | === Resolve a service name to a port number === | ||
==== Use cases ==== | ==== Use cases ==== | ||
* | * any software that works with TCP or UDP port numbers | ||
==== Input parameters ==== | ==== Input parameters ==== | ||
* service | * service | ||
* protocol (socktype?) | * protocol (socktype?) | ||
Output parameter | ==== Output parameter ==== | ||
* port | * port | ||
* protocol | * protocol | ||
Current | ==== Current interface ==== | ||
<pre> | <pre> | ||
Line 86: | Line 67: | ||
* *gethostinfo (name, family=0, flags=0) → list of sockaddr, canonical name | * *gethostinfo (name, family=0, flags=0) → list of sockaddr, canonical name | ||
* *getservinfo (name, protocol=0, ?socktype=0) → port, protocol, ?socktype | * *getservinfo (name, protocol=0, ?socktype=0) → port, protocol, ?socktype | ||
* * | * *getsockinfo (host, service, family, socktype, protocol, flags) → list of sockaddr, ?socktype, ?protocol, canonical name |
Latest revision as of 08:17, 29 July 2014
🔗 Some ideas for name resolution in linux distributions
🔗 Resolve a service name to a port number
🔗 Use cases
- any software that works with TCP or UDP port numbers
🔗 Input parameters
- service
- protocol (socktype?)
🔗 Output parameter
- port
- protocol
🔗 Current interface
struct servent *getservbyname(const char *name, const char *proto); struct servent { char *s_name; /* official service name */ char **s_aliases; /* alias list */ int s_port; /* port number */ char *s_proto; /* protocol to use */ }
🔗 Resolve an address for connect() or sendto()
Input parameters (network layer):
- host (IP address or some sort of host name)
- family (to implement -4 and -6 switches)
Input parameters (transport layer):
- socktype
- protocol
- service (TCP/UDP port number or service name)
- whether to use SRV records
Output parameters:
- List of sockaddr pointers
- Canonical name (why?)
- socktype
- protocol
🔗 Resolve an address for IP ACLs
Input parameters:
- host
- family
Output parameters:
- List of sockaddr pointers (zero ports, zero protocols, etc)
- Canonical name (why?)
🔗 How name resolution API should work
- *gethostinfo (name, family=0, flags=0) → list of sockaddr, canonical name
- *getservinfo (name, protocol=0, ?socktype=0) → port, protocol, ?socktype
- *getsockinfo (host, service, family, socktype, protocol, flags) → list of sockaddr, ?socktype, ?protocol, canonical name