Sign in to follow this  

[2016-04-16] introduction of private headers

Recommended Posts

Hello ~
For long time we had many functions or variables that were supposed to be kept privately used, but because of the design of our header files were kept a public access. This caused, on one hand, poor design choices (too much binding between separate components), and on the other hand, excessively long long re-compile for the whole project if anything changed in this headers (because cause any or all files can be affected). Now with private headers only the file meant to use this header will be recompiled resulting in less compile times, waaay less! :D
The login server client interface (lclif) was chosen as a working prototype of this, and now has a private interface (lclif.p.h) alongside its public interface (lclif.h).
Currently we will start limit the private function/variable/databases to a private interface under a private header only meant to be used by the module itself. This will stop other modules from accessing the private function/variable/databases (lclif.p.h should only be included by lclif.c, but never included by other .c files), however plugins will still be able to access it if they need to (the private interface is fully HPM and HPMHooking compliant).

The private interface is exposed through an opaque pointer inside the public interface.
the private data can be accessed through the interface through the private interface pointer
interface->p->private_function(); //General example
lclif->p->parse_sub(fd, sd); // Example for login client interface
to be able to use the private interface into your plugin please make sure to include the private header !
It's recommended to still include the public interface as well.
//General example
#include "project/file.h"
#include "project/file.p.h"
// Example to include Login Client Interface Private header
#include "login/lclif.h"
#include "login/lclif.p.h"
Merge Date:
Sat, 16 Apr 2016 15:37:47 +0200

Related Pull Requests:
- #1255 - - Login clif rewrite [hemagx]

Related Commits:
- 79d9ace - - Wed, 30 Mar 2016 23:58:17 +0200 Added support for private headers to the HPMDataCheck/HPMHooking generators [Haru]
- c0178d2 - - Thu, 31 Mar 2016 00:16:02 +0200 HPM Hooks Update [Haru]
- ab42483 - - Thu, 31 Mar 2016 14:42:56 +0200 Updated GNU Make build system to support private headers [Haru]
- 7555700 - - Mon, 28 Mar 2016 21:54:46 +0200 Rewrite client interface for login server (part 7) [hemagx]
- 37cc46c - - Thu, 31 Mar 2016 00:16:48 +0200 HPM Hooks Update [Haru]
- 15c9710 - - Sat, 16 Apr 2016 15:21:18 +0200 Moved packet_db to the private interface of lclif [Haru]
- 8448e3f - - Sat, 16 Apr 2016 15:22:21 +0200 HPM Hooks Update [Haru]
- bbcb040 - - Sat, 16 Apr 2016 15:37:47 +0200 Merge pull request #1255 from HerculesWS/login-clif_rewrite [Ibrahem Hossam]

View the full article

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this