2005-02-09 Paul Jakma <paul.jakma@sun.com>

	* (global) Update code to match stream.h changes.
	  stream_get_putp effectively replaced with stream_get_endp.
	  stream_forward renamed to stream_forward_getp.
	  stream_forward_endp introduced to replace some previous
	  setting/manual twiddling of putp by daemons.
	* lib/stream.h: Remove putp. Update reference to putp with endp.
	  Add stream_forward_endp, which daemons were doing manually.
	  Rename stream_forward to stream_forward_getp.
	  lib/stream.c: Remove/update references to putp.
	  introduce stream_forward_endp.
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index dd712c3..17cf28c 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -455,7 +455,7 @@
       lsa = (struct lsa_header *) STREAM_PNT (s);
       ospf_lsa_header_dump (lsa);
 
-      stream_forward (s, OSPF_LSA_HEADER_SIZE);
+      stream_forward_getp (s, OSPF_LSA_HEADER_SIZE);
       length -= OSPF_LSA_HEADER_SIZE;
     }
 }
@@ -481,7 +481,7 @@
 
   length -= OSPF_HEADER_SIZE + OSPF_DB_DESC_MIN_SIZE;
 
-  stream_forward (s, OSPF_DB_DESC_MIN_SIZE);
+  stream_forward_getp (s, OSPF_DB_DESC_MIN_SIZE);
 
   ospf_lsa_header_list_dump (s, length);
 
@@ -577,7 +577,7 @@
 	  break;
 	}
 
-      stream_forward (s, lsa_len);
+      stream_forward_getp (s, lsa_len);
       length -= lsa_len;
       count--;
     }
@@ -673,7 +673,7 @@
 
   /* Show OSPF header detail. */
   ospf_header_dump (ospfh);
-  stream_forward (s, OSPF_HEADER_SIZE);
+  stream_forward_getp (s, OSPF_HEADER_SIZE);
 
   switch (ospfh->type)
     {
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index fbc56e1..13302dd 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -407,7 +407,7 @@
   lsah->adv_router = router_id;
   lsah->ls_seqnum = htonl (OSPF_INITIAL_SEQUENCE_NUMBER);
 
-  ospf_output_forward (s, OSPF_LSA_HEADER_SIZE);
+  stream_forward_endp (s, OSPF_LSA_HEADER_SIZE);
 }
 
 
@@ -710,7 +710,7 @@
   stream_putc (s, 0);
 
   /* Keep pointer to # links. */
-  putp = s->putp;
+  putp = stream_get_endp(s);
 
   /* Forward word */
   stream_putw(s, 0);
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 44b130b..c4dc56f 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -84,13 +84,6 @@
 
 }
 
-/* forward output pointer. */
-void
-ospf_output_forward (struct stream *s, int size)
-{
-  s->putp += size;
-}
-
 struct ospf_packet *
 ospf_packet_new (size_t size)
 {
@@ -225,7 +218,6 @@
 ospf_stream_copy (struct stream *new, struct stream *s)
 {
   new->endp = s->endp;
-  new->putp = s->putp;
   new->getp = s->getp;
 
   memcpy (new->data, s->data, stream_get_endp (s));
@@ -571,7 +563,7 @@
         }
       
       iph->ip_off += offset;
-      stream_forward (op->s, iovp->iov_len);
+      stream_forward_getp (op->s, iovp->iov_len);
       iovp->iov_base = STREAM_PNT (op->s); 
     }
     
@@ -997,12 +989,12 @@
   struct ospf_lsa *new, *find;
   struct lsa_header *lsah;
 
-  stream_forward (s, OSPF_DB_DESC_MIN_SIZE);
+  stream_forward_getp (s, OSPF_DB_DESC_MIN_SIZE);
   for (size -= OSPF_DB_DESC_MIN_SIZE;
        size >= OSPF_LSA_HEADER_SIZE; size -= OSPF_LSA_HEADER_SIZE) 
     {
       lsah = (struct lsa_header *) STREAM_PNT (s);
-      stream_forward (s, OSPF_LSA_HEADER_SIZE);
+      stream_forward_getp (s, OSPF_LSA_HEADER_SIZE);
 
       /* Unknown LS type. */
       if (lsah->type < OSPF_MIN_LSA || lsah->type >= OSPF_MAX_LSA)
@@ -1492,7 +1484,7 @@
   size -= OSPF_LS_UPD_MIN_SIZE; /* # LSAs */
 
   for (; size >= OSPF_LSA_HEADER_SIZE && count > 0;
-       size -= length, stream_forward (s, length), count--)
+       size -= length, stream_forward_getp (s, length), count--)
     {
       lsah = (struct lsa_header *) STREAM_PNT (s);
       length = ntohs (lsah->length);
@@ -2016,7 +2008,7 @@
 
       /* lsah = (struct lsa_header *) STREAM_PNT (s); */
       size -= OSPF_LSA_HEADER_SIZE;
-      stream_forward (s, OSPF_LSA_HEADER_SIZE);
+      stream_forward_getp (s, OSPF_LSA_HEADER_SIZE);
 
       if (lsa->data->type < OSPF_MIN_LSA || lsa->data->type >= OSPF_MAX_LSA)
 	{
@@ -2402,7 +2394,7 @@
     }
 
   /* Adjust size to message length. */
-  stream_forward (ibuf, iph->ip_hl * 4);
+  stream_forward_getp (ibuf, iph->ip_hl * 4);
   
   /* Get ospf packet header. */
   ospfh = (struct ospf_header *) STREAM_PNT (ibuf);
@@ -2510,7 +2502,7 @@
       return ret;
     }
 
