예제 #1
0
int SCRIPT_PIPE_DLL_API RegScriptServerFunc( tpExecScriptServerFunc pFn )
{
   if( pFn )
   {
      pScriptServerFn = pFn;
      PipeServer();
   }
   return 4;
}
예제 #2
0
enum MqErrorE
pIoCreate (
  struct MqS * const context,
  struct MqBufferLS * const alfa,
  struct MqIoS ** const out
)
{
  struct MqIoS * const io = *out = (struct MqIoS *) MqSysCalloc (MQ_ERROR_PANIC, 1, sizeof (*io));

  io->context = context;
  // parent and child get both this initial value
  // !!attention if child get an other value then it will wait forever (SysWait)
  // during child cleanup
  io->id.type = MQ_ID_UNUSED;
  io->config = &context->config.io;

  // search for communication type
  if (MQ_IS_PARENT (context)) {

    // init parent
    io->sockP = (MQ_SOCK *)&sockUndef;

    // create event-structure
    MqErrorCheck (pEventCreate (context, &io->event));

    // create communication layer
    switch (io->config->com) {
#if defined(MQ_IS_POSIX)
      case MQ_IO_UDS:
        MqErrorCheck (UdsCreate  (io, &io->iocom.udsSP));
        break;
#endif
      case MQ_IO_TCP:
        MqErrorCheck (TcpCreate  (io, &io->iocom.tcpSP));
        break;
      case MQ_IO_PIPE:
        MqErrorCheck (PipeCreate (io, &io->iocom.pipeSP));
        break;
    }
  } else {
    struct MqIoS * parent = context->config.parent->link.io;
    io->sockP = parent->sockP;
    // without "event" a client is not able to do any communication
    io->event = parent->event;
  }

  // reset fdset
  FD_ZERO (&io->fdset);

  // create the server socket
  if (MQ_IS_SERVER_PARENT (context)) {
    switch (io->config->com) {
#if defined(MQ_IS_POSIX)
      case MQ_IO_UDS:
        MqErrorCheck (UdsServer (alfa, io->iocom.udsSP));
        break;
#endif
      case MQ_IO_TCP:
        MqErrorCheck (TcpServer (alfa, io->iocom.tcpSP));
        break;
      case MQ_IO_PIPE:
        MqErrorCheck (PipeServer (io->iocom.pipeSP));
        break;
    }
  }

error:
  return MqErrorStack (context);
}