ATLAS Offline Software
Loading...
Searching...
No Matches
JiveXML Namespace Reference

This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc. More...

Namespaces

namespace  MuonFullIDHelper
namespace  SiSpacePointRetrieverHelpers
namespace  TrackParticleRetrieverHelpers
namespace  TrackRetrieverHelpers
 Namespace for all helper functions.

Classes

class  AlgoJiveXML
 Converts Reconstructed Event Data objects into XML files which can be read by, for example, the Atlantis graphics package. More...
class  AODCaloClusterRetriever
 Retrieves all Calo Cluster objects. More...
class  AODJetRetriever
 Retrieves all Jet objects (JetEvent/Jet) More...
class  BadLArRetriever
 Retrieves all Calo Cluster objects. More...
class  BadTileRetriever
 Retrieves all Tile Calo Cell objects. More...
class  BeamSpotRetriever
 Retrieve the BeamSpot information (official ID s/w result) More...
class  BJetRetriever
 Retrieves Jet objects, filter from weight for BJet (JetEvent/Jet) More...
class  CaloClusterRetriever
 Retrieves all Calo Cluster objects. More...
class  CaloFCalRetriever
 Retrieves all Calo Cluster objects. More...
class  CaloHECRetriever
 Retrieves all Calo Cluster objects. More...
class  CaloLArRetriever
 Retrieves all Calo Cluster objects. More...
class  CaloMBTSRetriever
 Retrieves all Calo Cluster objects. More...
class  CaloTileRetriever
 Retrieves all Tile Calo Cell objects. More...
class  CompositeParticleRetriever
 Retrieves all CompositeParticle objects (AllObjects) More...
class  CSCClusterRetriever
class  CscPrepDataRetriever
class  CTPDecisionRetriever
class  DataType
 Templated class to convert any object that is streamable in a ostringstream in a string. More...
struct  DispatchThreadArguments_t
class  ElectronRetriever
 Retrieves all Electron objects (ElectronAODCollection etc.) More...
class  EmTauROIRetriever
struct  Event_t
struct  EventRequest_t
class  EventStreamID
 For the client-server communication, each event is uniquely identified by the run number, the event number and a string determining which stream it belongs to. More...
class  ExternalONCRPCServerSvc
 This athena service will provide a link to an external ONCRPC server, e.g running as standalone application or in another athena application. More...
class  GeometryWriter
 Writes the inner detector and calorimeter geometry to an XML file for use with Atlantis. More...
class  IDataRetriever
 Interface for all DataRetriever classes, that extract event data from StoreGate and pass them on to a IFormatTool The interface will only hold the methods that have to be implemented by all DataRetrievers. More...
class  IEventReceiver
 Pure abstract interface for all event serving classes that provide events, streams and status information to the serving threads. More...
class  IEventServer
 Pure abstract interface for all event serving classes that provide events, streams and status information to the serving threads. More...
class  IFormatTool
 Abstract interface to event data formatting classes. More...
class  IGeometryWriter
class  IInDetGeoModelTool
 Interface for the InDetGeoModelTool. More...
class  IMessage
 Pure abstract interface to provide some athena-indepandant messaging Note that only MSG::Level enum is used from IMessageSvc. More...
class  InDetGeoModelTool
 Provides easy access to the geometry model managers and identifier helpers for all JiveXML::IDataRetriever implemenations in InDetJiveXML . More...
class  IServer
 Pure abstract interface for all full server implementations. More...
class  IServerSvc
 Athena interface for all ServerSvc implementations. More...
class  IStreamTool
 Abstract interface to JiveXML event streaming classes. More...
class  JetROIRetriever
 Retrieves ROI objects, default mode uses HLT/Offline object LVL1_ROI::jets_type. More...
class  JiveXMLServer
class  LArDigitRetriever
 Retrieves all Tile Calo Cell objects. More...
class  LVL1JetElementRetriever
class  LVL1ResultRetriever
class  LVL1TrigTowerRetriever
class  MdtPrepDataRetriever
class  MMPrepDataRetriever
class  MuonGeometryWriter
 Writes the GeoModel muon geometry to an XML file for use with Atlantis. More...
class  MuonRetriever
 Retrieves all Muon objects (StacoMuonCollection etc.) More...
class  MuonROIRetriever
 Retrieves ROI objects, default mode uses HLT/Offline object LVL1_ROI::emtaus_type. More...
class  ONCRPCServerSvc
 This athena service will create an ONC/RPC (aka SunRPC) server, that can provide the athena status as well as data strings from events. More...
class  PhotonRetriever
 Retrieves all Photon objects (PhotonAODCollection) More...
class  PixelClusterRetriever
 Retrieves all InDet::SiCluster objects. More...
class  PixelRDORetriever
 Retrieve all PixelRDORawData information (pixel raw hits) More...
class  RpcPrepDataRetriever
class  SCTRDORetriever
 Retrieve all SCT_RDORawData information (SCT raw hits) More...
class  SegmentRetriever
 Retrieves all Trk::SegmentCollection objects. More...
struct  ServerThreadArguments_t
class  SiClusterRetriever
 Retrieves all InDet::SiCluster objects. More...
class  SiSpacePointRetriever
 Retrieves all InDet::SpacePoint data for Pixel and SCT. More...
class  sTgcPrepDataRetriever
struct  Streams_t
class  StreamToFileTool
 Stream JiveXML event information into a file. More...
class  StreamToServerTool
 Stream event to an IServerSvc, which typically is a network server run from and controlled by the Athena application. More...
class  TauJetRetriever
 Retrieves all TauJet objects. More...
class  TgcPrepDataRetriever
class  ThreadCollection
 This class handles a collection of threads. More...
class  TrackParticleRetriever
 Retrieves all TrackParticle (AOD) Collection objects This is a chopped version of the full (RDO/ESD) Trk::Track retriever TrigJiveXML/TrackRetriever. More...
class  TrackRetriever
 Retrieves the Trk::TrackCollection objects. More...
class  TrigEMClusterRetriever
class  TriggerInfoRetriever
class  TrigMuonROIRetriever
class  TrigRpcDataRetriever
class  TrigSiSpacePointRetriever
class  TRTRetriever
 Retrieves all InDet::TRT_DriftCircle objects. More...
class  TruthMuonTrackRetriever
 Retrieves the muons information from the TrackRecordCollection. More...
class  TruthParticleRetriever
class  TruthTrackRetriever
 Retrieves the McEventCollection or the TrackRecordCollection in simulated cosmics. More...
class  VertexRetriever
 Retrieves all Trk::VxCandidate objects. More...
class  xAODCaloClusterRetriever
 Retrieves the Calo Cluster objects. More...
class  xAODElectronRetriever
 Retrieves the Electron objects (Electrons etc.) More...
class  xAODEmTauROIRetriever
class  xAODJetRetriever
 Retrieves the Jet objects (AntiKt4TopoEMJets etc.) More...
