--- l2_ch_socket.c 2001/09/13 19:18:34 1.28
+++ l2_ch_socket.c 2001/09/26 08:55:19 1.29
@@ -45,31 +45,31 @@
/******************************************************************
IPv4 source used from Unix Network Programming by Richard STEVENS
******************************************************************/
-static int l2_inet_pton(int iFamily, const char *pszAddress, void *pvMemref)
+static int l2_inet_pton(int iFamily, const char *szAddress, void *pvMemref)
{
- int i = 0;
+ int i = 0;
struct in_addr IP4Addr;
struct in6_addr IP6Addr;
- const char *pszIndex = NULL; /* To index IPv6 validity */
- char *pszNextfield = ""; /* For IPv6 address trans */
+ const char *szIndex = NULL; /* To index IPv6 validity */
+ char *szNextfield = ""; /* For IPv6 address trans */
assert(pvMemref != NULL);
if (iFamily == AF_INET) {
- if (inet_aton(pszAddress, &IP4Addr)) {
+ if (inet_aton(szAddress, &IP4Addr)) {
memcpy(pvMemref, &IP4Addr, sizeof(struct in_addr));
return 1; /* Success */
}
return 0;
}
else if (iFamily == AF_INET6) { /* Translate IPv6 addresses */
- pszIndex = pszAddress; /* Initialize, verify in loop */
- for (i = 0; (i < 8) && pszNextfield; i++) { /* Iterate through fields */
+ szIndex = szAddress; /* Initialize, verify in loop */
+ for (i = 0; (i < 8) && szNextfield; i++) { /* Iterate through fields */
IP6Addr.__u6_addr.__u6_addr16[i] =\
- ntohs((u_int16_t)strtol(pszIndex, &pszNextfield, 16));
- pszIndex = pszNextfield + 1;
+ ntohs((u_int16_t)strtol(szIndex, &szNextfield, 16));
+ szIndex = szNextfield + 1;
}
- if ((i != 8) || (*pszNextfield))
+ if ((i != 8) || (*szNextfield))
return 0;
else { /* Success */
memcpy(pvMemref, &IP6Addr, sizeof(struct in6_addr));
@@ -87,7 +87,7 @@
/* declare private channel configuration */
typedef struct {
- char *pszHost; /* IP Address or name of host to connect to */
+ char *szHost; /* IP Address or name of host to connect to */
int iFamily; /* IP version to use, AF_INET4 or AF_INET6 */
int iProto; /* Protocol to use, IPPROTO_TCP or IPPROTO_UDP */
int iPort; /* TCP Port to connect to */
@@ -104,7 +104,7 @@
return L2_ERR_MEM;
/* initialize configuration with reasonable defaults */
- cfg->pszHost = NULL;
+ cfg->szHost = NULL;
cfg->iFamily = -1;
cfg->iProto = -1;
cfg->iPort = 0;
@@ -126,7 +126,7 @@
/* feed and call generic parameter parsing engine */
L2_PARAM_SET(pa[0], ipversion, INT, &cfg->iFamily);
L2_PARAM_SET(pa[1], protocol, INT, &cfg->iProto );
- L2_PARAM_SET(pa[2], host, CHARPTR, &cfg->pszHost);
+ L2_PARAM_SET(pa[2], host, CHARPTR, &cfg->szHost);
L2_PARAM_SET(pa[3], port, INT, &cfg->iPort );
L2_PARAM_END(pa[4]);
rv = l2_util_setparams(pa, fmt, ap);
@@ -143,7 +143,7 @@
struct sockaddr_in6 IP6Localsock, IP6Sockaddr;
/* make sure a target is configured */
- if (cfg->pszHost == NULL)
+ if (cfg->szHost == NULL)
return L2_ERR_USE;
/* open channel socket */
@@ -153,12 +153,12 @@
memset(&IP4Sockaddr, 0, sizeof(IP4Sockaddr));
/* resolve host numerically */
- if (l2_inet_pton(AF_INET, cfg->pszHost, &IP4Sockaddr.sin_addr.s_addr) == 1) {
+ if (l2_inet_pton(AF_INET, cfg->szHost, &IP4Sockaddr.sin_addr.s_addr) == 1) {
IP4Sockaddr.sin_family = AF_INET;
IP4Sockaddr.sin_port = htons(cfg->iPort);
}
/* resolve host nominally */
- else if ((pHostentry = gethostbyname(cfg->pszHost)) != NULL) {
+ else if ((pHostentry = gethostbyname(cfg->szHost)) != NULL) {
if (pHostentry->h_addrtype == AF_INET) {
IP4Sockaddr.sin_family = AF_INET;
IP4Sockaddr.sin_port = htons(cfg->iPort);
@@ -214,12 +214,12 @@
memset(&IP6Sockaddr, 0, sizeof(IP6Sockaddr));
/* resolve host numerically */
- if (l2_inet_pton(AF_INET6, cfg->pszHost, &IP6Sockaddr.sin6_addr.s6_addr) == 1) {
+ if (l2_inet_pton(AF_INET6, cfg->szHost, &IP6Sockaddr.sin6_addr.s6_addr) == 1) {
IP6Sockaddr.sin6_family = AF_INET6;
IP6Sockaddr.sin6_port = htons(cfg->iPort);
}
/* resolve host nominally */
- else if ((pHostentry = gethostbyname(cfg->pszHost)) != NULL) {
+ else if ((pHostentry = gethostbyname(cfg->szHost)) != NULL) {
if (pHostentry->h_addrtype == AF_INET6) {
IP6Sockaddr.sin6_family = AF_INET6;
IP6Sockaddr.sin6_port = htons(cfg->iPort);
|