AFS
view release on metacpan or search on metacpan
break;
if (ip == 0) {
ht = gethostbyaddr((const char *) &hosts[i], sizeof(struct in_addr), AF_INET);
if (ht == NULL)
h = (char *) inet_ntoa(hosts[i]);
else
h = ht->h_name;
}
else {
h = (char *) inet_ntoa(hosts[i]);
}
XPUSHs(sv_2mortal(newSVpv(h, strlen(h))));
}
}
}
void
fs__get_server_version(port,hostName="localhost",verbose=0)
short port
char *hostName
int32 verbose
CODE:
{
#if defined(AFS_3_4)
not_here("AFS::Utils::get_server_version");
#else
struct sockaddr_in taddr;
struct in_addr hostAddr;
struct hostent *th;
int32 host;
short port_num = htons(port);
int32 length = 64;
int32 code;
char version[64];
int s;
/* lookup host */
if (hostName) {
th = (struct hostent *) hostutil_GetHostByName(hostName);
if (!th) {
warn("rxdebug: host %s not found in host table\n", hostName);
SETCODE(EFAULT);
XSRETURN_UNDEF;
}
/* bcopy(th->h_addr, &host, sizeof(int32)); */
Copy(th->h_addr, &host, th->h_length, char);
}
else
host = htonl(0x7f000001); /* IP localhost */
hostAddr.s_addr = host;
if (verbose)
printf("Trying %s (port %d):\n", inet_ntoa(hostAddr), ntohs(port_num));
s = socket(AF_INET, SOCK_DGRAM, 0);
taddr.sin_family = AF_INET;
taddr.sin_port = 0;
taddr.sin_addr.s_addr = 0;
code = bind(s, (struct sockaddr *) &taddr, sizeof(struct sockaddr_in));
SETCODE(code);
if (code) {
perror("bind");
XSRETURN_UNDEF;
}
code = rx_GetServerVersion(s, host, port_num, length, version);
ST(0) = sv_newmortal();
if (code < 0) {
SETCODE(code);
}
else {
sv_setpv(ST(0), version);
}
#endif
}
void
fs_get_syslib_version()
CODE:
{
extern char *AFSVersion;
ST(0) = sv_newmortal();
sv_setpv(ST(0), AFSVersion);
}
void
fs_XSVERSION()
CODE:
{
ST(0) = sv_newmortal();
sv_setpv(ST(0), xs_version);
}
void
fs_sysname(newname=0)
char * newname
CODE:
{
struct ViceIoctl vi;
int32 code, set;
char space[MAXSIZE];
set = (newname && *newname);
vi.in = space;
bcopy(&set, space, sizeof(set));
vi.in_size = sizeof(set);
if (set) {
strcpy(space + sizeof(set), newname);
vi.in_size += strlen(newname) + 1;
}
vi.out_size = MAXSIZE;
vi.out = (caddr_t) space;
code = pioctl(NULL, VIOC_AFS_SYSNAME, &vi, 0);
SETCODE(code);
ST(0) = sv_newmortal();
if (code == 0) {
sv_setpv(ST(0), space + sizeof(set));
}
}
( run in 1.038 second using v1.01-cache-2.11-cpan-2398b32b56e )