class  xAODJetROIRetriever
class  xAODMissingETRetriever
 Retrieves the MissingET objects (MET_Reference_AntiKt4EMPFlow etc.) More...
class  xAODMuonRetriever
 Retrieves Muon objects (Muons etc.) More...
class  xAODMuonROIRetriever
class  xAODPhotonRetriever
 Retrieves the Photon objects (Photons etc.) More...
class  xAODTauRetriever
 Retrieves the Tau objects (TauJets etc.) More...
class  xAODTrackParticleRetriever
 Retrieves the TrackParticle objects (InDetTrackParticles etc.) More...
class  xAODTrigDecisionRetriever
class  xAODTriggerTowerRetriever
 Retrieves TriggerTower xAOD objects. More...
class  xAODVertexRetriever
 Retrieves the Vertex objects (PrimaryVertices etc.) More...
class  XMLFormatTool
 Writes data stored in a DataMap into an XML stream in the format required by the Atlantis event display. More...

Typedefs

typedef std::vector< DataTypeDataVect
 Defines a map with a key and a vector of DataType objects e.g.
typedef std::map< std::string, DataVectDataMap
typedef std::pair< std::string, std::string > TagType
 Defines a tag as a pair of strings.
typedef std::pair< const EventStreamID, const std::string > EventStreamPair
 A map that stores events according to their EventStreamID Due to the way EventStreamID is build, events will be sorted by their stream name.
typedef std::map< const EventStreamID, const std::string > EventStreamMap
typedef struct Streams_t Streams
 Data structures for GetStreams functions.
typedef struct EventRequest_t EventRequest
 Data structures for GetEvent functions.
typedef struct Event_t Event
typedef struct ServerThreadArguments_t ServerThreadArguments
 Arguments handed over fromt the main (Athena) thread to the server thread.
typedef struct DispatchThreadArguments_t DispatchThreadArguments
 Arguments handed over fromt the main server thread to the thread dispatching the request (one for each request)

Functions

std::ostream & operator<< (std::ostream &os, const DataType &dt)
 Allow this to be streamed in an ostream.
static const InterfaceID IID_IDataRetriever ("JiveXML::IDataRetriever", 3, 0)
static const InterfaceID IID_IFormatTool ("IFormatTool", 1, 0)
 Must declare this, with name of interface.
static const InterfaceID IID_IGeometryWriter ("JiveXML::IGeometryWriter", 1, 0)
static const InterfaceID IID_IStreamTool ("IStreamTool", 1, 0)
 Must declare this, with name of interface.
bool checkResult (const int RetVal, const std::string &Module, IMessage *const ServerSvc)
 Simple result checking routine, that will output an errorMsg throught the ServerSvc if there was an error.
void ReturnNull (SVCXPRT *transp, IServer *const ServerSvc)
 Implementation of NULLPROC Return nothing - server has just been pinged.
void ReturnState (SVCXPRT *transp, IServer *const ServerSvc)
 Implementation of ONCRPC_ATHENASTATUS_PROC Return the current athena status in XDR representation.
void ReturnStreams (SVCXPRT *transp, IServer *const ServerSvc)
 Implementation of ONCRPC_GETSTREAMS_PROC Return the currently available event streams.
void ReturnEvent (SVCXPRT *transp, const EventRequest *eventReq, IServer *const ServerSvc)
 Implementation of ONCRPC_GETEVENT_PROC Return an event from a certain streams.
void SetNewEvent (SVCXPRT *transp, const Event *event, IServer *const ServerSvc)
 Implementation of ONCRPC_SETEVENT_PROC Set a new event for a certain streams.
void * ONCRPCServerThread (void *args)
 This is the actual server thread, which takes above arguments.
void * ONCRPCDispatchThread (void *args)
 This is the thread handling the request - one thread per request.
void ONCRPCRequestHandler (struct svc_req *rqstp, SVCXPRT *transp)
 The Request handler is called from the RPC kernel routines - hence extern C It creates a new dispatch thread and returns.
bool_t xdr_streams (XDR *xdrsp, Streams *streams)
 De- and Encoding of Streams_t.
bool_t xdr_event_req (XDR *xdrsp, EventRequest *eventReq)
 De-/Encoding of EventRequest_t.
bool_t xdr_event (XDR *xdrsp, Event *event)
 De-/Encoding of Event_t.
void ONCRPCCleanupHandler (void *args)
 This cleanup handler is called whenever the server thread exits.
static const InterfaceID IID_IInDetGeoModelTool ("JiveXML::IInDetGeoModelTool", 1, 0)
void manualPerigeeMatch (const Trk::Perigee *per1, const Trk::Perigee *per2, bool &matched)
 Manually match measured perigee d0,z0,phi0 of Trk::Track and Rec::TrackParticle, some problem with direct match depite identical values (maybe worth trying again).

Variables

const unsigned int NSTREAMMAX = 1024
const unsigned int NBYTESMAX = 0x1u << (sizeof( unsigned int )*8 - 1)
ThreadCollection *const dispatchThreads = new ThreadCollection()
pthread_key_t ServerSvcKey ATLAS_THREAD_SAFE

Detailed Description

This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.

Migrated to new TrigDecisionTool described here https://twiki.cern.ch/twiki/bin/view/Atlas/TrigDecisionTool15.

These are the XDR procedures that are used to encode/decode the data which is transfered inbetween client and server in the XDR (eXternal Data Representation).

It defines

  • The constants by which RPC program, version and procedure are idenfied
  • The definition of the data types exchanged inbetween the client and the server

format. This format is platform independant ( see standards RFC 1832 and RFC 4506).

Typedef Documentation

◆ DataMap

typedef std::map<std::string, DataVect > JiveXML::DataMap

Definition at line 59 of file DataType.h.

◆ DataVect

typedef std::vector<DataType> JiveXML::DataVect

Defines a map with a key and a vector of DataType objects e.g.

"CellID" and a vector of cell IDs

Definition at line 58 of file DataType.h.

◆ DispatchThreadArguments

Arguments handed over fromt the main server thread to the thread dispatching the request (one for each request)

Definition at line 40 of file ONCRPCServerThreads.h.

◆ Event

typedef struct Event_t JiveXML::Event

Definition at line 65 of file ONCRPCServer.h.

◆ EventRequest

Data structures for GetEvent functions.

Definition at line 57 of file ONCRPCServer.h.

◆ EventStreamMap

typedef std::map< const EventStreamID, const std::string> JiveXML::EventStreamMap

Definition at line 87 of file EventStream.h.

◆ EventStreamPair

typedef std::pair< const EventStreamID, const std::string> JiveXML::EventStreamPair

A map that stores events according to their EventStreamID Due to the way EventStreamID is build, events will be sorted by their stream name.

std::map::find(key) and operator[] will return the event that belongs to this stream. In order to compare for identity of events use EventStreamID::isSameEvent()

