Windows: roken.h ordering
[openafs.git] / src / WINNT / afsadmsvr / TaAfsAdmSvrCell.cpp
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
12
13 extern "C" {
14 #include <afsconfig.h>
15 #include <afs/param.h>
16 #include <afs/stds.h>
17 #include <roken.h>
18 }
19
20 #include "TaAfsAdmSvrInternal.h"
21
22
23 /*
24  * ROUTINES ___________________________________________________________________
25  *
26  */
27
28
29       // AfsAdmSvr_ChangeCell
30       // ...changes a cell's properties.
31       //
32 extern "C" int AfsAdmSvr_ChangeCell (UINT_PTR idClient, ASID idCell, LPAFSADMSVR_CHANGECELL_PARAMS pChange, ULONG *pStatus)
33 {
34    ASACTION Action;
35    Action.Action = ACTION_CELL_CHANGE;
36    Action.idClient = idClient;
37    Action.idCell = idCell;
38    size_t iOp = AfsAdmSvr_BeginOperation (idClient, &Action);
39
40    Print (dlDETAIL, TEXT("Client 0x%08lX: ChangeCell (idCell=0x%08lX)"), idClient, idCell);
41
42    if (!AfsAdmSvr_fIsValidClient (idClient))
43       return FALSE_(ERROR_INVALID_PARAMETER,pStatus,iOp);
44
45    // Call AfsClass to actually do it
46    //
47    PTSPROPERTIES PtsProperties;
48    PtsProperties.idUserMax = (int)(pChange->idUserMax);
49    PtsProperties.idGroupMax = (int)(pChange->idGroupMax);
50
51    ULONG status;
52    if (!AfsClass_SetPtsProperties ((LPIDENT)idCell, &PtsProperties, &status))
53       {
54       Print (dlERROR, TEXT("Client 0x%08lX: ChangeCell failed; error 0x%08lX"), idClient, status);
55       return FALSE_(status,pStatus,iOp);
56       }
57
58    AfsAdmSvr_TestProperties (idCell);
59
60    Print (dlDETAIL, TEXT("Client 0x%08lX: ChangeCell succeeded"), idClient);
61    AfsAdmSvr_EndOperation (iOp);
62    return TRUE;
63 }
64
65
66
67       // AfsAdmSvr_SetRefreshRate
68       // ...changes the refresh rate for a specific cell
69       //
70 extern "C" int AfsAdmSvr_SetRefreshRate (UINT_PTR idClient, ASID idCell, ULONG cminRefreshRate, ULONG *pStatus)
71 {
72    if (!AfsAdmSvr_fIsValidClient (idClient))
73       return FALSE_(ERROR_INVALID_PARAMETER,pStatus);
74
75    Print (dlDETAIL, TEXT("Client 0x%08lX: Setting refresh rate to %lu minutes"), idClient, cminRefreshRate);
76
77    if (!cminRefreshRate)
78       AfsAdmSvr_StopCellRefreshThread (idCell);
79    else
80       AfsAdmSvr_SetCellRefreshRate (idCell, cminRefreshRate);
81
82    return TRUE;
83 }
84