Moving node list into global scope.

This commit is contained in:
Nicolás A. Ortega
2017-07-02 13:38:20 +02:00
parent cafe6a7243
commit a393cb8b4e
8 changed files with 109 additions and 10 deletions

24
include/connection.h Normal file
View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2017 Ortega Froysa, Nicolás <deathsbreed@themusicinnoise.net>
* Author: Ortega Froysa, Nicolás <deathsbreed@themusicinnoise.net>
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
int NeoComm_connect_all_nodes();
int NeoComm_disconnect();

View File

@ -20,3 +20,13 @@
#pragma once
#include "nodes.h"
/**
* @brief Initializes all modules of the NeoComm framework.
*
* @param max_nodes Maximum number of nodes in directory.
*
* @return If all modules were initialized successfully then a 1 is returned,
* else 0 is returned.
*/
int NeoComm_init(unsigned int max_nodes);

View File

@ -28,12 +28,13 @@ struct address {
};
struct node {
// The address of the node
/// The address of the node.
struct address address;
// Whether or not it is a directory node/server
/// Whether or not it is a directory node/server.
int directory;
// Useful variables for passing on connections of new nodes
/// Number of connections a directory has.
unsigned int connections;
/// Maximum number of connections the directory can have.
unsigned int max_connections;
};
@ -49,6 +50,8 @@ struct node {
*/
int NeoComm_init_nodes(unsigned int max_nodes);
void NeoComm_deinit_nodes();
/**
* @brief Enlarge the list.
*