transport: consolidated IP{v4,v6}/unix transports to {stream,dgram}-transpor
authorKrisztian Litkey <krisztian.litkey@intel.com>
Tue, 8 May 2012 13:01:33 +0000 (16:01 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Tue, 8 May 2012 13:40:41 +0000 (16:40 +0300)
commit98b62e156c1f362e08d9d88eaa0a7983e5d12588
tree1257d1eaa6b962ff76ca97fce172fc41eafaab6c
parent166731516eae194333b42795a330f291a110e0e4
transport: consolidated IP{v4,v6}/unix transports to {stream,dgram}-transpor

The recognized address prefixes are now tcp4, tcp6, udp4, udp6, unxstrm,
and unxdgrm. If you omit the type-specifier prefix, the address resolver
code will try to figure out the type based on the address itself ('[',
']', '@', '/'). However, a prefix specifies both the address family and
the connection-oriented vs. connectionlessness of the transport. The
resolver cannot guess which one you want if you omit the prefix and you
will always end up with connection-oriented transports in this case (as
these are registered before the datagram ones).

If you are careless and try to use prefixless string addresses for datagram
transports, you will get quite difficult to understand errors (as you end
up polling an unconnected, unlistened socket for readability).

One way to get around this would be to change the API so that
  - only the address family is passed to the address resolver
  - the socket type (dgram/stream) is passed to the transport creation

Although, this would be a more natural abstraction... maybe another day.
14 files changed:
src/Makefile.am
src/common/dgram-transport.c [new file with mode: 0644]
src/common/stream-transport.c [new file with mode: 0644]
src/common/tcp-transport.c
src/common/tests/Makefile.am
src/common/tests/dgram-test.c [new file with mode: 0644]
src/common/tests/stream-test.c [new file with mode: 0644]
src/common/tests/tcp-test.c
src/common/tests/udp-test.c
src/common/transport.c
src/common/transport.h
src/common/udp-transport.c
src/console-client/client.c
src/plugins/plugin-console.c