⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _rx.c

📁 This directory contains source code for tcpdump, a tool for network monitoring and data acquisition
💻 C
📖 第 1 页 / 共 4 页
字号:
    PUTS (" errcode");
    INTOUT();
  }

  return;

trunc:
  PUTS (" [|vldb]");
}

/*
 * Handle calls to the AFS Kerberos Authentication service
 */

static void kauth_print (const u_char * bp, int length)
{
  int kauth_op;
  char s[AFSNAMEMAX];

  if (length <= sizeof(struct rx_header))
     return;

  if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t))
     goto trunc;

  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from kauth/kauth.rg
   */

  kauth_op = ntohl (*((int *) (bp + sizeof(struct rx_header))));

  PUTS (" kauth");

  if (is_ubik (kauth_op))
  {
    ubik_print (bp, length);
    return;
  }


  PRINTF (" call %s", tok2str (kauth_req, "op#%d", kauth_op));

  /*
   * Decode some of the arguments to the KA calls
   */

  bp += sizeof(struct rx_header) + 4;

  switch (kauth_op)
  {
    case 1:                  /* Authenticate old */ ;
    case 21:                /* Authenticate */
    case 22:                /* Authenticate-V2 */
    case 2:                  /* Change PW */
    case 5:                  /* Set fields */
    case 6:                  /* Create user */
    case 7:                  /* Delete user */
    case 8:                  /* Get entry */
    case 14:                /* Unlock */
    case 15:                /* Lock status */
         PUTS (" principal");
         STROUT (KANAMEMAX);
         STROUT (KANAMEMAX);
         break;
    case 3:                  /* GetTicket-old */
    case 23:                /* GetTicket */
         {
           int i;

           PUTS (" kvno");
           INTOUT();
           PUTS (" domain");
           STROUT (KANAMEMAX);
           TRUNC (sizeof(int32_t));
           i = (int) ntohl (*((int *) bp));
           bp += sizeof(int32_t);
           TRUNC (i);
           bp += i;
           PUTS (" principal");
           STROUT (KANAMEMAX);
           STROUT (KANAMEMAX);
           break;
         }
    case 4:                  /* Set Password */
         PUTS (" principal");
         STROUT (KANAMEMAX);
         STROUT (KANAMEMAX);
         PUTS (" kvno");
         INTOUT();
         break;
    case 12:                /* Get password */
         PUTS (" name");
         STROUT (KANAMEMAX);
         break;
    default:
         ;
  }

  return;

trunc:
  PUTS (" [|kauth]");
}

/*
 * Handle replies to the AFS Kerberos Authentication Service
 */

static void kauth_reply_print (const u_char * bp, int length, int32_t opcode)
{
  struct rx_header *rxh;

  if (length <= sizeof(struct rx_header))
    return;

  rxh = (struct rx_header *) bp;

  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from kauth/kauth.rg
   */

  PUTS (" kauth");

  if (is_ubik (opcode))
  {
    ubik_reply_print (bp, length, opcode);
    return;
  }

  PRINTF (" reply %s", tok2str (kauth_req, "op#%d", opcode));

  bp += sizeof(struct rx_header);

  /*
   * If it was a data packet, interpret the response.
   */

  if (rxh->type == RX_PACKET_TYPE_DATA)
    /* Well, no, not really.  Leave this for later */
    ;
  else
  {
    /*
     * Otherwise, just print out the return code
     */
    PUTS (" errcode");
    INTOUT();
  }

  return;

trunc:
  PUTS (" [|kauth]");
}

/*
 * Handle calls to the AFS Volume location service
 */

static void vol_print (const u_char * bp, int length)
{
  int vol_op;

  if (length <= sizeof(struct rx_header))
     return;

  if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t))
     goto trunc;

  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from volser/volint.xg
   */

  vol_op = ntohl (*((int *) (bp + sizeof(struct rx_header))));

  PRINTF (" vol call %s", tok2str (vol_req, "op#%d", vol_op));

  /*
   * Normally there would be a switch statement here to decode the
   * arguments to the AFS call, but since I don't have access to
   * an AFS server (yet) and I'm not an AFS admin, I can't
   * test any of these calls.  Leave this blank for now.
   */

  return;

