"Fossies" - the Fresh Open Source Software Archive

Member "mod_ntlm2-0.1/smbval/rfcnb-priv.h" (21 Feb 2003, 3740 Bytes) of package /linux/www/apache_httpd_modules/old/mod_ntlm2-0.1.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* mod_ntlm file: $Id: rfcnb-priv.h,v 1.3 2003/02/21 01:55:14 casz Exp $ */
    2 
    3 #ifndef RFCNB_PRIV_H
    4 #define RFCNB_PRIV_H
    5 
    6 /* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation
    7  * 
    8  * Version 1.0 RFCNB Defines
    9  * 
   10  * Copyright (C) Richard Sharpe 1996
   11  * 
   12  */
   13 
   14 /* 
   15  * This program is free software; you can redistribute it and/or modify it 
   16  * under the terms of the GNU General Public License as published by the
   17  * Free Software Foundation; either version 2 of the License, or (at your
   18  * option) any later version.  This program is distributed in the hope
   19  * that it will be useful, but WITHOUT ANY WARRANTY; without even the
   20  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
   21  * PURPOSE.  See the GNU General Public License for more details.  You
   22  * should have received a copy of the GNU General Public License along
   23  * with this program; if not, write to the Free Software Foundation, Inc., 
   24  * 675 Mass Ave, Cambridge, MA 02139, USA. */
   25 
   26 /* Defines we need */
   27 
   28 #define GLOBAL extern
   29 
   30 #include "rfcnb-error.h"
   31 #include "rfcnb-common.h"
   32 #include "byteorder.h"
   33 
   34 #ifdef RFCNB_PORT
   35 #define RFCNB_Default_Port RFCNB_PORT
   36 #else
   37 #define RFCNB_Default_Port 139
   38 #endif
   39 
   40 #define RFCNB_MAX_STATS 1
   41 
   42 /* Protocol defines we need */
   43 
   44 #define RFCNB_SESSION_MESSAGE 0
   45 #define RFCNB_SESSION_REQUEST 0x81
   46 #define RFCNB_SESSION_ACK 0x82
   47 #define RFCNB_SESSION_REJ 0x83
   48 #define RFCNB_SESSION_RETARGET 0x84
   49 #define RFCNB_SESSION_KEEP_ALIVE 0x85
   50 
   51 /* Structures      */
   52 
   53 typedef struct redirect_addr *redirect_ptr;
   54 
   55 struct redirect_addr {
   56 
   57     struct in_addr ip_addr;
   58     int port;
   59     redirect_ptr next;
   60 
   61 };
   62 
   63 typedef struct RFCNB_Con {
   64 
   65     int fd;                     /* File descripter for TCP/IP connection */
   66     int rfc_errno;              /* last error                            */
   67     int timeout;                /* How many milli-secs before IO times out 
   68                                  */
   69     int redirects;              /* How many times we were redirected     */
   70     struct redirect_addr *redirect_list;        /* First is first address */
   71     struct redirect_addr *last_addr;
   72 
   73 } RFCNB_Con;
   74 
   75 typedef char RFCNB_Hdr[4];      /* The header is 4 bytes long with  */
   76                                     /* char[0] as the type, char[1] the */
   77                                     /* flags, and char[2..3] the length */
   78 
   79 /* Macros to extract things from the header. These are for portability
   80  * between architecture types where we are worried about byte order     */
   81 
   82 #define RFCNB_Pkt_Hdr_Len        4
   83 #define RFCNB_Pkt_Sess_Len       72
   84 #define RFCNB_Pkt_Retarg_Len     10
   85 #define RFCNB_Pkt_Nack_Len       5
   86 #define RFCNB_Pkt_Type_Offset    0
   87 #define RFCNB_Pkt_Flags_Offset   1
   88 #define RFCNB_Pkt_Len_Offset     2      /* Length is 2 bytes plus a flag
   89                                          * bit */
   90 #define RFCNB_Pkt_N1Len_Offset   4
   91 #define RFCNB_Pkt_Called_Offset  5
   92 #define RFCNB_Pkt_N2Len_Offset   38
   93 #define RFCNB_Pkt_Calling_Offset 39
   94 #define RFCNB_Pkt_Error_Offset   4
   95 #define RFCNB_Pkt_IP_Offset      4
   96 #define RFCNB_Pkt_Port_Offset    8
   97 
   98 /* The next macro isolates the length of a packet, including the bit in
   99  * the flags
  100  *     */
  101 
  102 #define RFCNB_Pkt_Len(p)  (PVAL((p), 3) | (PVAL((p), 2) << 8) |     \
  103                           ((PVAL((p), RFCNB_Pkt_Flags_Offset) & 0x01) << 16))
  104 
  105 #define RFCNB_Put_Pkt_Len(p, v) ((p)[1] = (((v) >> 16) & 1)); \
  106                                 ((p)[2] = (((v) >> 8) & 0xFF)); \
  107                                 ((p)[3] = ((v) & 0xFF));
  108 
  109 #define RFCNB_Pkt_Type(p) (CVAL((p), RFCNB_Pkt_Type_Offset))
  110 
  111 /* Static variables */
  112 
  113 /* Only declare this if not defined */
  114 
  115 #ifndef RFCNB_ERRNO
  116 static int RFCNB_errno;
  117 static int RFCNB_saved_errno;   /* Save this from point of error */
  118 #endif
  119 
  120 #endif