summaryrefslogtreecommitdiff
path: root/src/phonebook.h
blob: 3b4cf790342297bc8c711029c4eef917687deb9a (plain)
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
37
38
39
40
41
#ifndef __PHONEBOOK_H
#define __PHONEBOOK_H

#include "atcmd.h"
#include "list.h"

#define PHONEBOOK_ADDR_SIZE		64
#define PHONEBOOK_TEXT_SIZE		64

struct phonebook_entry {
	int index;
	char addr[PHONEBOOK_ADDR_SIZE];
	int type;
	char name[PHONEBOOK_TEXT_SIZE];
	struct list_head list;
};

void phonebook_entry_free(struct phonebook_entry *entry);
struct phonebook_entry *phonebook_entry_alloc(void);
struct phonebook_entry *phonebook_find_by_name(struct list_head *head,
		const char *name);
struct phonebook_entry *phonebook_search_names_i(struct list_head *head,
		const char *name);

struct phonebook_list_info {
	struct phonebook_store store;
	char store_select[STORE_NAME_SIZE];
	int state;

	int nr_lines;
	int nr_entries;

	struct list_head entry_list;
};

void phonebook_list_free(struct phonebook_list_info *list_info);
int phonebook_list_get(int fd, struct phonebook_list_info *list_info);

int print_phonebook_list(int fd, const char *store);

#endif /* ~__PHONEBOOK_H */