summaryrefslogtreecommitdiffstats
path: root/hw4/chttpd/chttpd-server.h
blob: e85716b1f203f64aa0682ad0f246a4166cc5f330 (plain) (blame)
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
#ifndef CHTTPD_SERVER_H
#define CHTTPD_SERVER_H

#include <l4list.h>
#include <pthread.h>
#include <stdbool.h>
#include <sys/socket.h>

typedef struct {
    /* read-only */
    int sockfd;
    struct sockaddr_storage addr;
    socklen_t addrlen;
    int attr_admin : 1;
    ChttpdLog* hlog;

    /* read-write and lock */
    pthread_rwlock_t lock;
    LbsListMeta* conn;
    int attr_close : 1;
} ChttpdServer;

extern int                chttpd_server_notify;
extern pthread_mutex_t    chttpd_server_notify_mutex;
extern ChttpdServer       chttpd_server_notify_data;

extern unsigned long long chttpd_server_count;
extern pthread_rwlock_t   chttpd_server_count_lock;

void chttpd_server_ctor (void* server_generic, ChttpdLog* hlog, bool is_admin);
void chttpd_server_dtor (void* server_generic);

#endif /* CHTTPD_SERVER_H */