Print this page
6282 ONBLD man pages not pbchk clean
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Josef Sipek <jeffpc@josefsipek.net>

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/ndrgen/ndrgen.1onbld
          +++ new/usr/src/tools/ndrgen/ndrgen.1onbld
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15  .\" If applicable, add the following below this CDDL HEADER, with the
  16   16  .\" fields enclosed by brackets "[]" replaced with your own identifying
  17   17  .\" information: Portions Copyright [yyyy] [name of copyright owner]
  18   18  .\"
  19   19  .\" CDDL HEADER END
  20   20  .\"
  21   21  .\" Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  22   22  .\" Use is subject to license terms.
  23   23  .\"
  24   24  '\" te
  25      -.TH ndrgen 1ONBLD "22 October 2007" "SunOS 5.11" "User Commands"
       25 +.TH NDRGEN 1ONBLD "Oct 22, 2007"
  26   26  .SH NAME
  27   27  ndrgen \- NDL RPC protocol compiler
  28   28  .SH SYNOPSIS
  29   29  .LP
  30   30  .nf
  31   31  \fBndrgen\fR [ -Y \fIcpp-path\fR ] \fIfile\fR [ \fIfile\fR ] \&.\|.\|.
  32   32  .fi
  33   33  
  34   34  .SH DESCRIPTION
  35      -.sp
  36   35  .LP
  37   36  The \fBndrgen\fR utility is a tool that generates C code to implement a DCERPC/MSRPC Network Data Representation (NDR) protocol. The input to \fBndrgen\fR is a language similar to C known as Network Data Language (NDL).
  38   37  .sp
  39   38  .LP
  40   39  The \fBndrgen\fR utility takes an input protocol definition file and generates an output C source file that contains the marshalling routines to implement the RPC protocol. If the input file is named \fBproto.ndl\fR, \fBndrgen\fR generates NDR routines in \fBproto_ndr.c\fR. Applications must define the service definition and server-side stub table for use with the RPC protocol.
  41   40  .sp
  42   41  .LP
  43   42  The following is an example stub table and service definition:
  44   43  .sp
  45   44  .in +2
↓ open down ↓ 79 lines elided ↑ open up ↑
 125  124  2.
 126  125  DCE RPC uses application provided heaps to support operations. A heap is a managed chunk of memory that NDR manages as it allocates. When the operation and its result are complete, the heap is disposed of as a single item. Transactions, which are the anchor of most operations, perform heap bookkeeping.
 127  126  .sp
 128  127  ONC RPC uses \fBmalloc()\fR liberally throughout its run-time system. To free results, ONC RPC supports an \fBXDR_FREE\fR operation that traverses data structures freeing memory as it goes.
 129  128  .RE
 130  129  .sp
 131  130  .LP
 132  131  The following terminology is used in the subsequent discussion of NDR.
 133  132  .sp
 134  133  .ne 2
 135      -.mk
 136  134  .na
 137  135  \fBSize\fR
 138  136  .ad
 139  137  .sp .6
 140  138  .RS 4n
 141  139  The size of an array in elements, such as the amount to \fBmalloc()\fR.
 142  140  .RE
 143  141  
 144  142  .sp
 145  143  .ne 2
 146      -.mk
 147  144  .na
 148  145  \fBLength\fR
 149  146  .ad
 150  147  .sp .6
 151  148  .RS 4n
 152  149  The number of significant elements of an array.
 153  150  .RE
 154  151  
 155  152  .sp
 156  153  .ne 2
 157      -.mk
 158  154  .na
 159  155  \fBKnown\fR
 160  156  .ad
 161  157  .sp .6
 162  158  .RS 4n
 163  159  Size or Length is known at build time.
 164  160  .RE
 165  161  
 166  162  .sp
 167  163  .ne 2
 168      -.mk
 169  164  .na
 170  165  \fBDetermined\fR
 171  166  .ad
 172  167  .sp .6
 173  168  .RS 4n
 174  169  Size or Length is determined at run time.
 175  170  .RE
 176  171  
 177  172  .sp
 178  173  .ne 2
 179      -.mk
 180  174  .na
 181  175  \fBFixed\fR
 182  176  .ad
 183  177  .sp .6
 184  178  .RS 4n
 185  179  The Size and Length are Known, such as a string constant:
 186  180  .sp
 187  181  .in +2
 188  182  .nf
 189  183  char array[] = "A constant Size/Length";
 190  184  .fi
 191  185  .in -2
 192  186  
 193  187  .RE
 194  188  
 195  189  .sp
 196  190  .LP
 197  191  The following DCE RPC terminology is used in the subsequent discussion.
 198  192  .sp
 199  193  .ne 2
 200      -.mk
 201  194  .na
 202  195  \fBConformant\fR
 203  196  .ad
 204  197  .sp .6
 205  198  .RS 4n
 206  199  The Size is Determined. The Length is the same as Size.
 207  200  .sp
 208  201  
 209  202  .RE
 210      -
 211  203  .sp
 212  204  .ne 2
 213      -.mk
      205 +
 214  206  .na
 215  207  \fBVarying\fR
 216  208  .ad
 217  209  .sp .6
 218  210  .RS 4n
 219  211  The Size is Known. The Length is Determined, such as a \fBstrcpy()\fR of a variable length string into a fixed length buffer:
 220  212  .sp
 221  213  .in +2
 222  214  .nf
 223  215  char array[100];
 224  216  strcpy(array, "very short string");
 225  217  .fi
 226  218  .in -2
 227  219  
 228  220  .RE
 229  221  
 230  222  .sp
 231  223  .ne 2
 232      -.mk
 233  224  .na
 234  225  \fBVarying and Conformant\fR
 235  226  .ad
 236  227  .sp .6
 237  228  .RS 4n
 238  229  The Size is Determined. The Length is separately Determined, such as:
 239  230  .sp
 240  231  .in +2
 241  232  .nf
 242  233  char *array = malloc(size);
 243  234  strcpy(array, "short string");
 244  235  .fi
 245  236  .in -2
 246  237  
 247  238  .RE
 248  239  
 249  240  .SS "Strings"
 250      -.sp
 251  241  .LP
 252  242  DCE RPC strings are represented as varying or varying and conformant one-dimensional arrays. Characters can be single-byte or multi-byte as long as all characters conform to a fixed element size. For instance, UCS-2 is valid, but UTF-8 is not a valid DCE RPC string format. The string is terminated by a null character of the appropriate element size.
 253  243  .sp
 254  244  .LP
 255  245  MSRPC strings are always varying and conformant format and not null terminated. This format uses the \fIsize_is\fR, \fIfirst_is\fR, and \fIlength_is\fR attributes:
 256  246  .sp
 257  247  .in +2
 258  248  .nf
 259  249  typedef struct string {
 260  250     DWORD size_is;
↓ open down ↓ 37 lines elided ↑ open up ↑
 298  288     WORD maxlen;
 299  289     LPTSTR str;
 300  290  } msrpc_string_t;
 301  291  .fi
 302  292  .in -2
 303  293  
 304  294  .sp
 305  295  .LP
 306  296  Here, \fIlength\fR is the array length in bytes excluding any terminating null bytes and \fImaxlen\fR is the array length in bytes including the terminating null bytes.
 307  297  .SS "NDL Syntax"
 308      -.sp
 309  298  .LP
 310  299  The \fBndrgen\fR input must be a valid C header file. Thus, NDL is defined by using macros to map to DCE RPC IDL. The following shows the mappings:
 311  300  .sp
 312  301  .in +2
 313  302  .nf
 314  303  NDRGEN NDL      DCE RPC IDL
 315  304  ================================
 316  305  OPERATION(X)    [operation(X)]
 317  306  IN              [in]
 318  307  OUT             [out]
