mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-05 19:15:05 +00:00
Protocol structure can now specify the default port.
This commit is contained in:
parent
63482e4fe9
commit
f14af3d95c
@ -2,9 +2,11 @@
|
||||
#define PROTO_H
|
||||
|
||||
#include "tables.h"
|
||||
#include "in.h"
|
||||
|
||||
struct protocol {
|
||||
char *name;
|
||||
in_port_t default_port;
|
||||
int ( * load ) ( char *url,
|
||||
struct sockaddr_in *server,
|
||||
char *file,
|
||||
|
@ -103,9 +103,6 @@ static int rpc_lookup(struct sockaddr_in *addr, int prog, int ver, int sport)
|
||||
*p++ = htonl(ver);
|
||||
*p++ = htonl(IP_UDP);
|
||||
*p++ = 0;
|
||||
if ( ! addr->sin_port ) {
|
||||
addr->sin_port = SUNRPC_PORT;
|
||||
}
|
||||
for (retries = 0; retries < MAX_RPC_RETRIES; retries++) {
|
||||
long timeout;
|
||||
udp_transmit(addr->sin_addr.s_addr, sport, addr->sin_port,
|
||||
@ -623,5 +620,7 @@ nfssymlink:
|
||||
INIT_FN ( INIT_RPC, rpc_init, nfs_reset, nfs_reset );
|
||||
|
||||
static struct protocol nfs_protocol __protocol = {
|
||||
"nfs", nfs
|
||||
.name = "nfs",
|
||||
.default_port = SUNRPC_PORT,
|
||||
.load = nfs,
|
||||
};
|
||||
|
@ -516,8 +516,6 @@ static int url_slam ( char *url __unused,
|
||||
struct slam_info info;
|
||||
/* Set the defaults */
|
||||
info.server = *server;
|
||||
if ( ! info.server.sin_port )
|
||||
info.server.sin_port = SLAM_PORT;
|
||||
info.multicast.sin_addr.s_addr = htonl(SLAM_MULTICAST_IP);
|
||||
info.multicast.sin_port = SLAM_MULTICAST_PORT;
|
||||
info.local.sin_addr.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr;
|
||||
@ -532,5 +530,7 @@ static int url_slam ( char *url __unused,
|
||||
}
|
||||
|
||||
static struct protocol slam_protocol __protocol = {
|
||||
"x-slam", url_slam
|
||||
.name = "x-slam",
|
||||
.default_port = SLAM_PORT,
|
||||
.load = url_slam,
|
||||
};
|
||||
|
@ -391,8 +391,6 @@ static int url_tftm ( char *url __unused,
|
||||
|
||||
/* Set the defaults */
|
||||
info.server = *server;
|
||||
if ( ! info.server.sin_port )
|
||||
info.server.sin_port = TFTM_PORT;
|
||||
info.local.sin_addr.s_addr = arptable[ARP_CLIENT].ipaddr.s_addr;
|
||||
info.local.sin_port = TFTM_PORT; /* Does not matter. */
|
||||
info.multicast = info.local;
|
||||
@ -482,5 +480,7 @@ static int opt_get_multicast(struct tftp_t *tr, unsigned short *len,
|
||||
}
|
||||
|
||||
static struct protocol tftm_protocol __protocol = {
|
||||
"x-tftm", url_tftm
|
||||
.name = "x-tftm",
|
||||
.default_port = TFTM_PORT,
|
||||
.load = url_tftm,
|
||||
};
|
||||
|
@ -50,8 +50,6 @@ int tftp_block ( struct tftpreq_info_t *request,
|
||||
blksize = TFTP_DEFAULTSIZE_PACKET;
|
||||
lport++; /* Use new local port */
|
||||
server = *(request->server);
|
||||
if ( ! server.sin_port )
|
||||
server.sin_port = TFTP_PORT;
|
||||
if ( !udp_transmit(server.sin_addr.s_addr, lport,
|
||||
server.sin_port, xmitlen, &xmit) )
|
||||
return (0);
|
||||
@ -170,5 +168,7 @@ int tftp ( char *url __unused,
|
||||
}
|
||||
|
||||
struct protocol tftp_protocol __default_protocol = {
|
||||
"tftp", tftp
|
||||
.name = "tftp",
|
||||
.default_port = TFTP_PORT,
|
||||
.load = tftp,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user