scalab01.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ident "ldclt @(#)scalab01.h 1.3 01/03/14"
  2. /** BEGIN COPYRIGHT BLOCK
  3. * This Program is free software; you can redistribute it and/or modify it under
  4. * the terms of the GNU General Public License as published by the Free Software
  5. * Foundation; version 2 of the License.
  6. *
  7. * This Program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License along with
  12. * this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
  13. * Place, Suite 330, Boston, MA 02111-1307 USA.
  14. *
  15. * In addition, as a special exception, Red Hat, Inc. gives You the additional
  16. * right to link the code of this Program with code not covered under the GNU
  17. * General Public License ("Non-GPL Code") and to distribute linked combinations
  18. * including the two, subject to the limitations in this paragraph. Non-GPL Code
  19. * permitted under this exception must only link to the code of this Program
  20. * through those well defined interfaces identified in the file named EXCEPTION
  21. * found in the source code files (the "Approved Interfaces"). The files of
  22. * Non-GPL Code may instantiate templates or use macros or inline functions from
  23. * the Approved Interfaces without causing the resulting work to be covered by
  24. * the GNU General Public License. Only Red Hat, Inc. may make changes or
  25. * additions to the list of Approved Interfaces. You must obey the GNU General
  26. * Public License in all respects for all of the Program code and other code used
  27. * in conjunction with the Program except the Non-GPL Code covered by this
  28. * exception. If you modify this file, you may extend this exception to your
  29. * version of the file, but you are not obligated to do so. If you do not wish to
  30. * provide this exception without modification, you must delete this exception
  31. * statement from your version and license this file solely under the GPL without
  32. * exception.
  33. *
  34. *
  35. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  36. * Copyright (C) 2006 Red Hat, Inc.
  37. * All rights reserved.
  38. * END COPYRIGHT BLOCK **/
  39. #ifdef HAVE_CONFIG_H
  40. # include <config.h>
  41. #endif
  42. /*
  43. FILE : scalab01.h
  44. AUTHOR : Jean-Luc SCHWING
  45. VERSION : 1.0
  46. DATE : 12 January 2001
  47. DESCRIPTION :
  48. This file contains the definitions related to the
  49. scenario scalab01 of ldclt.
  50. LOCAL : None.
  51. HISTORY :
  52. ---------+--------------+------------------------------------------------------
  53. dd/mm/yy | Author | Comments
  54. ---------+--------------+------------------------------------------------------
  55. 12/01/01 | JL Schwing | Creation
  56. ---------+--------------+------------------------------------------------------
  57. 01/02/01 | JL Schwing | 1.2 : Protect against multiple choice of same user.
  58. ---------+--------------+------------------------------------------------------
  59. 14/03/01 | JL Schwing | 1.3 : Lint cleanup.
  60. ---------+--------------+------------------------------------------------------
  61. */
  62. #ifndef SCALAB01_H
  63. #define SCALAB01_H
  64. /*
  65. * Default values for scalab01
  66. */
  67. #define SCALAB01_ACC_ATTRIB "ntUserUnitsPerWeek"
  68. #define SCALAB01_DEF_MAX_CNX 5000
  69. #define SCALAB01_DEF_CNX_DURATION 3600
  70. #define SCALAB01_DEF_WAIT_TIME 10
  71. #define SCALAB01_LOCK_ATTRIB "ntUserFlags"
  72. #define SCALAB01_SUPER_USER_RDN "cn=super user"
  73. #define SCALAB01_SUPER_USER_PASSWORD "super user password"
  74. #define SCALAB01_VAL_LOCKED "1"
  75. #define SCALAB01_VAL_UNLOCKED "0"
  76. #define SCALAB01_MAX_LOCKING 4096
  77. /*
  78. * This structure is intended to memorize the information about
  79. * the "ISP" users connected.
  80. * Uses mainly static size data to save malloc()/free() calls.
  81. */
  82. typedef struct isp_user {
  83. char dn[MAX_DN_LENGTH]; /* User's DN */
  84. int cost; /* Cnx cost */
  85. int counter; /* To free it */
  86. struct isp_user *next; /* Next entry */
  87. } isp_user;
  88. /*
  89. * This is the scalab01 context structure.
  90. */
  91. typedef struct scalab01_context {
  92. int cnxduration; /* Max cnx duration */
  93. LDAP *ldapCtx; /* LDAP context */
  94. isp_user *list; /* ISP users list */
  95. ldclt_mutex_t list_mutex; /* Protect list */
  96. char *locking[SCALAB01_MAX_LOCKING];
  97. ldclt_mutex_t locking_mutex;
  98. int lockingMax;
  99. int maxcnxnb; /* Modem pool size */
  100. int nbcnx; /* Nb cnx to the modem */
  101. ldclt_mutex_t nbcnx_mutex; /* Protect nbcnx */
  102. int wait; /* Retry every this time */
  103. } scalab01_context;
  104. /*
  105. * Exported functions and structures
  106. */
  107. extern int doScalab01 (thread_context *tttctx);
  108. extern scalab01_context s1ctx;
  109. extern void *scalab01_control (void *);
  110. extern int scalab01_init (void); /*JLS 14-03-01*/
  111. #endif /* SCALAB01_H */
  112. /* End of file */