Scheme.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 29 Authenticator */
10 
11 #include "squid.h"
12 #include "auth/Gadgets.h"
13 #include "auth/Scheme.h"
14 #include "auth/SchemeConfig.h"
15 #include "globals.h"
16 
17 std::vector<Auth::Scheme::Pointer> *Auth::Scheme::_Schemes = nullptr;
18 
19 void
21 {
22  iterator i = GetSchemes().begin();
23 
24  while (i != GetSchemes().end()) {
25  assert(strcmp((*i)->type(), instance->type()) != 0);
26  ++i;
27  }
28 
29  GetSchemes().push_back(instance);
30 }
31 
33 Auth::Scheme::Find(const char *typestr)
34 {
35  for (iterator i = GetSchemes().begin(); i != GetSchemes().end(); ++i) {
36  if (strcmp((*i)->type(), typestr) == 0)
37  return *i;
38  }
39 
40  return Auth::Scheme::Pointer(nullptr);
41 }
42 
43 std::vector<Auth::Scheme::Pointer> &
45 {
46  if (!_Schemes)
47  _Schemes = new std::vector<Auth::Scheme::Pointer>;
48 
49  return *_Schemes;
50 }
51 
59 void
61 {
63 
64  while (GetSchemes().size()) {
65  Auth::Scheme::Pointer scheme = GetSchemes().back();
66  GetSchemes().pop_back();
67  scheme->shutdownCleanup();
68  }
69 }
70 
RefCount< Scheme > Pointer
Definition: Scheme.h:30
static std::vector< Scheme::Pointer > * _Schemes
Definition: Scheme.h:70
static void AddScheme(Scheme::Pointer)
Definition: Scheme.cc:20
int size
Definition: ModDevPoll.cc:69
#define assert(EX)
Definition: assert.h:17
std::vector< Scheme::Pointer >::iterator iterator
Definition: Scheme.h:31
static std::vector< Scheme::Pointer > & GetSchemes()
Definition: Scheme.cc:44
static Scheme::Pointer Find(const char *)
Definition: Scheme.cc:33
int shutting_down
static void FreeAll()
Definition: Scheme.cc:60

 

Introduction

Documentation

Support

Miscellaneous