Browse Source

ID des nœuds en hexa (please !).

master
Stéphane 6 years ago
parent
commit
bd7ceb7905
2 changed files with 7 additions and 2 deletions
  1. +2
    -0
      interface.h
  2. +5
    -2
      node.c

+ 2
- 0
interface.h View File

@@ -31,6 +31,8 @@ struct list_subscription_t {
int fd_command_listen, fd_command_client;
};

int char_hexa_to_uint32(const char *const argv, uint32_t *nombre);

/* initialise la liste en mettant le port port_listen en écoute pour recevoir les commandes «subscribe» et «unsubscribe» */
int list_subscription_init(struct list_subscription_t *list_p, int port_listen);
/* détruit la liste */

+ 5
- 2
node.c View File

@@ -442,6 +442,9 @@ int main(int argc, char **argv) {
return 1;
}

uint32_t id;
char_hexa_to_uint32(argv[5], &id);

/* threads de la couche 1, transmission de la trame */
struct layer1_parm_t layer1_parm;
layer1_parm.next_node_ip = inet_addr(argv[1]);
@@ -449,10 +452,10 @@ int main(int argc, char **argv) {
layer1_parm.node_port = htons(atoi(argv[3]));
layer1_parm.node_address = atoi(argv[4]);

printfdbg("Subscribe port: %d\n", atoi(argv[5]));
printfdbg("Subscribe port: %d\n", id);

/* Initialisation de la liste d'inscriptions */
list_subscription_init(&list_subscription, atoi(argv[5]));
list_subscription_init(&list_subscription, id);

pthread_t layer1_thread; /* réception/réémission trame */
pthread_create(&layer1_thread, NULL, layer1_frame, &layer1_parm);

Loading…
Cancel
Save