-
Ben Laughton authored
Detail In net/if.h struct if_data was defined within struct ifnet, but also referred to later outside of struct ifnet. This is fine in C since the scope of strutures persists to the end of the translation unit, but in C++ it persists until the end of the block. This problem is solved by moving the definition of struct if_data out of struct ifnet and into the outermost level, as it is in the current FreeBSD sources. In sys/mbuf.h there were two defintions of struct mbuf; one was for ANSI C and one was for K&R C, and the appropriate one was chosen by testing whether __STDC__ was defined or not. The ANSI C version of the structure has const members in it, which C++ does not allow unless the structure/class has a constructor (since const members can only be initialised in a constructor's initialiser-list). The C++ standard says that use of __STDC__ is implementation defined, which means we can't rely on picking up the non-ANSI C version of the structure in C++ code. A third definition of the structure has been added, which is used if __cplusplus is defined. It retains the const members, but declares a private constructor, which keeps the compiler happy with respect to the const members. Under the terms of the C++ standard, this is still a 'P.O.D.' (Plain Old Data) structure, so it is guaranteed to have the same storage layout as the C one. In addition, the m_sys* members have been made private, since the client should never access these. Admin Tested with the ATM driver to verify the the changes work with C++. Tested with PPP to ensure that things still work for C. Version incremented to 5.10 and tagged. Version 5.10. Tagged as 'TCPIPLibs-5_10'
9ba0f2ae