00001 /*************************************************************************** 00002 LOW_IPCKeyGenerator_SysV.cpp - description 00003 ------------------- 00004 begin : Tue Jul 30 2002 00005 copyright : (C) 2002 by Harald Roelle, Helmut Reiser 00006 email : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 00019 #include <sys/types.h> 00020 #include <sys/ipc.h> 00021 00022 #include "LOW_IPCKeyGenerator_SysV.h" 00023 00024 00025 //===================================================================================== 00026 // 00027 // methods 00028 // 00029 00030 LOW_semaphoreSetFactory::semSetIPCKey_t LOW_IPCKeyGenerator_SysV::getSemSetKey( const LOW_portSerialFactory::portSpecifier_t &inSerPortSpec) 00031 { 00032 return ftok( inSerPortSpec.c_str(), 1); 00033 } 00034 00035 00036 LOW_semaphoreSetFactory::semSetIPCKey_t LOW_IPCKeyGenerator_SysV::getSemSetKey( const LOW_deviceID &inDevID) 00037 { 00038 LOW_deviceIDRaw::devSerNum_t serial; 00039 inDevID.getSerialNum( serial); 00040 return (serial[3]<<24) | (serial[2]<<16) | (serial[1]<<8) | serial[0]; 00041 } 00042 00043 00044 LOW_sharedMemSegmentFactory::sharedMemSegmentIPCKey_t LOW_IPCKeyGenerator_SysV::getSharedMemKey( const LOW_portSerialFactory::portSpecifier_t &inSerPortSpec) 00045 { 00046 return ftok( inSerPortSpec.c_str(), 2); 00047 }