root/source3/rpc_server/srv_echo_nt.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. _echo_AddOne
  2. _echo_EchoData
  3. _echo_SinkData
  4. _echo_SourceData
  5. _echo_TestCall
  6. _echo_TestCall2
  7. _echo_TestSleep
  8. _echo_TestEnum
  9. _echo_TestSurrounding
  10. _echo_TestDoublePointer

   1 /* 
   2  *  Unix SMB/CIFS implementation.
   3  *  RPC Pipe client / server routines for rpcecho
   4  *  Copyright (C) Tim Potter                   2003
   5  *  Copyright (C) Jelmer Vernooij              2006
   6  *  Copyright (C) Gerald (Jerry) Carter        2007
   7  *  
   8  *  This program is free software; you can redistribute it and/or modify
   9  *  it under the terms of the GNU General Public License as published by
  10  *  the Free Software Foundation; either version 3 of the License, or
  11  *  (at your option) any later version.
  12  *  
  13  *  This program is distributed in the hope that it will be useful,
  14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16  *  GNU General Public License for more details.
  17  *  
  18  *  You should have received a copy of the GNU General Public License
  19  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  20  */
  21 
  22 /* This is the interface to the rpcecho pipe. */
  23 
  24 #include "includes.h"
  25 
  26 #ifdef DEVELOPER
  27 
  28 #undef DBGC_CLASS
  29 #define DBGC_CLASS DBGC_RPC_SRV
  30 
  31 /* Add one to the input and return it */
  32 
  33 void _echo_AddOne(pipes_struct *p, struct echo_AddOne *r )
     /* [<][>][^][v][top][bottom][index][help] */
  34 {
  35         DEBUG(10, ("_echo_AddOne\n"));
  36 
  37         *r->out.out_data = r->in.in_data + 1;   
  38 }
  39 
  40 /* Echo back an array of data */
  41 
  42 void _echo_EchoData(pipes_struct *p, struct echo_EchoData *r)
     /* [<][>][^][v][top][bottom][index][help] */
  43 {
  44         DEBUG(10, ("_echo_EchoData\n"));
  45 
  46         if ( r->in.len == 0 ) {         
  47                 r->out.out_data = NULL;
  48                 return;
  49         }
  50 
  51         r->out.out_data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len);
  52         memcpy( r->out.out_data, r->in.in_data, r->in.len );
  53         return; 
  54 }
  55 
  56 /* Sink an array of data */
  57 
  58 void _echo_SinkData(pipes_struct *p, struct echo_SinkData *r)
     /* [<][>][^][v][top][bottom][index][help] */
  59 {
  60         DEBUG(10, ("_echo_SinkData\n"));
  61 
  62         /* My that was some yummy data! */
  63         return; 
  64 }
  65 
  66 /* Source an array of data */
  67 
  68 void _echo_SourceData(pipes_struct *p, struct echo_SourceData *r)
     /* [<][>][^][v][top][bottom][index][help] */
  69 {
  70         uint32 i;
  71 
  72         DEBUG(10, ("_echo_SourceData\n"));
  73 
  74         if ( r->in.len == 0 ) {
  75                 r->out.data = NULL;             
  76                 return;
  77         }
  78 
  79         r->out.data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len );
  80 
  81         for (i = 0; i < r->in.len; i++ ) {              
  82                 r->out.data[i] = i & 0xff;
  83         }
  84         
  85         return; 
  86 }
  87 
  88 void _echo_TestCall(pipes_struct *p, struct echo_TestCall *r)
     /* [<][>][^][v][top][bottom][index][help] */
  89 {
  90         p->rng_fault_state = True;
  91         return;
  92 }
  93 
  94 NTSTATUS _echo_TestCall2(pipes_struct *p, struct echo_TestCall2 *r)
     /* [<][>][^][v][top][bottom][index][help] */
  95 {
  96         p->rng_fault_state = True;
  97         return NT_STATUS_OK;
  98 }
  99 
 100 uint32 _echo_TestSleep(pipes_struct *p, struct echo_TestSleep *r)
     /* [<][>][^][v][top][bottom][index][help] */
 101 {
 102         p->rng_fault_state = True;
 103         return 0;
 104 }
 105 
 106 void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r)
     /* [<][>][^][v][top][bottom][index][help] */
 107 {
 108         p->rng_fault_state = True;
 109         return;
 110 }
 111 
 112 void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r)
     /* [<][>][^][v][top][bottom][index][help] */
 113 {
 114         p->rng_fault_state = True;
 115         return;
 116 }
 117 
 118 uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r)
     /* [<][>][^][v][top][bottom][index][help] */
 119 {
 120         p->rng_fault_state = True;
 121         return 0;
 122 }
 123 
 124 #endif /* DEVELOPER */

/* [<][>][^][v][top][bottom][index][help] */