trunc:
  PUTS (" [|vol]");
}

/*
 * Handle replies to the AFS Volume Service
 */

static void vol_reply_print (const u_char * bp, int length, int32_t opcode)
{
  struct rx_header *rxh;

  if (length <= sizeof(struct rx_header))
     return;

  rxh = (struct rx_header *) bp;

  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from volser/volint.xg
   */

  PRINTF (" vol reply %s", tok2str (vol_req, "op#%d", opcode));

  bp += sizeof(struct rx_header);

  /*
   * If it was a data packet, interpret the response.
   */

  if (rxh->type == RX_PACKET_TYPE_DATA)
    /* Well, no, not really.  Leave this for later */
    ;
  else
  {
    /*
     * Otherwise, just print out the return code
     */
    PUTS (" errcode");
    INTOUT();
  }

  return;

trunc:
  PUTS (" [|vol]");
}

/*
 * Handle calls to the AFS BOS service
 */

static void bos_print (const u_char * bp, int length)
{
  int bos_op;
  char s[BOSNAMEMAX];

  if (length <= sizeof(struct rx_header))
     return;

  if (snapend - bp + 1 <= sizeof(struct rx_header) + sizeof(int32_t))
     goto trunc;
 
  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from bozo/bosint.xg
   */

  bos_op = ntohl (*((int *) (bp + sizeof(struct rx_header))));

  PRINTF (" bos call %s", tok2str (bos_req, "op#%d", bos_op));

  /*
   * Decode some of the arguments to the BOS calls
   */

  bp += sizeof(struct rx_header) + 4;

  switch (bos_op)
  {
    case 80:                /* Create B node */
         PUTS (" type");
         STROUT (BOSNAMEMAX);
         PUTS (" instance");
         STROUT (BOSNAMEMAX);
         break;
    case 81:                /* Delete B node */
    case 83:                /* Get status */
    case 85:                /* Get instance info */
    case 87:                /* Add super user */
    case 88:                /* Delete super user */
    case 93:                /* Set cell name */
    case 96:                /* Add cell host */
    case 97:                /* Delete cell host */
    case 104:                /* Restart */
    case 106:                /* Uninstall */
    case 108:                /* Exec */
    case 112:                /* Getlog */
    case 114:                /* Get instance strings */
         STROUT (BOSNAMEMAX);
         break;
    case 82:                /* Set status */
    case 98:                /* Set T status */
         STROUT (BOSNAMEMAX);
         PUTS (" status");
         INTOUT();
         break;
    case 86:                /* Get instance parm */
         STROUT (BOSNAMEMAX);
         PUTS (" num");
         INTOUT();
         break;
    case 84:                /* Enumerate instance */
    case 89:                /* List super users */
    case 90:                /* List keys */
    case 91:                /* Add key */
    case 92:                /* Delete key */
    case 95:                /* Get cell host */
         INTOUT();
         break;
    case 105:                /* Install */
         STROUT (BOSNAMEMAX);
         PUTS (" size");
         INTOUT();
         PUTS (" flags");
         INTOUT();
         PUTS (" date");
         INTOUT();
         break;
    default:
         ;
  }

  return;

trunc:
  PUTS (" [|bos]");
}

/*
 * Handle replies to the AFS BOS Service
 */

static void bos_reply_print (const u_char * bp, int length, int32_t opcode)
{
  struct rx_header *rxh;

  if (length <= sizeof(struct rx_header))
    return;

  rxh = (struct rx_header *) bp;

  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from volser/volint.xg
   */

  PRINTF (" bos reply %s", tok2str (bos_req, "op#%d", opcode));

  bp += sizeof(struct rx_header);

  /*
   * If it was a data packet, interpret the response.
   */

  if (rxh->type == RX_PACKET_TYPE_DATA)
    /* Well, no, not really.  Leave this for later */
    ;
  else
  {
    /*
     * Otherwise, just print out the return code
     */
    PUTS (" errcode");
    INTOUT();
  }

  return;

trunc:
  PUTS (" [|bos]");
}


/*
 * Handle Ubik opcodes to any one of the replicated database services
 */
