00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef PRISM_HEADER_HH_
00023 # define PRISM_HEADER_HH_
00024
00025 # include <wipal/phy/phy.hh>
00026
00027
00028 namespace prism
00029 {
00030 struct time;
00031 struct header;
00032 }
00033
00034
00035
00036 namespace tool
00037 {
00038
00039 template <>
00040 struct types<prism::time>
00041 {
00042 typedef uint32_t impl_type;
00043 };
00044
00045 template <>
00046 struct types<prism::header>
00047 {
00048 typedef prism::time time_type;
00049 };
00050
00051 }
00052
00053
00054
00055
00057 namespace prism
00058 {
00064 struct item
00065 {
00067 uint32_t get(bool swapped) const;
00068
00070 item& set(uint32_t value, bool swapped);
00071
00072 protected:
00073 uint32_t did;
00074 uint16_t status;
00075 uint16_t len;
00076 uint32_t data;
00077 };
00078
00080 struct time: public phy::time<prism::time>
00081 {
00083
00084 typedef prism::time exact_type;
00085 typedef WP_TYPE_(impl_type, exact_type) impl_type;
00086
00087 impl_type get_impl() const;
00088 exact_type& increment(tool::microseconds microseconds);
00090
00092 time();
00093
00095 time(uint32_t mactime, uint32_t hosttime);
00096
00098 uint32_t mactime() const;
00099
00101 uint32_t hosttime() const;
00102
00103 private:
00104 uint32_t mactime_;
00105 uint32_t hosttime_;
00106 };
00107
00109 struct header: public phy::header<prism::header>
00110 {
00112
00113 typedef prism::header exact_type;
00114 typedef WP_TYPE_(time_type, exact_type) time_type;
00115
00116 size_t len_impl(size_t, bool) const;
00117 time_type time_get_impl(bool) const;
00118 void time_set_impl(const time_type&, bool);
00119
00120 template <class D1, class D2>
00121 static bool eq_time(const pcapxx::frame_descriptor<D1>& lhs,
00122 const pcapxx::frame_descriptor<D2>& rhs,
00123 tool::endian::endianness phy_end,
00124 unsigned prec);
00126
00127 enum
00128 {
00130 devnamelen_max = 16
00131 };
00132
00133 uint32_t msgcode;
00134 uint32_t msglen;
00135 uint8_t devname[devnamelen_max];
00136 item hosttime;
00137 item mactime;
00138 item channel;
00139 item rssi;
00140 item sq;
00141 item signal;
00142 item noise;
00143 item rate;
00144 item istx;
00145 item frmlen;
00146 };
00147
00148 }
00149
00150 # include "prism_header.hxx"
00151
00152 #endif // ! PRISM_HEADER_HH_