summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
authorpaul <paul>2005-02-09 15:51:56 +0000
committerpaul <paul>2005-02-09 15:51:56 +0000
commit9985f83ce7102f64b15f744b60320f8d14a8a5ff (patch)
tree344629bdc2b4a7d53b8d7ca1705c9be2ca282d18 /ospfd
parent083ee9d9cdbf72a452b9af96e62d0625ea712cd9 (diff)
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.
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_dump.c8
-rw-r--r--ospfd/ospf_lsa.c4
-rw-r--r--ospfd/ospf_packet.c42
3 files changed, 23 insertions, 31 deletions
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index dd712c3b..17cf28c7 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -455,7 +455,7 @@ ospf_lsa_header_list_dump (struct stream *s, u_int16_t length)
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 @@ ospf_packet_db_desc_dump (struct stream *s, u_int16_t length)
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 @@ ospf_packet_ls_upd_dump (struct stream *s, u_int16_t length)
break;
}
- stream_forward (s, lsa_len);
+ stream_forward_getp (s, lsa_len);
length -= lsa_len;
count--;
}
@@ -673,7 +673,7 @@ ospf_packet_dump (struct stream *s)
/* 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 fbc56e15..13302dd3 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -407,7 +407,7 @@ lsa_header_set (struct stream *s, u_char options,
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 @@ ospf_router_lsa_body_set (struct stream *s, struct ospf_area *area)
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 44b130b7..c4dc56f0 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -84,13 +84,6 @@ ospf_auth_type (struct ospf_interface *oi)
}
-/* 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 @@ struct stream *
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 @@ ospf_write_frags (int fd, struct ospf_packet *op, struct ip *iph,
}
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 @@ ospf_db_desc_proc (struct stream *s, struct ospf_interface *oi,
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 @@ ospf_ls_upd_list_lsa (struct ospf_neighbor *nbr, struct stream *s,
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 @@ ospf_ls_ack (struct ip *iph, struct ospf_header *ospfh,
/* 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 @@ ospf_read (struct thread *thread)
}
/* 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 @@ ospf_read (struct thread *thread)
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 @@ ospf_make_header (int type, struct ospf_interface *oi, struct stream *s)
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 @@ ospf_make_hello (struct ospf_interface *oi, struct stream *s)
/* 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 @@ ospf_make_db_desc (struct ospf_interface *oi, struct ospf_neighbor *nbr,
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 @@ ospf_make_db_desc (struct ospf_interface *oi, struct ospf_neighbor *nbr,
/* 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 @@ ospf_make_ls_req (struct ospf_neighbor *nbr, struct stream *s)
{
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 @@ ospf_make_ls_upd (struct ospf_interface *oi, struct list *update, struct stream
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 @@ ospf_make_ls_upd (struct ospf_interface *oi, struct list *update, struct stream
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 @@ ospf_make_ls_ack (struct ospf_interface *oi, struct list *ack, struct stream *s)
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 ();