Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / afssvrmgr / svr_col.cpp
blobe2a93223cbf9d6c940c76fd3afe9baac4ed871d6
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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 */
10 #include <winsock2.h>
11 #include <ws2tcpip.h>
13 extern "C" {
14 #include <afs/param.h>
15 #include <afs/stds.h>
18 #include "svrmgr.h"
19 #include "svr_col.h"
23 * SERVER-VIEW COLUMNS ________________________________________________________
27 void Server_SetDefaultView_Horz (LPVIEWINFO lpviHorz)
29 lpviHorz->lvsView = FLS_VIEW_LIST;
30 lpviHorz->nColsAvail = nSERVERCOLUMNS;
32 for (size_t iCol = 0; iCol < nSERVERCOLUMNS; ++iCol)
34 lpviHorz->cxColumns[ iCol ] = SERVERCOLUMNS[ iCol ].cxWidth;
35 lpviHorz->idsColumns[ iCol ] = SERVERCOLUMNS[ iCol ].idsColumn;
38 lpviHorz->iSort = svrcolNAME;
40 lpviHorz->nColsShown = 3;
41 lpviHorz->aColumns[0] = (int)svrcolNAME;
42 lpviHorz->aColumns[1] = (int)svrcolADDRESS;
43 lpviHorz->aColumns[2] = (int)svrcolSTATUS;
47 void Server_SetDefaultView_Vert (LPVIEWINFO lpviVert)
49 lpviVert->lvsView = FLS_VIEW_LARGE;
50 lpviVert->nColsAvail = nSERVERCOLUMNS;
52 for (size_t iCol = 0; iCol < nSERVERCOLUMNS; ++iCol)
54 lpviVert->cxColumns[ iCol ] = SERVERCOLUMNS[ iCol ].cxWidth;
55 lpviVert->idsColumns[ iCol ] = SERVERCOLUMNS[ iCol ].idsColumn;
58 lpviVert->iSort = svrcolNAME;
60 lpviVert->nColsShown = 3;
61 lpviVert->aColumns[0] = (int)svrcolNAME;
62 lpviVert->aColumns[1] = (int)svrcolADDRESS;
63 lpviVert->aColumns[2] = (int)svrcolSTATUS;
68 * ROUTINES ___________________________________________________________________
72 size_t Server_GetAlertCount (LPSERVER lpServer)
74 return Alert_GetCount (lpServer->GetIdentifier());
78 LPTSTR Server_GetColumnText (LPIDENT lpi, SERVERCOLUMN svrcol)
80 static TCHAR aszBuffer[ nSERVERCOLUMNS ][ cchRESOURCE ];
81 static size_t iBufferNext = 0;
82 LPTSTR pszBuffer = aszBuffer[ iBufferNext++ ];
83 if (iBufferNext == nSERVERCOLUMNS)
84 iBufferNext = 0;
85 *pszBuffer = TEXT('\0');
87 LPSERVERSTATUS lpss = NULL;
88 LPSERVER_PREF lpsp;
89 if ((lpsp = (LPSERVER_PREF)lpi->GetUserParam()) != NULL)
91 lpss = &lpsp->ssLast;
94 switch (svrcol)
96 case svrcolNAME:
97 lpi->GetServerName (pszBuffer);
98 break;
100 case svrcolADDRESS:
101 if (lpss)
102 FormatSockAddr (pszBuffer, TEXT("%a"), &lpss->aAddresses[0]);
103 break;
105 case svrcolSTATUS:
107 LPTSTR pszDesc;
108 if ((pszDesc = Alert_GetQuickDescription (lpi)) == NULL)
109 GetString (pszBuffer, IDS_STATUS_NOALERTS);
110 else
112 lstrcpy (pszBuffer, pszDesc);
113 FreeString (pszDesc);
116 break;
119 return pszBuffer;