|
|
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 i
Length: 8942 (0x22ee)
Types: TextFile
Names: »interface.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Src/qmgr/interface.c«
/* interface.c: interface to queue manager */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Src/qmgr/RCS/interface.c,v 5.0 90/09/20 16:21:16 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Src/qmgr/RCS/interface.c,v 5.0 90/09/20 16:21:16 pp Exp Locker: pp $
*
* $Log: interface.c,v $
* Revision 5.0 90/09/20 16:21:16 pp
* rcsforce : 5.0 public release
*
*/
#include <stdio.h>
#include "ryinitiator.h" /* for generic interactive initiators */
#include "Qmgr-ops.h" /* operation definitions */
#include "Qmgr-types.h" /* type definitions */
/* \f
Routines */
struct type_Qmgr_MsgStruct *gmsgstruct ();
struct type_Qmgr_FilterList *gfilterlist ();
struct type_Qmgr_ChannelControl *gchannelcontrol ();
struct type_Qmgr_ReadMessageArgument *greadmessageargument ();
struct type_UNIV_UTCTime *gutctime ();
struct type_Qmgr_MtaRead *gmtaread ();
struct type_Qmgr_MtaControl *gmtacontrol ();
/* \f
DATA */
static char *myservice = "pp qmgr";
static char *mycontext = "pp qmgr interface";
static char *mypci = "pp qmgr interface pci";
/* OPERATIONS */
int do_newmessage (),
do_readmsginfo (),
do_channelbegin (),
do_channelread (),
do_channelcontrol (),
do_mtaread (),
do_mtacontrol (),
do_qmgrcontrol (),
do_readchannelmtamessage (),
do_help (),
do_quit ();
/* RESULTS */
int newmessage_result (),
readmsginfo_result (),
channelbegin_result (),
channelread_result (),
channelcontrol_result (),
mtaread_result (),
qmgrcontrol_result (),
readchannelmtamessage_result (),
mtacontrol_result ();
/* ERRORS */
int general_error ();
#define newmessage_error general_error
#define readmsginfo_error general_error
#define channelbegin_error general_error
#define channelread_error general_error
#define channelcontrol_error general_error
#define mtaread_error general_error
#define mtacontrol_error general_error
#define qmgrcontrol_error general_error
#define readChannelMtaMessage_result general_error
static struct client_dispatch dispatches[] = {
{
"readmsginfo", operation_Qmgr_readmsginfo,
do_readmsginfo, free_Qmgr_readmsginfo_argument,
readmsginfo_result, readmsginfo_error,
"Read a set of messages"
},
{
"channelread", operation_Qmgr_channelread,
do_channelread, free_Qmgr_channelread_argument,
channelread_result, channelread_error,
"Read the set of channels",
},
{
"channelcontrol", operation_Qmgr_channelcontrol,
do_channelcontrol, free_Qmgr_channelcontrol_argument,
channelcontrol_result, channelcontrol_error,
"Control a channel",
},
{
"mtaread", operation_Qmgr_mtaread,
do_mtaread, free_Qmgr_mtaread_argument,
mtaread_result, mtaread_error,
"Read about a host",
},
{
"mtacontrol", operation_Qmgr_mtacontrol,
do_mtacontrol, free_Qmgr_mtacontrol_argument,
mtacontrol_result, mtacontrol_error,
"Host control"
},
{
"readchannelmtamessage", operation_Qmgr_readChannelMtaMessage,
do_readChannelMtaMessage, free_Qmgr_readChannelMtaMessage_argument,
readChannelMtaMessage_result, readChannelMtaMessage_error,
"Read messages from a given channel & mta"
}
{
"qmgrcontrol", operation_Qmgr_qmgrControl,
do_qmgrcontrol, free_Qmgr_qmgrControl_argument,
qmgrcontrol_result, qmgrcontrol_error,
"Control the queue manager"
{
"help", 0, do_help,
NULLIFP, NULLIFP, NULLIFP,
"print this information",
},
{
"quit", 0, do_quit,
NULLIFP, NULLIFP, NULLIFP,
"terminate the association and exit",
},
{
NULL
}
};
int level;
/* \f
MAIN */
/* ARGSUSED */
main (argc, argv, envp)
int argc;
char **argv,
**envp;
{
(void) ryinitiator (argc, argv, myservice, mycontext, mypci,
table_Qmgr_Operations, dispatches, do_quit);
exit (0); /* NOTREACHED */
}
/* \f
OPERATIONS */
/* ARGSUSED */
do_readmsginfo (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_Qmgr_ReadMessageArgument **arg;
{
char *cp;
if ((cp = *args ++) != NULLCP)
setinput (cp);
*arg = greadmessageargument ();
resetinput ();
return OK;
}
/* ARGSUSED */
do_channelread (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_UNIV_UTCTime **arg;
{
*arg = gutctime ();
return OK;
}
/* ARGSUSED */
do_channelcontrol (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_Qmgr_ChannelControl **arg;
{
char *cp;
if ((cp = *args ++) != NULLCP)
setinput (cp);
*arg = gchannelcontrol ();
resetinput ();
return OK;
}
/* ARGSUSED */
do_mtaread (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_Qmgr_MtaRead **arg;
{
char *cp;
struct type_Qmgr_Channel *getchan ();
if ((cp = *args ++) != NULLCP)
setinput (cp);
*arg = gmtaread ();
resetinput ();
return OK;
}
/* ARGSUSED */
do_mtacontrol (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_Qmgr_MtaControl **arg;
{
char *cp;
if ((cp = *args ++) != NULLCP)
setinput (cp);
*arg = gmtacontrol ();
resetinput ();
return OK;
}
/* ARGSUSED */
do_readChannelMtaMessage (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_Qmgr_ **arg;
{
char *cp;
if ((cp = *args ++) != NULLCP)
setinput (cp);
*arg = gmtacontrol ();
resetinput ();
return OK;
}
/* ARGSUSED */
do_qmgrcontrol (sd, ds, args, arg)
int sd;
struct client_dispatch *ds;
char **args;
struct type_Qmgr_QmgrControl **arg;
{
char *cp;
if ((cp = *args ++) != NULLCP)
setinput (cp);
*arg = gmtacontrol ();
resetinput ();
return OK;
}
/* ARGSUSED */
static int do_help (sd, ds, args)
int sd;
register struct client_dispatch *ds;
char **args;
{
printf ("\nCommands are:\n");
for (ds = dispatches; ds -> ds_name; ds++)
printf ("%s\t%s\n", ds -> ds_name, ds -> ds_help);
return NOTOK;
}
/* \f
*/
/* ARGSUSED */
static int do_quit (sd, ds, args)
int sd;
struct client_dispatch *ds;
char **args;
{
struct AcSAPrelease acrs;
register struct AcSAPrelease *acr = &acrs;
struct AcSAPindication acis;
register struct AcSAPindication *aci = &acis;
register struct AcSAPabort *aca = &aci -> aci_abort;
#ifdef CONNCETING_1
if (AcRelRequest (sd, ACF_NORMAL, NULLPEP, 0, NOTOK, acr, aci) == NOTOK)
#else
if (AcRelRequest (sd, ACF_NORMAL, NULLPEP, 0, acr, aci) == NOTOK)
#endif
acs_adios (aca, "A-RELEASE.REQUEST");
if (!acr -> acr_affirmative) {
(void) AcUAbortRequest (sd, NULLPEP, 0, aci);
adios (NULLCP, "Release rejected by peer: %d", acr -> acr_reason);
}
ACRFREE (acr);
exit (0);
}
/* \f
RESULTS */
/* ARGSUSED */
newmessage_result (sd, id, dummy, result, roi)
int sd,
id,
dummy;
struct type_Qmgr_Pseudo__newmessage *result;
struct RoSAPindication *roi;
{
return OK;
}
/* ARGSUSED */
readmsginfo_result (sd, id, dummy, result, roi)
int sd,
id,
dummy;
register struct type_Qmgr_MsgList *result;
struct RoSAPindication *roi;
{
extern void printmsg ();
pmsglist (result);
return OK;
}
/* ARGSUSED */
channelbegin_result (sd, id, dummy, result, roi)
int sd,
id,
dummy;
register struct type_Qmgr_FilterList *result;
struct RoSAPindication *roi;
{
pfilterlist (result);
return OK;
}
/* ARGSUSED */
channelread_result (sd, id, dummy, result, roi)
int sd, id, dummy;
register struct type_Qmgr_PrioritisedChannelList *result;
struct RoSAPindication *roi;
{
pprioritisedchannellist (result);
return OK;
}
/* ARGSUSED */
channelcontrol_result (sd, id, dummy, result, roi)
int sd,
id,
dummy;
register struct type_Qmgr_PrioritisedChannelList *result;
struct RoSAPindication *roi;
{
pprioritisedchannellist (result);
return OK;
}
/* ARGSUSED */
mtaread_result (sd, id, dummy, result, roi)
int sd,
id,
dummy;
register struct type_Qmgr_PrioritisedMtaList *result;
struct RoSAPindication *roi;
{
pprioritisedmtalist (result);
return OK;
}
/* ARGSUSED */
mtacontrol_result (sd, id, dummy, result, roi)
int sd,
id,
dummy;
register struct type_Qmgr_MtaInfo *result;
struct RoSAPindication *roi;
{
pmtainfo (result);
return OK;
}
/* \f
ERRORS */
/* ARGSUSED */
general_error (sd, id, error, parameter, roi)
int sd,
id,
error;
caddr_t parameter;
struct RoSAPindication *roi;
{
register struct RyError *rye;
if (error == RY_REJECT) {
advise (NULLCP, "%s", RoErrString ((int) parameter));
return OK;
}
if (rye = finderrbyerr (table_Qmgr_Errors, error))
advise (NULLCP, "%s", rye -> rye_name);
else
advise (NULLCP, "Error %d", error);
return OK;
}
/* \f
Misc */
static char *err2str (err)
int err;
{
struct RyError *rye;
static char buffer[BUFSIZ];
if (rye = finderrbyerr (table_Qmgr_Errors, err))
return rye -> rye_name;
(void) sprintf (buffer, "Error %d", err);
return buffer;
}