Coda Distributed File System
se.h
Go to the documentation of this file.
1/* BLURB lgpl
2
3 Coda File System
4 Release 5
5
6 Copyright (c) 1987-1999 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU Library General Public Licence Version 2, as
11shown in the file LICENSE. The technical and financial contributors to
12Coda are listed in the file CREDITS.
13
14 Additional copyrights
15
16#*/
17
18/*
19 IBM COPYRIGHT NOTICE
20
21 Copyright (C) 1986
22 International Business Machines Corporation
23 All Rights Reserved
24
25This file contains some code identical to or derived from the 1986
26version of the Andrew File System ("AFS"), which is owned by the IBM
27Corporation. This code is provided "AS IS" and IBM does not warrant
28that it is free of infringement of any intellectual rights of any
29third party. IBM disclaims liability of any kind for any damages
30whatsoever resulting directly or indirectly from use of this software
31or of any derivative work. Carnegie Mellon University has obtained
32permission to modify, distribute and sublicense this code, which is
33based on Version 2 of AFS and does not contain the features and
34enhancements that are part of Version 3 of AFS. Version 3 of AFS is
35commercially available and supported by Transarc Corporation,
36Pittsburgh, PA.
37
38*/
39
40#include <rpc2/rpc2.h>
41
42#ifndef _SE_
43#define _SE_
44
46 long SideEffectType; /* what kind of side effect am I? */
47 long (*SE_Init)(); /* on both client & server side */
48 long (*SE_Bind1)(); /* on client side */
49 long (*SE_Bind2)(); /* on client side */
50 long (*SE_Unbind)(); /* on client and server side */
51 long (*SE_NewConnection)(); /* on server side */
52 long (*SE_MakeRPC1)(); /* on client side */
53 long (*SE_MakeRPC2)(); /* on client side */
54 long (*SE_MultiRPC1)(); /* on client side */
55 long (*SE_MultiRPC2)(); /* on client side */
56 long (*SE_CreateMgrp)(); /* on client side */
57 long (*SE_AddToMgrp)(); /* on client side */
58 long (*SE_InitMulticast)(); /* on server side */
59 long (*SE_DeleteMgrp)(); /* on client and server side */
60 long (*SE_GetRequest)(); /* on server side */
61 long (*SE_InitSideEffect)(); /* on server side */
62 long (*SE_CheckSideEffect)(); /* on server side */
63 long (*SE_SendResponse)(); /* on server side */
64 long (*SE_PrintSEDescriptor)(); /* for debugging */
65 long (*SE_SetDefaults)(); /* for initialization */
67 long (*SE_GetHostInfo)();
68};
69
70/* Types of side effects: use these in the RPC2_Bind() call and in filling SE
71 * descriptors */
72#define OMITSE 9999 /* in MultiRPC for omitting side effects on some conns */
73#define SMARTFTP 1189
74
76{
79};
81{
85 FILEINVM = 74
86};
87
90 char hashmark; /* IN: 0 for non-verbose transfer */
91 long SeekOffset; /* IN: >= 0; position to seek to before first read/write */
92 long BytesTransferred; /* OUT: value after RPC2_CheckSideEffect() meaningful */
94 /* IN: maximum number of data bytes to be sent or received.
95 * A value of -1 implies infinity.
96 * Transfer is terminated and QuotaExceeded set if this limit would be
97 * exceeded.
98 * EnforceQuota in SFTP_Initializer must be specified as 1 at RPC
99 * initialization for the quota enforcement to take place.
100 * NOTE: (2/6/1994, Satya) The semantics is being slightly changed here to
101 * support partial file transfer; it used to be the case that hitting
102 * ByteQuota was an error reported as RPC2_SEFAIL1. But no one seems to be
103 * relying on this, so changing the error return to a success return seems
104 * fair game.
105 */
106 long QuotaExceeded; /* OUT: set to 1 if transfer terminated due to ByteQuota
107 limit 0 otherwise */
108 enum FileInfoTag Tag; /* IN */
109 union {
110 struct FileInfoByName {
111 long ProtectionBits; /* Unix mode bits to be set for created files */
112 char LocalFileName[256];
113 } ByName; /* if (Tag == FILEBYNAME); standard Unix open() */
114
115 struct FileInfoByInode {
116 long Device; /* device on which file resides */
117 long Inode; /* inode number of file (inode MUST exist already)*/
118 } ByInode; /* if (Tag == FILEBYINODE); ITC inode-open */
119
120 struct FileInfoByFD {
121 long fd; /* fd of already-open file (not automatically closed!) */
122 } ByFD; /* if (Tag == FILEBYFD); user gives already-open file */
123
124 struct FileInfoByAddr {
125 /* Describes buffer allocated by user in VM.
126 * When file used as source:
127 * - user sets vmfile.SeqLen to actual file length.
128 * - SFTP ignores vmfile.MaxSeqLen
129 * When used as sink:
130 * - user sets vmfile.MaxSeqLen
131 * - SFTP sets vmfile.SeqLen to length of received file.
132 * - SFTP returns RPC2_SEFAIL3 if file bigger than MaxSeqLen.
133 */
135 long vmfilep; /* for internal use by SFTP as file pointer */
136 } ByAddr; /* if (Tag == FILEINVM); file resides in VM */
137 } FileInfo; /* everything is IN */
138};
139
141{
145 SE_FAILURE = 36
147
151 long Tag; /* only SMARTFTP or OMITSE */
152 union {
153 /* nothing for OMITSE */
156
157 /* this is a callback function, which is called whenever a block of
158 * data is successfully transferred (sink side only for now). */
159 void (*XferCB)(void *userp, unsigned int offset);
160 void *userp;
162
163typedef struct SFTPI {
164 long PacketSize; /* bytes in data packet */
165 long WindowSize; /* max number of outstanding unacknowledged packets */
167 long RetryInterval; /* in milliseconds */
168 long SendAhead; /* number of packets to read and send ahead */
169 long AckPoint; /* when to send ack */
170 long EnforceQuota; /* 0 ==> don't */
171 long DoPiggy; /* FALSE ==> don't piggyback small files */
172 long DupThreshold; /* Duplicates allowed before spontaneous Ack is sent */
173 long MaxPackets; /* Memory usage throttle; SFTP will not use more than
174 this many packets in total; -1 (default) says no limit;
175 Caveat user: packet starvation can cause mysterious
176 RPC2_SEFAIL2s */
177 RPC2_PortIdent Port; /* initialization required on server side */
179
180/*
181Flag options in RPC2_CheckSEStatus(): OR these together as needed
182*/
183#define SE_AWAITLOCALSTATUS 1
184#define SE_AWAITREMOTESTATUS 2
185
186extern struct SE_Definition *SE_DefSpecs; /* array */
187extern long SE_DefCount; /* how many are there? */
188extern void SE_SetDefaults();
189extern char *SE_ErrorMsg();
190
191/*
192 Statistics
193*/
194
195/* I'm not sure where these should go. -JJK */
196struct sftpStats {
197 unsigned long Total, /* Packets Sent (Received) */
198 Starts, /* Starts Sent (Received) */
199 Datas, /* Datas Sent (Received) */
200 DataRetries, /* Data Retries Sent (Received) */
201 Acks, /* Acks Sent (Received) */
202 Naks, /* Naks Sent (Received) */
203 Busies, /* Busies Sent (Received) */
204 Bytes, /* Bytes Sent (Received) */
205 Timeouts; /* Timeouts when Sending (Receiving) */
206};
207
208extern struct sftpStats sftp_Sent, sftp_MSent;
209extern struct sftpStats sftp_Recvd, sftp_MRecvd;
210#endif
SE_Status
Definition: se.h:141
@ SE_NOTSTARTED
Definition: se.h:142
@ SE_INPROGRESS
Definition: se.h:143
@ SE_SUCCESS
Definition: se.h:144
@ SE_FAILURE
Definition: se.h:145
void SE_SetDefaults()
WhichWay
Definition: se.h:76
@ CLIENTTOSERVER
Definition: se.h:77
@ SERVERTOCLIENT
Definition: se.h:78
char * SE_ErrorMsg()
struct sftpStats sftp_Recvd sftp_MRecvd
Definition: sftp3.c:85
struct sftpStats sftp_Sent sftp_MSent
Definition: sftp3.c:84
FileInfoTag
Definition: se.h:81
@ FILEBYNAME
Definition: se.h:82
@ FILEINVM
Definition: se.h:85
@ FILEBYINODE
Definition: se.h:83
@ FILEBYFD
Definition: se.h:84
struct SE_SideEffectDescriptor SE_Descriptor
struct SFTPI SFTP_Initializer
long SE_DefCount
Definition: se.c:52
struct SE_Definition * SE_DefSpecs
Definition: se.c:50
Definition: rpc2.h:324
Definition: rpc2.h:358
Definition: se.h:45
long SideEffectType
Definition: se.h:46
long(* SE_AddToMgrp)()
Definition: se.h:57
long(* SE_Init)()
Definition: se.h:47
long(* SE_NewConnection)()
Definition: se.h:51
long(* SE_InitMulticast)()
Definition: se.h:58
long(* SE_CheckSideEffect)()
Definition: se.h:62
long(* SE_GetRequest)()
Definition: se.h:60
long(* SE_CreateMgrp)()
Definition: se.h:56
long(* SE_Bind1)()
Definition: se.h:48
long(* SE_SendResponse)()
Definition: se.h:63
long(* SE_MakeRPC2)()
Definition: se.h:53
long(* SE_InitSideEffect)()
Definition: se.h:61
long(* SE_Bind2)()
Definition: se.h:49
long(* SE_DeleteMgrp)()
Definition: se.h:59
long(* SE_Unbind)()
Definition: se.h:50
long(* SE_MultiRPC1)()
Definition: se.h:54
long(* SE_GetHostInfo)()
Definition: se.h:67
long(* SE_MakeRPC1)()
Definition: se.h:52
long(* SE_GetSideEffectTime)()
Definition: se.h:66
long(* SE_SetDefaults)()
Definition: se.h:65
long(* SE_MultiRPC2)()
Definition: se.h:55
long(* SE_PrintSEDescriptor)()
Definition: se.h:64
Definition: se.h:148
enum SE_Status LocalStatus
Definition: se.h:149
struct SFTP_Descriptor SmartFTPD
Definition: se.h:154
long Tag
Definition: se.h:151
union SE_SideEffectDescriptor::@44 Value
void * userp
Definition: se.h:160
enum SE_Status RemoteStatus
Definition: se.h:150
void(* XferCB)(void *userp, unsigned int offset)
Definition: se.h:159
Definition: se.h:163
long SendAhead
Definition: se.h:168
long PacketSize
Definition: se.h:164
long EnforceQuota
Definition: se.h:170
long WindowSize
Definition: se.h:165
RPC2_PortIdent Port
Definition: se.h:177
long AckPoint
Definition: se.h:169
long RetryCount
Definition: se.h:166
long RetryInterval
Definition: se.h:167
long MaxPackets
Definition: se.h:173
long DupThreshold
Definition: se.h:172
long DoPiggy
Definition: se.h:171
Definition: se.h:88
long fd
Definition: se.h:121
long QuotaExceeded
Definition: se.h:106
struct SFTP_Descriptor::@43::FileInfoByAddr ByAddr
enum WhichWay TransmissionDirection
Definition: se.h:89
long vmfilep
Definition: se.h:135
struct SFTP_Descriptor::@43::FileInfoByInode ByInode
char LocalFileName[256]
Definition: se.h:112
enum FileInfoTag Tag
Definition: se.h:108
long ProtectionBits
Definition: se.h:111
struct SFTP_Descriptor::@43::FileInfoByName ByName
long SeekOffset
Definition: se.h:91
long Device
Definition: se.h:116
char hashmark
Definition: se.h:90
long ByteQuota
Definition: se.h:93
union SFTP_Descriptor::@43 FileInfo
struct SFTP_Descriptor::@43::FileInfoByFD ByFD
long Inode
Definition: se.h:117
long BytesTransferred
Definition: se.h:92
RPC2_BoundedBS vmfile
Definition: se.h:134
Definition: se.h:196
unsigned long Total
Definition: se.h:197
unsigned long Bytes
Definition: se.h:204
unsigned long Datas
Definition: se.h:199
unsigned long Busies
Definition: se.h:203
unsigned long Timeouts
Definition: se.h:205
unsigned long Starts
Definition: se.h:198
unsigned long DataRetries
Definition: se.h:200
unsigned long Acks
Definition: se.h:201
unsigned long Naks
Definition: se.h:202