-  stream_forward (ibuf, OSPF_HEADER_SIZE);
+  stream_forward_getp (ibuf, OSPF_HEADER_SIZE);
 
   /* Adjust size to message length. */
   length = ntohs (ospfh->length) - OSPF_HEADER_SIZE;
@@ -2563,7 +2555,7 @@
 
   memset (ospfh->u.auth_data, 0, OSPF_AUTH_SIMPLE_SIZE);
 
-  ospf_output_forward (s, OSPF_HEADER_SIZE);
+  stream_forward_endp (s, OSPF_HEADER_SIZE);
 }
 
 /* Make Authentication Data. */
@@ -2665,7 +2657,7 @@
   /* Set Designated Router. */
   stream_put_ipv4 (s, DR (oi).s_addr);
 
-  p = stream_get_putp (s);
+  p = stream_get_endp (s);
 
   /* Set Backup Designated Router. */
   stream_put_ipv4 (s, BDR (oi).s_addr);
@@ -2736,7 +2728,7 @@
   stream_putc (s, options);
 
   /* Keep pointer to flags. */
-  pp = stream_get_putp (s);
+  pp = stream_get_endp (s);
   stream_putc (s, nbr->dd_flags);
 
   /* Set DD Sequence Number. */
@@ -2786,7 +2778,7 @@
 		
 		/* Keep pointer to LS age. */
 		lsah = (struct lsa_header *) (STREAM_DATA (s) +
-					      stream_get_putp (s));
+					      stream_get_endp (s));
 		
 		/* Proceed stream pointer. */
 		stream_put (s, lsa->data, OSPF_LSA_HEADER_SIZE);
@@ -2835,7 +2827,7 @@
 {
   struct ospf_lsa *lsa;
   u_int16_t length = OSPF_LS_REQ_MIN_SIZE;
-  unsigned long delta = stream_get_putp(s)+12;
+  unsigned long delta = stream_get_endp(s)+12;
   struct route_table *table;
   struct route_node *rn;
   int i;
@@ -2874,15 +2866,15 @@
   struct listnode *node;
   u_int16_t length = OSPF_LS_UPD_MIN_SIZE;
   unsigned int size_noauth;
-  unsigned long delta = stream_get_putp (s);
+  unsigned long delta = stream_get_endp (s);
   unsigned long pp;
   int count = 0;
 
   if (IS_DEBUG_OSPF_EVENT)
     zlog_debug ("ospf_make_ls_upd: Start");
 
-  pp = stream_get_putp (s);
-  ospf_output_forward (s, OSPF_LS_UPD_MIN_SIZE);
+  pp = stream_get_endp (s);
+  stream_forward_endp (s, OSPF_LS_UPD_MIN_SIZE);
 
   /* Calculate amount of packet usable for data. */
   size_noauth = stream_get_size(s) - ospf_packet_authspace(oi);
@@ -2904,7 +2896,7 @@
         break;
 
       /* Keep pointer to LS age. */
-      lsah = (struct lsa_header *) (STREAM_DATA (s) + stream_get_putp (s));
+      lsah = (struct lsa_header *) (STREAM_DATA (s) + stream_get_endp (s));
 
       /* Put LSA to Link State Request. */
       stream_put (s, lsa->data, ntohs (lsa->data->length));
@@ -2936,7 +2928,7 @@
   struct list *rm_list;
   struct listnode *node;
   u_int16_t length = OSPF_LS_ACK_MIN_SIZE;
-  unsigned long delta = stream_get_putp(s) + 24;
+  unsigned long delta = stream_get_endp(s) + 24;
   struct ospf_lsa *lsa;
 
   rm_list = list_new ();