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 namespace wpl
00028 {
00029
00030
00031 namespace prism
00032 {
00033 struct time;
00034 struct header;
00035 }
00036
00037
00038
00039 namespace tool
00040 {
00041
00042 template <>
00043 struct types<prism::time>
00044 {
00045 typedef uint32_t impl_type;
00046 };
00047
00048 template <>
00049 struct types<prism::header>
00050 {
00051 typedef prism::time time_type;
00052 };
00053
00054 }
00055
00056
00057
00058
00060 namespace prism
00061 {
00067 struct item
00068 {
00070 uint32_t get(bool swapped) const;
00071
00073 item& set(uint32_t value, bool swapped);
00074
00075 protected:
00076 uint32_t did;
00077 uint16_t status;
00078 uint16_t len;
00079 uint32_t data;
00080 } __attribute__ ((__packed__));
00081
00083 struct time: public phy::time<prism::time>
00084 {
00085 typedef prism::time exact_type;
00086 typedef WP_TYPE_(impl_type, exact_type) impl_type;
00087
00088 impl_type get_impl() const;
00089 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 {
00111 typedef prism::header exact_type;
00112 typedef WP_TYPE_(time_type, exact_type) time_type;
00113
00114 size_t len_impl(size_t, bool) const;
00115 time_type time_get_impl(bool) const;
00116 void time_set_impl(const time_type&, bool);
00117
00118 template <class S1, class S2>
00119 static bool
00120 eq_time(const pkt::packet<S1>& lhs,
00121 const pkt::packet<S2>& rhs,
00122 const unsigned prec,
00123 const tool::end::endianness phy_end);
00124
00125 enum
00126 {
00128 devnamelen_max = 16
00129 };
00130
00131 uint32_t msgcode;
00132 uint32_t msglen;
00133 uint8_t devname[devnamelen_max];
00134 item hosttime;
00135 item mactime;
00136 item channel;
00137 item rssi;
00138 item sq;
00139 item signal;
00140 item noise;
00141 item rate;
00142 item istx;
00143 item frmlen;
00144 } __attribute__ ((__packed__));
00145
00146 }
00147
00148 }
00149
00150 # include "prism_header.hxx"
00151
00152 #endif // ! PRISM_HEADER_HH_