[Telepathy] [Bug 19898] New: [gibber] GibberAddress union

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Feb 2 03:42:24 PST 2009


http://bugs.freedesktop.org/show_bug.cgi?id=19898

           Summary: [gibber] GibberAddress union
           Product: Telepathy
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: medium
         Component: telepathy-salut
        AssignedTo: telepathy at lists.freedesktop.org
        ReportedBy: simon.mcvittie at collabora.co.uk


When you use sockaddr_foo for addresses, there are usually lots of type casts
obscuring the code, and it's easy to forget that a struct sockaddr isn't big
enough for a Unix socket path (you need a struct sockaddr_storage for that).

Consider adding a GibberAddress struct or union which contains one of each
sockaddr struct, including sockaddr_storage:

typedef union {
    struct sockaddr generic;
    struct sockaddr_storage storage;
    struct sockaddr_inet ipv4;
    struct sockaddr_inet6 ipv6;
    struct sockaddr_unix un;
} GibberSockAddr;

Gabble has a union similar to this one internally, although the necessity to
#ifdef various bits of the union for different OSs (no Unix sockets on Windows)
may mean we can't have the union appear directly in an ABI-stable header file.

libnice has a NiceAddress type which could be worth investigating for this,
although that one is unlikely to support Unix sockets. I believe Avahi has a
similar thing too.


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Telepathy mailing list