|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 3324 (0xcfc)
Types: TextFile
Names: »rtsping84.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Chans/x40084/rtsping84.c«
/* rtsping.c: test rts connections */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Chans/x40084/RCS/rtsping84.c,v 5.0 90/09/20 15:56:09 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Chans/x40084/RCS/rtsping84.c,v 5.0 90/09/20 15:56:09 pp Exp Locker: pp $
*
* $Log: rtsping84.c,v $
* Revision 5.0 90/09/20 15:56:09 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
#include "rtsparams.h"
#include "chan.h"
#include <isode/rtsap.h>
#include "RTS84-types.h"
char *myname;
char *channame = "rtsping84";
CHAN *mychan;
main (argc, argv)
int argc;
char **argv;
{
extern char *optarg;
extern int optind;
int opt;
myname = argv[0];
while((opt = getopt(argc, argv, "c:")) != EOF)
switch (opt) {
case 'c':
channame = optarg;
break;
default:
fprintf (stderr, "Usage: %s", myname);
break;
}
argc -= optind;
argv += optind;
sys_init (channame);
rename_log (myname);
if ((mychan = ch_nm2struct (channame)) == NULL)
adios (NULLCP, "No such channel '%s'", channame);
while (argc-- > 0)
rtsping (*argv++);
exit (0);
}
static rtsping (remote_site)
char *remote_site;
{
RtsParams *rp;
int sd;
PE pe;
struct RtSAPaddr rtsaps, rtsaps2;
struct RtSAPaddr *rtsap = &rtsaps,
*rtsap2 = &rtsaps2;
struct SSAPaddr *sa;
struct RtSAPindication rtis;
struct RtSAPconnect rtcs;
register struct RtSAPconnect *rtc = &rtcs;
register struct RtSAPindication *rti = &rtis;
register struct RtSAPabort *rta = &rti->rti_abort;
struct type_RTS84_Request *req;
char err_buf[BUFSIZ];
if ((rp = tb_rtsparams (mychan, remote_site)) == NULL)
adios (NULLCP,
"Can't find RTS information for '%s'", remote_site);
if (rts_encode_request (&pe, &req,
rp -> our_name, rp -> our_passwd) == NOTOK)
adios (NULLCP, "Can't construct parameters");
PP_PDU (print_RTS84_Request, pe, "RTS84.Request", PDU_WRITE);
if (rp -> their_address == NULLCP)
adios (NULLCP, "Missing remote PSAP for '%s'", remote_site);
if ((sa = str2saddr (rp -> their_address)) == NULLSA)
adios (NULLCP, "Illegal remote PSAP '%s'", rp -> their_address);
rtsap -> rta_addr = *sa;
rtsap -> rta_port = htons (1);
if (rp -> our_address) {
if ((sa = str2saddr (rp -> our_address)) == NULLSA)
adios (NULLCP, "Illegal local PSAP '%s'",
rp -> our_address);
rtsap2 -> rta_addr = *sa;
rtsap2 -> rta_port = 0;
}
else rtsap2 = NULLRtA;
PP_NOTICE (("Connecting to site %s", remote_site));
if (RtBeginRequest2 (rtsap, rtsap2, rp -> rts_mode, RTS_INITIATOR,
pe, rtc, rti) == NOTOK)
rts_adios (rta, "RT-BEGIN.REQUEST");
if (rtc -> rtc_result != RTS_ACCEPT) {
(void) sprintf (err_buf, "Connection failed: Reason='%s'",
RtErrString (rtc -> rtc_result));
rts_adios (rta, err_buf);
}
sd = rtc -> rtc_sd;
parameter_checks (rtc->rtc_data, rp -> their_name,
rp -> their_passwd, remote_site, FALSE);
PP_PDU (print_RTS84_Request, rtc -> rtc_data, "RTS84.Response",
PDU_READ);
RTCFREE (rtc);
if (RtEndRequest (sd, rti) == NOTOK)
rts_adios (rta, "RT-END.REQUEST");
PP_NOTICE (("Connection successfully terminated"));
}