@@ -66,19 +66,31 @@ class NTPPrivate < BitStruct
66
66
# 0 1 2 3
67
67
# 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
68
68
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
69
- # |R M| VN | 7 |A| Sequence |
69
+ # |R M| VN | 7 |A| Sequence | Implementation| Req code |
70
70
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
71
- # | Implementation| request code |
72
- # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73
- unsigned :response , 1 , default : 0
74
- unsigned :more , 1 , default : 0
71
+ # | err | Number of data items | MBZ | Size of data item |
72
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
73
+ unsigned :response , 1 , default : 0
74
+ unsigned :more , 1 , default : 0
75
75
unsigned :version , 3 , default : 0
76
76
unsigned :mode , 3 , default : 7
77
77
unsigned :auth , 1 , default : 0
78
78
unsigned :sequence , 7 , default : 0
79
79
unsigned :implementation , 8 , default : 0
80
80
unsigned :request_code , 8 , default : 0
81
+ unsigned :error , 4 , default : 0
82
+ unsigned :record_count , 12 , default : 0
83
+ unsigned :mbz , 4 , default : 0
84
+ unsigned :record_size , 12 , default : 0
81
85
rest :payload
86
+
87
+ def records
88
+ records = [ ]
89
+ 1 . upto ( record_count ) do |record_num |
90
+ records << payload [ record_size *( record_num -1 ) , record_size ]
91
+ end
92
+ records
93
+ end
82
94
end
83
95
84
96
def self . ntp_control ( version , operation , payload = nil )
0 commit comments