2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include <afs/param.h>
14 #include <sys/types.h>
16 #include <netinet/in.h>
24 #define N_SECURITY_OBJECTS 1
29 rx_PrintStats(stdout
);
35 struct rx_securityClass
*(securityObjects
[N_SECURITY_OBJECTS
]);
36 struct rx_service
*service
;
38 signal(SIGINT
, InterruptSignal
);
40 /* Initialize Rx, telling it port number this server will use for its single service */
41 if (rx_Init(BULK_SERVER_PORT
) < 0)
44 /* Create a single security object, in this case the null security object, for unauthenticated connections, which will be used to control security on connections made to this server */
45 securityObjects
[RX_SECIDX_NULL
] = rxnull_NewServerSecurityObject();
46 if (securityObjects
[RX_SECIDX_NULL
] == (struct rx_securityClass
*)0)
47 Quit("rxnull_NewServerSecurityObject");
49 /* Instantiate a single BULK service. The rxgen-generated procedure which is called to decode requests is passed in here (BULK_ExecuteRequest). */
51 rx_NewService(0, BULK_SERVICE_ID
, "BULK", securityObjects
,
52 N_SECURITY_OBJECTS
, BULK_ExecuteRequest
);
53 if (service
== (struct rx_service
*)0)
54 Quit("rx_NewService");
55 rx_SetMaxProcs(service
, 5);
57 rx_StartServer(1); /* Donate this process to the server process pool */
58 Quit("StartServer returned?");
61 int bulk_operationNumber
= 0;
64 BULK_FetchFile(call
, verbose
, name
)
70 int opnum
= ++bulk_operationNumber
;
73 printf("%d: fetch %s\n", opnum
, name
);
74 fd
= open(name
, O_RDONLY
, 0);
75 if (fd
< 0 || fstat(fd
, &status
) < 0) {
77 printf("%d: failed to open %s\n", opnum
, name
);
81 error
= bulk_SendFile(fd
, call
, &status
);
83 printf("%d: fetch of %s failed, error %d\n", opnum
, name
, error
);
85 printf("%d: fetch of %s complete\n", opnum
, name
);
93 BULK_StoreFile(call
, verbose
, name
)
98 int opnum
= ++bulk_operationNumber
;
103 printf("%d: store file %s\n", opnum
, name
);
104 fd
= open(name
, O_CREAT
| O_TRUNC
| O_WRONLY
, 0666);
105 if (fd
< 0 || fstat(fd
, &status
) < 0) {
106 fprintf(stderr
, "%d: could not create %s\n", opnum
, name
);
110 error
= bulk_ReceiveFile(fd
, call
, &status
);
112 printf("%d: store of %s failed, error %d\n", opnum
, name
, error
);
114 printf("%d: store of %s complete\n", opnum
, name
);
125 fprintf(stderr
, msg
, a
, b
);