1 package info.mikethomas.fahview.v6project.model;
2
3 /*
4 * #%L
5 * This file is part of FAHView-v6project.
6 * %%
7 * Copyright (C) 2011 - 2017 Mike Thomas <mikepthomas@outlook.com>
8 * %%
9 * FAHView is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 * %
14 * FAHView is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 * %
19 * You should have received a copy of the GNU General Public License
20 * along with FAHView. If not, see <http://www.gnu.org/licenses/>.
21 * #L%
22 */
23
24 import java.net.InetAddress;
25 import java.net.URL;
26 import java.util.Date;
27
28 /**
29 * Interface to represent data stored about a Folding@home queue index.
30 *
31 * @author <a href="mailto:mikepthomas@outlook.com">Michael Thomas</a>
32 * @version 6.00
33 */
34 public interface QueueIndex {
35 // <editor-fold defaultstate="collapsed" desc="position-constants">
36 /**
37 * Position in bytes of Status from the start of {@code queue.dat}.
38 */
39 int STAT_POS = 0;
40 /**
41 * Position in bytes of Pad for Windows from the start of {@code queue.dat}.
42 *
43 * @since 4.01 Pad for others
44 * @since 6.01 Number of SMP Cores to use
45 * @deprecated Use {@link #CORES_POS}
46 */
47 int Z004_POS = 4;
48 /**
49 * Position in bytes of Time data from the start of {@code queue.dat}.
50 */
51 int TDATA_POS = 8;
52 /**
53 * Position in bytes of Server IP address from the start of
54 * {@code queue.dat}.
55 *
56 * @deprecated As of 3.00 replaced by {@link #SVR2_POS}
57 */
58 int SVR1_POS = 40;
59 /**
60 * Position in bytes of Upload status from the start of {@code queue.dat}.
61 */
62 int USTAT_POS = 44;
63 /**
64 * Position in bytes of Web address for core downloads from the start of
65 * {@code queue.dat}.
66 */
67 int URL_POS = 48;
68 /**
69 * Position in bytes of Misc1a from the start of {@code queue.dat}.
70 */
71 int M176_POS = 176;
72 /**
73 * Position in bytes of Core_xx number (hex) from the start of
74 * {@code queue.dat}.
75 */
76 int CORE_POS = 180;
77 /**
78 * Position in bytes of Misc1b from the start of {@code queue.dat}.
79 */
80 int M184_POS = 184;
81 /**
82 * Position in bytes of wudata_xx.dat file size from the start of
83 * {@code queue.dat}.
84 */
85 int DSIZ_POS = 188;
86 /**
87 * Position in bytes of padding from the start of {@code queue.dat}
88 * (All Zeros).
89 */
90 int Z192_POS = 192;
91 /**
92 * Position in bytes of Work unit ID information from the start of
93 * {@code queue.dat}.
94 */
95 int WUID_POS = 208;
96 /**
97 * Position in bytes of padding from the start of {@code queue.dat}
98 * (All Zeros).
99 */
100 int Z224_POS = 224;
101 /**
102 * Position in bytes of Machine ID from the start of {@code queue.dat}.
103 */
104 int MID_POS = 260;
105 /**
106 * Position in bytes of Server IP address from the start of
107 * {@code queue.dat}.
108 */
109 int SVR2_POS = 264;
110 /**
111 * Position in bytes of Server port number from the start of
112 * {@code queue.dat}.
113 */
114 int PORT_POS = 268;
115 /**
116 * Position in bytes of Work unit type from the start of {@code queue.dat}.
117 */
118 int TYPE_POS = 272;
119 /**
120 * Position in bytes of User Name from the start of {@code queue.dat}.
121 */
122 int UNAME_POS = 336;
123 /**
124 * Position in bytes of Team Number from the start of {@code queue.dat}.
125 */
126 int TEAMN_POS = 400;
127 /**
128 * Position in bytes of Stored ID for unit (UserID + MachineID) from the
129 * start of {@code queue.dat}.
130 */
131 int UID_POS = 464;
132 /**
133 * Position in bytes of Benchmark from the start of {@code queue.dat}.
134 *
135 * @since 3.24
136 */
137 int BENCH_POS = 472;
138 /**
139 * Position in bytes of Misc3b from the start of {@code queue.dat}.
140 *
141 * @deprecated 3.24
142 */
143 int M476_POS = 476;
144 /**
145 * Position in bytes of CPU type from the start of {@code queue.dat}.
146 */
147 int CPU_TYPE_POS = 480;
148 /**
149 * Position in bytes of OS type from the start of {@code queue.dat}.
150 */
151 int OS_TYPE_POS = 484;
152 /**
153 * Position in bytes of CPU species from the start of {@code queue.dat}.
154 */
155 int CPU_SPEC_POS = 488;
156 /**
157 * Position in bytes of OS species from the start of {@code queue.dat}.
158 */
159 int OS_SPEC_POS = 492;
160 /**
161 * Position in bytes of Allowed time to return (seconds) from the start of
162 * {@code queue.dat}.
163 */
164 int EXPIRE_POS = 496;
165 /**
166 * Position in bytes of padding from the start of {@code queue.dat}
167 * (All Zeros).
168 */
169 int Z500_POS = 500;
170 /**
171 * Position in bytes of Client type required from the start of
172 * {@code queue.dat}.
173 */
174 int CLTYPE_POS = 504;
175 /**
176 * Position in bytes of Assignment info present flag from the start of
177 * {@code queue.dat}.
178 */
179 int AIFLAG_POS = 508;
180 /**
181 * Position in bytes of Assignment timestamp from the start of
182 * {@code queue.dat}.
183 */
184 int AITIME_POS = 512;
185 /**
186 * Position in bytes of Assignment info from the start of {@code queue.dat}.
187 */
188 int AIDATA_POS = 516;
189 /**
190 * Position in bytes of Collection server IP address from the start of
191 * {@code queue.dat}.
192 *
193 * @since 5.00
194 */
195 int CSIP_POS = 520;
196 /**
197 * Position in bytes of Download started time from the start of
198 * {@code queue.dat}.
199 *
200 * @since 5.00
201 */
202 int DSTART_POS = 524;
203 /**
204 * Position in bytes of padding from the start of {@code queue.dat}
205 * (All Zeros).
206 */
207 int Z528_POS = 528;
208 /**
209 * Position in bytes of Misc4a from the start of {@code queue.dat}.
210 */
211 int M532_POS = 532;
212 /**
213 * Position in bytes of padding from the start of {@code queue.dat}
214 * (All Zeros).
215 */
216 int Z536_POS = 536;
217 /**
218 * Position in bytes of Number of SMP cores from the start of
219 * {@code queue.dat}.
220 *
221 * @since 5.91
222 */
223 int CORES_POS = 544;
224 /**
225 * Position in bytes of Tag of Work Unit from the start of
226 * {@code queue.dat}.
227 *
228 * @since 5.00
229 */
230 int TAG_POS = 548;
231 /**
232 * Position in bytes of padding from the start of {@code queue.dat}
233 * (All Zeros).
234 */
235 int Z564_POS = 564;
236 /**
237 * Position in bytes of Passkey from the start of {@code queue.dat}.
238 *
239 * @since 6.00
240 */
241 int PASSKEY_POS = 580;
242 /**
243 * Position in bytes of Flops per CPU (core) from the start of
244 * {@code queue.dat}.
245 *
246 * @since 6.00
247 */
248 int FLOPS_POS = 612;
249 /**
250 * Position in bytes of Available memory from the start of
251 * {@code queue.dat}.
252 *
253 * @since 6.00
254 */
255 int MEMORY_POS = 616;
256 /**
257 * Position in bytes of Available GPU memory from the start of
258 * {@code queue.dat}.
259 *
260 * @since 6.20
261 */
262 int GPU_MEMORY_POS = 620;
263 /**
264 * Position in bytes of padding from the start of {@code queue.dat}
265 * (All Zeros).
266 */
267 int Z624_POS = 624;
268 /**
269 * Position in bytes of WU expiration time from the start of
270 * {@code queue.dat}.
271 */
272 int DUE_POS = 688;
273 /**
274 * Position in bytes of Packet size limit from the start of
275 * {@code queue.dat}.
276 *
277 * @since 5.00
278 */
279 int PLIMIT_POS = 704;
280 /**
281 * Position in bytes of Number of upload failures from the start of
282 * {@code queue.dat}.
283 *
284 * @since 5.00
285 */
286 int UPLOADS_POS = 708;
287 // </editor-fold>
288 // <editor-fold defaultstate="collapsed" desc="length-constants">
289 /**
290 * Length in bytes of the Status in {@code queue.dat}.
291 *
292 * @see #getStat()
293 * @see #STAT_POS
294 */
295 int STAT_LENGTH = 4;
296 /**
297 * Length in bytes of the Pad for Windows in {@code queue.dat}.
298 *
299 * @since 4.01 Pad for others
300 * @since 6.01 Number of SMP Cores to use
301 * @deprecated Use {@link #CORES_POS}
302 */
303 int Z004_LENGTH = 4;
304 /**
305 * Length in bytes of the Time data in {@code queue.dat}.
306 *
307 * @see #getTdata()
308 * @see #TDATA_POS
309 */
310 int TDATA_LENGTH = 32;
311 /**
312 * Length in bytes of the Server IP address in {@code queue.dat}.
313 *
314 * @deprecated As of 3.00 replaced by {@link #SVR2_POS}
315 */
316 int SVR1_LENGTH = 4;
317 /**
318 * Length in bytes of the Upload Status in {@code queue.dat}.
319 *
320 * @see #getUstat()
321 * @see #USTAT_POS
322 */
323 int USTAT_LENGTH = 4;
324 /**
325 * Length in bytes of the Web address for core downloads in
326 * {@code queue.dat}.
327 *
328 * @see #getUrl()
329 * @see #URL_POS
330 */
331 int URL_LENGTH = 128;
332 /**
333 * Length in bytes of the Misc1a in {@code queue.dat}.
334 *
335 * @see #M176_POS
336 */
337 int M176_LENGTH = 4;
338 /**
339 * Length in bytes of the Core_xx number (hex) in {@code queue.dat}.
340 *
341 * @see #getCore()
342 * @see #CORE_POS
343 */
344 int CORE_LENGTH = 4;
345 /**
346 * Length in bytes of the Misc1b in {@code queue.dat}.
347 *
348 * @see #M184_POS
349 */
350 int M184_LENGTH = 4;
351 /**
352 * Length in bytes of the wudata_xx.dat file size in {@code queue.dat}.
353 *
354 * @see #getDsiz()
355 * @see #DSIZ_POS
356 */
357 int DSIZ_LENGTH = 4;
358 /**
359 * Length in bytes of the z192 in {@code queue.dat}.
360 *
361 * @see #Z192_POS
362 */
363 int Z192_LENGTH = 16;
364 /**
365 * Length in bytes of the Work unit ID information in {@code queue.dat}.
366 *
367 * @see #getWuid()
368 * @see #WUID_POS
369 */
370 int WUID_LENGTH = 16;
371 /**
372 * Length in bytes of the z224 in {@code queue.dat}.
373 *
374 * @see #Z224_POS
375 */
376 int Z224_LENGTH = 36;
377 /**
378 * Length in bytes of the Machine ID in {@code queue.dat}.
379 *
380 * @see #getMid()
381 * @see #MID_POS
382 */
383 int MID_LENGTH = 4;
384 /**
385 * Length in bytes of the Server IP address in {@code queue.dat}.
386 *
387 * @see #getSvr2()
388 * @see #SVR2_POS
389 */
390 int SVR2_LENGTH = 4;
391 /**
392 * Length in bytes of the Server port number in {@code queue.dat}.
393 *
394 * @see #getPort()
395 * @see #PORT_POS
396 */
397 int PORT_LENGTH = 4;
398 /**
399 * Length in bytes of the Work unit type in {@code queue.dat}.
400 *
401 * @see #getType()
402 * @see #TYPE_POS
403 */
404 int TYPE_LENGTH = 64;
405 /**
406 * Length in bytes of the User Name in {@code queue.dat}.
407 *
408 * @see #getUname()
409 * @see #UNAME_POS
410 */
411 int UNAME_LENGTH = 64;
412 /**
413 * Length in bytes of the Team Number in {@code queue.dat}.
414 *
415 * @see #getTeamn()
416 * @see #TEAMN_POS
417 */
418 int TEAMN_LENGTH = 64;
419 /**
420 * Length in bytes of the Stored ID for unit (UserID + MachineID)
421 * in {@code queue.dat}.
422 *
423 * @see #getUid()
424 * @see #UID_POS
425 */
426 int UID_LENGTH = 8;
427 /**
428 * Length in bytes of the Benchmark in {@code queue.dat}.
429 *
430 * @since 3.24
431 * @see #getBench()
432 * @see #BENCH_POS
433 */
434 int BENCH_LENGTH = 4;
435 /**
436 * Length in bytes of Misc3b in {@code queue.dat}.
437 *
438 * @deprecated 3.24
439 */
440 int M476_LENGTH = 4;
441 /**
442 * Length in bytes of the CPU type in {@code queue.dat}.
443 *
444 * @see #getCpuType()
445 * @see #CPU_TYPE_POS
446 */
447 int CPU_TYPE_LENGTH = 4;
448 /**
449 * Length in bytes of the OS type in {@code queue.dat}.
450 *
451 * @see #getOsType()
452 * @see #OS_TYPE_POS
453 */
454 int OS_TYPE_LENGTH = 4;
455 /**
456 * Length in bytes of the CPU species in {@code queue.dat}.
457 *
458 * @see #getCpuSpec()
459 * @see #CPU_SPEC_POS
460 */
461 int CPU_SPEC_LENGTH = 4;
462 /**
463 * Length in bytes of the OS species in {@code queue.dat}.
464 *
465 * @see #getOsSpec()
466 * @see #OS_SPEC_POS
467 */
468 int OS_SPEC_LENGTH = 4;
469 /**
470 * Length in bytes of the Allowed time to return (seconds)
471 * in {@code queue.dat}.
472 *
473 * @see #getExpire()
474 * @see #EXPIRE_POS
475 */
476 int EXPIRE_LENGTH = 4;
477 /**
478 * Length in bytes of the z500 in {@code queue.dat}.
479 *
480 * @see #Z500_POS
481 */
482 int Z500_LENGTH = 4;
483 /**
484 * Length in bytes of the Client type required in {@code queue.dat}.
485 *
486 * @see #getCltype()
487 * @see #CLTYPE_POS
488 */
489 int CLTYPE_LENGTH = 4;
490 /**
491 * Length in bytes of the Assignment info present flag in {@code queue.dat}.
492 *
493 * @see #getAiflag()
494 * @see #AIFLAG_POS
495 */
496 int AIFLAG_LENGTH = 4;
497 /**
498 * Length in bytes of the Assignment timestamp in {@code queue.dat}.
499 *
500 * @see #getAitime()
501 * @see #AITIME_POS
502 */
503 int AITIME_LENGTH = 4;
504 /**
505 * Length in bytes of the Assignment info in {@code queue.dat}.
506 *
507 * @see #getAidata()
508 * @see #AIDATA_POS
509 */
510 int AIDATA_LENGTH = 4;
511 /**
512 * Length in bytes of the Collection server IP address in {@code queue.dat}.
513 *
514 * @since 5.00
515 * @see #getCsip()
516 * @see #CSIP_POS
517 */
518 int CSIP_LENGTH = 4;
519 /**
520 * Length in bytes of the Download started time in {@code queue.dat}.
521 *
522 * @since 5.00
523 * @see #getDstart()
524 * @see #DSTART_POS
525 */
526 int DSTART_LENGTH = 4;
527 /**
528 * Length in bytes of the z528 in {@code queue.dat}.
529 *
530 * @see #Z528_POS
531 */
532 int Z528_LENGTH = 4;
533 /**
534 * Length in bytes of the Misc4a in {@code queue.dat}.
535 *
536 * @see #M532_POS
537 */
538 int M532_LENGTH = 4;
539 /**
540 * Length in bytes of the z536 in {@code queue.dat}.
541 *
542 * @see #Z536_POS
543 */
544 int Z536_LENGTH = 8;
545 /**
546 * Length in bytes of the Number of SMP cores in {@code queue.dat}.
547 *
548 * @since 5.91
549 * @see #getCores()
550 * @see #CORES_POS
551 */
552 int CORES_LENGTH = 4;
553 /**
554 * Length in bytes of the Tag of Work Unit in {@code queue.dat}.
555 *
556 * @since 5.00
557 * @see #getCores()
558 * @see #CORES_POS
559 */
560 int TAG_LENGTH = 16;
561 /**
562 * Length in bytes of the z564 in {@code queue.dat}.
563 *
564 * @see #Z564_POS
565 */
566 int Z564_LENGTH = 16;
567 /**
568 * Length in bytes of the Passkey in {@code queue.dat}.
569 *
570 * @since 6.00
571 * @see #getPasskey()
572 * @see #PASSKEY_POS
573 */
574 int PASSKEY_LENGTH = 32;
575 /**
576 * Length in bytes of the Flops per CPU (core) in {@code queue.dat}.
577 *
578 * @since 6.00
579 * @see #getFlops()
580 * @see #FLOPS_POS
581 */
582 int FLOPS_LENGTH = 4;
583 /**
584 * Length in bytes of the Available memory in {@code queue.dat}.
585 *
586 * @since 6.00
587 * @see #getMemory()
588 * @see #MEMORY_POS
589 */
590 int MEMORY_LENGTH = 4;
591 /**
592 * Length in bytes of the Available GPU memory in {@code queue.dat}.
593 *
594 * @since 6.20
595 * @see #getGpuMemory()
596 * @see #GPU_MEMORY_POS
597 */
598 int GPU_MEMORY_LENGTH = 4;
599 /**
600 * Length in bytes of the z624 in {@code queue.dat}.
601 *
602 * @see #Z624_POS
603 */
604 int Z624_LENGTH = 64;
605 /**
606 * Length in bytes of the WU expiration time in {@code queue.dat}.
607 *
608 * @see #getDue()
609 * @see #DUE_POS
610 */
611 int DUE_LENGTH = 16;
612 /**
613 * Length in bytes of the Packet size limit in {@code queue.dat}.
614 *
615 * @since 5.00
616 * @see #getPlimit()
617 * @see #PLIMIT_POS
618 */
619 int PLIMIT_LENGTH = 4;
620 /**
621 * Length in bytes of the Number of upload failures in {@code queue.dat}.
622 *
623 * @since 5.00
624 * @see #getUploads()
625 * @see #UPLOADS_POS
626 */
627 int UPLOADS_LENGTH = 4;
628 // </editor-fold>
629 // <editor-fold desc="Accessors">
630 /**
631 * Get the value of Status.
632 *
633 * @return the value of stat
634 */
635 int getStat();
636 /**
637 * Get the value of Time data.
638 *
639 * @return the value of tdata
640 */
641 Date getTdata();
642 /**
643 * Get the value of Server IP address.
644 *
645 * @return the value of svr1
646 */
647 InetAddress getSvr1();
648 /**
649 * Get the value of Upload status.
650 *
651 * @return the value of ustat
652 */
653 int getUstat();
654 /**
655 * Get the value of Web address for core download.
656 *
657 * @return the value of url
658 */
659 URL getUrl();
660 /**
661 * Get the value of Core_xx number (hex).
662 *
663 * @return the value of core
664 */
665 Core getCore();
666 /**
667 * Get the value of wudata_xx.dat file size.
668 *
669 * @return the value of dsiz
670 */
671 int getDsiz();
672 /**
673 * Get the value of Work unit ID information.
674 *
675 * @return the value of wuid
676 */
677 WorkUnitImpl getWuid();
678 /**
679 * Get the value of Machine ID.
680 *
681 * @return the value of mid
682 */
683 int getMid();
684 /**
685 * Get the value of Server IP address.
686 *
687 * @return the value of svr2
688 */
689 InetAddress getSvr2();
690 /**
691 * Get the value of Server port number.
692 *
693 * @return the value of port
694 */
695 int getPort();
696 /**
697 * Get the value of Work unit type.
698 *
699 * @return the value of type
700 */
701 String getType();
702 /**
703 * Get the value of User Name.
704 *
705 * @return the value of uname
706 */
707 String getUname();
708 /**
709 * Get the value of Team Number.
710 *
711 * @return the value of teamn
712 */
713 int getTeamn();
714 /**
715 * Get the value of Stored ID for unit (UserID + MachineID).
716 *
717 * @return the value of uid
718 */
719 long getUid();
720 /**
721 * Get the value of Benchmark.
722 *
723 * @since 3.24
724 * @return the value of bench
725 */
726 int getBench();
727 /**
728 * Get the value of CPU type.
729 *
730 * @since 3.00
731 * @return the value of cpu_type
732 */
733 String getCpuType();
734 /**
735 * Get the value of OS type.
736 *
737 * @since 3.00
738 * @return the value of os_type
739 */
740 String getOsType();
741 /**
742 * Get the value of CPU species.
743 *
744 * @return the value of cpu_spec
745 */
746 String getCpuSpec();
747 /**
748 * Get the value of OS species.
749 *
750 * @return the value of os_spec
751 */
752 String getOsSpec();
753 /**
754 * Get the value of Allowed time to return (seconds).
755 *
756 * @return the value of expire
757 */
758 Date getExpire();
759 /**
760 * Get the value of Client type required (usually 0).
761 *
762 * @return the value of cltype
763 */
764 int getCltype();
765 /**
766 * Get the value of Assignment info present flag.
767 *
768 * @return the value of aiflag
769 */
770 boolean getAiflag();
771 /**
772 * Get the value of Assignment timestamp.
773 *
774 * @return the value of aitime
775 */
776 Date getAitime();
777 /**
778 * Get the value of Assignment info.
779 *
780 * @return the value of aidata
781 */
782 long getAidata();
783 /**
784 * Get the value of Collection server IP address.
785 *
786 * @return the value of csip
787 */
788 InetAddress getCsip();
789 /**
790 * Get the value of Download started time.
791 *
792 * @since 5.00
793 * @return the value of dstart
794 */
795 Date getDstart();
796 /**
797 * Get the value of Number of SMP cores.
798 *
799 * @since 5.91
800 * @return the value of cores
801 */
802 int getCores();
803 /**
804 * Get the value of Tag of Work Unit.
805 *
806 * @since 5.00
807 * @return the value of tag
808 */
809 String getTag();
810 /**
811 * Get the value of Passkey.
812 *
813 * @since 6.00
814 * @return the value of passkey
815 */
816 String getPasskey();
817 /**
818 * Get the value of Flops per CPU (core).
819 *
820 * @since 6.00
821 * @return the value of flops
822 */
823 int getFlops();
824 /**
825 * Get the value of Available memory.
826 *
827 * @since 6.00
828 * @return the value of memory
829 */
830 int getMemory();
831 /**
832 * Get the value of Available GPU memory.
833 *
834 * @since 6.20
835 * @return the value of gpu_memory
836 */
837 int getGpuMemory();
838 /**
839 * Get the value of WU expiration time.
840 *
841 * @return the value of due
842 */
843 Date getDue();
844 /**
845 * Get the value of Packet size limit.
846 *
847 * @since 5.00
848 * @return the value of plimit
849 */
850 int getPlimit();
851 /**
852 * Get the value of Number of upload failures.
853 *
854 * @since 5.00
855 * @return the value of uploads
856 */
857 int getUploads();
858 // </editor-fold>
859
860 /**
861 * Update all values.
862 */
863 void update();
864 }