-
Notifications
You must be signed in to change notification settings - Fork 0
/
database.h
executable file
·36 lines (34 loc) · 912 Bytes
/
database.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/***
*
*/
#ifndef __DATABASE_H
#define __DATABASE_H
/******************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
/******************************************************************************/
struct node
{
struct node * next;
char * id;
unsigned short port;
unsigned long ip;
};
struct database
{
int n_nodes;
struct node * first;
};
/******************************************************************************/
int init_database();
int insert_record(char * id, unsigned short port, unsigned long ip);
int consult_record(char * id, unsigned short * port, unsigned long * ip);
int delete_record(char * id);
void print_database();
void delete_database();
/******************************************************************************/
#endif