85 |
} // main() |
} // main() |
86 |
|
|
87 |
void show_usage(int exitcode) |
void show_usage(int exitcode) |
88 |
{ |
{ |
89 |
fprintf((exitcode == EXIT_SUCCESS) ? stdout : stderr, |
fprintf((exitcode == EXIT_SUCCESS) ? stdout : stderr, |
90 |
"Usage: %s [-h] [-v] filename\n" |
"Usage: %s [-h] [-v] filename\n" |
91 |
" E.g.: %s darkstat.db\n", |
" E.g.: %s darkstat.db\n", |
92 |
progname, progname); |
progname, progname); |
93 |
|
|
94 |
exit(exitcode); |
exit(exitcode); |
95 |
} // show_usage() |
} // show_usage() |
96 |
|
|
97 |
void show_version(void) |
void show_version(void) |
98 |
{ |
{ |
99 |
puts("darkstattype 1.0"); |
puts("darkstattype 1.0"); |
100 |
|
puts("$Ximalas$"); |
101 |
puts(""); |
puts(""); |
102 |
|
|
103 |
puts("Copyright © 2014, Trond Endrestøl <Trond.Endrestol@ximalas.info>"); |
puts("Copyright © 2014, Trond Endrestøl <Trond.Endrestol@ximalas.info>"); |
104 |
puts("All rights reserved."); |
puts("All rights reserved."); |
105 |
puts(""); |
puts(""); |
106 |
puts("Redistribution and use in source and binary forms, with or without"); |
puts("Redistribution and use in source and binary forms, with or without"); |
107 |
puts("modification, are permitted provided that the following conditions are met:"); |
puts("modification, are permitted provided that the following conditions are met:"); |
108 |
puts(""); |
puts(""); |
109 |
puts("1. Redistributions of source code must retain the above copyright notice, this"); |
puts("1. Redistributions of source code must retain the above copyright notice, this"); |
110 |
puts(" list of conditions and the following disclaimer."); |
puts(" list of conditions and the following disclaimer."); |
111 |
puts("2. Redistributions in binary form must reproduce the above copyright notice,"); |
puts("2. Redistributions in binary form must reproduce the above copyright notice,"); |
112 |
puts(" this list of conditions and the following disclaimer in the documentation"); |
puts(" this list of conditions and the following disclaimer in the documentation"); |
113 |
puts(" and/or other materials provided with the distribution."); |
puts(" and/or other materials provided with the distribution."); |
114 |
puts(""); |
puts(""); |
115 |
puts("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND"); |
puts("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND"); |
574 |
|
|
575 |
indent(); |
indent(); |
576 |
|
|
577 |
for (u = 0; u < ipprotocount; u++) { |
for (u = 0; u < ipprotocount; u++) { |
578 |
unsigned char proto; |
unsigned char proto; |
579 |
unsigned long in; |
unsigned long in; |
580 |
unsigned long out; |
unsigned long out; |
581 |
|
|
582 |
print_indentation(); |
print_indentation(); |
583 |
printf("Protocol #%u of %u:\n", u + 1, ipprotocount); |
printf("Protocol #%u of %u:\n", u + 1, ipprotocount); |
584 |
|
|
585 |
proto = read8u(); |
proto = read8u(); |
586 |
|
|
587 |
indent(); |
indent(); |
588 |
print_indentation(); |
print_indentation(); |
589 |
printf("Protocol 0x%x\n", proto); |
printf("Protocol 0x%02x\n", proto); |
590 |
|
|
591 |
in = read64u(); |
in = read64u(); |
592 |
|
|
593 |
print_indentation(); |
print_indentation(); |
594 |
printf("In %lu\n", in); |
printf("In %lu\n", in); |
595 |
|
|
596 |
out = read64u(); |
out = read64u(); |
597 |
|
|
598 |
print_indentation(); |
print_indentation(); |
599 |
printf("Out %lu\n", out); |
printf("Out %lu\n", out); |
600 |
|
|
601 |
exdent(); |
exdent(); |
602 |
} // for |
} // for |
603 |
|
|
604 |
exdent(); |
exdent(); |