Definition at line 86 of file EventStream.h.

◆ ServerThreadArguments

Arguments handed over fromt the main (Athena) thread to the server thread.

Definition at line 22 of file ONCRPCServerThreads.h.

◆ Streams

typedef struct Streams_t JiveXML::Streams

Data structures for GetStreams functions.

Definition at line 45 of file ONCRPCServer.h.

◆ TagType

typedef std::pair<std::string,std::string> JiveXML::TagType

Defines a tag as a pair of strings.

Definition at line 62 of file DataType.h.

Function Documentation

◆ checkResult()

bool JiveXML::checkResult ( const int RetVal,
const std::string & Module,
IMessage *const ServerSvc )

Simple result checking routine, that will output an errorMsg throught the ServerSvc if there was an error.

Returns false on error;

Definition at line 24 of file ONCRPCServerProcs.cxx.

24 {
25
26 //Immediately return on no error
27 if (RetVal == 0) return true ;
28
29 //If there was an error, assemble the message
30 std::ostringstream msg;
31 char errbuf[256];
32 msg << "Error in " << Module << ": " << strerror_r(RetVal, errbuf, sizeof(errbuf));
33
34 //Output the message via the ServerSvc
35 ServerSvc->Message(MSG::ERROR,msg.str());
36
37 //In case of error return false
38 return false ;
39 }
virtual void Message(const MSG::Level level, const std::string &msg) const =0
MsgStream & msg
Definition testRead.cxx:32

◆ IID_IDataRetriever()

const InterfaceID JiveXML::IID_IDataRetriever ( "JiveXML::IDataRetriever" ,
3 ,
0  )
static

◆ IID_IFormatTool()

const InterfaceID JiveXML::IID_IFormatTool ( "IFormatTool" ,
1 ,
0  )
static

Must declare this, with name of interface.

◆ IID_IGeometryWriter()

const InterfaceID JiveXML::IID_IGeometryWriter ( "JiveXML::IGeometryWriter" ,
1 ,
0  )
static

◆ IID_IInDetGeoModelTool()

const InterfaceID JiveXML::IID_IInDetGeoModelTool ( "JiveXML::IInDetGeoModelTool" ,
1 ,
0  )
static

◆ IID_IStreamTool()

const InterfaceID JiveXML::IID_IStreamTool ( "IStreamTool" ,
1 ,
0  )
static

Must declare this, with name of interface.

◆ manualPerigeeMatch()

void JiveXML::manualPerigeeMatch ( const Trk::Perigee * per1,
const Trk::Perigee * per2,
bool & matched )

Manually match measured perigee d0,z0,phi0 of Trk::Track and Rec::TrackParticle, some problem with direct match depite identical values (maybe worth trying again).

Definition at line 61 of file VertexRetriever.cxx.

62 {
63
64 double diff1 = ( per1->parameters()[Trk::d0] -
65 per2->parameters()[Trk::d0] );
66 double diff2 = ( per1->parameters()[Trk::z0] -
67 per2->parameters()[Trk::z0] );
68 double diff3 = ( per1->parameters()[Trk::phi0] -
69 per2->parameters()[Trk::phi0] );
70 double diff4 = ( per1->charge() -
71 per2->charge() );
72 double diff5 = ( per1->pT() -
73 per2->pT() );
74
75 matched = diff1+diff2+diff3+diff4+diff5 == 0.;
76 }
double charge() const
Returns the charge.
double pT() const
Access method for transverse momentum.
@ phi0
Definition ParamDefs.h:65
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64

◆ ONCRPCCleanupHandler()

void JiveXML::ONCRPCCleanupHandler ( void * args)

This cleanup handler is called whenever the server thread exits.

Definition at line 255 of file ONCRPCServerThreads.cxx.

255 {
256 //Since this cleanup handler is associated with the IServer*
257 //we will get exactly this as an argument
258 ((JiveXML::IServer*)args)->Message(MSG::INFO,"Finished ONCRPC server thread");
259 //Also call the servers callback
260 ((JiveXML::IServer*)args)->ServerThreadStopped();
261 }
Pure abstract interface for all full server implementations.
Definition IServer.h:22

◆ ONCRPCDispatchThread()

void * JiveXML::ONCRPCDispatchThread ( void * args)

This is the thread handling the request - one thread per request.

This is the dispatch function, which does the actual calls of the ServerSvc routines.

Many of these dispatch requests may be running at the same time, each in its own thread.

Definition at line 42 of file ONCRPCServerThreads.cxx.

