/*
* This structure describes global (ie., server-wide) parameters.
*/
-typedef struct {
+struct global {
int ConfigBackend;
char *smb_ports;
char *dos_charset;
int iKeepalive;
int iminreceivefile;
param_opt_struct *param_opt;
-} global;
+};
-static global Globals;
+static struct global Globals;
/*
* This structure describes a single service.
*/
-typedef struct {
+struct service {
bool valid;
bool autoloaded;
int usershare;
param_opt_struct *param_opt;
char dummy[3]; /* for alignment */
-} service;
+};
/* This is a default service used to prime a services structure */
-static service sDefault = {
+static struct service sDefault = {
True, /* valid */
False, /* not autoloaded */
0, /* not a usershare */
};
/* local variables */
-static service **ServicePtrs = NULL;
+static struct service **ServicePtrs = NULL;
static int iNumServices = 0;
static int iServiceIndex = 0;
static struct db_context *ServiceHash;
Initialise the sDefault parameter structure for the printer values.
***************************************************************************/
-static void init_printer_values(service *pService)
+static void init_printer_values(struct service *pService)
{
/* choose defaults depending on the type of printing */
switch (pService->iPrinting) {
static bool set_boolean(bool *pb, const char *pszParmValue);
static const char *get_boolean(bool bool_value);
static int getservicebyname(const char *pszServiceName,
- service * pserviceDest);
-static void copy_service(service * pserviceDest,
- service * pserviceSource,
+ struct service *pserviceDest);
+static void copy_service(struct service *pserviceDest,
+ struct service *pserviceSource,
struct bitmap *pcopymapDest);
static bool do_parameter(const char *pszParmName, const char *pszParmValue);
static bool do_section(const char *pszSectionName);
-static void init_copymap(service * pservice);
+static void init_copymap(struct service *pservice);
static bool hash_a_service(const char *name, int number);
static void free_service_byindex(int iService);
static char * canonicalize_servicename(const char *name);
Initialise a service to the defaults.
***************************************************************************/
-static void init_service(service * pservice)
+static void init_service(struct service *pservice)
{
- memset((char *)pservice, '\0', sizeof(service));
+ memset((char *)pservice, '\0', sizeof(struct service));
copy_service(pservice, &sDefault, NULL);
}
Free the dynamically allocated parts of a service struct.
***************************************************************************/
-static void free_service(service *pservice)
+static void free_service(struct service *pservice)
{
int i;
param_opt_struct *data, *pdata;
service.
***************************************************************************/
-static int add_a_service(const service *pservice, const char *name)
+static int add_a_service(const struct service *pservice, const char *name)
{
int i;
- service tservice;
+ struct service tservice;
int num_to_alloc = iNumServices + 1;
param_opt_struct *data, *pdata;
/* if not, then create one */
if (i == iNumServices) {
- service **tsp;
+ struct service **tsp;
int *tinvalid;
- tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, service *, num_to_alloc);
+ tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
if (tsp == NULL) {
DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
return (-1);
}
ServicePtrs = tsp;
- ServicePtrs[iNumServices] = SMB_MALLOC_P(service);
+ ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
if (!ServicePtrs[iNumServices]) {
DEBUG(0,("add_a_service: out of memory!\n"));
return (-1);
Find a service by name. Otherwise works like get_service.
***************************************************************************/
-static int getservicebyname(const char *pszServiceName, service * pserviceDest)
+static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
{
int iService = -1;
char *canon_name;
If pcopymapDest is NULL then copy all fields
***************************************************************************/
-static void copy_service(service * pserviceDest, service * pserviceSource,
+static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
struct bitmap *pcopymapDest)
{
int i;
{
bool bRetval;
int iTemp;
- service serviceTemp;
+ struct service serviceTemp;
string_set(ptr, pszParmValue);
static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
{
static int parm_num = -1;
- service *s;
+ struct service *s;
if ( parm_num == -1 )
parm_num = map_parameter( "printing" );
Initialise a copymap.
***************************************************************************/
-static void init_copymap(service * pservice)
+static void init_copymap(struct service *pservice)
{
int i;
if (pservice->copymap) {
Display the contents of a single services record.
***************************************************************************/
-static void dump_a_service(service * pService, FILE * f)
+static void dump_a_service(struct service *pService, FILE * f)
{
int i;
param_opt_struct *data;
if (isGlobal) {
ptr = parm_table[i].ptr;
} else {
- service * pService = ServicePtrs[snum];
+ struct service *pService = ServicePtrs[snum];
ptr = ((char *)pService) +
PTR_DIFF(parm_table[i].ptr, &sDefault);
}
return &parm_table[(*i)++];
}
} else {
- service *pService = ServicePtrs[snum];
+ struct service *pService = ServicePtrs[snum];
for (; parm_table[*i].label; (*i)++) {
if (parm_table[*i].p_class == P_SEPARATOR)
/* Everything ok - add the service possibly using a template. */
if (iService < 0) {
- const service *sp = &sDefault;
+ const struct service *sp = &sDefault;
if (snum_template != -1) {
sp = ServicePtrs[snum_template];
}