Index: trunk/lib/smb_deps.c
===================================================================
--- trunk/lib/smb_deps.c	(revision 132)
+++ trunk/lib/smb_deps.c	(revision 134)
@@ -142,416 +142,2 @@
 
 /* End of stuff from lib/time.c */
-
-/* From parse_prs.c */
-
-/*******************************************************************
- Attempt, if needed, to grow a data buffer.
- Also depends on the data stream mode (io).
- ********************************************************************/
-bool prs_grow(prs_struct *ps, uint32 extra_space)
-{
-  uint32 new_size;
-  char *new_data;
-  
-  ps->grow_size = MAX(ps->grow_size, ps->data_offset + extra_space);
-  
-  if(ps->data_offset + extra_space <= ps->buffer_size)
-    return true;
-  
-  /*
-   * We cannot grow the buffer if we're not reading
-   * into the prs_struct, or if we don't own the memory.
-   */
-  
-  if(ps->io || !ps->is_dynamic)
-    return false;
-  
-  /*
-   * Decide how much extra space we really need.
-   */
-  extra_space -= (ps->buffer_size - ps->data_offset);
-  if(ps->buffer_size == 0) 
-  {
-    /*
-     * Ensure we have at least a PDU's length, or extra_space, 
-     * whichever is greater.
-     */  
-    new_size = MAX(MAX_PDU_FRAG_LEN,extra_space);
-    
-    if((new_data = zalloc(new_size)) == NULL)
-      return false;
-  } 
-  else 
-  {
-    /*
-     * If the current buffer size is bigger than the space needed, just 
-     * double it, else add extra_space.
-     */
-    new_size = MAX(ps->buffer_size*2, ps->buffer_size + extra_space);		
-    
-    if ((new_data = (char*)realloc(ps->data_p, new_size)) == NULL)
-      return false;
-    
-    memset(&new_data[ps->buffer_size], '\0', 
-	   (size_t)(new_size - ps->buffer_size));
-  }
-  ps->buffer_size = new_size;
-  ps->data_p = new_data;
-  
-  return true;
-}
-
-
-/*******************************************************************
- Align a the data_len to a multiple of align bytes - filling with
- zeros.
- ********************************************************************/
-bool prs_align(prs_struct *ps)
-{
-  uint32 mod = ps->data_offset & (ps->align-1);
-  
-  if (ps->align != 0 && mod != 0) 
-  {
-    uint32 extra_space = (ps->align - mod);
-    if(!prs_grow(ps, extra_space))
-      return false;
-    memset(&ps->data_p[ps->data_offset], '\0', (size_t)extra_space);
-    ps->data_offset += extra_space;
-  }
-  
-  return true;
-}
-
-
-/**
- * Initialise an expandable parse structure.
- *
- * @param size Initial buffer size.  If >0, a new buffer will be
- * created with malloc().
- *
- * @return false if allocation fails, otherwise true.
- **/
-
-bool prs_init(prs_struct *ps, uint32 size, void *ctx, bool io)
-{
-  if(ps == NULL)
-    return false;
-  memset(ps, 0, sizeof(prs_struct));
-
-  ps->io = io;
-  ps->bigendian_data = RPC_LITTLE_ENDIAN;
-  ps->align = RPC_PARSE_ALIGN;
-  ps->is_dynamic = false;
-  ps->data_offset = 0;
-  ps->buffer_size = 0;
-  ps->data_p = NULL;
-  ps->mem_ctx = ctx;
-  
-  if (size != 0) 
-  {
-    ps->buffer_size = size;
-    if((ps->data_p = (char *)zalloc((size_t)size)) == NULL)
-      return false;
-
-    ps->is_dynamic = true; /* We own this memory. */
-  }
-  
-  return true;
-}
-
-
-char *prs_mem_get(prs_struct *ps, uint32 extra_size)
-{
-  if(ps->io) 
-  {
-    /*
-     * If reading, ensure that we can read the requested size item.
-     */
-    if (ps->data_offset + extra_size > ps->buffer_size)
-      return NULL;
-  } 
-  else 
-  {
-    /*
-     * Writing - grow the buffer if needed.
-     */
-    if(!prs_grow(ps, extra_size))
-      return NULL;
-  }
-
-  return &ps->data_p[ps->data_offset];
-}
-
-
-/*******************************************************************
- Stream a uint32.
- ********************************************************************/
-bool prs_uint32(const char *name, prs_struct *ps, int depth, uint32 *data32)
-{
-  char *q = prs_mem_get(ps, sizeof(uint32));
-  if (q == NULL)
-    return false;
-  
-  if (ps->io) 
-  {
-    if (ps->bigendian_data)
-      *data32 = RIVAL(q,0);
-    else
-      *data32 = IVAL(q,0);
-  } 
-  else 
-  {
-    if (ps->bigendian_data)
-      RSIVAL(q,0,*data32);
-    else
-      SIVAL(q,0,*data32);
-  }
-  ps->data_offset += sizeof(uint32);
-  
-  return true;
-}
-
-
-/******************************************************************
- Stream an array of uint32s. Length is number of uint32s.
- ********************************************************************/
-bool prs_uint32s(const char *name, prs_struct *ps, 
-		 int depth, uint32 *data32s, int len)
-{
-  int i;
-  char *q = prs_mem_get(ps, len * sizeof(uint32));
-  if (q == NULL)
-    return false;
-  
-  if (ps->io) 
-  {
-    if (ps->bigendian_data) 
-    {
-      for (i = 0; i < len; i++)
-	data32s[i] = RIVAL(q, 4*i);
-    } 
-    else 
-    {
-      for (i = 0; i < len; i++)
-	data32s[i] = IVAL(q, 4*i);
-    }
-  } 
-  else 
-  {
-    if (ps->bigendian_data) 
-    {
-      for (i = 0; i < len; i++)
-	RSIVAL(q, 4*i, data32s[i]);
-    } 
-    else 
-    {
-      for (i = 0; i < len; i++)
-	SIVAL(q, 4*i, data32s[i]);
-    }
-  }
-  ps->data_offset += (len * sizeof(uint32));
-  
-  return true;
-}
-
-
-/*******************************************************************
- Stream a uint16.
- ********************************************************************/
-bool prs_uint16(const char *name, prs_struct *ps, int depth, uint16 *data16)
-{
-  char *q = prs_mem_get(ps, sizeof(uint16));
-  if (q == NULL)
-    return false;
-  
-  if (ps->io) 
-  {
-    if (ps->bigendian_data)
-      *data16 = RSVAL(q,0);
-    else
-      *data16 = SVAL(q,0);
-  } 
-  else 
-  {
-    if (ps->bigendian_data)
-      RSSVAL(q,0,*data16);
-    else
-      SSVAL(q,0,*data16);
-  }
-  ps->data_offset += sizeof(uint16);
-  
-  return true;
-}
-
-
-/*******************************************************************
- prs_uint16 wrapper. Call this and it sets up a pointer to where the
- uint16 should be stored, or gets the size if reading.
- ********************************************************************/
-bool prs_uint16_pre(const char *name, prs_struct *ps, int depth, 
-		    uint16 *data16, uint32 *offset)
-{
-  *offset = ps->data_offset;
-  if (ps->io) 
-  {
-    /* reading. */
-    return prs_uint16(name, ps, depth, data16);
-  } 
-  else 
-  {
-    char *q = prs_mem_get(ps, sizeof(uint16));
-    if(q ==NULL)
-      return false;
-    ps->data_offset += sizeof(uint16);
-  }
-  return true;
-}
-
-
-/*******************************************************************
- prs_uint16 wrapper.  call this and it retrospectively stores the size.
- does nothing on reading, as that is already handled by ...._pre()
- ********************************************************************/
-bool prs_uint16_post(const char *name, prs_struct *ps, int depth, 
-		     uint16 *data16, uint32 ptr_uint16, uint32 start_offset)
-{
-  if (!ps->io) 
-  {
-    /* 
-     * Writing - temporarily move the offset pointer.
-     */
-    uint16 data_size = ps->data_offset - start_offset;
-    uint32 old_offset = ps->data_offset;
-    
-    ps->data_offset = ptr_uint16;
-    if(!prs_uint16(name, ps, depth, &data_size)) 
-    {
-      ps->data_offset = old_offset;
-      return false;
-    }
-    ps->data_offset = old_offset;
-  } 
-  else 
-    ps->data_offset = start_offset + (uint32)(*data16);
-
-  return true;
-}
-
-
-/*******************************************************************
- Stream a uint8.
- ********************************************************************/
-bool prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8)
-{
-  char *q = prs_mem_get(ps, 1);
-  if (q == NULL)
-    return false;
-  
-  if (ps->io)
-    *data8 = CVAL(q,0);
-  else
-    SCVAL(q,0,*data8);
-  
-  ps->data_offset += 1;
-  
-  return true;
-}
-
-
-/******************************************************************
- Stream an array of uint8s. Length is number of uint8s.
- ********************************************************************/
-bool prs_uint8s(const char *name, prs_struct *ps, int depth, 
-		uint8* data8s, int len)
-{
-  int i;
-  char *q = prs_mem_get(ps, len);
-  if (q == NULL)
-    return false;
-  
-  if (ps->io) 
-  {
-    for (i = 0; i < len; i++)
-      data8s[i] = CVAL(q,i);
-  } 
-  else 
-  {
-    for (i = 0; i < len; i++)
-      SCVAL(q, i, data8s[i]);
-  }
-  
-  ps->data_offset += len;
-  
-  return true;
-}
-
-
-/*******************************************************************
- Set the current offset (external interface).
- ********************************************************************/
-bool prs_set_offset(prs_struct *ps, uint32 offset)
-{
-  if(offset <= ps->data_offset) 
-  {
-    ps->data_offset = offset;
-    return true;
-  }
-  
-  if(!prs_grow(ps, offset - ps->data_offset))
-    return false;
-  
-  ps->data_offset = offset;
-  return true;
-}
-
-/* End of stuff from parse_prs.c */
-
-/* From rpc_parse/parse_misc.c */
-
-/*******************************************************************
- Reads or writes a struct uuid
-********************************************************************/
-bool smb_io_uuid(const char *desc, struct uuid *uuid, 
-		 prs_struct *ps, int depth)
-{
-  if (uuid == NULL)
-    return false;
-  depth++;
-  
-  if(!prs_uint32 ("data   ", ps, depth, &uuid->time_low))
-    return false;
-  if(!prs_uint16 ("data   ", ps, depth, &uuid->time_mid))
-    return false;
-  if(!prs_uint16 ("data   ", ps, depth, &uuid->time_hi_and_version))
-    return false;
-  
-  if(!prs_uint8s ("data   ", ps, depth, 
-		  uuid->clock_seq, sizeof(uuid->clock_seq)))
-    return false;
-
-  if(!prs_uint8s ("data   ", ps, depth, uuid->node, sizeof(uuid->node)))
-    return false;
-  
-  return true;
-}
-
-
-/*******************************************************************
- Reads or writes an NTTIME structure.
-********************************************************************/
-bool smb_io_time(const char *desc, NTTIME *nttime, prs_struct *ps, int depth)
-{
-  if (nttime == NULL)
-    return false;
-  depth++;
-
-  if(!prs_align(ps))
-    return false;
-	
-  if(!prs_uint32("low ", ps, depth, &nttime->low)) /* low part */
-    return false;
-  if(!prs_uint32("high", ps, depth, &nttime->high)) /* high part */
-    return false;
-
-  return true;
-}