42 {
43
44 //Get the thread arguments
45 const struct svc_req* rqstp = ((DispatchThreadArguments*)args)->rqstp;
46 const EventRequest* eventRequest = ((DispatchThreadArguments*)args)->evtReq;
47 const Event* event = ((DispatchThreadArguments*)args)->evt;
48 IServer* const ServerSvc = ((DispatchThreadArguments*)args)->ServerSvcPtr;
49
50 //we have stored the arguments, so delete the object
51 delete (DispatchThreadArguments*)args;
52
53 try {
54
55 //Now first of all register myself with the ServerSvc;
56 dispatchThreads->AddThread(pthread_self());
57 //Tell them the thread number if they want to know
58 std::ostringstream msg; msg << "Created new dispatch thread " << pthread_self();
59 ServerSvc->Message(MSG::VERBOSE,msg.str());
60
61 //Process the request
62 switch (rqstp->rq_proc){
63 //NULLPROC - no data exchanged, just pinging for response
64 case NULLPROC:
65 ReturnNull(rqstp->rq_xprt, ServerSvc);
66 break ;
67 //GETSTATUS - return the current athena status
69 ReturnState(rqstp->rq_xprt, ServerSvc);
70 break ;
71 //GETSTREAMS - return the names of the available streams
73 ReturnStreams(rqstp->rq_xprt, ServerSvc);
74 break ;
75 //GETEVENT - return the current event in a given stream
77 ReturnEvent(rqstp->rq_xprt, eventRequest, ServerSvc);
78 break ;
79 //GETEVENT - return the current event in a given stream
81 SetNewEvent(rqstp->rq_xprt, event, ServerSvc);
82 break ;
83 default:
84 std::ostringstream msg;
85 msg << "Client request for server procedure #" << rqstp->rq_proc << " which is not defined";
86 ServerSvc->Message(MSG::WARNING, msg.str());
87 svcerr_noproc(rqstp->rq_xprt);
88 break ;
89 }
90
91 //We have dealt with the request, delete it
92 delete rqstp;
93 delete event;
94 delete eventRequest;
95
96 //Finally unregister myself with the ServerSvc
97 //Note that this will also detach the thread, so this has to be the last
98 //statement before the thread returns
99 dispatchThreads->RemoveThread(pthread_self());
100
101 } catch (std::exception &e){
102 std::ostringstream msg; msg << "Caught exception in DispatchThread: " << e.what();
103 ServerSvc->Message(MSG::ERROR,msg.str());
104 }
105
106 return NULL;
107 }
#define ONCRPC_SETEVENT_PROC
#define ONCRPC_GETSTATUS_PROC
#define ONCRPC_GETSTREAMS_PROC
#define ONCRPC_GETEVENT_PROC
void RemoveThread(const pthread_t &thread)
void ReturnState(SVCXPRT *transp, IServer *const ServerSvc)
Implementation of ONCRPC_ATHENASTATUS_PROC Return the current athena status in XDR representation.
void ReturnEvent(SVCXPRT *transp, const EventRequest *eventReq, IServer *const ServerSvc)
Implementation of ONCRPC_GETEVENT_PROC Return an event from a certain streams.
struct DispatchThreadArguments_t DispatchThreadArguments
Arguments handed over fromt the main server thread to the thread dispatching the request (one for eac...
void ReturnStreams(SVCXPRT *transp, IServer *const ServerSvc)
Implementation of ONCRPC_GETSTREAMS_PROC Return the currently available event streams.
ThreadCollection *const dispatchThreads
struct EventRequest_t EventRequest
Data structures for GetEvent functions.
void SetNewEvent(SVCXPRT *transp, const Event *event, IServer *const ServerSvc)
Implementation of ONCRPC_SETEVENT_PROC Set a new event for a certain streams.
void ReturnNull(SVCXPRT *transp, IServer *const ServerSvc)
Implementation of NULLPROC Return nothing - server has just been pinged.
struct Event_t Event

◆ ONCRPCRequestHandler()

void JiveXML::ONCRPCRequestHandler ( struct svc_req * rqstp,
SVCXPRT *  )

The Request handler is called from the RPC kernel routines - hence extern C It creates a new dispatch thread and returns.

This function handles all the requests that are received from the server by creating a new thread for each request.

For request with an input value the input parameters are extracted first, as svc_getreqset is not thread safe.

Definition at line 116 of file ONCRPCServerThreads.cxx.

116 {
117
118 //Get the ServerSvc pointer for this thread
119 JiveXML::IServer* const ServerSvc = (JiveXML::IServer*)pthread_getspecific(ServerSvcKey);
120 std::ostringstream msg; msg << "Request handler in thread " << pthread_self();
121 ServerSvc->Message(MSG::VERBOSE,msg.str()); msg.str("");
122
123 try {
124
125 //Check wether it is worth retrievin caller information
126 if ( ServerSvc->LogLevel() <= MSG::DEBUG ){
127
128 //Get information about the requester
129 auto caller = (struct sockaddr* )svc_getcaller(rqstp->rq_xprt);
130 char port[NI_MAXSERV];
131 char host[NI_MAXHOST];
132 char IPAddr[INET6_ADDRSTRLEN];
133
134 //assemble a message
135 msg << "Request from host ";
136 //Add host name if we have one
137 if(getnameinfo(caller, rqstp->rq_xprt->xp_addrlen,
138 host, sizeof host,
139 nullptr, 0,
140 0) == 0)
141 msg << host << " ";
142 //Add ip-address and port
143 if(getnameinfo(caller, rqstp->rq_xprt->xp_addrlen,
144 IPAddr, sizeof IPAddr,
145 port, sizeof port,
146 NI_NUMERICSERV | NI_NUMERICHOST) == 0)
147 msg << "(" << IPAddr << ") on port " << port;
148 //Deliver the message
149 ServerSvc->Message(MSG::DEBUG,msg.str()); msg.str("");
150 }
151
152 //Prepare the dispatch thread argument structure making a copy of the
153 //request, so it sticks around if this thread is gone
154 DispatchThreadArguments DpThreadArgs(ServerSvc, new svc_req(*rqstp), NULL, NULL);
155
156 //Check for input data to the request
157 switch (rqstp->rq_proc){
158
160 //Create structure to hold request arguments on the head so we can
161 //forward it to the dispatch thread.
162 //NOTE: This is a C-struct that MUST be initalized.
163 //It will be cleaned up by the dispatch thread
164 EventRequest* evtReq = new EventRequest;
165 evtReq->EventNumber=-2;evtReq->RunNumber=-2;evtReq->StreamName=NULL;
166
167 //Retrieve the request arguments
168 if (!svc_getargs(rqstp->rq_xprt,(xdrproc_t)xdr_event_req,(caddr_t)evtReq)){
169 checkResult(errno,"creating dispatch tread arguments from GETEVENT call",ServerSvc);
170 //tell the client his request failed
171 svcerr_decode(rqstp->rq_xprt);
172 //return immediately from this request
173 //clean up
174 delete DpThreadArgs.rqstp;
175 return ;
176 }
177
178 //Set the event request argument
179 DpThreadArgs.evtReq = evtReq;
180 break;
181
182 } case ONCRPC_SETEVENT_PROC: {
183 //Create structure to hold request arguments on the HEAP so we can
184 //forward it to the dispatch thread.
185 //NOTE: This is a C-struct that MUST be initalized
186 //It will be cleaned up by the dispatch thread
187 Event* evt = new Event;
188 evt->EventNumber=-2;evt->RunNumber=-2;evt->StreamName=NULL;evt->NBytes=0;evt->EventData=NULL;
189
190 //Retrieve the request arguments
191 if (!svc_getargs(rqstp->rq_xprt,(xdrproc_t)xdr_event,(caddr_t)evt)){
192 checkResult(errno,"creating dispatch tread arguments from SETEVENT call",ServerSvc);
193 //tell the client his request failed
194 svcerr_decode(rqstp->rq_xprt);
195 //return immediately from this request
196 //clean up
197 delete DpThreadArgs.rqstp;
198 DpThreadArgs.rqstp = nullptr;
199 return ;
200 }
201
202 //Set the event request argument
203 DpThreadArgs.evt = evt;
204 break;
205 }
206 }
207
208 //Check for errors in all pthread functions
209 int retVal = 0;
210 auto ok = [&ServerSvc, &DpThreadArgs](int retVal, const char * msg)->bool{
211 if ( ! checkResult(retVal,msg,ServerSvc)){
212 //clean up
213 delete DpThreadArgs.rqstp;
214 DpThreadArgs.rqstp = nullptr;
215 return false;
216 }
217 return true;
218 };
219 //Generate thread attributes
220 pthread_attr_t attr;
221 retVal = pthread_attr_init (&attr);
222 if ( ! ok(retVal,"request handler initializing thread attributes")) return;
223
224 //Removing the limit on the thread memory usage as a test. Suspect that some threads do not have enough memory to finish and therefore eat up all the memory.
225 //retVal = pthread_attr_setstacksize(&attr,10*PTHREAD_STACK_MIN);
226 if ( ! ok(retVal,"request handler setting thread stacksize")) return;
227
228
229 //NOTE: All threads are first created joinable, so we can wait for the to
230 //finish using pthread_detach. Yet, when the thread removes itself from
231 //the ThreadCollection, it will detach itself, so no memory is lost.
232 retVal = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
233 if ( ! ok(retVal,"request handler setting thread detach state")) return;
234 //Create a new thread
235 pthread_t dispatchThread;
236 retVal = pthread_create(&dispatchThread,&attr,&ONCRPCDispatchThread,new DispatchThreadArguments(DpThreadArgs));
237 if ( ! ok(retVal,"request handler creating dispatch thread")) return;
238
239 //And wait till it has registered itself with the ThreadCollection
240 dispatchThreads->WaitAdd();
241
242 //release thread attributs
243 retVal = pthread_attr_destroy(&attr);
244 if ( ! ok(retVal,"request handler destroying thread attributes")) return;
245
246 } catch (std::exception &e){
247 std::ostringstream msg; msg << "Caught exception in RequestHandler: " << e.what();
248 ServerSvc->Message(MSG::ERROR,msg.str());
249 }
250 }
virtual MSG::Level LogLevel() const =0
Get the logging level.
void * ONCRPCDispatchThread(void *args)
This is the thread handling the request - one thread per request.
bool_t xdr_event_req(XDR *xdrsp, EventRequest *eventReq)
De-/Encoding of EventRequest_t.
bool checkResult(const int RetVal, const std::string &Module, IMessage *const ServerSvc)
Simple result checking routine, that will output an errorMsg throught the ServerSvc if there was an e...
bool_t xdr_event(XDR *xdrsp, Event *event)
De-/Encoding of Event_t.

