1*5a1d355fSStephan Aßmus // RequestFactory.cpp 2*5a1d355fSStephan Aßmus 3*5a1d355fSStephan Aßmus #include <new> 4*5a1d355fSStephan Aßmus 5*5a1d355fSStephan Aßmus #include "RequestFactory.h" 6*5a1d355fSStephan Aßmus #include "Requests.h" 7*5a1d355fSStephan Aßmus 8*5a1d355fSStephan Aßmus // constructor RequestFactory()9*5a1d355fSStephan AßmusRequestFactory::RequestFactory() 10*5a1d355fSStephan Aßmus { 11*5a1d355fSStephan Aßmus } 12*5a1d355fSStephan Aßmus 13*5a1d355fSStephan Aßmus // destructor ~RequestFactory()14*5a1d355fSStephan AßmusRequestFactory::~RequestFactory() 15*5a1d355fSStephan Aßmus { 16*5a1d355fSStephan Aßmus } 17*5a1d355fSStephan Aßmus 18*5a1d355fSStephan Aßmus // CreateRequest 19*5a1d355fSStephan Aßmus status_t CreateRequest(uint32 type,Request ** request)20*5a1d355fSStephan AßmusRequestFactory::CreateRequest(uint32 type, Request** request) 21*5a1d355fSStephan Aßmus { 22*5a1d355fSStephan Aßmus if (!request) 23*5a1d355fSStephan Aßmus return B_BAD_VALUE; 24*5a1d355fSStephan Aßmus switch (type) { 25*5a1d355fSStephan Aßmus case INIT_CONNECTION_REQUEST: 26*5a1d355fSStephan Aßmus *request = new(std::nothrow) InitConnectionRequest; 27*5a1d355fSStephan Aßmus break; 28*5a1d355fSStephan Aßmus case INIT_CONNECTION_REPLY: 29*5a1d355fSStephan Aßmus *request = new(std::nothrow) InitConnectionReply; 30*5a1d355fSStephan Aßmus break; 31*5a1d355fSStephan Aßmus case MOUNT_REQUEST: 32*5a1d355fSStephan Aßmus *request = new(std::nothrow) MountRequest; 33*5a1d355fSStephan Aßmus break; 34*5a1d355fSStephan Aßmus case MOUNT_REPLY: 35*5a1d355fSStephan Aßmus *request = new(std::nothrow) MountReply; 36*5a1d355fSStephan Aßmus break; 37*5a1d355fSStephan Aßmus case UNMOUNT_REQUEST: 38*5a1d355fSStephan Aßmus *request = new(std::nothrow) UnmountRequest; 39*5a1d355fSStephan Aßmus break; 40*5a1d355fSStephan Aßmus case READ_VNODE_REQUEST: 41*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadVNodeRequest; 42*5a1d355fSStephan Aßmus break; 43*5a1d355fSStephan Aßmus case READ_VNODE_REPLY: 44*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadVNodeReply; 45*5a1d355fSStephan Aßmus break; 46*5a1d355fSStephan Aßmus case WRITE_STAT_REQUEST: 47*5a1d355fSStephan Aßmus *request = new(std::nothrow) WriteStatRequest; 48*5a1d355fSStephan Aßmus break; 49*5a1d355fSStephan Aßmus case WRITE_STAT_REPLY: 50*5a1d355fSStephan Aßmus *request = new(std::nothrow) WriteStatReply; 51*5a1d355fSStephan Aßmus break; 52*5a1d355fSStephan Aßmus case CREATE_FILE_REQUEST: 53*5a1d355fSStephan Aßmus *request = new(std::nothrow) CreateFileRequest; 54*5a1d355fSStephan Aßmus break; 55*5a1d355fSStephan Aßmus case CREATE_FILE_REPLY: 56*5a1d355fSStephan Aßmus *request = new(std::nothrow) CreateFileReply; 57*5a1d355fSStephan Aßmus break; 58*5a1d355fSStephan Aßmus case OPEN_REQUEST: 59*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenRequest; 60*5a1d355fSStephan Aßmus break; 61*5a1d355fSStephan Aßmus case OPEN_REPLY: 62*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenReply; 63*5a1d355fSStephan Aßmus break; 64*5a1d355fSStephan Aßmus case CLOSE_REQUEST: 65*5a1d355fSStephan Aßmus *request = new(std::nothrow) CloseRequest; 66*5a1d355fSStephan Aßmus break; 67*5a1d355fSStephan Aßmus case CLOSE_REPLY: 68*5a1d355fSStephan Aßmus *request = new(std::nothrow) CloseReply; 69*5a1d355fSStephan Aßmus break; 70*5a1d355fSStephan Aßmus case READ_REQUEST: 71*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadRequest; 72*5a1d355fSStephan Aßmus break; 73*5a1d355fSStephan Aßmus case READ_REPLY: 74*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadReply; 75*5a1d355fSStephan Aßmus break; 76*5a1d355fSStephan Aßmus case WRITE_REQUEST: 77*5a1d355fSStephan Aßmus *request = new(std::nothrow) WriteRequest; 78*5a1d355fSStephan Aßmus break; 79*5a1d355fSStephan Aßmus case WRITE_REPLY: 80*5a1d355fSStephan Aßmus *request = new(std::nothrow) WriteReply; 81*5a1d355fSStephan Aßmus break; 82*5a1d355fSStephan Aßmus case CREATE_LINK_REQUEST: 83*5a1d355fSStephan Aßmus *request = new(std::nothrow) CreateLinkRequest; 84*5a1d355fSStephan Aßmus break; 85*5a1d355fSStephan Aßmus case CREATE_LINK_REPLY: 86*5a1d355fSStephan Aßmus *request = new(std::nothrow) CreateLinkReply; 87*5a1d355fSStephan Aßmus break; 88*5a1d355fSStephan Aßmus case UNLINK_REQUEST: 89*5a1d355fSStephan Aßmus *request = new(std::nothrow) UnlinkRequest; 90*5a1d355fSStephan Aßmus break; 91*5a1d355fSStephan Aßmus case UNLINK_REPLY: 92*5a1d355fSStephan Aßmus *request = new(std::nothrow) UnlinkReply; 93*5a1d355fSStephan Aßmus break; 94*5a1d355fSStephan Aßmus case CREATE_SYMLINK_REQUEST: 95*5a1d355fSStephan Aßmus *request = new(std::nothrow) CreateSymlinkRequest; 96*5a1d355fSStephan Aßmus break; 97*5a1d355fSStephan Aßmus case CREATE_SYMLINK_REPLY: 98*5a1d355fSStephan Aßmus *request = new(std::nothrow) CreateSymlinkReply; 99*5a1d355fSStephan Aßmus break; 100*5a1d355fSStephan Aßmus case READ_LINK_REQUEST: 101*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadLinkRequest; 102*5a1d355fSStephan Aßmus break; 103*5a1d355fSStephan Aßmus case READ_LINK_REPLY: 104*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadLinkReply; 105*5a1d355fSStephan Aßmus break; 106*5a1d355fSStephan Aßmus case RENAME_REQUEST: 107*5a1d355fSStephan Aßmus *request = new(std::nothrow) RenameRequest; 108*5a1d355fSStephan Aßmus break; 109*5a1d355fSStephan Aßmus case RENAME_REPLY: 110*5a1d355fSStephan Aßmus *request = new(std::nothrow) RenameReply; 111*5a1d355fSStephan Aßmus break; 112*5a1d355fSStephan Aßmus case MAKE_DIR_REQUEST: 113*5a1d355fSStephan Aßmus *request = new(std::nothrow) MakeDirRequest; 114*5a1d355fSStephan Aßmus break; 115*5a1d355fSStephan Aßmus case MAKE_DIR_REPLY: 116*5a1d355fSStephan Aßmus *request = new(std::nothrow) MakeDirReply; 117*5a1d355fSStephan Aßmus break; 118*5a1d355fSStephan Aßmus case REMOVE_DIR_REQUEST: 119*5a1d355fSStephan Aßmus *request = new(std::nothrow) RemoveDirRequest; 120*5a1d355fSStephan Aßmus break; 121*5a1d355fSStephan Aßmus case REMOVE_DIR_REPLY: 122*5a1d355fSStephan Aßmus *request = new(std::nothrow) RemoveDirReply; 123*5a1d355fSStephan Aßmus break; 124*5a1d355fSStephan Aßmus case OPEN_DIR_REQUEST: 125*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenDirRequest; 126*5a1d355fSStephan Aßmus break; 127*5a1d355fSStephan Aßmus case OPEN_DIR_REPLY: 128*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenDirReply; 129*5a1d355fSStephan Aßmus break; 130*5a1d355fSStephan Aßmus case READ_DIR_REQUEST: 131*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadDirRequest; 132*5a1d355fSStephan Aßmus break; 133*5a1d355fSStephan Aßmus case READ_DIR_REPLY: 134*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadDirReply; 135*5a1d355fSStephan Aßmus break; 136*5a1d355fSStephan Aßmus case WALK_REQUEST: 137*5a1d355fSStephan Aßmus *request = new(std::nothrow) WalkRequest; 138*5a1d355fSStephan Aßmus break; 139*5a1d355fSStephan Aßmus case WALK_REPLY: 140*5a1d355fSStephan Aßmus *request = new(std::nothrow) WalkReply; 141*5a1d355fSStephan Aßmus break; 142*5a1d355fSStephan Aßmus case MULTI_WALK_REQUEST: 143*5a1d355fSStephan Aßmus *request = new(std::nothrow) MultiWalkRequest; 144*5a1d355fSStephan Aßmus break; 145*5a1d355fSStephan Aßmus case MULTI_WALK_REPLY: 146*5a1d355fSStephan Aßmus *request = new(std::nothrow) MultiWalkReply; 147*5a1d355fSStephan Aßmus break; 148*5a1d355fSStephan Aßmus case OPEN_ATTR_DIR_REQUEST: 149*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenAttrDirRequest; 150*5a1d355fSStephan Aßmus break; 151*5a1d355fSStephan Aßmus case OPEN_ATTR_DIR_REPLY: 152*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenAttrDirReply; 153*5a1d355fSStephan Aßmus break; 154*5a1d355fSStephan Aßmus case READ_ATTR_DIR_REQUEST: 155*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadAttrDirRequest; 156*5a1d355fSStephan Aßmus break; 157*5a1d355fSStephan Aßmus case READ_ATTR_DIR_REPLY: 158*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadAttrDirReply; 159*5a1d355fSStephan Aßmus break; 160*5a1d355fSStephan Aßmus case READ_ATTR_REQUEST: 161*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadAttrRequest; 162*5a1d355fSStephan Aßmus break; 163*5a1d355fSStephan Aßmus case READ_ATTR_REPLY: 164*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadAttrReply; 165*5a1d355fSStephan Aßmus break; 166*5a1d355fSStephan Aßmus case WRITE_ATTR_REQUEST: 167*5a1d355fSStephan Aßmus *request = new(std::nothrow) WriteAttrRequest; 168*5a1d355fSStephan Aßmus break; 169*5a1d355fSStephan Aßmus case WRITE_ATTR_REPLY: 170*5a1d355fSStephan Aßmus *request = new(std::nothrow) WriteAttrReply; 171*5a1d355fSStephan Aßmus break; 172*5a1d355fSStephan Aßmus case REMOVE_ATTR_REQUEST: 173*5a1d355fSStephan Aßmus *request = new(std::nothrow) RemoveAttrRequest; 174*5a1d355fSStephan Aßmus break; 175*5a1d355fSStephan Aßmus case REMOVE_ATTR_REPLY: 176*5a1d355fSStephan Aßmus *request = new(std::nothrow) RemoveAttrReply; 177*5a1d355fSStephan Aßmus break; 178*5a1d355fSStephan Aßmus case RENAME_ATTR_REQUEST: 179*5a1d355fSStephan Aßmus *request = new(std::nothrow) RenameAttrRequest; 180*5a1d355fSStephan Aßmus break; 181*5a1d355fSStephan Aßmus case RENAME_ATTR_REPLY: 182*5a1d355fSStephan Aßmus *request = new(std::nothrow) RenameAttrReply; 183*5a1d355fSStephan Aßmus break; 184*5a1d355fSStephan Aßmus case STAT_ATTR_REQUEST: 185*5a1d355fSStephan Aßmus *request = new(std::nothrow) StatAttrRequest; 186*5a1d355fSStephan Aßmus break; 187*5a1d355fSStephan Aßmus case STAT_ATTR_REPLY: 188*5a1d355fSStephan Aßmus *request = new(std::nothrow) StatAttrReply; 189*5a1d355fSStephan Aßmus break; 190*5a1d355fSStephan Aßmus case OPEN_QUERY_REQUEST: 191*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenQueryRequest; 192*5a1d355fSStephan Aßmus break; 193*5a1d355fSStephan Aßmus case OPEN_QUERY_REPLY: 194*5a1d355fSStephan Aßmus *request = new(std::nothrow) OpenQueryReply; 195*5a1d355fSStephan Aßmus break; 196*5a1d355fSStephan Aßmus case READ_QUERY_REQUEST: 197*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadQueryRequest; 198*5a1d355fSStephan Aßmus break; 199*5a1d355fSStephan Aßmus case READ_QUERY_REPLY: 200*5a1d355fSStephan Aßmus *request = new(std::nothrow) ReadQueryReply; 201*5a1d355fSStephan Aßmus break; 202*5a1d355fSStephan Aßmus case ENTRY_CREATED_REQUEST: 203*5a1d355fSStephan Aßmus *request = new(std::nothrow) EntryCreatedRequest; 204*5a1d355fSStephan Aßmus break; 205*5a1d355fSStephan Aßmus case ENTRY_REMOVED_REQUEST: 206*5a1d355fSStephan Aßmus *request = new(std::nothrow) EntryRemovedRequest; 207*5a1d355fSStephan Aßmus break; 208*5a1d355fSStephan Aßmus case ENTRY_MOVED_REQUEST: 209*5a1d355fSStephan Aßmus *request = new(std::nothrow) EntryMovedRequest; 210*5a1d355fSStephan Aßmus break; 211*5a1d355fSStephan Aßmus case ENTRY_STAT_CHANGED_REQUEST: 212*5a1d355fSStephan Aßmus *request = new(std::nothrow) StatChangedRequest; 213*5a1d355fSStephan Aßmus break; 214*5a1d355fSStephan Aßmus case ENTRY_ATTRIBUTE_CHANGED_REQUEST: 215*5a1d355fSStephan Aßmus *request = new(std::nothrow) AttributeChangedRequest; 216*5a1d355fSStephan Aßmus break; 217*5a1d355fSStephan Aßmus case SERVER_INFO_REQUEST: 218*5a1d355fSStephan Aßmus *request = new(std::nothrow) ServerInfoRequest; 219*5a1d355fSStephan Aßmus break; 220*5a1d355fSStephan Aßmus default: 221*5a1d355fSStephan Aßmus return B_BAD_VALUE; 222*5a1d355fSStephan Aßmus } 223*5a1d355fSStephan Aßmus return (*request ? B_OK : B_NO_MEMORY); 224*5a1d355fSStephan Aßmus } 225*5a1d355fSStephan Aßmus 226