Simple Geolocalization and Course Transmission Protocol (SGCTP)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
parameters.hpp
Go to the documentation of this file.
1 // INDENTING (emacs/vi): -*- mode:c++; tab-width:2; c-basic-offset:2; intent-tabs-mode:nil; -*- ex: set tabstop=2 expandtab:
2 
3 /*
4  * Simple Geolocalization and Course Transmission Protocol (SGCTP)
5  * Copyright (C) 2014 Cedric Dufour <http://cedric.dufour.name>
6  *
7  * The Simple Geolocalization and Course Transmission Protocol (SGCTP) is
8  * free software:
9  * you can redistribute it and/or modify it under the terms of the GNU General
10  * Public License as published by the Free Software Foundation, Version 3.
11  *
12  * The Simple Geolocalization and Course Transmission Protocol (SGCTP) is
13  * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
14  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15  * PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License for more details.
18  */
19 
20 #ifndef SGCTP_CPARAMETERS_HPP
21 #define SGCTP_CPARAMETERS_HPP
22 
23 // C
24 #include <stdint.h>
25 #include <sys/socket.h>
26 
27 // SGCTP
28 #include "sgctp/principal.hpp"
29 
30 
31 // SGCTP namespace
32 namespace SGCTP
33 {
34 
36 
41  {
42 
43  //----------------------------------------------------------------------
44  // FIELDS
45  //----------------------------------------------------------------------
46 
47  protected:
49  struct sockaddr *ptSockaddr;
51  socklen_t *ptSocklenT;
52 
54  const char *pcPrincipalsPath;
57 
59  const unsigned char *pucPasswordSalt;
60 
61  //----------------------------------------------------------------------
62  // CONSTRUCTORS / DESTRUCTOR
63  //----------------------------------------------------------------------
64 
65  public:
67  {
68  reset();
69  };
71  {};
72 
73 
74  //----------------------------------------------------------------------
75  // METHODS
76  //----------------------------------------------------------------------
77 
78  //
79  // GETTERS
80  //
81 
82  public:
85  return &oPrincipal;
86  };
87 
88  //
89  // SETTERS
90  //
91 
92  public:
94  void reset()
95  {
96  ptSockaddr = NULL;
97  ptSocklenT = NULL;
98  pcPrincipalsPath = NULL;
99  oPrincipal.reset();
100  pucPasswordSalt = NULL;
101  };
102 
104 
108  void setSocketAddress( struct sockaddr *_ptSockaddr,
109  socklen_t *_ptSocklenT )
110  {
111  ptSockaddr = _ptSockaddr;
112  ptSocklenT = _ptSocklenT;
113  };
114 
115 
117 
120  void setPrincipalsPath( const char *_pcPrincipalsPath )
121  {
122  pcPrincipalsPath = _pcPrincipalsPath;
123  };
124 
126 
129  void setPasswordSalt( const unsigned char *_pucPasswordSalt )
130  {
131  pucPasswordSalt = _pucPasswordSalt;
132  };
133 
134  };
135 
136 }
137 
138 #endif // SGCTP_CPARAMETERS_HPP
void setPasswordSalt(const unsigned char *_pucPasswordSalt)
Set the cryptographic password salt/nonce (pointer to existing variable)
Definition: parameters.hpp:129
CPrincipal oPrincipal
Principal.
Definition: parameters.hpp:56
void setSocketAddress(struct sockaddr *_ptSockaddr, socklen_t *_ptSocklenT)
Set the network socket address (pointers to existing variables)
Definition: parameters.hpp:108
void setPrincipalsPath(const char *_pcPrincipalsPath)
Set the principals (database) path (pointer to existing variable)
Definition: parameters.hpp:120
void reset()
Reset (undefines) all data.
Definition: parameters.hpp:94
SGCTP principal.
Definition: principal.hpp:44
socklen_t * ptSocklenT
Network socket address length (pointer to existing variable)
Definition: parameters.hpp:51
CPrincipal * usePrincipal()
Return the principal (pointer)
Definition: parameters.hpp:84
SGCTP transmission/payload parameters.
Definition: parameters.hpp:40
void reset()
Resets all parameters.
Definition: principal.cpp:44
const char * pcPrincipalsPath
Principals (database) path (pointer to existing variable)
Definition: parameters.hpp:54
const unsigned char * pucPasswordSalt
Cryptographic password salt/nonce (pointer to existing variable)
Definition: parameters.hpp:59
struct sockaddr * ptSockaddr
Network socket address (pointer to existing variable)
Definition: parameters.hpp:49