capabilities-20030304
authorDerrick Brashear <shadow@dementia.org>
Tue, 4 Mar 2003 16:19:46 +0000 (16:19 +0000)
committerDerrick Brashear <shadow@dementia.org>
Tue, 4 Mar 2003 16:19:46 +0000 (16:19 +0000)
need to remove dummy capability, but otherwise this is the rpc part.

src/afs/afs_callback.c
src/fsint/afscbint.xg
src/fsint/afsint.xg
src/fsint/common.xg
src/fsprobe/fsprobe_callback.c
src/viced/afsfileprocs.c
src/xstat/xstat_fs_callback.c

index 9d3b7d7..ee0a7a7 100644 (file)
@@ -1436,3 +1436,38 @@ int SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
     return 0;
 }
  
+int SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, 
+                                 struct interfaceAddr *addr, 
+                                 Capabilities *capabilities)
+{
+    int i;
+    int code = 0;
+    afs_int32 *dataBuffP;               
+    afs_int32 dataBytes;                
+
+    RX_AFS_GLOCK();
+
+    AFS_STATCNT(SRXAFSCB_WhoAreYou);
+
+    ObtainReadLock(&afs_xinterface);
+
+    /* return all network interface addresses */
+    addr->numberOfInterfaces = afs_cb_interface.numberOfInterfaces;
+    addr->uuid = afs_cb_interface.uuid;
+    for ( i=0; i < afs_cb_interface.numberOfInterfaces; i++) {
+       addr->addr_in[i] = ntohl(afs_cb_interface.addr_in[i]);
+       addr->subnetmask[i] = ntohl(afs_cb_interface.subnetmask[i]);
+       addr->mtu[i] = ntohl(afs_cb_interface.mtu[i]);
+    }
+
+    ReleaseReadLock(&afs_xinterface);
+    
+    RX_AFS_GUNLOCK();
+    
+    dataBuffP = (afs_int32 *)afs_osi_Alloc(dataBytes);
+    memcpy((char *)dataBuffP, "1", dataBytes);
+    capabilities->Capabilities_len = dataBytes/sizeof(afs_int32);
+    capabilities->Capabilities_val = dataBuffP;
+
+    return code;
+}
index e658915..8edc66f 100644 (file)
@@ -107,3 +107,7 @@ proc GetCellByNum(
   OUT serverList *cellHosts
 ) = 65537;
 
