mirror of
https://github.com/simh/simh.git
synced 2026-04-28 20:57:26 +00:00
SOCKETS: Cleanup, simplify and extend the sim_sock API set.
Cleanup/Simplification by: 1) removing irrelevant master flag variable from sim_close_sock and thus sim_err_sock 2) change previous boolean feature arguments (datagram, nodelay, reuseaddr) to flag bits in a single option argument. This allows for features to be added by new flag bits which don't change the calling signatures. 3) changed all status returns to be int (vs t_stat) with success being 0 and error being -1 4) removed unneeded simh specific type references to allow sim_sock to be used by n Extended API by providing flags to influence socket setup/behavior: SIM_SOCK_OPT_REUSEADDR Retains prior behavior when sim_switches had -U set SIM_SOCK_OPT_DATAGRAM UDP socket setup provided for when prior datagram argument was specified SIM_SOCK_OPT_NODELAY TCP Nagle disable provided for when prior nodelay argument was specified SIM_SOCK_OPT_BLOCKING Blocking socket mode (detault is non blocking)
This commit is contained in:
@@ -1258,20 +1258,18 @@ t_stat dmc_setpeer (UNIT* uptr, int32 val, char* cptr, void* desc)
|
||||
DEVICE *dptr = (UNIBUS) ? ((&dmc_dev == find_dev_from_unit(uptr)) ? &dmc_dev : &dmp_dev) : &dmv_dev;
|
||||
int32 dmc = (int32)(uptr-dptr->units);
|
||||
char *peer = ((dptr == &dmc_dev)? &dmc_peer[dmc][0] : &dmp_peer[dmc][0]);
|
||||
t_stat status = SCPE_OK;
|
||||
char host[CBUFSIZE], port[CBUFSIZE];
|
||||
|
||||
if ((!cptr) || (!*cptr))
|
||||
return SCPE_ARG;
|
||||
if (dmc_is_attached(uptr))
|
||||
return SCPE_ALATT;
|
||||
status = sim_parse_addr (cptr, host, sizeof(host), NULL, port, sizeof(port), NULL, NULL);
|
||||
if (status != SCPE_OK)
|
||||
return status;
|
||||
if (sim_parse_addr (cptr, host, sizeof(host), NULL, port, sizeof(port), NULL, NULL))
|
||||
return SCPE_ARG;
|
||||
if (host[0] == '\0')
|
||||
return SCPE_ARG;
|
||||
strncpy(peer, cptr, CBUFSIZE-1);
|
||||
return status;
|
||||
return SCPE_OK;
|
||||
}
|
||||
|
||||
t_stat dmc_showspeed (FILE* st, UNIT* uptr, int32 val, void* desc)
|
||||
|
||||
Reference in New Issue
Block a user