Beispiel #1
0
int
pfinet_demuxer (mach_msg_header_t *inp,
                mach_msg_header_t *outp)
{
    struct port_info *pi;

    /* We have several classes in one bucket, which need to be demuxed
       differently.  */
    if (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) ==
            MACH_MSG_TYPE_PROTECTED_PAYLOAD)
        pi = ports_lookup_payload (pfinet_bucket,
                                   inp->msgh_protected_payload,
                                   socketport_class);
    else
        pi = ports_lookup_port (pfinet_bucket,
                                inp->msgh_local_port,
                                socketport_class);

    if (pi)
    {
        ports_port_deref (pi);

        mig_routine_t routine;
        if ((routine = io_server_routine (inp)) ||
                (routine = socket_server_routine (inp)) ||
                (routine = pfinet_server_routine (inp)) ||
                (routine = iioctl_server_routine (inp)) ||
                (routine = NULL, trivfs_demuxer (inp, outp)) ||
                (routine = startup_notify_server_routine (inp)))
        {
            if (routine)
                (*routine) (inp, outp);
            return TRUE;
        }
        else
            return FALSE;
    }
    else
    {
        mig_routine_t routine;
        if ((routine = socket_server_routine (inp)) ||
                (routine = pfinet_server_routine (inp)) ||
                (routine = iioctl_server_routine (inp)) ||
                (routine = NULL, trivfs_demuxer (inp, outp)) ||
                (routine = startup_notify_server_routine (inp)))
        {
            if (routine)
                (*routine) (inp, outp);
            return TRUE;
        }
        else
            return FALSE;
    }
}
Beispiel #2
0
/* A demuxer for socket operations.  */
static int
sock_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
{
  mig_routine_t routine;
  if ((routine = io_server_routine (inp)) ||
      (routine = socket_server_routine (inp)) ||
      (routine = ports_interrupt_server_routine (inp)) ||
      (routine = ports_notify_server_routine (inp)))
    {
      (*routine) (inp, outp);
      return TRUE;
    }
  else
    return FALSE;
}