static void ubik_print (const u_char * bp, int length)
{
  int     ubik_op;
  int32_t temp;

  /*
   * Print out the afs call we're invoking.  The table used here was
   * gleaned from ubik/ubik_int.xg
   */

  ubik_op = ntohl (*((int *) (bp + sizeof(struct rx_header))));

  PRINTF (" ubik call %s", tok2str (ubik_req, "op#%d", ubik_op));

  /*
   * Decode some of the arguments to the Ubik calls
   */

  bp += sizeof(struct rx_header) + 4;

  switch (ubik_op)
  {
    case 10000:              /* Beacon */
         TRUNC (4);
         temp = ntohl (*((int *) bp));
         bp += sizeof(int32_t);
         PRINTF (" syncsite %s", temp ? "yes" : "no");
         PUTS (" votestart");
         DATEOUT();
         PUTS (" dbversion");
         UBIK_VERSIONOUT();
         PUTS (" tid");
         UBIK_VERSIONOUT();
         break;
    case 10003:              /* Get sync site */
         PUTS (" site");
         UINTOUT();
         break;
    case 20000:              /* Begin */
    case 20001:              /* Commit */
    case 20007:              /* Abort */
    case 20008:              /* Release locks */
    case 20010:              /* Writev */
         PUTS (" tid");
         UBIK_VERSIONOUT();
         break;
    case 20002:              /* Lock */
         PUTS (" tid");
         UBIK_VERSIONOUT();
         PUTS (" file");
         INTOUT();
         PUTS (" pos");
         INTOUT();
         PUTS (" length");
         INTOUT();
         temp = ntohl (*((int *) bp));
         bp += sizeof(int32_t);
         tok2str (ubik_lock_types, "type %d", temp);
         break;
    case 20003:              /* Write */
         PUTS (" tid");
         UBIK_VERSIONOUT();
         PUTS (" file");
         INTOUT();
         PUTS (" pos");
         INTOUT();
         break;
    case 20005:              /* Get file */
         PUTS (" file");
         INTOUT();
         break;
    case 20006:              /* Send file */
         PUTS (" file");
         INTOUT();
         PUTS (" length");
         INTOUT();
         PUTS (" dbversion");
         UBIK_VERSIONOUT();
         break;
    case 20009:              /* Truncate */
         PUTS (" tid");
         UBIK_VERSIONOUT();
         PUTS (" file");
         INTOUT();
         PUTS (" length");
         INTOUT();
         break;
    case 20012:              /* Set version */
         PUTS (" tid");
         UBIK_VERSIONOUT();
         PUTS (" oldversion");
         UBIK_VERSIONOUT();
         PUTS (" newversion");
         UBIK_VERSIONOUT();
         break;
    default:
         ;
  }

  return;

trunc:
  PUTS (" [|ubik]");
}

/*
 * Handle Ubik replies to any one of the replicated database services
 */

static void ubik_reply_print (const u_char * bp, int length, int32_t opcode)
{
  struct rx_header *rxh;

  if (length < sizeof(struct rx_header))
    return;

  rxh = (struct rx_header *) bp;

  /*
   * Print out the ubik call we're invoking.  This table was gleaned
   * from ubik/ubik_int.xg
   */

  PRINTF (" ubik reply %s", tok2str (ubik_req, "op#%d", opcode));

  bp += sizeof(struct rx_header);

  /*
   * If it was a data packet, print out the arguments to the Ubik calls
   */

  if (rxh->type == RX_PACKET_TYPE_DATA)
    switch (opcode)
    {
      case 10000:            /* Beacon */
           PUTS (" vote no");
           break;
      case 20004:            /* Get version */
           PUTS (" dbversion");
           UBIK_VERSIONOUT();
           break;
      default:
           ;
    }

  /*
   * Otherwise, print out "yes" it it was a beacon packet (because
   * that's how yes votes are returned, go figure), otherwise
   * just print out the error code.
   */

  else
    switch (opcode)
    {
      case 10000:            /* Beacon */
           PUTS (" vote yes until");
           DATEOUT();
           break;
      default:
           PUTS (" errcode");
           INTOUT();
    }

  return;

trunc:
  PUTS (" [|ubik]");
}

#endif  /* OLD_RX_PRINTER */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -