[
https://issues.apache.org/jira/browse/TS-679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006626#comment-13006626
]
Leif Hedstrom edited comment on TS-679 at 3/14/11 8:52 PM:
-----------------------------------------------------------
This turns out to be a beast if we want to do it "right". Meaning, if we expose
internal struct sockaddr_storage storage through the APIs. The APIs would look
something like
{code}
Currently:
tsapi unsigned int TSHttpTxnClientIPGet(TSHttpTxn txnp);
becomes:
tsapi struct sockaddr_storage* TSHttpTxnClientAddrGet(TSHttpTxn txnp,
socklen_t* addrlen);
{code}
The alternative is to pass in a sockaddr pointer to the APIs, but this is worse
for performance IMO, since it means we have to memcpy() the addr, instead of
simply returning a pointer to the internal representation. This is where the
problem comes in, we'll have to change all internal "IP and port" storage,
which currently are e.g.
{code}
unsigned int ip;
int port;
{code}
to just be
{code}
struct sockaddr_storage addr;
{code}
IMO, this is the correct solution, since it makes the core truly IPv6
compatible, but it's a lot more work than simply converting the internal IPv4
representation to sockaddr's...
was (Author: zwoop):
This turns out to be a beast if we want to do it "right". Meaning, if we
expose internal struct sockaddr_storage storage through the APIs. The APIs
would look something like
{code}
Currently:
tsapi unsigned int TSHttpTxnClientIPGet(TSHttpTxn txnp);
becomes:
tsapi struct sockaddr_storage* TSHttpTxnClientAddrGet(TSHttpTxn txnp,
socklen_t* addrlen);
{code}
The alternative is to pass in a sockaddr pointer to the APIs, but this is worse
for performance IMO, since it means we have to memcpy() the addr, instead of
simply returning a pointer to the internal representation. This is where the
problem comes in, we'll have to change all internal "IP and port" storage,
which currently are e.g.
{code}
unsigned int ip
int port;
{code}
to just be
{code}
struct sockaddr_storage addr;
{code}
IMO, this is the correct solution, since it makes the core truly IPv6
compatible, but it's a lot more work than simply converting the internal IPv4
representation to sockaddr's...
> Make SDK APIs use struct sockaddr_storage instead of "unsigned int" for IPs
> ---------------------------------------------------------------------------
>
> Key: TS-679
> URL: https://issues.apache.org/jira/browse/TS-679
> Project: Traffic Server
> Issue Type: Improvement
> Components: TS API
> Reporter: Leif Hedstrom
> Assignee: Leif Hedstrom
> Fix For: 2.1.8
>
>
> We should at a minimum make the necessary SDK changes to make the IP related
> APIs IPv6 "compatible". Meaning, when we properly support IPv6, the APIs
> should not have to change (again).
> For some useful tips, see http://www.akkadia.org/drepper/userapi-ipv6.html
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira