1 /*
2  *   libcddb - CDDB Interface Library for xmcd/cda
3  *
4  *	This library implements an interface to access the "classic"
5  *	CDDB1 services.
6  *
7  *   Copyright (C) 1993-2004  Ti Kan
8  *   E-mail: xmcd@amb.org
9  *
10  *   This program is free software; you can redistribute it and/or modify
11  *   it under the terms of the GNU General Public License as published by
12  *   the Free Software Foundation; either version 2 of the License, or
13  *   (at your option) any later version.
14  *
15  *   This program is distributed in the hope that it will be useful,
16  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *   GNU General Public License for more details.
19  *
20  *   You should have received a copy of the GNU General Public License
21  *   along with this program; if not, write to the Free Software
22  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 #ifndef lint
26 static char     *_options_c_ident_ = "@(#)options.c	1.14 03/12/12";
27 #endif
28 
29 #include "fcddb.h"
30 
31 
32 /*
33  * CddbOptions_PutLocalCacheFlags
34  *	Set the local cache flags
35  */
36 CddbResult
37 CddbOptions_PutLocalCacheFlags(CddbOptionsPtr optionsp, long newval)
38 {
39 	cddb_options_t	*op = (cddb_options_t *) optionsp;
40 
41 	op->localcacheflags = newval;
42 	return Cddb_OK;
43 }
44 
45 
46 /*
47  * CddbOptions_PutProxyPassword
48  *	Set the proxy password
49  */
50 CddbResult
51 CddbOptions_PutProxyPassword(CddbOptionsPtr optionsp, CddbConstStr newval)
52 {
53 	cddb_options_t	*op = (cddb_options_t *) optionsp;
54 
55 	if (op->proxypassword != NULL)
56 		MEM_FREE(op->proxypassword);
57 
58 	if (newval == NULL || newval[0] == '\0')
59 		op->proxypassword = NULL;
60 	else
61 		op->proxypassword = (CddbStr) fcddb_strdup((char *) newval);
62 
63 	return Cddb_OK;
64 }
65 
66 
67 /*
68  * CddbOptions_PutProxyServer
69  *	Set the proxy server name
70  */
71 CddbResult
72 CddbOptions_PutProxyServer(CddbOptionsPtr optionsp, CddbConstStr newval)
73 {
74 	cddb_options_t	*op = (cddb_options_t *) optionsp;
75 
76 	if (op->proxyserver != NULL)
77 		MEM_FREE(op->proxyserver);
78 
79 	if (newval == NULL || newval[0] == '\0')
80 		op->proxyserver = NULL;
81 	else
82 		op->proxyserver = (CddbStr) fcddb_strdup((char *) newval);
83 
84 	return Cddb_OK;
85 }
86 
87 
88 /*
89  * CddbOptions_PutProxyServerPort
90  *	Set the proxy server port
91  */
92 CddbResult
93 CddbOptions_PutProxyServerPort(CddbOptionsPtr optionsp, long newval)
94 {
95 	cddb_options_t	*op = (cddb_options_t *) optionsp;
96 
97 	op->proxyport = newval;
98 	return Cddb_OK;
99 }
100 
101 
102 /*
103  * CddbOptions_PutProxyUserName
104  *	Set the proxy user name
105  */
106 CddbResult
107 CddbOptions_PutProxyUserName(CddbOptionsPtr optionsp, CddbConstStr newval)
108 {
109 	cddb_options_t	*op = (cddb_options_t *) optionsp;
110 
111 	if (op->proxyusername != NULL)
112 		MEM_FREE(op->proxyusername);
113 
114 	if (newval == NULL || newval[0] == '\0')
115 		op->proxyusername = NULL;
116 	else
117 		op->proxyusername = (CddbStr) fcddb_strdup((char *) newval);
118 
119 	return Cddb_OK;
120 }
121 
122 
123 /*
124  * CddbOptions_PutServerTimeout
125  *	Set the server timeout interval
126  */
127 CddbResult
128 CddbOptions_PutServerTimeout(CddbOptionsPtr optionsp, long newval)
129 {
130 	cddb_options_t	*op = (cddb_options_t *) optionsp;
131 
132 	op->servertimeout = newval;
133 	return Cddb_OK;
134 }
135 
136 
137 /*
138  * CddbOptions_PutTestSubmitMode
139  *	Set the test submit mode flag
140  */
141 CddbResult
142 CddbOptions_PutTestSubmitMode(CddbOptionsPtr optionsp, CddbBoolean newval)
143 {
144 	cddb_options_t	*op = (cddb_options_t *) optionsp;
145 
146 	op->testsubmitmode = newval;
147 	return Cddb_OK;
148 }
149 
150 
151 /*
152  * CddbOptions_PutLocalCacheTimeout
153  *	Set the local cache timeout interval
154  */
155 CddbResult
156 CddbOptions_PutLocalCacheTimeout(CddbOptionsPtr optionsp, long newval)
157 {
158 	cddb_options_t	*op = (cddb_options_t *) optionsp;
159 
160 	op->localcachetimeout = newval;
161 	return Cddb_OK;
162 }
163 
164 
165