typedef void (*cf_callback_t) (gint event, gpointer data, gpointer user_data);
+typedef struct {
+ const char *string;
+ size_t string_len;
+ capture_file *cf;
+ gboolean frame_matched;
+ field_info *finfo;
+} match_data;
+
extern void
cf_callback_add(cf_callback_t func, gpointer user_data);
* @param cf the capture file to be opened
* @param fname the filename to be opened
* @param is_tempfile is this a temporary file?
+ * @param err error code
* @return one of cf_status_t
*/
cf_status_t cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err);
*/
cf_read_status_t cf_read(capture_file *cf, gboolean from_save);
+/**
+ * Read the pseudo-header and raw data for a packet. It will pop
+ * up an alert box if there's an error.
+ *
+ * @param cf the capture file from which to read the packet
+ * @param fdata the frame_data structure for the packet in question
+ * @param pseudo_header pointer to a wtap_pseudo_header union into
+ * which to read the packet's pseudo-header
+ * @param pd a guin8 array into which to read the packet's raw data
+ * @return TRUE if the read succeeded, FALSE if there was an error
+ */
gboolean cf_read_frame_r(capture_file *cf, frame_data *fdata,
- union wtap_pseudo_header *pseudo_header, guint8 *pd,
- int *err, gchar **err_info);
+ union wtap_pseudo_header *pseudo_header, guint8 *pd);
-gboolean cf_read_frame(capture_file *cf, frame_data *fdata,
- int *err, gchar **err_info);
+/**
+ * Read the pseudo-header and raw data for a packet into a
+ * capture_file structure's pseudo_header and pd members.
+ * It will pop up an alert box if there's an error.
+ *
+ * @param cf the capture file from which to read the packet
+ * @param fdata the frame_data structure for the packet in question
+ * @return TRUE if the read succeeded, FALSE if there was an error
+ */
+gboolean cf_read_frame(capture_file *cf, frame_data *fdata);
/**
* Start reading from the end of a capture file.
* return a non-null value. The returned value should not be freed.
*
* @param cf the capture file
- * @param source the source description. this will be copied internally.
*/
const gchar *cf_get_tempfile_source(capture_file *cf);
* Set the number of packets in the capture file.
*
* @param cf the capture file
- * @param the number of packets in the capture file
+ * @param packet_count the number of packets in the capture file
*/
void cf_set_packet_count(capture_file *cf, int packet_count);
*/
gulong cf_get_computed_elapsed(void);
-/**
- * The coloring rules have changed, redo coloring
- *
- * @param cf the capture file
- */
-void cf_colorize_packets(capture_file *cf);
-
/**
* "Something" has changed, rescan all packets.
*
*/
cf_read_status_t cf_retap_packets(capture_file *cf);
-/**
- * The time format has changed, rescan all packets.
- *
- * @param cf the capture file
- */
-void cf_change_time_formats(capture_file *cf);
-
/**
* Adjust timestamp precision if auto is selected.
*
cf_print_status_t cf_write_carrays_packets(capture_file *cf, print_args_t *print_args);
/**
- * Find Packet in protocol tree.
+ * Find packet with a protocol tree item that contains a specified text string.
*
* @param cf the capture file
* @param string the string to find
+ * @param dir direction in which to search
+ * @return TRUE if a packet was found, FALSE otherwise
+ */
+gboolean cf_find_packet_protocol_tree(capture_file *cf, const char *string,
+ search_direction dir);
+
+/**
+ * Find field with a label that contains text string cfile->sfilter.
+ *
+ * @param cf the capture file
+ * @param tree the protocol tree
+ * @param mdata the first field (mdata->finfo) that matched the string
* @return TRUE if a packet was found, FALSE otherwise
*/
-gboolean cf_find_packet_protocol_tree(capture_file *cf, const char *string);
+extern gboolean cf_find_string_protocol_tree(capture_file *cf, proto_tree *tree,
+ match_data *mdata);
/**
- * Find Packet in summary line.
+ * Find packet whose summary line contains a specified text string.
*
* @param cf the capture file
* @param string the string to find
+ * @param dir direction in which to search
* @return TRUE if a packet was found, FALSE otherwise
*/
-gboolean cf_find_packet_summary_line(capture_file *cf, const char *string);
+gboolean cf_find_packet_summary_line(capture_file *cf, const char *string,
+ search_direction dir);
/**
- * Find Packet in packet data.
+ * Find packet whose data contains a specified byte string.
*
* @param cf the capture file
* @param string the string to find
* @param string_size the size of the string to find
+ * @param dir direction in which to search
* @return TRUE if a packet was found, FALSE otherwise
*/
gboolean cf_find_packet_data(capture_file *cf, const guint8 *string,
- size_t string_size);
+ size_t string_size, search_direction dir);
/**
- * Find Packet by display filter.
+ * Find packet that matches a compiled display filter.
*
* @param cf the capture file
- * @param sfcode the display filter to find a packet for
+ * @param sfcode the display filter to match
+ * @param dir direction in which to search
* @return TRUE if a packet was found, FALSE otherwise
*/
-gboolean cf_find_packet_dfilter(capture_file *cf, dfilter_t *sfcode);
+gboolean cf_find_packet_dfilter(capture_file *cf, dfilter_t *sfcode,
+ search_direction dir);
/**
- * GoTo Packet in first row.
+ * Find packet that matches a display filter given as a text string.
*
* @param cf the capture file
+ * @param filter the display filter to match
+ * @param dir direction in which to search
+ * @return TRUE if a packet was found, FALSE otherwise
+ */
+gboolean
+cf_find_packet_dfilter_string(capture_file *cf, const char *filter,
+ search_direction dir);
+
+/**
+ * Find marked packet.
+ *
+ * @param cf the capture file
+ * @param dir direction in which to search
+ * @return TRUE if a packet was found, FALSE otherwise
+ */
+gboolean cf_find_packet_marked(capture_file *cf, search_direction dir);
+
+/**
+ * Find time-reference packet.
+ *
+ * @param cf the capture file
+ * @param dir direction in which to search
+ * @return TRUE if a packet was found, FALSE otherwise
+ */
+gboolean cf_find_packet_time_reference(capture_file *cf, search_direction dir);
+
+/**
+ * GoTo Packet in first row.
+ *
* @return TRUE if the first row exists, FALSE otherwise
*/
-gboolean cf_goto_top_frame(capture_file *cf);
+gboolean cf_goto_top_frame();
/**
* GoTo Packet in last row.
*
- * @param cf the capture file
* @return TRUE if last row exists, FALSE otherwise
*/
-gboolean cf_goto_bottom_frame(capture_file *cf);
+gboolean cf_goto_bottom_frame();
/**
* GoTo Packet with the given row.
* Unselect all packets, if any.
*
* @param cf the capture file
- * @param row the row to select
*/
void cf_unselect_packet(capture_file *cf);
* Unselect all protocol tree fields, if any.
*
* @param cf the capture file
- * @param row the row to select
*/
void cf_unselect_field(capture_file *cf);
*/
void cf_unignore_frame(capture_file *cf, frame_data *frame);
-/**
- * Convert error number and info to a complete message.
- *
- * @param err the error number
- * @param err_info a string with additional details about this error
- * @return statically allocated error message
- */
-char *cf_read_error_message(int err, gchar *err_info);
-
/**
* Merge two (or more) capture files into one.
* @todo is this the right place for this function? It doesn't have to do a lot with capture_file.
* NULL, a temporary file name is generated and *out_filename is set
* to point to the generated file name
* @param in_file_count the number of input files to merge
- * @param in_filnames array of input filenames
+ * @param in_filenames array of input filenames
* @param file_type the output filetype
* @param do_append FALSE to merge chronologically, TRUE simply append
* @return one of cf_status_t