1 /*
2 *
3 * Copyright (c) 2004 The Regents of the University of California. All
4 * rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * - Neither the name of the University nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 */
30
31
32 /*
33 * link_parse.h -- Header for defining packet parsing code
34 *
35 * $Id: link_parse.h,v 1.5 2005-01-04 18:19:09 girod Exp $
36 */
37
38
39 #include <link/link_headers.h>
40
41 #ifndef __LINK_PARSE_H__
42 #define __LINK_PARSE_H__
43
44
45 /*
46 * Packet unparse functions
47 */
48
49 char *dump_ssync_log_cmd(uint8_t cmd);
50 void dump_ssync_flowid(buf_t *buf, flow_id_t *fid);
51 int dump_ssync(buf_t *buf, link_pkt_t *pkt, char *data_start,
52 int data_len, char *prefix, flow_id_t *fid);
53 char *ssync_flowid_to_str(flow_id_t *fid);
54
55
56 /*
57 * retrans2 iterator
58 */
59
60 typedef struct ssync_msg_iter {
61 /* current message */
62 char *msg;
63
64 int garbage; /* if there was junk at the end.. */
65
66 uint8_t command;
67 uint8_t flow_index;
68 cl_index_t target;
69 uint8_t length;
70 if_id_t if_addr; /* set by the ADDR mapping segments */
71 flow_entry_t curr_flow; /* set by the FLOW mapping segments */
72
73 log_seqno_t seqno;
74 uint8_t list_index;
75
76 uint8_t nack_list_index;
77 log_seqno_t nack_seqno;
78 uint16_t nack_count;
79 uint nack_init:2;
80
81 uint valid:1;
82 uint inc_next:1;
83
84 /******
85 * private
86 */
87
88 uint nack_cont:1;
89 ssync_retx2_nack_ctrl_t nack_cmd;
90
91 char *data;
92 int remain;
93
94 char *orig;
95 int orig_len;
96
97 uint8_t last_set_length;
98 int MTU;
99 buf_t *grow_pkt;
100 char *last_nack_ctrl;
101 int header_orig_len;
102
103 /* current address map */
104 if_id_t addr_map[256];
105 flow_entry_t flow_map[256];
106 } ssync_msg_iter_t;
107
108
109 ssync_msg_iter_t *ssync_msg_iter_new(char *data, int data_len, int MTU);
110 void ssync_msg_iter_destroy(ssync_msg_iter_t *iter);
111
112 void ssync_msg_iter_top(ssync_msg_iter_t *iter);
113 int ssync_msg_iter_valid(ssync_msg_iter_t *iter);
114 void ssync_msg_iter_next(ssync_msg_iter_t *iter);
115
116 void ssync_msg_iter_init_msg(ssync_msg_iter_t *iter, int opcode, buf_t *header);
117 /* length < 0 ==> not set or use last */
118 int ssync_msg_iter_append_msg(ssync_msg_iter_t *iter,
119 uint8_t command, uint8_t flow_index, cl_index_t target,
120 uint8_t list_index, log_seqno_t seqno,
121 int nack_init, uint16_t nack_count,
122 char *msg, uint8_t length);
123
124 int ssync_msg_iter_maybe_addr_map(ssync_msg_iter_t *iter,
125 cl_index_t *target, if_id_t if_id);
126 int ssync_msg_iter_maybe_flow_map(ssync_msg_iter_t *iter,
127 uint8_t *flow_index, flow_id_t *flow, int hops);
128
129 buf_t *ssync_msg_iter_finalize_msg(ssync_msg_iter_t *iter);
130
131 int ssync_msg_iter_get_len(ssync_msg_iter_t *iter);
132
133 #endif
134
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.