mirror of
https://github.com/ntop/n2n.git
synced 2024-09-20 00:51:10 +02:00
Add comm_init() function
This commit is contained in:
parent
b5d4a70983
commit
acafbc61a1
|
@ -202,6 +202,19 @@ static int try_broadcast(n2n_sn_t * sss,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Initialise some fields of the community structure **/
|
||||||
|
int comm_init(struct sn_community *comm, char *cmn){
|
||||||
|
|
||||||
|
comm = (struct sn_community*)malloc(sizeof(struct sn_community));
|
||||||
|
memset(comm, 0, sizeof(struct sn_community));
|
||||||
|
|
||||||
|
strncpy((char*)comm->community, cmn, N2N_COMMUNITY_SIZE-1);
|
||||||
|
comm->community[N2N_COMMUNITY_SIZE-1] = '\0';
|
||||||
|
comm->is_federation = IS_NO_FEDERATION;
|
||||||
|
|
||||||
|
return 0; /* OK */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Initialise the supernode structure */
|
/** Initialise the supernode structure */
|
||||||
int sn_init(n2n_sn_t *sss) {
|
int sn_init(n2n_sn_t *sss) {
|
||||||
|
@ -969,11 +982,10 @@ static int process_udp(n2n_sn_t * sss,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!comm && (!sss->lock_communities || (match == 1))) {
|
if(!comm && (!sss->lock_communities || (match == 1))) {
|
||||||
comm = calloc(1, sizeof(struct sn_community));
|
|
||||||
|
comm_init(comm,(char *)cmn.community);
|
||||||
|
|
||||||
if(comm) {
|
if(comm) {
|
||||||
strncpy(comm->community, (char*)cmn.community, N2N_COMMUNITY_SIZE-1);
|
|
||||||
comm->community[N2N_COMMUNITY_SIZE-1] = '\0';
|
|
||||||
/* new communities introduced by REGISTERs could not have had encrypted header... */
|
/* new communities introduced by REGISTERs could not have had encrypted header... */
|
||||||
comm->header_encryption = HEADER_ENCRYPTION_NONE;
|
comm->header_encryption = HEADER_ENCRYPTION_NONE;
|
||||||
comm->header_encryption_ctx = NULL;
|
comm->header_encryption_ctx = NULL;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user