+proc TellMeAboutYourself(
+  OUT struct interfaceAddr *addr,
+  OUT Capabilities *capabilities
+) = 65538;
index a225783..b0fb6fd 100644 (file)
@@ -694,3 +694,7 @@ StoreData64(
 
 GiveUpAllCallBacks(
 ) = 65539;
+
+GetCapabilities(
+  Capabilities *capabilities
+) = 65540;
index 83d50a1..88da555 100644 (file)
@@ -156,4 +156,7 @@ typedef afs_int32 serverList<AFSMAXCELLHOSTS>;
 
 typedef afs_uint32 cacheConfig<>;
 
+const AFSCAPABILITIESMAX = 196;
+typedef afs_int32 Capabilities<AFSCAPABILITIESMAX>;
+
 %#endif /* FSINT_COMMON_XG */
index bffcf06..f5fc6c9 100644 (file)
@@ -752,3 +752,38 @@ afs_int32 SRXAFSCB_GetCacheConfig(
 {
     return RXGEN_OPCODE;
 }
+
+afs_int32 SRXAFSCB_TellMeAboutYourself(struct rx_call *rxcall,
+                                       struct interfaceAddr *addr,
+                                       Capabilities *capabilities)
+{
+    int i;
+    int code = 0;
+    int         count;
+
+#if FSPROBE_CALLBACK_VERBOSE
+    static char rn[] = "SRXAFSCB_TellMeAboutYourself";  /*Routine name*/
+    char hostName[256];                                 /*Host name buffer*/
+    char *hostNameResult;                               /*Ptr to static*/
+
+    if (rxcall != (struct rx_call *)0) {
+      hostNameResult =
+          hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
+      strcpy(hostName, hostNameResult);
+      fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
+              mn, rn, hostName, rxcall->conn->peer->port);
+    } /*Valid rxcall param*/
+#endif /* FSPROBE_CALLBACK_VERBOSE */
+
+    if ( rxcall && addr )
+    {
+        if (!afs_cb_inited) init_afs_cb();
+        *addr = afs_cb_interface;
+    }
+
+    /*
+     * Return successfully.
+     */
+    return(0);
+}
+
index 4d44846..beaea59 100644 (file)
@@ -5980,6 +5980,19 @@ afs_int32 SRXAFS_Lookup(struct rx_call *call_p,
 }
 
 
+afs_int32 SRXAFS_GetCapabilities(struct rx_call *acall,
+                                Capabilities *capabilities)
+{
+    afs_int32 *dataBuffP;               
+    afs_int32 dataBytes;   
+
+    dataBuffP = (afs_int32 *)malloc(dataBytes);
+    memcpy((char *)dataBuffP, "1", dataBytes);
+    capabilities->Capabilities_len = dataBytes/sizeof(afs_int32);
+    capabilities->Capabilities_val = dataBuffP;
+    return 0;
+} 
+
 afs_int32 SRXAFS_FlushCPS(struct rx_call *acall,
                          struct ViceIds *vids,
                          struct IPAddrs *addrs,
index c385748..2ef32a0 100644 (file)
@@ -196,7 +196,7 @@ afs_int32 SRXAFSCB_InitCallBackState(rxcall)
  *------------------------------------------------------------------------*/
 
 afs_int32 SRXAFSCB_Probe(rxcall)
-       struct rx_call *rxcall;
+    struct rx_call *rxcall;
 
 { /*SRXAFSCB_Probe*/
 
@@ -461,8 +461,8 @@ afs_int32 SRXAFSCB_GetXStats(rxcall, clientVersionNumber, collectionNumber,
  *------------------------------------------------------------------------*/
 
 afs_int32 SRXAFSCB_InitCallBackState2(rxcall, addr)
-struct rx_call *rxcall;
-struct interfaceAddr * addr;
+    struct rx_call *rxcall;
+    struct interfaceAddr * addr;
 {
 
 #if XSTAT_FS_CALLBACK_VERBOSE
@@ -471,11 +471,11 @@ struct interfaceAddr * addr;
     char *hostNameResult;                              /*Ptr to static*/
 
     if (rxcall != (struct rx_call *)0) {
-      hostNameResult =
-         hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
-      strcpy(hostName, hostNameResult);
-      fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
-             mn, rn, hostName, rxcall->conn->peer->port);
+       hostNameResult =
+           hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
+       strcpy(hostName, hostNameResult);
+       fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
+               mn, rn, hostName, rxcall->conn->peer->port);
     } /*Valid rxcall param*/
 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
     return RXGEN_OPCODE;
@@ -506,8 +506,8 @@ struct interfaceAddr * addr;
  *------------------------------------------------------------------------*/
 
 afs_int32 SRXAFSCB_WhoAreYou(rxcall, addr)
-struct rx_call *rxcall;
-struct interfaceAddr *addr;
+    struct rx_call *rxcall;
+    struct interfaceAddr *addr;
 {
     int i;
     int code = 0;
@@ -519,11 +519,11 @@ struct interfaceAddr *addr;
     char *hostNameResult;                              /*Ptr to static*/
 
     if (rxcall != (struct rx_call *)0) {
-      hostNameResult =
-         hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
-      strcpy(hostName, hostNameResult);
-      fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
-             mn, rn, hostName, rxcall->conn->peer->port);
+       hostNameResult =
+           hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
+       strcpy(hostName, hostNameResult);
+       fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
+               mn, rn, hostName, rxcall->conn->peer->port);
     } /*Valid rxcall param*/
 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
 
@@ -561,8 +561,8 @@ struct interfaceAddr *addr;
  *------------------------------------------------------------------------*/
 
 afs_int32 SRXAFSCB_InitCallBackState3(rxcall, uuidp)
-struct rx_call *rxcall;
-afsUUID *uuidp;
+    struct rx_call *rxcall;
+    afsUUID *uuidp;
 {
 #if XSTAT_FS_CALLBACK_VERBOSE
     static char rn[] = "SRXAFSCB_InitCallBackState3";  /*Routine name*/
@@ -570,11 +570,11 @@ afsUUID *uuidp;
     char *hostNameResult;                              /*Ptr to static*/
 
     if (rxcall != (struct rx_call *)0) {
-      hostNameResult =
-         hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
-      strcpy(hostName, hostNameResult);
-      fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
-             mn, rn, hostName, rxcall->conn->peer->port);
+       hostNameResult =
+           hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
+       strcpy(hostName, hostNameResult);
+       fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
+               mn, rn, hostName, rxcall->conn->peer->port);
     } /*Valid rxcall param*/
 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
 
@@ -609,8 +609,8 @@ afsUUID *uuidp;
  *------------------------------------------------------------------------*/
 
 afs_int32 SRXAFSCB_ProbeUuid(rxcall, uuidp)
-struct rx_call *rxcall;
-afsUUID *uuidp;
+    struct rx_call *rxcall;
+    afsUUID *uuidp;
 {
     int code = 0;
 
@@ -620,11 +620,11 @@ afsUUID *uuidp;
     char *hostNameResult;                              /*Ptr to static*/
 
     if (rxcall != (struct rx_call *)0) {
-      hostNameResult =
-         hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
-      strcpy(hostName, hostNameResult);
-      fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
-             mn, rn, hostName, rxcall->conn->peer->port);
+       hostNameResult =
+           hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
+       strcpy(hostName, hostNameResult);
+       fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
+               mn, rn, hostName, rxcall->conn->peer->port);
     } /*Valid rxcall param*/
 #endif /* XSTAT_FS_CALLBACK_VERBOSE */
 
@@ -776,3 +776,37 @@ afs_int32 SRXAFSCB_GetCacheConfig(
 {
     return RXGEN_OPCODE;
 }
+
+afs_int32 SRXAFSCB_TellMeAboutYourself(struct rx_call *rxcall, 
+                                       struct interfaceAddr *addr,
+                                       Capabilities *capabilites)
+{
+    int i;
+    int code = 0;
+    int         count;
+
+#if XSTAT_FS_CALLBACK_VERBOSE
+    static char rn[] = "SRXAFSCB_TellMeAboutYourself";  /*Routine name*/
+    char hostName[256];                                 /*Host name buffer*/
+    char *hostNameResult;                               /*Ptr to static*/
+
+    if (rxcall != (struct rx_call *)0) {
+       hostNameResult =
+           hostutil_GetNameByINet((afs_int32)(rxcall->conn->peer->host));
+       strcpy(hostName, hostNameResult);
+       fprintf(stderr, "[%s:%s] Called from host %s, port %d\n",
+               mn, rn, hostName, rxcall->conn->peer->port);
+    } /*Valid rxcall param*/
+#endif /* XSTAT_FS_CALLBACK_VERBOSE */
+
+    if ( rxcall && addr )
+    {
+       if (!afs_cb_inited) init_afs_cb();
+       *addr = afs_cb_interface;
+    }
+
+    /*
+     * Return successfully.
+     */
+    return(0);
+}