Commit Graph

17 Commits

Author SHA1 Message Date
endoffile78
59e2a844f0 Revert "Portability fixes"
This reverts commit f3469070fe.
2017-01-05 15:16:56 -06:00
David Zero
f3469070fe Portability fixes
- CFLAG gnu99 was changed to c99.
- CXXFLAG c++98 was changed to c++11.
- CFLAG -pedantic-errors was added so that non-ISO C now throws errors.
- _XOPEN_SOURCE feature test macro added and set to 600 to expose SUSv3
  and c99 definitions in modules that required them.
- Fixed tests (and bootstrap daemon logging) that were failing due to
  the altered build flags.
- Avoid string suffix misinterpretation; explicit narrowing conversion.
- Misc. additions to .gitignore to make sure build artifacts don't wind
  up in version control.
2017-01-04 13:44:39 -08:00
iphydf
ad26560516
Improve static and const correctness.
- Any non-externally-visible declarations should be `static`.
- Casting away the `const` qualifier from pointers-to-const is
  dangerous. All but one instance of this are now correct. The one
  instance where we can't keep `const` is one where toxav code actually
  writes to a chunk of memory marked as `const`. This code also assumes
  4 byte alignment of data packets. I don't know whether that is a valid
  assumption, but it's likely unportable, and *not* obviously correct.
- Replaced empty parameter lists with `(void)` to avoid passing
  parameters to it. Empty parameter lists are old style declarations for
  unknown number and type of arguments.
- Commented out (as `#if DHT_HARDENING` block) the hardening code that
  was never executed.
- Minor style fix: don't use `default` in enum-switches unless the number
  of enumerators in the default case is very large. In this case, it was
  2, so we want to list them both explicitly to be warned about missing
  one if we add one in the future.
- Removed the only two function declarations from nTox.h and put them
  into nTox.c. They are not used outside and nTox is not a library.
2016-09-06 11:54:37 +01:00
iphydf
77db27331e
Sort #includes in all source files. 2016-09-01 16:35:46 +01:00
Roman Yepishev
c886f906a8
Move argument comments to the end of line 2016-02-27 14:32:49 -05:00
Roman Yepishev
32d86978fd
Remove unused main() arguments 2016-02-27 12:07:04 -05:00
Roman Yepishev
9035325e56
Remove magic numbers from addr_resolve
* Add #defines for INET/INET6 returns
* Remove magic number 3 - exact AF_INET/INET6 result found.
* Updated network_test.c
2016-02-27 11:45:02 -05:00
irungentoo
939f2003ef
Removed now useless network sturct size tests. 2014-09-26 18:01:03 -04:00
pyruvate
ec9082f2c3 Remove DEFTESTCASE and DEFTESTCASE_SLOW redefinitions 2014-08-09 11:33:20 +03:00
irungentoo
f9bf7b074a
Major protocol changes, this commit breaks all network compatibility.
Removed a bunch of useless space from various structs.

pack_nodes() and unpack_nodes() are now used to transmit lists of
nodes for the DHT and onion parts. They provide a way to transmit
both ipv6 and ipv4 nodes in the same packet in a portable way that
takes as little space as possible without compression.

Using pack_nodes, merged the send nodes and send nodes ipv6 packets
into one packet greatly reducing the risk of amplification attacks.
2014-04-15 18:09:07 -04:00
irungentoo
62ef4ed95d Astyled and added tests. 2014-02-18 13:49:17 -05:00
irungentoo
4b4507b44f Fixed test issue. 2014-02-17 19:28:31 -05:00
irungentoo
00100ea335 random_nodes_path should return slightly better paths.
Fixed test in network_test failing on some machines because of localhost
ipv6 issues.
2014-01-21 11:14:16 -05:00
irungentoo
1c45e59938 Added/updated some basic docs and cleaned up some things. 2013-12-07 19:06:41 -05:00
Coren[m]
6fe25e4f6f Permit -Wshadow as useful warning. 2013-09-27 11:24:33 +02:00
irungentoo
5a83c1296c astyled everything. 2013-09-17 16:28:39 -04:00
Coren[m]
ee1cc34d55 Fix in ip_equal, plus testing code which led to that fix...
network.c:
- use the correct macro for IPv4-in-IPv6 test

network_test.c:
- bunch of tests for addr_resolve() and ip_equal()
2013-09-15 23:39:09 +02:00