[Commit] nickle socket.5c,NONE,1.1
Keith Packard
commit at keithp.com
Tue Jun 10 23:02:44 PDT 2003
- Previous message: [Commit] nickle/builtin builtin.c,1.10,1.11 namespaces.h,1.2,1.3
sockets.c,1.10,1.11
- Next message: [Commit] librr/src Makefile.am,1.2,1.3 rr.c,1.3,1.4 rr.h,1.4,1.5
rr_board.c,1.5,1.6 rr_client.c,1.1,1.2 rrint.h,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: keithp
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv10121
Added Files:
socket.5c
Log Message:
Add a couple of network address conversion utilities
--- NEW FILE: socket.5c ---
extend namespace Socket {
public string addr_to_string (int addr) {
return sprintf ("%d.%d.%d.%d",
(addr >> 24) & 0xff,
(addr >> 16) & 0xff,
(addr >> 8) & 0xff,
(addr) & 0xff);
}
public int string_to_addr (string addr) {
int r = File::sscanf (addr, "%d.%d.%d.%d",
&(int a), &(int b), &(int c), &(int d));
if (r != 4)
raise invalid_argument ("invalid network address format",
r, addr);
return (a << 24) + (b << 16) + (c << 8) + d;
}
}
/*
* backwards compatibility for old namespace name
*/
namespace Sockets {
public import Socket;
}
- Previous message: [Commit] nickle/builtin builtin.c,1.10,1.11 namespaces.h,1.2,1.3
sockets.c,1.10,1.11
- Next message: [Commit] librr/src Makefile.am,1.2,1.3 rr.c,1.3,1.4 rr.h,1.4,1.5
rr_board.c,1.5,1.6 rr_client.c,1.1,1.2 rrint.h,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list