summaryrefslogtreecommitdiffhomepage
path: root/NetEx/HttpSession.h
blob: e8d67f80f7e04df56e4baac2c2f0ce9d27212444 (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
42
43
44
45
46
47
48
49
/*  Starshatter: The Open Source Project
    Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
    Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
    Copyright (c) 1997-2006, Destroyer Studios LLC.
*/

#ifndef HttpSession_h
#define HttpSession_h

#include "HttpParam.h"
#include "List.h"
#include "Text.h"


class HttpSession
{
public:
    static const char* TYPENAME() { return "HttpSession"; }

    HttpSession();
    virtual ~HttpSession();

    int operator == (const HttpSession& s) const { return id == s.id; }

    Text              GenerateUniqueID();

    Text              GetID()              const { return id;         }
    void              SetID(const char* i)       { id = i;            }
    int               GetLastAccess()      const { return access_time;}
    void              Access();

    List<HttpParam>&  GetAttributes()            { return attributes; }

    Text              GetAttribute(const char* name);
    void              SetAttribute(const char* name, const char* value);
    void              DelAttribute(const char* name);

    int               GetIntAttribute(const char* name);
    void              SetIntAttribute(const char* name, int value);
    void              DelIntAttribute(const char* name);

protected:
    Text              id;
    int               access_time;
    List<HttpParam>   attributes;
};


#endif  // HttpSession_h