00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PCAP_LIST_HH_
00023 # define PCAP_LIST_HH_
00024
00025 # include <cstddef>
00026 # include <string>
00027 # include <utility>
00028 # include <vector>
00029
00030 # include <wipal/tool/list_of_iterables.hh>
00031 # include <wipal/pcap/stream.hh>
00032
00033 namespace wpl
00034 {
00035
00036 namespace pcap
00037 {
00038
00039 template <class Stream = file<>, class Bottom = tool::bottom>
00040 struct list:
00041 public tool::list_of_iterables<Stream, WP_GET_EXACT(Bottom,
00042 list<Stream, Bottom>)>
00043 {
00044 typedef WP_GET_EXACT(Bottom, list<Stream, Bottom>) exact_type;
00045 typedef tool::list_of_iterables<Stream, exact_type> super_type;
00046
00047 enum
00048 {
00049 trace_name_sep = ':',
00050 addr_sep = '=',
00051 escape_char = '\\'
00052 };
00053
00054 list(const std::string& stream_names = "");
00055 list(const list& other);
00056
00057 list& operator = (const list& rhs);
00058
00059 std::ostream& print(std::ostream&) const;
00060
00061 pkt::type type() const;
00062 void expect(typename pkt::type t) const;
00063 const opt::list& meta() const;
00064
00065 protected:
00066 static
00067 std::pair<std::string, size_t>
00068 parse_word(const std::string& stream_names,
00069 const size_t start,
00070 const std::set<char>& stop_seps);
00071
00072 static
00073 std::pair<std::vector<std::string>, std::string>
00074 parse(const std::string& stream_names);
00075
00076 void
00077 update_meta(list* p);
00078
00079 private:
00080 opt::list meta_;
00081 };
00082
00083 template <class Stream, class Bottom>
00084 std::ostream&
00085 operator << (std::ostream& os, const list<Stream, Bottom>& l);
00086
00087 }
00088
00089 namespace tool
00090 {
00091
00092 template <class S, class B>
00093 struct types< pcap::list<S, B> >:
00094 public types< list_of_iterables<S, WP_GET_EXACT(B, pcap::list<S, B>)> >
00095 {
00096 };
00097
00098 }
00099
00100 }
00101
00102 # include "list.hxx"
00103
00104 #endif // ! PCAP_LIST_HH_