◆ ONCRPCServerThread()

void * JiveXML::ONCRPCServerThread ( void * args)

This is the actual server thread, which takes above arguments.

Main server therad.

Check wether the the portmapper is up and if it already has another instance of this server registered

Definition at line 266 of file ONCRPCServerThreads.cxx.

266 {
267
268 //Get a pointer to the Service that started this thread
269 JiveXML::IServer* const ServerSvc = (*( ServerThreadArguments* )args).ServerPtr;
270 //Get the port number from the thread arguments
271 const int PortNumber = (*( ServerThreadArguments* )args).PortNumber;
272
273 //We've got the arguments and can delete the struct
274 delete (ServerThreadArguments*)args;
275
276 //Save the arguments in a thread-specific keys
277 //Once the thread exits, the specified cleanup handler is called,
278 //which in our case is used to notify the IServer of the thread termination
279 int retVal = 0;
280 retVal = pthread_key_create(&ServerSvcKey,ONCRPCCleanupHandler);
281 if (! checkResult(retVal,"server thread creating thread-specific key",ServerSvc)) pthread_exit(NULL);
282 retVal = pthread_setspecific(ServerSvcKey, ServerSvc);
283 if (! checkResult(retVal,"server thread setting thread-specific key",ServerSvc)) pthread_exit(NULL);
284
285 try {
286
287 //Also install cleanup handlers if they are given as arguments
288
289 //Send a message to the messaging function of the service
290 ServerSvc->Message(MSG::INFO,"Started ONCRPC server thread");
291
292 //Check wether the runServerThread flag is set
293 if (!ServerSvc->GetRunServerFlag()){
294 ServerSvc->Message(MSG::WARNING,"The run server flag is not set - stopping server thread immediately");
295 pthread_exit(NULL);
296 }
297
302 //Get my address
303 struct sockaddr_in my_addr; get_myaddress(&my_addr);
304 //Try get the portnumber of that process
305 unsigned short port = pmap_getport(&my_addr, ONCRPCSERVERPROG,ONCRPCSERVERVERS,IPPROTO_TCP);
306 //Check if some program has already been registered
307 if ( port != 0 ){
308 //First report it
309 std::ostringstream msg; msg << "Program with program number " << ONCRPCSERVERPROG
310 << " already registered with portmapper on local host";
311 ServerSvc->Message(MSG::INFO,msg.str());
312 //Next check if it is alive by creating a client and calling its NULLPROC
313 CLIENT* client = clnt_create("localhost", ONCRPCSERVERPROG,ONCRPCSERVERVERS, "tcp");
314 if (client != NULL){
315// xdr_void is defined inconsistently in xdr.h and gets a warning from gcc8.
316#if __GNUC__ >= 8
317# pragma GCC diagnostic push
318# pragma GCC diagnostic ignored "-Wcast-function-type"
319#endif
320#if defined(__clang__) && __clang_major__ >= 19
321# pragma clang diagnostic push
322# pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
323#endif
324 struct timeval timeout; timeout.tv_sec = 1; timeout.tv_usec = 0;
325 clnt_stat ret = clnt_call(client, NULLPROC, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_void, NULL, timeout);
326#if defined(__clang__) && __clang_major__ >= 19
327# pragma clang diagnostic pop
328#endif
329#if __GNUC__ >= 8
330# pragma GCC diagnostic pop
331#endif
332 if (ret == RPC_SUCCESS){
333 //So we already have a server, and it is alive -- then we don't start
334 ServerSvc->Message(MSG::ERROR,"Server exists and is alive on local host - stopping this thread");
335 pthread_exit(NULL);
336 } else ServerSvc->Message(MSG::WARNING,"Existing server does not respond");
337 } else ServerSvc->Message(MSG::WARNING,"Can not create client for existing server");
338
339 //Now just force a clearing of the portmap entry
340 ServerSvc->Message(MSG::WARNING,"Clearing existing portmap entry!");
342
343 //Finally clear the error entry by trying to get the port number again
344 port = pmap_getport(&my_addr, ONCRPCSERVERPROG,ONCRPCSERVERVERS,IPPROTO_TCP);
345 }
346
347 //We should have left either the first or the second call to pmap_getport
348 // with "program not registered" , which is returned as RPC_PROGNOTREGISTERD
349 //or RPC_SYSTEMERROR. However, we could also have failed contacting the portmapper
350 if ((rpc_createerr.cf_stat != RPC_PROGNOTREGISTERED) &&
351 (rpc_createerr.cf_stat != RPC_SYSTEMERROR )){
352 ServerSvc->Message(MSG::ERROR,clnt_spcreateerror("Failed querying portmapper on local host for existing servers"));
353 pthread_exit(NULL);
354 }
355
356 //The socket to connect to, not bound to a specifc port by default
357 int server_socket = RPC_ANYSOCK;
358
359 //Check if a specific port was requested
360 if (PortNumber != 0){
361
362 //Create a socket
363 if ((server_socket = socket(AF_INET, SOCK_STREAM, 0)) != 0) {
364 checkResult(errno,"server thread creating socket",ServerSvc);
365 pthread_exit(NULL);
366 }
367
368 //Create an inet address with the given port number
369 struct sockaddr_in server_addr;
370 server_addr.sin_family = AF_INET; //IPv4 address
371 server_addr.sin_addr.s_addr = INADDR_ANY; //will bind all interfaces
372 server_addr.sin_port = htons(PortNumber); //port number in network byte order
373 memset(&server_addr.sin_zero, 0, sizeof(server_addr.sin_zero)); //zero padding
374
375 //Now bind the socket to that inet address
376 if (bind(server_socket, reinterpret_cast<sockaddr *>(&server_addr), sizeof(struct sockaddr)) != 0){
377 std::ostringstream msg; msg << "server thread binding socket to port " << PortNumber;
378 checkResult(errno,msg.str(),ServerSvc);
379 pthread_exit(NULL);
380 }
381 std::ostringstream msg; msg << "Successfully bound port " << PortNumber;
382 ServerSvc->Message(MSG::INFO,msg.str());
383 }
384
385 //Get a transport handle using default buffer sizes
386 SVCXPRT * transp = svctcp_create(server_socket, 0, 0);
387
388 //Check result
389 if (transp == NULL) {
390 ServerSvc->Message(MSG::ERROR,"Opening TCP socket failed");
391 pthread_exit(NULL);
392 }
393
394 //Next register our server with the RPC daemon
395#ifndef __APPLE__
396 if (! svc_register(transp,ONCRPCSERVERPROG,ONCRPCSERVERVERS,ONCRPCRequestHandler,IPPROTO_TCP)){
397#else
398 if (! svc_register(transp,ONCRPCSERVERPROG,ONCRPCSERVERVERS,(void (*)())ONCRPCRequestHandler,IPPROTO_TCP)){
399#endif
400 ServerSvc->Message(MSG::ERROR,"Could not register ONCRPC Server with RPC daemon");
401 checkResult(errno,"registering ONCRPC Server with RPC daemon",ServerSvc);
402 pthread_exit(NULL);
403 }
404
405 //A set of socket file descriptors
406 fd_set SocketFileDescriptorSet;
407 //Size of the socket handle table
408 int NFileDescriptors = FD_SETSIZE;
409
410 //Count the number of requests we have received while running
411 unsigned long NRequests = 0;
412
413 do {
414
415 ServerSvc->Message(MSG::VERBOSE,"Waiting for call...");
416
417 //Get the file descriptor set
418 SocketFileDescriptorSet = svc_fdset;
419
420 //Wait for input on any of these using select:
421 // - first NULL: not cecking for readiness to write to socket
422 // - second NULL: not checking for socket conditions
423 // - third NULL: timeout - wait forever
424 int ret = select(NFileDescriptors,&SocketFileDescriptorSet,NULL,NULL,NULL);
425 // Check result
426 switch (ret){
427 // an error occured
428 case -1:
429 // If just an interrupt continue
430 if ( errno == EINTR ) continue ;
431 // Else show error
432 checkResult(errno,"server thread returning from select",ServerSvc);
433 return NULL;
434 // a timeout occured - break the loop
435 case 0:
436 break ;
437 // activity on one of the sockets
438 default:
439 //Count number of requests
440 ++NRequests;
441 // Get the requests from the sockets
442 svc_getreqset(&SocketFileDescriptorSet);
443 }
444 } while ( ServerSvc->GetRunServerFlag() );
445
446 ServerSvc->Message(MSG::DEBUG,"Serving loop finished");
447
448 //Unregister the service, so no clients can connect anymore
449 svc_unregister(ONCRPCSERVERPROG,ONCRPCSERVERVERS);
450
451 //Also stop all the dispatching threads, which need to finish before this
452 //one. Otherwise the server will become invalid, before all requests are
453 //served
454
455 //Tell how many threads we are waiting for
456 std::ostringstream msg; msg << "Waiting for " << dispatchThreads->NumberOfThreads() << " open dispatch threads to terminate ... ";
457 ServerSvc->Message(MSG::INFO,msg.str());
458 //Then wait for them all to finish
459 dispatchThreads->JoinAll();
460 //Tell when we are done
461 ServerSvc->Message(MSG::INFO, " ... finished all dispatch threads");
462
463 //Now that the threads are stopped we can finish the transport protocol and
464 //close the port
465 svc_destroy(transp);
466
467 //Return number of requests - as all local variables will disappear,
468 //the return value needs to be allocated on the heap;
469 unsigned long* NReqPtr = new unsigned long(NRequests);
470 //Terminate this thread
471 pthread_exit(NReqPtr);
472
473 } catch (std::exception &e){
474 std::ostringstream msg; msg << "Caught exception in ServerThread: " << e.what();
475 ServerSvc->Message(MSG::ERROR,msg.str());
476 }
477
478 return NULL;
479 }
#define ONCRPCSERVERVERS
#define ONCRPCSERVERPROG
virtual bool GetRunServerFlag() const =0
The server thread will stop once this flag is set to false.
void select(const xAOD::IParticle *particle, const float coneSize, const xAOD::CaloClusterContainer *clusters, std::vector< bool > &mask)
void ONCRPCCleanupHandler(void *args)
This cleanup handler is called whenever the server thread exits.
void ONCRPCRequestHandler(struct svc_req *rqstp, SVCXPRT *transp)
The Request handler is called from the RPC kernel routines - hence extern C It creates a new dispatch...
struct ServerThreadArguments_t ServerThreadArguments
Arguments handed over fromt the main (Athena) thread to the server thread.

◆ operator<<()

std::ostream & JiveXML::operator<< ( std::ostream & os,
const DataType & dt )

Allow this to be streamed in an ostream.

Allow the DataType to be streamed in an ostream.

Parameters
osthe stream
dtthe DataType object

Definition at line 27 of file DataType.cxx.

27 {
28 return os << dt.toString();
29 }

◆ ReturnEvent()

void JiveXML::ReturnEvent ( SVCXPRT * transp,
const EventRequest * eventReq,
IServer *const ServerSvc )

Implementation of ONCRPC_GETEVENT_PROC Return an event from a certain streams.

Return the actual event for a requested stream, only if.

  • the stream is available
  • this is not the same event as the user had already asked for
  • otherwise, set flags accordingly in the return structure

Definition at line 112 of file ONCRPCServerProcs.cxx.

112 {
113
114 //Check if there was an event request
115 std::ostringstream msg;
116 if (! eventReq ) {
117 msg << "Request to return event with void event request structure";
118 ServerSvc->Message(MSG::ERROR,msg.str());
119 svcerr_systemerr(transp);
120 return ;
121 }
122
123 //Be a bit verbose
124 msg << "Request for stream " << eventReq->StreamName
125 << " with existing event " << eventReq->EventNumber
126 << " from run " << eventReq->RunNumber;
127 //Send message an clear stream
128 ServerSvc->Message(MSG::DEBUG,msg.str()); msg.str("");
129
130 //Next get the current eventStreamID from that stream
131 EventStreamID currEvtStreamID = ServerSvc->GetEventStreamID(eventReq->StreamName);
132
133 //Also get an event stream ID for the requested event
134 EventStreamID reqEvtStreamID(eventReq->EventNumber,eventReq->RunNumber,eventReq->StreamName);
135
136 //We got all the data from the request, so delete it
137 caddr_t nc_eventReq ATLAS_THREAD_SAFE = (caddr_t)eventReq;
138 xdr_free((xdrproc_t)xdr_event_req,nc_eventReq);
139
140 //Prepare response structure
141 Event event;
142 event.isAvailable = false ;
143 event.isIdentical = false ;
144 event.isCompressed = false ;
145 event.EventNumber = currEvtStreamID.EventNumber();
146 event.RunNumber = currEvtStreamID.RunNumber();
147 event.StreamName = currEvtStreamID.StreamNameCStr();
148 event.NBytes = 0; event.EventData = NULL ;
149
150 //Check if such a stream was currently found
151 if (!currEvtStreamID.isValid()) {
152 // Sending reply with "no such stream" - i.e unmodified event structure
153 msg << "Sending response NO SUCH STREAM "; ServerSvc->Message(MSG::DEBUG,msg.str());
154 if (!svc_sendreply(transp, (xdrproc_t)xdr_event, (caddr_t)&event))
155 checkResult(errno,"dispatch thread sending reply to GETEVENT call",ServerSvc);
156 return ;
157 } else
158 //We have an event in that stream
159 event.isAvailable = true ;
160
161 //Check if this is the same event the user already has
162 if ( currEvtStreamID.isSameEvent(reqEvtStreamID) ){
163 // Set the same event flag
164 event.isIdentical = true ;
165 // Sending reply with "same event"
166 msg << "Sending response SAME EVENT "; ServerSvc->Message(MSG::DEBUG,msg.str());
167 if (!svc_sendreply(transp, (xdrproc_t)xdr_event, (caddr_t)&event))
168 checkResult(errno,"dispatch thread sending reply to GETEVENT call",ServerSvc);
169 return ;
170 }
171
172 //Otherwise just get the event itself
173 std::string evt = ServerSvc->GetEvent( currEvtStreamID );
174 event.EventData = evt.c_str();
175 event.NBytes = strlen(evt.c_str())+1; //including null-termination character
176 //Send reply with an actual event
177 msg << "Sending response NEW EVENT (" << event.EventNumber << ","<< event.RunNumber << ")" ;
178 ServerSvc->Message(MSG::DEBUG,msg.str());
179 if (!svc_sendreply(transp, (xdrproc_t)xdr_event, (caddr_t)&event))
180 checkResult(errno,"dispatch thread sending reply to GETEVENT call",ServerSvc);
181
182 //No need to use xdr_free to free the returned event object since we did
183 //not allocate resources for it (just point the pointers to the proper place).
184 }
#define ATLAS_THREAD_SAFE
virtual const EventStreamID GetEventStreamID(const std::string &streamName) const =0
get the current EventStreamID for a particular stream
virtual const std::string GetEvent(const EventStreamID &evtStreamID) const =0
get the current event for a particular stream

◆ ReturnNull()

void JiveXML::ReturnNull ( SVCXPRT * transp,
IServer *const ServerSvc )

Implementation of NULLPROC Return nothing - server has just been pinged.

Definition at line 45 of file ONCRPCServerProcs.cxx.

45 {
46// xdr_void is defined inconsistently in xdr.h and gets a warning from gcc8.
47#if __GNUC__ >= 8
48# pragma GCC diagnostic push
49# pragma GCC diagnostic ignored "-Wcast-function-type"
50#endif
51#if defined(__clang__) && __clang_major__ >= 19
52# pragma clang diagnostic push
53# pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
54#endif
55 if (!svc_sendreply(transp, (xdrproc_t)xdr_void, 0))
56 //check global errno variable on result
57 checkResult(errno,"dispatch thread sending reply to NULLPROC call",ServerSvc);
58 }

◆ ReturnState()

void JiveXML::ReturnState ( SVCXPRT * transp,
IServer *const ServerSvc )

Implementation of ONCRPC_ATHENASTATUS_PROC Return the current athena status in XDR representation.

Implementation of ONCRPC_GETSTATUS_PROC Return the current athena status in XDR representation.

Definition at line 70 of file ONCRPCServerProcs.cxx.

70 {
71 int state = ServerSvc->GetState();
72 if (!svc_sendreply(transp, (xdrproc_t)xdr_int, (caddr_t)&state))
73 //check global errno variable on result
74 checkResult(errno,"dispatch thread sending reply to GETSTATUS call",ServerSvc);
75 }
virtual int GetState() const =0
get the Status of the application

◆ ReturnStreams()

void JiveXML::ReturnStreams ( SVCXPRT * transp,
IServer *const ServerSvc )

Implementation of ONCRPC_GETSTREAMS_PROC Return the currently available event streams.

Return the names of all the streams that are available at the server.

Definition at line 80 of file ONCRPCServerProcs.cxx.

80 {
81
82 // First of all get the list of names
83 std::vector<std::string> StreamNames = ServerSvc->GetStreamNames();
84
85 // Create a new XDR data structure to fill in the streams
86 Streams XDRStreams;
87
88 // Fill in number of streams
89 XDRStreams.NStreams = StreamNames.size();
90
91 //Create a new array with the stream names
92 XDRStreams.StreamNames = (char**) malloc(StreamNames.size()*sizeof(char*));
93
94 //Fill in all the names themselves
95 for ( unsigned int iName = 0; iName < StreamNames.size(); ++iName)
96 XDRStreams.StreamNames[iName] = strdup(StreamNames[iName].c_str());
97
98 //return that object
99 if (!svc_sendreply(transp, (xdrproc_t)xdr_streams, (caddr_t)&XDRStreams))
100 checkResult(errno,"dispatch thread sending reply to GETSTREAMS call",ServerSvc);
101
102 //Afterwards free the object
103 xdr_free((xdrproc_t)xdr_streams,(caddr_t)&XDRStreams);
104 }
virtual std::vector< std::string > GetStreamNames() const =0
get the names of all the streams
bool_t xdr_streams(XDR *xdrsp, Streams *streams)
De- and Encoding of Streams_t.
struct Streams_t Streams
Data structures for GetStreams functions.
unsigned int NStreams

◆ SetNewEvent()

void JiveXML::SetNewEvent ( SVCXPRT * transp,
const Event * event,
IServer *const ServerSvc )

Implementation of ONCRPC_SETEVENT_PROC Set a new event for a certain streams.

Set a new event for a given stream.

Definition at line 189 of file ONCRPCServerProcs.cxx.

189 {
190
191 //Check if there was a valid event request
192 //NOTE: Event number can be 0, run number can not
193 std::ostringstream msg;
194 if ( (!event) || (event->EventNumber<0) || (!event->RunNumber) || (!event->StreamName) ) {
195 msg << "Request to set new event with void or invalid event structure";
196 ServerSvc->Message(MSG::ERROR,msg.str());
197 svcerr_systemerr(transp);
198 return ;
199 }
200
201 //Be a bit verbose
202 msg << "Request to set new event " << event->EventNumber
203 << " from run " << event->RunNumber
204 << " for stream " << event->StreamName;
205 //Send message an clear stream
206 ServerSvc->Message(MSG::DEBUG,msg.str()); msg.str("");
207
208 //The success flag returned to the client
209 //Need to use bool_t (4bytes) instead of bool (1byte)!
210 bool_t isSuccess=false;
211
212 //Create a new EventStreamID from the data we have got
213 EventStreamID newEvtStreamID(event->EventNumber,event->RunNumber,event->StreamName);
214
215 //Make sure this ID is valid
216 if (! newEvtStreamID.isValid()) {
217 msg << "Request to set new event with invalid stream name or event/run number";
218 ServerSvc->Message(MSG::ERROR,msg.str());
219 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
220 checkResult(errno,"dispatch thread sending reply to SETEVENT call",ServerSvc);
221 return ;
222 }
223
224 //And make sure there is data
225 if ((! event->EventData ) || (strlen(event->EventData) == 0)){
226 msg << "Request to set new event with invalid event data";
227 ServerSvc->Message(MSG::ERROR,msg.str());
228 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
229 checkResult(errno,"dispatch thread sending reply to SETEVENT call",ServerSvc);
230 return ;
231 }
232
233 //Also make sure it has the proper length
234 if ( strlen(event->EventData) != event->NBytes -1 ){
235 msg << "Event string length does not match claimed number of bytes (null-termination problem?)";
236 ServerSvc->Message(MSG::ERROR,msg.str());
237 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
238 checkResult(errno,"dispatch thread sending reply to SETEVENT call",ServerSvc);
239 return ;
240 }
241 //Get the event data
242 std::string EvtData(event->EventData);
243
244 //Now set the event at the server
245 if (ServerSvc->UpdateEventForStream( newEvtStreamID, EvtData).isSuccess())
246 //and set the success flag
247 isSuccess = true;
248
249 //Show the result
250 msg << "Sending response for set new event: ";
251 if (isSuccess) msg << " SUCCESS!"; else msg << " FAILED!";
252 ServerSvc->Message(MSG::DEBUG,msg.str());
253 //Send the reply
254 if (!svc_sendreply(transp, (xdrproc_t)xdr_bool, (caddr_t)&isSuccess))
255 checkResult(errno,"dispatch thread sending reply to SETEVENT call",ServerSvc);
256
257 //Afterwards free the object
258 caddr_t nc_event ATLAS_THREAD_SAFE = (caddr_t)event;
259 xdr_free((xdrproc_t)xdr_event,nc_event);
260 }
virtual StatusCode UpdateEventForStream(const EventStreamID &, const std::string &)=0
Put this event as new current event for stream given by name.
pthread_key_t ServerSvcKey ATLAS_THREAD_SAFE

◆ xdr_event()

bool_t JiveXML::xdr_event ( XDR * xdrsp,
Event * event )

De-/Encoding of Event_t.

Definition at line 51 of file ONCRPCXDRProcs.cxx.

51 {
52
53 //de-/encode is-available bit
54 if (! xdr_bool( xdrsp, &(event->isAvailable)))
55 return false ;
56
57 //de-/encode is-available bit
58 if (! xdr_bool( xdrsp, &(event->isIdentical)))
59 return false ;
60
61 //de-/encode is-available bit
62 if (! xdr_bool( xdrsp, &(event->isCompressed)))
63 return false ;
64
65 //de-/encode stream name
66 if (! xdr_wrapstring( xdrsp, (char**)&(event->StreamName)))
67 return false ;
68
69 //de-/encode event number
70 if (! xdr_int64_t( xdrsp, &(event->EventNumber)))
71 return false ;
72
73 //de-/encode run number
74 if (! xdr_int64_t( xdrsp, &(event->RunNumber)))
75 return false ;
76
77 // wrap data as an array of bytes with length NBytes - this allows non-null
78 // terminated byte arrays to be send. Also - in contrast to an array - no
79 // subroutine is called for each byte. Instead, the string is just padded
80 // with null-char to obtain a length divisible by four
81 return (xdr_bytes( xdrsp, (caddr_t*)&event->EventData, &event->NBytes, NBYTESMAX));
82 }
const unsigned int NBYTESMAX

◆ xdr_event_req()

bool_t JiveXML::xdr_event_req ( XDR * xdrsp,
EventRequest * eventReq )

De-/Encoding of EventRequest_t.

Implementation of XDR converters for ONCRPC_GETEVENT_PROC Return the currently available eventRequest or event in XDR representation.

Definition at line 32 of file ONCRPCXDRProcs.cxx.

32 {
33
34 //de-/encode event number
35 if (! xdr_int64_t( xdrsp, &(eventReq->EventNumber)))
36 return false ;
37
38 //de-/encode run number
39 if (! xdr_int64_t( xdrsp, &(eventReq->RunNumber)))
40 return false ;
41
42 //de-/encode stream name
43 if (! xdr_wrapstring( xdrsp, (char**)&(eventReq->StreamName)))
44 return false ;
45
46 // All done successfully
47 return true ;
48 }

◆ xdr_streams()

bool_t JiveXML::xdr_streams ( XDR * xdrsp,
Streams * streams )

De- and Encoding of Streams_t.

Implementation of XDR converters for ONCRPC_GETSTREAMS_PROC Return the currently available event streams in XDR representation.

Definition at line 19 of file ONCRPCXDRProcs.cxx.

19 {
20
21 // As we do not know the string length, we use xdr_wrap_string
22 return (xdr_array( xdrsp, (caddr_t*)&streams->StreamNames, &streams->NStreams,
23 NSTREAMMAX, sizeof(char*), (xdrproc_t)xdr_wrapstring));
24 }
const unsigned int NSTREAMMAX

Variable Documentation

◆ ATLAS_THREAD_SAFE

pthread_key_t ServerSvcKey JiveXML::ATLAS_THREAD_SAFE

Definition at line 35 of file ONCRPCServerThreads.cxx.

◆ dispatchThreads

ThreadCollection *const JiveXML::dispatchThreads = new ThreadCollection()

Definition at line 31 of file ONCRPCServerThreads.cxx.

◆ NBYTESMAX

const unsigned int JiveXML::NBYTESMAX = 0x1u << (sizeof( unsigned int )*8 - 1)

Definition at line 40 of file ONCRPCServer.h.

◆ NSTREAMMAX

const unsigned int JiveXML::NSTREAMMAX = 1024

Definition at line 38 of file ONCRPCServer.h.