Changeset f46f7f4
- Timestamp:
- 01/06/12 15:57:40 (9 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 1453435
- Parents:
- e224862
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/libtrace.h.in
rcc6fcee rf46f7f4 2017 2017 uint8_t *ospf_type, uint32_t *remaining); 2018 2018 2019 /** Get a pointer to the start of the first LSA contained within an LS Update packet 2020 * @param ls_update Pointer to the LS Update header 2021 * @param[in,out] remaining Updated with the number of captured bytes remaining 2022 * @return A pointer to the first LSA in the packet. 2023 * 2024 * This function simply skips past the LS Update header to provide a suitable 2025 * pointer to pass into trace_get_next_ospf_lsa_v2. 2026 * 2027 * If the OSPF packet is truncated, then NULL will be returned. 2028 * 2029 * 'remaining' MUST be set to the amount of bytes remaining in the captured 2030 * packet starting from the beginning of the LS Update header. It will be 2031 * updated to contain the number of bytes remaining from the start of the 2032 * first LSA. 2033 * 2034 * @note This function only works for OSPF version 2 packets. 2035 * @note trace_get_next_ospf_lsa_v2() should be subequently used to process the LSAs 2036 */ 2019 2037 DLLEXPORT SIMPLE_FUNCTION 2020 2038 unsigned char *trace_get_first_ospf_lsa_from_update_v2( … … 2022 2040 uint32_t *remaining); 2023 2041 2042 /** Get a pointer to the start of the first LSA contained within an Database Description packet 2043 * @param db_desc Pointer to the Database Description header 2044 * @param[in,out] remaining Updated with the number of captured bytes remaining 2045 * @return A pointer to the first LSA in the packet. 2046 * 2047 * This function simply skips past the Database Description header to provide a 2048 * suitable pointer to pass into trace_get_next_ospf_lsa_header_v2. 2049 * 2050 * If the OSPF packet is truncated, then NULL will be returned. 2051 * 2052 * 'remaining' MUST be set to the amount of bytes remaining in the captured 2053 * packet starting from the beginning of the Database Description header. It 2054 * will be updated to contain the number of bytes remaining from the start of 2055 * the first LSA. 2056 * 2057 * @note This function only works for OSPF version 2 packets. 2058 * @note trace_get_next_ospf_lsa_header_v2() should be subequently used to process the LSA headers 2059 */ 2024 2060 DLLEXPORT SIMPLE_FUNCTION 2025 2061 unsigned char *trace_get_first_ospf_lsa_from_db_desc_v2( … … 2027 2063 uint32_t *remaining); 2028 2064 2065 /** Get a pointer to the start of the first link contained within a Router LSA 2066 * @param lsa Pointer to the Router LSA 2067 * @param[in,out] remaining Updated with the number of captured bytes remaining 2068 * @return A pointer to the first link in the packet. 2069 * 2070 * This function simply skips past the Router LSA header to provide a 2071 * suitable pointer to pass into trace_get_next_ospf_link_v2. 2072 * 2073 * If the OSPF packet is truncated, then NULL will be returned. 2074 * 2075 * 'remaining' MUST be set to the amount of bytes remaining in the captured 2076 * packet starting from the beginning of the Router LSA (not including the LSA 2077 * header) header. It will be updated to contain the number of bytes remaining 2078 * from the start of the first Link. 2079 * 2080 * @note This function only works for OSPF version 2 packets. 2081 * @note trace_get_next_ospf_link_v2() should be subequently used to process 2082 * the links 2083 */ 2029 2084 DLLEXPORT SIMPLE_FUNCTION 2030 2085 unsigned char *trace_get_first_ospf_link_from_router_lsa_v2( … … 2032 2087 uint32_t *remaining); 2033 2088 2089 /** Parses an OSPF Router LSA Link and finds the next Link (if there is one) 2090 * @param[in,out] current Pointer to the next Link (updated by this function) 2091 * @param[out] link Set to point to the Link located at the original value of current 2092 * @param[in,out] remaining Updated with the number of captured bytes remaining 2093 * @param[out] link_len Set to the size of the Link pointed to by 'link' 2094 * @return 0 if there are no more links after the current one, 1 otherwise. 2095 * 2096 * When called, 'current' MUST point to an OSPF Router LSA link. Ideally, this 2097 * would come from either a call to 2098 * trace_get_first_ospf_link_from_router_lsa_v2() or a previous call of this 2099 * function. 2100 * 2101 * 'link' will be set to the value of 'current', so that the caller may then 2102 * do any processing they wish on that particular link. 'current' is advanced 2103 * to point to the next link and 'link_len' is updated to report the size of 2104 * the original link. 2105 * 2106 * 'remaining' MUST be set to the amount of bytes remaining in the captured 2107 * packet starting from the beginning of the Link pointed to by 'current'. 2108 * It will be updated to contain the number of bytes remaining from the start 2109 * of the next link. 2110 * 2111 * If this function returns 0 but 'link' is NOT NULL, that link is still valid 2112 * but there are no more links after this one. 2113 * If this function returns 0 AND link is NULL, the link is obviously not 2114 * suitable for processing. 2115 * 2116 * @note This function only works for OSPF version 2 packets. 2117 */ 2034 2118 DLLEXPORT SIMPLE_FUNCTION 2035 2119 int trace_get_next_ospf_link_v2(unsigned char **current, … … 2038 2122 uint32_t *link_len); 2039 2123 2124 /** Parses an OSPF LSA and finds the next LSA (if there is one) 2125 * @param[in,out] current Pointer to the next LSA (updated by this function) 2126 * @param[out] lsa_hdr Set to point to the header of the LSA located at the original value of current 2127 * @param[out] lsa_body Set to point to the body of the LSA located at the original value of current 2128 * @param[in,out] remaining Updated with the number of captured bytes remaining 2129 * @param[out] lsa_type Set to the type of the LSA located at the original value of current 2130 * @param[out] lsa_length Set to the size of the LSA located at the original value of current 2131 * @return 1 if there are more LSAs after the current one, 0 if there are no more LSAs to come, and -1 if the current LSA is incomplete, truncated or invalid. 2132 * 2133 * When called, 'current' MUST point to an OSPF LSA. Ideally, this would come 2134 * from either a call to trace_get_first_ospf_lsa_from_update_v2() or a 2135 * previous call of this function. 2136 * 2137 * This function should only be used to access COMPLETE LSAs, i.e. LSAs that 2138 * have both a header and a body. In OSPFv2, only the LSAs contained within 2139 * LSA Update packets meet this requirement. trace_get_next_ospf_lsa_header_v2 2140 * should be used to read header-only LSAs, e.g. those present in LS Acks. 2141 * 2142 * 'lsa_hdr' will be set to the value of 'current', so that the caller may then 2143 * do any processing they wish on that particular LSA. 'lsa_body' will be set 2144 * to point to the first byte after the LSA header. 'current' is advanced 2145 * to point to the next LSA. 'lsa_length' is updated to contain the size of 2146 * the parsed LSA, while 'lsa_type' is set to indicate the LSA type. 2147 * 2148 * 'remaining' MUST be set to the amount of bytes remaining in the captured 2149 * packet starting from the beginning of the LSA pointed to by 'current'. 2150 * It will be updated to contain the number of bytes remaining from the start 2151 * of the next LSA. 2152 * 2153 * If this function returns 0 but 'lsa_hdr' is NOT NULL, that LSA is still 2154 * valid but there are no more LSAs after this one. 2155 * If this function returns 0 AND 'lsa_hdr' is NULL, the LSA is obviously not 2156 * suitable for processing. 2157 * 2158 * It is also recommended to check the value of 'lsa_body' before 2159 * de-referencing it. 'lsa_body' will be set to NULL if there is only an LSA 2160 * header present. 2161 * 2162 * @note This function only works for OSPF version 2 packets. 2163 * 2164 */ 2040 2165 DLLEXPORT SIMPLE_FUNCTION 2041 2166 int trace_get_next_ospf_lsa_v2(unsigned char **current, … … 2046 2171 uint16_t *lsa_length); 2047 2172 2173 /** Parses an OSPF LSA header and finds the next LSA (if there is one) 2174 * @param[in,out] current Pointer to the next LSA (updated by this function) 2175 * @param[out] lsa_hdr Set to point to the header of the LSA located at the original value of current 2176 * @param[in,out] remaining Updated with the number of captured bytes remaining 2177 * @param[out] lsa_length Set to the size of the LSA located at the original value of current 2178 * @return 1 if there are more LSAs after the current one, 0 if there are no more LSAs to come, and -1 if the current LSA is incomplete, truncated or invalid. 2179 * 2180 * When called, 'current' MUST point to an OSPF LSA. Ideally, this would come 2181 * from either a call to trace_get_first_ospf_lsa_from_db_desc_v2() or a 2182 * previous call of this function. 2183 * 2184 * This function should only be used to access LSA headers, i.e. LSAs that 2185 * have a header only. In OSPFv2, the LSAs contained within LSA Ack and 2186 * Database Description packets meet this requirement. 2187 * trace_get_next_ospf_lsa_v2 should be used to read full LSAs, e.g. those 2188 * present in LS Updates. 2189 * 2190 * 'lsa_hdr' will be set to the value of 'current', so that the caller may then 2191 * do any processing they wish on that particular LSA header. 'current' is 2192 * advanced to point to the next LSA header. 'lsa_length' is updated to contain 2193 * the size of the parsed LSA header. 2194 * 2195 * 'remaining' MUST be set to the amount of bytes remaining in the captured 2196 * packet starting from the beginning of the LSA pointed to by 'current'. 2197 * It will be updated to contain the number of bytes remaining from the start 2198 * of the next LSA. 2199 * 2200 * If this function returns 0 but 'lsa_hdr' is NOT NULL, that LSA is still 2201 * valid but there are no more LSAs after this one. 2202 * If this function returns 0 AND 'lsa_hdr' is NULL, the LSA is obviously not 2203 * suitable for processing. 2204 * 2205 * @note This function only works for OSPF version 2 packets. 2206 * 2207 */ 2048 2208 DLLEXPORT SIMPLE_FUNCTION 2049 2209 int trace_get_next_ospf_lsa_header_v2(unsigned char **current, … … 2053 2213 uint16_t *lsa_length); 2054 2214 2055 2215 /** Extracts the metric field from an AS External LSA packet 2216 * 2217 * @param as_lsa The AS External LSA 2218 * @returns The value of the metric field 2219 * 2220 * The metric field in the AS External LSA packet is a 24-bit value, which 2221 * is difficult to extract correctly. To avoid byte-ordering issues, use this 2222 * function which will extract the correct value for you. 2223 */ 2056 2224 DLLEXPORT SIMPLE_FUNCTION 2057 2225 uint32_t trace_get_ospf_metric_from_as_external_lsa_v2( 2058 2226 libtrace_ospf_as_external_lsa_v2_t *as_lsa); 2059 2227 2228 /** Extracts the metric field from a Summary LSA packet 2229 * 2230 * @param sum_lsa The Summary LSA 2231 * @returns The value of the metric field 2232 * 2233 * The metric field in the Summary LSA packet is a 24-bit value, which 2234 * is difficult to extract correctly. To avoid byte-ordering issues, use this 2235 * function which will extract the correct value for you. 2236 */ 2060 2237 DLLEXPORT SIMPLE_FUNCTION 2061 2238 uint32_t trace_get_ospf_metric_from_summary_lsa_v2(
Note: See TracChangeset
for help on using the changeset viewer.