struct GNUNET_CRYPTO_EcdsaSignature *sig;
struct GNUNET_TIME_Absolute etime_abs;
- if (5 != SSCANF(s,
+ if (5 != sscanf(s,
"%52s.%253s -> %52s | %s | %" SCNu64,
issuer_pkey,
name,
*data_size = sizeof(struct GNUNET_CREDENTIAL_DelegationRecord);
while (NULL != token)
{
- matches = SSCANF(token, "%s %s", subject_pkey, attr_str);
+ matches = sscanf(token, "%s %s", subject_pkey, attr_str);
if (0 == matches)
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
memset(set, 0, sizeof(struct GNUNET_CREDENTIAL_DelegationSet) * entries);
for (i = 0; i < entries; i++)
{
- matches = SSCANF(token, "%s %s", subject_pkey, attr_str);
+ matches = sscanf(token, "%s %s", subject_pkey, attr_str);
GNUNET_CRYPTO_ecdsa_public_key_from_string(
subject_pkey, strlen(subject_pkey), &set[i].subject_key);
if (2 == matches)
* @file src/nat/gnunet-helper-nat-client-windows.c
* @brief Tool to help bypass NATs using ICMP method; must run as
* administrator on W32
- * This code is forx W32.
+ * This code is for W32.
* @author Nathan Evans
*
* This program will send ONE ICMP message using RAW sockets
/**
* Socket we use to send our ICMP packets.
*/
-static SOCKET rawsock;
+static _win_socket rawsock;
/**
* Target "dummy" address.
*
* @return INVALID_SOCKET on error
*/
-static SOCKET
+static _win_socket
make_raw_socket()
{
DWORD bOptVal = TRUE;
int bOptLen = sizeof(bOptVal);
- SOCKET ret;
+ _win_socket ret;
- ret = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
+ ret = _win_socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (INVALID_SOCKET == ret)
{
fprintf(stderr, "Error opening RAW socket: %s\n", strerror(errno));
return INVALID_SOCKET;
}
if (0 !=
- setsockopt(ret, SOL_SOCKET, SO_BROADCAST, (char *)&bOptVal, bOptLen))
+ _win_setsockopt(ret, SOL_SOCKET, SO_BROADCAST, (char *)&bOptVal, bOptLen))
{
fprintf(stderr, "Error setting SO_BROADCAST to ON: %s\n",
strerror(errno));
return INVALID_SOCKET;
}
- if (0 != setsockopt(ret, IPPROTO_IP, IP_HDRINCL, (char *)&bOptVal, bOptLen))
+ if (0 != _win_setsockopt(ret, IPPROTO_IP, IP_HDRINCL, (char *)&bOptVal, bOptLen))
{
fprintf(stderr, "Error setting IP_HDRINCL to ON: %s\n", strerror(errno));
closesocket(rawsock);
/**
* Socket we use to receive "fake" ICMP replies.
*/
-static SOCKET icmpsock;
+static _win_socket icmpsock;
/**
* Socket we use to send our ICMP requests.
*/
-static SOCKET rawsock;
+static _win_socket rawsock;
/**
* Socket we use to send our UDP requests.
*/
-static SOCKET udpsock;
+static _win_socket udpsock;
/**
* Target "dummy" address.
*
* @return INVALID_SOCKET on error
*/
-static SOCKET
+static _win_socket
make_icmp_socket()
{
- SOCKET ret;
+ _win_socket ret;
- ret = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+ ret = _win_socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
if (INVALID_SOCKET == ret)
{
fprintf(stderr, "Error opening RAW socket: %s\n", strerror(errno));
*
* @return INVALID_SOCKET on error
*/
-static SOCKET
+static _win_socket
make_raw_socket()
{
DWORD bOptVal = TRUE;
int bOptLen = sizeof(bOptVal);
- rawsock = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
+ rawsock = _win_socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
if (INVALID_SOCKET == rawsock)
{
fprintf(stderr, "Error opening RAW socket: %s\n", strerror(errno));
}
if (0 !=
- setsockopt(rawsock, SOL_SOCKET, SO_BROADCAST, (char *)&bOptVal,
+ _win_setsockopt(rawsock, SOL_SOCKET, SO_BROADCAST, (char *)&bOptVal,
bOptLen))
{
fprintf(stderr, "Error setting SO_BROADCAST to ON: %s\n",
return INVALID_SOCKET;
}
if (0 !=
- setsockopt(rawsock, IPPROTO_IP, IP_HDRINCL, (char *)&bOptVal, bOptLen))
+ _win_setsockopt(rawsock, IPPROTO_IP, IP_HDRINCL, (char *)&bOptVal, bOptLen))
{
fprintf(stderr, "Error setting IP_HDRINCL to ON: %s\n", strerror(errno));
closesocket(rawsock);
* @param my_ip source address (our ip address)
* @return INVALID_SOCKET on error
*/
-static SOCKET
+static _win_socket
make_udp_socket(const struct in_addr *my_ip)
{
- SOCKET ret;
+ _win_socket ret;
struct sockaddr_in addr;
- ret = socket(AF_INET, SOCK_DGRAM, 0);
+ ret = _win_socket(AF_INET, SOCK_DGRAM, 0);
if (INVALID_SOCKET == ret)
{
fprintf(stderr, "Error opening UDP socket: %s\n", strerror(errno));
"e.g. mon0 11-22-33-44-55-66 12-34-56-78-90-ab\n");
return 1;
}
- if (6 != SSCANF(argv[2],
+ if (6 != sscanf(argv[2],
"%x-%x-%x-%x-%x-%x",
&temp[0],
&temp[1],
}
for (i = 0; i < 6; i++)
outmac.mac[i] = temp[i];
- if (6 != SSCANF(argv[3],
+ if (6 != sscanf(argv[3],
"%x-%x-%x-%x-%x-%x",
&temp[0],
&temp[1],
return GNUNET_SYSERR;
}
- if (8 != SSCANF(addr,
+ if (8 != sscanf(addr,
"%4s.%u.%X:%X:%X:%X:%X:%X",
plugin, &options,
&a[0], &a[1], &a[2],
return NULL;
while (NULL != fgets(line, sizeof(line), f))
{
- if ((1 == SSCANF(line,
+ if ((1 == sscanf(line,
"%*x-%*x %*c%*c%*c%*c %*x %*2x:%*2x %*u%*[ ]%1023s",
dir)) &&
(NULL != (lgu = strstr(dir, current_pd->libname))))
}
if (!isspace(line[0]))
{
- have_ifc = (1 == SSCANF(line, "%11s", ifc)) ? GNUNET_YES : GNUNET_NO;
+ have_ifc = (1 == sscanf(line, "%11s", ifc)) ? GNUNET_YES : GNUNET_NO;
/* would end with ':' on OSX, fix it! */
if (ifc[strlen(ifc) - 1] == ':')
ifc[strlen(ifc) - 1] = '\0';
prefixlen = 0;
if ( /* Linux */
- (3 == SSCANF(start, "inet addr:%127s Bcast:%127s Mask:%127s", addrstr, bcstr, netmaskstr)) ||
- (2 == SSCANF(start, "inet addr:%127s Mask:%127s", addrstr, netmaskstr)) ||
- (2 == SSCANF(start, "inet6 addr:%127s %d", addrstr, &prefixlen)) ||
+ (3 == sscanf(start, "inet addr:%127s Bcast:%127s Mask:%127s", addrstr, bcstr, netmaskstr)) ||
+ (2 == sscanf(start, "inet addr:%127s Mask:%127s", addrstr, netmaskstr)) ||
+ (2 == sscanf(start, "inet6 addr:%127s %d", addrstr, &prefixlen)) ||
/* Solaris, OS X */
- (1 == SSCANF(start, "inet %127s", addrstr)) ||
- (1 == SSCANF(start, "inet6 %127s", addrstr)))
+ (1 == sscanf(start, "inet %127s", addrstr)) ||
+ (1 == sscanf(start, "inet6 %127s", addrstr)))
{
/* IPv4 */
if (1 == inet_pton(AF_INET, addrstr, &v4))
memset(ifname, 0, 64);
memset(afstr, 0, 6);
memset(addrstr, 0, 128);
- if (4 != SSCANF(line,
+ if (4 != sscanf(line,
"%*u: %63s %5s %127s %6u",
ifname,
afstr,