|
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 q
Length: 4925 (0x133d) Types: TextFile Names: »qmgr-start.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« └─⟦e5a54fb17⟧ └─⟦this⟧ »pp-5.0/Chans/qmgr-load/qmgr-start.c«
/* qmgr_start.c: routines to read in Q from addr dir and pass on to Qmgr */ # ifndef lint static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Chans/qmgr-load/RCS/qmgr-start.c,v 5.0 90/09/20 15:53:10 pp Exp Locker: pp $"; # endif /* * $Header: /cs/research/pp/hubris/pp-beta/Chans/qmgr-load/RCS/qmgr-start.c,v 5.0 90/09/20 15:53:10 pp Exp Locker: pp $ * * $Log: qmgr-start.c,v $ * Revision 5.0 90/09/20 15:53:10 pp * rcsforce : 5.0 public release * */ #include "util.h" #include "retcode.h" #include "ryinitiator.h" /* for generic interactive initiators */ #include "Qmgr-ops.h" /* operation definitions */ #include "Qmgr-types.h" /* type definitions */ /* Sumbit types */ #include "q.h" #include "prm.h" /* \f */ /* Outside routines */ extern struct type_Qmgr_MsgStruct *qstruct2qmgr(); extern void qinit(), sys_init(), rd_end(); /* \f */ /* DATA */ static char *myservice = "pp qmgr"; static char *mycontext = "pp qmgr interface"; static char *mypci = "pp qmgr interface pci"; /* OPERATIONS */ static int do_newmessage(), do_help(), do_quit(); /* RESULTS */ int newmessage_result(); /* ERRORS */ int general_error (); #define newmessage_error general_error static struct client_dispatch dispatches[] = { { "newmessage", operation_Qmgr_newmessage, do_newmessage, free_Qmgr_newmessage_argument, newmessage_result, newmessage_error, "Re-add message to the queue" }, { "help", 0, do_help, NULLIFP, NULLIFP, NULLIFP, "print this information", }, { "quit", 0, do_quit, NULLIFP, NULLIFP, NULLIFP, "terminate the association and exit", }, { NULL } }; /* \f */ /* MAIN */ /* ARGSUSED */ main (argc, argv, envp) int argc; char **argv, **envp; { char *myname, *hostname; if (myname = rindex (argv[0], '/')) myname++; if (myname == NULL || *myname == NULL) myname = argv[0]; argv++; argc--; if (argc < 1) { printf("usage: %s [-h hostname] msg ...",myname); exit(1); } sys_init(myname); if (strcmp(*argv,"-h") == 0) { argv++; hostname = *argv; argv++; argc -= 2; } else hostname = PLocalHostName (); if (argc < 1) { printf (NULLCP, "usage: %s [-h host] msg ...",myname); exit(1); } (void) ryinitiator (myname, hostname, argc, argv, myservice, mycontext, mypci, table_Qmgr_Operations, dispatches, do_quit); exit(0); /* NOT REACHED */ } /* \f */ /* OPERATIONS */ /* ARGSUSED */ static int do_newmessage (sd, ds, args, arg) int sd; struct client_dispatch *ds; char **args; struct type_Qmgr_MsgStruct **arg; { char *file = NULL; struct prm_vars prm; Q_struct que; ADDR *sender = NULL; ADDR *recips = NULL; int rcount, result; result = OK; qinit (&que); bzero ((char *)&prm, sizeof(prm)); if ((file = *args++) == NULLCP) result = NOTOK; if ((result == OK) && (rp_isbad(rd_msg(file,&prm,&que,&sender,&recips,&rcount)))) { PP_LOG(LLOG_EXCEPTIONS, ("Chans/qmgr-load/xqstart rd_msg err: '%s'",file)); result = NOTOK; } /* unlock message */ rd_end(); if ((result == OK) && ((*arg = qstruct2qmgr(file,&prm,&que,sender,recips,rcount)) == NULL)) { PP_LOG(LLOG_EXCEPTIONS, ("Chans/qmgr-load/xqstart qstruct2qmgr err: '%s'",file)); result = NOTOK; } /* free all storage */ q_init(&que); return result; } /* 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; } /* 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; if (AcRelRequest (sd, ACF_NORMAL, NULLPEP, 0, acr, aci) == NOTOK) 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; } /* \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; }