To avoid the error you mention you should move this:
struct bridge
{
int s;
};
to bridge.h
.
Currently it is declared local to the module (translation unit) bridge.c
and so its members are not know to the outside world.
Alternativly, if you want to hide the internals of struct bridge
, you need to add a getter and a setter function to the module bridge.c
for each member which you want to access from the outside like for example so:
bridge.h
typedef struct bridge bridge_t;
void brigde_s_set(bridge_t *, int);
int bridge_s_get(bridge_t *);
bridge.c
#include "bridge.h"
struct bridge
{
int s;
};
int brigde_s_set(bridge_t * pb, int s)
{
pb->s = s;
}
int bridge_s_get(bridge_t * pb)
{
return pb->s;
}
So the snippet from your main.c
would then look like:
#include "bridge.h"
...
bridge_t * bridge_p = bridge_new(); //Create / init our bridge
bridge_s_set(bridge_p,
server_connect(options.server_p, options.dest_port, options.ifname_p, options.gateway_p));