↓ open down ↓ 24 lines elided ↑ open up ↑
 343  332  WORD            unsigned short
 344  333  DWORD           unsigned long
 345  334  LPTSTR          wchar_t *
 346  335  LPBYTE          unsigned char *
 347  336  LPWORD          unsigned short *
 348  337  LPDWORD         unsigned long *
 349  338  .fi
 350  339  .in -2
 351  340  
 352  341  .SH OPTIONS
 353      -.sp
 354  342  .LP
 355  343  The \fBsmbutil\fR command supports the following global option:
 356  344  .sp
 357  345  .ne 2
 358      -.mk
 359  346  .na
 360  347  \fB\fB-Y\fR\fR
 361  348  .ad
 362  349  .RS 13n
 363      -.rt  
 364  350  Specifies the path to the \fBcpp\fR program.
 365  351  .RE
 366  352  
 367  353  .SH EXAMPLES
 368      -.sp
 369  354  .LP
 370  355  The following is an example NDL header file:
 371  356  .sp
 372  357  .in +2
 373  358  .nf
 374  359  #ifndef _SVC_NDL_
 375  360  #define _SVC_NDL_
 376  361  
 377  362  #include "ndrtypes.ndl"
 378  363  
↓ open down ↓ 75 lines elided ↑ open up ↑
 454  439     struct svc_write net_write;
 455  440  };
 456  441  typedef union svc_interface svc_interface_t;
 457  442  EXTERNTYPEINFO(svc_interface)
 458  443  
 459  444  #endif /* _SVC_NDL_ */
 460  445  .fi
 461  446  .in -2
 462  447  
 463  448  .SH EXIT STATUS
 464      -.sp
 465  449  .LP
 466  450  The following exit values are returned:
 467  451  .sp
 468  452  .ne 2
 469      -.mk
 470  453  .na
 471  454  \fB0\fR
 472  455  .ad
 473  456  .RS 13n
 474      -.rt  
 475  457  Successful operation.
 476  458  .RE
 477  459  
 478  460  .sp
 479  461  .ne 2
 480      -.mk
 481  462  .na
 482  463  \fB>0\fR
 483  464  .ad
 484  465  .RS 13n
 485      -.rt  
 486  466  An error occurred.
 487  467  .RE
 488  468  
 489  469  .SH ATTRIBUTES
 490      -.sp
 491      -.LP
 492  470  See the \fBattributes\fR(5) man page for descriptions of the following attributes:
 493  471  .sp
 494  472  
 495  473  .sp
 496  474  .TS
 497      -tab() box;
 498      -cw(2.75i) |cw(2.75i) 
 499      -lw(2.75i) |lw(2.75i) 
 500      -.
 501      -ATTRIBUTE TYPEATTRIBUTE VALUE
      475 +box;
      476 +cw | cw
      477 +lw | lw .
      478 +ATTRIBUTE TYPE  ATTRIBUTE VALUE
 502  479  _
 503      -AvailabilitySUNWbtool
      480 +Availability    SUNWbtool
 504  481  .TE
 505  482  
 506  483  .SH SEE ALSO
 507      -.sp
 508  484  .LP
 509  485  \fBcpp\fR(1), \fBrpcgen\fR(1), \fBcc\fR(1B), \fBattributes\fR(5)
 510  486  .SH BUGS
 511      -.sp
 512  487  .LP
 513  488  Some \fBcpp\fR(1) macros used by \fBndrgen\fR are not understood by \fB/usr/bin/cpp\fR or \fB/usr/sfw/bin/cpp\fR. Simple NDL files generally do not pose a problem. If problems occur, for example, when using unions, use \fB/usr/libexec/cpp\fR or \fBcw\fR.
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX