Ixp9Srv(3) ixp_serve9conn

SYNOPSIS


#include <ixp.h>
typedef struct Ixp9Srv Ixp9Srv;
struct Ixp9Srv {
void* aux;
void (*attach)(Ixp9Req*);
void (*clunk)(Ixp9Req*);
void (*create)(Ixp9Req*);
void (*flush)(Ixp9Req*);
void (*open)(Ixp9Req*);
void (*read)(Ixp9Req*);
void (*remove)(Ixp9Req*);
void (*stat)(Ixp9Req*);
void (*walk)(Ixp9Req*);
void (*write)(Ixp9Req*);
void (*wstat)(Ixp9Req*);
void (*freefid)(IxpFid*);
}
typedef struct Ixp9Req Ixp9Req;
struct Ixp9Req {
Ixp9Srv* srv;
IxpFid* fid; /* Fid structure corresponding to IxpFHdr.fid */
IxpFid* newfid; /* Corresponds to IxpFTWStat.newfid */
Ixp9Req* oldreq; /* For TFlush requests, the original request. */
IxpFcall ifcall; /* The incoming request fcall. */
IxpFcall ofcall; /* The response fcall, to be filled by handler. */
void* aux; /* Arbitrary pointer, to be used by handlers. */
/* Private members */
...
}
void ixp_serve9conn(IxpConn *c);

DESCRIPTION

The ixp_serve9conn handles incoming 9P connections. It is ordinarily passed as the read member to ixp_listen(3) with an Ixp9Srv structure passed as the aux member. The handlers defined in the Ixp9Srv structure are called whenever a matching Fcall type is received. The handlers are expected to call ixp_respond(3) at some point, whether before they return or at some undefined point in the future. Whenever a client disconnects, libixp generates whatever flush and clunk events are required to leave the connection in a clean state and waits for all responses before freeing the connections associated data structures.

Whenever a file is closed and an IxpFid(3) is about to be freed, the freefid member is called to perform any necessary cleanup and to free any associated resources.