diff --git a/.github/workflows/stylecheck.yml b/.github/workflows/stylecheck.yml index 8c28a678410..ffbb051bf6b 100644 --- a/.github/workflows/stylecheck.yml +++ b/.github/workflows/stylecheck.yml @@ -21,13 +21,13 @@ jobs: - name: Fix spacing run: | # Fix mixed tabs and spaces - find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'expand -t 4 "$0" | sponge "$0"' {} \; + find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'expand -t 4 "$0" | sponge "$0"' {} \; # Fix trailing white spaces - find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'sed -i '' -e "s/[[:space:]]*$//" "$0"' {} \; + find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'sed -i '' -e "s/[[:space:]]*$//" "$0"' {} \; # Ensure files end with a new line - find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'tail -c1 < "$0" | read -r _ || echo >> "$0"' {} \; + find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'tail -c1 < "$0" | read -r _ || echo >> "$0"' {} \; - name: Report result run: | @@ -52,10 +52,10 @@ jobs: - name: Fix encoding run: | # Ensure that files are UTF-8 encoded - find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'recode UTF-8 "$0" 2> /dev/null' {} \; + find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'recode UTF-8 "$0" 2> /dev/null' {} \; # Ensure that files have LF line endings and do not contain a BOM - find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'dos2unix "$0" 2> /dev/null' {} \; + find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'dos2unix "$0" 2> /dev/null' {} \; - name: Report result run: | @@ -103,7 +103,6 @@ jobs: git restore ./Externals git restore ./res git restore ./sdk - git restore ./src/utils/mp_gpprof_server/libraries - name: Report result run: | diff --git a/src/Common/Common.vcxproj b/src/Common/Common.vcxproj index bfa5fe31330..217dde6bb77 100644 --- a/src/Common/Common.vcxproj +++ b/src/Common/Common.vcxproj @@ -55,16 +55,11 @@ - - - - - @@ -80,9 +75,6 @@ - - - diff --git a/src/Common/Common.vcxproj.filters b/src/Common/Common.vcxproj.filters index 6269d792325..a0c0018659d 100644 --- a/src/Common/Common.vcxproj.filters +++ b/src/Common/Common.vcxproj.filters @@ -3,7 +3,6 @@ - @@ -18,18 +17,6 @@ - - NvMender2003 - - - NvMender2003 - - - NvMender2003 - - - NvMender2003 - Platform @@ -95,9 +82,6 @@ - - {4a2b53ad-98a9-4338-99a6-b5ea4123d5bf} - {05b6dbf9-e387-495f-9d92-e2b8ecc350fa} @@ -108,11 +92,6 @@ {d02f2a58-bd08-43dc-86cc-6edd8c1f08a5} - - - NvMender2003 - - Platform diff --git a/src/Common/NvMender2003/NVMeshMender.cpp b/src/Common/NvMender2003/NVMeshMender.cpp deleted file mode 100644 index f147008ffe2..00000000000 --- a/src/Common/NvMender2003/NVMeshMender.cpp +++ /dev/null @@ -1,1038 +0,0 @@ -/*********************************************************************NVMH4**** -Path: -File: - -Copyright NVIDIA Corporation 2003 -TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED -*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS -BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES -WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) -ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - -Comments: - - Todo - - Performance improvements, right now for each vertex I am building the list - of it's neighbors, when we could do a single pass and build the full adjacency - map in the beginning. Note: I tried this and didn't see a real perf improvement. - - - I'd like to provide a non c++ standard library interface, probably - a simple c interface for all those simple c folks. or the - old nvMeshMender interface for all those using it already - -*/ - -#include "stdafx.h" -#include "nvMeshMender.h" -#include "assert.h" - -namespace -{ -const unsigned int NO_GROUP = 0xFFFFFFFF; - -// IC: Replacement for D3DXVec3Normalize so that we don't have dll dependancies. -static D3DXVECTOR3* Vec3Normalize(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV) -{ - assert(pOut != NULL); - assert(pV != NULL); - - float v = 1.0f / _sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z); - pOut->x *= v; - pOut->y *= v; - pOut->z *= v; - return pOut; -} -}; - -void MeshMender::Triangle::Reset() -{ - handled = false; - group = NO_GROUP; -} - -class MeshMender::CanSmoothChecker -{ -public: - virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle) = 0; -}; - -class CanSmoothNormalsChecker : public MeshMender::CanSmoothChecker -{ -public: - virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle) - { - assert(t1 && t2); - // for checking the angle, we want these to be normalized, - // they may not be for whatever reason - D3DXVECTOR3 tmp1 = t1->normal; - D3DXVECTOR3 tmp2 = t2->normal; - Vec3Normalize(&tmp1, &tmp1); - Vec3Normalize(&tmp2, &tmp2); - - if (D3DXVec3Dot(&tmp1, &tmp2) >= minCreaseAngle) - { - return true; - } - else if ((tmp1 == D3DXVECTOR3(0, 0, 0)) && (tmp2 == D3DXVECTOR3(0, 0, 0))) - { - // check for them both being null, then they are - // welcome to smooth no matter what the minCreaseAngle is - return true; - } - return false; - } -}; - -class CanSmoothTangentsChecker : public MeshMender::CanSmoothChecker -{ -public: - virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle) - { - assert(t1 && t2); - // for checking the angle, we want these to be normalized, - // they may not be for whatever reason - D3DXVECTOR3 tmp1 = t1->tangent; - D3DXVECTOR3 tmp2 = t2->tangent; - Vec3Normalize(&tmp1, &tmp1); - Vec3Normalize(&tmp2, &tmp2); - - if (D3DXVec3Dot(&tmp1, &tmp2) >= minCreaseAngle) - { - return true; - } - else if ((tmp1 == D3DXVECTOR3(0, 0, 0)) && (tmp2 == D3DXVECTOR3(0, 0, 0))) - { - // check for them both being null, then they are - // welcome to smooth no matter what the minCreaseAngle is - return true; - } - return false; - } -}; - -class CanSmoothBinormalsChecker : public MeshMender::CanSmoothChecker -{ -public: - virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle) - { - assert(t1 && t2); - // for checking the angle, we want these to be normalized, - // they may not be for whatever reason - D3DXVECTOR3 tmp1 = t1->binormal; - D3DXVECTOR3 tmp2 = t2->binormal; - Vec3Normalize(&tmp1, &tmp1); - Vec3Normalize(&tmp2, &tmp2); - - if (D3DXVec3Dot(&tmp1, &tmp2) >= minCreaseAngle) - return true; - else if ((tmp1 == D3DXVECTOR3(0, 0, 0)) && (tmp2 == D3DXVECTOR3(0, 0, 0))) - { - // check for them both being null, then they are - // welcome to smooth no matter what the minCreaseAngle is - return true; - } - return false; - } -}; - -bool operator<(const D3DXVECTOR3& lhs, const D3DXVECTOR3& rhs) -{ - // needed to have a vertex in a map. - // must be an absolute sort so that we can reliably find the exact - // position again, not a fuzzy compare for equality based on an epsilon. - if (lhs.x == rhs.x) - { - if (lhs.y == rhs.y) - { - if (lhs.z == rhs.z) - { - return false; - } - else - { - return (lhs.z < rhs.z); - } - } - else - { - return (lhs.y < rhs.y); - } - } - else - { - return (lhs.x < rhs.x); - } -} - -MeshMender::MeshMender() -{ - MinNormalsCreaseCosAngle = 0.3f; - MinTangentsCreaseCosAngle = 0.0f; - MinBinormalsCreaseCosAngle = 0.0f; - WeightNormalsByArea = 0.0f; - m_RespectExistingSplits = DONT_RESPECT_SPLITS; -} -MeshMender::~MeshMender() {} -void MeshMender::UpdateIndices(const size_t oldIndex, const size_t newIndex, TriangleList& curGroup) -{ - // make any triangle that used the oldIndex use the newIndex instead - - for (size_t t = 0; t < curGroup.size(); ++t) - { - TriID tID = curGroup[t]; - for (size_t indx = 0; indx < 3; ++indx) - { - if (m_Triangles[tID].indices[indx] == oldIndex) - { - m_Triangles[tID].indices[indx] = newIndex; - } - } - } -} -void MeshMender::ProcessNormals(TriangleList& possibleNeighbors, xr_vector& theVerts, - xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition) -{ - NeighborGroupList neighborGroups; // a fresh group for each pass - - // reset each triangle to prepare for smoothing group building - for (u32 i = 0; i < possibleNeighbors.size(); ++i) - { - m_Triangles[possibleNeighbors[i]].Reset(); - } - - // now start building groups - CanSmoothNormalsChecker canSmoothNormalsChecker; - for (u32 i = 0; i < possibleNeighbors.size(); ++i) - { - Triangle* currTri = &(m_Triangles[possibleNeighbors[i]]); - assert(currTri); - if (!currTri->handled) - { - BuildGroups(currTri, possibleNeighbors, neighborGroups, theVerts, &canSmoothNormalsChecker, - MinNormalsCreaseCosAngle); - } - } - - xr_vector groupNormalVectors; - - for (u32 i = 0; i < neighborGroups.size(); ++i) - { - // for each group, calculate the group normal - TriangleList& curGroup = neighborGroups[i]; - D3DXVECTOR3 gnorm(0.0f, 0.0f, 0.0f); - - assert(curGroup.size() != 0 && "should not be a zero group here."); - for (size_t t = 0; t < curGroup.size(); ++t) // for each triangle in the group, - { - TriID tID = curGroup[t]; - gnorm += m_Triangles[tID].normal; - } - Vec3Normalize(&gnorm, &gnorm); - groupNormalVectors.push_back(gnorm); - } - - // next step, ensure that triangles in different groups are not - // sharing vertices. and give the shared vertex their new group vector - xr_set otherGroupsIndices; - for (u32 i = 0; i < neighborGroups.size(); ++i) - { - TriangleList& curGroup = neighborGroups[i]; - xr_set thisGroupIndices; - - for (size_t t = 0; t < curGroup.size(); ++t) // for each tri - { - TriID tID = curGroup[t]; - for (size_t indx = 0; indx < 3; ++indx) // for each vert in that tri - { - // if it is at the positions in question - if (theVerts[m_Triangles[tID].indices[indx]].pos == workingPosition) - { - // see if another group is already using this vert - if (otherGroupsIndices.find(m_Triangles[tID].indices[indx]) != otherGroupsIndices.end()) - { - // then we need to make a new vertex - Vertex ov; - ov = theVerts[m_Triangles[tID].indices[indx]]; - ov.normal = groupNormalVectors[i]; - size_t oldIndex = m_Triangles[tID].indices[indx]; - size_t newIndex = theVerts.size(); - theVerts.push_back(ov); - AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert); - UpdateIndices(oldIndex, newIndex, curGroup); - } - else - { - // otherwise, just update it with the new vector - theVerts[m_Triangles[tID].indices[indx]].normal = groupNormalVectors[i]; - } - - // store that we have used this index, so other groups can check - thisGroupIndices.insert(m_Triangles[tID].indices[indx]); - } - } - } - - for (xr_set::iterator it = thisGroupIndices.begin(); it != thisGroupIndices.end(); ++it) - { - otherGroupsIndices.insert(*it); - } - } -} - -void MeshMender::ProcessTangents(TriangleList& possibleNeighbors, xr_vector& theVerts, - xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition) -{ - NeighborGroupList neighborGroups; // a fresh group for each pass - - // reset each triangle to prepare for smoothing group building - for (u32 i = 0; i < possibleNeighbors.size(); ++i) - { - m_Triangles[possibleNeighbors[i]].Reset(); - } - - // now start building groups - CanSmoothTangentsChecker canSmoothTangentsChecker; - for (u32 i = 0; i < possibleNeighbors.size(); ++i) - { - Triangle* currTri = &(m_Triangles[possibleNeighbors[i]]); - assert(currTri); - if (!currTri->handled) - { - BuildGroups(currTri, possibleNeighbors, neighborGroups, theVerts, &canSmoothTangentsChecker, - MinTangentsCreaseCosAngle); - } - } - - xr_vector groupTangentVectors; - - for (u32 i = 0; i < neighborGroups.size(); ++i) - { - D3DXVECTOR3 gtang(0, 0, 0); - for (unsigned int t = 0; t < neighborGroups[i].size(); ++t) // for each triangle in the group, - { - TriID tID = neighborGroups[i][t]; - gtang += m_Triangles[tID].tangent; - } - Vec3Normalize(>ang, >ang); - groupTangentVectors.push_back(gtang); - } - - // next step, ensure that triangles in different groups are not - // sharing vertices. and give the shared vertex their new group vector - xr_set otherGroupsIndices; - for (u32 i = 0; i < neighborGroups.size(); ++i) - { - TriangleList& curGroup = neighborGroups[i]; - xr_set thisGroupIndices; - - for (size_t t = 0; t < curGroup.size(); ++t) // for each tri - { - TriID tID = curGroup[t]; - for (size_t indx = 0; indx < 3; indx++) // for each vert in that tri - { - // if it is at the positions in question - if (theVerts[m_Triangles[tID].indices[indx]].pos == workingPosition) - { - // see if another group is already using this vert - if (otherGroupsIndices.find(m_Triangles[tID].indices[indx]) != otherGroupsIndices.end()) - { - // then we need to make a new vertex - Vertex ov; - ov = theVerts[m_Triangles[tID].indices[indx]]; - ov.tangent = groupTangentVectors[i]; - size_t oldIndex = m_Triangles[tID].indices[indx]; - size_t newIndex = theVerts.size(); - theVerts.push_back(ov); - AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert); - UpdateIndices(oldIndex, newIndex, curGroup); - } - else - { - // otherwise, just update it with the new vector - theVerts[m_Triangles[tID].indices[indx]].tangent = groupTangentVectors[i]; - } - - // store that we have used this index, so other groups can check - thisGroupIndices.insert(m_Triangles[tID].indices[indx]); - } - } - } - - for (xr_set::iterator it = thisGroupIndices.begin(); it != thisGroupIndices.end(); ++it) - { - otherGroupsIndices.insert(*it); - } - } -} - -void MeshMender::ProcessBinormals(TriangleList& possibleNeighbors, xr_vector& theVerts, - xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition) -{ - NeighborGroupList neighborGroups; // a fresh group for each pass - - // reset each triangle to prepare for smoothing group building - for (u32 i = 0; i < possibleNeighbors.size(); ++i) - { - m_Triangles[possibleNeighbors[i]].Reset(); - } - - // now start building groups - CanSmoothBinormalsChecker canSmoothBinormalsChecker; - for (u32 i = 0; i < possibleNeighbors.size(); ++i) - { - Triangle* currTri = &(m_Triangles[possibleNeighbors[i]]); - assert(currTri); - if (!currTri->handled) - { - BuildGroups(currTri, possibleNeighbors, neighborGroups, theVerts, &canSmoothBinormalsChecker, - MinBinormalsCreaseCosAngle); - } - } - - xr_vector groupBinormalVectors; - - for (u32 i = 0; i < neighborGroups.size(); ++i) - { - D3DXVECTOR3 gbinormal(0, 0, 0); - for (unsigned int t = 0; t < neighborGroups[i].size(); ++t) // for each triangle in the group, - { - TriID tID = neighborGroups[i][t]; - gbinormal += m_Triangles[tID].binormal; - } - Vec3Normalize(&gbinormal, &gbinormal); - groupBinormalVectors.push_back(gbinormal); - } - - // next step, ensure that triangles in different groups are not - // sharing vertices. and give the shared vertex their new group vector - xr_set otherGroupsIndices; - for (u32 i = 0; i < neighborGroups.size(); ++i) - { - TriangleList& curGroup = neighborGroups[i]; - xr_set thisGroupIndices; - - for (size_t t = 0; t < curGroup.size(); ++t) // for each tri - { - TriID tID = curGroup[t]; - for (size_t indx = 0; indx < 3; ++indx) // for each vert in that tri - { - // if it is at the positions in question - if (theVerts[m_Triangles[tID].indices[indx]].pos == workingPosition) - { - // see if another group is already using this vert - if (otherGroupsIndices.find(m_Triangles[tID].indices[indx]) != otherGroupsIndices.end()) - { - // then we need to make a new vertex - Vertex ov; - ov = theVerts[m_Triangles[tID].indices[indx]]; - ov.binormal = groupBinormalVectors[i]; - size_t oldIndex = m_Triangles[tID].indices[indx]; - size_t newIndex = theVerts.size(); - theVerts.push_back(ov); - AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert); - UpdateIndices(oldIndex, newIndex, curGroup); - } - else - { - // otherwise, just update it with the new vector - theVerts[m_Triangles[tID].indices[indx]].binormal = groupBinormalVectors[i]; - } - - // store that we have used this index, so other groups can check - thisGroupIndices.insert(m_Triangles[tID].indices[indx]); - } - } - } - - for (xr_set::iterator it = thisGroupIndices.begin(); it != thisGroupIndices.end(); ++it) - { - otherGroupsIndices.insert(*it); - } - } -} - -bool MeshMender::Mend(xr_vector& theVerts, xr_vector& theIndices, - xr_vector& mappingNewToOldVert, const float minNormalsCreaseCosAngle, - const float minTangentsCreaseCosAngle, const float minBinormalsCreaseCosAngle, const float weightNormalsByArea, - const NormalCalcOption computeNormals, const ExistingSplitOption respectExistingSplits, - const CylindricalFixOption fixCylindricalWrapping) -{ - MinNormalsCreaseCosAngle = minNormalsCreaseCosAngle; - MinTangentsCreaseCosAngle = minTangentsCreaseCosAngle; - MinBinormalsCreaseCosAngle = minBinormalsCreaseCosAngle; - WeightNormalsByArea = weightNormalsByArea; - m_RespectExistingSplits = respectExistingSplits; - - // fix cylindrical should happen before we do any other calculations - if (fixCylindricalWrapping == FIX_CYLINDRICAL) - { - FixCylindricalWrapping(theVerts, theIndices, mappingNewToOldVert); - } - - SetUpData(theVerts, theIndices, mappingNewToOldVert, computeNormals); - - // for each unique position - for (VertexChildrenMap::iterator vert = m_VertexChildrenMap.begin(); vert != m_VertexChildrenMap.end(); ++vert) - { - D3DXVECTOR3 workingPosition = vert->first; - - TriangleList& possibleNeighbors = vert->second; - if (computeNormals == CALCULATE_NORMALS) - { - ProcessNormals(possibleNeighbors, theVerts, mappingNewToOldVert, workingPosition); - } - ProcessTangents(possibleNeighbors, theVerts, mappingNewToOldVert, workingPosition); - ProcessBinormals(possibleNeighbors, theVerts, mappingNewToOldVert, workingPosition); - } - - UpdateTheIndicesWithFinalIndices(theIndices); - OrthogonalizeTangentsAndBinormals(theVerts); - - return true; -} - -void MeshMender::BuildGroups(Triangle* tri, // the tri of interest - TriangleList& possibleNeighbors, // all tris arround a vertex - NeighborGroupList& neighborGroups, // the neighbor groups to be updated - xr_vector& theVerts, CanSmoothChecker* smoothChecker, const float& minCreaseAngle) -{ - if ((!tri) || (tri->handled)) - return; - - Triangle* neighbor1 = NULL; - Triangle* neighbor2 = NULL; - - FindNeighbors(tri, possibleNeighbors, &neighbor1, &neighbor2, theVerts); - - // see if I can join my first neighbors group - if (neighbor1 && (neighbor1->group != NO_GROUP)) - { - if (smoothChecker->CanSmooth(tri, neighbor1, minCreaseAngle)) - { - neighborGroups[neighbor1->group].push_back(tri->myID); - tri->group = neighbor1->group; - } - } - - // see if I can join my second neighbors group - if (neighbor2 && (neighbor2->group != NO_GROUP)) - { - if (smoothChecker->CanSmooth(tri, neighbor2, minCreaseAngle)) - { - neighborGroups[neighbor2->group].push_back(tri->myID); - tri->group = neighbor2->group; - } - } - // I either couldn't join, or they weren't in a group, so I think I'll - // just go and start my own group...right here we go. - if (tri->group == NO_GROUP) - { - tri->group = neighborGroups.size(); - neighborGroups.push_back(TriangleList()); - neighborGroups.back().push_back(tri->myID); - } - assert((tri->group != NO_GROUP) && "error!: tri should have a group set"); - tri->handled = true; - - // continue growing our group with each neighbor. - BuildGroups(neighbor1, possibleNeighbors, neighborGroups, theVerts, smoothChecker, minCreaseAngle); - BuildGroups(neighbor2, possibleNeighbors, neighborGroups, theVerts, smoothChecker, minCreaseAngle); -} - -void MeshMender::FindNeighbors(Triangle* tri, TriangleList& possibleNeighbors, Triangle** neighbor1, - Triangle** neighbor2, xr_vector& theVerts) -{ - *neighbor1 = NULL; - *neighbor2 = NULL; - - xr_vector theNeighbors; - for (unsigned int n = 0; n < possibleNeighbors.size(); ++n) - { - TriID tID = possibleNeighbors[n]; - Triangle* possible = &(m_Triangles[tID]); - if (possible != tri) // check for myself - { - if (SharesEdge(tri, possible, theVerts)) - { - theNeighbors.push_back(possible); - } - } - } - - if (theNeighbors.size() > 0) - *neighbor1 = theNeighbors[0]; - if (theNeighbors.size() > 1) - *neighbor2 = theNeighbors[1]; -} - -bool MeshMender::TriHasEdge( - const size_t& p0, const size_t& p1, const size_t& triA, const size_t& triB, const size_t& triC) -{ - if (((p0 == triB) && (p1 == triA)) || ((p0 == triA) && (p1 == triB))) - { - return true; - } - - if (((p0 == triB) && (p1 == triC)) || ((p0 == triC) && (p1 == triB))) - { - return true; - } - - if (((p0 == triC) && (p1 == triA)) || ((p0 == triA) && (p1 == triC))) - { - return true; - } - return false; -} - -bool MeshMender::TriHasEdge(const D3DXVECTOR3& p0, const D3DXVECTOR3& p1, const D3DXVECTOR3& triA, - const D3DXVECTOR3& triB, const D3DXVECTOR3& triC) -{ - if (((p0 == triB) && (p1 == triA)) || ((p0 == triA) && (p1 == triB))) - { - return true; - } - - if (((p0 == triB) && (p1 == triC)) || ((p0 == triC) && (p1 == triB))) - { - return true; - } - - if (((p0 == triC) && (p1 == triA)) || ((p0 == triA) && (p1 == triC))) - { - return true; - } - return false; -} - -bool MeshMender::SharesEdgeRespectSplits(Triangle* triA, Triangle* triB, xr_vector& theVerts) -{ - assert(triA && triB && "invalid data passed to SharesEdgeNoSplit"); - // here we want to compare based solely on indices. - - size_t a1 = triA->indices[0]; - size_t b1 = triA->indices[1]; - size_t c1 = triA->indices[2]; - - size_t a2 = triB->indices[0]; - size_t b2 = triB->indices[1]; - size_t c2 = triB->indices[2]; - - // edge B1->A1 - if (TriHasEdge(b1, a1, a2, b2, c2)) - return true; - - // edge A1->C1 - if (TriHasEdge(a1, c1, a2, b2, c2)) - return true; - - // edge C1->B1 - if (TriHasEdge(c1, b1, a2, b2, c2)) - return true; - - return false; -} - -bool MeshMender::SharesEdge(Triangle* triA, Triangle* triB, xr_vector& theVerts) -{ - assert(triA && triB && "invalid data passed to SharesEdge"); - - // check based on position not on indices, because there may be splits - // we don't care about. unless the user has told us they care about those - // splits - if (m_RespectExistingSplits == RESPECT_SPLITS) - { - return SharesEdgeRespectSplits(triA, triB, theVerts); - } - - D3DXVECTOR3 a1 = theVerts[triA->indices[0]].pos; - D3DXVECTOR3 b1 = theVerts[triA->indices[1]].pos; - D3DXVECTOR3 c1 = theVerts[triA->indices[2]].pos; - - D3DXVECTOR3 a2 = theVerts[triB->indices[0]].pos; - D3DXVECTOR3 b2 = theVerts[triB->indices[1]].pos; - D3DXVECTOR3 c2 = theVerts[triB->indices[2]].pos; - - // edge B1->A1 - if (TriHasEdge(b1, a1, a2, b2, c2)) - return true; - - // edge A1->C1 - if (TriHasEdge(a1, c1, a2, b2, c2)) - return true; - - // edge C1->B1 - if (TriHasEdge(c1, b1, a2, b2, c2)) - return true; - - return false; -} - -void MeshMender::SetUpData(xr_vector& theVerts, const xr_vector& theIndices, - xr_vector& mappingNewToOldVert, const NormalCalcOption computeNormals) -{ - assert(((theIndices.size() % 3) == 0) && "expected the indices to be a multiple of 3"); - unsigned int i; - - // initialize the mapping - for (i = 0; i < theVerts.size(); ++i) - mappingNewToOldVert.push_back(i); - - m_originalNumVerts = theVerts.size(); - - // set up our triangles - for (i = 0; i < theIndices.size(); i += 3) - { - Triangle t; - - t.indices[0] = theIndices[i + 0]; - t.indices[1] = theIndices[i + 1]; - t.indices[2] = theIndices[i + 2]; - - // set up bin, norm, and tan - SetUpFaceVectors(t, theVerts, computeNormals); - - t.myID = m_Triangles.size(); // set id, to my index into m_Triangles - m_Triangles.push_back(t); - } - - // build vertex position/traingle pairings. - // we use the position and not the actual vertex, because there may - // be multiple coppies of the same vertex for textureing - // but we don't want that to - // effect our decisions about normal smoothing. - // note: maybe this should be an option, the position thing. - for (i = 0; i < m_Triangles.size(); ++i) - { - for (size_t indx = 0; indx < 3; ++indx) - { - D3DXVECTOR3 v = theVerts[m_Triangles[i].indices[indx]].pos; - VertexChildrenMap::iterator iter = m_VertexChildrenMap.find(v); - if (iter != m_VertexChildrenMap.end()) - { - // we found it, so just add ourselves to it. - iter->second.push_back(TriID(i)); - } - else - { - // we didn't find it so join whatever was there. - xr_vector tmp; - m_VertexChildrenMap[v] = tmp; - m_VertexChildrenMap[v].push_back(TriID(i)); - } - } - } -} - -// sets up the normal, binormal, and tangent for a triangle -// assumes the triangle indices are set to match whats in the verts -void MeshMender::SetUpFaceVectors(Triangle& t, const xr_vector& verts, const NormalCalcOption computeNormals) -{ - if (computeNormals == CALCULATE_NORMALS) - { - D3DXVECTOR3 edge0 = verts[t.indices[1]].pos - verts[t.indices[0]].pos; - D3DXVECTOR3 edge1 = verts[t.indices[2]].pos - verts[t.indices[0]].pos; - - D3DXVec3Cross(&t.normal, &edge0, &edge1); - - if (WeightNormalsByArea < 1.0f) - { - D3DXVECTOR3 normalizedNorm; - Vec3Normalize(&normalizedNorm, &t.normal); - D3DXVECTOR3 finalNorm = (normalizedNorm * (1.0f - WeightNormalsByArea)) + (t.normal * WeightNormalsByArea); - t.normal = finalNorm; - } - } - // need to set up tangents, and binormals here - GetGradients(verts[t.indices[0]], verts[t.indices[1]], verts[t.indices[2]], t.tangent, t.binormal); -} - -void MeshMender::OrthogonalizeTangentsAndBinormals(xr_vector& theVerts) -{ - // put our tangents and binormals through the final orthogonalization - // with the final processed normals - size_t len = theVerts.size(); - for (size_t i = 0; i < len; ++i) - { - assert(D3DXVec3Length(&(theVerts[i].normal)) > 0.00001f && - "found zero length normal when calculating tangent basis!,\ - if you are not using mesh mender to compute normals, you\ - must still pass in valid normals to be used when calculating\ - tangents and binormals."); - - // now with T and B and N we can get from tangent space to object space - // but we want to go the other way, so we need the inverse - // of the T, B,N matrix - // we can use the Gram-Schmidt algorithm to find the newTangent and the newBinormal - // newT = T - (N dot T)N - // newB = B - (N dot B)N - (newT dot B)newT - - // NOTE: this should maybe happen with the final smoothed N, T, and B - // will try it here and see what the results look like - - D3DXVECTOR3 tmpTan = theVerts[i].tangent; - D3DXVECTOR3 tmpNorm = theVerts[i].normal; - D3DXVECTOR3 tmpBin = theVerts[i].binormal; - - D3DXVECTOR3 newT = tmpTan - (D3DXVec3Dot(&tmpNorm, &tmpTan) * tmpNorm); - D3DXVECTOR3 newB = tmpBin - (D3DXVec3Dot(&tmpNorm, &tmpBin) * tmpNorm) - (D3DXVec3Dot(&newT, &tmpBin) * newT); - - Vec3Normalize(&(theVerts[i].tangent), &newT); - Vec3Normalize(&(theVerts[i].binormal), &newB); - - // this is where we can do a final check for zero length vectors - // and set them to something appropriate - float lenTan = D3DXVec3Length(&(theVerts[i].tangent)); - float lenBin = D3DXVec3Length(&(theVerts[i].binormal)); - - if ((lenTan <= 0.001f) || (lenBin <= 0.001f)) // should be approx 1.0f - { - // the tangent space is ill defined at this vertex - // so we can generate a valid one based on the normal vector, - // which I'm assuming is valid! - - if (lenTan > 0.5f) - { - // the tangent is valid, so we can just use that - // to calculate the binormal - D3DXVec3Cross(&(theVerts[i].binormal), &(theVerts[i].normal), &(theVerts[i].tangent)); - } - else if (lenBin > 0.5) - { - // the binormal is good and we can use it to calculate - // the tangent - D3DXVec3Cross(&(theVerts[i].tangent), &(theVerts[i].binormal), &(theVerts[i].normal)); - } - else - { - // both vectors are invalid, so we should create something - // that is at least valid if not correct - D3DXVECTOR3 xAxis(1.0f, 0.0f, 0.0f); - D3DXVECTOR3 yAxis(0.0f, 1.0f, 0.0f); - // I'm checking two possible axis, because the normal could be one of them, - // and we want to chose a different one to start making our valid basis. - // I can find out which is further away from it by checking the dot product - D3DXVECTOR3 startAxis; - - if (D3DXVec3Dot(&xAxis, &(theVerts[i].normal)) < D3DXVec3Dot(&yAxis, &(theVerts[i].normal))) - { - // the xAxis is more different than the yAxis when compared to the normal - startAxis = xAxis; - } - else - { - // the yAxis is more different than the xAxis when compared to the normal - startAxis = yAxis; - } - - D3DXVec3Cross(&(theVerts[i].tangent), &(theVerts[i].normal), &startAxis); - D3DXVec3Cross(&(theVerts[i].binormal), &(theVerts[i].normal), &(theVerts[i].tangent)); - } - } - else - { - // one final sanity check, make sure that they tangent and binormal are different enough - if (D3DXVec3Dot(&(theVerts[i].binormal), &(theVerts[i].tangent)) > 0.999f) - { - // then they are too similar lets make them more different - D3DXVec3Cross(&(theVerts[i].binormal), &(theVerts[i].normal), &(theVerts[i].tangent)); - } - } - } -} - -void MeshMender::GetGradients(const MeshMender::Vertex& v0, const MeshMender::Vertex& v1, const MeshMender::Vertex& v2, - D3DXVECTOR3& tangent, D3DXVECTOR3& binormal) const -{ - // using Eric Lengyel's approach with a few modifications - // from Mathematics for 3D Game Programmming and Computer Graphics - // want to be able to trasform a vector in Object Space to Tangent Space - // such that the x-axis cooresponds to the 's' direction and the - // y-axis corresponds to the 't' direction, and the z-axis corresponds - // to <0,0,1>, straight up out of the texture map - - // let P = v1 - v0 - D3DXVECTOR3 P = v1.pos - v0.pos; - // let Q = v2 - v0 - D3DXVECTOR3 Q = v2.pos - v0.pos; - float s1 = v1.s - v0.s; - float t1 = v1.t - v0.t; - float s2 = v2.s - v0.s; - float t2 = v2.t - v0.t; - - // we need to solve the equation - // P = s1*T + t1*B - // Q = s2*T + t2*B - // for T and B - - // this is a linear system with six unknowns and six equatinos, for TxTyTz BxByBz - //[px,py,pz] = [s1,t1] * [Tx,Ty,Tz] - // qx,qy,qz s2,t2 Bx,By,Bz - - // multiplying both sides by the inverse of the s,t matrix gives - //[Tx,Ty,Tz] = 1/(s1t2-s2t1) * [t2,-t1] * [px,py,pz] - // Bx,By,Bz -s2,s1 qx,qy,qz - - // solve this for the unormalized T and B to get from tangent to object space - - float tmp = 0.0f; - if (_abs(s1 * t2 - s2 * t1) <= 0.0001f) - { - tmp = (s1 * t2 - s2 * t1) > 0.f ? 1.0f : -1.f; - } - else - { - tmp = 1.0f / (s1 * t2 - s2 * t1); - } - - tangent.x = (t2 * P.x - t1 * Q.x); - tangent.y = (t2 * P.y - t1 * Q.y); - tangent.z = (t2 * P.z - t1 * Q.z); - - tangent = tmp * tangent; - - binormal.x = (s1 * Q.x - s2 * P.x); - binormal.y = (s1 * Q.y - s2 * P.y); - binormal.z = (s1 * Q.z - s2 * P.z); - - binormal = tmp * binormal; - - // after these vectors are smoothed together, - // they must be again orthogonalized with the final normals - // see OrthogonalizeTangentsAndBinormals -} - -void MeshMender::UpdateTheIndicesWithFinalIndices(xr_vector& theIndices) -{ - // theIndices is assumed to be filled with a copy of the in Indices. - - assert(((theIndices.size() / 3) == m_Triangles.size()) && "invalid number of tris, or indices."); - // Note that we do not change the number or the order of indices at all, - // so we just need to copy the triangles indices to the output. - size_t oIndex = 0; - - for (size_t i = 0; i < m_Triangles.size(); ++i) - { - theIndices[oIndex + 0] = (u32)m_Triangles[i].indices[0]; - theIndices[oIndex + 1] = (u32)m_Triangles[i].indices[1]; - theIndices[oIndex + 2] = (u32)m_Triangles[i].indices[2]; - oIndex += 3; - } -} - -void MeshMender::FixCylindricalWrapping( - xr_vector& theVerts, xr_vector& theIndices, xr_vector& mappingNewToOldVert) -{ - // when using cylindrical texture coordinate generation, - // you can end up with triangles that have coordinates like - // <0,0.9> -------------> <0,0> - // and - // <0,0.9> -------------> <0,0.1> - // this will cause the texture to be mapped from 0.9 back to 0.0 or 0.1 when - // what you really want it to do is - // wrap arround to 1.0, then start from 0.0 again. - // to fix this, we can duplicate a vertex and add 1.0 to the wrapped texture coordinate - // we need to do this for both the S and the T directions. - - size_t index; - for (index = 0; index < theIndices.size(); index += 3) - { - // for each triangle - xr_set alreadyDuped; - - for (unsigned int begin = 0; begin < 3; ++begin) - { - unsigned int end = begin + 1; - if (begin == 2) - end = 0; - // for each begin -> end edge - - float sBegin = theVerts[theIndices[index + begin]].s; - float sEnd = theVerts[theIndices[index + end]].s; - - if (sBegin <= 1.0f && sEnd <= 1.0f && sBegin >= 0.0f && sEnd >= 0.0f) - { - // we only handle coordinates between 0 and 1 for the cylindrical wrappign fix - if (_abs(sBegin - sEnd) > 0.5f) - { - unsigned int theOneToDupe = begin; - // we have some wrapping going on. - if (sBegin > sEnd) - theOneToDupe = end; - - if (alreadyDuped.find(theOneToDupe) == alreadyDuped.end()) - { - size_t oldIndex = theIndices[index + theOneToDupe]; - Vertex theDupe = theVerts[oldIndex]; - alreadyDuped.insert(theOneToDupe); - theDupe.s += 1.0f; - theIndices[index + theOneToDupe] = theVerts.size(); - theVerts.push_back(theDupe); - AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert); - } - else - { - theVerts[theIndices[index + theOneToDupe]].s += 1.0f; - } - } - } - - float tBegin = theVerts[theIndices[index + begin]].t; - float tEnd = theVerts[theIndices[index + end]].t; - - if (tBegin <= 1.0f && tEnd <= 1.0f && tBegin >= 0.0f && tEnd >= 0.0f) - { - // we only handle coordinates between 0 and 1 for the cylindrical wrappign fix - if (_abs(tBegin - tEnd) > 0.5f) - { - unsigned int theOneToDupe = begin; - // we have some wrapping going on. - if (tBegin > tEnd) - theOneToDupe = end; - - if (alreadyDuped.find(theOneToDupe) == alreadyDuped.end()) - { - size_t oldIndex = theIndices[index + theOneToDupe]; - Vertex theDupe = theVerts[oldIndex]; - alreadyDuped.insert(theOneToDupe); - theDupe.t += 1.0f; - theIndices[index + theOneToDupe] = theVerts.size(); - theVerts.push_back(theDupe); - AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert); - } - else - { - theVerts[theIndices[index + theOneToDupe]].t += 1.0f; - } - } - } - } - } -} - -void MeshMender::AppendToMapping( - const size_t oldIndex, const size_t originalNumVerts, xr_vector& mappingNewToOldVert) -{ - if (oldIndex >= originalNumVerts) - { - // then this is a newer vertex we are mapping to another vertex we created in meshmender. - // we need to find the original old vertex index to map to. - // so we can just use the mapping - - // that is to say, just keep the same mapping for this new one. - unsigned int originalVertIndex = mappingNewToOldVert[oldIndex]; - assert(originalVertIndex < originalNumVerts); - - mappingNewToOldVert.push_back(originalVertIndex); - } - else - { - // this is mapping to an original vertex - mappingNewToOldVert.push_back(oldIndex); - } -} diff --git a/src/Common/NvMender2003/NVMeshMender.h b/src/Common/NvMender2003/NVMeshMender.h deleted file mode 100644 index 90af5babd1e..00000000000 --- a/src/Common/NvMender2003/NVMeshMender.h +++ /dev/null @@ -1,321 +0,0 @@ -/*********************************************************************NVMH4**** -Path: -File: - -Copyright NVIDIA Corporation 2003 -TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED -*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS -BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES -WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, -BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) -ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - -Comments: - send questions or comments to sdietrich@nvidia.com, cbrewer@nvidia.com - - MeshMender's main purpose is to generate a tangent space basis for - per pixel lighting. Given a set of vertices and normal map texture coordinates, - MeshMender will return a set of normals, binormals, and tangents taking into - account texture mirroring. - - Meshmender also lets you choose a minimum angle between neighboring - triangles vectors to determine whether or not they can smooth together. - If they can't smooth together, then MeshMender automagically mends the mesh - so that each unsmoothable neighbor has it's own set of vectors in a unique vertex. - - - -How to use MeshMender: - assumes that you have an array of vertices in myVerts and an array - of indices in myIndices. - the verts should be of the format - float x, float y, float z, - float s, - float t - ------------------------- - - - std::vector theVerts; - std::vector theIndices; - std::vector mappingNewToOld; - - //fill up the vectors with your mesh's data - for (DWORD i = 0; i < numVerts; ++i) - { - MeshMender::Vertex v; - v.pos = myVerts[i].pos; - v.s = myVerts[i].s; - v.t = myVerts[i].t; - //meshmender will computer normals, tangents, and binormals, no need to fill those in. - //however, if you do not have meshmender compute the normals, you _must_ pass in valid - //normals to meshmender - theVerts.push_back(v); - } - - for(DWORD ind = 0; ind - -class MeshMender -{ -public: - class Vertex - { - public: - D3DXVECTOR3 pos; - D3DXVECTOR3 normal; - float s; - float t; - D3DXVECTOR3 tangent; - D3DXVECTOR3 binormal; - enum - { - FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE3(1) | - D3DFVF_TEXCOORDSIZE3(2) - }; - Vertex() : - pos(0.0f, 0.0f, 0.0f), normal(0.0f, 0.0f, 0.0f), s(0.0f), t(0.0f), - tangent(0.0f, 0.0f, 0.0f), binormal(0.0f, 0.0f, 0.0f) - {} - }; - - enum NormalCalcOption - { - DONT_CALCULATE_NORMALS, - CALCULATE_NORMALS - }; - enum ExistingSplitOption - { - DONT_RESPECT_SPLITS, - RESPECT_SPLITS - }; - enum CylindricalFixOption - { - DONT_FIX_CYLINDRICAL, - FIX_CYLINDRICAL - }; - - // Mend - given a mesh, output the new data complete with smoothed - // normals, binormals, and tangents - // - // RETURNS true on success, false on failure - // - // theVerts - should be initialized with your mesh data, NOTE that when - // mesh mender is done with it, the number of vertices may grow - // and it will be filled with normals, tangents and binormals - // - // theIndices - should be initialized with your mesh indices - // will contain the new indices..we are not adding triangles, - // so the number of indices passed back should be the same as the - // number of indices passed in, but they may point to new vertices now. - // - // mappingNewToOldVert - this should be passed in as an empty vector. after mending - // it will contain a mapping of newvertexindex -> oldvertexindex - // so it could be used to map any per vertex data you had in your original - // mesh to the new mesh like so: - // - // for each new vertex index - // newVert[index]->myData = oldVert[ mappingNewToOldVert[index]]->myData; - // - // where myData is some custom vertex data in your original mesh. - // - // minNormalsCreaseCosAngle - the minimum cosine of the angle between normals - // so that they are allowed to be smoothed together - // ranges between -1.0 and +1.0 - // this is ignored if computeNormals is set to DONT_CALCULATE_NORMALS - // - // - // minTangentsCreaseCosAngle - the minimum cosine of the angle between tangents - // so that they are allowed to be smoothed together - // ranges between -1.0 and +1.0 - // - // minBinormalsCreaseCosAngle - the minimum cosine of the angle between binormals - // so that they are allowed to be smoothed together - // ranges between -1.0 and +1.0 - // - // weightNormalsByArea - an ammount to blend the normalized face normal, and the - // unnormalized face normal together. Thus weighting the - // normal by the face area by a given ammount - // ranges between 0.0 and +1.0 - // 0.0 means use the normalized face normals (not weighted by area) - // 1.0 means use the unnormalized face normal(weighted by area) - // this is ignored if computeNormals is set to DONT_CALCULATE_NORMALS - // - // computeNormals - should mesh mender calculate normals? If this is set to DONT_CALCULATE_NORMALS - // then the vertex normals after mesh mender is called will be the - // same ones you pass in. If you are automatically calculating normals yourself, - // you may find that meshmender provides greater control over how normals are smoothed - // together. I've been able to get better results using the Crease angle with - // meshmender's smoothing groups - // - // respectExistingSplits - DONT_RESPECT_SPLITS means that neighboring triangles for smoothing will be determined - // based on position and not on indices. - // RESPECT_SPLITS means that neighboring triangles will be determined based on the indices of - //the - // triangle and not the positions of the vertices. - // you can usually get better smoothing by not respecting existing splits - // only respect them if you know they should be respected. - // - // fixCylindricalWrapping - DONT_FIX_CYLINDRICAL means take the texture coordinates as they come - // FIX_CYLINDRICAL means we might need to split the verts - // at that point and generate the proper texture coordinate. - // for instance, if we have tex coords 0.9 -> 0.0-> 0.2 we would need to add - // a new vert so that we have 0.9 -> 1.0 0.0-> 0.2 - // this is only supported for texture coordinates in the range [ 0.0f , 1.0f ] - // NOTE: don't leave this on for all meshes, only use it when you know - // you need it. If you have polygons that map to a large area in texture space - // this option could mess up the texture coordinates - bool Mend(xr_vector& theVerts, xr_vector& theIndices, - xr_vector& mappingNewToOldVert, const float minNormalsCreaseCosAngle = 0.0f, - const float minTangentsCreaseCosAngle = 0.0f, const float minBinormalsCreaseCosAngle = 0.0f, - const float weightNormalsByArea = 1.0f, const NormalCalcOption computeNormals = CALCULATE_NORMALS, - const ExistingSplitOption respectExistingSplits = DONT_RESPECT_SPLITS, - const CylindricalFixOption fixCylindricalWrapping = DONT_FIX_CYLINDRICAL); - - MeshMender(); - - ~MeshMender(); - -protected: - float MinNormalsCreaseCosAngle; - float MinTangentsCreaseCosAngle; - float MinBinormalsCreaseCosAngle; - float WeightNormalsByArea; - ExistingSplitOption m_RespectExistingSplits; - - class CanSmoothChecker; - friend class CanSmoothChecker; - friend class CanSmoothNormalsChecker; - friend class CanSmoothTangentsChecker; - friend class CanSmoothBinormalsChecker; - - // sets up any internal data structures needed - void SetUpData(xr_vector& theVerts, const xr_vector& theIndices, - xr_vector& mappingNewToOldVert, const NormalCalcOption computeNormals); - - typedef size_t NeighborhoodID; - typedef size_t TriID; - typedef xr_vector TriangleList; - - struct Triangle - { - size_t indices[3]; - - // per face values - D3DXVECTOR3 normal; - D3DXVECTOR3 tangent; - D3DXVECTOR3 binormal; - - // helper flags - bool handled; - NeighborhoodID group; - void Reset(); - - TriID myID; // a global id used to keep track of tris' - }; - - xr_vector m_Triangles; - - // each vertex has a set of triangles that contain it. - // those triangles are considered to be that vertex's children - typedef xr_map VertexChildrenMap; - VertexChildrenMap m_VertexChildrenMap; - - // a neighbor group is defined to be the list of traingles - // that all fall arround a single vertex, and can smooth with - // eachother - typedef xr_vector NeighborGroupList; - - size_t m_originalNumVerts; - - // sets up the normal, binormal, and tangent for a triangle - // assumes the triangle indices are set to match whats in the verts - void SetUpFaceVectors(Triangle& t, const xr_vector& verts, const NormalCalcOption computeNormals); - - // function responsible for growing the neighbor hood groups - // arround a vertex - void BuildGroups(Triangle* tri, // the tri of interest - TriangleList& possibleNeighbors, // all tris arround a vertex - NeighborGroupList& neighborGroups, // the neighbor groups to be updated - xr_vector& theVerts, CanSmoothChecker* smoothChecker, const float& minCreaseAngle); - - // given 2 triangles, fill the two neighbor pointers with either - // null or valid Triangle pointers. - void FindNeighbors(Triangle* tri, TriangleList& possibleNeighbors, Triangle** neighbor1, Triangle** neighbor2, - xr_vector& theVerts); - - bool SharesEdge(Triangle* triA, Triangle* triB, xr_vector& theVerts); - - bool SharesEdgeRespectSplits(Triangle* triA, Triangle* triB, xr_vector& theVerts); - - // calculates the tangent and binormal per face - void GetGradients(const MeshMender::Vertex& v0, const MeshMender::Vertex& v1, const MeshMender::Vertex& v2, - D3DXVECTOR3& tangent, D3DXVECTOR3& binormal) const; - - void OrthogonalizeTangentsAndBinormals(xr_vector& theVerts); - - void UpdateTheIndicesWithFinalIndices(xr_vector& theIndices); - - void FixCylindricalWrapping( - xr_vector& theVerts, xr_vector& theIndices, xr_vector& mappingNewToOldVert); - - bool TriHasEdge(const D3DXVECTOR3& p0, const D3DXVECTOR3& p1, const D3DXVECTOR3& triA, const D3DXVECTOR3& triB, - const D3DXVECTOR3& triC); - - bool TriHasEdge(const size_t& p0, const size_t& p1, const size_t& triA, const size_t& triB, const size_t& triC); - - void ProcessNormals(TriangleList& possibleNeighbors, xr_vector& theVerts, - xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition); - - void ProcessTangents(TriangleList& possibleNeighbors, xr_vector& theVerts, - xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition); - - void ProcessBinormals(TriangleList& possibleNeighbors, xr_vector& theVerts, - xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition); - - // make any triangle that used the oldIndex use the newIndex instead - void UpdateIndices(const size_t oldIndex, const size_t newIndex, TriangleList& curGroup); - - // adds a new mapping entry, - // takes into account that we may be mapping a new vertex to another new vertex, - // and uses the original old vertex index....is that confusing? - void AppendToMapping( - const size_t oldIndex, const size_t originalNumVerts, xr_vector& mappingNewToOldVert); -}; - -#endif diff --git a/src/Common/NvMender2003/ReadMe.txt b/src/Common/NvMender2003/ReadMe.txt deleted file mode 100644 index 3eab99358e9..00000000000 --- a/src/Common/NvMender2003/ReadMe.txt +++ /dev/null @@ -1,16 +0,0 @@ -======================================================================== - STATIC LIBRARY : nv_meshmender -======================================================================== - -revision history - -2-05-2004 - - added the mapping from new to old vertices - -1-26-2004 - - grouped parameters to Mend() differently - - added default values to Mend() parameters - - renamed MeshMender::MenderVertex to MeshMender::Vertex since the extra mender was redundant - - added some more comments in the options section with advice on usage - - turned bool parameters into enums so that they aren't easily mixed up. - diff --git a/src/Common/NvMender2003/convert.h b/src/Common/NvMender2003/convert.h deleted file mode 100644 index 618de30127a..00000000000 --- a/src/Common/NvMender2003/convert.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _CONVERT_H_ -#define _CONVERT_H_ -IC D3DXVECTOR3& cv_vector(D3DXVECTOR3& l, const Fvector& r) -{ - l.x = r.x; - l.y = r.y; - l.z = r.z; - return l; -} - -IC Fvector& cv_vector(Fvector& l, const D3DXVECTOR3& r) -{ - l.x = r.x; - l.y = r.y; - l.z = r.z; - return l; -} - -#endif diff --git a/src/Common/NvMender2003/mender_input_output.h b/src/Common/NvMender2003/mender_input_output.h deleted file mode 100644 index 5b201e5f3fa..00000000000 --- a/src/Common/NvMender2003/mender_input_output.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _MENDER_INPUT_OUTPUT_H_ -#define _MENDER_INPUT_OUTPUT_H_ - -#include "convert.h" - -template -IC void add_face(xr_vector& theIndices, const type_face& iF) -{ - theIndices.push_back(face_vertex(iF, 0)); - theIndices.push_back(face_vertex(iF, 1)); - theIndices.push_back(face_vertex(iF, 2)); -} - -template -IC void set_face(type_face& iF, unsigned int v0, unsigned int v1, unsigned int v2) -{ - face_vertex(iF, 0) = v0; - face_vertex(iF, 1) = v1; - face_vertex(iF, 2) = v2; -} - -template -static void fill_mender_input(const xr_vector& vertices, const xr_vector& faces, - xr_vector& theVerts, xr_vector& theIndices) -{ - theVerts.clear(); - theIndices.clear(); - // fill inputs (verts) - const u32 vertices_number = vertices.size(); - theVerts.resize(vertices_number); - for (u32 i = 0; i < vertices_number; ++i) - set_vertex(theVerts[i], vertices[i]); - // fill inputs (indices) - for (auto face_it = faces.cbegin(); face_it!=faces.cend(); ++face_it) - add_face(theIndices, *face_it); -} - -template -static void retrive_data_from_mender_otput(xr_vector& vertices, // in-out - xr_vector& faces, const xr_vector& theVerts, - const xr_vector& theIndices, const xr_vector& mappingNewToOldVert) -{ - xr_vector old_vertices; - { - old_vertices.clear(); - // save old vertices to retrive through mappingNewToOldVert data that missing in MeshMender::Vertex - old_vertices = vertices; - // retrieving data - const u32 face_count = faces.size(); - for (u32 i = 0; i < face_count; ++i) - set_face(faces[i], theIndices[3*i + 0], theIndices[3*i + 1], theIndices[3*i + 2]); - } - { - const u32 vertex_count = theVerts.size(); - vertices.clear(); - vertices.resize(vertex_count); - for (u32 i = 0; i < vertex_count; i++) - set_vertex(vertices[i], old_vertices[mappingNewToOldVert[i]], theVerts[i]); - } -} - -#endif diff --git a/src/Common/NvMender2003/remove_isolated_verts.h b/src/Common/NvMender2003/remove_isolated_verts.h deleted file mode 100644 index 701b7f895cd..00000000000 --- a/src/Common/NvMender2003/remove_isolated_verts.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _REMOVE_ISOLATED_VERTS_H_ -#define _REMOVE_ISOLATED_VERTS_H_ - -template -static void add_face(const type_face& F, xr_vector& new_vertices, xr_vector& new_faces, - const xr_vector& vertices, xr_vector& remap) -{ - type_face new_face; - for (u32 v = 0; v<3; v++) - { - u32 old_id = face_vertex(F, v); - u32 new_id = remap[old_id]; - // Register new if not found - if (new_id == u32(-1)) - { - new_vertices.push_back(vertices[old_id]); - new_id = new_vertices.size() - 1; - remap[old_id] = new_id; - } - face_vertex(new_face, v) = new_id; - } - new_faces.push_back(new_face); -} - -template -static void t_remove_isolated_verts(xr_vector& new_vertices, xr_vector& new_faces, - const xr_vector& vertices, const xr_vector& faces) -{ - new_vertices.clear(); - new_faces.clear(); - xr_vector remap; - remap.resize(vertices.size(), u32(-1)); - for (u32 f = 0; f -void t_remove_isolated_verts(xr_vector& vertices, xr_vector& faces) -{ - xr_vector old_vertices; - xr_vector old_faces; - old_vertices.clear(); - old_faces.clear(); - - old_vertices = vertices; - old_faces = faces; - - t_remove_isolated_verts(vertices, faces, old_vertices, old_faces); - - old_vertices.clear(); - old_faces.clear(); -} - -#endif diff --git a/src/utils/mp_balancer/entry_point.cpp b/src/utils/mp_balancer/entry_point.cpp deleted file mode 100644 index 8a4578f0aa5..00000000000 --- a/src/utils/mp_balancer/entry_point.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "pch.h" -#include "wpn_collection.hpp" -#include "statistics_collector.hpp" - -void main(int argc, char* argv[]) -{ - xrDebug::Initialize(false); - Core.Initialize("mp_balancer", nullptr, true, "fsgame.ltx"); - - SetConsoleOutputCP(1251); - - weapon_collection wpn_collection; - - wpn_collection.load_all_mp_weapons(); - - if (argc == 2) - { - if (!strcmp(argv[1], "export_configs")) - { - wpn_collection.extract_all_params(); - wpn_collection.save_new_configs(); - } - else if (!strcmp(argv[1], "made_csv")) - { - statistics_collector stat_collector(&wpn_collection); - stat_collector.load_settings(); - stat_collector.save_files(); - } - } - - Core._destroy(); -} diff --git a/src/utils/mp_balancer/iostreams_proxy.cpp b/src/utils/mp_balancer/iostreams_proxy.cpp deleted file mode 100644 index 309c83c69e1..00000000000 --- a/src/utils/mp_balancer/iostreams_proxy.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "pch.h" -#include "iostreams_proxy.h" - -#ifdef _STLP_NO_IOSTREAMS - -namespace std -{ -console_output cout; -console_output cerr; -console_output clog; -char const* endl = "\n"; -} - -#endif //#ifdef _STLP_NO_IOSTREAMS diff --git a/src/utils/mp_balancer/iostreams_proxy.h b/src/utils/mp_balancer/iostreams_proxy.h deleted file mode 100644 index 513fbb5a1df..00000000000 --- a/src/utils/mp_balancer/iostreams_proxy.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef IOSTREAMS_PROXY_INCLUDED -#define IOSTREAMS_PROXY_INCLUDED - -#include -#include - -#ifndef _STLP_NO_IOSTREAMS -#include -#else //#ifdef _STLP_NO_IOSTREAMS - -namespace std -{ -class console_output -{ -public: - console_output(){}; - ~console_output(){}; - - console_output& operator<<(char const* str) - { - printf(str); - return *this; - } -}; // class console_output - -extern console_output cout; -extern console_output cerr; -extern console_output clog; -extern char const* endl; - -}; // namespace std - -#endif //#ifndef _STLP_NO_IOSTREAMS - -#endif //#ifndef IOSTREAMS_PROXY_INCLUDED diff --git a/src/utils/mp_balancer/mp_balancer.vcxproj b/src/utils/mp_balancer/mp_balancer.vcxproj deleted file mode 100644 index 5e8c97fa9ed..00000000000 --- a/src/utils/mp_balancer/mp_balancer.vcxproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - mp_ballancer - {93EA76CE-7B49-420D-BD4A-C9798B82CD59} - mp_balancer - Win32Proj - - - - Application - $(xrPlatformToolset) - MultiByte - true - - - Application - $(xrPlatformToolset) - MultiByte - - - - - - - - - - - - - pch.h - - - Console - - - - - pch.h - - - Console - - - - - - - Create - Create - - - - - - - - - - - - - - - - {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} - - - {c964d17a-05a8-4bfa-b0a8-7af5c6b627ec} - - - - - - \ No newline at end of file diff --git a/src/utils/mp_balancer/mp_balancer.vcxproj.filters b/src/utils/mp_balancer/mp_balancer.vcxproj.filters deleted file mode 100644 index 1f3c210a582..00000000000 --- a/src/utils/mp_balancer/mp_balancer.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - {fd2378e1-b71d-4204-a752-cae314fdb9fc} - - - - - core - - - core - - - core - - - - - - - - core - - - core - - - core - - - - - - \ No newline at end of file diff --git a/src/utils/mp_balancer/pch.cpp b/src/utils/mp_balancer/pch.cpp deleted file mode 100644 index 1d9f38c57d6..00000000000 --- a/src/utils/mp_balancer/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/src/utils/mp_balancer/pch.h b/src/utils/mp_balancer/pch.h deleted file mode 100644 index 900d1326a06..00000000000 --- a/src/utils/mp_balancer/pch.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef PCH_H_INCLUDED -#define PCH_H_INCLUDED - -#include "Common/Platform.hpp" -#include "Common/Common.hpp" -#include "Common/object_broker.h" -#include "xrCore/xrCore.h" -#include "xrCore/Containers/AssociativeVector.hpp" - -#include "xr_ini_ex.h" - -#include -#include - -#endif // #define PCH_H_INCLUDED diff --git a/src/utils/mp_balancer/statistics_collector.cpp b/src/utils/mp_balancer/statistics_collector.cpp deleted file mode 100644 index 797a702f3b4..00000000000 --- a/src/utils/mp_balancer/statistics_collector.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include "pch.h" -#include "statistics_collector.hpp" -#include "wpn_collection.hpp" -#include "tools.hpp" - -statistics_collector::statistics_collector(weapon_collection* wpn_collection) { m_wpn_collection = wpn_collection; } -statistics_collector::~statistics_collector() { delete_data(m_all_params); } -#define CSV_SETTINGS "csv_settings" -void statistics_collector::load_settings() -{ - u32 file_count = m_wpn_collection->settings->line_count(CSV_SETTINGS); - for (u32 i = 0; i != file_count; ++i) - { - LPCSTR key = NULL; - LPCSTR value = NULL; - if (m_wpn_collection->settings->r_line(CSV_SETTINGS, i, &key, &value) && key) - { - csv_files::iterator new_file_iter = - m_all_params.emplace(shared_str(key), new params_collection()).first; - if (value) - { - get_string_collection(value, *new_file_iter->second); - } - } - } -} - -void statistics_collector::save_files() -{ - //std::for_each(m_all_params.begin(), m_all_params.end(), - // std::bind1st(std::mem_fun(&statistics_collector::save_file), this)); - for (auto &it : m_all_params) - save_file(it); -} - -statistics_collector::csv_files::const_iterator statistics_collector::get_most_acceptable_group( - shared_str const& section) -{ - u32 max_size = 0; - csv_files::const_iterator ret_iter = m_all_params.end(); - for (csv_files::const_iterator i = m_all_params.begin(), ie = m_all_params.end(); i != ie; ++i) - { - if (strncmp(i->first.c_str(), section.c_str(), i->first.size())) - continue; - - if (ret_iter == ie) - { - ret_iter = i; - max_size = i->first.size(); - } - else if (max_size < i->first.size()) - { - ret_iter = i; - max_size = i->first.size(); - } - } - return ret_iter; -} - -void statistics_collector::save_file(csv_files::value_type const& val) -{ - // LPCSTR new_file_name; - // STRCONCAT(new_file_name, val.first.c_str(), ".csv"); - string_path new_file_name; - strconcat(sizeof(new_file_name), new_file_name, val.first.c_str(), ".csv"); - - char temp_string[1024]; - xr_string dest_string; - dest_string.reserve(4096); - - dest_string.append("\"section_name\","); - for (params_collection::const_iterator i = val.second->begin(), ie = val.second->end(); i != ie; ++i) - { - sprintf_s(temp_string, "\"%s\",", i->c_str()); - dest_string.append(temp_string); - } - dest_string.erase(dest_string.end() - 1); - dest_string.append("\r\n"); - - for (xr_vector::const_iterator i = m_wpn_collection->all_weapons.begin(), - ie = m_wpn_collection->all_weapons.end(); - i != ie; ++i) - { - csv_files::const_iterator temp_cit = get_most_acceptable_group(*i); - if (temp_cit == m_all_params.end()) - continue; - if (temp_cit->first != val.first) - continue; - - sprintf_s(temp_string, "\"%s\",", i->c_str()); - dest_string.append(temp_string); - for (params_collection::const_iterator param_i = val.second->begin(), param_ie = val.second->end(); - param_i != param_ie; ++param_i) - { - LPCSTR val = m_wpn_collection->priquel_config->r_string(i->c_str(), param_i->c_str()); - if (!val) - val = ""; - sprintf_s(temp_string, "\"%s\",", val); - dest_string.append(temp_string); - } - dest_string.erase(dest_string.end() - 1); - dest_string.append("\r\n"); - } - - IWriter* new_file = FS.w_open(new_file_name); - R_ASSERT(new_file); - new_file->w_string(dest_string.c_str()); - FS.w_close(new_file); -} diff --git a/src/utils/mp_balancer/statistics_collector.hpp b/src/utils/mp_balancer/statistics_collector.hpp deleted file mode 100644 index 1f8586d1226..00000000000 --- a/src/utils/mp_balancer/statistics_collector.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef STATISTICS_COLLECTOR -#define STATISTICS_COLLECTOR - -class weapon_collection; - -class statistics_collector -{ -private: - weapon_collection* m_wpn_collection; - typedef xr_vector params_collection; - typedef AssociativeVector csv_files; - csv_files m_all_params; - void save_file(csv_files::value_type const& val); - csv_files::const_iterator get_most_acceptable_group(shared_str const& section); - -public: - explicit statistics_collector(weapon_collection* wpn_collection); - ~statistics_collector(); - void save_files(); - void load_settings(); -}; - -#endif //#ifndef STATISTICS_COLLECTOR diff --git a/src/utils/mp_balancer/tools.hpp b/src/utils/mp_balancer/tools.hpp deleted file mode 100644 index 00306487ee4..00000000000 --- a/src/utils/mp_balancer/tools.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef TOOLS_HPP -#define TOOLS_HPP - -inline u32 get_string_collection(shared_str const& src, xr_vector& dest_collection) -{ - u32 cnt = _GetItemCount(src.c_str()); - string1024 _one; - - for (u32 c = 0; c < cnt; ++c) - { - _GetItem(src.c_str(), c, _one); - dest_collection.push_back(_one); - } - return cnt; -} - -inline void get_string_from_collection(xr_vector const& src_collection, xr_string& dest_string) -{ - xr_vector::const_iterator ie = src_collection.end(); - for (xr_vector::const_iterator i = src_collection.begin(); i != ie; ++i) - { - dest_string.append(i->c_str()); - if ((i + 1) != ie) - dest_string.append(","); - } -} - -#endif //#ifndef TOOLS_HPP diff --git a/src/utils/mp_balancer/wpn_collection.cpp b/src/utils/mp_balancer/wpn_collection.cpp deleted file mode 100644 index f068ca4c050..00000000000 --- a/src/utils/mp_balancer/wpn_collection.cpp +++ /dev/null @@ -1,361 +0,0 @@ -#include "pch.h" -#include "wpn_collection.hpp" - -weapon_collection::weapon_collection() {} -weapon_collection::~weapon_collection() -{ - if (priquel_config) - xr_delete(priquel_config); - if (patch_config) - xr_delete(patch_config); - - if (settings) - { - xr_delete(settings); - } - - delete_data(extract_list); -} - -void weapon_collection::load_all_mp_weapons() -{ - string_path path_ltx; - - FS.update_path(path_ltx, "$patch_config$", "system.ltx"); - patch_config = new CInifileEx(path_ltx, TRUE, TRUE, FALSE); - - FS.update_path(path_ltx, "$game_config$", "system.ltx"); - priquel_config = new CInifileEx(path_ltx, TRUE, TRUE, FALSE); - - /*FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\weapons_mp_for_work.ltx"); - work_mp_weapons = xr_new(path_ltx, TRUE, TRUE, FALSE); - - FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\ammo_mp_for_work.ltx"); - work_mp_ammo = xr_new(path_ltx, TRUE, TRUE, FALSE); - - FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\items_mp_for_work.ltx"); - work_mp_items = xr_new(path_ltx, TRUE, TRUE, FALSE); - - FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\outfit_mp_for_work.ltx"); - work_mp_outfits = xr_new(path_ltx, TRUE, TRUE, FALSE);*/ - - FS.update_path(path_ltx, "$app_data_root$", "export_settings.ltx"); - settings = new CInifileEx(path_ltx, TRUE, TRUE, FALSE); - load_settings(); - - /*new_mp_weapons = xr_new("new_weapons_mp.ltx", FALSE, FALSE, FALSE); - new_mp_ammo = xr_new("new_ammo_mp.ltx", FALSE, FALSE, FALSE); - new_mp_items = xr_new("new_items_mp.ltx", FALSE, FALSE, FALSE); - new_mp_outfits = xr_new("new_outfit_mp.ltx", FALSE, FALSE, FALSE);*/ - - CInifileEx::Sect& dm_base_cost = priquel_config->r_section("deathmatch_base_cost"); - CInifileEx::SectIt_ ie = dm_base_cost.Data.end(); - std::cout << "Found next weapons and ammo:" << std::endl; - for (CInifileEx::SectIt_ i = dm_base_cost.Data.begin(); i != ie; ++i) - { - std::cout << i->first.c_str() << std::endl; - all_weapons.push_back(i->first); - } -} - -struct SymbolCountComparator : public std::binary_function -{ - bool operator()( - weapon_collection::tentity_extract_keys const* left, weapon_collection::tentity_extract_keys const* right) const - { - return (left->first.size() >= right->first.size()); - }; -}; - -void read_arguments_to_set(xr_set& dest, char const* source_string) -{ - xr_string tmp; - - for (int k = 0, cnt = _GetItemCount(source_string); k < cnt; ++k) - { - _GetItem(source_string, k, tmp); - dest.insert(tmp.c_str()); - } -} - -#define EXPORT_SETTINGS_SECT "export_settings" -void weapon_collection::load_settings() -{ - u32 params_count = settings->line_count(EXPORT_SETTINGS_SECT); - extract_list.reserve(params_count); - for (u32 param = 0; param < params_count; ++param) - { - const char* line = NULL; - const char* larg = NULL; - settings->r_line(EXPORT_SETTINGS_SECT, param, &line, &larg); - R_ASSERT(line); - extract_list.push_back(new tentity_extract_keys()); - extract_list.back()->first = line; - new_config.insert(std::make_pair(shared_str(line), xr_vector())); - if (larg) - { - read_arguments_to_set(extract_list.back()->second, larg); - } - } - std::sort(extract_list.begin(), extract_list.end(), SymbolCountComparator()); -} - -weapon_collection::textract_list::const_iterator weapon_collection::get_extract_keys(char const* section_name) -{ - for (weapon_collection::textract_list::const_iterator i = extract_list.begin(), ie = extract_list.end(); i != ie; - ++i) - { - if (!strncmp((*i)->first.c_str(), section_name, (*i)->first.size())) - return i; - } - - return extract_list.end(); -} - -// save all items using existing structure.. -void weapon_collection::extract_all_params() -{ - std::cout << "----------------- started to save values -----------------" << std::endl; - xr_set no_extract_params; - xr_vector::const_iterator ie = all_weapons.end(); - for (xr_vector::const_iterator i = all_weapons.begin(); i != ie; ++i) - { - textract_list::const_iterator extr_iter = get_extract_keys(i->c_str()); - if (extr_iter == extract_list.end()) - { - std::cerr << "Not found extract list for section: " << i->c_str() << std::endl; - continue; - } - std::cout << "\r\n\r\nProcessing section: " << i->c_str() << std::endl; - - CInifileEx::Sect new_sect; - CInifileEx::Sect& temp_sect = priquel_config->r_section(*i); - build_section(new_sect, temp_sect, (*extr_iter)->second); - - new_config[(*extr_iter)->first].push_back(new_sect); - - /*u32 params_count = priquel_config->line_count(*i); - for (u32 param = 0; param < params_count; ++param) - { - const char * line = NULL; - const char * larg = NULL; - const char * patch_arg = NULL; - const char * base_line = NULL; - priquel_config->r_line(i->c_str(), param, &line, &larg); - R_ASSERT(line); - if (!larg) larg = ""; - std::cout << "Key: " << line << ", value: " << larg << std::endl; - write_store->remove_line(i->c_str(), line); - if (mp_base->line_exist(base_section, line)) - { - std::cout << "This key present in base section ...\r\n"; - continue; - } - patch_arg = try_extract_from_patch(i->c_str(), line); - if (patch_arg) - { - if (strcmp(larg, patch_arg)) - { - std::cout << "Patch value is not equal: " << patch_arg << std::endl; - if (remember_yes_keys.find(shared_str(line)) != remember_yes_keys.end()) - { - larg = patch_arg; - std::cout << "Processing YES action...\r\n"; - } else if (remember_no_keys.find(shared_str(line)) != remember_no_keys.end()) - { - std::cout << "Processing NO action...\r\n"; - } else - { - std::cout << "Do you want to save patch value ? (y - single yes, Y - multiple yes, n - single - no, N - multiple no):"; - int ch = _getch(); - if (ch == 'y') - { - larg = patch_arg; - } else if (ch == 'Y') - { - remember_yes_keys.insert(shared_str(line)); - larg = patch_arg; - } else if (ch == 'N') - { - remember_no_keys.insert(shared_str(line)); - } - } - } - } - std::cout << "Saving key: " << line << ", value: " << larg << std::endl << std::endl; - write_store->w_string(temp_section, line, larg); - }*/ - } -} - -char const* weapon_collection::try_extract_from_patch(char const* sect, char const* line) -{ - R_ASSERT(sect && line); - if (patch_config->line_exist(sect, line)) - { - return patch_config->r_string(sect, line); - } - return NULL; -} - -void weapon_collection::copy_params_ex( - CInifileEx::Sect& dest, CInifileEx::Sect const& from, xr_set const& copy_keys) -{ - std::cout << "Processing section: " << from.Name.c_str() << std::endl; - for (CInifileEx::SectCIt i = from.Data.begin(), ie = from.Data.end(); i != ie; ++i) - { - if (copy_keys.find(i->first) != copy_keys.end()) - { - char const* larg = try_extract_from_patch(from.Name.c_str(), i->first.c_str()); - CInifileEx::Item temp_item; - temp_item.first = i->first; - temp_item.second = priquel_config->r_string(dest.Name.c_str(), temp_item.first.c_str()); - temp_item.comment = i->comment; - if (larg) - { - if (temp_item.second != larg) - { - //-------------------------------- - std::cout << "Key: " << temp_item.first.c_str() << "\r\n"; - if (temp_item.comment.c_str()) - { - std::cout << "Comment: " << temp_item.comment.c_str() << std::endl; - } - - std::cout << "Values not EQUAL:\r\n" - << "Priquel value is: " << temp_item.second.c_str() << ", patch value is: " << larg - << std::endl; - if (remember_yes_keys.find(shared_str(temp_item.first)) != remember_yes_keys.end()) - { - temp_item.second = larg; - std::cout << "Processing YES action...\r\n"; - } - else if (remember_no_keys.find(shared_str(temp_item.first)) != remember_no_keys.end()) - { - std::cout << "Processing NO action...\r\n"; - } - else - { - std::cout << "Do you want to save patch value ? (y - single yes, Y - multiple yes, n - single " - "no, N - multiple no):"; - int ch = _getch(); - if (ch == 'y') - { - temp_item.second = larg; - } - else if (ch == 'Y') - { - remember_yes_keys.insert(shared_str(temp_item.first)); - temp_item.second = larg; - } - else if (ch == 'N') - { - remember_no_keys.insert(shared_str(temp_item.first)); - } - std::cout << std::endl; - } - //-------------------------------- - } - } - dest.Data.push_back(temp_item); - } - } -} - -void weapon_collection::build_section( - CInifileEx::Sect& dest, CInifileEx::Sect const& orig, xr_set const& extract_from_base_keys) -{ - dest.Name = orig.Name; - dest.base_sections = orig.base_sections; - - for (xr_vector::const_iterator bi = orig.base_sections.begin(), bie = orig.base_sections.end(); - bi != bie; ++bi) - { - R_ASSERT2(priquel_config->section_exist(bi->c_str()), "base section not exist"); - CInifileEx::Sect& base_sect = priquel_config->r_section(bi->c_str()); - copy_params_ex(dest, base_sect, extract_from_base_keys); - } - - for (CInifileEx::SectCIt i = orig.Data.begin(), ie = orig.Data.end(); i != ie; ++i) - { - bool found_key = false; - - for (xr_vector::const_iterator bi = orig.base_sections.begin(), bie = orig.base_sections.end(); - bi != bie; ++bi) - { - if (priquel_config->line_exist(bi->c_str(), i->first.c_str())) - { - // char const * larg = config->r_string(bi->c_str(), i->first.c_str()); - // if (i->second == larg) - //{ - found_key = true; - break; - //} - } - } - if (!found_key) - { - dest.Data.push_back(*i); - } - } -} - -void weapon_collection::save_config_to_file(tnew_config_map::const_iterator cfg_iter) -{ - xr_set comments_set; - IWriter* new_file = FS.w_open(cfg_iter->first.c_str()); - tnew_config_map::mapped_type const& sect_collection = cfg_iter->second; - xr_string temp_string; - temp_string.reserve(1024 * 5); - char temp_buffer[2096]; - for (tnew_config_map::mapped_type::const_iterator i = sect_collection.begin(), ie = sect_collection.end(); i != ie; - ++i) - { - temp_string.clear(); - sprintf_s(temp_buffer, "[%s]", i->Name.c_str()); - - temp_string.append(temp_buffer); - if (i->base_sections.size()) - { - temp_string.append(":"); - for (xr_vector::const_iterator bi = i->base_sections.begin(), bie = i->base_sections.end(); - bi != bie; ++bi) - { - temp_string.append(bi->c_str()); - if ((bi + 1) != bie) - temp_string.append(", "); - } - } - temp_string.append("\r\n"); - - for (CInifileEx::SectCIt si = i->Data.begin(), sie = i->Data.end(); si != sie; ++si) - { - sprintf_s( - temp_buffer, "%4s%-32s = %-8s", " ", si->first.c_str(), si->second.c_str() ? si->second.c_str() : ""); - if (si->comment.c_str()) - { - if (comments_set.find(si->first) == comments_set.end()) - { - strcat_s(temp_buffer, ";"); - strcat_s(temp_buffer, si->comment.c_str()); - comments_set.insert(si->first); - } - } - strcat_s(temp_buffer, "\r\n"); - temp_string.append(temp_buffer); - } - temp_string.append("\r\n"); - new_file->w_string(temp_string.c_str()); - } - FS.w_close(new_file); -} - -void weapon_collection::save_new_configs() -{ - for (tnew_config_map::const_iterator i = new_config.begin(), ie = new_config.end(); i != ie; ++i) - { - save_config_to_file(i); - } -} diff --git a/src/utils/mp_balancer/wpn_collection.hpp b/src/utils/mp_balancer/wpn_collection.hpp deleted file mode 100644 index fb65ff4d159..00000000000 --- a/src/utils/mp_balancer/wpn_collection.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "pch.h" - -#ifndef WEAPON_COLLECTION -#define WEAPON_COLLECTION - -class weapon_collection -{ - friend class statistics_collector; - -protected: - CInifileEx* priquel_config; - CInifileEx* patch_config; - - /*CInifileEx* work_mp_weapons; - CInifileEx* work_mp_ammo; - CInifileEx* work_mp_items; - CInifileEx* work_mp_outfits;*/ - - CInifileEx* settings; - - xr_vector all_weapons; - xr_set remember_yes_keys; - xr_set remember_no_keys; - -public: - typedef std::pair> tentity_extract_keys; - typedef std::map> tnew_config_map; - typedef std::vector textract_list; - - void load_all_mp_weapons(); - void load_settings(); - - textract_list::const_iterator get_extract_keys(char const* section_name); - - void extract_all_params(); - - char const* try_extract_from_patch(char const* sect, char const* key); - void copy_params_ex(CInifileEx::Sect& dest, CInifileEx::Sect const& from, xr_set const& copy_keys); - void build_section(CInifileEx::Sect& dest, CInifileEx::Sect const& orig, xr_set const& extract); - - void save_config_to_file(tnew_config_map::const_iterator cfg_iter); - void save_new_configs(); - - weapon_collection(); - ~weapon_collection(); - -private: - textract_list extract_list; - tnew_config_map new_config; -}; // class weapon_collection - -#endif //#ifndef WEAPON_COLLECTION diff --git a/src/utils/mp_balancer/xr_ini_ex.cpp b/src/utils/mp_balancer/xr_ini_ex.cpp deleted file mode 100644 index 329b5d9feab..00000000000 --- a/src/utils/mp_balancer/xr_ini_ex.cpp +++ /dev/null @@ -1,838 +0,0 @@ -#include "pch.h" -#pragma hdrstop - -#include "xr_ini_ex.h" -#include "../../xrCore/fs_internal.h" - -CInifileEx* pSettingsEx = NULL; - -CInifileEx* CInifileEx::Create(const char* szFileName, BOOL ReadOnly) -{ - return new CInifileEx(szFileName, ReadOnly); -} - -void CInifileEx::Destroy(CInifileEx* ini) { xr_delete(ini); } -bool sect_pred(const CInifileEx::Sect* x, LPCSTR val) { return xr_strcmp(*x->Name, val) < 0; }; -bool item_pred(const CInifileEx::Item& x, LPCSTR val) -{ - if ((!x.first) || (!val)) - return x.first < val; - else - return xr_strcmp(*x.first, val) < 0; -} - -//------------------------------------------------------------------------------ -//Тело функций Inifile -//------------------------------------------------------------------------------ -BOOL _parse(pstr dest, LPCSTR src) -{ - BOOL bInsideSTR = false; - if (src) - { - while (*src) - { - if (isspace((u8)*src)) - { - if (bInsideSTR) - { - *dest++ = *src++; - continue; - } - while (*src && isspace(*src)) - { - ++src; - } - continue; - } - else if (*src == '"') - { - bInsideSTR = !bInsideSTR; - } - *dest++ = *src++; - } - } - *dest = 0; - return bInsideSTR; -} - -void _decorate(pstr dest, LPCSTR src) -{ - if (src) - { - BOOL bInsideSTR = false; - while (*src) - { - if (*src == ',') - { - if (bInsideSTR) - { - *dest++ = *src++; - } - else - { - *dest++ = *src++; - *dest++ = ' '; - } - continue; - } - else if (*src == '"') - { - bInsideSTR = !bInsideSTR; - } - *dest++ = *src++; - } - } - *dest = 0; -} -//------------------------------------------------------------------------------ - -BOOL CInifileEx::Sect::line_exist(LPCSTR L, LPCSTR* val) -{ - SectCIt A = std::lower_bound(Data.begin(), Data.end(), L, item_pred); - if (A != Data.end() && xr_strcmp(*A->first, L) == 0) - { - if (val) - *val = *A->second; - return TRUE; - } - return FALSE; -} -//------------------------------------------------------------------------------ - -CInifileEx::CInifileEx(IReader* F, LPCSTR path) -{ - m_file_name[0] = 0; - m_flags.zero(); - m_flags.set(eSaveAtEnd, FALSE); - m_flags.set(eReadOnly, TRUE); - m_flags.set(eOverrideNames, FALSE); - Load(F, path); -} - -CInifileEx::CInifileEx(LPCSTR szFileName, BOOL ReadOnly, BOOL bLoad, BOOL SaveAtEnd) -{ - m_file_name[0] = 0; - m_flags.zero(); - if (szFileName) - strcpy_s(m_file_name, szFileName); - - m_flags.set(eSaveAtEnd, SaveAtEnd); - m_flags.set(eReadOnly, ReadOnly); - - if (bLoad) - { - string_path path, folder; - _splitpath(m_file_name, path, folder, 0, 0); - strcat(path, folder); - IReader* R = FS.r_open(szFileName); - if (R) - { - Load(R, path); - FS.r_close(R); - } - } -} - -CInifileEx::~CInifileEx() -{ - if (!m_flags.test(eReadOnly) && m_flags.test(eSaveAtEnd)) - { - if (!save_as()) - Log("!Can't save inifile:", m_file_name); - } - - RootIt I = DATA.begin(); - RootIt E = DATA.end(); - for (; I != E; ++I) - xr_delete(*I); -} - -static void insert_item(CInifileEx::Sect* tgt, const CInifileEx::Item& I) -{ - CInifileEx::SectIt_ sect_it = std::lower_bound(tgt->Data.begin(), tgt->Data.end(), *I.first, item_pred); - if (sect_it != tgt->Data.end() && sect_it->first.equal(I.first)) - { - sect_it->second = I.second; -#ifdef DEBUG - sect_it->comment = I.comment; -#endif - } - else - { - tgt->Data.insert(sect_it, I); - } -} - -IC BOOL is_empty_line_now(IReader* F) -{ - char* a0 = (char*)F->pointer() - 4; - char* a1 = (char*)(F->pointer()) - 3; - char* a2 = (char*)F->pointer() - 2; - char* a3 = (char*)(F->pointer()) - 1; - - return (*a0 == 13) && (*a1 == 10) && (*a2 == 13) && (*a3 == 10); -}; - -void CInifileEx::Load(IReader* F, LPCSTR path) -{ - R_ASSERT(F); - Sect* Current = 0; - string4096 str; - string4096 str2; - - BOOL bInsideSTR = FALSE; - - while (!F->eof()) - { - F->r_string(str, sizeof(str)); - _Trim(str); - pstr comm = strchr(str, ';'); - pstr comm_1 = strchr(str, '/'); - - if (comm_1 && (*(comm_1 + 1) == '/') && ((!comm) || (comm && (comm_1 < comm)))) - { - comm = comm_1; - } - -#ifdef DEBUG - pstr comment = 0; -#endif - if (comm) - { - //."bla-bla-bla;nah-nah-nah" - char quot = '"'; - bool in_quot = false; - - LPCSTR q1 = strchr(str, quot); - if (q1 && q1 < comm) - { - LPCSTR q2 = strchr(++q1, quot); - if (q2 && q2 > comm) - in_quot = true; - } - - if (!in_quot) - { - *comm = 0; -#ifdef DEBUG - comment = comm + 1; -#endif - } - } - - if (str[0] && (str[0] == '#') && strstr(str, "#include")) // handle includes - { - string_path inc_name; - R_ASSERT(path && path[0]); - if (_GetItem(str, 1, inc_name, '"')) - { - string_path fn, inc_path, folder; - strconcat(sizeof(fn), fn, path, inc_name); - _splitpath(fn, inc_path, folder, 0, 0); - strcat(inc_path, folder); - IReader* I = FS.r_open(fn); - R_ASSERT3(I, "Can't find include file:", inc_name); - Load(I, inc_path); - FS.r_close(I); - } - } - else if (str[0] && (str[0] == '[')) // new section ? - { - // insert previous filled section - if (Current) - { - // store previous section - RootIt I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred); - if ((I != DATA.end()) && ((*I)->Name == Current->Name)) - FATAL(make_string("Duplicate section '%s' found.", *Current->Name.c_str()).c_str()); - DATA.insert(I, Current); - } - Current = new Sect(); - Current->Name = 0; - // start new section - R_ASSERT3(strchr(str, ']'), "Bad ini section found: ", str); - LPCSTR inherited_names = strstr(str, "]:"); - if (0 != inherited_names) - { - VERIFY2(m_flags.test(eReadOnly), "Allow for readonly mode only."); - inherited_names += 2; - int cnt = _GetItemCount(inherited_names); - - for (int k = 0; k < cnt; ++k) - { - xr_string tmp; - _GetItem(inherited_names, k, tmp); -#ifdef DEBUG - Current->base_sections.push_back(tmp.c_str()); -#endif - Sect& inherited_section = r_section(tmp.c_str()); - for (SectIt_ it = inherited_section.Data.begin(); it != inherited_section.Data.end(); it++) - insert_item(Current, *it); - } - } - *strchr(str, ']') = 0; - Current->Name = strlwr(str + 1); - } - else // name = value - { - if (Current) - { - string4096 value_raw; - char* name = str; - char* t = strchr(name, '='); - if (t) - { - *t = 0; - _Trim(name); - ++t; - strcpy_s(value_raw, sizeof(value_raw), t); - bInsideSTR = _parse(str2, value_raw); - if (bInsideSTR) // multiline str value - { - while (bInsideSTR) - { - strcat_s(value_raw, sizeof(value_raw), "\r\n"); - string4096 str_add_raw; - F->r_string(str_add_raw, sizeof(str_add_raw)); - R_ASSERT2(xr_strlen(value_raw) + xr_strlen(str_add_raw) < sizeof(value_raw), - make_string("Incorrect inifile format: section[%s], variable[%s]. Odd number of quotes " - "(\") found, but " - "should be even.", - Current->Name.c_str(), name)); - strcat_s(value_raw, sizeof(value_raw), str_add_raw); - bInsideSTR = _parse(str2, value_raw); - if (bInsideSTR) - { - if (is_empty_line_now(F)) - strcat_s(value_raw, sizeof(value_raw), "\r\n"); - } - } - } - } - else - { - _Trim(name); - str2[0] = 0; - } - - Item I; - I.first = (name[0] ? name : NULL); - I.second = (str2[0] ? str2 : NULL); -#ifdef DEBUG - I.comment = m_flags.test(eReadOnly) ? comment : 0; //:comment; -#endif - - if (m_flags.test(eReadOnly)) - { - if (*I.first) - insert_item(Current, I); - } - else - { - if (*I.first || *I.second -#ifdef DEBUG - || *I.comment -#endif - ) - insert_item(Current, I); - } - } - } - } - if (Current) - { - RootIt I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred); - if ((I != DATA.end()) && ((*I)->Name == Current->Name)) - FATAL(make_string("Duplicate section '%s' found.", *Current->Name.c_str()).c_str()); - DATA.insert(I, Current); - } -} - -void CInifileEx::save_as(IWriter& writer) -{ - string4096 temp, val; - for (RootIt r_it = DATA.begin(); r_it != DATA.end(); ++r_it) - { - sprintf_s(temp, sizeof(temp), "[%s]", *(*r_it)->Name); - writer.w_string(temp); - for (SectCIt s_it = (*r_it)->Data.begin(); s_it != (*r_it)->Data.end(); ++s_it) - { - const Item& I = *s_it; - if (*I.first) - { - if (*I.second) - { - _decorate(val, *I.second); -#ifdef DEBUG - if (*I.comment) - { - // name, value and comment - sprintf_s(temp, sizeof(temp), "%8s%-32s = %-32s ;%s", " ", *I.first, val, *I.comment); - } - else -#endif - { - // only name and value - sprintf_s(temp, sizeof(temp), "%8s%-32s = %-32s", " ", *I.first, val); - } - } - else - { -#ifdef DEBUG - if (*I.comment) - { - // name and comment - sprintf_s(temp, sizeof(temp), "%8s%-32s = ;%s", " ", *I.first, *I.comment); - } - else -#endif - { - // only name - sprintf_s(temp, sizeof(temp), "%8s%-32s = ", " ", *I.first); - } - } - } - else - { -// no name, so no value -#ifdef DEBUG - if (*I.comment) - sprintf_s(temp, sizeof(temp), "%8s;%s", " ", *I.comment); - else -#endif - temp[0] = 0; - } - _TrimRight(temp); - if (temp[0]) - writer.w_string(temp); - } - writer.w_string(" "); - } -} - -bool CInifileEx::save_as(LPCSTR new_fname) -{ - // save if needed - if (new_fname && new_fname[0]) - strcpy_s(m_file_name, new_fname); - - R_ASSERT(m_file_name && m_file_name[0]); - IWriter* F = FS.w_open_ex(m_file_name); - if (!F) - return (false); - - save_as(*F); - FS.w_close(F); - return (true); -} - -BOOL CInifileEx::section_exist(LPCSTR S) -{ - RootIt I = std::lower_bound(DATA.begin(), DATA.end(), S, sect_pred); - return (I != DATA.end() && xr_strcmp(*(*I)->Name, S) == 0); -} - -BOOL CInifileEx::line_exist(LPCSTR S, LPCSTR L) -{ - if (!section_exist(S)) - return FALSE; - Sect& I = r_section(S); - SectCIt A = std::lower_bound(I.Data.begin(), I.Data.end(), L, item_pred); - return (A != I.Data.end() && xr_strcmp(*A->first, L) == 0); -} - -u32 CInifileEx::line_count(LPCSTR Sname) -{ - Sect& S = r_section(Sname); - SectCIt I = S.Data.begin(); - u32 C = 0; - for (; I != S.Data.end(); I++) - if (*I->first) - C++; - return C; -} - -//-------------------------------------------------------------------------------------- -CInifileEx::Sect& CInifileEx::r_section(const shared_str& S) { return r_section(*S); } -BOOL CInifileEx::line_exist(const shared_str& S, const shared_str& L) { return line_exist(*S, *L); } -u32 CInifileEx::line_count(const shared_str& S) { return line_count(*S); } -BOOL CInifileEx::section_exist(const shared_str& S) { return section_exist(*S); } -//-------------------------------------------------------------------------------------- -// Read functions -//-------------------------------------------------------------------------------------- -CInifileEx::Sect& CInifileEx::r_section(LPCSTR S) -{ - char section[256]; - strcpy_s(section, sizeof(section), S); - strlwr(section); - RootIt I = std::lower_bound(DATA.begin(), DATA.end(), section, sect_pred); - if (!(I != DATA.end() && xr_strcmp(*(*I)->Name, section) == 0)) - FATAL(make_string("Can't open section '%s'", S).c_str()); - return **I; -} - -LPCSTR CInifileEx::r_string(LPCSTR S, LPCSTR L) -{ - Sect& I = r_section(S); - SectCIt A = std::lower_bound(I.Data.begin(), I.Data.end(), L, item_pred); - if (A != I.Data.end() && xr_strcmp(*A->first, L) == 0) - return *A->second; - else - FATAL(make_string("Can't find variable %s in [%s]", L, S).c_str()); - return 0; -} - -shared_str CInifileEx::r_string_wb(LPCSTR S, LPCSTR L) -{ - LPCSTR _base = r_string(S, L); - - if (0 == _base) - return shared_str(0); - - string4096 _original; - strcpy_s(_original, _base); - u32 _len = xr_strlen(_original); - if (0 == _len) - return shared_str(""); - if ('"' == _original[_len - 1]) - _original[_len - 1] = 0; // skip end - if ('"' == _original[0]) - return shared_str(&_original[0] + 1); // skip begin - return shared_str(_original); -} - -u8 CInifileEx::r_u8(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return u8(atoi(C)); -} -u16 CInifileEx::r_u16(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return u16(atoi(C)); -} -u32 CInifileEx::r_u32(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return u32(atoi(C)); -} -u64 CInifileEx::r_u64(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); -#ifndef _EDITOR - return _strtoui64(C, NULL, 10); -#else - return (u64)_atoi64(C); -#endif -} - -s64 CInifileEx::r_s64(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return _atoi64(C); -} -s8 CInifileEx::r_s8(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return s8(atoi(C)); -} -s16 CInifileEx::r_s16(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return s16(atoi(C)); -} -s32 CInifileEx::r_s32(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return s32(atoi(C)); -} -float CInifileEx::r_float(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return float(atof(C)); -} -Fcolor CInifileEx::r_fcolor(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Fcolor V = {0, 0, 0, 0}; - sscanf(C, "%f,%f,%f,%f", &V.r, &V.g, &V.b, &V.a); - return V; -} -u32 CInifileEx::r_color(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - u32 r = 0, g = 0, b = 0, a = 255; - sscanf(C, "%d,%d,%d,%d", &r, &g, &b, &a); - return color_rgba(r, g, b, a); -} - -Ivector2 CInifileEx::r_ivector2(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Ivector2 V = {0, 0}; - sscanf(C, "%d,%d", &V.x, &V.y); - return V; -} -Ivector3 CInifileEx::r_ivector3(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Ivector V = {0, 0, 0}; - sscanf(C, "%d,%d,%d", &V.x, &V.y, &V.z); - return V; -} -Ivector4 CInifileEx::r_ivector4(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Ivector4 V = {0, 0, 0, 0}; - sscanf(C, "%d,%d,%d,%d", &V.x, &V.y, &V.z, &V.w); - return V; -} -Fvector2 CInifileEx::r_fvector2(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Fvector2 V = {0.f, 0.f}; - sscanf(C, "%f,%f", &V.x, &V.y); - return V; -} -Fvector3 CInifileEx::r_fvector3(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Fvector3 V = {0.f, 0.f, 0.f}; - sscanf(C, "%f,%f,%f", &V.x, &V.y, &V.z); - return V; -} -Fvector4 CInifileEx::r_fvector4(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - Fvector4 V = {0.f, 0.f, 0.f, 0.f}; - sscanf(C, "%f,%f,%f,%f", &V.x, &V.y, &V.z, &V.w); - return V; -} -BOOL CInifileEx::r_bool(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - VERIFY2(xr_strlen(C) <= 5, make_string("\"%s\" is not a valid bool value, section[%s], line[%s]", C, S, L)); - char B[8]; - strncpy(B, C, 7); - B[7] = 0; - strlwr(B); - return IsBOOL(B); -} -CLASS_ID CInifileEx::r_clsid(LPCSTR S, LPCSTR L) -{ - LPCSTR C = r_string(S, L); - return TEXT2CLSID(C); -} -int CInifileEx::r_token(LPCSTR S, LPCSTR L, const xr_token* token_list) -{ - LPCSTR C = r_string(S, L); - for (int i = 0; token_list[i].name; i++) - if (!stricmp(C, token_list[i].name)) - return token_list[i].id; - return 0; -} -BOOL CInifileEx::r_line(LPCSTR S, int L, const char** N, const char** V) -{ - Sect& SS = r_section(S); - if (L >= (int)SS.Data.size() || L < 0) - return FALSE; - for (SectCIt I = SS.Data.begin(); I != SS.Data.end(); I++) - if (!(L--)) - { - *N = *I->first; - *V = *I->second; - return TRUE; - } - return FALSE; -} -BOOL CInifileEx::r_line(const shared_str& S, int L, const char** N, const char** V) { return r_line(*S, L, N, V); } -//-------------------------------------------------------------------------------------------------------- -// Write functions -//-------------------------------------------------------------------------------------- -void CInifileEx::w_string(LPCSTR S, LPCSTR L, LPCSTR V, LPCSTR comment) -{ - R_ASSERT(!m_flags.test(eReadOnly)); - - // section - string256 sect; - _parse(sect, S); - _strlwr(sect); - - if (!section_exist(sect)) - { - // create _new_ section - Sect* NEW = new Sect(); - NEW->Name = sect; - RootIt I = std::lower_bound(DATA.begin(), DATA.end(), sect, sect_pred); - DATA.insert(I, NEW); - } - - // parse line/value - string4096 line; - _parse(line, L); - string4096 value; - _parse(value, V); - - // duplicate & insert - Item I; - Sect& data = r_section(sect); - I.first = (line[0] ? line : 0); - I.second = (value[0] ? value : 0); - -#ifdef DEBUG - I.comment = (comment ? comment : 0); -#endif - SectIt_ it = std::lower_bound(data.Data.begin(), data.Data.end(), *I.first, item_pred); - - if (it != data.Data.end()) - { - // Check for "first" matching - if (0 == xr_strcmp(*it->first, *I.first)) - { - BOOL b = m_flags.test(eOverrideNames); - R_ASSERT2(b, make_string("name[%s] already exist in section[%s]", line, sect).c_str()); - *it = I; - } - else - { - data.Data.insert(it, I); - } - } - else - { - data.Data.insert(it, I); - } -} -void CInifileEx::w_u8(LPCSTR S, LPCSTR L, u8 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d", V); - w_string(S, L, temp, comment); -} -void CInifileEx::w_u16(LPCSTR S, LPCSTR L, u16 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d", V); - w_string(S, L, temp, comment); -} -void CInifileEx::w_u32(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d", V); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_u64(LPCSTR S, LPCSTR L, u64 V, LPCSTR comment) -{ - string128 temp; -#ifndef _EDITOR - _ui64toa_s(V, temp, sizeof(temp), 10); -#else - _ui64toa(V, temp, 10); -#endif - w_string(S, L, temp, comment); -} - -void CInifileEx::w_s64(LPCSTR S, LPCSTR L, s64 V, LPCSTR comment) -{ - string128 temp; -#ifndef _EDITOR - _i64toa_s(V, temp, sizeof(temp), 10); -#else - _i64toa(V, temp, 10); -#endif - w_string(S, L, temp, comment); -} - -void CInifileEx::w_s8(LPCSTR S, LPCSTR L, s8 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d", V); - w_string(S, L, temp, comment); -} -void CInifileEx::w_s16(LPCSTR S, LPCSTR L, s16 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d", V); - w_string(S, L, temp, comment); -} -void CInifileEx::w_s32(LPCSTR S, LPCSTR L, s32 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d", V); - w_string(S, L, temp, comment); -} -void CInifileEx::w_float(LPCSTR S, LPCSTR L, float V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%f", V); - w_string(S, L, temp, comment); -} -void CInifileEx::w_fcolor(LPCSTR S, LPCSTR L, const Fcolor& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%f,%f,%f,%f", V.r, V.g, V.b, V.a); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_color(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d,%d,%d,%d", color_get_R(V), color_get_G(V), color_get_B(V), color_get_A(V)); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_ivector2(LPCSTR S, LPCSTR L, const Ivector2& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d,%d", V.x, V.y); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_ivector3(LPCSTR S, LPCSTR L, const Ivector3& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d,%d,%d", V.x, V.y, V.z); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_ivector4(LPCSTR S, LPCSTR L, const Ivector4& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%d,%d,%d,%d", V.x, V.y, V.z, V.w); - w_string(S, L, temp, comment); -} -void CInifileEx::w_fvector2(LPCSTR S, LPCSTR L, const Fvector2& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%f,%f", V.x, V.y); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_fvector3(LPCSTR S, LPCSTR L, const Fvector3& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%f,%f,%f", V.x, V.y, V.z); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_fvector4(LPCSTR S, LPCSTR L, const Fvector4& V, LPCSTR comment) -{ - string128 temp; - sprintf_s(temp, sizeof(temp), "%f,%f,%f,%f", V.x, V.y, V.z, V.w); - w_string(S, L, temp, comment); -} - -void CInifileEx::w_bool(LPCSTR S, LPCSTR L, BOOL V, LPCSTR comment) { w_string(S, L, V ? "on" : "off", comment); } -void CInifileEx::remove_line(LPCSTR S, LPCSTR L) -{ - R_ASSERT(!m_flags.test(eReadOnly)); - - if (line_exist(S, L)) - { - Sect& data = r_section(S); - SectIt_ A = std::lower_bound(data.Data.begin(), data.Data.end(), L, item_pred); - R_ASSERT(A != data.Data.end() && xr_strcmp(*A->first, L) == 0); - data.Data.erase(A); - } -} diff --git a/src/utils/mp_balancer/xr_ini_ex.h b/src/utils/mp_balancer/xr_ini_ex.h deleted file mode 100644 index 2e5219deef4..00000000000 --- a/src/utils/mp_balancer/xr_ini_ex.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef xr_iniexH -#define xr_iniexH - -// refs -struct xr_token; - -class CInifileEx -{ -public: - struct Item - { - shared_str first; - shared_str second; -#ifdef DEBUG - shared_str comment; -#endif - Item() - : first(0), second(0) -#ifdef DEBUG - , - comment(0) -#endif - {}; - }; - typedef xr_vector Items; - typedef Items::const_iterator SectCIt; - typedef Items::iterator SectIt_; - struct Sect - { - shared_str Name; - Items Data; -#ifdef DEBUG - xr_vector base_sections; -#endif - BOOL line_exist(LPCSTR L, LPCSTR* val = 0); - }; - typedef xr_vector Root; - typedef Root::iterator RootIt; - - static CInifileEx* Create(LPCSTR szFileName, BOOL ReadOnly = TRUE); - static void Destroy(CInifileEx*); - static IC BOOL IsBOOL(LPCSTR B) - { - return ( - xr_strcmp(B, "on") == 0 || xr_strcmp(B, "yes") == 0 || xr_strcmp(B, "true") == 0 || xr_strcmp(B, "1") == 0); - } - -private: - enum - { - eSaveAtEnd = (1 << 0), - eReadOnly = (1 << 1), - eOverrideNames = (1 << 2), - }; - Flags8 m_flags; - string_path m_file_name; - Root DATA; - - void Load(IReader* F, LPCSTR path); - -public: - CInifileEx(IReader* F, LPCSTR path = 0); - CInifileEx(LPCSTR szFileName, BOOL ReadOnly = TRUE, BOOL bLoadAtStart = TRUE, BOOL SaveAtEnd = TRUE); - virtual ~CInifileEx(); - bool save_as(LPCSTR new_fname = 0); - void save_as(IWriter& writer); - void set_override_names(BOOL b) { m_flags.set(eOverrideNames, b); } - void save_at_end(BOOL b) { m_flags.set(eSaveAtEnd, b); } - LPCSTR fname() { return m_file_name; }; - Sect& r_section(LPCSTR S); - Sect& r_section(const shared_str& S); - BOOL line_exist(LPCSTR S, LPCSTR L); - BOOL line_exist(const shared_str& S, const shared_str& L); - u32 line_count(LPCSTR S); - u32 line_count(const shared_str& S); - BOOL section_exist(LPCSTR S); - BOOL section_exist(const shared_str& S); - Root& sections() { return DATA; } - CLASS_ID r_clsid(LPCSTR S, LPCSTR L); - CLASS_ID r_clsid(const shared_str& S, LPCSTR L) { return r_clsid(*S, L); } - LPCSTR r_string(LPCSTR S, LPCSTR L); // оÑтавлÑет кавычки - LPCSTR r_string(const shared_str& S, LPCSTR L) { return r_string(*S, L); } // оÑтавлÑет кавычки - shared_str r_string_wb(LPCSTR S, LPCSTR L); // убирает кавычки - shared_str r_string_wb(const shared_str& S, LPCSTR L) { return r_string_wb(*S, L); } // убирает кавычки - u8 r_u8(LPCSTR S, LPCSTR L); - u8 r_u8(const shared_str& S, LPCSTR L) { return r_u8(*S, L); } - u16 r_u16(LPCSTR S, LPCSTR L); - u16 r_u16(const shared_str& S, LPCSTR L) { return r_u16(*S, L); } - u32 r_u32(LPCSTR S, LPCSTR L); - u32 r_u32(const shared_str& S, LPCSTR L) { return r_u32(*S, L); } - u64 r_u64(LPCSTR S, LPCSTR L); - s8 r_s8(LPCSTR S, LPCSTR L); - s8 r_s8(const shared_str& S, LPCSTR L) { return r_s8(*S, L); } - s16 r_s16(LPCSTR S, LPCSTR L); - s16 r_s16(const shared_str& S, LPCSTR L) { return r_s16(*S, L); } - s32 r_s32(LPCSTR S, LPCSTR L); - s32 r_s32(const shared_str& S, LPCSTR L) { return r_s32(*S, L); } - s64 r_s64(LPCSTR S, LPCSTR L); - float r_float(LPCSTR S, LPCSTR L); - float r_float(const shared_str& S, LPCSTR L) { return r_float(*S, L); } - Fcolor r_fcolor(LPCSTR S, LPCSTR L); - Fcolor r_fcolor(const shared_str& S, LPCSTR L) { return r_fcolor(*S, L); } - u32 r_color(LPCSTR S, LPCSTR L); - u32 r_color(const shared_str& S, LPCSTR L) { return r_color(*S, L); } - Ivector2 r_ivector2(LPCSTR S, LPCSTR L); - Ivector2 r_ivector2(const shared_str& S, LPCSTR L) { return r_ivector2(*S, L); } - Ivector3 r_ivector3(LPCSTR S, LPCSTR L); - Ivector3 r_ivector3(const shared_str& S, LPCSTR L) { return r_ivector3(*S, L); } - Ivector4 r_ivector4(LPCSTR S, LPCSTR L); - Ivector4 r_ivector4(const shared_str& S, LPCSTR L) { return r_ivector4(*S, L); } - Fvector2 r_fvector2(LPCSTR S, LPCSTR L); - Fvector2 r_fvector2(const shared_str& S, LPCSTR L) { return r_fvector2(*S, L); } - Fvector3 r_fvector3(LPCSTR S, LPCSTR L); - Fvector3 r_fvector3(const shared_str& S, LPCSTR L) { return r_fvector3(*S, L); } - Fvector4 r_fvector4(LPCSTR S, LPCSTR L); - Fvector4 r_fvector4(const shared_str& S, LPCSTR L) { return r_fvector4(*S, L); } - BOOL r_bool(LPCSTR S, LPCSTR L); - BOOL r_bool(const shared_str& S, LPCSTR L) { return r_bool(*S, L); } - int r_token(LPCSTR S, LPCSTR L, const xr_token* token_list); - BOOL r_line(LPCSTR S, int L, LPCSTR* N, LPCSTR* V); - BOOL r_line(const shared_str& S, int L, LPCSTR* N, LPCSTR* V); - - void w_string(LPCSTR S, LPCSTR L, LPCSTR V, LPCSTR comment = 0); - void w_u8(LPCSTR S, LPCSTR L, u8 V, LPCSTR comment = 0); - void w_u16(LPCSTR S, LPCSTR L, u16 V, LPCSTR comment = 0); - void w_u32(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment = 0); - void w_u64(LPCSTR S, LPCSTR L, u64 V, LPCSTR comment = 0); - void w_s64(LPCSTR S, LPCSTR L, s64 V, LPCSTR comment = 0); - void w_s8(LPCSTR S, LPCSTR L, s8 V, LPCSTR comment = 0); - void w_s16(LPCSTR S, LPCSTR L, s16 V, LPCSTR comment = 0); - void w_s32(LPCSTR S, LPCSTR L, s32 V, LPCSTR comment = 0); - void w_float(LPCSTR S, LPCSTR L, float V, LPCSTR comment = 0); - void w_fcolor(LPCSTR S, LPCSTR L, const Fcolor& V, LPCSTR comment = 0); - void w_color(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment = 0); - void w_ivector2(LPCSTR S, LPCSTR L, const Ivector2& V, LPCSTR comment = 0); - void w_ivector3(LPCSTR S, LPCSTR L, const Ivector3& V, LPCSTR comment = 0); - void w_ivector4(LPCSTR S, LPCSTR L, const Ivector4& V, LPCSTR comment = 0); - void w_fvector2(LPCSTR S, LPCSTR L, const Fvector2& V, LPCSTR comment = 0); - void w_fvector3(LPCSTR S, LPCSTR L, const Fvector3& V, LPCSTR comment = 0); - void w_fvector4(LPCSTR S, LPCSTR L, const Fvector4& V, LPCSTR comment = 0); - void w_bool(LPCSTR S, LPCSTR L, BOOL V, LPCSTR comment = 0); - - void remove_line(LPCSTR S, LPCSTR L); -}; - -// Main configuration file -extern CInifileEx* pSettingsEx; - -#endif //__XR_INI_H__ diff --git a/src/utils/mp_gpprof_server/Makefile b/src/utils/mp_gpprof_server/Makefile deleted file mode 100644 index 7dc8d8d175e..00000000000 --- a/src/utils/mp_gpprof_server/Makefile +++ /dev/null @@ -1,148 +0,0 @@ -SHELL = /bin/sh -ROOT_DIR = . -BIN_DIRECTORY = $(ROOT_DIR)/bin -LIBS_DIR = $(ROOT_DIR)/libraries -FASTCGI_LIB_DIR = $(LIBS_DIR)/fcgi-2.4.0 -GAMESPY_LIB_DIR = $(LIBS_DIR)/gamespy -TARGET_NAME = $(BIN_DIRECTORY)/mp_gpprof_server - -INSTALL_DIR = /usr/share/mp_gpprof_server -INITD_SCRIPT = mpgpprof -INITD_DIR = /etc/init.d - -CC = gcc -CPP = g++ - -BASE_CFLAGS=-D_LINUX -DGSI_NO_THREADS - -CFLAGS=$(BASE_CFLAGS) -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -falign-loops=2 \ - -falign-jumps=2 -falign-functions=2 -lpthread -CPPFLAGS=$(BASE_CFLAGS) -march=i486 -lpthread - -DEBUG_CFLAGS =$(BASE_CFLAGS) -g -lpthread -DGSI_COMMON_DEBUG -D_DEBUG -DEBUG_CPPFLAGS =$(BASE_CFLAGS) -g -lpthread -DGSI_COMMON_DEBUG -D_DEBUG - - -#use these to specify debug and release configurations -CURR_CFLAGS = $(CFLAGS) -CURR_CPPFLAGS = $(CPPFLAGS) - -FASTCGI_OBJS =\ - $(BIN_DIRECTORY)/libfcgi/fcgiapp.o\ - $(BIN_DIRECTORY)/libfcgi/os_unix.o\ - $(BIN_DIRECTORY)/libfcgi/fcgi_stdio.o\ - $(BIN_DIRECTORY)/libfcgi/fcgio.o - -MP_GPPROF_OBJS = \ - $(BIN_DIRECTORY)/entry_point.o\ - $(BIN_DIRECTORY)/gamespy_sake.o\ - $(BIN_DIRECTORY)/profile_data_types.o\ - $(BIN_DIRECTORY)/profile_request.o\ - $(BIN_DIRECTORY)/profiles_cache.o\ - $(BIN_DIRECTORY)/requests_processor.o\ - $(BIN_DIRECTORY)/sake_worker.o\ - $(BIN_DIRECTORY)/threads.o\ - $(BIN_DIRECTORY)/atlas_stalkercoppc_v1.o - -GAMESPY_OBJS =\ - $(BIN_DIRECTORY)/gamespy/md5c.o\ - $(BIN_DIRECTORY)/gamespy/darray.o\ - $(BIN_DIRECTORY)/gamespy/hashtable.o\ - $(BIN_DIRECTORY)/gamespy/common/linux/LinuxCommon.o\ - $(BIN_DIRECTORY)/gamespy/common/gsAssert.o\ - $(BIN_DIRECTORY)/gamespy/common/gsAvailable.o\ - $(BIN_DIRECTORY)/gamespy/common/gsDebug.o\ - $(BIN_DIRECTORY)/gamespy/common/gsCore.o\ - $(BIN_DIRECTORY)/gamespy/common/gsCrypt.o\ - $(BIN_DIRECTORY)/gamespy/common/gsLargeInt.o\ - $(BIN_DIRECTORY)/gamespy/common/gsStringUtil.o\ - $(BIN_DIRECTORY)/gamespy/common/gsPlatform.o\ - $(BIN_DIRECTORY)/gamespy/common/gsPlatformSocket.o\ - $(BIN_DIRECTORY)/gamespy/common/gsPlatformThread.o\ - $(BIN_DIRECTORY)/gamespy/common/gsPlatformUtil.o\ - $(BIN_DIRECTORY)/gamespy/common/gsMemory.o\ - $(BIN_DIRECTORY)/gamespy/common/gsXML.o\ - $(BIN_DIRECTORY)/gamespy/common/gsSHA1.o\ - $(BIN_DIRECTORY)/gamespy/common/gsRC4.o\ - $(BIN_DIRECTORY)/gamespy/common/gsSSL.o\ - $(BIN_DIRECTORY)/gamespy/common/gsSoap.o\ - $(BIN_DIRECTORY)/gamespy/common/gsUdpEngine.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpBuffer.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpCallbacks.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpConnection.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpEncryption.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpMain.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpProcess.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpCommon.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpPost.o\ - $(BIN_DIRECTORY)/gamespy/ghttp/ghttpc/ghttpc.o\ - $(BIN_DIRECTORY)/gamespy/GP/gp.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpi.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiBuddy.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiBuffer.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiCallback.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiConnect.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiInfo.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiKeys.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiOperation.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiPeer.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiProfile.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiSearch.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiUnique.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiUtility.o\ - $(BIN_DIRECTORY)/gamespy/GP/gpiTransfer.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Auth.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Buffer.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Callback.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Connection.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Encode.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Filter.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Main.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Message.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Socket.o\ - $(BIN_DIRECTORY)/gamespy/gt2/gt2Utility.o\ - $(BIN_DIRECTORY)/gamespy/sake/sakeMain.o\ - $(BIN_DIRECTORY)/gamespy/sake/sakeRequest.o\ - $(BIN_DIRECTORY)/gamespy/sake/sakeRequestMisc.o\ - $(BIN_DIRECTORY)/gamespy/sake/sakeRequestModify.o\ - $(BIN_DIRECTORY)/gamespy/sake/sakeRequestRead.o - - - -$(TARGET_NAME): $(GAMESPY_OBJS) $(FASTCGI_OBJS) $(MP_GPPROF_OBJS) - $(CPP) $(CURR_CPPFLAGS) $(GAMESPY_OBJS) $(FASTCGI_OBJS) $(MP_GPPROF_OBJS) -o $@ - -$(BIN_DIRECTORY)/%.o: %.c - $(CC) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@ - -$(BIN_DIRECTORY)/%.o: %.cpp - $(CPP) $(CURR_CPPFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@ - -$(BIN_DIRECTORY)/gamespy/%.o: $(GAMESPY_LIB_DIR)/%.c - $(CC) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@ - -$(BIN_DIRECTORY)/libfcgi/%.o: $(FASTCGI_LIB_DIR)/libfcgi/%.c - $(CC) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@ - -$(BIN_DIRECTORY)/libfcgi/%.o: $(FASTCGI_LIB_DIR)/libfcgi/%.cpp - $(CPP) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@ - - -clean: - find ./ -name "*.o" | xargs rm -f - rm -f $(TARGET_NAME) -all: $(TARGET_NAME) - -install: $(TARGET_NAME) - mkdir $(INSTALL_DIR) - cp $(TARGET_NAME) $(INSTALL_DIR)/mp_gpprof_server - cp $(ROOT_DIR)/$(INITD_SCRIPT) $(INITD_DIR)/$(INITD_SCRIPT) - chkconfig -a $(INITD_SCRIPT) - $(INITD_DIR)/$(INITD_SCRIPT) start - -uninstall: - $(INITD_DIR)/$(INITD_SCRIPT) stop - rm -f $(INSTALL_DIR)/mp_gpprof_server - rmdir $(INSTALL_DIR) - rm -f $(INITD_DIR)/$(INITD_SCRIPT) diff --git a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.c b/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.c deleted file mode 100644 index 31b81a1e58c..00000000000 --- a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.c +++ /dev/null @@ -1,656 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// GameSpy ATLAS Competition System Source File -// -// NOTE: This is an auto-generated file, do not edit this file directly. -/////////////////////////////////////////////////////////////////////////////// - -#include -#include "atlas_stalkercoppc_v1.h" - -int atlas_rule_set_version = 1; - -int ATLAS_GET_KEY(char* keyName) -{ - if (!keyName) - return 0; - - if (!strcmp("KEY_BestScore_KillsInRow", keyName)) - return KEY_BestScore_KillsInRow; - if (!strcmp("KEY_BestScore_KnifeKillsInRow", keyName)) - return KEY_BestScore_KnifeKillsInRow; - if (!strcmp("KEY_BestScore_BackstabsKillsInRow", keyName)) - return KEY_BestScore_BackstabsKillsInRow; - if (!strcmp("KEY_BestScore_HeadshotsKillsInRow", keyName)) - return KEY_BestScore_HeadshotsKillsInRow; - if (!strcmp("KEY_BestScore_EyeKillsInRow", keyName)) - return KEY_BestScore_EyeKillsInRow; - if (!strcmp("KEY_BestScore_BleedKillsInRow", keyName)) - return KEY_BestScore_BleedKillsInRow; - if (!strcmp("KEY_BestScore_ExplosiveKillsInRow", keyName)) - return KEY_BestScore_ExplosiveKillsInRow; - if (!strcmp("KEY_AwardMasscare", keyName)) - return KEY_AwardMasscare; - if (!strcmp("KEY_AwardMasscareLastRewardDate", keyName)) - return KEY_AwardMasscareLastRewardDate; - if (!strcmp("KEY_AwardParanoia", keyName)) - return KEY_AwardParanoia; - if (!strcmp("KEY_AwardParanoiaLastRewardDate", keyName)) - return KEY_AwardParanoiaLastRewardDate; - if (!strcmp("KEY_AwardOverwhelmingSuperiority", keyName)) - return KEY_AwardOverwhelmingSuperiority; - if (!strcmp("KEY_AwardOverwhelmingSuperiorityLastRewardDate", keyName)) - return KEY_AwardOverwhelmingSuperiorityLastRewardDate; - if (!strcmp("KEY_AwardBlitzkrieg", keyName)) - return KEY_AwardBlitzkrieg; - if (!strcmp("KEY_AwardBlitzkriegLastRewardDate", keyName)) - return KEY_AwardBlitzkriegLastRewardDate; - if (!strcmp("KEY_AwardDryVictory", keyName)) - return KEY_AwardDryVictory; - if (!strcmp("KEY_AwardDryVictoryLastRewardDate", keyName)) - return KEY_AwardDryVictoryLastRewardDate; - if (!strcmp("KEY_AwardMultichampion", keyName)) - return KEY_AwardMultichampion; - if (!strcmp("KEY_AwardMultichampionLastRewardDate", keyName)) - return KEY_AwardMultichampionLastRewardDate; - if (!strcmp("KEY_AwardMad", keyName)) - return KEY_AwardMad; - if (!strcmp("KEY_AwardMadLastRewardDate", keyName)) - return KEY_AwardMadLastRewardDate; - if (!strcmp("KEY_AwardAchillesHeel", keyName)) - return KEY_AwardAchillesHeel; - if (!strcmp("KEY_AwardAchillesHeelLastRewardDate", keyName)) - return KEY_AwardAchillesHeelLastRewardDate; - if (!strcmp("KEY_AwardFasterThanBullets", keyName)) - return KEY_AwardFasterThanBullets; - if (!strcmp("KEY_AwardFasterThanBulletsLastRewardDate", keyName)) - return KEY_AwardFasterThanBulletsLastRewardDate; - if (!strcmp("KEY_AwardHarvestTime", keyName)) - return KEY_AwardHarvestTime; - if (!strcmp("KEY_AwardHarvestTimeLastRewardDate", keyName)) - return KEY_AwardHarvestTimeLastRewardDate; - if (!strcmp("KEY_AwardSkewer", keyName)) - return KEY_AwardSkewer; - if (!strcmp("KEY_AwardSkewerLastRewardDate", keyName)) - return KEY_AwardSkewerLastRewardDate; - if (!strcmp("KEY_AwardDoubleShotDoubleKill", keyName)) - return KEY_AwardDoubleShotDoubleKill; - if (!strcmp("KEY_AwardDoubleShotDoubleKillLastRewardDate", keyName)) - return KEY_AwardDoubleShotDoubleKillLastRewardDate; - if (!strcmp("KEY_AwardClimber", keyName)) - return KEY_AwardClimber; - if (!strcmp("KEY_AwardClimberLastRewardDate", keyName)) - return KEY_AwardClimberLastRewardDate; - if (!strcmp("KEY_AwardOpener", keyName)) - return KEY_AwardOpener; - if (!strcmp("KEY_AwardOpenerLastRewardDate", keyName)) - return KEY_AwardOpenerLastRewardDate; - if (!strcmp("KEY_AwardToughy", keyName)) - return KEY_AwardToughy; - if (!strcmp("KEY_AwardToughyLastRewardDate", keyName)) - return KEY_AwardToughyLastRewardDate; - if (!strcmp("KEY_AwardInvincibleFury", keyName)) - return KEY_AwardInvincibleFury; - if (!strcmp("KEY_AwardInvincibleFuryLastRewardDate", keyName)) - return KEY_AwardInvincibleFuryLastRewardDate; - if (!strcmp("KEY_AwardOculist", keyName)) - return KEY_AwardOculist; - if (!strcmp("KEY_AwardOculistLastRewardDate", keyName)) - return KEY_AwardOculistLastRewardDate; - if (!strcmp("KEY_AwardLightingReflexes", keyName)) - return KEY_AwardLightingReflexes; - if (!strcmp("KEY_AwardLightingReflexesLastRewardDate", keyName)) - return KEY_AwardLightingReflexesLastRewardDate; - if (!strcmp("KEY_AwardSprinterStopper", keyName)) - return KEY_AwardSprinterStopper; - if (!strcmp("KEY_AwardSprinterStopperLastRewardDate", keyName)) - return KEY_AwardSprinterStopperLastRewardDate; - if (!strcmp("KEY_AwardMarksMan", keyName)) - return KEY_AwardMarksMan; - if (!strcmp("KEY_AwardMarksManLastRewardDate", keyName)) - return KEY_AwardMarksManLastRewardDate; - if (!strcmp("KEY_AwardPeaceAmbassador", keyName)) - return KEY_AwardPeaceAmbassador; - if (!strcmp("KEY_AwardPeaceAmbassadorLastRewardDate", keyName)) - return KEY_AwardPeaceAmbassadorLastRewardDate; - if (!strcmp("KEY_AwardDeadlyAccuracy", keyName)) - return KEY_AwardDeadlyAccuracy; - if (!strcmp("KEY_AwardDeadlyAccuracyLastRewardDate", keyName)) - return KEY_AwardDeadlyAccuracyLastRewardDate; - if (!strcmp("KEY_AwardRemembrance", keyName)) - return KEY_AwardRemembrance; - if (!strcmp("KEY_AwardRemembranceLastRewardDate", keyName)) - return KEY_AwardRemembranceLastRewardDate; - if (!strcmp("KEY_AwardAvenger", keyName)) - return KEY_AwardAvenger; - if (!strcmp("KEY_AwardAvengerLastRewardDate", keyName)) - return KEY_AwardAvengerLastRewardDate; - if (!strcmp("KEY_AwardCherub", keyName)) - return KEY_AwardCherub; - if (!strcmp("KEY_AwardCherubLastRewardDate", keyName)) - return KEY_AwardCherubLastRewardDate; - if (!strcmp("KEY_AwardDignity", keyName)) - return KEY_AwardDignity; - if (!strcmp("KEY_AwardDignityLastRewardDate", keyName)) - return KEY_AwardDignityLastRewardDate; - if (!strcmp("KEY_AwardStalkerFlair", keyName)) - return KEY_AwardStalkerFlair; - if (!strcmp("KEY_AwardStalkerFlairLastRewardDate", keyName)) - return KEY_AwardStalkerFlairLastRewardDate; - if (!strcmp("KEY_AwardLucky", keyName)) - return KEY_AwardLucky; - if (!strcmp("KEY_AwardLuckyLastRewardDate", keyName)) - return KEY_AwardLuckyLastRewardDate; - if (!strcmp("KEY_AwardBlackList", keyName)) - return KEY_AwardBlackList; - if (!strcmp("KEY_AwardBlackListLastRewardDate", keyName)) - return KEY_AwardBlackListLastRewardDate; - if (!strcmp("KEY_AwardSilentDeath", keyName)) - return KEY_AwardSilentDeath; - if (!strcmp("KEY_AwardSilentDeathLastRewardDate", keyName)) - return KEY_AwardSilentDeathLastRewardDate; - if (!strcmp("KEY_PlayerName", keyName)) - return KEY_PlayerName; - - return 0; -} - -char* ATLAS_GET_KEY_NAME(int keyId) -{ - if (keyId <= 0) - return ""; - - if (keyId == KEY_BestScore_KillsInRow) - return "KEY_BestScore_KillsInRow"; - if (keyId == KEY_BestScore_KnifeKillsInRow) - return "KEY_BestScore_KnifeKillsInRow"; - if (keyId == KEY_BestScore_BackstabsKillsInRow) - return "KEY_BestScore_BackstabsKillsInRow"; - if (keyId == KEY_BestScore_HeadshotsKillsInRow) - return "KEY_BestScore_HeadshotsKillsInRow"; - if (keyId == KEY_BestScore_EyeKillsInRow) - return "KEY_BestScore_EyeKillsInRow"; - if (keyId == KEY_BestScore_BleedKillsInRow) - return "KEY_BestScore_BleedKillsInRow"; - if (keyId == KEY_BestScore_ExplosiveKillsInRow) - return "KEY_BestScore_ExplosiveKillsInRow"; - if (keyId == KEY_AwardMasscare) - return "KEY_AwardMasscare"; - if (keyId == KEY_AwardMasscareLastRewardDate) - return "KEY_AwardMasscareLastRewardDate"; - if (keyId == KEY_AwardParanoia) - return "KEY_AwardParanoia"; - if (keyId == KEY_AwardParanoiaLastRewardDate) - return "KEY_AwardParanoiaLastRewardDate"; - if (keyId == KEY_AwardOverwhelmingSuperiority) - return "KEY_AwardOverwhelmingSuperiority"; - if (keyId == KEY_AwardOverwhelmingSuperiorityLastRewardDate) - return "KEY_AwardOverwhelmingSuperiorityLastRewardDate"; - if (keyId == KEY_AwardBlitzkrieg) - return "KEY_AwardBlitzkrieg"; - if (keyId == KEY_AwardBlitzkriegLastRewardDate) - return "KEY_AwardBlitzkriegLastRewardDate"; - if (keyId == KEY_AwardDryVictory) - return "KEY_AwardDryVictory"; - if (keyId == KEY_AwardDryVictoryLastRewardDate) - return "KEY_AwardDryVictoryLastRewardDate"; - if (keyId == KEY_AwardMultichampion) - return "KEY_AwardMultichampion"; - if (keyId == KEY_AwardMultichampionLastRewardDate) - return "KEY_AwardMultichampionLastRewardDate"; - if (keyId == KEY_AwardMad) - return "KEY_AwardMad"; - if (keyId == KEY_AwardMadLastRewardDate) - return "KEY_AwardMadLastRewardDate"; - if (keyId == KEY_AwardAchillesHeel) - return "KEY_AwardAchillesHeel"; - if (keyId == KEY_AwardAchillesHeelLastRewardDate) - return "KEY_AwardAchillesHeelLastRewardDate"; - if (keyId == KEY_AwardFasterThanBullets) - return "KEY_AwardFasterThanBullets"; - if (keyId == KEY_AwardFasterThanBulletsLastRewardDate) - return "KEY_AwardFasterThanBulletsLastRewardDate"; - if (keyId == KEY_AwardHarvestTime) - return "KEY_AwardHarvestTime"; - if (keyId == KEY_AwardHarvestTimeLastRewardDate) - return "KEY_AwardHarvestTimeLastRewardDate"; - if (keyId == KEY_AwardSkewer) - return "KEY_AwardSkewer"; - if (keyId == KEY_AwardSkewerLastRewardDate) - return "KEY_AwardSkewerLastRewardDate"; - if (keyId == KEY_AwardDoubleShotDoubleKill) - return "KEY_AwardDoubleShotDoubleKill"; - if (keyId == KEY_AwardDoubleShotDoubleKillLastRewardDate) - return "KEY_AwardDoubleShotDoubleKillLastRewardDate"; - if (keyId == KEY_AwardClimber) - return "KEY_AwardClimber"; - if (keyId == KEY_AwardClimberLastRewardDate) - return "KEY_AwardClimberLastRewardDate"; - if (keyId == KEY_AwardOpener) - return "KEY_AwardOpener"; - if (keyId == KEY_AwardOpenerLastRewardDate) - return "KEY_AwardOpenerLastRewardDate"; - if (keyId == KEY_AwardToughy) - return "KEY_AwardToughy"; - if (keyId == KEY_AwardToughyLastRewardDate) - return "KEY_AwardToughyLastRewardDate"; - if (keyId == KEY_AwardInvincibleFury) - return "KEY_AwardInvincibleFury"; - if (keyId == KEY_AwardInvincibleFuryLastRewardDate) - return "KEY_AwardInvincibleFuryLastRewardDate"; - if (keyId == KEY_AwardOculist) - return "KEY_AwardOculist"; - if (keyId == KEY_AwardOculistLastRewardDate) - return "KEY_AwardOculistLastRewardDate"; - if (keyId == KEY_AwardLightingReflexes) - return "KEY_AwardLightingReflexes"; - if (keyId == KEY_AwardLightingReflexesLastRewardDate) - return "KEY_AwardLightingReflexesLastRewardDate"; - if (keyId == KEY_AwardSprinterStopper) - return "KEY_AwardSprinterStopper"; - if (keyId == KEY_AwardSprinterStopperLastRewardDate) - return "KEY_AwardSprinterStopperLastRewardDate"; - if (keyId == KEY_AwardMarksMan) - return "KEY_AwardMarksMan"; - if (keyId == KEY_AwardMarksManLastRewardDate) - return "KEY_AwardMarksManLastRewardDate"; - if (keyId == KEY_AwardPeaceAmbassador) - return "KEY_AwardPeaceAmbassador"; - if (keyId == KEY_AwardPeaceAmbassadorLastRewardDate) - return "KEY_AwardPeaceAmbassadorLastRewardDate"; - if (keyId == KEY_AwardDeadlyAccuracy) - return "KEY_AwardDeadlyAccuracy"; - if (keyId == KEY_AwardDeadlyAccuracyLastRewardDate) - return "KEY_AwardDeadlyAccuracyLastRewardDate"; - if (keyId == KEY_AwardRemembrance) - return "KEY_AwardRemembrance"; - if (keyId == KEY_AwardRemembranceLastRewardDate) - return "KEY_AwardRemembranceLastRewardDate"; - if (keyId == KEY_AwardAvenger) - return "KEY_AwardAvenger"; - if (keyId == KEY_AwardAvengerLastRewardDate) - return "KEY_AwardAvengerLastRewardDate"; - if (keyId == KEY_AwardCherub) - return "KEY_AwardCherub"; - if (keyId == KEY_AwardCherubLastRewardDate) - return "KEY_AwardCherubLastRewardDate"; - if (keyId == KEY_AwardDignity) - return "KEY_AwardDignity"; - if (keyId == KEY_AwardDignityLastRewardDate) - return "KEY_AwardDignityLastRewardDate"; - if (keyId == KEY_AwardStalkerFlair) - return "KEY_AwardStalkerFlair"; - if (keyId == KEY_AwardStalkerFlairLastRewardDate) - return "KEY_AwardStalkerFlairLastRewardDate"; - if (keyId == KEY_AwardLucky) - return "KEY_AwardLucky"; - if (keyId == KEY_AwardLuckyLastRewardDate) - return "KEY_AwardLuckyLastRewardDate"; - if (keyId == KEY_AwardBlackList) - return "KEY_AwardBlackList"; - if (keyId == KEY_AwardBlackListLastRewardDate) - return "KEY_AwardBlackListLastRewardDate"; - if (keyId == KEY_AwardSilentDeath) - return "KEY_AwardSilentDeath"; - if (keyId == KEY_AwardSilentDeathLastRewardDate) - return "KEY_AwardSilentDeathLastRewardDate"; - if (keyId == KEY_PlayerName) - return "KEY_PlayerName"; - - return ""; -} - -int ATLAS_GET_STAT(char* statName) -{ - if (!statName) - return 0; - - if (!strcmp("STAT_AwardAchillesHeel", statName)) - return STAT_AwardAchillesHeel; - if (!strcmp("STAT_AwardAchillesHeelLastRewardDate", statName)) - return STAT_AwardAchillesHeelLastRewardDate; - if (!strcmp("STAT_AwardAvenger", statName)) - return STAT_AwardAvenger; - if (!strcmp("STAT_AwardAvengerLastRewardDate", statName)) - return STAT_AwardAvengerLastRewardDate; - if (!strcmp("STAT_AwardBlackList", statName)) - return STAT_AwardBlackList; - if (!strcmp("STAT_AwardBlackListLastRewardDate", statName)) - return STAT_AwardBlackListLastRewardDate; - if (!strcmp("STAT_AwardBlitzkrieg", statName)) - return STAT_AwardBlitzkrieg; - if (!strcmp("STAT_AwardBlitzkriegLastRewardDate", statName)) - return STAT_AwardBlitzkriegLastRewardDate; - if (!strcmp("STAT_AwardCherub", statName)) - return STAT_AwardCherub; - if (!strcmp("STAT_AwardCherubLastRewardDate", statName)) - return STAT_AwardCherubLastRewardDate; - if (!strcmp("STAT_AwardClimber", statName)) - return STAT_AwardClimber; - if (!strcmp("STAT_AwardClimberLastRewardDate", statName)) - return STAT_AwardClimberLastRewardDate; - if (!strcmp("STAT_AwardDeadlyAccuracy", statName)) - return STAT_AwardDeadlyAccuracy; - if (!strcmp("STAT_AwardDeadlyAccuracyLastRewardDate", statName)) - return STAT_AwardDeadlyAccuracyLastRewardDate; - if (!strcmp("STAT_AwardDignity", statName)) - return STAT_AwardDignity; - if (!strcmp("STAT_AwardDignityLastRewardDate", statName)) - return STAT_AwardDignityLastRewardDate; - if (!strcmp("STAT_AwardDoubleShotDoubleKill", statName)) - return STAT_AwardDoubleShotDoubleKill; - if (!strcmp("STAT_AwardDoubleShotDoubleKillLastRewardDate", statName)) - return STAT_AwardDoubleShotDoubleKillLastRewardDate; - if (!strcmp("STAT_AwardDryVictory", statName)) - return STAT_AwardDryVictory; - if (!strcmp("STAT_AwardDryVictoryLastRewardDate", statName)) - return STAT_AwardDryVictoryLastRewardDate; - if (!strcmp("STAT_AwardFasterThanBullets", statName)) - return STAT_AwardFasterThanBullets; - if (!strcmp("STAT_AwardFasterThanBulletsLastRewardDate", statName)) - return STAT_AwardFasterThanBulletsLastRewardDate; - if (!strcmp("STAT_AwardHarvestTime", statName)) - return STAT_AwardHarvestTime; - if (!strcmp("STAT_AwardHarvestTimeLastRewardDate", statName)) - return STAT_AwardHarvestTimeLastRewardDate; - if (!strcmp("STAT_AwardInvincibleFury", statName)) - return STAT_AwardInvincibleFury; - if (!strcmp("STAT_AwardInvincibleFuryLastRewardDate", statName)) - return STAT_AwardInvincibleFuryLastRewardDate; - if (!strcmp("STAT_AwardLightingReflexes", statName)) - return STAT_AwardLightingReflexes; - if (!strcmp("STAT_AwardLightingReflexesLastRewardDate", statName)) - return STAT_AwardLightingReflexesLastRewardDate; - if (!strcmp("STAT_AwardLucky", statName)) - return STAT_AwardLucky; - if (!strcmp("STAT_AwardLuckyLastRewardDate", statName)) - return STAT_AwardLuckyLastRewardDate; - if (!strcmp("STAT_AwardMad", statName)) - return STAT_AwardMad; - if (!strcmp("STAT_AwardMadLastRewardDate", statName)) - return STAT_AwardMadLastRewardDate; - if (!strcmp("STAT_AwardMarksman", statName)) - return STAT_AwardMarksman; - if (!strcmp("STAT_AwardMarksmanLastRewardDate", statName)) - return STAT_AwardMarksmanLastRewardDate; - if (!strcmp("STAT_AwardMasscare", statName)) - return STAT_AwardMasscare; - if (!strcmp("STAT_AwardMasscareLastRewardDate", statName)) - return STAT_AwardMasscareLastRewardDate; - if (!strcmp("STAT_AwardMultichampion", statName)) - return STAT_AwardMultichampion; - if (!strcmp("STAT_AwardMultichampionLastRewardDate", statName)) - return STAT_AwardMultichampionLastRewardDate; - if (!strcmp("STAT_AwardOculist", statName)) - return STAT_AwardOculist; - if (!strcmp("STAT_AwardOculistLastRewardDate", statName)) - return STAT_AwardOculistLastRewardDate; - if (!strcmp("STAT_AwardOpener", statName)) - return STAT_AwardOpener; - if (!strcmp("STAT_AwardOpenerLastRewardDate", statName)) - return STAT_AwardOpenerLastRewardDate; - if (!strcmp("STAT_AwardOwerwhelmingSuperiority", statName)) - return STAT_AwardOwerwhelmingSuperiority; - if (!strcmp("STAT_AwardOwerwhelmingSuperiorityLastRewardDate", statName)) - return STAT_AwardOwerwhelmingSuperiorityLastRewardDate; - if (!strcmp("STAT_AwardParanoia", statName)) - return STAT_AwardParanoia; - if (!strcmp("STAT_AwardParanoiaLastRewardDate", statName)) - return STAT_AwardParanoiaLastRewardDate; - if (!strcmp("STAT_AwardPeaceAmbassador", statName)) - return STAT_AwardPeaceAmbassador; - if (!strcmp("STAT_AwardPeaceAmbassadorLastRewardDate", statName)) - return STAT_AwardPeaceAmbassadorLastRewardDate; - if (!strcmp("STAT_AwardRemembrance", statName)) - return STAT_AwardRemembrance; - if (!strcmp("STAT_AwardRemembranceLastRewardDate", statName)) - return STAT_AwardRemembranceLastRewardDate; - if (!strcmp("STAT_AwardSilentDeath", statName)) - return STAT_AwardSilentDeath; - if (!strcmp("STAT_AwardSilentDeathLastRewardDate", statName)) - return STAT_AwardSilentDeathLastRewardDate; - if (!strcmp("STAT_AwardSkewer", statName)) - return STAT_AwardSkewer; - if (!strcmp("STAT_AwardSkewerLastRewardDate", statName)) - return STAT_AwardSkewerLastRewardDate; - if (!strcmp("STAT_AwardSprinterStopper", statName)) - return STAT_AwardSprinterStopper; - if (!strcmp("STAT_AwardSprinterStopperLastRewardDate", statName)) - return STAT_AwardSprinterStopperLastRewardDate; - if (!strcmp("STAT_AwardStalkerFlair", statName)) - return STAT_AwardStalkerFlair; - if (!strcmp("STAT_AwardStalkerFlairLastRewardDate", statName)) - return STAT_AwardStalkerFlairLastRewardDate; - if (!strcmp("STAT_AwardToughy", statName)) - return STAT_AwardToughy; - if (!strcmp("STAT_AwardToughyLastRewardDate", statName)) - return STAT_AwardToughyLastRewardDate; - if (!strcmp("STAT_BestScore_BackstabsKillsInRow", statName)) - return STAT_BestScore_BackstabsKillsInRow; - if (!strcmp("STAT_BestScore_BleedKillsInRow", statName)) - return STAT_BestScore_BleedKillsInRow; - if (!strcmp("STAT_BestScore_ExplosiveKillsInRow", statName)) - return STAT_BestScore_ExplosiveKillsInRow; - if (!strcmp("STAT_BestScore_EyeKillsInRow", statName)) - return STAT_BestScore_EyeKillsInRow; - if (!strcmp("STAT_BestScore_HeadshotsKillsInRow", statName)) - return STAT_BestScore_HeadshotsKillsInRow; - if (!strcmp("STAT_BestScore_KillsInRow", statName)) - return STAT_BestScore_KillsInRow; - if (!strcmp("STAT_BestScore_KnifeKillsInRow", statName)) - return STAT_BestScore_KnifeKillsInRow; - if (!strcmp("STAT_PlayerName", statName)) - return STAT_PlayerName; - - return 0; -} -char* ATLAS_GET_STAT_NAME(int statId) -{ - if (statId <= 0) - return ""; - - if (statId == STAT_AwardAchillesHeel) - return "STAT_AwardAchillesHeel"; - if (statId == STAT_AwardAchillesHeelLastRewardDate) - return "STAT_AwardAchillesHeelLastRewardDate"; - if (statId == STAT_AwardAvenger) - return "STAT_AwardAvenger"; - if (statId == STAT_AwardAvengerLastRewardDate) - return "STAT_AwardAvengerLastRewardDate"; - if (statId == STAT_AwardBlackList) - return "STAT_AwardBlackList"; - if (statId == STAT_AwardBlackListLastRewardDate) - return "STAT_AwardBlackListLastRewardDate"; - if (statId == STAT_AwardBlitzkrieg) - return "STAT_AwardBlitzkrieg"; - if (statId == STAT_AwardBlitzkriegLastRewardDate) - return "STAT_AwardBlitzkriegLastRewardDate"; - if (statId == STAT_AwardCherub) - return "STAT_AwardCherub"; - if (statId == STAT_AwardCherubLastRewardDate) - return "STAT_AwardCherubLastRewardDate"; - if (statId == STAT_AwardClimber) - return "STAT_AwardClimber"; - if (statId == STAT_AwardClimberLastRewardDate) - return "STAT_AwardClimberLastRewardDate"; - if (statId == STAT_AwardDeadlyAccuracy) - return "STAT_AwardDeadlyAccuracy"; - if (statId == STAT_AwardDeadlyAccuracyLastRewardDate) - return "STAT_AwardDeadlyAccuracyLastRewardDate"; - if (statId == STAT_AwardDignity) - return "STAT_AwardDignity"; - if (statId == STAT_AwardDignityLastRewardDate) - return "STAT_AwardDignityLastRewardDate"; - if (statId == STAT_AwardDoubleShotDoubleKill) - return "STAT_AwardDoubleShotDoubleKill"; - if (statId == STAT_AwardDoubleShotDoubleKillLastRewardDate) - return "STAT_AwardDoubleShotDoubleKillLastRewardDate"; - if (statId == STAT_AwardDryVictory) - return "STAT_AwardDryVictory"; - if (statId == STAT_AwardDryVictoryLastRewardDate) - return "STAT_AwardDryVictoryLastRewardDate"; - if (statId == STAT_AwardFasterThanBullets) - return "STAT_AwardFasterThanBullets"; - if (statId == STAT_AwardFasterThanBulletsLastRewardDate) - return "STAT_AwardFasterThanBulletsLastRewardDate"; - if (statId == STAT_AwardHarvestTime) - return "STAT_AwardHarvestTime"; - if (statId == STAT_AwardHarvestTimeLastRewardDate) - return "STAT_AwardHarvestTimeLastRewardDate"; - if (statId == STAT_AwardInvincibleFury) - return "STAT_AwardInvincibleFury"; - if (statId == STAT_AwardInvincibleFuryLastRewardDate) - return "STAT_AwardInvincibleFuryLastRewardDate"; - if (statId == STAT_AwardLightingReflexes) - return "STAT_AwardLightingReflexes"; - if (statId == STAT_AwardLightingReflexesLastRewardDate) - return "STAT_AwardLightingReflexesLastRewardDate"; - if (statId == STAT_AwardLucky) - return "STAT_AwardLucky"; - if (statId == STAT_AwardLuckyLastRewardDate) - return "STAT_AwardLuckyLastRewardDate"; - if (statId == STAT_AwardMad) - return "STAT_AwardMad"; - if (statId == STAT_AwardMadLastRewardDate) - return "STAT_AwardMadLastRewardDate"; - if (statId == STAT_AwardMarksman) - return "STAT_AwardMarksman"; - if (statId == STAT_AwardMarksmanLastRewardDate) - return "STAT_AwardMarksmanLastRewardDate"; - if (statId == STAT_AwardMasscare) - return "STAT_AwardMasscare"; - if (statId == STAT_AwardMasscareLastRewardDate) - return "STAT_AwardMasscareLastRewardDate"; - if (statId == STAT_AwardMultichampion) - return "STAT_AwardMultichampion"; - if (statId == STAT_AwardMultichampionLastRewardDate) - return "STAT_AwardMultichampionLastRewardDate"; - if (statId == STAT_AwardOculist) - return "STAT_AwardOculist"; - if (statId == STAT_AwardOculistLastRewardDate) - return "STAT_AwardOculistLastRewardDate"; - if (statId == STAT_AwardOpener) - return "STAT_AwardOpener"; - if (statId == STAT_AwardOpenerLastRewardDate) - return "STAT_AwardOpenerLastRewardDate"; - if (statId == STAT_AwardOwerwhelmingSuperiority) - return "STAT_AwardOwerwhelmingSuperiority"; - if (statId == STAT_AwardOwerwhelmingSuperiorityLastRewardDate) - return "STAT_AwardOwerwhelmingSuperiorityLastRewardDate"; - if (statId == STAT_AwardParanoia) - return "STAT_AwardParanoia"; - if (statId == STAT_AwardParanoiaLastRewardDate) - return "STAT_AwardParanoiaLastRewardDate"; - if (statId == STAT_AwardPeaceAmbassador) - return "STAT_AwardPeaceAmbassador"; - if (statId == STAT_AwardPeaceAmbassadorLastRewardDate) - return "STAT_AwardPeaceAmbassadorLastRewardDate"; - if (statId == STAT_AwardRemembrance) - return "STAT_AwardRemembrance"; - if (statId == STAT_AwardRemembranceLastRewardDate) - return "STAT_AwardRemembranceLastRewardDate"; - if (statId == STAT_AwardSilentDeath) - return "STAT_AwardSilentDeath"; - if (statId == STAT_AwardSilentDeathLastRewardDate) - return "STAT_AwardSilentDeathLastRewardDate"; - if (statId == STAT_AwardSkewer) - return "STAT_AwardSkewer"; - if (statId == STAT_AwardSkewerLastRewardDate) - return "STAT_AwardSkewerLastRewardDate"; - if (statId == STAT_AwardSprinterStopper) - return "STAT_AwardSprinterStopper"; - if (statId == STAT_AwardSprinterStopperLastRewardDate) - return "STAT_AwardSprinterStopperLastRewardDate"; - if (statId == STAT_AwardStalkerFlair) - return "STAT_AwardStalkerFlair"; - if (statId == STAT_AwardStalkerFlairLastRewardDate) - return "STAT_AwardStalkerFlairLastRewardDate"; - if (statId == STAT_AwardToughy) - return "STAT_AwardToughy"; - if (statId == STAT_AwardToughyLastRewardDate) - return "STAT_AwardToughyLastRewardDate"; - if (statId == STAT_BestScore_BackstabsKillsInRow) - return "STAT_BestScore_BackstabsKillsInRow"; - if (statId == STAT_BestScore_BleedKillsInRow) - return "STAT_BestScore_BleedKillsInRow"; - if (statId == STAT_BestScore_ExplosiveKillsInRow) - return "STAT_BestScore_ExplosiveKillsInRow"; - if (statId == STAT_BestScore_EyeKillsInRow) - return "STAT_BestScore_EyeKillsInRow"; - if (statId == STAT_BestScore_HeadshotsKillsInRow) - return "STAT_BestScore_HeadshotsKillsInRow"; - if (statId == STAT_BestScore_KillsInRow) - return "STAT_BestScore_KillsInRow"; - if (statId == STAT_BestScore_KnifeKillsInRow) - return "STAT_BestScore_KnifeKillsInRow"; - if (statId == STAT_PlayerName) - return "STAT_PlayerName"; - - return ""; -} - -int ATLAS_GET_STAT_PAGE_BY_ID(int statId) -{ - if (statId <= 0) - return 0; - - // PlayerStats - if (statId == 1 || statId == 2 || statId == 3 || statId == 4 || statId == 5 || statId == 6 || statId == 7 || - statId == 8 || statId == 9 || statId == 10 || statId == 11 || statId == 12 || statId == 13 || statId == 14 || - statId == 15 || statId == 16 || statId == 17 || statId == 18 || statId == 19 || statId == 20 || statId == 21 || - statId == 22 || statId == 23 || statId == 24 || statId == 25 || statId == 26 || statId == 27 || statId == 28 || - statId == 29 || statId == 30 || statId == 31 || statId == 32 || statId == 33 || statId == 34 || statId == 35 || - statId == 36 || statId == 37 || statId == 38 || statId == 39 || statId == 40 || statId == 41 || statId == 42 || - statId == 43 || statId == 44 || statId == 45 || statId == 46 || statId == 47 || statId == 48 || statId == 49 || - statId == 50 || statId == 51 || statId == 52 || statId == 53 || statId == 54 || statId == 55 || statId == 56 || - statId == 57 || statId == 58 || statId == 59 || statId == 60 || statId == 61 || statId == 62 || statId == 63 || - statId == 64 || statId == 65 || statId == 66 || statId == 67 || statId == 68) - return 1; - - return 0; -} - -int ATLAS_GET_STAT_PAGE_BY_NAME(char* statName) -{ - if (!statName) - return 0; - - // PlayerStats - if (!strcmp("STAT_AwardAchillesHeel", statName) || !strcmp("STAT_AwardAchillesHeelLastRewardDate", statName) || - !strcmp("STAT_AwardAvenger", statName) || !strcmp("STAT_AwardAvengerLastRewardDate", statName) || - !strcmp("STAT_AwardBlackList", statName) || !strcmp("STAT_AwardBlackListLastRewardDate", statName) || - !strcmp("STAT_AwardBlitzkrieg", statName) || !strcmp("STAT_AwardBlitzkriegLastRewardDate", statName) || - !strcmp("STAT_AwardCherub", statName) || !strcmp("STAT_AwardCherubLastRewardDate", statName) || - !strcmp("STAT_AwardClimber", statName) || !strcmp("STAT_AwardClimberLastRewardDate", statName) || - !strcmp("STAT_AwardDeadlyAccuracy", statName) || !strcmp("STAT_AwardDeadlyAccuracyLastRewardDate", statName) || - !strcmp("STAT_AwardDignity", statName) || !strcmp("STAT_AwardDignityLastRewardDate", statName) || - !strcmp("STAT_AwardDoubleShotDoubleKill", statName) || - !strcmp("STAT_AwardDoubleShotDoubleKillLastRewardDate", statName) || !strcmp("STAT_AwardDryVictory", statName) || - !strcmp("STAT_AwardDryVictoryLastRewardDate", statName) || !strcmp("STAT_AwardFasterThanBullets", statName) || - !strcmp("STAT_AwardFasterThanBulletsLastRewardDate", statName) || !strcmp("STAT_AwardHarvestTime", statName) || - !strcmp("STAT_AwardHarvestTimeLastRewardDate", statName) || !strcmp("STAT_AwardInvincibleFury", statName) || - !strcmp("STAT_AwardInvincibleFuryLastRewardDate", statName) || !strcmp("STAT_AwardLightingReflexes", statName) || - !strcmp("STAT_AwardLightingReflexesLastRewardDate", statName) || !strcmp("STAT_AwardLucky", statName) || - !strcmp("STAT_AwardLuckyLastRewardDate", statName) || !strcmp("STAT_AwardMad", statName) || - !strcmp("STAT_AwardMadLastRewardDate", statName) || !strcmp("STAT_AwardMarksman", statName) || - !strcmp("STAT_AwardMarksmanLastRewardDate", statName) || !strcmp("STAT_AwardMasscare", statName) || - !strcmp("STAT_AwardMasscareLastRewardDate", statName) || !strcmp("STAT_AwardMultichampion", statName) || - !strcmp("STAT_AwardMultichampionLastRewardDate", statName) || !strcmp("STAT_AwardOculist", statName) || - !strcmp("STAT_AwardOculistLastRewardDate", statName) || !strcmp("STAT_AwardOpener", statName) || - !strcmp("STAT_AwardOpenerLastRewardDate", statName) || !strcmp("STAT_AwardOwerwhelmingSuperiority", statName) || - !strcmp("STAT_AwardOwerwhelmingSuperiorityLastRewardDate", statName) || !strcmp("STAT_AwardParanoia", statName) || - !strcmp("STAT_AwardParanoiaLastRewardDate", statName) || !strcmp("STAT_AwardPeaceAmbassador", statName) || - !strcmp("STAT_AwardPeaceAmbassadorLastRewardDate", statName) || !strcmp("STAT_AwardRemembrance", statName) || - !strcmp("STAT_AwardRemembranceLastRewardDate", statName) || !strcmp("STAT_AwardSilentDeath", statName) || - !strcmp("STAT_AwardSilentDeathLastRewardDate", statName) || !strcmp("STAT_AwardSkewer", statName) || - !strcmp("STAT_AwardSkewerLastRewardDate", statName) || !strcmp("STAT_AwardSprinterStopper", statName) || - !strcmp("STAT_AwardSprinterStopperLastRewardDate", statName) || !strcmp("STAT_AwardStalkerFlair", statName) || - !strcmp("STAT_AwardStalkerFlairLastRewardDate", statName) || !strcmp("STAT_AwardToughy", statName) || - !strcmp("STAT_AwardToughyLastRewardDate", statName) || !strcmp("STAT_BestScore_BackstabsKillsInRow", statName) || - !strcmp("STAT_BestScore_BleedKillsInRow", statName) || !strcmp("STAT_BestScore_ExplosiveKillsInRow", statName) || - !strcmp("STAT_BestScore_EyeKillsInRow", statName) || !strcmp("STAT_BestScore_HeadshotsKillsInRow", statName) || - !strcmp("STAT_BestScore_KillsInRow", statName) || !strcmp("STAT_BestScore_KnifeKillsInRow", statName) || - !strcmp("STAT_PlayerName", statName)) - return 1; - - return 0; -} diff --git a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.h b/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.h deleted file mode 100644 index 98d1431ac94..00000000000 --- a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.h +++ /dev/null @@ -1,173 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// GameSpy ATLAS Competition System Header File -// -// NOTE: This is an auto-generated file, do not edit this file directly. -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _ATLAS_STALKERCOPPC_V1_H_ -#define _ATLAS_STALKERCOPPC_V1_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int ATLAS_GET_KEY(char* keyName); -extern char* ATLAS_GET_KEY_NAME(int keyId); -extern int ATLAS_GET_STAT(char* statName); -extern char* ATLAS_GET_STAT_NAME(int statId); -extern int ATLAS_GET_STAT_PAGE_BY_ID(int statId); -extern int ATLAS_GET_STAT_PAGE_BY_NAME(char* statName); - -#define ATLAS_RULE_SET_VERSION 1 - -// KEYS -// Use these key ID's to report match data for your game. - -#define KEY_BestScore_KillsInRow 3 // [TYPE: int] [DESC: kills in row] -#define KEY_BestScore_KnifeKillsInRow 4 // [TYPE: int] [DESC: knife kills in row] -#define KEY_BestScore_BackstabsKillsInRow 5 // [TYPE: int] [DESC: knife backstabs kills in row] -#define KEY_BestScore_HeadshotsKillsInRow 6 // [TYPE: int] [DESC: headshots kills in row] -#define KEY_BestScore_EyeKillsInRow 7 // [TYPE: int] [DESC: eye kills in row] -#define KEY_BestScore_BleedKillsInRow 8 // [TYPE: int] [DESC: bleed kills in row] -#define KEY_BestScore_ExplosiveKillsInRow 9 // [TYPE: int] [DESC: explosive kills in row] -#define KEY_AwardMasscare 10 // [TYPE: int] -#define KEY_AwardMasscareLastRewardDate 11 // [TYPE: int] -#define KEY_AwardParanoia 12 // [TYPE: int] -#define KEY_AwardParanoiaLastRewardDate 13 // [TYPE: int] -#define KEY_AwardOverwhelmingSuperiority 14 // [TYPE: int] -#define KEY_AwardOverwhelmingSuperiorityLastRewardDate 15 // [TYPE: int] -#define KEY_AwardBlitzkrieg 16 // [TYPE: int] -#define KEY_AwardBlitzkriegLastRewardDate 17 // [TYPE: int] -#define KEY_AwardDryVictory 18 // [TYPE: int] -#define KEY_AwardDryVictoryLastRewardDate 19 // [TYPE: int] -#define KEY_AwardMultichampion 20 // [TYPE: int] -#define KEY_AwardMultichampionLastRewardDate 21 // [TYPE: int] -#define KEY_AwardMad 22 // [TYPE: int] -#define KEY_AwardMadLastRewardDate 23 // [TYPE: int] -#define KEY_AwardAchillesHeel 24 // [TYPE: int] -#define KEY_AwardAchillesHeelLastRewardDate 25 // [TYPE: int] -#define KEY_AwardFasterThanBullets 26 // [TYPE: int] -#define KEY_AwardFasterThanBulletsLastRewardDate 27 // [TYPE: int] -#define KEY_AwardHarvestTime 28 // [TYPE: int] -#define KEY_AwardHarvestTimeLastRewardDate 29 // [TYPE: int] -#define KEY_AwardSkewer 30 // [TYPE: int] -#define KEY_AwardSkewerLastRewardDate 31 // [TYPE: int] -#define KEY_AwardDoubleShotDoubleKill 32 // [TYPE: int] -#define KEY_AwardDoubleShotDoubleKillLastRewardDate 33 // [TYPE: int] -#define KEY_AwardClimber 34 // [TYPE: int] -#define KEY_AwardClimberLastRewardDate 35 // [TYPE: int] -#define KEY_AwardOpener 36 // [TYPE: int] -#define KEY_AwardOpenerLastRewardDate 37 // [TYPE: int] -#define KEY_AwardToughy 38 // [TYPE: int] -#define KEY_AwardToughyLastRewardDate 39 // [TYPE: int] -#define KEY_AwardInvincibleFury 40 // [TYPE: int] -#define KEY_AwardInvincibleFuryLastRewardDate 41 // [TYPE: int] -#define KEY_AwardOculist 42 // [TYPE: int] -#define KEY_AwardOculistLastRewardDate 43 // [TYPE: int] -#define KEY_AwardLightingReflexes 44 // [TYPE: int] -#define KEY_AwardLightingReflexesLastRewardDate 45 // [TYPE: int] -#define KEY_AwardSprinterStopper 46 // [TYPE: int] -#define KEY_AwardSprinterStopperLastRewardDate 47 // [TYPE: int] -#define KEY_AwardMarksMan 48 // [TYPE: int] -#define KEY_AwardMarksManLastRewardDate 49 // [TYPE: int] -#define KEY_AwardPeaceAmbassador 50 // [TYPE: int] -#define KEY_AwardPeaceAmbassadorLastRewardDate 51 // [TYPE: int] -#define KEY_AwardDeadlyAccuracy 52 // [TYPE: int] -#define KEY_AwardDeadlyAccuracyLastRewardDate 53 // [TYPE: int] -#define KEY_AwardRemembrance 54 // [TYPE: int] -#define KEY_AwardRemembranceLastRewardDate 55 // [TYPE: int] -#define KEY_AwardAvenger 56 // [TYPE: int] -#define KEY_AwardAvengerLastRewardDate 57 // [TYPE: int] -#define KEY_AwardCherub 58 // [TYPE: int] -#define KEY_AwardCherubLastRewardDate 59 // [TYPE: int] -#define KEY_AwardDignity 60 // [TYPE: int] -#define KEY_AwardDignityLastRewardDate 61 // [TYPE: int] -#define KEY_AwardStalkerFlair 62 // [TYPE: int] -#define KEY_AwardStalkerFlairLastRewardDate 63 // [TYPE: int] -#define KEY_AwardLucky 64 // [TYPE: int] -#define KEY_AwardLuckyLastRewardDate 65 // [TYPE: int] -#define KEY_AwardBlackList 66 // [TYPE: int] -#define KEY_AwardBlackListLastRewardDate 67 // [TYPE: int] -#define KEY_AwardSilentDeath 68 // [TYPE: int] -#define KEY_AwardSilentDeathLastRewardDate 69 // [TYPE: int] -#define KEY_PlayerName 70 // [TYPE: string] - -/////////////////////////////////////////////////////////////////////////////// - -// STATS -// Use these stat ID's to query aggregate statistics for your game. - -#define STAT_AwardAchillesHeel 1 // [TYPE: int] -#define STAT_AwardAchillesHeelLastRewardDate 2 // [TYPE: int] -#define STAT_AwardAvenger 3 // [TYPE: int] -#define STAT_AwardAvengerLastRewardDate 4 // [TYPE: int] -#define STAT_AwardBlackList 5 // [TYPE: int] -#define STAT_AwardBlackListLastRewardDate 6 // [TYPE: int] -#define STAT_AwardBlitzkrieg 7 // [TYPE: int] -#define STAT_AwardBlitzkriegLastRewardDate 8 // [TYPE: int] -#define STAT_AwardCherub 9 // [TYPE: int] -#define STAT_AwardCherubLastRewardDate 10 // [TYPE: int] -#define STAT_AwardClimber 11 // [TYPE: int] -#define STAT_AwardClimberLastRewardDate 12 // [TYPE: int] -#define STAT_AwardDeadlyAccuracy 13 // [TYPE: int] -#define STAT_AwardDeadlyAccuracyLastRewardDate 14 // [TYPE: int] -#define STAT_AwardDignity 15 // [TYPE: int] -#define STAT_AwardDignityLastRewardDate 16 // [TYPE: int] -#define STAT_AwardDoubleShotDoubleKill 17 // [TYPE: int] -#define STAT_AwardDoubleShotDoubleKillLastRewardDate 18 // [TYPE: int] -#define STAT_AwardDryVictory 19 // [TYPE: int] -#define STAT_AwardDryVictoryLastRewardDate 20 // [TYPE: int] -#define STAT_AwardFasterThanBullets 21 // [TYPE: int] -#define STAT_AwardFasterThanBulletsLastRewardDate 22 // [TYPE: int] -#define STAT_AwardHarvestTime 23 // [TYPE: int] -#define STAT_AwardHarvestTimeLastRewardDate 24 // [TYPE: int] -#define STAT_AwardInvincibleFury 25 // [TYPE: int] -#define STAT_AwardInvincibleFuryLastRewardDate 26 // [TYPE: int] -#define STAT_AwardLightingReflexes 27 // [TYPE: int] -#define STAT_AwardLightingReflexesLastRewardDate 28 // [TYPE: int] -#define STAT_AwardLucky 29 // [TYPE: int] -#define STAT_AwardLuckyLastRewardDate 30 // [TYPE: int] -#define STAT_AwardMad 31 // [TYPE: int] -#define STAT_AwardMadLastRewardDate 32 // [TYPE: int] -#define STAT_AwardMarksman 33 // [TYPE: int] -#define STAT_AwardMarksmanLastRewardDate 34 // [TYPE: int] -#define STAT_AwardMasscare 35 // [TYPE: int] -#define STAT_AwardMasscareLastRewardDate 36 // [TYPE: int] -#define STAT_AwardMultichampion 37 // [TYPE: int] -#define STAT_AwardMultichampionLastRewardDate 38 // [TYPE: int] -#define STAT_AwardOculist 39 // [TYPE: int] -#define STAT_AwardOculistLastRewardDate 40 // [TYPE: int] -#define STAT_AwardOpener 41 // [TYPE: int] -#define STAT_AwardOpenerLastRewardDate 42 // [TYPE: int] -#define STAT_AwardOwerwhelmingSuperiority 43 // [TYPE: int] -#define STAT_AwardOwerwhelmingSuperiorityLastRewardDate 44 // [TYPE: int] -#define STAT_AwardParanoia 45 // [TYPE: int] -#define STAT_AwardParanoiaLastRewardDate 46 // [TYPE: int] -#define STAT_AwardPeaceAmbassador 47 // [TYPE: int] -#define STAT_AwardPeaceAmbassadorLastRewardDate 48 // [TYPE: int] -#define STAT_AwardRemembrance 49 // [TYPE: int] -#define STAT_AwardRemembranceLastRewardDate 50 // [TYPE: int] -#define STAT_AwardSilentDeath 51 // [TYPE: int] -#define STAT_AwardSilentDeathLastRewardDate 52 // [TYPE: int] -#define STAT_AwardSkewer 53 // [TYPE: int] -#define STAT_AwardSkewerLastRewardDate 54 // [TYPE: int] -#define STAT_AwardSprinterStopper 55 // [TYPE: int] -#define STAT_AwardSprinterStopperLastRewardDate 56 // [TYPE: int] -#define STAT_AwardStalkerFlair 57 // [TYPE: int] -#define STAT_AwardStalkerFlairLastRewardDate 58 // [TYPE: int] -#define STAT_AwardToughy 59 // [TYPE: int] -#define STAT_AwardToughyLastRewardDate 60 // [TYPE: int] -#define STAT_BestScore_BackstabsKillsInRow 61 // [TYPE: int] -#define STAT_BestScore_BleedKillsInRow 62 // [TYPE: int] -#define STAT_BestScore_ExplosiveKillsInRow 63 // [TYPE: int] -#define STAT_BestScore_EyeKillsInRow 64 // [TYPE: int] -#define STAT_BestScore_HeadshotsKillsInRow 65 // [TYPE: int] -#define STAT_BestScore_KillsInRow 66 // [TYPE: int] -#define STAT_BestScore_KnifeKillsInRow 67 // [TYPE: int] -#define STAT_PlayerName 68 // [TYPE: string] [DESC: contains players name] - -#ifdef __cplusplus -} -#endif - -#endif // _ATLAS_STALKERCOPPC_V1_H_ diff --git a/src/utils/mp_gpprof_server/entry_point.cpp b/src/utils/mp_gpprof_server/entry_point.cpp deleted file mode 100644 index 87fccc15ec3..00000000000 --- a/src/utils/mp_gpprof_server/entry_point.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#include "sake_worker.h" -#include "requests_processor.h" -#include "profile_request.h" -#include "profile_printer.h" - -char const* game_name = "stalkercoppc"; -int game_id = 2760; -int game_product_id = 11994; -int game_namespace_id = 1; - -char const* default_root_path = "/gprof"; -char const* root_path = NULL; - -int main(int argc, char** argv) -{ - using namespace std; - using namespace gamespy_profile; - - try - { -#ifdef WIN32 - pthread_win32_process_attach_np(); -#endif - - /*streambuf* cin_streambuf = cin.rdbuf(); - streambuf* cout_streambuf = cout.rdbuf(); - streambuf* cerr_streambuf = cerr.rdbuf();*/ - - FCGX_Init(); - int binded_sock = 0; - if (argc >= 2) - binded_sock = FCGX_OpenSocket(argv[1], 128); - if (!binded_sock) - { - cerr << "failed to bind socket to address " << argv[1] << endl; - return EXIT_FAILURE; - } - - cout << "binded server to: " << argv[1] << ", value=" << binded_sock << endl; - - if (argc >= 3) - root_path = argv[2]; - - std::auto_ptr req_poll(new requests_poll()); - fetch_profile_request::request_ptr_t new_request(new FCGX_Request()); - - FCGX_InitRequest(new_request.get(), binded_sock, 0); - - cout << "listening requests..." << endl; - while (FCGX_Accept_r(new_request.get()) == 0) - { - req_poll->add_request(new_request); - assert(!new_request.get()); - new_request.reset(new FCGX_Request()); - FCGX_InitRequest(new_request.get(), binded_sock, 0); - } - - /*cin.rdbuf(cin_streambuf); - cout.rdbuf(cout_streambuf); - cerr.rdbuf(cerr_streambuf);*/ - } - catch (const std::exception& e) - { - cerr << "Caught exception: " << e.what() << endl << "Type: " << typeid(e).name() << endl; - return EXIT_FAILURE; - } - - return EXIT_SUCCESS; -}; diff --git a/src/utils/mp_gpprof_server/gamespy_sake.cpp b/src/utils/mp_gpprof_server/gamespy_sake.cpp deleted file mode 100644 index 6d0b1e3ab16..00000000000 --- a/src/utils/mp_gpprof_server/gamespy_sake.cpp +++ /dev/null @@ -1,349 +0,0 @@ -#include -#include -#include -#include "gamespy_sake.h" - -extern char const* game_name; -extern int game_id; -extern int game_product_id; -extern int game_namespace_id; - -char const* gp_nick = "profile_printer@ua"; -char const* gp_email = "profile_printer@ua"; -char const* gp_pass = "loopzilla"; - -typedef char secret_key_t[32]; -void fill_secret_key(secret_key_t& sc) -{ - sc[0] = 'L'; - sc[1] = 'T'; - sc[2] = 'U'; - sc[3] = '2'; - sc[4] = 'z'; - sc[5] = '2'; - sc[6] = '\0'; -} - -#ifdef GSI_COMMON_DEBUG -static void debug_callback(GSIDebugCategory theCat, GSIDebugType theType, GSIDebugLevel theLevel, - const char* theTokenStr, va_list theParamList) -{ - char tmp_prefix_buffer[256]; - char error_buffer[1024]; - - // hope compiler will find specializations like: template int sprintf( char (&buffer)[size], - - sprintf(tmp_prefix_buffer, "GameSpy: [%s][%s] ", gGSIDebugCatStrings[theCat], gGSIDebugTypeStrings[theType]); - - vsprintf(error_buffer, theTokenStr, theParamList); - std::cerr << tmp_prefix_buffer << error_buffer << std::endl; -} -#endif - -GSIACResult check_gamespy_services(void) -{ - GSIACResult aResult; - GSIStartAvailableCheck(game_name); - // Continue processing while the check is in progress - do - { - aResult = GSIAvailableCheckThink(); - msleep(10); - } while (aResult == GSIACWaiting); - - // Check the result - switch (aResult) - { - case GSIACAvailable: break; - case GSIACUnavailable: - std::cerr << "GameSpy: Online services are unavailable\r\n" - << "GameSpy: Please visit www.mygame.com for more information.\r\n"; - break; - case GSIACTemporarilyUnavailable: - std::cerr << "GameSpy: Online services are temporarily unavailable.\r\n" - << "GameSpy: Please visit www.mygame.com for more information.\r\n"; - break; - default: break; - }; - return aResult; -} - -sake_processor::core_initializer::core_initializer() -{ - if (check_gamespy_services() != GSIACAvailable) - throw std::runtime_error("GameSpy services are unavailable"); - -#ifdef GSI_COMMON_DEBUG - gsSetDebugCallback(debug_callback); - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Hardcore); -#endif - gsCoreInitialize(); -} -sake_processor::core_initializer::~core_initializer() { gsCoreShutdown(); } -sake_processor::gp_processor::gp_processor() : m_connection(NULL) -{ - memset(&m_login_ticket, 0, sizeof(m_login_ticket)); - GPResult tmp_res = gpInitialize(&m_connection, game_product_id, game_namespace_id, GP_PARTNERID_GAMESPY); - m_complete = false; - if (tmp_res != GP_NO_ERROR) - { - std::cerr << "GameSpy: GP initialization failed, errcode: " << tmp_res << std::endl; - throw std::runtime_error("GameSpy GP initialization failed"); - } -} - -bool sake_processor::gp_processor::login() -{ - assert(m_connection); - GPResult tmp_res = gpConnect( - &m_connection, gp_nick, gp_email, gp_pass, GP_NO_FIREWALL, GP_BLOCKING, &gp_processor::login_result_cb, this); - - if (tmp_res != GP_NO_ERROR) - return false; - - return true; -} - -void sake_processor::gp_processor::login_result_cb(GPConnection* connection, void* arg, void* param) -{ - gp_processor* me = static_cast(param); - GPConnectResponseArg* tmp_rarg = static_cast(arg); - me->m_complete = true; - - assert(tmp_rarg); - if (tmp_rarg->result != GP_NO_ERROR) - { - std::cerr << "GameSpy: GP failed to connect, errcode: " << tmp_rarg->result << std::endl; - return; - } - me->m_profile_id = tmp_rarg->profile; - gpGetLoginTicket(&me->m_connection, me->m_login_ticket); -} - -sake_processor::gp_processor::~gp_processor() { gpDestroy(&m_connection); } -sake_processor::sake_processor() -{ - static bool already_initialized = false; - assert(!already_initialized && "sake_processor instance must be single (please implement singleton)"); - // setup the common debugging - already_initialized = true; - - if (!m_gp_processor.login()) - { - std::cerr << "GameSpy: GP failed to login" << std::endl; - throw std::runtime_error(std::string("failed to login with GameSpy GP")); - } - - if (sakeStartup(&m_sake_inst) != SAKEStartupResult_SUCCESS) - { - std::cerr << "GameSpy: failed to initialize SAKE" << std::endl; - throw std::runtime_error(std::string("failed to initialize GameSpy SAKE")); - } - secret_key_t tmp_sc; - memset(tmp_sc, 0, sizeof(secret_key_t)); - fill_secret_key(tmp_sc); - - sakeSetGame(m_sake_inst, game_name, game_id, tmp_sc); - sakeSetProfile(m_sake_inst, m_gp_processor.m_profile_id, m_gp_processor.m_login_ticket); - - init_request_fields(); - m_processing_request = false; -} - -void sake_processor::think(gsi_time ms) { gsCoreThink(ms); } -sake_processor::~sake_processor() { sakeShutdown(m_sake_inst); } -void sake_processor::begin_fetch() -{ - m_request_names.clear(); - m_result_players.clear(); - m_current_offset = 0; -} -void sake_processor::add_name(char const* name) -{ - for (player_names_t::const_iterator i = m_request_names.begin(), ie = m_request_names.end(); i != ie; ++i) - { - if (!strcmp(i->c_str(), name)) - return; - } - m_request_names.resize(m_request_names.size() + 1); - m_request_names.back() = name; -} - -bool sake_processor::get_profile(char const* name, gamespy_profile::profile_data& dest_data) -{ - assert(!m_processing_request); - m_tmp_string = name; - players_map_t::iterator tmp_iter = m_result_players.find(m_tmp_string); - if (tmp_iter != m_result_players.end()) - { - dest_data = tmp_iter->second; - return true; - } - return false; -} - -bool security_treat(std::string const& name) { return (std::find(name.begin(), name.end(), '\'') != name.end()); } -bool sake_processor::create_request_string() -{ - m_tmp_string = ""; - m_request_names.erase( - std::remove_if(m_request_names.begin(), m_request_names.end(), security_treat), m_request_names.end()); - - player_names_t::const_iterator i = m_request_names.begin(); - player_names_t::const_iterator ie = m_request_names.end(); - if (i == ie) - return false; - do - { - m_tmp_string.append("(STAT_PlayerName='"); - m_tmp_string.append(*i); - ++i; - if (i == ie) - { - m_tmp_string.append("')"); - break; - } - else - { - m_tmp_string.append("')or"); - } - } while (1); - return true; -} - -void sake_processor::fetch() -{ - memset(&m_get_records_input, 0, sizeof(m_get_records_input)); - m_get_records_input.mTableId = gamespy_profile::profile_table_name; - m_get_records_input.mFieldNames = m_field_names_store; - m_get_records_input.mNumFields = merged_fields_count; - m_get_records_input.mCacheFlag = gsi_true; - if (!create_request_string()) - return; - - m_get_records_input.mFilter = &*m_tmp_string.begin(); - m_get_records_input.mOffset = m_current_offset; - m_get_records_input.mMaxRecords = max_request_records; - - SAKERequest tmp_request = - sakeSearchForRecords(m_sake_inst, &m_get_records_input, &sake_processor::request_callback, this); - m_processing_request = true; - - if (!tmp_request) - { - SAKEStartRequestResult tmp_result = sakeGetStartRequestResult(m_sake_inst); - std::cerr << "GameSpy: SAKE request failed, errcode: " << tmp_result << std::endl; - request_callback(m_sake_inst, tmp_request, SAKERequestResult_UNKNOWN_ERROR, NULL, NULL, this); - } -} - -bool sake_processor::is_result_ready() const { return (m_processing_request == false); } -void sake_processor::init_request_fields() -{ - using namespace gamespy_profile; - int ci = 0; - for (int i = 0; i < bst_score_types_count; ++i) - { - m_field_names_store[ci] = ATLAS_GET_STAT_NAME(get_best_score_id_stat(static_cast(i))); - ++ci; - } - for (int i = 0; i < at_awards_count; ++i) - { - int findex = i * ap_award_params_count; - m_field_names_store[ci + ap_award_id] = ATLAS_GET_STAT_NAME(get_award_id_stat(static_cast(i))); - m_field_names_store[ci + ap_award_rdate] = - ATLAS_GET_STAT_NAME(get_award_reward_date_stat(static_cast(i))); - ci += ap_award_params_count; - } - m_field_names_store[ci] = ATLAS_GET_STAT_NAME(STAT_PlayerName); -} - -bool sake_processor::process_record( - SAKESearchForRecordsInput* in, SAKEField* fields, gamespy_profile::profile_data& dest_data, std::string& dest_name) -{ - using namespace gamespy_profile; - int last_fi = 0; - dest_name.clear(); - for (int i = 0; i < in->mNumFields; ++i, ++last_fi) - { - if (strcmp(fields[last_fi].mName, in->mFieldNames[i])) - { - bool found = false; - last_fi = 0; - do - { - if (!strcmp(fields[last_fi].mName, in->mFieldNames[i])) - { - found = true; - break; - } - ++last_fi; - } while (last_fi < in->mNumFields); - if (!found) - { - last_fi = 0; - continue; - } - } - enum_awards_t tmp_award_id = get_award_by_stat_id_name(fields[last_fi].mName); - if (tmp_award_id < at_awards_count) - { - dest_data.m_awards[tmp_award_id].m_count = fields[last_fi].mValue.mShort; - continue; - } - tmp_award_id = get_award_by_stat_rdate_name(fields[last_fi].mName); - if (tmp_award_id < at_awards_count) - { - dest_data.m_awards[tmp_award_id].m_last_reward_date = fields[last_fi].mValue.mInt; - continue; - } - enum_best_score_type tmp_best_score_id = get_best_score_type_by_sname(fields[last_fi].mName); - if (tmp_best_score_id < bst_score_types_count) - { - dest_data.m_best_scores[tmp_best_score_id] = fields[last_fi].mValue.mInt; - continue; - } - if (strcmp(fields[last_fi].mName, ATLAS_GET_KEY_NAME(STAT_PlayerName))) - { - if (strlen(fields[last_fi].mValue.mAsciiString)) - { - dest_name = fields[last_fi].mValue.mAsciiString; - } - } - } - return !dest_name.empty(); -} - -void sake_processor::process_out_request(SAKESearchForRecordsInput* in, SAKESearchForRecordsOutput* out) -{ - using namespace gamespy_profile; - for (int ri = 0; ri < out->mNumRecords; ++ri) - { - profile_data tmp_data; - if (process_record(in, out->mRecords[ri], tmp_data, m_tmp_string)) - { - m_result_players.insert(std::make_pair(m_tmp_string, tmp_data)); - m_tmp_string.clear(); - } - } -} - -void sake_processor::request_callback( - SAKE sake, SAKERequest request, SAKERequestResult result, void* inputData, void* outputData, void* userData) -{ - sake_processor* me = static_cast(userData); - SAKESearchForRecordsInput* tmp_in = static_cast(inputData); - SAKESearchForRecordsOutput* tmp_out = static_cast(outputData); - if (tmp_out) - { - me->process_out_request(tmp_in, tmp_out); - me->m_current_offset += tmp_out->mNumRecords; - if ((tmp_out->mNumRecords == max_request_records) && - (static_cast(me->m_current_offset) < me->m_request_names.size())) - { - me->fetch(); - return; - } - } - me->m_processing_request = false; -} diff --git a/src/utils/mp_gpprof_server/gamespy_sake.h b/src/utils/mp_gpprof_server/gamespy_sake.h deleted file mode 100644 index 14b0f524411..00000000000 --- a/src/utils/mp_gpprof_server/gamespy_sake.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef GAMESPY_SAKE_INCLUDED -#define GAMESPY_SAKE_INCLUDED - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "profile_data_types.h" - -#undef max - -// must be singleton -class sake_processor -{ -public: - sake_processor(); - ~sake_processor(); - void think(gsi_time ms); - - void begin_fetch(); - void add_name(char const* name); - void fetch(); - - bool is_result_ready() const; - bool get_profile(char const* name, gamespy_profile::profile_data& dest_data); - -private: - struct core_initializer - { - core_initializer(); - ~core_initializer(); - }; - - class gp_processor - { - public: - gp_processor(); - bool login(); - ~gp_processor(); - - char m_login_ticket[GP_LOGIN_TICKET_LEN]; - GPProfile m_profile_id; - - private: - GPConnection m_connection; - bool m_complete; - static void login_result_cb(GPConnection* connection, void* arg, void* param); - }; - - core_initializer m_core_initilizer; - gp_processor m_gp_processor; - SAKE m_sake_inst; - - static unsigned int const merged_fields_count = - (gamespy_profile::at_awards_count * gamespy_profile::ap_award_params_count) + - gamespy_profile::bst_score_types_count + 1; //+1 = STAT_PlayerName - static int const max_request_records = 128; - typedef char* merged_fields_names_t[merged_fields_count]; - typedef std::map players_map_t; - typedef std::list player_names_t; - - merged_fields_names_t m_field_names_store; - SAKESearchForRecordsInput m_get_records_input; - bool m_processing_request; - int m_current_offset; - player_names_t m_request_names; - std::string m_tmp_string; - players_map_t m_result_players; - - void init_request_fields(); - bool create_request_string(); - void process_out_request(SAKESearchForRecordsInput* in, SAKESearchForRecordsOutput* out); - bool process_record(SAKESearchForRecordsInput* in, SAKEField* fields, gamespy_profile::profile_data& dest_data, - std::string& dest_name); - static void request_callback( - SAKE sake, SAKERequest request, SAKERequestResult result, void* inputData, void* outputData, void* userData); -}; // class sake_processor - -#endif //#ifndef GAMESPY_SAKE_INCLUDED diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/LICENSE.TERMS b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/LICENSE.TERMS deleted file mode 100644 index 7e6bdfded70..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/LICENSE.TERMS +++ /dev/null @@ -1,28 +0,0 @@ -This FastCGI application library source and object code (the -"Software") and its documentation (the "Documentation") are -copyrighted by Open Market, Inc ("Open Market"). The following terms -apply to all files associated with the Software and Documentation -unless explicitly disclaimed in individual files. - -Open Market permits you to use, copy, modify, distribute, and license -this Software and the Documentation for any purpose, provided that -existing copyright notices are retained in all copies and that this -notice is included verbatim in any distributions. No written -agreement, license, or royalty fee is required for any of the -authorized uses. Modifications to this Software and Documentation may -be copyrighted by their authors and need not follow the licensing -terms described here. If modifications to this Software and -Documentation have new licensing terms, the new terms must be clearly -indicated on the first page of each file where they apply. - -OPEN MARKET MAKES NO EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE -SOFTWARE OR THE DOCUMENTATION, INCLUDING WITHOUT LIMITATION ANY -WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN -NO EVENT SHALL OPEN MARKET BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY -DAMAGES ARISING FROM OR RELATING TO THIS SOFTWARE OR THE -DOCUMENTATION, INCLUDING, WITHOUT LIMITATION, ANY INDIRECT, SPECIAL OR -CONSEQUENTIAL DAMAGES OR SIMILAR DAMAGES, INCLUDING LOST PROFITS OR -LOST DATA, EVEN IF OPEN MARKET HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS". -OPEN MARKET HAS NO LIABILITY IN CONTRACT, TORT, NEGLIGENCE OR -OTHERWISE ARISING OUT OF THIS SOFTWARE OR THE DOCUMENTATION. diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.am b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.am deleted file mode 100644 index f666b13758b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -# -# Makefile for FastCGI development kit -# -# $Id: Makefile.am,v 1.7 2001/12/22 13:05:39 robs Exp $ -# - -SUBDIRS = libfcgi cgi-fcgi examples include - -include_HEADERS = fcgi_config.h - -EXTRA_DIST = LICENSE.TERMS \ - Makefile.nt \ - cgi-fcgi/cgi-fcgi.mak \ - examples/authorizer.mak \ - examples/echo.mak \ - examples/echox.mak \ - examples/size.mak \ - examples/echo-cpp.mak \ - libfcgi/libfcgi.mak \ - images/aplib-hd.gif \ - images/divider.gif \ - images/fcgi-hd.gif \ - images/mail-hd.gif \ - images/navbar.gif \ - images/serv-hd.gif \ - images/words-hd.gif \ - include/fcgi_config_x86.h \ - java/FCGIGlobalDefs.java \ - java/FCGIInputStream.java \ - java/FCGIInterface.java \ - java/FCGIMessage.java \ - java/FCGIOutputStream.java \ - java/FCGIRequest.java \ - libfcgi/os_unix.c \ - libfcgi/os_win32.c \ - perl/ChangeLog \ - perl/FCGI.PL \ - perl/FCGI.XL \ - perl/MANIFEST \ - perl/Makefile.PL \ - perl/README \ - perl/aclocal.m4 \ - perl/configure \ - perl/configure.in \ - perl/echo.PL \ - perl/fcgi_config.h.in \ - perl/oldinterface.pod \ - perl/remote.PL \ - perl/threaded.PL \ - perl/typemap \ - perl/version.pm \ - Win32/FastCGI.dsw \ - Win32/authorizer.dsp \ - Win32/cgifcgi.dsp \ - Win32/echo-cpp.dsp \ - Win32/echo.dsp \ - Win32/echox.dsp \ - Win32/libfcgi.dsp \ - Win32/logdump.dsp \ - Win32/size.dsp \ - Win32/threaded.dsp \ - doc/FCGI_Accept.3 \ - doc/FCGI_Finish.3 \ - doc/FCGI_SetExitStatus.3 \ - doc/FCGI_StartFilterData.3 \ - doc/cgi-fcgi.1 \ - doc/fcgi-devel-kit.htm \ - doc/fcgi-java.htm \ - doc/fcgi-perf.htm \ - doc/fcgi-perl.htm \ - doc/fcgi-spec.html \ - doc/fcgi-tcl.htm \ - doc/omi-logo.gif \ - doc/overview.html \ - doc/www5-api-workshop.html \ - doc/fastcgi-prog-guide/ap_guida.htm \ - doc/fastcgi-prog-guide/ap_guide.htm \ - doc/fastcgi-prog-guide/apaman.htm \ - doc/fastcgi-prog-guide/ch1inta1.gif \ - doc/fastcgi-prog-guide/ch1intra.gif \ - doc/fastcgi-prog-guide/ch1intro.htm \ - doc/fastcgi-prog-guide/ch2c.htm \ - doc/fastcgi-prog-guide/ch3perl.htm \ - doc/fastcgi-prog-guide/ch4tcl.htm \ - doc/fastcgi-prog-guide/cover.htm \ - doc/fastcgi-prog-guide/covera.gif \ - doc/fastcgi-whitepaper/fastcgi.htm \ - doc/fastcgi-whitepaper/img00001.gif \ - doc/fastcgi-whitepaper/img00002.gif \ - doc/fastcgi-whitepaper/img00003.gif - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.in deleted file mode 100644 index c40836ffdf9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.in +++ /dev/null @@ -1,534 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# -# Makefile for FastCGI development kit -# -# $Id: Makefile.am,v 1.7 2001/12/22 13:05:39 robs Exp $ -# - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_CPP = @ECHO_CPP@ -EXEEXT = @EXEEXT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBFCGIXX = @LIBFCGIXX@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -SYSTEM = @SYSTEM@ -THREADED = @THREADED@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -SUBDIRS = libfcgi cgi-fcgi examples include - -include_HEADERS = fcgi_config.h - -EXTRA_DIST = LICENSE.TERMS \ - Makefile.nt \ - cgi-fcgi/cgi-fcgi.mak \ - examples/authorizer.mak \ - examples/echo.mak \ - examples/echox.mak \ - examples/size.mak \ - examples/echo-cpp.mak \ - libfcgi/libfcgi.mak \ - images/aplib-hd.gif \ - images/divider.gif \ - images/fcgi-hd.gif \ - images/mail-hd.gif \ - images/navbar.gif \ - images/serv-hd.gif \ - images/words-hd.gif \ - include/fcgi_config_x86.h \ - java/FCGIGlobalDefs.java \ - java/FCGIInputStream.java \ - java/FCGIInterface.java \ - java/FCGIMessage.java \ - java/FCGIOutputStream.java \ - java/FCGIRequest.java \ - libfcgi/os_unix.c \ - libfcgi/os_win32.c \ - perl/ChangeLog \ - perl/FCGI.PL \ - perl/FCGI.XL \ - perl/MANIFEST \ - perl/Makefile.PL \ - perl/README \ - perl/aclocal.m4 \ - perl/configure \ - perl/configure.in \ - perl/echo.PL \ - perl/fcgi_config.h.in \ - perl/oldinterface.pod \ - perl/remote.PL \ - perl/threaded.PL \ - perl/typemap \ - perl/version.pm \ - Win32/FastCGI.dsw \ - Win32/authorizer.dsp \ - Win32/cgifcgi.dsp \ - Win32/echo-cpp.dsp \ - Win32/echo.dsp \ - Win32/echox.dsp \ - Win32/libfcgi.dsp \ - Win32/logdump.dsp \ - Win32/size.dsp \ - Win32/threaded.dsp \ - doc/FCGI_Accept.3 \ - doc/FCGI_Finish.3 \ - doc/FCGI_SetExitStatus.3 \ - doc/FCGI_StartFilterData.3 \ - doc/cgi-fcgi.1 \ - doc/fcgi-devel-kit.htm \ - doc/fcgi-java.htm \ - doc/fcgi-perf.htm \ - doc/fcgi-perl.htm \ - doc/fcgi-spec.html \ - doc/fcgi-tcl.htm \ - doc/omi-logo.gif \ - doc/overview.html \ - doc/www5-api-workshop.html \ - doc/fastcgi-prog-guide/ap_guida.htm \ - doc/fastcgi-prog-guide/ap_guide.htm \ - doc/fastcgi-prog-guide/apaman.htm \ - doc/fastcgi-prog-guide/ch1inta1.gif \ - doc/fastcgi-prog-guide/ch1intra.gif \ - doc/fastcgi-prog-guide/ch1intro.htm \ - doc/fastcgi-prog-guide/ch2c.htm \ - doc/fastcgi-prog-guide/ch3perl.htm \ - doc/fastcgi-prog-guide/ch4tcl.htm \ - doc/fastcgi-prog-guide/cover.htm \ - doc/fastcgi-prog-guide/covera.gif \ - doc/fastcgi-whitepaper/fastcgi.htm \ - doc/fastcgi-whitepaper/img00001.gif \ - doc/fastcgi-whitepaper/img00002.gif \ - doc/fastcgi-whitepaper/img00003.gif - -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = fcgi_config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(include_HEADERS) - - -RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ - uninstall-info-recursive all-recursive install-data-recursive \ - install-exec-recursive installdirs-recursive install-recursive \ - uninstall-recursive check-recursive installcheck-recursive -DIST_COMMON = README $(include_HEADERS) ./stamp-h.in Makefile.am \ - Makefile.in acinclude.m4 aclocal.m4 compile config.guess \ - config.sub configure configure.in depcomp fcgi_config.h.in \ - install-sh ltmain.sh missing mkinstalldirs -DIST_SUBDIRS = $(SUBDIRS) -all: fcgi_config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$@ $(SHELL) ./config.status - -$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -$(ACLOCAL_M4): configure.in acinclude.m4 - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) -fcgi_config.h: stamp-h - @if test ! -f $@; then \ - rm -f stamp-h; \ - $(MAKE) stamp-h; \ - else :; fi -stamp-h: $(srcdir)/fcgi_config.h.in $(top_builddir)/config.status - @rm -f stamp-h stamp-hT - @echo timestamp > stamp-hT 2> /dev/null - cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=fcgi_config.h \ - $(SHELL) ./config.status - @mv stamp-hT stamp-h -$(srcdir)/fcgi_config.h.in: $(srcdir)/./stamp-h.in - @if test ! -f $@; then \ - rm -f $(srcdir)/./stamp-h.in; \ - $(MAKE) $(srcdir)/./stamp-h.in; \ - else :; fi -$(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) - @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT - @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null - cd $(top_srcdir) && $(AUTOHEADER) - @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in - -distclean-hdr: - -rm -f fcgi_config.h -uninstall-info-am: -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(INSTALL_HEADER) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ - $(INSTALL_HEADER) $$d$$p $(DESTDIR)$(includedir)/$$f; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ - rm -f $(DESTDIR)$(includedir)/$$f; \ - done - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) fcgi_config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)fcgi_config.h.in$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags fcgi_config.h.in $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = . -# Avoid unsightly `./'. -distdir = $(PACKAGE)-$(VERSION) - -GZIP_ENV = --best - -distdir: $(DISTFILES) - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) - mkdir $(distdir) - $(mkinstalldirs) $(distdir)/Win32 $(distdir)/cgi-fcgi $(distdir)/doc $(distdir)/doc/fastcgi-prog-guide $(distdir)/doc/fastcgi-whitepaper $(distdir)/examples $(distdir)/images $(distdir)/include $(distdir)/java $(distdir)/libfcgi $(distdir)/perl - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - chmod a-w $(distdir) - dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ - && cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ - || (echo "Error: files left after uninstall" 1>&2; \ - exit 1) ) \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && $(MAKE) $(AM_MAKEFLAGS) distclean \ - && rm -f $(distdir).tar.gz \ - && (test `find . -type f -print | wc -l` -eq 0 \ - || (echo "Error: files left after distclean" 1>&2; \ - exit 1) ) - -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) - @echo "$(distdir).tar.gz is ready for distribution" | \ - sed 'h;s/./=/g;p;x;p;x' -check-am: all-am -check: check-recursive -all-am: Makefile $(HEADERS) fcgi_config.h -installdirs: installdirs-recursive -installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(includedir) - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -dist-all: distdir - $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) -distclean: distclean-recursive - -rm -f config.status config.cache config.log -distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: install-includeHEADERS - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -uninstall-am: uninstall-includeHEADERS uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive dist dist-all \ - distcheck distclean distclean-generic distclean-hdr \ - distclean-libtool distclean-recursive distclean-tags distdir \ - dvi dvi-am dvi-recursive info info-am info-recursive install \ - install-am install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-includeHEADERS install-info install-info-am \ - install-info-recursive install-man install-recursive \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am installdirs-recursive maintainer-clean \ - maintainer-clean-generic maintainer-clean-recursive mostlyclean \ - mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ - tags tags-recursive uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.nt b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.nt deleted file mode 100644 index 466f8091934..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Makefile.nt +++ /dev/null @@ -1,47 +0,0 @@ -# -# Windows Makefile for FastCGI development kit -# -# $Id: Makefile.nt,v 1.4 2001/11/27 14:02:54 robs Exp $ -# - -!IF "$(CFG)" == "" -CFG=release -!ENDIF - -all: "include\fcgi_config.h" - cd ".\libfcgi" - $(MAKE) $(MAKEFLAGS) /NOLOGO /F libfcgi.mak CFG=$(CFG) $@ - - cd ".\..\cgi-fcgi" - $(MAKE) $(MAKEFLAGS) /NOLOGO /F cgi-fcgi.mak CFG=$(CFG) $@ - - cd ".\..\examples" - $(MAKE) $(MAKEFLAGS) /NOLOGO /F authorizer.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F echo.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F echox.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F size.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F echo-cpp.mak CFG=$(CFG) $@ - - cd ".\.." - -"include\fcgi_config.h": "include\fcgi_config_x86.h" - copy "include\fcgi_config_x86.h" "include\fcgi_config.h" - -clean: - cd ".\libfcgi" - $(MAKE) $(MAKEFLAGS) /NOLOGO /F libfcgi.mak CFG=$(CFG) $@ - - cd ".\..\cgi-fcgi" - $(MAKE) $(MAKEFLAGS) /NOLOGO /F cgi-fcgi.mak CFG=$(CFG) $@ - - cd ".\..\examples" - $(MAKE) $(MAKEFLAGS) /NOLOGO /F authorizer.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F echo.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F echox.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F size.mak CFG=$(CFG) $@ - $(MAKE) $(MAKEFLAGS) /NOLOGO /F echo-cpp.mak CFG=$(CFG) $@ - - cd ".\.." - -install: - @echo "Sorry, the install target hasn't been written yet" diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/README b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/README deleted file mode 100644 index 6cd00f116cb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/README +++ /dev/null @@ -1,400 +0,0 @@ -FastCGI Developer's Kit README ------------------------------- - - $Id: README,v 1.21 2003/01/19 17:19:41 robs Exp $ - Copyright (c) 1996 Open Market, Inc. - See the file "LICENSE.TERMS" for information on usage and redistribution - of this file, and for a DISCLAIMER OF ALL WARRANTIES. - -Basic Directions ----------------- - -Unix: - - ./configure - make - make install - -Win32: - - nmake -f Makefile.nt - - (or use the MSVC++ project files in the Win32 directory) - - -CHANGES -------- - -For more detail regarding changes, please consult the cvs log available -on http://fastcgi.com/. - - -2.4.0 ------ - - *) When closing connections, shutdown() the send side of TCP sockets to - prevent a TCP RST from trashing the reciept of data on the client (when - the client continues to send data to the application). - - *) [WIN32] force an exit from the ShutdownRequestThread when a shutdown is - signaled and NamedPipes are in use. - - *) Use streamsize and char_type in the C++ API. - - *) [WIN32] Eliminate the (partial and broken) use of OverlappedIO - this - was causing a loose spin in acceptNamedPipe(). - - *) Fix a bug that caused an assert to pop when an async file descriptor was - numbered greater than 16. Kevin Eye [eye@buffalo.edu] - - *) Update the echo-cpp example to show the restoral of the original - streambufs. Trub, Vladimir [vtrub@purolator.com] - - *) Fix a bug a that caused the lib to crash under certain circumstances - when an error occured on a read - - *) Test for iostreams that support a streambuf assigment operator - - *) (WIN32) Fixed initialization of the accept mutex when OpenSocket() was used. - Niklas Bergh [niklas.bergh@tific.com] - - -2.2.2 ------ - - *) Added support for shared libraries. - - *) Added support for a graceful shutdown via an event under Win32. - - *) Added default signal handlers for PIPE, USR1, and TERM. - - *) Fix some minor bugs in the 0S_ layer. - - *) Fixed the C++ streambuf implementation. - - -Changes with devkit 2.1.1 -------------------------- - - *) Fixed an unintentional sign extension during promotion in Java's - FCGIInputStream.read(). Takayuki Tachikawa - - *) Cleaned up warnings in examples (mostly main() complaints). - - *) Removed examples/tiny-cgi.c (it wasn't a FastCGI application?!). - - *) Remove some debugging code and clean up some gcc warnings in cgi-fcgi.c. - - *) Add multithread support to the fcgiapp lib and an example multithreaded - application, threaded.c. Based on work by Dennis Payne - and Gene Sokolov . - - *) Remove the printf() and #include of stdio.h from examples/echo2.c. - - *) Remove the static initialization of _fcgi_sF[] because on glibc 2.x based - systems stdin/stdout/stderr are no longer static. - - *) Flush FastCGI buffers at application exit. - - << INSERT OTHER STUFF HERE >> - - -What's New: Version 2.0b2, 04 April 1997 --------------------------------------- - -Some additional bug fixes, mostly on NT port. The following list -of the bugs that have been and fixed: - 1. Updated build_no_shell.bat to create a FcgiBin directory under the - top level of the FastCGI kit and copy all executables and the - FastCGI dll there. This makes it easier to use. - 2. Corrected the Unix version of OS_SpawnChild so that it didn't close - the listenFd when forking off child processes. This code would - affect the cgi-fcgi application on Unix. The problem is that it - could only start one fastcgi process. Any other processes would not - get the listen file descriptor and they would die. - 3. Corrected cgi-fcgi.c so that it properly handled large posts. The - bug was introduced with the asynchronous I/O model implemented for - the Windows NT port. The problem was not clearing a bit indicating - that a read had completed. This caused the application to stall. - 4. Corrected OS_DoIo, the function used for scheduling I/O for cgi-fcgi. - It had a bug where it wasn't creating a copy of the file descriptors - used for I/O. This would cause the master list of FDs to watch to be - reset and thus would hang the application because we would no longer - watch for I/O on those file descriptors. (This problem was specific to - Unix and only happened with the cgi-fcgi application.) - 5. Cleaned up several compilation warnings present on OSF. - - -What's New: Version 2.0b1, 24 March 1997 --------------------------------------- - -This "beta" release adds the functionality of "cgi-fcgi" to the -Windows NT platform and allows for creation of FastCGI applications -running in Win32 environment. There is almost no new documentation -provided, but will become part of this kit in the official release. - 1. Added FastCGI libraries running on Windows NT 3.51+ - 2. Rename errno to FCGI_errno in the FCGX_Stream, which was causing - problems on some Linux platforms and NT. - 3. Fixed a parenthesis problem in FCGI_gets - - -What's New: Version 1.5.1, 12 December 1996 --------------------------------------- - -This release introduces mostly bug fixes, without any additional -functionality to the kit. - 1. Conditional compilation for the hp-ux compiler. - 2. Loop around the accept() call to eliminate "OS Error: Interrupted - System Call" message from appearing in the error logs. - 3. Casting of the FCGI_Header to (char *), which eliminates the - assertion failure "bufPtr->size>0". - - -What's New: Version 1.5, 12 June 1996 --------------------------------------- - -General: - - Added a white paper on FastCGI application performance to the - doc directory. Generally brought the other docs up to date. - - Rearranged the kit to put more emphasis on running FastCGI-capable - servers and less on running cgi-fcgi. Added - examples/conf/om-httpd.config, a config file that demonstrates all - of the example apps. (Would like to have similar configs for NCSA - and Apache.) - - Added the tiny-authorizer and sample-store applications to - the examples. These are explained in the index.html. - - In addition to everything else it does, sample-store demonstrates - a bug in the Open Market WebServer 2.0: When an Authorizer - application denies access, the server tacks some extra junk onto - the end of the page the application returns. A little ugly but - not fatal. - -C libraries: - - Added the functions FCGX_Finish and FCGI_Finish. These functions - finish the current request from the HTTP server but do not begin a - new request. These functions make it possible for applications to - perform other processing between requests. An application must not - use its stdin, stdout, stderr, or environ between calling - FCGI_Finish and calling FCGI_Accept. See doc/FCGI_Finish.3 for - more information. The application examples/sample-store.c demonstrates - the use of FCGI_Finish. - - Added conditional 'extern "C"' stuff to the .h files fcgi_stdio.h, - fcgiapp.h, and fcgiappmisc.h for the benefit of C++ applications - (suggested by Jim McCarthy). - - Fixed two bugs in FCGX_VFPrintF (reported by Ben Laurie). These - bugs affected processing of %f format specifiers and of all format - specifiers containing a precision spec (e.g "%12.4g"). - - Fixed a bug in FCGX_Accept in which the environment variable - FCGI_WEBSERVER_ADDRS was being read rather than the specified - FCGI_WEB_SERVER_ADDRS. Fixed a bug in FCGX_Accept in which the - wrong storage was freed when FCGI_WEB_SERVER_ADDRS contained more - than one address or if the address check failed. - - Changed FCGX_Accept to avoid depending upon accept(2) returning the - correct value of sin_family in the socketaddr structure for an - AF_UNIX connection (SCO returns the wrong value, as reported by Paul - Mahoney). - - Changed the error retry logic in FCGX_Accept. FCGX_Accept now - returns -1 only in case of operating system errors that occur while - accepting a connection (e.g. out of file descriptors). Other errors - cause the current connection to be dropped and a new connection to - be attempted. - -Perl: - - Changed FCGI.xs to make it insensitive to Perl's treatment of - environ (we hope). Changed FCGI::accept so the initial environment - variables are not unset on the first call to FCGI::accept (or on - subsequent calls either). Added the echo-perl example - program. Added a workaround for the "empty initial environment bug" - to tiny-perl-fcgi. Changed the example Perl scripts to use a new - symbolic link ./perl, avoiding the HP-UX 32 character limit on the - first line of a command interpreter file. - - Because the FastCGI-enabled Perl interpreter uses the C fcgi_stdio - library, it picks up all the changes listed above for C. There's - a new Perl subroutine FCGI::finish. - -Tcl: - - Fixed a bug in tclFCGI.c that caused the request environment - variables to be lost. Changed FCGI_Accept so the initial - environment variables are not unset on the first call to FCGI_Accept - (or on subsequent calls either). Added the echo-tcl example - program. Fixed another bug that caused Tcl to become confused by - file opens; as a side effect of this change, writes to stdout/stderr - that occur in an app running as FastCGI before FCGI_Accept is called - are no-ops rather than crashing Tcl. Changed the example Tcl - scripts to use a new symbolic link ./tclsh, avoiding the HP-UX 32 - character limit on the first line of a command interpreter file. - - Because the FastCGI-enabled Tcl interpreter uses the C fcgi_stdio - library, it picks up all the changes listed above for C; there's - a new Tcl command FCGI_Finish. - -Java: - - Fixed a sign-extension bug in FCGIMessage.java that caused bad encodings - of names and values in name-value pairs for lengths in [128..255]. - Made small cleanups in the Java example programs to make them more - consistent with the other examples. - - - -What's New: Version 1.4, 10 May 1996 --------------------------------------- - -Includes Java classes and Java examples. - - - -What's New: Version 1.3.1, 6 May 1996 --------------------------------------- - -New, simplified, license terms. Includes an expanded whitepaper that -describes FastCGI support in Open Market's Secure WebServer 2.0. -Includes Open Market FastCGI 1.0 Programmer's Guide. Includes -"FastCGI: A High-Performance Gateway Interface", a position paper -presented at the workshop "Programming the Web - a search for APIs", -Fifth International World Wide Web Conference, 6 May 1996, Paris, -France. - - - -What's New: Version 1.3, 29 April 1996 --------------------------------------- - -First public release; new license terms on all files. - -Changed cgi-fcgi.c to use SO_REUSEADDR when creating the listening socket; -this avoids the need to wait through the TIME_WAIT state on all the TCP -connections made by the previous instance of an external application -you are restarting. - - - -What's New: Version 1.2.2, 15 April 1996 ----------------------------------------- - -Partially fixed a bug in Perl's FCGI::accept (source file FCGI.xs). -The per-request environment variables were being lost. Now the -per-request environment variables show up correctly, except that if -the Perl application has an empty initial environment, the environment -variables associated with the *first* request are lost. Therefore, -when starting Perl, always set some environment variable using the -AppClass -initial-env option, or by running cgi-fcgi in a non-empty -environment. - - - -What's New: Version 1.2.1, 22 March 1996 ----------------------------------------- - -Fixed a bug in FCGI_Accept. If your application running as FastCGI -opened a file before calling FCGI_Accept, it would decide that it -was really running as CGI. Things went downhill quickly after that! - -Also added advisory locking to serialize calls to accept on shared -listening sockets on Solaris and IRIX, to work around problems -with concurrent accept calls on these platforms. - - - -What's New: Version 1.2, 20 March 1996 --------------------------------------- - -1. This version of the kit implements the most recent draft -of the protocol spec. Enhancements to the protocol include -a BEGIN_REQUEST record that simplifies request ID management -and transmits role and keep-alive information, and a simplified -end-of-stream indication. - -The protocol spec has been revised to describe exactly what's -been implemented, leaving out the features that we hope to -introduce in later releases. - -At the application level, the visible change is the FCGI_ROLE -variable that's available to applications. This allows an application -to check that it has been invoked in the expected role. A single -application can be written to respond in several roles. The -FCGI_Accept.3 manpage contains more information. - -2. We introduced the new "module" prefix FCGX in order to simplify -the relationship between fcgi_stdio and fcgiapp. - -A growing number of functions are provided in both fcgi_stdio and -fcgiapp versions. Rather than inventing an ad hoc solution for each -naming conflict (as we did with FCGI_accept and FCGI_Accept), we've -bitten the bullet and systematically renamed *all* the fcgapp -primitives with the prefix FCGX_. In fcgi_stdio, we've renamed -FCGI_accept to FCGI_Accept. So all functions that are common in the -two libraries have the same name modulo the different prefixes. - -The Accept function visible in Tcl is now called FCGI_Accept, not -FCGI_accept. - -The Accept function visible in Perl is now FCGI::accept. All -lower case names for functions and all upper case names for -modules appears to be a Perl convention, so we conform. - -3. The kit now fully supports the Responder, Authorizer, -and Filter roles. - -The Filter role required a new function, FCGI_StartFilterData. -FCGI_StartFilterData changes the input stream from reading -FCGI_STDIN data to reading FCGI_DATA data. The manpage -gives full details. - -Another new function, FCGI_SetExitStatus, is primarily for -the Responder role but is available to all. FCGI_SetExitStatus -allows an application to set a nonzero "exit" status -before completing a request and calling FCGI_Accept again. -The manpage gives full details. - -These two new functions are provided at both the fcgi_stdio interface -and the basic fcgiapp interface. Naturally, the fcgiapp versions are -called FCGX_StartFilterData and FCGX_SetExitStatus. - -4. The fcgiapp interface changed slightly in order to treat -the streams and environment data more symmetrically. - -FCGX_Accept now returns an environment pointer, rather than requiring -a call to FCGX_GetAllParams to retrieve an environment pointer. -FCGX_GetParam takes an explicit environment pointer argument. -FCGX_GetAllParams is eliminated. See the documentation in the header -file for complete information. - -fcgiapp also added the procedure FCGX_IsCGI, providing a standardized -test of whether the app was started as CGI or FastCGI. - -5. We've ported the kits to vendor-supported ANSI C compilers -on Sun (Solaris 2.X), HP, and Digital platforms. GCC can be -selected on these platforms by performing SETENV CC gcc before -running configure. - - - -What's New: Version 1.1, 30 Jan 1996 ------------------------------------- - -1. More platforms: Digital UNIX, IBM AIX, Silicon Graphics IRIX, -Sun SunOS 4.1.4. - -2. Perl and Tcl: Simple recipes for producing Perl and Tcl -interpreters that run as FastCGI applications. No source -code changes are needed to Perl and Tcl. Documented -in separate documents, accessible via the index page. - - - -Version 1.0, 10 Jan 1996 ------------------------- diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/FastCGI.dsw b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/FastCGI.dsw deleted file mode 100644 index 1418cc36c36..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/FastCGI.dsw +++ /dev/null @@ -1,164 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "authorizer"=".\authorizer.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "cgifcgi"=".\cgifcgi.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "config_h"=".\config_h.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "echo"=".\echo.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "echo_cpp"=".\echo-cpp.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "echox"=".\echox.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "libfcgi"=".\libfcgi.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name config_h - End Project Dependency -}}} - -############################################################################### - -Project: "logdump"=".\logdump.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "size"=".\size.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Project: "threaded"=".\threaded.dsp" - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name libfcgi - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/authorizer.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/authorizer.dsp deleted file mode 100644 index 5e83fec20c6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/authorizer.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="authorizer" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=authorizer - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "authorizer.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "authorizer.mak" CFG="authorizer - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "authorizer - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "authorizer - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "authorizer - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\authorizer\Release" -# PROP Intermediate_Dir "..\examples\authorizer\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "authorizer - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\examples/authorizer/Debug" -# PROP Intermediate_Dir "..\examples/authorizer/Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "authorizer - Win32 Release" -# Name "authorizer - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\examples\authorizer.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/cgifcgi.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/cgifcgi.dsp deleted file mode 100644 index c522a2107dd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/cgifcgi.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cgifcgi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=cgifcgi - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "cgifcgi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cgifcgi.mak" CFG="cgifcgi - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cgifcgi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "cgifcgi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cgifcgi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\cgi-fcgi\Release" -# PROP Intermediate_Dir "..\cgi-fcgi\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"..\cgi-fcgi\Release\cgi-fcgi.exe" /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "cgifcgi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../cgi-fcgi/Debug" -# PROP Intermediate_Dir "../cgi-fcgi/Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"..\cgi-fcgi\Debug\cgi-fcgi.exe" /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "cgifcgi - Win32 Release" -# Name "cgifcgi - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE="..\cgi-fcgi\cgi-fcgi.c" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echo-cpp.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echo-cpp.dsp deleted file mode 100644 index b3199805e82..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echo-cpp.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="echo_cpp" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=echo_cpp - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "echo-cpp.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "echo-cpp.mak" CFG="echo_cpp - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "echo_cpp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "echo_cpp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "echo_cpp - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "echo-cpp\Release" -# PROP BASE Intermediate_Dir "echo-cpp\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\echo-cpp\Release" -# PROP Intermediate_Dir "..\examples\echo-cpp\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /GX /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "echo_cpp - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../examples/echo-cpp\Debug" -# PROP Intermediate_Dir "../examples/echo-cpp\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "echo_cpp - Win32 Release" -# Name "echo_cpp - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE="..\examples\echo-cpp.cpp" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echo.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echo.dsp deleted file mode 100644 index d7e94103e2d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echo.dsp +++ /dev/null @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="echo" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=echo - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "echo.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "echo.mak" CFG="echo - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "echo - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "echo - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "echo - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "echo\Release" -# PROP BASE Intermediate_Dir "echo\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\echo\Release" -# PROP Intermediate_Dir "..\examples\echo\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /GX- /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "echo - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../examples/echo\Debug" -# PROP Intermediate_Dir "../examples/echo\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /GX- /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /map /debug /machine:IX86 /libpath:"..\libfcgi\Debug" -# SUBTRACT LINK32 /verbose - -!ENDIF - -# Begin Target - -# Name "echo - Win32 Release" -# Name "echo - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\examples\echo.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echox.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echox.dsp deleted file mode 100644 index 77e7870f8fd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/echox.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="echox" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=echox - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "echox.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "echox.mak" CFG="echox - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "echox - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "echox - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "echox - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "echo-x\Release" -# PROP BASE Intermediate_Dir "echo-x\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\echo-x\Release" -# PROP Intermediate_Dir "..\examples\echo-x\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /GX- /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"..\examples\echo-x\Release\echo-x.exe" /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "echox - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../examples/echo-x\Debug" -# PROP Intermediate_Dir "../examples/echo-x\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /GX- /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"..\examples\echo-x\Debug\echo-x.exe" /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "echox - Win32 Release" -# Name "echox - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE="..\examples\echo-x.c" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/libfcgi.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/libfcgi.dsp deleted file mode 100644 index 56eea1d34cb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/libfcgi.dsp +++ /dev/null @@ -1,175 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libfcgi" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libfcgi - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libfcgi.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libfcgi.mak" CFG="libfcgi - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libfcgi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libfcgi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libfcgi - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\libfcgi\Release" -# PROP Intermediate_Dir "..\libfcgi\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /O2 /Ob2 /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBFCGI_EXPORTS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 Ws2_32.lib /nologo /dll /pdb:none /machine:I386 -# SUBTRACT LINK32 /verbose /nodefaultlib - -!ELSEIF "$(CFG)" == "libfcgi - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\libfcgi\Debug" -# PROP Intermediate_Dir "..\libfcgi\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "LIBFCGI_EXPORTS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 Ws2_32.lib /nologo /dll /profile /map /debug /machine:I386 -# SUBTRACT LINK32 /verbose /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "libfcgi - Win32 Release" -# Name "libfcgi - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\libfcgi\fcgi_stdio.c -# End Source File -# Begin Source File - -SOURCE=..\libfcgi\fcgiapp.c -# End Source File -# Begin Source File - -SOURCE=..\libfcgi\fcgio.cpp - -!IF "$(CFG)" == "libfcgi - Win32 Release" - -# ADD CPP /GX - -!ELSEIF "$(CFG)" == "libfcgi - Win32 Debug" - -# ADD CPP /W3 /GX - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\libfcgi\os_unix.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=..\libfcgi\os_win32.c -# End Source File -# Begin Source File - -SOURCE=..\libfcgi\strerror.c -# PROP Exclude_From_Build 1 -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\include\fastcgi.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgi_config.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgi_config_x86.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgi_stdio.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgiapp.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgimisc.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgio.h -# End Source File -# Begin Source File - -SOURCE=..\include\fcgios.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/logdump.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/logdump.dsp deleted file mode 100644 index 4d0074d6723..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/logdump.dsp +++ /dev/null @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="logdump" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=logdump - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "logdump.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "logdump.mak" CFG="logdump - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "logdump - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "logdump - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "logdump - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "log-dump\Release" -# PROP BASE Intermediate_Dir "log-dump\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\log-dump\Release" -# PROP Intermediate_Dir "..\examples\log-dump\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /GX- /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"..\examples\log-dump\Release\log-dump.exe" /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "logdump - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../examples/log-dump\Debug" -# PROP Intermediate_Dir "../examples/log-dump\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /GX- /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"..\examples\log-dump\Debug\log-dump.exe" /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "logdump - Win32 Release" -# Name "logdump - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE="..\examples\log-dump.c" -# PROP Exclude_From_Build 1 -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/size.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/size.dsp deleted file mode 100644 index 9bafd29ac31..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/size.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="size" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=size - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "size.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "size.mak" CFG="size - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "size - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "size - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "size - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "size\Release" -# PROP BASE Intermediate_Dir "size\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\size\Release" -# PROP Intermediate_Dir "..\examples\size\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /GX- /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "size - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "../examples/size\Debug" -# PROP Intermediate_Dir "../examples/size\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /GX- /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "size - Win32 Release" -# Name "size - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\examples\size.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/threaded.dsp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/threaded.dsp deleted file mode 100644 index bce2268679d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/Win32/threaded.dsp +++ /dev/null @@ -1,109 +0,0 @@ -# Microsoft Developer Studio Project File - Name="threaded" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=threaded - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "threaded.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "threaded.mak" CFG="threaded - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "threaded - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "threaded - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "threaded - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\examples\threaded\Release" -# PROP Intermediate_Dir "..\examples\threaded\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /Gi /GX /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release" - -!ELSEIF "$(CFG)" == "threaded - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\examples/threaded/Debug" -# PROP Intermediate_Dir "..\examples/threaded/Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W4 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug" - -!ENDIF - -# Begin Target - -# Name "threaded - Win32 Release" -# Name "threaded - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\examples\threaded.c -# PROP Exclude_From_Build 1 -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/acinclude.m4 b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/acinclude.m4 deleted file mode 100644 index ab199359485..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/acinclude.m4 +++ /dev/null @@ -1,391 +0,0 @@ -dnl $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ - -AC_DEFUN(FCGI_COMMON_CHECKS, [ - AC_CHECK_TYPE([ssize_t], [int]) - - AC_MSG_CHECKING([for sun_len in sys/un.h]) - AC_EGREP_HEADER([sun_len], [sys/un.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1], - [Define if sockaddr_un in sys/un.h contains a sun_len component])], - AC_MSG_RESULT([no])) - - AC_MSG_CHECKING([for fpos_t in stdio.h]) - AC_EGREP_HEADER([fpos_t], [stdio.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FPOS], [1], - [Define if the fpos_t typedef is in stdio.h])], - AC_MSG_RESULT([no])) - - AC_CHECK_HEADERS([sys/socket.h netdb.h netinet/in.h arpa/inet.h]) - AC_CHECK_HEADERS([sys/time.h limits.h sys/param.h unistd.h]) - - AC_MSG_CHECKING([for a fileno() prototype in stdio.h]) - AC_EGREP_HEADER([fileno], [stdio.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FILENO_PROTO], [1], - [Define if there's a fileno() prototype in stdio.h])], - AC_MSG_RESULT([no])) - - if test "$HAVE_SYS_SOCKET_H"; then - AC_MSG_CHECKING([for socklen_t in sys/socket.h]) - AC_EGREP_HEADER([socklen_t], [sys/socket.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_SOCKLEN], [1], - [Define if the socklen_t typedef is in sys/socket.h])], - AC_MSG_RESULT([no])) - fi - - #-------------------------------------------------------------------- - # Do we need cross-process locking on this platform? - #-------------------------------------------------------------------- - AC_MSG_CHECKING([whether cross-process locking is required by accept()]) - case "`uname -sr`" in - IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0) - AC_MSG_RESULT([yes]) - AC_DEFINE([USE_LOCKING], [1], - [Define if cross-process locking is required by accept()]) - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac - - #-------------------------------------------------------------------- - # Does va_arg(arg, long double) crash the compiler? - # hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler) - #-------------------------------------------------------------------- - AC_MSG_CHECKING([whether va_arg(arg, long double) crashes the compiler]) - AC_TRY_COMPILE([#include ], - [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);], - AC_MSG_RESULT([no]), - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_VA_ARG_LONG_DOUBLE_BUG], [1], - [Define if va_arg(arg, long double) crashes the compiler])]) - - AC_C_CONST -]) - - -dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -dnl -dnl This macro figures out how to build C programs using POSIX -dnl threads. It sets the PTHREAD_LIBS output variable to the threads -dnl library and linker flags, and the PTHREAD_CFLAGS output variable -dnl to any special C compiler flags that are needed. (The user can also -dnl force certain compiler flags/libs to be tested by setting these -dnl environment variables.) -dnl -dnl Also sets PTHREAD_CC to any special C compiler that is needed for -dnl multi-threaded programs (defaults to the value of CC otherwise). -dnl (This is necessary on AIX to use the special cc_r compiler alias.) -dnl -dnl If you are only building threads programs, you may wish to -dnl use these variables in your default LIBS, CFLAGS, and CC: -dnl -dnl LIBS="$PTHREAD_LIBS $LIBS" -dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -dnl CC="$PTHREAD_CC" -dnl -dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute -dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE -dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -dnl -dnl ACTION-IF-FOUND is a list of shell commands to run if a threads -dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands -dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, -dnl the default action will define HAVE_PTHREAD. -dnl -dnl Please let the authors know if this macro fails on any platform, -dnl or if you have any other suggestions or comments. This macro was -dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) -dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread -dnl macros posted by AFC to the autoconf macro repository. We are also -dnl grateful for the helpful feedback of numerous users. -dnl -dnl @version $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ -dnl @author Steven G. Johnson and Alejandro Forero Cuervo - -AC_DEFUN([ACX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -acx_pthread_ok=no - -# First, check if the POSIX threads header, pthread.h, is available. -# If it isn't, don't bother looking for the threads libraries. -AC_CHECK_HEADER(pthread.h, , acx_pthread_ok=noheader) - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) - AC_MSG_RESULT($acx_pthread_ok) - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all. - -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# pthread: Linux, etcetera -# --thread-safe: KAI C++ - -case "${host_cpu}-${host_os}" in - *solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthread or - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" - ;; -esac - -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [acx_pthread_ok=yes]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT($acx_pthread_ok) - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: threads are created detached by default - # and the JOINABLE attribute has a nonstandard name (UNDETACHED). - AC_MSG_CHECKING([for joinable pthread attribute]) - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_JOINABLE;], - ok=PTHREAD_CREATE_JOINABLE, ok=unknown) - if test x"$ok" = xunknown; then - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_UNDETACHED;], - ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) - fi - if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then - AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, - [Define to the necessary symbol if this constant - uses a non-standard name on your system.]) - fi - AC_MSG_RESULT(${ok}) - if test x"$ok" = xunknown; then - AC_MSG_WARN([we do not know how to create joinable pthreads]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; - *solaris* | alpha*-osf*) flag="-D_REENTRANT";; - esac - AC_MSG_RESULT(${flag}) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: must compile with cc_r - AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) -else - PTHREAD_CC="$CC" -fi - -AC_SUBST(PTHREAD_LIBS) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_CC) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) - : -else - acx_pthread_ok=no - $2 -fi - -])dnl ACX_PTHREAD - - - -dnl @synopsis AC_PROG_CC_WARNINGS([ANSI]) -dnl -dnl Enables a reasonable set of warnings for the C compiler. Optionally, -dnl if the first argument is nonempty, turns on flags which enforce and/or -dnl enable proper ANSI C if such flags are known to the compiler used. -dnl -dnl Currently this macro knows about GCC, Solaris C compiler, -dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler, -dnl and IRIX C compiler. -dnl -dnl @version $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ -dnl @author Ville Laurikari -dnl -AC_DEFUN([AC_PROG_CC_WARNINGS], [ - ansi=$1 - if test -z "$ansi"; then - msg="for C compiler warning flags" - else - msg="for C compiler warning and ANSI conformance flags" - fi - AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [ - if test -n "$CC"; then - cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && - $CC -c -v -Xc conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-v" - else - ac_cv_prog_cc_warnings="-v -Xc" - fi - - dnl HP-UX C compiler - elif $CC > /dev/null 2>&1 && - $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="+w1" - else - ac_cv_prog_cc_warnings="+w1 -Aa" - fi - - dnl Digital Unix C compiler - elif ! $CC > /dev/null 2>&1 && - $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" - else - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" - fi - - dnl C for AIX Compiler - elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && - $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" - else - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" - fi - - dnl IRIX C compiler - elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-fullwarn" - else - ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" - fi - - fi - rm -f conftest.* - fi - if test -n "$ac_cv_prog_cc_warnings"; then - CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" - else - ac_cv_prog_cc_warnings="unknown" - fi - ]) -]) - - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/aclocal.m4 b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/aclocal.m4 deleted file mode 100644 index 20dfa952bc0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/aclocal.m4 +++ /dev/null @@ -1,4444 +0,0 @@ -# aclocal.m4 generated automatically by aclocal 1.5 - -# Copyright 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -dnl $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ - -AC_DEFUN(FCGI_COMMON_CHECKS, [ - AC_CHECK_TYPE([ssize_t], [int]) - - AC_MSG_CHECKING([for sun_len in sys/un.h]) - AC_EGREP_HEADER([sun_len], [sys/un.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1], - [Define if sockaddr_un in sys/un.h contains a sun_len component])], - AC_MSG_RESULT([no])) - - AC_MSG_CHECKING([for fpos_t in stdio.h]) - AC_EGREP_HEADER([fpos_t], [stdio.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FPOS], [1], - [Define if the fpos_t typedef is in stdio.h])], - AC_MSG_RESULT([no])) - - AC_CHECK_HEADERS([sys/socket.h netdb.h netinet/in.h arpa/inet.h]) - AC_CHECK_HEADERS([sys/time.h limits.h sys/param.h unistd.h]) - - AC_MSG_CHECKING([for a fileno() prototype in stdio.h]) - AC_EGREP_HEADER([fileno], [stdio.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FILENO_PROTO], [1], - [Define if there's a fileno() prototype in stdio.h])], - AC_MSG_RESULT([no])) - - if test "$HAVE_SYS_SOCKET_H"; then - AC_MSG_CHECKING([for socklen_t in sys/socket.h]) - AC_EGREP_HEADER([socklen_t], [sys/socket.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_SOCKLEN], [1], - [Define if the socklen_t typedef is in sys/socket.h])], - AC_MSG_RESULT([no])) - fi - - #-------------------------------------------------------------------- - # Do we need cross-process locking on this platform? - #-------------------------------------------------------------------- - AC_MSG_CHECKING([whether cross-process locking is required by accept()]) - case "`uname -sr`" in - IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0) - AC_MSG_RESULT([yes]) - AC_DEFINE([USE_LOCKING], [1], - [Define if cross-process locking is required by accept()]) - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac - - #-------------------------------------------------------------------- - # Does va_arg(arg, long double) crash the compiler? - # hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler) - #-------------------------------------------------------------------- - AC_MSG_CHECKING([whether va_arg(arg, long double) crashes the compiler]) - AC_TRY_COMPILE([#include ], - [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);], - AC_MSG_RESULT([no]), - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_VA_ARG_LONG_DOUBLE_BUG], [1], - [Define if va_arg(arg, long double) crashes the compiler])]) - - AC_C_CONST -]) - - -dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -dnl -dnl This macro figures out how to build C programs using POSIX -dnl threads. It sets the PTHREAD_LIBS output variable to the threads -dnl library and linker flags, and the PTHREAD_CFLAGS output variable -dnl to any special C compiler flags that are needed. (The user can also -dnl force certain compiler flags/libs to be tested by setting these -dnl environment variables.) -dnl -dnl Also sets PTHREAD_CC to any special C compiler that is needed for -dnl multi-threaded programs (defaults to the value of CC otherwise). -dnl (This is necessary on AIX to use the special cc_r compiler alias.) -dnl -dnl If you are only building threads programs, you may wish to -dnl use these variables in your default LIBS, CFLAGS, and CC: -dnl -dnl LIBS="$PTHREAD_LIBS $LIBS" -dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -dnl CC="$PTHREAD_CC" -dnl -dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute -dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE -dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -dnl -dnl ACTION-IF-FOUND is a list of shell commands to run if a threads -dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands -dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, -dnl the default action will define HAVE_PTHREAD. -dnl -dnl Please let the authors know if this macro fails on any platform, -dnl or if you have any other suggestions or comments. This macro was -dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) -dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread -dnl macros posted by AFC to the autoconf macro repository. We are also -dnl grateful for the helpful feedback of numerous users. -dnl -dnl @version $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ -dnl @author Steven G. Johnson and Alejandro Forero Cuervo - -AC_DEFUN([ACX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -acx_pthread_ok=no - -# First, check if the POSIX threads header, pthread.h, is available. -# If it isn't, don't bother looking for the threads libraries. -AC_CHECK_HEADER(pthread.h, , acx_pthread_ok=noheader) - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) - AC_MSG_RESULT($acx_pthread_ok) - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all. - -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# pthread: Linux, etcetera -# --thread-safe: KAI C++ - -case "${host_cpu}-${host_os}" in - *solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthread or - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" - ;; -esac - -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [acx_pthread_ok=yes]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT($acx_pthread_ok) - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: threads are created detached by default - # and the JOINABLE attribute has a nonstandard name (UNDETACHED). - AC_MSG_CHECKING([for joinable pthread attribute]) - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_JOINABLE;], - ok=PTHREAD_CREATE_JOINABLE, ok=unknown) - if test x"$ok" = xunknown; then - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_UNDETACHED;], - ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) - fi - if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then - AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, - [Define to the necessary symbol if this constant - uses a non-standard name on your system.]) - fi - AC_MSG_RESULT(${ok}) - if test x"$ok" = xunknown; then - AC_MSG_WARN([we do not know how to create joinable pthreads]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; - *solaris* | alpha*-osf*) flag="-D_REENTRANT";; - esac - AC_MSG_RESULT(${flag}) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: must compile with cc_r - AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) -else - PTHREAD_CC="$CC" -fi - -AC_SUBST(PTHREAD_LIBS) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_CC) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) - : -else - acx_pthread_ok=no - $2 -fi - -])dnl ACX_PTHREAD - - - -dnl @synopsis AC_PROG_CC_WARNINGS([ANSI]) -dnl -dnl Enables a reasonable set of warnings for the C compiler. Optionally, -dnl if the first argument is nonempty, turns on flags which enforce and/or -dnl enable proper ANSI C if such flags are known to the compiler used. -dnl -dnl Currently this macro knows about GCC, Solaris C compiler, -dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler, -dnl and IRIX C compiler. -dnl -dnl @version $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ -dnl @author Ville Laurikari -dnl -AC_DEFUN([AC_PROG_CC_WARNINGS], [ - ansi=$1 - if test -z "$ansi"; then - msg="for C compiler warning flags" - else - msg="for C compiler warning and ANSI conformance flags" - fi - AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [ - if test -n "$CC"; then - cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && - $CC -c -v -Xc conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-v" - else - ac_cv_prog_cc_warnings="-v -Xc" - fi - - dnl HP-UX C compiler - elif $CC > /dev/null 2>&1 && - $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="+w1" - else - ac_cv_prog_cc_warnings="+w1 -Aa" - fi - - dnl Digital Unix C compiler - elif ! $CC > /dev/null 2>&1 && - $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" - else - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" - fi - - dnl C for AIX Compiler - elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && - $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" - else - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" - fi - - dnl IRIX C compiler - elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-fullwarn" - else - ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" - fi - - fi - rm -f conftest.* - fi - if test -n "$ac_cv_prog_cc_warnings"; then - CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" - else - ac_cv_prog_cc_warnings="unknown" - fi - ]) -]) - - - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 5 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# We require 2.13 because we rely on SHELL being computed by configure. -AC_PREREQ([2.13]) - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. -# The purpose of this macro is to provide the user with a means to -# check macros which are provided without letting her know how the -# information is coded. -# If this macro is not defined by Autoconf, define it here. -ifdef([AC_PROVIDE_IFELSE], - [], - [define([AC_PROVIDE_IFELSE], - [ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) -# ---------------------------------------------- -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) -fi - -# Define the identity of the package. -PACKAGE=$1 -AC_SUBST(PACKAGE)dnl -VERSION=$2 -AC_SUBST(VERSION)dnl -ifelse([$3],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) - -# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow -# the ones we care about. -ifdef([m4_pattern_allow], - [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl - -# Autoconf 2.50 always computes EXEEXT. However we need to be -# compatible with 2.13, for now. So we always define EXEEXT, but we -# don't compute it. -AC_SUBST(EXEEXT) -# Similar for OBJEXT -- only we only use OBJEXT if the user actually -# requests that it be used. This is a bit dumb. -: ${OBJEXT=o} -AC_SUBST(OBJEXT) - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_MISSING_PROG(AMTAR, tar) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl -AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_PROVIDE_IFELSE([AC_PROG_][CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_][CC], - defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_][CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_][CXX], - defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl -]) - -# -# Check to make sure that the build environment is sane. -# - -# serial 3 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - - -# serial 2 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - am_backtick='`' - AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) -fi -]) - -# AM_AUX_DIR_EXPAND - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], [ -# expand $ac_aux_dir to an absolute path -am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` -]) - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"$am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# serial 4 -*- Autoconf -*- - - - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - - -# _AM_DEPENDENCIES(NAME) -# --------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX" or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -$1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" -AC_SUBST([$1DEPMODE]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null -AC_SUBST(DEPDIR) -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking Speeds up one-time builds - --enable-dependency-tracking Do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -pushdef([subst], defn([AC_SUBST])) -subst(AMDEPBACKSLASH) -popdef([subst]) -]) - -# Generate code to set up dependency tracking. -# This macro should only be invoked once -- use via AC_REQUIRE. -# Usage: -# AM_OUTPUT_DEPENDENCY_COMMANDS - -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ -AC_OUTPUT_COMMANDS([ -test x"$AMDEP_TRUE" != x"" || -for mf in $CONFIG_FILES; do - case "$mf" in - Makefile) dirpart=.;; - */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; - *) continue;; - esac - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`echo "$file" | sed -e 's|/[^/]*$||'` - $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -], [AMDEP_TRUE="$AMDEP_TRUE" -ac_aux_dir="$ac_aux_dir"])]) - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include='#' -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote='"' - _am_result=BSD - fi -fi -AC_SUBST(am__include) -AC_SUBST(am__quote) -AC_MSG_RESULT($_am_result) -rm -f confinc confmf -]) - -# serial 3 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -# -# FIXME: Once using 2.50, use this: -# m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_DEFUN([AM_CONDITIONAL], -[ifelse([$1], [TRUE], - [errprint(__file__:__line__: [$0: invalid condition: $1 -])dnl -m4exit(1)])dnl -ifelse([$1], [FALSE], - [errprint(__file__:__line__: [$0: invalid condition: $1 -])dnl -m4exit(1)])dnl -AC_SUBST([$1_TRUE]) -AC_SUBST([$1_FALSE]) -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. - -# serial 3 - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. We must strip everything past the first ":", -# and everything past the last "/". - -AC_PREREQ([2.12]) - -AC_DEFUN([AM_CONFIG_HEADER], -[ifdef([AC_FOREACH],dnl - [dnl init our file count if it isn't already - m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) - dnl prepare to store our destination file list for use in config.status - AC_FOREACH([_AM_File], [$1], - [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) - m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) - dnl and add it to the list of files AC keeps track of, along - dnl with our hook - AC_CONFIG_HEADERS(_AM_File, -dnl COMMANDS, [, INIT-CMDS] -[# update the timestamp -echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" -][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS - m4_popdef([_AM_Dest])])],dnl -[AC_CONFIG_HEADER([$1]) - AC_OUTPUT_COMMANDS( - ifelse(patsubst([$1], [[^ ]], []), - [], - [test -z "$CONFIG_HEADERS" || echo timestamp >dnl - patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl -[am_indx=1 -for am_file in $1; do - case " \$CONFIG_HEADERS " in - *" \$am_file "*) - am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` - if test -n "\$am_dir"; then - am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` - for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do - am_tmpdir=\$am_tmpdir\$am_subdir/ - if test ! -d \$am_tmpdir; then - mkdir \$am_tmpdir - fi - done - fi - echo timestamp > "\$am_dir"stamp-h\$am_indx - ;; - esac - am_indx=\`expr \$am_indx + 1\` -done]) -])]) # AM_CONFIG_HEADER - -# _AM_DIRNAME(PATH) -# ----------------- -# Like AS_DIRNAME, only do it during macro expansion -AC_DEFUN([_AM_DIRNAME], - [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, - m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, - m4_if(m4_regexp([$1], [^/.*]), -1, - [.], - m4_patsubst([$1], [^\(/\).*], [\1])), - m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), - m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl -]) # _AM_DIRNAME - -# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- - -# serial 46 AC_PROG_LIBTOOL - -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -]) - -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.13)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -_LT_AC_PROG_ECHO_BACKSLASH -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE(libtool-lock, - [ --disable-libtool-lock avoid locking (might break parallel builds)]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_SAVE - AC_LANG_C - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_RESTORE]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one - AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain, - [AC_TRY_LINK([], - [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*); - DllMain (0, 0, 0);], - [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])]) - - case $host/$CC in - *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*) - # old mingw systems require "-dll" to link a DLL, while more recent ones - # require "-mdll" - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mdll" - AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch, - [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])]) - CFLAGS="$SAVE_CFLAGS" ;; - *-*-cygwin* | *-*-pw32*) - # cygwin systems need to pass --dll to the linker, and not link - # crt.o which will require a WinMain@16 definition. - lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;; - esac - ;; - ]) -esac - -_LT_AC_LTCONFIG_HACK - -]) - -# AC_LIBTOOL_HEADER_ASSERT -# ------------------------ -AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], -[AC_CACHE_CHECK([whether $CC supports assert without backlinking], - [lt_cv_func_assert_works], - [case $host in - *-*-solaris*) - if test "$GCC" = yes && test "$with_gnu_ld" != yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) lt_cv_func_assert_works=no ;; - *) lt_cv_func_assert_works=yes ;; - esac - fi - ;; - esac]) - -if test "x$lt_cv_func_assert_works" = xyes; then - AC_CHECK_HEADERS(assert.h) -fi -])# AC_LIBTOOL_HEADER_ASSERT - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h) -])# _LT_AC_CHECK_DLFCN - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix*) - symcode='[[BCDEGRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[[ABCDGISTW]]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[[]] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if AC_TRY_EVAL(ac_link) && test -s conftest; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AC_FD_CC - fi - else - echo "cannot find nm_test_var in $nlist" >&AC_FD_CC - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC - fi - else - echo "$progname: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - -# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR -# --------------------------------- -AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR], -[# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi -])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -AC_DIVERT_POP -])# _LT_AC_PROG_ECHO_BACKSLASH - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[if test "$cross_compiling" = yes; then : - [$4] -else - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - cygwin* | mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - -AC_DEFUN([_LT_AC_LTCONFIG_HACK], -[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="[$]2" - -AC_MSG_CHECKING([for objdir]) -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -AC_MSG_RESULT($objdir) - - -AC_ARG_WITH(pic, -[ --with-pic try to use only PIC/non-PIC objects [default=use both]], -pic_mode="$withval", pic_mode=default) -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -AC_MSG_CHECKING([for $compiler option to produce PIC]) -AC_CACHE_VAL(lt_cv_prog_cc_pic, -[ lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - if test "x$host_vendor" = xsni; then - lt_cv_prog_cc_wl='-LD' - else - lt_cv_prog_cc_wl='-Wl,' - fi - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi -]) -if test -z "$lt_cv_prog_cc_pic"; then - AC_MSG_RESULT([none]) -else - AC_MSG_RESULT([$lt_cv_prog_cc_pic]) - - # Check to make sure the pic_flag actually works. - AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works]) - AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - AC_TRY_COMPILE([], [], [dnl - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - ], [dnl - lt_cv_prog_cc_pic_works=no - ]) - CFLAGS="$save_CFLAGS" - ]) - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - AC_MSG_RESULT([$lt_cv_prog_cc_pic_works]) -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | egrep -e "[[ ]]$lt_cv_prog_cc_shlib[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure]) - lt_cv_prog_cc_can_build_shared=no - fi -fi - -AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works]) -AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes]) - LDFLAGS="$save_LDFLAGS" -]) - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -AC_MSG_RESULT([$lt_cv_prog_cc_static_works]) - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - - -# Check to see if options -o and -c are simultaneously supported by compiler -AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext]) -AC_CACHE_VAL([lt_cv_compiler_c_o], [ -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&AC_FD_CC - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null -]) -compiler_c_o=$lt_cv_compiler_c_o -AC_MSG_RESULT([$compiler_c_o]) - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - AC_MSG_CHECKING([if $compiler supports -c -o file.lo]) - AC_CACHE_VAL([lt_cv_compiler_o_lo], [ - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - ]) - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - ]) - compiler_o_lo=$lt_cv_compiler_o_lo - AC_MSG_RESULT([$compiler_o_lo]) -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed -hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi - -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions]) - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - AC_TRY_COMPILE([], [int some_variable = 0;], [dnl - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - ]) - CFLAGS="$save_CFLAGS" - AC_MSG_RESULT([$compiler_rtti_exceptions]) - - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries]) - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \[$]# in - 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi -else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[[012]]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [[12]].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - if test "x$host_vendor" = xsno; then - archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - else - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac -fi -AC_MSG_RESULT([$ld_shlibs]) -test "$ld_shlibs" = no && can_build_shared=no - -# Check hardcoding attributes. -AC_MSG_CHECKING([how to hardcode library paths into programs]) -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -AC_MSG_RESULT([$hardcode_action]) - -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics -AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' - ;; - -aix4* | aix5*) - version_type=linux - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}.so' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - need_version=no - need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin*) - library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - ;; - *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - *) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos - need_lib_prefix=no - need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6*) - version_type=irix - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' - case $host_os in - irix5*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux-gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -os2*) - libname_spec='$name' - need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -# Report the final consequences. -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -AC_LIBTOOL_DLOPEN_SELF - -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - AC_CACHE_VAL([lt_cv_archive_cmds_need_lc], - [$rm conftest* - echo 'static int dummy;' > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile); then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi]) - AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc]) - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} - -# The second clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - cat <<__EOF__ > "${ofile}T" -#! $SHELL - -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996-2000 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# ### BEGIN LIBTOOL CONFIG - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# The default C compiler. -CC=$lt_CC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC - -# The linker used to build libraries. -LD=$lt_LD - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_wl - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag -pic_mode=$pic_mode - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o - -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ - - case $host_os in - aix3*) - cat <<\EOF >> "${ofile}T" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -])# _LT_AC_LTCONFIG_HACK - -# AC_LIBTOOL_DLOPEN - enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) - -# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) - -# AC_ENABLE_SHARED - implement the --enable-shared flag -# Usage: AC_ENABLE_SHARED[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(shared, -changequote(<<, >>)dnl -<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl -]) - -# AC_DISABLE_SHARED - set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no)]) - -# AC_ENABLE_STATIC - implement the --enable-static flag -# Usage: AC_ENABLE_STATIC[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(static, -changequote(<<, >>)dnl -<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_static=AC_ENABLE_STATIC_DEFAULT)dnl -]) - -# AC_DISABLE_STATIC - set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no)]) - - -# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] -# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to -# `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE(fast-install, -changequote(<<, >>)dnl -<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], -changequote([, ])dnl -[p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac], -enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl -]) - -# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no)]) - -# AC_LIBTOOL_PICMODE - implement the --with-pic flag -# Usage: AC_LIBTOOL_PICMODE[(MODE)] -# Where MODE is either `yes' or `no'. If omitted, it defaults to -# `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default)]) - - -# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -]) - - -# AC_PATH_MAGIC - find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl -AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH) - else - MAGIC_CMD=: - fi -fi -]) - - -# AC_PROG_LD - find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH(gnu-ld, -[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], -test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | [[A-Za-z]]:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$lt_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT($LD) -else - AC_MSG_RESULT(no) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_PROG_LD_GNU -]) - -# AC_PROG_LD_GNU - -AC_DEFUN([AC_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld, -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi]) -with_gnu_ld=$lt_cv_prog_gnu_ld -]) - -# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker -# -- PORTME Some linkers may need a different reload flag. -AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], -[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag, -[lt_cv_ld_reload_flag='-r']) -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" -]) - -# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], -[AC_CACHE_CHECK([how to recognise dependant libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* | pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[[012]]) - lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv5uw[[78]]* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - esac - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -]) - - -# AC_PROG_NM - find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl -AC_MSG_CHECKING([for BSD-compatible nm]) -AC_CACHE_VAL(lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -AC_MSG_RESULT([$NM]) -]) - -# AC_CHECK_LIBM - check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32*) - # These system don't have libm - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, main, LIBM="-lm") - ;; -esac -]) - -# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl convenience library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-convenience to the -# configure arguments. Note that LIBLTDL and INCLTDL are not -# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not -# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed -# with '${top_builddir}/' and INCLTDL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) -]) - -# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for -# the libltdl installable library and INCLTDL to the include flags for -# the libltdl header and adds --enable-ltdl-install to the configure -# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is -# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed -# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed -# with '${top_srcdir}/' (note the single quotes!). If your package is -# not flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, main, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - INCLTDL= - fi -]) - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/Makefile.am b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/Makefile.am deleted file mode 100644 index 4a5c685bce0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -# $Id: Makefile.am,v 1.4 2001/12/22 03:16:22 robs Exp $ -bin_PROGRAMS = cgi-fcgi - -INCLUDEDIR = ../include -CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include - -INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \ - $(INCLUDEDIR)/fcgiapp.h \ - $(INCLUDEDIR)/fcgimisc.h - -LIBDIR = ../libfcgi -LIBFCGI = $(LIBDIR)/libfcgi.la - -LDADD = $(LIBFCGI) -cgi_fcgi_SOURCES = $(INCLUDE_FILES) cgi-fcgi.c diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/Makefile.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/Makefile.in deleted file mode 100644 index e975dc238f6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/Makefile.in +++ /dev/null @@ -1,352 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# $Id: Makefile.am,v 1.4 2001/12/22 03:16:22 robs Exp $ - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_CPP = @ECHO_CPP@ -EXEEXT = @EXEEXT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBFCGIXX = @LIBFCGIXX@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -SYSTEM = @SYSTEM@ -THREADED = @THREADED@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -bin_PROGRAMS = cgi-fcgi - -INCLUDEDIR = ../include -CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include - -INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \ - $(INCLUDEDIR)/fcgiapp.h \ - $(INCLUDEDIR)/fcgimisc.h - - -LIBDIR = ../libfcgi -LIBFCGI = $(LIBDIR)/libfcgi.la - -LDADD = $(LIBFCGI) -cgi_fcgi_SOURCES = $(INCLUDE_FILES) cgi-fcgi.c -subdir = cgi-fcgi -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/fcgi_config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = cgi-fcgi$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_cgi_fcgi_OBJECTS = cgi-fcgi.$(OBJEXT) -cgi_fcgi_OBJECTS = $(am_cgi_fcgi_OBJECTS) -cgi_fcgi_LDADD = $(LDADD) -cgi_fcgi_DEPENDENCIES = $(LIBDIR)/libfcgi.la -cgi_fcgi_LDFLAGS = - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/cgi-fcgi.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ -DIST_SOURCES = $(cgi_fcgi_SOURCES) -DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(cgi_fcgi_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign cgi-fcgi/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -cgi-fcgi$(EXEEXT): $(cgi_fcgi_OBJECTS) $(cgi_fcgi_DEPENDENCIES) - @rm -f cgi-fcgi$(EXEEXT) - $(LINK) $(cgi_fcgi_LDFLAGS) $(cgi_fcgi_OBJECTS) $(cgi_fcgi_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/cgi-fcgi.Po@am__quote@ - -distclean-depend: - -rm -rf $(DEPDIR) - -.c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< - -.c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` - -.c.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -CCDEPMODE = @CCDEPMODE@ -uninstall-info-am: - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool distclean distclean-compile \ - distclean-depend distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-binPROGRAMS install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/cgi-fcgi.c b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/cgi-fcgi.c deleted file mode 100644 index cdd828d55e9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/cgi-fcgi.c +++ /dev/null @@ -1,849 +0,0 @@ -/* - * cgifcgi.c -- - * - * CGI to FastCGI bridge - * - * - * Copyright (c) 1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - */ -#ifndef lint -static const char rcsid[] = "$Id: cgi-fcgi.c,v 1.15 2001/09/01 01:14:28 robs Exp $"; -#endif /* not lint */ - -#include -#include -#include -#include -#include -#include -#include - -#include "fcgi_config.h" - -#ifdef HAVE_NETDB_H -#include -#endif - -#ifdef _WIN32 -#include -#include -#else -extern char **environ; -#endif - -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -#ifdef HAVE_SYS_TIME_H -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "fcgimisc.h" -#include "fcgiapp.h" -#include "fastcgi.h" -#include "fcgios.h" - - -static int wsReadPending = 0; -static int fcgiReadPending = 0; -static int fcgiWritePending = 0; - -static void ScheduleIo(void); - - -/* - * Simple buffer (not ring buffer) type, used by all event handlers. - */ -#define BUFFLEN 8192 -typedef struct { - char *next; - char *stop; - char buff[BUFFLEN]; -} Buffer; - -/* - *---------------------------------------------------------------------- - * - * GetPtr -- - * - * Returns a count of the number of characters available - * in the buffer (at most n) and advances past these - * characters. Stores a pointer to the first of these - * characters in *ptr. - * - *---------------------------------------------------------------------- - */ - -static int GetPtr(char **ptr, int n, Buffer *pBuf) -{ - int result; - *ptr = pBuf->next; - result = min(n, pBuf->stop - pBuf->next); - pBuf->next += result; - return result; -} - -/* - *---------------------------------------------------------------------- - * - * MakeHeader -- - * - * Constructs an FCGI_Header struct. - * - *---------------------------------------------------------------------- - */ -static FCGI_Header MakeHeader( - int type, - int requestId, - int contentLength, - int paddingLength) -{ - FCGI_Header header; - ASSERT(contentLength >= 0 && contentLength <= FCGI_MAX_LENGTH); - ASSERT(paddingLength >= 0 && paddingLength <= 0xff); - header.version = FCGI_VERSION_1; - header.type = (unsigned char) type; - header.requestIdB1 = (unsigned char) ((requestId >> 8) & 0xff); - header.requestIdB0 = (unsigned char) ((requestId ) & 0xff); - header.contentLengthB1 = (unsigned char) ((contentLength >> 8) & 0xff); - header.contentLengthB0 = (unsigned char) ((contentLength ) & 0xff); - header.paddingLength = (unsigned char) paddingLength; - header.reserved = 0; - return header; -} - -/* - *---------------------------------------------------------------------- - * - * MakeBeginRequestBody -- - * - * Constructs an FCGI_BeginRequestBody record. - * - *---------------------------------------------------------------------- - */ -static FCGI_BeginRequestBody MakeBeginRequestBody( - int role, - int keepConnection) -{ - FCGI_BeginRequestBody body; - ASSERT((role >> 16) == 0); - body.roleB1 = (unsigned char) ((role >> 8) & 0xff); - body.roleB0 = (unsigned char) (role & 0xff); - body.flags = (unsigned char) ((keepConnection) ? FCGI_KEEP_CONN : 0); - memset(body.reserved, 0, sizeof(body.reserved)); - return body; -} - - -static int bytesToRead; /* number of bytes to read from Web Server */ -static int appServerSock = -1; /* Socket connected to FastCGI application, - * used by AppServerReadHandler and - * AppServerWriteHandler. */ -static Buffer fromAS; /* Bytes read from the FCGI application server. */ -static FCGI_Header header; /* Header of the current record. Is global - * since read may return a partial header. */ -static int headerLen = 0; /* Number of valid bytes contained in header. - * If headerLen < sizeof(header), - * AppServerReadHandler is reading a record header; - * otherwise it is reading bytes of record content - * or padding. */ -static int contentLen; /* If headerLen == sizeof(header), contentLen - * is the number of content bytes still to be - * read. */ -static int paddingLen; /* If headerLen == sizeof(header), paddingLen - * is the number of padding bytes still - * to be read. */ -static int requestId; /* RequestId of the current request. - * Set by main. */ -static FCGI_EndRequestBody erBody; -static int readingEndRequestBody = FALSE; - /* If readingEndRequestBody, erBody contains - * partial content: contentLen more bytes need - * to be read. */ -static int exitStatus = 0; -static int exitStatusSet = FALSE; - -static int stdinFds[3]; - - -/* - *---------------------------------------------------------------------- - * - * FCGIexit -- - * - * FCGIexit provides a single point of exit. It's main use is for - * application debug when porting to other operating systems. - * - *---------------------------------------------------------------------- - */ -static void FCGIexit(int exitCode) -{ - if(appServerSock != -1) { - OS_Close(appServerSock); - appServerSock = -1; - } - OS_LibShutdown(); - exit(exitCode); -} - -#undef exit -#define exit FCGIexit - - -/* - *---------------------------------------------------------------------- - * - * AppServerReadHandler -- - * - * Reads data from the FCGI application server and (blocking) - * writes all of it to the Web server. Exits the program upon - * reading EOF from the FCGI application server. Called only when - * there's data ready to read from the application server. - * - *---------------------------------------------------------------------- - */ - -static void AppServerReadHandler(ClientData dc, int bytesRead) -{ - int count, outFD; - char *ptr; - - /* Touch unused parameters to avoid warnings */ - dc = NULL; - - assert(fcgiReadPending == TRUE); - fcgiReadPending = FALSE; - count = bytesRead; - - if(count <= 0) { - if(count < 0) { - exit(OS_Errno); - } - if(headerLen > 0 || paddingLen > 0) { - exit(FCGX_PROTOCOL_ERROR); - } - if(appServerSock != -1) { - OS_Close(appServerSock); - appServerSock = -1; - } - /* - * XXX: Shouldn't be here if exitStatusSet. - */ - exit((exitStatusSet) ? exitStatus : FCGX_PROTOCOL_ERROR); - } - fromAS.stop = fromAS.next + count; - while(fromAS.next != fromAS.stop) { - /* - * fromAS is not empty. What to do with the contents? - */ - if(headerLen < sizeof(header)) { - /* - * First priority is to complete the header. - */ - count = GetPtr(&ptr, sizeof(header) - headerLen, &fromAS); - assert(count > 0); - memcpy(&header + headerLen, ptr, count); - headerLen += count; - if(headerLen < sizeof(header)) { - break; - } - if(header.version != FCGI_VERSION_1) { - exit(FCGX_UNSUPPORTED_VERSION); - } - if((header.requestIdB1 << 8) + header.requestIdB0 != requestId) { - exit(FCGX_PROTOCOL_ERROR); - } - contentLen = (header.contentLengthB1 << 8) - + header.contentLengthB0; - paddingLen = header.paddingLength; - } else { - /* - * Header is complete (possibly from previous call). What now? - */ - switch(header.type) { - case FCGI_STDOUT: - case FCGI_STDERR: - /* - * Write the buffered content to stdout or stderr. - * Blocking writes are OK here; can't prevent a slow - * client from tying up the app server without buffering - * output in temporary files. - */ - count = GetPtr(&ptr, contentLen, &fromAS); - contentLen -= count; - if(count > 0) { - outFD = (header.type == FCGI_STDOUT) ? - STDOUT_FILENO : STDERR_FILENO; - if(OS_Write(outFD, ptr, count) < 0) { - exit(OS_Errno); - } - } - break; - case FCGI_END_REQUEST: - if(!readingEndRequestBody) { - if(contentLen != sizeof(erBody)) { - exit(FCGX_PROTOCOL_ERROR); - } - readingEndRequestBody = TRUE; - } - count = GetPtr(&ptr, contentLen, &fromAS); - if(count > 0) { - memcpy(&erBody + sizeof(erBody) - contentLen, - ptr, count); - contentLen -= count; - } - if(contentLen == 0) { - if(erBody.protocolStatus != FCGI_REQUEST_COMPLETE) { - /* - * XXX: What to do with FCGI_OVERLOADED? - */ - exit(FCGX_PROTOCOL_ERROR); - } - exitStatus = (erBody.appStatusB3 << 24) - + (erBody.appStatusB2 << 16) - + (erBody.appStatusB1 << 8) - + (erBody.appStatusB0 ); - exitStatusSet = TRUE; - readingEndRequestBody = FALSE; - } - break; - case FCGI_GET_VALUES_RESULT: - /* coming soon */ - case FCGI_UNKNOWN_TYPE: - /* coming soon */ - default: - exit(FCGX_PROTOCOL_ERROR); - } - if(contentLen == 0) { - if(paddingLen > 0) { - paddingLen -= GetPtr(&ptr, paddingLen, &fromAS); - } - /* - * If we've processed all the data and skipped all the - * padding, discard the header and look for the next one. - */ - if(paddingLen == 0) { - headerLen = 0; - } - } - } /* headerLen >= sizeof(header) */ - } /*while*/ - ScheduleIo(); -} - -static Buffer fromWS; /* Buffer for data read from Web server - * and written to FastCGI application. Used - * by WebServerReadHandler and - * AppServerWriteHandler. */ -static int webServerReadHandlerEOF; - /* TRUE iff WebServerReadHandler has read EOF from - * the Web server. Used in main to prevent - * rescheduling WebServerReadHandler. */ - -static void WriteStdinEof(void) -{ - static int stdin_eof_sent = 0; - - if (stdin_eof_sent) - return; - - *((FCGI_Header *)fromWS.stop) = MakeHeader(FCGI_STDIN, requestId, 0, 0); - fromWS.stop += sizeof(FCGI_Header); - stdin_eof_sent = 1; -} - -/* - *---------------------------------------------------------------------- - * - * WebServerReadHandler -- - * - * Non-blocking reads data from the Web server into the fromWS - * buffer. Called only when fromWS is empty, no EOF has been - * received from the Web server, and there's data available to read. - * - *---------------------------------------------------------------------- - */ - -static void WebServerReadHandler(ClientData dc, int bytesRead) -{ - /* Touch unused parameters to avoid warnings */ - dc = NULL; - - assert(fromWS.next == fromWS.stop); - assert(fromWS.next == &fromWS.buff[0]); - assert(wsReadPending == TRUE); - wsReadPending = FALSE; - - if(bytesRead < 0) { - exit(OS_Errno); - } - *((FCGI_Header *) &fromWS.buff[0]) - = MakeHeader(FCGI_STDIN, requestId, bytesRead, 0); - bytesToRead -= bytesRead; - fromWS.stop = &fromWS.buff[sizeof(FCGI_Header) + bytesRead]; - webServerReadHandlerEOF = (bytesRead == 0); - - if (bytesToRead <= 0) - WriteStdinEof(); - - ScheduleIo(); -} - -/* - *---------------------------------------------------------------------- - * - * AppServerWriteHandler -- - * - * Non-blocking writes data from the fromWS buffer to the FCGI - * application server. Called only when fromWS is non-empty - * and the socket is ready to accept some data. - * - *---------------------------------------------------------------------- - */ - -static void AppServerWriteHandler(ClientData dc, int bytesWritten) -{ - int length = fromWS.stop - fromWS.next; - - /* Touch unused parameters to avoid warnings */ - dc = NULL; - - assert(length > 0); - assert(fcgiWritePending == TRUE); - - fcgiWritePending = FALSE; - if(bytesWritten < 0) { - exit(OS_Errno); - } - if((int)bytesWritten < length) { - fromWS.next += bytesWritten; - } else { - fromWS.stop = fromWS.next = &fromWS.buff[0]; - } - - ScheduleIo(); -} - - -/* - * ScheduleIo -- - * - * This functions is responsible for scheduling all I/O to move - * data between a web server and a FastCGI application. - * - * Results: - * None. - * - * Side effects: - * This routine will signal the ioEvent upon completion. - * - */ -static void ScheduleIo(void) -{ - int length; - - /* - * Move data between standard in and the FastCGI connection. - */ - if(!fcgiWritePending && appServerSock != -1 && - ((length = fromWS.stop - fromWS.next) != 0)) { - if(OS_AsyncWrite(appServerSock, 0, fromWS.next, length, - AppServerWriteHandler, - (ClientData)appServerSock) == -1) { - FCGIexit(OS_Errno); - } else { - fcgiWritePending = TRUE; - } - } - - /* - * Schedule a read from the FastCGI application if there's not - * one pending and there's room in the buffer. - */ - if(!fcgiReadPending && appServerSock != -1) { - fromAS.next = &fromAS.buff[0]; - - if(OS_AsyncRead(appServerSock, 0, fromAS.next, BUFFLEN, - AppServerReadHandler, - (ClientData)appServerSock) == -1) { - FCGIexit(OS_Errno); - } else { - fcgiReadPending = TRUE; - } - } - - /* - * Schedule a read from standard in if necessary. - */ - if((bytesToRead > 0) && !webServerReadHandlerEOF && !wsReadPending && - !fcgiWritePending && - fromWS.next == &fromWS.buff[0]) { - if(OS_AsyncReadStdin(fromWS.next + sizeof(FCGI_Header), - BUFFLEN - sizeof(FCGI_Header), - WebServerReadHandler, STDIN_FILENO)== -1) { - FCGIexit(OS_Errno); - } else { - wsReadPending = TRUE; - } - } -} - - -/* - *---------------------------------------------------------------------- - * - * FCGI_Start -- - * - * Starts nServers copies of FCGI application appPath, all - * listening to a Unix Domain socket at bindPath. - * - *---------------------------------------------------------------------- - */ - -static void FCGI_Start(char *bindPath, char *appPath, int nServers) -{ - int listenFd, i; - - /* @@@ Should be able to pick up the backlog as an arg */ - if((listenFd = OS_CreateLocalIpcFd(bindPath, 5)) == -1) { - exit(OS_Errno); - } - - if(access(appPath, X_OK) == -1) { - fprintf(stderr, "%s is not executable\n", appPath); - exit(1); - } - - /* - * Create the server processes - */ - for(i = 0; i < nServers; i++) { - if(OS_SpawnChild(appPath, listenFd) == -1) { - exit(OS_Errno); - } - } - OS_Close(listenFd); -} - -/* - *---------------------------------------------------------------------- - * - * FCGIUtil_BuildNameValueHeader -- - * - * Builds a name-value pair header from the name length - * and the value length. Stores the header into *headerBuffPtr, - * and stores the length of the header into *headerLenPtr. - * - * Side effects: - * Stores header's length (at most 8) into *headerLenPtr, - * and stores the header itself into - * headerBuffPtr[0 .. *headerLenPtr - 1]. - * - *---------------------------------------------------------------------- - */ -static void FCGIUtil_BuildNameValueHeader( - int nameLen, - int valueLen, - unsigned char *headerBuffPtr, - int *headerLenPtr) { - unsigned char *startHeaderBuffPtr = headerBuffPtr; - - ASSERT(nameLen >= 0); - if (nameLen < 0x80) { - *headerBuffPtr++ = (unsigned char) nameLen; - } else { - *headerBuffPtr++ = (unsigned char) ((nameLen >> 24) | 0x80); - *headerBuffPtr++ = (unsigned char) (nameLen >> 16); - *headerBuffPtr++ = (unsigned char) (nameLen >> 8); - *headerBuffPtr++ = (unsigned char) nameLen; - } - ASSERT(valueLen >= 0); - if (valueLen < 0x80) { - *headerBuffPtr++ = (unsigned char) valueLen; - } else { - *headerBuffPtr++ = (unsigned char) ((valueLen >> 24) | 0x80); - *headerBuffPtr++ = (unsigned char) (valueLen >> 16); - *headerBuffPtr++ = (unsigned char) (valueLen >> 8); - *headerBuffPtr++ = (unsigned char) valueLen; - } - *headerLenPtr = headerBuffPtr - startHeaderBuffPtr; -} - - -#define MAXARGS 16 -static int ParseArgs(int argc, char *argv[], - int *doBindPtr, int *doStartPtr, - char *connectPathPtr, char *appPathPtr, int *nServersPtr) { - int i, - x, - err = 0, - ac; - char *tp1, - *tp2, - *av[MAXARGS]; - FILE *fp; - char line[BUFSIZ]; - - *doBindPtr = TRUE; - *doStartPtr = TRUE; - *connectPathPtr = '\0'; - *appPathPtr = '\0'; - *nServersPtr = 0; - - for(i = 0; i < MAXARGS; i++) - av[i] = NULL; - for(i = 1; i < argc; i++) { - if(argv[i][0] == '-') { - if(!strcmp(argv[i], "-f")) { - if(++i == argc) { - fprintf(stderr, - "Missing command file name after -f\n"); - return 1; - } - if((fp = fopen(argv[i], "r")) == NULL) { - fprintf(stderr, "Cannot open command file %s\n", argv[i]); - return 1; - } - ac = 1; - while(fgets(line, BUFSIZ, fp)) { - if(line[0] == '#') { - continue; - } - if((tp1 = (char *) strrchr(line,'\n')) != NULL) { - *tp1-- = 0; - while(*tp1 == ' ' || *tp1 =='\t') { - *tp1-- = 0; - } - } else { - fprintf(stderr, "Line to long\n"); - return 1; - } - tp1 = line; - while(tp1) { - if((tp2 = strchr(tp1, ' ')) != NULL) { - *tp2++ = 0; - } - if(ac >= MAXARGS) { - fprintf(stderr, - "To many arguments, " - "%d is max from a file\n", MAXARGS); - exit(-1); - } - if((av[ac] = (char *)malloc(strlen(tp1)+1)) == NULL) { - fprintf(stderr, "Cannot allocate %d bytes\n", - strlen(tp1)+1); - exit(-1); - } - strcpy(av[ac++], tp1); - tp1 = tp2; - } - } - err = ParseArgs(ac, av, doBindPtr, doStartPtr, - connectPathPtr, appPathPtr, nServersPtr); - for(x = 1; x < ac; x++) { - ASSERT(av[x] != NULL); - free(av[x]); - } - return err; -#ifdef _WIN32 - } else if (!strcmp(argv[i], "-jitcgi")) { - DebugBreak(); - } else if (!strcmp(argv[i], "-dbgfcgi")) { - putenv("DEBUG_FCGI=TRUE"); -#endif - } else if(!strcmp(argv[i], "-start")) { - *doBindPtr = FALSE; - } else if(!strcmp(argv[i], "-bind")) { - *doStartPtr = FALSE; - } else if(!strcmp(argv[i], "-connect")) { - if(++i == argc) { - fprintf(stderr, - "Missing connection name after -connect\n"); - err++; - } else { - strcpy(connectPathPtr, argv[i]); - } - } else { - fprintf(stderr, "Unknown option %s\n", argv[i]); - err++; - } - } else if(*appPathPtr == '\0') { - strcpy(appPathPtr, argv[i]); - } else if(isdigit((int)argv[i][0]) && *nServersPtr == 0) { - *nServersPtr = atoi(argv[i]); - if(*nServersPtr <= 0) { - fprintf(stderr, "Number of servers must be greater than 0\n"); - err++; - } - } else { - fprintf(stderr, "Unknown argument %s\n", argv[i]); - err++; - } - } - if(*doStartPtr && *appPathPtr == 0) { - fprintf(stderr, "Missing application pathname\n"); - err++; - } - if(*connectPathPtr == 0) { - fprintf(stderr, "Missing -connect \n"); - err++; - } else if(strchr(connectPathPtr, ':')) { -/* - * XXX: Test to see if we can use IP connect locally... - This hack lets me test the ability to create a local process listening - to a TCP/IP port for connections and subsequently connect to the app - like we do for Unix domain and named pipes. - - if(*doStartPtr && *doBindPtr) { - fprintf(stderr, - " of form hostName:portNumber " - "requires -start or -bind\n"); - err++; - } - */ - } - if(*nServersPtr == 0) { - *nServersPtr = 1; - } - return err; -} - -int main(int argc, char **argv) -{ - char **envp = environ; - int count; - FCGX_Stream *paramsStream; - int numFDs; - unsigned char headerBuff[8]; - int headerLen, valueLen; - char *equalPtr; - FCGI_BeginRequestRecord beginRecord; - int doBind, doStart, nServers; - char appPath[MAXPATHLEN], bindPath[MAXPATHLEN]; - - if(ParseArgs(argc, argv, &doBind, &doStart, - (char *) &bindPath, (char *) &appPath, &nServers)) { - fprintf(stderr, -"Usage:\n" -" cgi-fcgi -f , or\n" -" cgi-fcgi -connect [] , or\n" -" cgi-fcgi -start -connect [] , or\n" -" cgi-fcgi -bind -connect ,\n" -"where is either the pathname of a UNIX domain socket\n" -"or (if -bind is given) a hostName:portNumber specification\n" -"or (if -start is given) a :portNumber specification (uses local host).\n"); - exit(1); - } - - if(OS_LibInit(stdinFds)) { - fprintf(stderr, "Error initializing OS library: %d\n", OS_Errno); - exit(0); - } - - equalPtr = getenv("CONTENT_LENGTH"); - if(equalPtr != NULL) { - bytesToRead = atoi(equalPtr); - } else { - bytesToRead = 0; - } - - if(doBind) { - appServerSock = OS_FcgiConnect(bindPath); - } - if(doStart && (!doBind || appServerSock < 0)) { - FCGI_Start(bindPath, appPath, nServers); - if(!doBind) { - exit(0); - } else { - appServerSock = OS_FcgiConnect(bindPath); - } - } - if(appServerSock < 0) { - fprintf(stderr, "Could not connect to %s\n", bindPath); - exit(OS_Errno); - } - /* - * Set an arbitrary non-null FCGI RequestId - */ - requestId = 1; - /* - * XXX: Send FCGI_GET_VALUES - */ - - /* - * XXX: Receive FCGI_GET_VALUES_RESULT - */ - - /* - * Send FCGI_BEGIN_REQUEST (XXX: hack, separate write) - */ - beginRecord.header = MakeHeader(FCGI_BEGIN_REQUEST, requestId, - sizeof(beginRecord.body), 0); - beginRecord.body = MakeBeginRequestBody(FCGI_RESPONDER, FALSE); - count = OS_Write(appServerSock, (char *)&beginRecord, sizeof(beginRecord)); - if(count != sizeof(beginRecord)) { - exit(OS_Errno); - } - /* - * Send environment to the FCGI application server - */ - paramsStream = FCGX_CreateWriter(appServerSock, requestId, 8192, FCGI_PARAMS); - for( ; *envp != NULL; envp++) { - equalPtr = strchr(*envp, '='); - if(equalPtr == NULL) { - exit(1000); - } - valueLen = strlen(equalPtr + 1); - FCGIUtil_BuildNameValueHeader( - equalPtr - *envp, - valueLen, - &headerBuff[0], - &headerLen); - if(FCGX_PutStr((char *) &headerBuff[0], headerLen, paramsStream) < 0 - || FCGX_PutStr(*envp, equalPtr - *envp, paramsStream) < 0 - || FCGX_PutStr(equalPtr + 1, valueLen, paramsStream) < 0) { - exit(FCGX_GetError(paramsStream)); - } - } - FCGX_FClose(paramsStream); - FCGX_FreeStream(¶msStream); - /* - * Perform the event loop until AppServerReadHander sees FCGI_END_REQUEST - */ - fromWS.stop = fromWS.next = &fromWS.buff[0]; - webServerReadHandlerEOF = FALSE; - /* - * XXX: might want to use numFDs in the os library. - */ - numFDs = max(appServerSock, STDIN_FILENO) + 1; - OS_SetFlags(appServerSock, O_NONBLOCK); - - if (bytesToRead <= 0) - WriteStdinEof(); - - ScheduleIo(); - - while(!exitStatusSet) { - /* - * NULL = wait forever (or at least until there's something - * to do. - */ - OS_DoIo(NULL); - } - if(exitStatusSet) { - FCGIexit(exitStatus); - } else { - FCGIexit(999); - } - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/cgi-fcgi.mak b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/cgi-fcgi.mak deleted file mode 100644 index c5b58d15237..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/cgi-fcgi/cgi-fcgi.mak +++ /dev/null @@ -1,206 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on cgifcgi.dsp - -!IF "$(CFG)" == "" -CFG=release -!ENDIF - -!IF "$(CFG)" != "release" && "$(CFG)" != "debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "cgifcgi.mak" CFG="debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "release" - -OUTDIR=.\..\cgi-fcgi\Release -INTDIR=.\..\cgi-fcgi\Release -# Begin Custom Macros -OutDir=.\..\cgi-fcgi\Release -# End Custom Macros - -ALL : "$(OUTDIR)\cgi-fcgi.exe" - -CLEAN : - -@erase "$(INTDIR)\cgi-fcgi.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\cgi-fcgi.exe" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\cgifcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\cgifcgi.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"$(OUTDIR)\cgi-fcgi.exe" /libpath:"..\libfcgi\Release" -LINK32_OBJS= \ - "$(INTDIR)\cgi-fcgi.obj" \ - "..\libfcgi\Release\libfcgi.lib" - -"$(OUTDIR)\cgi-fcgi.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "debug" - -OUTDIR=.\../cgi-fcgi/Debug -INTDIR=.\../cgi-fcgi/Debug -# Begin Custom Macros -OutDir=.\../cgi-fcgi/Debug -# End Custom Macros - -ALL : "$(OUTDIR)\cgi-fcgi.exe" "$(OUTDIR)\cgifcgi.bsc" - -CLEAN : - -@erase "$(INTDIR)\cgi-fcgi.obj" - -@erase "$(INTDIR)\cgi-fcgi.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\cgi-fcgi.exe" - -@erase "$(OUTDIR)\cgifcgi.bsc" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\cgifcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\cgifcgi.bsc" -BSC32_SBRS= \ - "$(INTDIR)\cgi-fcgi.sbr" - -"$(OUTDIR)\cgifcgi.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"$(OUTDIR)\cgi-fcgi.exe" /libpath:"..\libfcgi\Debug" -LINK32_OBJS= \ - "$(INTDIR)\cgi-fcgi.obj" \ - "..\libfcgi\Debug\libfcgi.lib" - -"$(OUTDIR)\cgi-fcgi.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -"..\cgi-fcgi\cgi-fcgi.c" : \ - "..\include\fastcgi.h"\ - "..\include\fcgi_config.h"\ - "..\include\fcgiapp.h"\ - "..\include\fcgimisc.h"\ - "..\include\fcgios.h"\ - - -!IF "$(CFG)" == "release" || "$(CFG)" == "debug" -SOURCE="..\cgi-fcgi\cgi-fcgi.c" - -!IF "$(CFG)" == "release" - - -"$(INTDIR)\cgi-fcgi.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "debug" - - -"$(INTDIR)\cgi-fcgi.obj" "$(INTDIR)\cgi-fcgi.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -!ENDIF - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/compile b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/compile deleted file mode 100644 index 9bb997a6a9b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/compile +++ /dev/null @@ -1,99 +0,0 @@ -#! /bin/sh - -# Wrapper for compilers which do not understand `-c -o'. - -# Copyright 1999, 2000 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Usage: -# compile PROGRAM [ARGS]... -# `-o FOO.o' is removed from the args passed to the actual compile. - -prog=$1 -shift - -ofile= -cfile= -args= -while test $# -gt 0; do - case "$1" in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we do something ugly here. - ofile=$2 - shift - case "$ofile" in - *.o | *.obj) - ;; - *) - args="$args -o $ofile" - ofile= - ;; - esac - ;; - *.c) - cfile=$1 - args="$args $1" - ;; - *) - args="$args $1" - ;; - esac - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$prog" $args -fi - -# Name of file we expect compiler to create. -cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d -while true; do - if mkdir $lockdir > /dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir $lockdir; exit 1" 1 2 15 - -# Run the compile. -"$prog" $args -status=$? - -if test -f "$cofile"; then - mv "$cofile" "$ofile" -fi - -rmdir $lockdir -exit $status diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/config.guess b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/config.guess deleted file mode 100644 index fedfce496ee..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/config.guess +++ /dev/null @@ -1,1304 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. - -timestamp='2001-07-30' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Written by Per Bothner . -# Please send patches to . -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int dummy(){}" > $dummy.c ; - for c in cc gcc c89 ; do - ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; - if test $? = 0 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - rm -f $dummy.c $dummy.o $dummy.rel ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # Netbsd (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # Determine the machine/vendor (is the vendor relevant). - case "${UNAME_MACHINE}" in - amiga) machine=m68k-unknown ;; - arm32) machine=arm-unknown ;; - atari*) machine=m68k-atari ;; - sun3*) machine=m68k-sun ;; - mac68k) machine=m68k-apple ;; - macppc) machine=powerpc-apple ;; - hp3[0-9][05]) machine=m68k-hp ;; - ibmrt|romp-ibm) machine=romp-ibm ;; - *) machine=${UNAME_MACHINE}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE}" in - i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - cat <$dummy.s - .data -\$Lformat: - .byte 37,100,45,37,120,10,0 # "%d-%x\n" - - .text - .globl main - .align 4 - .ent main -main: - .frame \$30,16,\$26,0 - ldgp \$29,0(\$27) - .prologue 1 - .long 0x47e03d80 # implver \$0 - lda \$2,-1 - .long 0x47e20c21 # amask \$2,\$1 - lda \$16,\$Lformat - mov \$0,\$17 - not \$1,\$18 - jsr \$26,printf - ldgp \$29,0(\$26) - mov 0,\$16 - jsr \$26,exit - .end main -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; - esac - fi - rm -f $dummy.s $dummy - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit 0;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - arc64:OpenBSD:*:*) - echo mips64el-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hkmips:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mips-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit 0;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit 0 ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit 0 ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.c -o $dummy \ - && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - case "${HPUX_REV}" in - 11.[0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - esac ;; - esac - fi ;; - esac - if [ "${HP_ARCH}" = "" ]; then - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - eval $set_cc_for_build - (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi - rm -f $dummy.c $dummy - fi ;; - esac - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - hppa*:OpenBSD:*:*) - echo hppa-unknown-openbsd - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3D:*:*:*) - echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i386-pc-interix - exit 0 ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit 0 ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in - big) echo mips-unknown-linux-gnu && exit 0 ;; - little) echo mipsel-unknown-linux-gnu && exit 0 ;; - esac - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev67 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - ld_supported_targets=`cd /; ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - cat >$dummy.c < -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __ELF__ -# ifdef __GLIBC__ -# if __GLIBC__ >= 2 - printf ("%s-pc-linux-gnu\n", argv[1]); -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -# else - printf ("%s-pc-linux-gnulibc1\n", argv[1]); -# endif -#else - printf ("%s-pc-linux-gnuaout\n", argv[1]); -#endif - return 0; -} -EOF - eval $set_cc_for_build - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit 0 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit 0 ;; - i*86:*:5:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit 0 ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; - PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit 0 ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit 0 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit 0 ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit 0 ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit 0 ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit 0 ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; - *:Darwin:*:*) - echo `uname -p`-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - if test "${UNAME_MACHINE}" = "x86pc"; then - UNAME_MACHINE=pc - fi - echo `uname -p`-${UNAME_MACHINE}-nto-qnx - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[KW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -eval $set_cc_for_build -$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 -rm -f $dummy.c $dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/config.sub b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/config.sub deleted file mode 100644 index e2fc51248bb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/config.sub +++ /dev/null @@ -1,1375 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. - -timestamp='2001-07-27' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ - | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ - | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | hppa64 \ - | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ - | alphaev6[78] \ - | we32k | ns16k | clipper | i370 | sh | sh[34] | sh[34]eb \ - | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp10 | pdp11 \ - | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | mips64vr5000el | mcore | s390 | s390x \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ - | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ - | pj | pjl | h8500 | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - # FIXME: clean up the formatting here. - vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ - | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ - | hppa2.0n-* | hppa64-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ - | alphaev6[78]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp10-* | pdp11-* | sh-* | sh[34]-* | sh[34]eb-* \ - | powerpc-* | powerpcle-* | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ - | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* | mcore-* \ - | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ - | [cjt]90-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ - | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | ymp) - basic_machine=ymp-cray - os=-unicos - ;; - cray2) - basic_machine=cray2-cray - os=-unicos - ;; - [cjt]90) - basic_machine=${basic_machine}-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mipsel*-linux*) - basic_machine=mipsel-unknown - os=-linux-gnu - ;; - mips*-linux*) - basic_machine=mips-unknown - os=-linux-gnu - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pentium | p5 | k5 | k6 | nexgen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i686-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sparclite-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=t3e-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - windows32) - basic_machine=i386-pc - os=-windows32-msvcrt - ;; - xmp) - basic_machine=xmp-cray - os=-unicos - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - mips) - if [ x$os = x-linux-gnu ]; then - basic_machine=mips-unknown - else - basic_machine=mips-mips - fi - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh3eb | sh4eb) - basic_machine=sh-unknown - ;; - sparc | sparcv9 | sparcv9b) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - c4x*) - basic_machine=c4x-none - os=-coff - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto*) - os=-nto-qnx - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-ibm) - os=-aix - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/configure b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/configure deleted file mode 100644 index e2c8f4ee49c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/configure +++ /dev/null @@ -1,9440 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by Autoconf 2.52. -# -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','` - ;; -esac - -echo=${ECHO-echo} -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - IFS="${IFS= }"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL $0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL $0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "$0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo" -fi - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Name of the executable. -as_me=`echo "$0" |sed 's,.*[\\/],,'` - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -as_executable_p="test -f" - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - -# NLS nuisances. -$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } -$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } -$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } -$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } -$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } -$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } -$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } -$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -cross_compiling=no -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: should be removed in autoconf 3.0. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP -ac_env_CXX_set=${CXX+set} -ac_env_CXX_value=$CXX -ac_cv_env_CXX_set=${CXX+set} -ac_cv_env_CXX_value=$CXX -ac_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_env_CXXFLAGS_value=$CXXFLAGS -ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} -ac_cv_env_CXXFLAGS_value=$CXXFLAGS - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat < if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -EOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue - cd $ac_subdir - # A "../" for each directory in /$ac_subdir. - ac_dots=`echo $ac_subdir | - sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` - - case $srcdir in - .) # No --srcdir option. We are building in place. - ac_sub_srcdir=$srcdir ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_sub_srcdir=$srcdir/$ac_subdir ;; - *) # Relative path. - ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; - esac - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_sub_srcdir/configure.gnu; then - echo - $SHELL $ac_sub_srcdir/configure.gnu --help=recursive - elif test -f $ac_sub_srcdir/configure; then - echo - $SHELL $ac_sub_srcdir/configure --help=recursive - elif test -f $ac_sub_srcdir/configure.ac || - test -f $ac_sub_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\EOF - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -EOF - exit 0 -fi -exec 5>config.log -cat >&5 </dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -PATH = $PATH - -_ASUNAME -} >&5 - -cat >&5 <\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - ac_sep=" " ;; - *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" - ac_sep=" " ;; - esac - # Get rid of the leading space. -done - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - echo >&5 - echo "## ----------------- ##" >&5 - echo "## Cache variables. ##" >&5 - echo "## ----------------- ##" >&5 - echo >&5 - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} >&5 - sed "/^$/d" confdefs.h >conftest.log - if test -s conftest.log; then - echo >&5 - echo "## ------------ ##" >&5 - echo "## confdefs.h. ##" >&5 - echo "## ------------ ##" >&5 - echo >&5 - cat conftest.log >&5 - fi - (echo; echo) >&5 - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" >&5 - echo "$as_me: exit $exit_status" >&5 - rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:1045: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - cat "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:1056: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:1064: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:1080: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:1084: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:1090: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:1092: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:1094: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. It doesn't matter if - # we pass some twice (in addition to the command line arguments). - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" - ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:1113: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:1115: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac -echo "#! $SHELL" >conftest.sh -echo "exit 0" >>conftest.sh -chmod +x conftest.sh -if { (echo "$as_me:1135: PATH=\".;.\"; conftest.sh") >&5 - (PATH=".;."; conftest.sh) 2>&5 - ac_status=$? - echo "$as_me:1138: \$? = $ac_status" >&5 - (exit $ac_status); }; then - ac_path_separator=';' -else - ac_path_separator=: -fi -PATH_SEPARATOR="$ac_path_separator" -rm -f conftest.sh - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:1164: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:1184: checking for a BSD compatible install" >&5 -echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_IFS=$IFS; IFS=$ac_path_separator - for ac_dir in $PATH; do - IFS=$ac_save_IFS - # Account for people who put trailing slashes in PATH elements. - case $ac_dir/ in - / | ./ | .// | /cC/* \ - | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ - | /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if $as_executable_p "$ac_dir/$ac_prog"; then - if test $ac_prog = install && - grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:1233: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -echo "$as_me:1244: checking whether build environment is sane" >&5 -echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - { { echo "$as_me:1268: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&5 -echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken -alias in your environment" >&2;} - { (exit 1); exit 1; }; } - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - { { echo "$as_me:1281: error: newly created file is older than distributed files! -Check your system clock" >&5 -echo "$as_me: error: newly created file is older than distributed files! -Check your system clock" >&2;} - { (exit 1); exit 1; }; } -fi -echo "$as_me:1287: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -test "$program_prefix" != NONE && - program_transform_name="s,^,$program_prefix,;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s,\$,$program_suffix,;$program_transform_name" -# Double any \ or $. echo might interpret backslashes. -# By default was `s,x,x', remove it if useless. -cat <<\_ACEOF >conftest.sed -s/[\\$]/&&/g;s/;s,x,x,$// -_ACEOF -program_transform_name=`echo $program_transform_name | sed -f conftest.sed` -rm conftest.sed - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - am_backtick='`' - { echo "$as_me:1312: WARNING: ${am_backtick}missing' script is too old or missing" >&5 -echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} -fi - -for ac_prog in mawk gawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:1320: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_AWK="$ac_prog" -echo "$as_me:1335: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:1343: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:1346: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - -echo "$as_me:1353: checking whether ${MAKE-make} sets \${MAKE}" >&5 -echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` -if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.make <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftest.make -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:1373: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - SET_MAKE= -else - echo "$as_me:1377: result: no" >&5 -echo "${ECHO_T}no" >&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then - enableval="$enable_dependency_tracking" - -fi; -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - -if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - -rm -f .deps 2>/dev/null -mkdir .deps 2>/dev/null -if test -d .deps; then - DEPDIR=.deps -else - # MS-DOS does not allow filenames that begin with a dot. - DEPDIR=_deps -fi -rmdir .deps 2>/dev/null - -# test to see if srcdir already configured -if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - { { echo "$as_me:1413: error: source directory already configured; run \"make distclean\" there first" >&5 -echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} - { (exit 1); exit 1; }; } -fi - -# Define the identity of the package. -PACKAGE=fcgi -VERSION=2.4.0 - -cat >>confdefs.h <>confdefs.h <&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:1487: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1495: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1498: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:1507: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1522: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:1530: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:1533: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1546: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1561: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1569: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1572: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:1581: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1596: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:1604: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:1607: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:1620: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue -fi -ac_cv_prog_CC="cc" -echo "$as_me:1640: found $ac_dir/$ac_word" >&5 -break -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" ${1+"$@"} - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1662: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1665: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1676: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1691: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1699: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1702: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:1715: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1730: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:1738: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:1741: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - -test -z "$CC" && { { echo "$as_me:1753: error: no acceptable cc found in \$PATH" >&5 -echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:1758:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1761: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:1764: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:1766: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:1769: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:1771: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:1774: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line 1778 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:1794: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1797: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:1800: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. -for ac_file in `ls a.exe conftest.exe 2>/dev/null; - ls a.out conftest 2>/dev/null; - ls a.* conftest.* 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; - a.out ) # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool --akim. - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:1823: error: C compiler cannot create executables" >&5 -echo "$as_me: error: C compiler cannot create executables" >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:1829: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:1834: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:1840: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1843: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:1850: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:1858: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:1865: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1867: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:1870: checking for executable suffix" >&5 -echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1872: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:1875: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:1891: error: cannot compute EXEEXT: cannot compile and link" >&5 -echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:1897: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:1903: checking for object suffix" >&5 -echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 1909 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1921: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1924: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:1936: error: cannot compute OBJEXT: cannot compile" >&5 -echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:1943: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:1947: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 1953 "configure" -#include "confdefs.h" - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:1968: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1971: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1974: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1977: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:1989: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:1995: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 2001 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2013: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2016: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2019: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2022: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:2032: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2059: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2062: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2065: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2068: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line 2080 "configure" -#include "confdefs.h" -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2093: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2096: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2099: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2102: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line 2112 "configure" -#include "confdefs.h" -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2124: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2127: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2130: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2133: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_config_commands="$ac_config_commands default-1" - -am_make=${MAKE-make} -cat > confinc << 'END' -doit: - @echo done -END -# If we don't find an include directive, just comment out the code. -echo "$as_me:2168: checking for style of include used by $am_make" >&5 -echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 -am__include='#' -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote='"' - _am_result=BSD - fi -fi - -echo "$as_me:2195: result: $_am_result" >&5 -echo "${ECHO_T}$_am_result" >&6 -rm -f confinc confmf - -depcc="$CC" am_compiler_list= - -echo "$as_me:2201: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -echo "$as_me:2263: result: $am_cv_CC_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 -CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:2272: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line 2293 "configure" -#include "confdefs.h" -#include - Syntax error -_ACEOF -if { (eval echo "$as_me:2298: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:2304: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line 2327 "configure" -#include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:2331: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:2337: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:2374: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line 2384 "configure" -#include "confdefs.h" -#include - Syntax error -_ACEOF -if { (eval echo "$as_me:2389: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:2395: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line 2418 "configure" -#include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:2422: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:2428: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:2456: error: C preprocessor \"$CPP\" fails sanity check" >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:2479: checking for a BSD compatible install" >&5 -echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_save_IFS=$IFS; IFS=$ac_path_separator - for ac_dir in $PATH; do - IFS=$ac_save_IFS - # Account for people who put trailing slashes in PATH elements. - case $ac_dir/ in - / | ./ | .// | /cC/* \ - | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ - | /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if $as_executable_p "$ac_dir/$ac_prog"; then - if test $ac_prog = install && - grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:2528: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -# Check whether --enable-shared or --disable-shared was given. -if test "${enable_shared+set}" = set; then - enableval="$enable_shared" - p=${PACKAGE-default} -case $enableval in -yes) enable_shared=yes ;; -no) enable_shared=no ;; -*) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_shared=yes -fi; -# Check whether --enable-static or --disable-static was given. -if test "${enable_static+set}" = set; then - enableval="$enable_static" - p=${PACKAGE-default} -case $enableval in -yes) enable_static=yes ;; -no) enable_static=no ;; -*) - enable_static=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_static=yes -fi; -# Check whether --enable-fast-install or --disable-fast-install was given. -if test "${enable_fast_install+set}" = set; then - enableval="$enable_fast_install" - p=${PACKAGE-default} -case $enableval in -yes) enable_fast_install=yes ;; -no) enable_fast_install=no ;; -*) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," - for pkg in $enableval; do - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$ac_save_ifs" - ;; -esac -else - enable_fast_install=yes -fi; -# Make sure we can run config.sub. -$ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:2607: error: cannot run $ac_config_sub" >&5 -echo "$as_me: error: cannot run $ac_config_sub" >&2;} - { (exit 1); exit 1; }; } - -echo "$as_me:2611: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6 -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_build_alias=$build_alias -test -z "$ac_cv_build_alias" && - ac_cv_build_alias=`$ac_config_guess` -test -z "$ac_cv_build_alias" && - { { echo "$as_me:2620: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } -ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:2624: error: $ac_config_sub $ac_cv_build_alias failed." >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:2629: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6 -build=$ac_cv_build -build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -echo "$as_me:2636: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_host_alias=$host_alias -test -z "$ac_cv_host_alias" && - ac_cv_host_alias=$ac_cv_build_alias -ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:2645: error: $ac_config_sub $ac_cv_host_alias failed" >&5 -echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} - { (exit 1); exit 1; }; } - -fi -echo "$as_me:2650: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 -host=$ac_cv_host -host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -# Find the correct PATH separator. Usually this is `:', but -# DJGPP uses `;' like DOS. -if test "X${PATH_SEPARATOR+set}" != Xset; then - UNAME=${UNAME-`uname 2>/dev/null`} - case X$UNAME in - *-DOS) lt_cv_sys_path_separator=';' ;; - *) lt_cv_sys_path_separator=':' ;; - esac - PATH_SEPARATOR=$lt_cv_sys_path_separator -fi - -# Check whether --with-gnu-ld or --without-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then - withval="$with_gnu_ld" - test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi; -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - echo "$as_me:2678: checking for ld used by GCC" >&5 -echo $ECHO_N "checking for ld used by GCC... $ECHO_C" >&6 - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | [A-Za-z]:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - echo "$as_me:2708: checking for GNU ld" >&5 -echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6 -else - echo "$as_me:2711: checking for non-GNU ld" >&5 -echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6 -fi -if test "${lt_cv_path_LD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then - test "$with_gnu_ld" != no && break - else - test "$with_gnu_ld" != yes && break - fi - fi - done - IFS="$ac_save_ifs" -else - lt_cv_path_LD="$LD" # Let the user override the test with a path. -fi -fi - -LD="$lt_cv_path_LD" -if test -n "$LD"; then - echo "$as_me:2741: result: $LD" >&5 -echo "${ECHO_T}$LD" >&6 -else - echo "$as_me:2744: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -test -z "$LD" && { { echo "$as_me:2747: error: no acceptable ld found in \$PATH" >&5 -echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} - { (exit 1); exit 1; }; } -echo "$as_me:2750: checking if the linker ($LD) is GNU ld" >&5 -echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6 -if test "${lt_cv_prog_gnu_ld+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # I'd rather use --version here, but apparently some GNU ld's only accept -v. -if $LD -v 2>&1 &5; then - lt_cv_prog_gnu_ld=yes -else - lt_cv_prog_gnu_ld=no -fi -fi -echo "$as_me:2762: result: $lt_cv_prog_gnu_ld" >&5 -echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6 -with_gnu_ld=$lt_cv_prog_gnu_ld - -echo "$as_me:2766: checking for $LD option to reload object files" >&5 -echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6 -if test "${lt_cv_ld_reload_flag+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_ld_reload_flag='-r' -fi -echo "$as_me:2773: result: $lt_cv_ld_reload_flag" >&5 -echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6 -reload_flag=$lt_cv_ld_reload_flag -test -n "$reload_flag" && reload_flag=" $reload_flag" - -echo "$as_me:2778: checking for BSD-compatible nm" >&5 -echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6 -if test "${lt_cv_path_NM+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/${ac_tool_prefix}nm - if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then - lt_cv_path_NM="$tmp_nm -B" - break - elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then - lt_cv_path_NM="$tmp_nm -p" - break - else - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - fi - fi - done - IFS="$ac_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi -fi - -NM="$lt_cv_path_NM" -echo "$as_me:2814: result: $NM" >&5 -echo "${ECHO_T}$NM" >&6 - -echo "$as_me:2817: checking whether ln -s works" >&5 -echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - echo "$as_me:2821: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:2824: result: no, using $LN_S" >&5 -echo "${ECHO_T}no, using $LN_S" >&6 -fi - -echo "$as_me:2828: checking how to recognise dependant libraries" >&5 -echo $ECHO_N "checking how to recognise dependant libraries... $ECHO_C" >&6 -if test "${lt_cv_deplibs_check_method+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given egrep regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix4* | aix5*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi4*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin* | mingw* | pw32*) - lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' - lt_cv_file_magic_cmd='/usr/bin/file -L' - case "$host_os" in - rhapsody* | darwin1.[012]) - lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` - ;; - *) # Darwin 1.3 on - lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' - ;; - esac - ;; - -freebsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20*|hpux11*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - -irix5* | irix6*) - case $host_os in - irix5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux-gnu*) - case $host_cpu in - alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv5uw[78]* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - esac - ;; -esac - -fi -echo "$as_me:3006: result: $lt_cv_deplibs_check_method" >&5 -echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6 -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method - -# Check for command to grab the raw symbol name followed by C symbol from nm. -echo "$as_me:3012: checking command to parse $NM output" >&5 -echo $ECHO_N "checking command to parse $NM output... $ECHO_C" >&6 -if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32*) - symcode='[ABCDGISTW]' - ;; -hpux*) # Its linker distinguishes data from code symbols - lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix*) - symcode='[BCDEGRST]' - ;; -solaris* | sysv5*) - symcode='[BDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $host_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then - symcode='[ABCDGISTW]' -fi - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. -lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - rm -f conftest* - cat > conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3096: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { (eval echo "$as_me:3100: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 - (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 - ac_status=$? - echo "$as_me:3103: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if egrep ' nm_test_var$' "$nlist" >/dev/null; then - if egrep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr address; -} -lt_preloaded_symbols[] = -{ -EOF - sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$no_builtin_flag" - if { (eval echo "$as_me:3155: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:3158: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest; then - pipe_works=yes - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" -if test -z "$lt_cv_sys_global_symbol_pipe"; then - global_symbol_to_cdecl= - global_symbol_to_c_name_address= -else - global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" - global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" -fi -if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; -then - echo "$as_me:3199: result: failed" >&5 -echo "${ECHO_T}failed" >&6 -else - echo "$as_me:3202: result: ok" >&5 -echo "${ECHO_T}ok" >&6 -fi - -for ac_header in dlfcn.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:3209: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 3215 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:3219: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:3225: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:3244: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6 -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$as_me:3313: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6 -else - echo "$as_me:3316: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - echo "$as_me:3322: checking for file" >&5 -echo $ECHO_N "checking for file... $ECHO_C" >&6 -if test "${lt_cv_path_MAGIC_CMD+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $MAGIC_CMD in - /*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; - ?:/*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path. - ;; - *) - ac_save_MAGIC_CMD="$MAGIC_CMD" - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="/usr/bin:$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$ac_save_ifs" - MAGIC_CMD="$ac_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - echo "$as_me:3377: result: $MAGIC_CMD" >&5 -echo "${ECHO_T}$MAGIC_CMD" >&6 -else - echo "$as_me:3380: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:3396: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -echo "$as_me:3411: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - echo "$as_me:3419: result: $RANLIB" >&5 -echo "${ECHO_T}$RANLIB" >&6 -else - echo "$as_me:3422: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo "$as_me:3431: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_RANLIB="ranlib" -echo "$as_me:3446: found $ac_dir/$ac_word" >&5 -break -done - - test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - echo "$as_me:3455: result: $ac_ct_RANLIB" >&5 -echo "${ECHO_T}$ac_ct_RANLIB" >&6 -else - echo "$as_me:3458: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - RANLIB=$ac_ct_RANLIB -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:3470: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_STRIP="${ac_tool_prefix}strip" -echo "$as_me:3485: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - echo "$as_me:3493: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 -else - echo "$as_me:3496: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -echo "$as_me:3505: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_STRIP="strip" -echo "$as_me:3520: found $ac_dir/$ac_word" >&5 -break -done - - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - echo "$as_me:3529: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 -else - echo "$as_me:3532: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - STRIP=$ac_ct_STRIP -else - STRIP="$ac_cv_prog_STRIP" -fi - -enable_dlopen=no -enable_win32_dll=no - -# Check whether --enable-libtool-lock or --disable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then - enableval="$enable_libtool_lock" - -fi; -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -*-*-irix6*) - # Find out which ABI we are using. - echo '#line 3556 "configure"' > conftest.$ac_ext - if { (eval echo "$as_me:3557: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3560: \$? = $ac_status" >&5 - (exit $ac_status); }; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - echo "$as_me:3581: checking whether the C compiler needs -belf" >&5 -echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6 -if test "${lt_cv_cc_needs_belf+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat >conftest.$ac_ext <<_ACEOF -#line 3594 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:3606: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:3609: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:3612: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3615: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - lt_cv_cc_needs_belf=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -lt_cv_cc_needs_belf=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -echo "$as_me:3631: result: $lt_cv_cc_needs_belf" >&5 -echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6 - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; - -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" -need_locks="$enable_libtool_lock" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -if test x"$host" != x"$build"; then - ac_tool_prefix=${host_alias}- -else - ac_tool_prefix= -fi - -# Transform linux* to *-*-linux-gnu*, to support old configure scripts. -case $host_os in -linux-gnu*) ;; -linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` -esac - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Allow CC to be a program name with arguments. -set dummy $CC -compiler="$2" - -echo "$as_me:3731: checking for objdir" >&5 -echo $ECHO_N "checking for objdir... $ECHO_C" >&6 -rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - objdir=_libs -fi -rmdir .libs 2>/dev/null -echo "$as_me:3742: result: $objdir" >&5 -echo "${ECHO_T}$objdir" >&6 - -# Check whether --with-pic or --without-pic was given. -if test "${with_pic+set}" = set; then - withval="$with_pic" - pic_mode="$withval" -else - pic_mode=default -fi; -test -z "$pic_mode" && pic_mode=default - -# We assume here that the value for lt_cv_prog_cc_pic will not be cached -# in isolation, and that seeing it set (from the cache) indicates that -# the associated values are set (in the cache) correctly too. -echo "$as_me:3757: checking for $compiler option to produce PIC" >&5 -echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_pic+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_pic= - lt_cv_prog_cc_shlib= - lt_cv_prog_cc_wl= - lt_cv_prog_cc_static= - lt_cv_prog_cc_no_builtin= - lt_cv_prog_cc_can_build_shared=$can_build_shared - - if test "$GCC" = yes; then - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-static' - - case $host_os in - aix*) - # Below there is a dirty hack to force normal static linking with -ldl - # The problem is because libdl dynamically linked with both libc and - # libC (AIX C++ library), which obviously doesn't included in libraries - # list by gcc. This cause undefined symbols with -static flags. - # This hack allows C programs to be linked with "-static -ldl", but - # not sure about C++ programs. - lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | irix5* | irix6* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_cv_prog_cc_pic='-fno-common' - ;; - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_cv_prog_cc_pic=-Kconform_pic - fi - ;; - *) - lt_cv_prog_cc_pic='-fPIC' - ;; - esac - else - # PORTME Check for PIC flags for the system compiler. - case $host_os in - aix3* | aix4* | aix5*) - lt_cv_prog_cc_wl='-Wl,' - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_cv_prog_cc_static='-Bstatic' - else - lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - hpux9* | hpux10* | hpux11*) - # Is there a better lt_cv_prog_cc_static that works with the bundled CC? - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive" - lt_cv_prog_cc_pic='+Z' - ;; - - irix5* | irix6*) - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - # PIC (with -KPIC) is the default. - ;; - - cygwin* | mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_cv_prog_cc_pic='-DDLL_EXPORT' - ;; - - newsos6) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - ;; - - osf3* | osf4* | osf5*) - # All OSF/1 code is PIC. - lt_cv_prog_cc_wl='-Wl,' - lt_cv_prog_cc_static='-non_shared' - ;; - - sco3.2v5*) - lt_cv_prog_cc_pic='-Kpic' - lt_cv_prog_cc_static='-dn' - lt_cv_prog_cc_shlib='-belf' - ;; - - solaris*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Wl,' - ;; - - sunos4*) - lt_cv_prog_cc_pic='-PIC' - lt_cv_prog_cc_static='-Bstatic' - lt_cv_prog_cc_wl='-Qoption ld ' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - lt_cv_prog_cc_pic='-KPIC' - lt_cv_prog_cc_static='-Bstatic' - if test "x$host_vendor" = xsni; then - lt_cv_prog_cc_wl='-LD' - else - lt_cv_prog_cc_wl='-Wl,' - fi - ;; - - uts4*) - lt_cv_prog_cc_pic='-pic' - lt_cv_prog_cc_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_cv_prog_cc_pic='-Kconform_pic' - lt_cv_prog_cc_static='-Bstatic' - fi - ;; - - *) - lt_cv_prog_cc_can_build_shared=no - ;; - esac - fi - -fi - -if test -z "$lt_cv_prog_cc_pic"; then - echo "$as_me:3904: result: none" >&5 -echo "${ECHO_T}none" >&6 -else - echo "$as_me:3907: result: $lt_cv_prog_cc_pic" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic" >&6 - - # Check to make sure the pic_flag actually works. - echo "$as_me:3911: checking if $compiler PIC flag $lt_cv_prog_cc_pic works" >&5 -echo $ECHO_N "checking if $compiler PIC flag $lt_cv_prog_cc_pic works... $ECHO_C" >&6 - if test "${lt_cv_prog_cc_pic_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC" - cat >conftest.$ac_ext <<_ACEOF -#line 3919 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:3931: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3934: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3937: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3940: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - case $host_os in - hpux9* | hpux10* | hpux11*) - # On HP-UX, both CC and GCC only warn that PIC is supported... then - # they create non-PIC objects. So, if there were any warnings, we - # assume that PIC is not supported. - if test -s conftest.err; then - lt_cv_prog_cc_pic_works=no - else - lt_cv_prog_cc_pic_works=yes - fi - ;; - *) - lt_cv_prog_cc_pic_works=yes - ;; - esac - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 - lt_cv_prog_cc_pic_works=no - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - -fi - - if test "X$lt_cv_prog_cc_pic_works" = Xno; then - lt_cv_prog_cc_pic= - lt_cv_prog_cc_can_build_shared=no - else - lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic" - fi - - echo "$as_me:3976: result: $lt_cv_prog_cc_pic_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_pic_works" >&6 -fi - -# Check for any special shared library compilation flags. -if test -n "$lt_cv_prog_cc_shlib"; then - { echo "$as_me:3982: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&5 -echo "$as_me: WARNING: \`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries" >&2;} - if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$lt_cv_prog_cc_shlib[ ]" >/dev/null; then : - else - { echo "$as_me:3986: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&5 -echo "$as_me: WARNING: add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure" >&2;} - lt_cv_prog_cc_can_build_shared=no - fi -fi - -echo "$as_me:3992: checking if $compiler static flag $lt_cv_prog_cc_static works" >&5 -echo $ECHO_N "checking if $compiler static flag $lt_cv_prog_cc_static works... $ECHO_C" >&6 -if test "${lt_cv_prog_cc_static_works+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - lt_cv_prog_cc_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static" - cat >conftest.$ac_ext <<_ACEOF -#line 4001 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4013: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:4016: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4019: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4022: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - lt_cv_prog_cc_static_works=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi - -# Belt *and* braces to stop my trousers falling down: -test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static= -echo "$as_me:4036: result: $lt_cv_prog_cc_static_works" >&5 -echo "${ECHO_T}$lt_cv_prog_cc_static_works" >&6 - -pic_flag="$lt_cv_prog_cc_pic" -special_shlib_compile_flags="$lt_cv_prog_cc_shlib" -wl="$lt_cv_prog_cc_wl" -link_static_flag="$lt_cv_prog_cc_static" -no_builtin_flag="$lt_cv_prog_cc_no_builtin" -can_build_shared="$lt_cv_prog_cc_can_build_shared" - -# Check to see if options -o and -c are simultaneously supported by compiler -echo "$as_me:4047: checking if $compiler supports -c -o file.$ac_objext" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6 -if test "${lt_cv_compiler_c_o+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -$rm -r conftest 2>/dev/null -mkdir conftest -cd conftest -echo "int some_variable = 0;" > conftest.$ac_ext -mkdir out -# According to Tom Tromey, Ian Lance Taylor reported there are C compilers -# that will create temporary files in the current directory regardless of -# the output directory. Thus, making CWD read-only will cause this test -# to fail, enabling locking or at least warning the user not to do parallel -# builds. -chmod -w . -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -o out/conftest2.$ac_objext" -compiler_c_o=no -if { (eval echo configure:4067: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s out/conftest.err; then - lt_cv_compiler_c_o=no - else - lt_cv_compiler_c_o=yes - fi -else - # Append any errors to the config.log. - cat out/conftest.err 1>&5 - lt_cv_compiler_c_o=no -fi -CFLAGS="$save_CFLAGS" -chmod u+w . -$rm conftest* out/* -rmdir out -cd .. -rmdir conftest -$rm -r conftest 2>/dev/null - -fi - -compiler_c_o=$lt_cv_compiler_c_o -echo "$as_me:4091: result: $compiler_c_o" >&5 -echo "${ECHO_T}$compiler_c_o" >&6 - -if test x"$compiler_c_o" = x"yes"; then - # Check to see if we can write to a .lo - echo "$as_me:4096: checking if $compiler supports -c -o file.lo" >&5 -echo $ECHO_N "checking if $compiler supports -c -o file.lo... $ECHO_C" >&6 - if test "${lt_cv_compiler_o_lo+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - lt_cv_compiler_o_lo=no - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -c -o conftest.lo" - save_objext="$ac_objext" - ac_objext=lo - cat >conftest.$ac_ext <<_ACEOF -#line 4108 "configure" -#include "confdefs.h" - -int -main () -{ -int some_variable = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:4120: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:4123: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4126: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4129: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - lt_cv_compiler_o_lo=no - else - lt_cv_compiler_o_lo=yes - fi - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext - ac_objext="$save_objext" - CFLAGS="$save_CFLAGS" - -fi - - compiler_o_lo=$lt_cv_compiler_o_lo - echo "$as_me:4150: result: $compiler_o_lo" >&5 -echo "${ECHO_T}$compiler_o_lo" >&6 -else - compiler_o_lo=no -fi - -# Check to see if we can do hard links to lock some files if needed -hard_links="nottested" -if test "$compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - echo "$as_me:4160: checking if we can lock with hard links" >&5 -echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6 - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - echo "$as_me:4168: result: $hard_links" >&5 -echo "${ECHO_T}$hard_links" >&6 - if test "$hard_links" = no; then - { echo "$as_me:4171: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - -if test "$GCC" = yes; then - # Check to see if options -fno-rtti -fno-exceptions are supported by compiler - echo "$as_me:4181: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6 - echo "int some_variable = 0;" > conftest.$ac_ext - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext" - compiler_rtti_exceptions=no - cat >conftest.$ac_ext <<_ACEOF -#line 4188 "configure" -#include "confdefs.h" - -int -main () -{ -int some_variable = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:4200: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:4203: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4206: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:4209: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - compiler_rtti_exceptions=no - else - compiler_rtti_exceptions=yes - fi - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext - CFLAGS="$save_CFLAGS" - echo "$as_me:4225: result: $compiler_rtti_exceptions" >&5 -echo "${ECHO_T}$compiler_rtti_exceptions" >&6 - - if test "$compiler_rtti_exceptions" = "yes"; then - no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' - else - no_builtin_flag=' -fno-builtin' - fi -fi - -# See if the linker supports building shared libraries. -echo "$as_me:4236: checking whether the linker ($LD) supports shared libraries" >&5 -echo $ECHO_N "checking whether the linker ($LD) supports shared libraries... $ECHO_C" >&6 - -allow_undefined_flag= -no_undefined_flag= -need_lib_prefix=unknown -need_version=unknown -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -archive_cmds= -archive_expsym_cmds= -old_archive_from_new_cmds= -old_archive_from_expsyms_cmds= -export_dynamic_flag_spec= -whole_archive_flag_spec= -thread_safe_flag_spec= -hardcode_into_libs=no -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no -hardcode_shlibpath_var=unsupported -runpath_var= -link_all_deplibs=unknown -always_export_symbols=no -export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' -# include_expsyms should be a list of space-separated symbols to be *always* -# included in the symbol list -include_expsyms= -# exclude_expsyms can be an egrep regular expression of symbols to exclude -# it will be wrapped by ` (' and `)$', so one must not match beginning or -# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', -# as well as any symbol that contains `d'. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_" -# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out -# platforms (ab)use it in PIC code, but their linkers get confused if -# the symbol is explicitly referenced. Since portable code cannot -# rely on this symbol name, it's probably fine to never include it in -# preloaded symbol tables. -extract_expsyms_cmds= - -case $host_os in -cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; -openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX, the GNU linker is very broken - # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available. - ld_shlibs=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can use - # them. - ld_shlibs=no - ;; - - beos*) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - allow_undefined_flag=unsupported - always_export_symbols=yes - - extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ - sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~ - test -f $output_objdir/impgen.exe || (cd $output_objdir && \ - if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \ - else $CC -o impgen impgen.c ; fi)~ - $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' - - old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' - - # cygwin and mingw dlls have different entry points and sets of symbols - # to exclude. - # FIXME: what about values for MSVC? - dll_entry=__cygwin_dll_entry@12 - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ - case $host_os in - mingw*) - # mingw values - dll_entry=_DllMainCRTStartup@12 - dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ - ;; - esac - - # mingw and cygwin differ, and it's simplest to just exclude the union - # of the two symbol sets. - dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 - - # recent cygwin and mingw systems supply a stub DllMain which the user - # can override, but on older systems we have to supply one (in ltdll.c) - if test "x$lt_cv_need_dllmain" = "xyes"; then - ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext " - ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~ - test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' - else - ltdll_obj= - ltdll_cmds= - fi - - # Extract the symbol export list from an `--export-all' def file, - # then regenerate the def file from the symbol export list, so that - # the compiled dll only exports the symbol export list. - # Be careful not to strip the DATA tag left be newer dlltools. - export_symbols_cmds="$ltdll_cmds"' - $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ - sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' - - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is. - # If DATA tags from a recent dlltool are present, honour them! - archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname-def; - else - echo EXPORTS > $output_objdir/$soname-def; - _lt_hint=1; - cat $export_symbols | while read symbol; do - set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $output_objdir/$soname-def;; - esac; - _lt_hint=`expr 1 + \$_lt_hint`; - done; - fi~ - '"$ltdll_cmds"' - $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ - $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ - $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ - $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = yes; then - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - case $host_os in - cygwin* | mingw* | pw32*) - # dlltool doesn't understand --whole-archive et. al. - whole_archive_flag_spec= - ;; - *) - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - ;; - esac - fi -else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - hardcode_direct=yes - archive_cmds='' - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - hardcode_direct=yes - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - esac - - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - shared_flag='${wl}-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall can do strange things, so it is better to - # generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' - archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='${wl}-berok' - # This is a bit strange, but is similar to how AIX traditionally builds - # it's shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' - fi - fi - ;; - - amigaos*) - archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - # see comment about different semantics on the GNU ld section - ld_shlibs=no - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - ;; - - darwin* | rhapsody*) - case "$host_os" in - rhapsody* | darwin1.[012]) - allow_undefined_flag='-undefined suppress' - ;; - *) # Darwin 1.3 on - allow_undefined_flag='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' - # We need to add '_' to the symbols in $export_symbols first - #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' - hardcode_direct=yes - hardcode_shlibpath_var=no - whole_archive_flag_spec='-all_load $convenience' - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9* | hpux10* | hpux11*) - case $host_os in - hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; - *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; - esac - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_minus_L=yes # Not in the search PATH, but as the default - # location of the library. - export_dynamic_flag_spec='${wl}-E' - ;; - - irix5* | irix6*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - openbsd*) - hardcode_direct=yes - hardcode_shlibpath_var=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - #Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - - sco3.2v5*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - export_dynamic_flag_spec='${wl}-Bexport' - ;; - - solaris*) - # gcc --version < 3.0 without binutils cannot create self contained - # shared libraries reliably, requiring libgcc.a to resolve some of - # the object symbols generated in some cases. Libraries that use - # assert need libgcc.a to resolve __eprintf, for example. Linking - # a copy of libgcc.a into every shared library to guarantee resolving - # such symbols causes other problems: According to Tim Van Holder - # , C++ libraries end up with a separate - # (to the application) exception stack for one thing. - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - case `$CC --version 2>/dev/null` in - [12].*) - cat <&2 - -*** Warning: Releases of GCC earlier than version 3.0 cannot reliably -*** create self contained shared libraries on Solaris systems, without -*** introducing a dependency on libgcc.a. Therefore, libtool is disabling -*** -no-undefined support, which will at least allow you to build shared -*** libraries. However, you may find that when you link such libraries -*** into an application without using GCC, you have to manually add -*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to -*** upgrade to a newer version of GCC. Another option is to rebuild your -*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. - -EOF - no_undefined_flag= - ;; - esac - fi - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - if test "x$host_vendor" = xsno; then - archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - else - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv5*) - no_undefined_flag=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - hardcode_libdir_flag_spec= - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4.2uw2*) - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=no - hardcode_shlibpath_var=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5uw7* | unixware7*) - no_undefined_flag='${wl}-z ${wl}text' - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac -fi -echo "$as_me:4916: result: $ld_shlibs" >&5 -echo "${ECHO_T}$ld_shlibs" >&6 -test "$ld_shlibs" = no && can_build_shared=no - -# Check hardcoding attributes. -echo "$as_me:4921: checking how to hardcode library paths into programs" >&5 -echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6 -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || \ - test -n "$runpath_var"; then - - # We can hardcode non-existant directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$hardcode_shlibpath_var" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -echo "$as_me:4945: result: $hardcode_action" >&5 -echo "${ECHO_T}$hardcode_action" >&6 - -striplib= -old_striplib= -echo "$as_me:4950: checking whether stripping libraries is possible" >&5 -echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6 -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - echo "$as_me:4955: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me:4958: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -reload_cmds='$LD$reload_flag -o $output$reload_objs' -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -# PORTME Fill in your ld.so characteristics -echo "$as_me:4966: checking dynamic linker characteristics" >&5 -echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6 -library_names_spec= -libname_spec='lib$name' -soname_spec= -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}.so$major' - ;; - -aix4* | aix5*) - version_type=linux - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can - # not hardcode correct soname into executable. Probably we can - # add versioning support to collect2, so additional links can - # be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}.so$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}.so' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - export_dynamic_flag_spec=-rdynamic - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - need_version=no - need_lib_prefix=no - case $GCC,$host_os in - yes,cygwin*) - library_names_spec='$libname.dll.a' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog .libs/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - ;; - yes,mingw*) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` - ;; - yes,pw32*) - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/./-/g'`${versuffix}.dll' - ;; - *) - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' - soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - *) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - dynamic_linker="$host_os dld.sl" - version_type=sunos - need_lib_prefix=no - need_version=no - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' - soname_spec='${libname}${release}.sl$major' - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6*) - version_type=irix - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' - case $host_os in - irix5*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux-gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' - soname_spec='${libname}${release}.so$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case "$host_os" in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - ;; - -os2*) - libname_spec='$name' - need_lib_prefix=no - library_names_spec='$libname.dll $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_version=no - soname_spec='${libname}${release}.so' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}.so$major' - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' - soname_spec='${libname}${release}.so$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' - soname_spec='$libname.so.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -*) - dynamic_linker=no - ;; -esac -echo "$as_me:5359: result: $dynamic_linker" >&5 -echo "${ECHO_T}$dynamic_linker" >&6 -test "$dynamic_linker" = no && can_build_shared=no - -# Report the final consequences. -echo "$as_me:5364: checking if libtool supports shared libraries" >&5 -echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6 -echo "$as_me:5366: result: $can_build_shared" >&5 -echo "${ECHO_T}$can_build_shared" >&6 - -echo "$as_me:5369: checking whether to build shared libraries" >&5 -echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6 -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; -esac -echo "$as_me:5390: result: $enable_shared" >&5 -echo "${ECHO_T}$enable_shared" >&6 - -echo "$as_me:5393: checking whether to build static libraries" >&5 -echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6 -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -echo "$as_me:5397: result: $enable_static" >&5 -echo "${ECHO_T}$enable_static" >&6 - -if test "$hardcode_action" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - cygwin* | mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - *) - echo "$as_me:5435: checking for shl_load" >&5 -echo $ECHO_N "checking for shl_load... $ECHO_C" >&6 -if test "${ac_cv_func_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 5441 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char shl_load (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_shl_load) || defined (__stub___shl_load) -choke me -#else -f = shl_load; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5472: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5475: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5478: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5481: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_shl_load=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:5491: result: $ac_cv_func_shl_load" >&5 -echo "${ECHO_T}$ac_cv_func_shl_load" >&6 -if test $ac_cv_func_shl_load = yes; then - lt_cv_dlopen="shl_load" -else - echo "$as_me:5496: checking for shl_load in -ldld" >&5 -echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_shl_load+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 5504 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char shl_load (); -int -main () -{ -shl_load (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5523: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5526: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5529: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5532: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_shl_load=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_dld_shl_load=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:5543: result: $ac_cv_lib_dld_shl_load" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6 -if test $ac_cv_lib_dld_shl_load = yes; then - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld" -else - echo "$as_me:5548: checking for dlopen" >&5 -echo $ECHO_N "checking for dlopen... $ECHO_C" >&6 -if test "${ac_cv_func_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 5554 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char dlopen (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_dlopen) || defined (__stub___dlopen) -choke me -#else -f = dlopen; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5585: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5588: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5591: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5594: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_func_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_dlopen=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:5604: result: $ac_cv_func_dlopen" >&5 -echo "${ECHO_T}$ac_cv_func_dlopen" >&6 -if test $ac_cv_func_dlopen = yes; then - lt_cv_dlopen="dlopen" -else - echo "$as_me:5609: checking for dlopen in -ldl" >&5 -echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6 -if test "${ac_cv_lib_dl_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 5617 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5636: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5639: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5642: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5645: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dl_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_dl_dlopen=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:5656: result: $ac_cv_lib_dl_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6 -if test $ac_cv_lib_dl_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - echo "$as_me:5661: checking for dlopen in -lsvld" >&5 -echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6 -if test "${ac_cv_lib_svld_dlopen+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 5669 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dlopen (); -int -main () -{ -dlopen (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5688: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5691: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5694: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5697: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_svld_dlopen=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_svld_dlopen=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:5708: result: $ac_cv_lib_svld_dlopen" >&5 -echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6 -if test $ac_cv_lib_svld_dlopen = yes; then - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - echo "$as_me:5713: checking for dld_link in -ldld" >&5 -echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6 -if test "${ac_cv_lib_dld_dld_link+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 5721 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char dld_link (); -int -main () -{ -dld_link (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5740: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5743: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5746: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:5749: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_dld_dld_link=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_dld_dld_link=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:5760: result: $ac_cv_lib_dld_dld_link" >&5 -echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6 -if test $ac_cv_lib_dld_dld_link = yes; then - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld" -fi - -fi - -fi - -fi - -fi - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - echo "$as_me:5796: checking whether a program can dlopen itself" >&5 -echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:5868: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5871: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - -fi -echo "$as_me:5888: result: $lt_cv_dlopen_self" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self" >&6 - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - echo "$as_me:5893: checking whether a statically linked program can dlopen itself" >&5 -echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6 -if test "${lt_cv_dlopen_self_static+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -} -EOF - if { (eval echo "$as_me:5965: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:5968: \$? = $ac_status" >&5 - (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_unknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - -fi -echo "$as_me:5985: result: $lt_cv_dlopen_self_static" >&5 -echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6 - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - -if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - echo "$as_me:6015: checking whether -lc should be explicitly linked in" >&5 -echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6 - if test "${lt_cv_archive_cmds_need_lc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - $rm conftest* - echo 'static int dummy;' > conftest.$ac_ext - - if { (eval echo "$as_me:6023: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6026: \$? = $ac_status" >&5 - (exit $ac_status); }; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_cv_prog_cc_wl - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { (eval echo "$as_me:6040: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5 - (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - echo "$as_me:6043: \$? = $ac_status" >&5 - (exit $ac_status); } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi -fi - - echo "$as_me:6056: result: $lt_cv_archive_cmds_need_lc" >&5 -echo "${ECHO_T}$lt_cv_archive_cmds_need_lc" >&6 - ;; - esac -fi -need_lc=${lt_cv_archive_cmds_need_lc-yes} - -# The second clause should only fire when bootstrapping the -# libtool distribution, otherwise you forgot to ship ltmain.sh -# with your package, and you will get complaints that there are -# no rules to generate ltmain.sh. -if test -f "$ltmain"; then - : -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi - -if test -f "$ltmain"; then - trap "$rm \"${ofile}T\"; exit 1" 1 2 15 - $rm -f "${ofile}T" - - echo creating $ofile - - # Now quote all the things that may contain metacharacters while being - # careful not to overquote the AC_SUBSTed values. We take copies of the - # variables and quote the copies for generation of the libtool script. - for var in echo old_CC old_CFLAGS \ - AR AR_FLAGS CC LD LN_S NM SHELL \ - reload_flag reload_cmds wl \ - pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ - thread_safe_flag_spec whole_archive_flag_spec libname_spec \ - library_names_spec soname_spec \ - RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ - postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ - old_striplib striplib file_magic_cmd export_symbols_cmds \ - deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ - global_symbol_to_c_name_address \ - hardcode_libdir_flag_spec hardcode_libdir_separator \ - sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ - compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do - - case $var in - reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ - old_postinstall_cmds | old_postuninstall_cmds | \ - export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ - extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ - postinstall_cmds | postuninstall_cmds | \ - finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) - # Double-quote double-evaled strings. - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" - ;; - *) - eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" - ;; - esac - done - - cat <<__EOF__ > "${ofile}T" -#! $SHELL - -# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996-2000 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="sed -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# ### BEGIN LIBTOOL CONFIG - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$need_lc - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# The default C compiler. -CC=$lt_CC - -# Is the compiler the GNU C compiler? -with_gcc=$GCC - -# The linker used to build libraries. -LD=$lt_LD - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_wl - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_pic_flag -pic_mode=$pic_mode - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_compiler_c_o - -# Can we write directly to a .lo ? -compiler_o_lo=$lt_compiler_o_lo - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_link_static_flag - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_no_builtin_flag - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_thread_safe_flag_spec - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_old_archive_cmds -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build and install a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$hardcode_direct - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$fix_srcfile_path" - -# Set to yes if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# ### END LIBTOOL CONFIG - -__EOF__ - - case $host_os in - aix3*) - cat <<\EOF >> "${ofile}T" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - case $host_os in - cygwin* | mingw* | pw32* | os2*) - cat <<'EOF' >> "${ofile}T" - # This is a source program that is used to create dlls on Windows - # Don't remove nor modify the starting and closing comments -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ - # This is a source program that is used to create import libraries - # on Windows for dlls which lack them. Don't remove nor modify the - # starting and closing comments -# /* impgen.c starts here */ -# /* Copyright (C) 1999-2000 Free Software Foundation, Inc. -# -# This file is part of GNU libtool. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# */ -# -# #include /* for printf() */ -# #include /* for open(), lseek(), read() */ -# #include /* for O_RDONLY, O_BINARY */ -# #include /* for strdup() */ -# -# /* O_BINARY isn't required (or even defined sometimes) under Unix */ -# #ifndef O_BINARY -# #define O_BINARY 0 -# #endif -# -# static unsigned int -# pe_get16 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[2]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 2); -# return b[0] + (b[1]<<8); -# } -# -# static unsigned int -# pe_get32 (fd, offset) -# int fd; -# int offset; -# { -# unsigned char b[4]; -# lseek (fd, offset, SEEK_SET); -# read (fd, b, 4); -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# static unsigned int -# pe_as32 (ptr) -# void *ptr; -# { -# unsigned char *b = ptr; -# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); -# } -# -# int -# main (argc, argv) -# int argc; -# char *argv[]; -# { -# int dll; -# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; -# unsigned long export_rva, export_size, nsections, secptr, expptr; -# unsigned long name_rvas, nexp; -# unsigned char *expdata, *erva; -# char *filename, *dll_name; -# -# filename = argv[1]; -# -# dll = open(filename, O_RDONLY|O_BINARY); -# if (dll < 1) -# return 1; -# -# dll_name = filename; -# -# for (i=0; filename[i]; i++) -# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') -# dll_name = filename + i +1; -# -# pe_header_offset = pe_get32 (dll, 0x3c); -# opthdr_ofs = pe_header_offset + 4 + 20; -# num_entries = pe_get32 (dll, opthdr_ofs + 92); -# -# if (num_entries < 1) /* no exports */ -# return 1; -# -# export_rva = pe_get32 (dll, opthdr_ofs + 96); -# export_size = pe_get32 (dll, opthdr_ofs + 100); -# nsections = pe_get16 (dll, pe_header_offset + 4 +2); -# secptr = (pe_header_offset + 4 + 20 + -# pe_get16 (dll, pe_header_offset + 4 + 16)); -# -# expptr = 0; -# for (i = 0; i < nsections; i++) -# { -# char sname[8]; -# unsigned long secptr1 = secptr + 40 * i; -# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); -# unsigned long vsize = pe_get32 (dll, secptr1 + 16); -# unsigned long fptr = pe_get32 (dll, secptr1 + 20); -# lseek(dll, secptr1, SEEK_SET); -# read(dll, sname, 8); -# if (vaddr <= export_rva && vaddr+vsize > export_rva) -# { -# expptr = fptr + (export_rva - vaddr); -# if (export_rva + export_size > vaddr + vsize) -# export_size = vsize - (export_rva - vaddr); -# break; -# } -# } -# -# expdata = (unsigned char*)malloc(export_size); -# lseek (dll, expptr, SEEK_SET); -# read (dll, expdata, export_size); -# erva = expdata - export_rva; -# -# nexp = pe_as32 (expdata+24); -# name_rvas = pe_as32 (expdata+32); -# -# printf ("EXPORTS\n"); -# for (i = 0; i> "${ofile}T" || (rm -f "${ofile}T"; exit 1) - - mv -f "${ofile}T" "$ofile" || \ - (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T") - chmod +x "$ofile" -fi - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - -# Prevent multiple expansion - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -n "$ac_tool_prefix"; then - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:6631: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" -echo "$as_me:6646: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - echo "$as_me:6654: result: $CXX" >&5 -echo "${ECHO_T}$CXX" >&6 -else - echo "$as_me:6657: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:6670: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CXX="$ac_prog" -echo "$as_me:6685: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - echo "$as_me:6693: result: $ac_ct_CXX" >&5 -echo "${ECHO_T}$ac_ct_CXX" >&6 -else - echo "$as_me:6696: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CXX" && break -done -test -n "$ac_ct_CXX" || ac_ct_CXX="g++" - - CXX=$ac_ct_CXX -fi - -# Provide some information about the compiler. -echo "$as_me:6708:" \ - "checking for C++ compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:6711: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:6714: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:6716: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:6719: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:6721: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:6724: \$? = $ac_status" >&5 - (exit $ac_status); } - -echo "$as_me:6727: checking whether we are using the GNU C++ compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 -if test "${ac_cv_cxx_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 6733 "configure" -#include "confdefs.h" - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6748: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6751: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6754: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6757: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:6769: result: $ac_cv_cxx_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 -GXX=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -CXXFLAGS="-g" -echo "$as_me:6775: checking whether $CXX accepts -g" >&5 -echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cxx_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 6781 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6793: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6796: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6799: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6802: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cxx_g=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_prog_cxx_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:6812: result: $ac_cv_prog_cxx_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line 6839 "configure" -#include "confdefs.h" -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6852: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6855: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6858: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6861: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line 6871 "configure" -#include "confdefs.h" -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6883: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6886: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6889: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6892: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -depcc="$CXX" am_compiler_list= - -echo "$as_me:6916: checking dependency style of $depcc" >&5 -echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 -if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - - am_cv_CXX_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - echo '#include "conftest.h"' > conftest.c - echo 'int i;' > conftest.h - echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=conftest.c object=conftest.o \ - depfile=conftest.Po tmpdepfile=conftest.TPo \ - $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && - grep conftest.h conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - am_cv_CXX_dependencies_compiler_type=$depmode - break - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CXX_dependencies_compiler_type=none -fi - -fi -echo "$as_me:6978: result: $am_cv_CXX_dependencies_compiler_type" >&5 -echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 -CXXDEPMODE="depmode=$am_cv_CXX_dependencies_compiler_type" - -ac_ext=cc -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -echo "$as_me:6988: checking whether $CXX works" >&5 -echo $ECHO_N "checking whether $CXX works... $ECHO_C" >&6 - -cat >conftest.$ac_ext <<_ACEOF -#line 6992 "configure" -#include "confdefs.h" -#include -int -main () -{ -std::cout << "ok"; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7004: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7007: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7010: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7013: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:7015: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - LIBFCGIXX=libfcgi++.la - ECHO_CPP=echo-cpp${EXEEXT} - echo "$as_me:7019: checking whether cin has a streambuf assignment operator" >&5 -echo $ECHO_N "checking whether cin has a streambuf assignment operator... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 7022 "configure" -#include "confdefs.h" -#include -int -main () -{ -cin = static_cast(0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7034: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7037: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7040: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7043: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:7045: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_IOSTREAM_WITHASSIGN_STREAMBUF 1 -EOF - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:7055: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:7059: checking whether char_type is defined in the context of streambuf" >&5 -echo $ECHO_N "checking whether char_type is defined in the context of streambuf... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 7062 "configure" -#include "confdefs.h" -#include -int -main () -{ -class fcgi_streambuf : public std::streambuf { char_type ct; } - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7074: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7077: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7080: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7083: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:7085: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_STREAMBUF_CHAR_TYPE 1 -EOF - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:7095: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:7102: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -echo "$as_me:7113: checking for gethostbyname in -lnsl" >&5 -echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 -if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lnsl $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 7121 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostbyname (); -int -main () -{ -gethostbyname (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7140: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7143: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7146: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7149: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_nsl_gethostbyname=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_nsl_gethostbyname=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:7160: result: $ac_cv_lib_nsl_gethostbyname" >&5 -echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 -if test $ac_cv_lib_nsl_gethostbyname = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 -if test "${ac_cv_lib_socket_socket+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsocket $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 7179 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char socket (); -int -main () -{ -socket (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7198: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7201: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7204: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7207: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_socket_socket=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_socket_socket=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:7218: result: $ac_cv_lib_socket_socket" >&5 -echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 -if test $ac_cv_lib_socket_socket = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6 -if test "${ac_cv_header_pthread_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 7239 "configure" -#include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:7243: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:7249: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_cv_header_pthread_h=yes -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_pthread_h=no -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:7268: result: $ac_cv_header_pthread_h" >&5 -echo "${ECHO_T}$ac_cv_header_pthread_h" >&6 -if test $ac_cv_header_pthread_h = yes; then - : -else - acx_pthread_ok=noheader -fi - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - echo "$as_me:7289: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 -echo $ECHO_N "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 7292 "configure" -#include "confdefs.h" - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char pthread_join (); -int -main () -{ -pthread_join (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7311: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7314: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7317: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7320: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - acx_pthread_ok=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - echo "$as_me:7328: result: $acx_pthread_ok" >&5 -echo "${ECHO_T}$acx_pthread_ok" >&6 - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all. - -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# pthread: Linux, etcetera -# --thread-safe: KAI C++ - -case "${host_cpu}-${host_os}" in - *solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthread or - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" - ;; -esac - -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do - - case $flag in - none) - echo "$as_me:7382: checking whether pthreads work without any flags" >&5 -echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6 - ;; - - -*) - echo "$as_me:7387: checking whether pthreads work with $flag" >&5 -echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6 - PTHREAD_CFLAGS="$flag" - ;; - - *) - echo "$as_me:7393: checking for the pthreads library -l$flag" >&5 -echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6 - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - cat >conftest.$ac_ext <<_ACEOF -#line 7414 "configure" -#include "confdefs.h" -#include -int -main () -{ -pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7428: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7431: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7434: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7437: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - acx_pthread_ok=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - echo "$as_me:7449: result: $acx_pthread_ok" >&5 -echo "${ECHO_T}$acx_pthread_ok" >&6 - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: threads are created detached by default - # and the JOINABLE attribute has a nonstandard name (UNDETACHED). - echo "$as_me:7469: checking for joinable pthread attribute" >&5 -echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 7472 "configure" -#include "confdefs.h" -#include -int -main () -{ -int attr=PTHREAD_CREATE_JOINABLE; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7484: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7487: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7490: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7493: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ok=PTHREAD_CREATE_JOINABLE -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ok=unknown -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - if test x"$ok" = xunknown; then - cat >conftest.$ac_ext <<_ACEOF -#line 7504 "configure" -#include "confdefs.h" -#include -int -main () -{ -int attr=PTHREAD_CREATE_UNDETACHED; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7516: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7519: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7522: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7525: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ok=PTHREAD_CREATE_UNDETACHED -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ok=unknown -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - fi - if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then - -cat >>confdefs.h <<\EOF -#define PTHREAD_CREATE_JOINABLE $ok -EOF - - fi - echo "$as_me:7542: result: ${ok}" >&5 -echo "${ECHO_T}${ok}" >&6 - if test x"$ok" = xunknown; then - { echo "$as_me:7545: WARNING: we do not know how to create joinable pthreads" >&5 -echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;} - fi - - echo "$as_me:7549: checking if more special flags are required for pthreads" >&5 -echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6 - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; - *solaris* | alpha*-osf*) flag="-D_REENTRANT";; - esac - echo "$as_me:7556: result: ${flag}" >&5 -echo "${ECHO_T}${flag}" >&6 - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: must compile with cc_r - # Extract the first word of "cc_r", so it can be a program name with args. -set dummy cc_r; ac_word=$2 -echo "$as_me:7568: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$PTHREAD_CC"; then - ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_PTHREAD_CC="cc_r" -echo "$as_me:7583: found $ac_dir/$ac_word" >&5 -break -done - - test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}" -fi -fi -PTHREAD_CC=$ac_cv_prog_PTHREAD_CC -if test -n "$PTHREAD_CC"; then - echo "$as_me:7592: result: $PTHREAD_CC" >&5 -echo "${ECHO_T}$PTHREAD_CC" >&6 -else - echo "$as_me:7595: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -else - PTHREAD_CC="$CC" -fi - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - THREADED=threaded${EXEEXT} - : -else - acx_pthread_ok=no - -fi - -echo "$as_me:7612: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 7618 "configure" -#include "confdefs.h" -#include -#include -#include -#include - -_ACEOF -if { (eval echo "$as_me:7626: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:7632: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no -fi -rm -f conftest.err conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line 7654 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line 7672 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -#line 7693 "configure" -#include "confdefs.h" -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:7719: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:7722: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:7724: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7727: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_header_stdc=no -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:7740: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7756: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 7762 "configure" -#include "confdefs.h" -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7768: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7771: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7774: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7777: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:7787: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line 7805 "configure" -#include "confdefs.h" -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:7854: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7857: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7860: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7863: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:7880: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:7883: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - - echo "$as_me:7888: checking for ssize_t" >&5 -echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 -if test "${ac_cv_type_ssize_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 7894 "configure" -#include "confdefs.h" -$ac_includes_default -int -main () -{ -if ((ssize_t *) 0) - return 0; -if (sizeof (ssize_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7909: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7912: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7915: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7918: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_ssize_t=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_type_ssize_t=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:7928: result: $ac_cv_type_ssize_t" >&5 -echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 -if test $ac_cv_type_ssize_t = yes; then - : -else - -cat >>confdefs.h <&5 -echo $ECHO_N "checking for sun_len in sys/un.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 7943 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sun_len" >/dev/null 2>&1; then - echo "$as_me:7950: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_SOCKADDR_UN_SUN_LEN 1 -EOF - -else - echo "$as_me:7958: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - echo "$as_me:7963: checking for fpos_t in stdio.h" >&5 -echo $ECHO_N "checking for fpos_t in stdio.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 7966 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "fpos_t" >/dev/null 2>&1; then - echo "$as_me:7973: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_FPOS 1 -EOF - -else - echo "$as_me:7981: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - -for ac_header in sys/socket.h netdb.h netinet/in.h arpa/inet.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:7989: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 7995 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:7999: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:8005: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:8024: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 8043 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:8047: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:8053: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:8072: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for a fileno() prototype in stdio.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 8085 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "fileno" >/dev/null 2>&1; then - echo "$as_me:8092: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_FILENO_PROTO 1 -EOF - -else - echo "$as_me:8100: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - if test "$HAVE_SYS_SOCKET_H"; then - echo "$as_me:8106: checking for socklen_t in sys/socket.h" >&5 -echo $ECHO_N "checking for socklen_t in sys/socket.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 8109 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "socklen_t" >/dev/null 2>&1; then - echo "$as_me:8116: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_SOCKLEN 1 -EOF - -else - echo "$as_me:8124: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - fi - - #-------------------------------------------------------------------- - # Do we need cross-process locking on this platform? - #-------------------------------------------------------------------- - echo "$as_me:8134: checking whether cross-process locking is required by accept()" >&5 -echo $ECHO_N "checking whether cross-process locking is required by accept()... $ECHO_C" >&6 - case "`uname -sr`" in - IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0) - echo "$as_me:8138: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define USE_LOCKING 1 -EOF - - ;; - *) - echo "$as_me:8147: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac - - #-------------------------------------------------------------------- - # Does va_arg(arg, long double) crash the compiler? - # hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler) - #-------------------------------------------------------------------- - echo "$as_me:8156: checking whether va_arg(arg, long double) crashes the compiler" >&5 -echo $ECHO_N "checking whether va_arg(arg, long double) crashes the compiler... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 8159 "configure" -#include "confdefs.h" -#include -int -main () -{ -long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:8171: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:8174: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8177: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:8180: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:8182: result: no" >&5 -echo "${ECHO_T}no" >&6 -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:8187: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_VA_ARG_LONG_DOUBLE_BUG 1 -EOF - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - - echo "$as_me:8197: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 8203 "configure" -#include "confdefs.h" - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:8261: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:8264: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8267: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:8270: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_c_const=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:8280: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\EOF -#define const -EOF - -fi - -for ac_func in strerror -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:8293: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 8299 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -char (*f) (); - -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -f = $ac_func; -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8330: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:8333: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8336: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:8339: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:8349: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6 -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -#line 8369 "configure" -#include "confdefs.h" -#ifndef __cplusplus -static $ac_kw int static_foo () {return 0; } -$ac_kw int foo () {return 0; } -#endif - -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:8378: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:8381: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8384: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:8387: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_inline=$ac_kw; break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done - -fi -echo "$as_me:8398: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6 -case $ac_cv_c_inline in - inline | yes) ;; - no) -cat >>confdefs.h <<\EOF -#define inline -EOF - ;; - *) cat >>confdefs.h <&5 -echo $ECHO_N "checking $msg... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_warnings+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - if test -n "$CC"; then - cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && - $CC -c -v -Xc conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-v" - else - ac_cv_prog_cc_warnings="-v -Xc" - fi - - elif $CC > /dev/null 2>&1 && - $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="+w1" - else - ac_cv_prog_cc_warnings="+w1 -Aa" - fi - - elif ! $CC > /dev/null 2>&1 && - $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" - else - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" - fi - - elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && - $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" - else - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" - fi - - elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-fullwarn" - else - ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" - fi - - fi - rm -f conftest.* - fi - if test -n "$ac_cv_prog_cc_warnings"; then - CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" - else - ac_cv_prog_cc_warnings="unknown" - fi - -fi -echo "$as_me:8499: result: $ac_cv_prog_cc_warnings" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_warnings" >&6 - -ac_config_files="$ac_config_files Makefile cgi-fcgi/Makefile include/Makefile libfcgi/Makefile examples/Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overriden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if cmp -s $cache_file confcache; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:8583: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -SHELL=\${CONFIG_SHELL-$SHELL} -ac_cs_invocation="\$0 \$@" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Name of the executable. -as_me=`echo "$0" |sed 's,.*[\\/],,'` - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -as_executable_p="test -f" - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - -# NLS nuisances. -$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } -$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } -$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } -$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } -$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } -$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } -$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } -$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } - -exec 6>&1 - -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\EOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." -EOF - -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - shift - set dummy "$ac_option" "$ac_optarg" ${1+"$@"} - shift - ;; - -*);; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_need_defaults=false;; - esac - - case $1 in - # Handling of the options. -EOF -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:8759: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - shift - CONFIG_FILES="$CONFIG_FILES $1" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - shift - CONFIG_HEADERS="$CONFIG_HEADERS $1" - ac_need_defaults=false;; - - # This is an error. - -*) { { echo "$as_me:8778: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -exec 5>>config.log -cat >&5 << _ACEOF - -## ----------------------- ## -## Running config.status. ## -## ----------------------- ## - -This file was extended by $as_me 2.52, executed with - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - > $ac_cs_invocation -on `(hostname || uname -n) 2>/dev/null | sed 1q` - -_ACEOF -EOF - -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "cgi-fcgi/Makefile" ) CONFIG_FILES="$CONFIG_FILES cgi-fcgi/Makefile" ;; - "include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; - "libfcgi/Makefile" ) CONFIG_FILES="$CONFIG_FILES libfcgi/Makefile" ;; - "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; - "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; - "fcgi_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS fcgi_config.h" ;; - *) { { echo "$as_me:8830: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/cs$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - -EOF - -cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@DEFS@,$DEFS,;t t -s,@LIBS@,$LIBS,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@PACKAGE@,$PACKAGE,;t t -s,@VERSION@,$VERSION,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@ACLOCAL@,$ACLOCAL,;t t -s,@AUTOCONF@,$AUTOCONF,;t t -s,@AUTOMAKE@,$AUTOMAKE,;t t -s,@AUTOHEADER@,$AUTOHEADER,;t t -s,@MAKEINFO@,$MAKEINFO,;t t -s,@AMTAR@,$AMTAR,;t t -s,@install_sh@,$install_sh,;t t -s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t -s,@AWK@,$AWK,;t t -s,@SET_MAKE@,$SET_MAKE,;t t -s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t -s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t -s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t -s,@DEPDIR@,$DEPDIR,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@am__include@,$am__include,;t t -s,@am__quote@,$am__quote,;t t -s,@CCDEPMODE@,$CCDEPMODE,;t t -s,@CPP@,$CPP,;t t -s,@build@,$build,;t t -s,@build_cpu@,$build_cpu,;t t -s,@build_vendor@,$build_vendor,;t t -s,@build_os@,$build_os,;t t -s,@host@,$host,;t t -s,@host_cpu@,$host_cpu,;t t -s,@host_vendor@,$host_vendor,;t t -s,@host_os@,$host_os,;t t -s,@LN_S@,$LN_S,;t t -s,@ECHO@,$ECHO,;t t -s,@RANLIB@,$RANLIB,;t t -s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t -s,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@LIBTOOL@,$LIBTOOL,;t t -s,@CXX@,$CXX,;t t -s,@CXXFLAGS@,$CXXFLAGS,;t t -s,@ac_ct_CXX@,$ac_ct_CXX,;t t -s,@CXXDEPMODE@,$CXXDEPMODE,;t t -s,@LIBFCGIXX@,$LIBFCGIXX,;t t -s,@ECHO_CPP@,$ECHO_CPP,;t t -s,@PTHREAD_CC@,$PTHREAD_CC,;t t -s,@PTHREAD_LIBS@,$PTHREAD_LIBS,;t t -s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t -s,@THREADED@,$THREADED,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@SYSTEM@,$SYSTEM,;t t -CEOF - -EOF - - cat >>$CONFIG_STATUS <<\EOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -EOF -cat >>$CONFIG_STATUS <<\EOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - { case "$ac_dir" in - [\\/]* | ?:[\\/]* ) as_incr_dir=;; - *) as_incr_dir=.;; -esac -as_dummy="$ac_dir" -for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do - case $as_mkdir_dir in - # Skip DOS drivespec - ?:) as_incr_dir=$as_mkdir_dir ;; - *) - as_incr_dir=$as_incr_dir/$as_mkdir_dir - test -d "$as_incr_dir" || mkdir "$as_incr_dir" - ;; - esac -done; } - - ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` - else - ac_dir_suffix= ac_dots= - fi - - case $srcdir in - .) ac_srcdir=. - if test -z "$ac_dots"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_dots$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_dots$srcdir ;; - esac - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_dots$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:9083: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated automatically by config.status. */ - configure_input="Generated automatically from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:9101: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:9114: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -EOF -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -EOF -cat >>$CONFIG_STATUS <<\EOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:9175: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:9186: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:9199: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -EOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\EOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -EOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\EOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -EOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # egrep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\EOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated automatically by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated automatically by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:9316: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - { case "$ac_dir" in - [\\/]* | ?:[\\/]* ) as_incr_dir=;; - *) as_incr_dir=.;; -esac -as_dummy="$ac_dir" -for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do - case $as_mkdir_dir in - # Skip DOS drivespec - ?:) as_incr_dir=$as_mkdir_dir ;; - *) - as_incr_dir=$as_incr_dir/$as_mkdir_dir - test -d "$as_incr_dir" || mkdir "$as_incr_dir" - ;; - esac -done; } - - fi - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi - # Run the commands associated with the file. - case $ac_file in - fcgi_config.h ) # update the timestamp -echo timestamp >"./stamp-h1" - ;; - esac -done -EOF -cat >>$CONFIG_STATUS <<\EOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - - case $ac_dest in - default-1 ) -test x"$AMDEP_TRUE" != x"" || -for mf in $CONFIG_FILES; do - case "$mf" in - Makefile) dirpart=.;; - */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; - *) continue;; - esac - grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue - # Extract the definition of DEP_FILES from the Makefile without - # running `make'. - DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` - test -z "$DEPDIR" && continue - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n -e '/^U = / s///p' < "$mf"` - test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" - # We invoke sed twice because it is the simplest approach to - # changing $(DEPDIR) to its actual value in the expansion. - for file in `sed -n -e ' - /^DEP_FILES = .*\\\\$/ { - s/^DEP_FILES = // - :loop - s/\\\\$// - p - n - /\\\\$/ b loop - p - } - /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`echo "$file" | sed -e 's|/[^/]*$||'` - $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - esac -done -EOF - -cat >>$CONFIG_STATUS <<\EOF - -{ (exit 0); exit 0; } -EOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/configure.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/configure.in deleted file mode 100644 index e1941d00870..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/configure.in +++ /dev/null @@ -1,77 +0,0 @@ -dnl $Id: configure.in,v 1.26 2003/01/19 17:19:41 robs Exp $ -dnl -dnl This file is an input file used by the GNU "autoconf" program to -dnl generate the file "configure", which is run during the build -dnl to configure the system for the local environment. - -AC_INIT -AM_INIT_AUTOMAKE(fcgi, 2.4.0) - -AM_CONFIG_HEADER(fcgi_config.h) - -AC_PROG_CC -AC_PROG_CPP -AC_PROG_INSTALL -AC_PROG_LIBTOOL - -AC_PROG_CXX - -AC_LANG([C++]) - -dnl autoconf defaults CXX to 'g++', so its unclear whether it exists/works -AC_MSG_CHECKING([whether $CXX works]) -AC_TRY_COMPILE([#include ], - [std::cout << "ok";], - [AC_MSG_RESULT(yes) - LIBFCGIXX=libfcgi++.la - ECHO_CPP=echo-cpp${EXEEXT} - AC_MSG_CHECKING([whether cin has a streambuf assignment operator]) - AC_TRY_COMPILE([#include ], - [cin = static_cast(0);], - [AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_IOSTREAM_WITHASSIGN_STREAMBUF], [1], - [Define if cin/cout/cerr has a streambuf assignment operator])], - [AC_MSG_RESULT(no)]) - AC_MSG_CHECKING([whether char_type is defined in the context of streambuf]) - AC_TRY_COMPILE([#include ], - [class fcgi_streambuf : public std::streambuf { char_type ct; }], - [AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_STREAMBUF_CHAR_TYPE], [1], - [Define if char_type is defined in the context of streambuf])], - [AC_MSG_RESULT(no)])], - [AC_MSG_RESULT(no)]) -AC_SUBST(LIBFCGIXX) -AC_SUBST(ECHO_CPP) - -AC_LANG([C]) - -AC_CHECK_LIB([nsl], [gethostbyname]) -AC_CHECK_LIB([socket], [socket]) - -ACX_PTHREAD([THREADED=threaded${EXEEXT}]) -AC_SUBST([THREADED]) - -FCGI_COMMON_CHECKS - -AC_REPLACE_FUNCS([strerror]) - -AC_C_INLINE - -#-------------------------------------------------------------------- -# This is a little hokie in that it avoids including config.guess -# and config.sub in the distribution, but its been working so far. -# Windows builds don't run configure so we should be safe fixing -# this to 'unix' (at least for now). -#-------------------------------------------------------------------- -SYSTEM=unix -AC_SUBST([SYSTEM]) - -AC_PROG_CC_WARNINGS - -AC_CONFIG_FILES([Makefile - cgi-fcgi/Makefile - include/Makefile - libfcgi/Makefile - examples/Makefile]) - -AC_OUTPUT diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/depcomp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/depcomp deleted file mode 100644 index 65899658ee7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/depcomp +++ /dev/null @@ -1,411 +0,0 @@ -#! /bin/sh - -# depcomp - compile a program generating dependencies as side-effects -# Copyright 1999, 2000 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi -# `libtool' can also be set to `yes' or `no'. - -depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. This file always lives in the current directory. - # Also, the AIX compiler puts `$object:' at the start of each line; - # $object doesn't have directory information. - stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - outname="$stripped.o" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 AIX compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - - tmpdepfile1="$object.d" - tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` - if test "$libtool" = yes; then - "$@" -Wc,-MD - else - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - if test -f "$tmpdepfile1"; then - tmpdepfile="$tmpdepfile1" - else - tmpdepfile="$tmpdepfile2" - fi - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a space and a tab in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - test -z "$dashmflag" && dashmflag=-M - ( IFS=" " - case " $* " in - *" --mode=compile "*) # this is libtool, let us make it quiet - for arg - do # cycle over the arguments - case "$arg" in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - # X makedepend - ( - shift - cleared=no - for arg in "$@"; do - case $cleared in no) - set ""; shift - cleared=yes - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift;; - -*) - ;; - *) - set fnord "$@" "$arg"; shift;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tail +3 "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the proprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - ( IFS=" " - case " $* " in - *" --mode=compile "*) - for arg - do # cycle over the arguments - case $arg in - "--mode=compile") - # insert --quiet before "--mode=compile" - set fnord "$@" --quiet - shift # fnord - ;; - esac - set fnord "$@" "$arg" - shift # fnord - shift # "$arg" - done - ;; - esac - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - ) & - proc=$! - "$@" - stat=$? - wait "$proc" - if test "$stat" != 0; then exit $stat; fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/fcgi_config.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/fcgi_config.h deleted file mode 100644 index 3698f285418..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/fcgi_config.h +++ /dev/null @@ -1,112 +0,0 @@ -/* fcgi_config.h. Generated automatically by configure. */ -/* fcgi_config.h.in. Generated automatically from configure.in by autoheader. */ -/* Define if you have the header file. */ -#define DLLAPI -#define HAVE_ARPA_INET_H 1 - -/* Define if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if there's a fileno() prototype in stdio.h */ -#define HAVE_FILENO_PROTO 1 - -/* Define if the fpos_t typedef is in stdio.h */ -#define HAVE_FPOS 1 - -/* Define if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define if cin/cout/cerr has a streambuf assignment operator */ -/* #undef HAVE_IOSTREAM_WITHASSIGN_STREAMBUF */ - -/* Define if you have the `nsl' library (-lnsl). */ -#define HAVE_LIBNSL 1 - -/* Define if you have the `socket' library (-lsocket). */ -#define HAVE_LIBSOCKET 1 - -/* Define if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the header file. */ -#define HAVE_NETDB_H 1 - -/* Define if you have the header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define if you have POSIX threads libraries and header files. */ -/* #undef HAVE_PTHREAD */ - -/* Define if sockaddr_un in sys/un.h contains a sun_len component */ -/* #undef HAVE_SOCKADDR_UN_SUN_LEN */ - -/* Define if the socklen_t typedef is in sys/socket.h */ -/* #undef HAVE_SOCKLEN */ - -/* Define if you have the header file. */ -/* #undef HAVE_STDINT_H */ - -/* Define if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define if char_type is defined in the context of streambuf */ -#define HAVE_STREAMBUF_CHAR_TYPE 1 - -/* Define if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the header file. */ -//#define HAVE_SYS_SOCKET_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define if you have the header file. */ -//#define HAVE_SYS_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have the header file. */ -//#define HAVE_UNISTD_H 1 - -/* Define if va_arg(arg, long double) crashes the compiler */ -/* #undef HAVE_VA_ARG_LONG_DOUBLE_BUG */ - -/* Name of package */ -#define PACKAGE "fcgi" - -/* Define to the necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if cross-process locking is required by accept() */ -#define USE_LOCKING 1 - -/* Version number of package */ -#define VERSION "2.4.0" - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -/* #undef inline */ - -/* Define to `int' if does not define. */ -/* #undef ssize_t */ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/fcgi_config.h.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/fcgi_config.h.in deleted file mode 100644 index 8375babd926..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/fcgi_config.h.in +++ /dev/null @@ -1,111 +0,0 @@ -/* fcgi_config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define if there's a fileno() prototype in stdio.h */ -#undef HAVE_FILENO_PROTO - -/* Define if the fpos_t typedef is in stdio.h */ -#undef HAVE_FPOS - -/* Define if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if cin/cout/cerr has a streambuf assignment operator */ -#undef HAVE_IOSTREAM_WITHASSIGN_STREAMBUF - -/* Define if you have the `nsl' library (-lnsl). */ -#undef HAVE_LIBNSL - -/* Define if you have the `socket' library (-lsocket). */ -#undef HAVE_LIBSOCKET - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define if you have POSIX threads libraries and header files. */ -#undef HAVE_PTHREAD - -/* Define if sockaddr_un in sys/un.h contains a sun_len component */ -#undef HAVE_SOCKADDR_UN_SUN_LEN - -/* Define if the socklen_t typedef is in sys/socket.h */ -#undef HAVE_SOCKLEN - -/* Define if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if char_type is defined in the context of streambuf */ -#undef HAVE_STREAMBUF_CHAR_TYPE - -/* Define if you have the `strerror' function. */ -#undef HAVE_STRERROR - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if va_arg(arg, long double) crashes the compiler */ -#undef HAVE_VA_ARG_LONG_DOUBLE_BUG - -/* Name of package */ -#undef PACKAGE - -/* Define to the necessary symbol if this constant uses a non-standard name on - your system. */ -#undef PTHREAD_CREATE_JOINABLE - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if cross-process locking is required by accept() */ -#undef USE_LOCKING - -/* Version number of package */ -#undef VERSION - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define as `__inline' if that's what the C compiler calls it, or to nothing - if it is not supported. */ -#undef inline - -/* Define to `int' if does not define. */ -#undef ssize_t diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/Makefile.am b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/Makefile.am deleted file mode 100644 index 417a561372b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -# $Id: Makefile.am,v 1.2 2001/09/24 18:03:05 skimo Exp $ -include_HEADERS = \ - fastcgi.h \ - fcgi_stdio.h \ - fcgiapp.h \ - fcgimisc.h \ - fcgio.h \ - fcgios.h diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/Makefile.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/Makefile.in deleted file mode 100644 index 51ad6249505..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/Makefile.in +++ /dev/null @@ -1,279 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# $Id: Makefile.am,v 1.2 2001/09/24 18:03:05 skimo Exp $ - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_CPP = @ECHO_CPP@ -EXEEXT = @EXEEXT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBFCGIXX = @LIBFCGIXX@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -SYSTEM = @SYSTEM@ -THREADED = @THREADED@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -include_HEADERS = \ - fastcgi.h \ - fcgi_stdio.h \ - fcgiapp.h \ - fcgimisc.h \ - fcgio.h \ - fcgios.h - -subdir = include -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/fcgi_config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(include_HEADERS) - -DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in -all: all-am - -.SUFFIXES: - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign include/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status -uninstall-info-am: -install-includeHEADERS: $(include_HEADERS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(includedir) - @list='$(include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(INSTALL_HEADER) $$d$$p $(DESTDIR)$(includedir)/$$f"; \ - $(INSTALL_HEADER) $$d$$p $(DESTDIR)$(includedir)/$$f; \ - done - -uninstall-includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(include_HEADERS)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(includedir)/$$f"; \ - rm -f $(DESTDIR)$(includedir)/$$f; \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(includedir) - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: install-includeHEADERS - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -uninstall-am: uninstall-includeHEADERS uninstall-info-am - -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-libtool distclean distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-includeHEADERS install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool tags uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fastcgi.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fastcgi.h deleted file mode 100644 index d5b54686df1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fastcgi.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * fastcgi.h -- - * - * Defines for the FastCGI protocol. - * - * - * Copyright (c) 1995-1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * $Id: fastcgi.h,v 1.1.1.1 1997/09/16 15:36:32 stanleyg Exp $ - */ - -#ifndef _FASTCGI_H -#define _FASTCGI_H - -/* - * Listening socket file number - */ -#define FCGI_LISTENSOCK_FILENO 0 - -typedef struct { - unsigned char version; - unsigned char type; - unsigned char requestIdB1; - unsigned char requestIdB0; - unsigned char contentLengthB1; - unsigned char contentLengthB0; - unsigned char paddingLength; - unsigned char reserved; -} FCGI_Header; - -#define FCGI_MAX_LENGTH 0xffff - -/* - * Number of bytes in a FCGI_Header. Future versions of the protocol - * will not reduce this number. - */ -#define FCGI_HEADER_LEN 8 - -/* - * Value for version component of FCGI_Header - */ -#define FCGI_VERSION_1 1 - -/* - * Values for type component of FCGI_Header - */ -#define FCGI_BEGIN_REQUEST 1 -#define FCGI_ABORT_REQUEST 2 -#define FCGI_END_REQUEST 3 -#define FCGI_PARAMS 4 -#define FCGI_STDIN 5 -#define FCGI_STDOUT 6 -#define FCGI_STDERR 7 -#define FCGI_DATA 8 -#define FCGI_GET_VALUES 9 -#define FCGI_GET_VALUES_RESULT 10 -#define FCGI_UNKNOWN_TYPE 11 -#define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE) - -/* - * Value for requestId component of FCGI_Header - */ -#define FCGI_NULL_REQUEST_ID 0 - - -typedef struct { - unsigned char roleB1; - unsigned char roleB0; - unsigned char flags; - unsigned char reserved[5]; -} FCGI_BeginRequestBody; - -typedef struct { - FCGI_Header header; - FCGI_BeginRequestBody body; -} FCGI_BeginRequestRecord; - -/* - * Mask for flags component of FCGI_BeginRequestBody - */ -#define FCGI_KEEP_CONN 1 - -/* - * Values for role component of FCGI_BeginRequestBody - */ -#define FCGI_RESPONDER 1 -#define FCGI_AUTHORIZER 2 -#define FCGI_FILTER 3 - - -typedef struct { - unsigned char appStatusB3; - unsigned char appStatusB2; - unsigned char appStatusB1; - unsigned char appStatusB0; - unsigned char protocolStatus; - unsigned char reserved[3]; -} FCGI_EndRequestBody; - -typedef struct { - FCGI_Header header; - FCGI_EndRequestBody body; -} FCGI_EndRequestRecord; - -/* - * Values for protocolStatus component of FCGI_EndRequestBody - */ -#define FCGI_REQUEST_COMPLETE 0 -#define FCGI_CANT_MPX_CONN 1 -#define FCGI_OVERLOADED 2 -#define FCGI_UNKNOWN_ROLE 3 - - -/* - * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records - */ -#define FCGI_MAX_CONNS "FCGI_MAX_CONNS" -#define FCGI_MAX_REQS "FCGI_MAX_REQS" -#define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS" - - -typedef struct { - unsigned char type; - unsigned char reserved[7]; -} FCGI_UnknownTypeBody; - -typedef struct { - FCGI_Header header; - FCGI_UnknownTypeBody body; -} FCGI_UnknownTypeRecord; - -#endif /* _FASTCGI_H */ - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_config.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_config.h deleted file mode 100644 index c59cda801e7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_config.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copied to fcgi_config.h when building on WinNT without cygwin, - * i.e. configure is not run. See fcgi_config.h.in for details. - */ - -#define HAVE_FPOS 1 -#define HAVE_LIMITS_H 1 -#define HAVE_STREAMBUF_CHAR_TYPE 1 -#define HAVE_STRERROR 1 -#undef HAVE_ARPA_INET_H -#undef HAVE_DLFCN_H -#undef HAVE_FILENO_PROTO -#undef HAVE_INTTYPES_H -#undef HAVE_IOSTREAM_WITHASSIGN_STREAMBUF -#undef HAVE_LIBNSL -#undef HAVE_LIBSOCKET -#undef HAVE_MEMORY_H -#undef HAVE_NETDB_H -#undef HAVE_NETINET_IN_H -#undef HAVE_PTHREAD -#undef HAVE_SOCKADDR_UN_SUN_LEN -#undef HAVE_SOCKLEN -#undef HAVE_STDINT_H -#undef HAVE_STDLIB_H -#undef HAVE_STRING_H -#undef HAVE_STRINGS_H -#undef HAVE_SYS_PARAM_H -#undef HAVE_SYS_SOCKET_H -#undef HAVE_SYS_STAT_H -#undef HAVE_SYS_TIME_H -#undef HAVE_SYS_TYPES_H -#undef HAVE_UNISTD_H -#undef HAVE_VA_ARG_LONG_DOUBLE_BUG -#undef PTHREAD_CREATE_JOINABLE -#undef STDC_HEADERS -#undef USE_LOCKING -#undef const -#undef inline -#undef ssize_t diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_config_x86.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_config_x86.h deleted file mode 100644 index c59cda801e7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_config_x86.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copied to fcgi_config.h when building on WinNT without cygwin, - * i.e. configure is not run. See fcgi_config.h.in for details. - */ - -#define HAVE_FPOS 1 -#define HAVE_LIMITS_H 1 -#define HAVE_STREAMBUF_CHAR_TYPE 1 -#define HAVE_STRERROR 1 -#undef HAVE_ARPA_INET_H -#undef HAVE_DLFCN_H -#undef HAVE_FILENO_PROTO -#undef HAVE_INTTYPES_H -#undef HAVE_IOSTREAM_WITHASSIGN_STREAMBUF -#undef HAVE_LIBNSL -#undef HAVE_LIBSOCKET -#undef HAVE_MEMORY_H -#undef HAVE_NETDB_H -#undef HAVE_NETINET_IN_H -#undef HAVE_PTHREAD -#undef HAVE_SOCKADDR_UN_SUN_LEN -#undef HAVE_SOCKLEN -#undef HAVE_STDINT_H -#undef HAVE_STDLIB_H -#undef HAVE_STRING_H -#undef HAVE_STRINGS_H -#undef HAVE_SYS_PARAM_H -#undef HAVE_SYS_SOCKET_H -#undef HAVE_SYS_STAT_H -#undef HAVE_SYS_TIME_H -#undef HAVE_SYS_TYPES_H -#undef HAVE_UNISTD_H -#undef HAVE_VA_ARG_LONG_DOUBLE_BUG -#undef PTHREAD_CREATE_JOINABLE -#undef STDC_HEADERS -#undef USE_LOCKING -#undef const -#undef inline -#undef ssize_t diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_stdio.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_stdio.h deleted file mode 100644 index de2af89bedb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgi_stdio.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * fcgi_stdio.h -- - * - * FastCGI-stdio compatibility package - * - * - * Copyright (c) 1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * $Id: fcgi_stdio.h,v 1.5 2001/06/22 13:21:15 robs Exp $ - */ - -#ifndef _FCGI_STDIO -#define _FCGI_STDIO 1 - -#include -#include -#include "fcgiapp.h" - -#if defined (c_plusplus) || defined (__cplusplus) -extern "C" { -#endif - -#ifndef DLLAPI -#ifdef _WIN32 -#define DLLAPI __declspec(dllimport) -#else -#define DLLAPI -#endif -#endif - -/* - * Wrapper type for FILE - */ - -typedef struct { - FILE *stdio_stream; - FCGX_Stream *fcgx_stream; -} FCGI_FILE; - -/* - * The four new functions and two new macros - */ - -DLLAPI int FCGI_Accept(void); -DLLAPI void FCGI_Finish(void); -DLLAPI int FCGI_StartFilterData(void); -DLLAPI void FCGI_SetExitStatus(int status); - -#define FCGI_ToFILE(fcgi_file) (fcgi_file->stdio_stream) -#define FCGI_ToFcgiStream(fcgi_file) (fcgi_file->fcgx_stream) - -/* - * Wrapper stdin, stdout, and stderr variables, set up by FCGI_Accept() - */ - -DLLAPI extern FCGI_FILE _fcgi_sF[]; -#define FCGI_stdin (&_fcgi_sF[0]) -#define FCGI_stdout (&_fcgi_sF[1]) -#define FCGI_stderr (&_fcgi_sF[2]) - -/* - * Wrapper function prototypes, grouped according to sections - * of Harbison & Steele, "C: A Reference Manual," fourth edition, - * Prentice-Hall, 1995. - */ - -DLLAPI void FCGI_perror(const char *str); - -DLLAPI FCGI_FILE *FCGI_fopen(const char *path, const char *mode); -DLLAPI int FCGI_fclose(FCGI_FILE *fp); -DLLAPI int FCGI_fflush(FCGI_FILE *fp); -DLLAPI FCGI_FILE *FCGI_freopen(const char *path, const char *mode, FCGI_FILE *fp); - -DLLAPI int FCGI_setvbuf(FCGI_FILE *fp, char *buf, int bufmode, size_t size); -DLLAPI void FCGI_setbuf(FCGI_FILE *fp, char *buf); - -DLLAPI int FCGI_fseek(FCGI_FILE *fp, long offset, int whence); -DLLAPI int FCGI_ftell(FCGI_FILE *fp); -DLLAPI void FCGI_rewind(FCGI_FILE *fp); -#ifdef HAVE_FPOS -DLLAPI int FCGI_fgetpos(FCGI_FILE *fp, fpos_t *pos); -DLLAPI int FCGI_fsetpos(FCGI_FILE *fp, const fpos_t *pos); -#endif -DLLAPI int FCGI_fgetc(FCGI_FILE *fp); -DLLAPI int FCGI_getchar(void); -DLLAPI int FCGI_ungetc(int c, FCGI_FILE *fp); - -DLLAPI char *FCGI_fgets(char *str, int size, FCGI_FILE *fp); -DLLAPI char *FCGI_gets(char *str); - -/* - * Not yet implemented - * - * int FCGI_fscanf(FCGI_FILE *fp, const char *format, ...); - * int FCGI_scanf(const char *format, ...); - * - */ - -DLLAPI int FCGI_fputc(int c, FCGI_FILE *fp); -DLLAPI int FCGI_putchar(int c); - -DLLAPI int FCGI_fputs(const char *str, FCGI_FILE *fp); -DLLAPI int FCGI_puts(const char *str); - -DLLAPI int FCGI_fprintf(FCGI_FILE *fp, const char *format, ...); -DLLAPI int FCGI_printf(const char *format, ...); - -DLLAPI int FCGI_vfprintf(FCGI_FILE *fp, const char *format, va_list ap); -DLLAPI int FCGI_vprintf(const char *format, va_list ap); - -DLLAPI size_t FCGI_fread(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp); -DLLAPI size_t FCGI_fwrite(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp); - -DLLAPI int FCGI_feof(FCGI_FILE *fp); -DLLAPI int FCGI_ferror(FCGI_FILE *fp); -DLLAPI void FCGI_clearerr(FCGI_FILE *fp); - -DLLAPI FCGI_FILE *FCGI_tmpfile(void); - -DLLAPI int FCGI_fileno(FCGI_FILE *fp); -DLLAPI FCGI_FILE *FCGI_fdopen(int fd, const char *mode); -DLLAPI FCGI_FILE *FCGI_popen(const char *cmd, const char *type); -DLLAPI int FCGI_pclose(FCGI_FILE *); - -/* - * The remaining definitions are for application programs, - * not for fcgi_stdio.c - */ - -#ifndef NO_FCGI_DEFINES - -/* - * Replace standard types, variables, and functions with FastCGI wrappers. - * Use undef in case a macro is already defined. - */ - -#undef FILE -#define FILE FCGI_FILE - -#undef stdin -#define stdin FCGI_stdin -#undef stdout -#define stdout FCGI_stdout -#undef stderr -#define stderr FCGI_stderr - -#undef perror -#define perror FCGI_perror - -#undef fopen -#define fopen FCGI_fopen -#undef fclose -#define fclose FCGI_fclose -#undef fflush -#define fflush FCGI_fflush -#undef freopen -#define freopen FCGI_freopen - -#undef setvbuf -#define setvbuf FCGI_setvbuf -#undef setbuf -#define setbuf FCGI_setbuf - -#undef fseek -#define fseek FCGI_fseek -#undef ftell -#define ftell FCGI_ftell -#undef rewind -#define rewind FCGI_rewind -#undef fgetpos -#define fgetpos FCGI_fgetpos -#undef fsetpos -#define fsetpos FCGI_fsetpos - -#undef fgetc -#define fgetc FCGI_fgetc -#undef getc -#define getc FCGI_fgetc -#undef getchar -#define getchar FCGI_getchar -#undef ungetc -#define ungetc FCGI_ungetc - -#undef fgets -#define fgets FCGI_fgets -#undef gets -#define gets FCGI_gets - -#undef fputc -#define fputc FCGI_fputc -#undef putc -#define putc FCGI_fputc -#undef putchar -#define putchar FCGI_putchar - -#undef fputs -#define fputs FCGI_fputs -#undef puts -#define puts FCGI_puts - -#undef fprintf -#define fprintf FCGI_fprintf -#undef printf -#define printf FCGI_printf - -#undef vfprintf -#define vfprintf FCGI_vfprintf -#undef vprintf -#define vprintf FCGI_vprintf - -#undef fread -#define fread FCGI_fread -#undef fwrite -#define fwrite FCGI_fwrite - -#undef feof -#define feof FCGI_feof -#undef ferror -#define ferror FCGI_ferror -#undef clearerr -#define clearerr FCGI_clearerr - -#undef tmpfile -#define tmpfile FCGI_tmpfile - -#undef fileno -#define fileno FCGI_fileno -#undef fdopen -#define fdopen FCGI_fdopen -#undef popen -#define popen FCGI_popen -#undef pclose -#define pclose FCGI_pclose - -#endif /* NO_FCGI_DEFINES */ - -#if defined (__cplusplus) || defined (c_plusplus) -} /* terminate extern "C" { */ -#endif - -#endif /* _FCGI_STDIO */ - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgiapp.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgiapp.h deleted file mode 100644 index d7236f6f3f2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgiapp.h +++ /dev/null @@ -1,622 +0,0 @@ -/* - * fcgiapp.h -- - * - * Definitions for FastCGI application server programs - * - * - * Copyright (c) 1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * $Id: fcgiapp.h,v 1.12 2001/11/21 21:10:11 robs Exp $ - */ - -#ifndef _FCGIAPP_H -#define _FCGIAPP_H - -/* Hack to see if we are building TCL - TCL needs varargs not stdarg */ -#ifndef TCL_LIBRARY -#include -#else -#include -#endif - -#ifndef DLLAPI -#ifdef _WIN32 -#define DLLAPI __declspec(dllimport) -#else -#define DLLAPI -#endif -#endif - -#if defined (c_plusplus) || defined (__cplusplus) -extern "C" { -#endif - -/* - * Error codes. Assigned to avoid conflict with EOF and errno(2). - */ -#define FCGX_UNSUPPORTED_VERSION -2 -#define FCGX_PROTOCOL_ERROR -3 -#define FCGX_PARAMS_ERROR -4 -#define FCGX_CALL_SEQ_ERROR -5 - -/* - * This structure defines the state of a FastCGI stream. - * Streams are modeled after the FILE type defined in stdio.h. - * (We wouldn't need our own if platform vendors provided a - * standard way to subclass theirs.) - * The state of a stream is private and should only be accessed - * by the procedures defined below. - */ -typedef struct FCGX_Stream { - unsigned char *rdNext; /* reader: first valid byte - * writer: equals stop */ - unsigned char *wrNext; /* writer: first free byte - * reader: equals stop */ - unsigned char *stop; /* reader: last valid byte + 1 - * writer: last free byte + 1 */ - unsigned char *stopUnget; /* reader: first byte of current buffer - * fragment, for ungetc - * writer: undefined */ - int isReader; - int isClosed; - int wasFCloseCalled; - int FCGI_errno; /* error status */ - void (*fillBuffProc) (struct FCGX_Stream *stream); - void (*emptyBuffProc) (struct FCGX_Stream *stream, int doClose); - void *data; -} FCGX_Stream; - -/* - * An environment (as defined by environ(7)): A NULL-terminated array - * of strings, each string having the form name=value. - */ -typedef char **FCGX_ParamArray; - -/* - * FCGX_Request Flags - * - * Setting FCGI_FAIL_ACCEPT_ON_INTR prevents FCGX_Accept() from - * restarting upon being interrupted. - */ -#define FCGI_FAIL_ACCEPT_ON_INTR 1 - -/* - * FCGX_Request -- State associated with a request. - * - * Its exposed for API simplicity, I expect parts of it to change! - */ -typedef struct FCGX_Request { - int requestId; /* valid if isBeginProcessed */ - int role; - FCGX_Stream *in; - FCGX_Stream *out; - FCGX_Stream *err; - char **envp; - - /* Don't use anything below here */ - - struct Params *paramsPtr; - int ipcFd; /* < 0 means no connection */ - int isBeginProcessed; /* FCGI_BEGIN_REQUEST seen */ - int keepConnection; /* don't close ipcFd at end of request */ - int appStatus; - int nWriters; /* number of open writers (0..2) */ - int flags; - int listen_sock; -} FCGX_Request; - - -/* - *====================================================================== - * Control - *====================================================================== - */ - -/* - *---------------------------------------------------------------------- - * - * FCGX_IsCGI -- - * - * Returns TRUE iff this process appears to be a CGI process - * rather than a FastCGI process. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_IsCGI(void); - -/* - *---------------------------------------------------------------------- - * - * FCGX_Init -- - * - * Initialize the FCGX library. Call in multi-threaded apps - * before calling FCGX_Accept_r(). - * - * Returns 0 upon success. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_Init(void); - -/* - *---------------------------------------------------------------------- - * - * FCGX_OpenSocket -- - * - * Create a FastCGI listen socket. - * - * path is the Unix domain socket (named pipe for WinNT), or a colon - * followed by a port number. e.g. "/tmp/fastcgi/mysocket", ":5000" - * - * backlog is the listen queue depth used in the listen() call. - * - * Returns the socket's file descriptor or -1 on error. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_OpenSocket(const char *path, int backlog); - -/* - *---------------------------------------------------------------------- - * - * FCGX_InitRequest -- - * - * Initialize a FCGX_Request for use with FCGX_Accept_r(). - * - * sock is a file descriptor returned by FCGX_OpenSocket() or 0 (default). - * The only supported flag at this time is FCGI_FAIL_ON_INTR. - * - * Returns 0 upon success. - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_InitRequest(FCGX_Request *request, int sock, int flags); - -/* - *---------------------------------------------------------------------- - * - * FCGX_Accept_r -- - * - * Accept a new request (multi-thread safe). Be sure to call - * FCGX_Init() first. - * - * Results: - * 0 for successful call, -1 for error. - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * Creates input, output, and error streams and - * assigns them to *in, *out, and *err respectively. - * Creates a parameters data structure to be accessed - * via getenv(3) (if assigned to environ) or by FCGX_GetParam - * and assigns it to *envp. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - * DON'T use the FCGX_Request, its structure WILL change. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_Accept_r(FCGX_Request *request); - -/* - *---------------------------------------------------------------------- - * - * FCGX_Finish_r -- - * - * Finish the request (multi-thread safe). - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ -DLLAPI void FCGX_Finish_r(FCGX_Request *request); - -/* - *---------------------------------------------------------------------- - * - * FCGX_Free -- - * - * Free the memory and, if close is true, - * IPC FD associated with the request (multi-thread safe). - * - *---------------------------------------------------------------------- - */ -DLLAPI void FCGX_Free(FCGX_Request * request, int close); - -/* - *---------------------------------------------------------------------- - * - * FCGX_Accept -- - * - * Accept a new request (NOT multi-thread safe). - * - * Results: - * 0 for successful call, -1 for error. - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * Creates input, output, and error streams and - * assigns them to *in, *out, and *err respectively. - * Creates a parameters data structure to be accessed - * via getenv(3) (if assigned to environ) or by FCGX_GetParam - * and assigns it to *envp. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_Accept( - FCGX_Stream **in, - FCGX_Stream **out, - FCGX_Stream **err, - FCGX_ParamArray *envp); - -/* - *---------------------------------------------------------------------- - * - * FCGX_Finish -- - * - * Finish the current request (NOT multi-thread safe). - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ -DLLAPI void FCGX_Finish(void); - -/* - *---------------------------------------------------------------------- - * - * FCGX_StartFilterData -- - * - * stream is an input stream for a FCGI_FILTER request. - * stream is positioned at EOF on FCGI_STDIN. - * Repositions stream to the start of FCGI_DATA. - * If the preconditions are not met (e.g. FCGI_STDIN has not - * been read to EOF) sets the stream error code to - * FCGX_CALL_SEQ_ERROR. - * - * Results: - * 0 for a normal return, < 0 for error - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_StartFilterData(FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_SetExitStatus -- - * - * Sets the exit status for stream's request. The exit status - * is the status code the request would have exited with, had - * the request been run as a CGI program. You can call - * SetExitStatus several times during a request; the last call - * before the request ends determines the value. - * - *---------------------------------------------------------------------- - */ -DLLAPI void FCGX_SetExitStatus(int status, FCGX_Stream *stream); - -/* - *====================================================================== - * Parameters - *====================================================================== - */ - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetParam -- obtain value of FCGI parameter in environment - * - * - * Results: - * Value bound to name, NULL if name not present in the - * environment envp. Caller must not mutate the result - * or retain it past the end of this request. - * - *---------------------------------------------------------------------- - */ -DLLAPI char *FCGX_GetParam(const char *name, FCGX_ParamArray envp); - -/* - *====================================================================== - * Readers - *====================================================================== - */ - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetChar -- - * - * Reads a byte from the input stream and returns it. - * - * Results: - * The byte, or EOF (-1) if the end of input has been reached. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_GetChar(FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_UnGetChar -- - * - * Pushes back the character c onto the input stream. One - * character of pushback is guaranteed once a character - * has been read. No pushback is possible for EOF. - * - * Results: - * Returns c if the pushback succeeded, EOF if not. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_UnGetChar(int c, FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetStr -- - * - * Reads up to n consecutive bytes from the input stream - * into the character array str. Performs no interpretation - * of the input bytes. - * - * Results: - * Number of bytes read. If result is smaller than n, - * the end of input has been reached. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_GetStr(char *str, int n, FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetLine -- - * - * Reads up to n-1 consecutive bytes from the input stream - * into the character array str. Stops before n-1 bytes - * have been read if '\n' or EOF is read. The terminating '\n' - * is copied to str. After copying the last byte into str, - * stores a '\0' terminator. - * - * Results: - * NULL if EOF is the first thing read from the input stream, - * str otherwise. - * - *---------------------------------------------------------------------- - */ -DLLAPI char *FCGX_GetLine(char *str, int n, FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_HasSeenEOF -- - * - * Returns EOF if end-of-file has been detected while reading - * from stream; otherwise returns 0. - * - * Note that FCGX_HasSeenEOF(s) may return 0, yet an immediately - * following FCGX_GetChar(s) may return EOF. This function, like - * the standard C stdio function feof, does not provide the - * ability to peek ahead. - * - * Results: - * EOF if end-of-file has been detected, 0 if not. - * - *---------------------------------------------------------------------- - */ - -DLLAPI int FCGX_HasSeenEOF(FCGX_Stream *stream); - -/* - *====================================================================== - * Writers - *====================================================================== - */ - -/* - *---------------------------------------------------------------------- - * - * FCGX_PutChar -- - * - * Writes a byte to the output stream. - * - * Results: - * The byte, or EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_PutChar(int c, FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_PutStr -- - * - * Writes n consecutive bytes from the character array str - * into the output stream. Performs no interpretation - * of the output bytes. - * - * Results: - * Number of bytes written (n) for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_PutStr(const char *str, int n, FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_PutS -- - * - * Writes a null-terminated character string to the output stream. - * - * Results: - * number of bytes written for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_PutS(const char *str, FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_FPrintF, FCGX_VFPrintF -- - * - * Performs printf-style output formatting and writes the results - * to the output stream. - * - * Results: - * number of bytes written for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_FPrintF(FCGX_Stream *stream, const char *format, ...); - -DLLAPI int FCGX_VFPrintF(FCGX_Stream *stream, const char *format, va_list arg); - -/* - *---------------------------------------------------------------------- - * - * FCGX_FFlush -- - * - * Flushes any buffered output. - * - * Server-push is a legitimate application of FCGX_FFlush. - * Otherwise, FCGX_FFlush is not very useful, since FCGX_Accept - * does it implicitly. Calling FCGX_FFlush in non-push applications - * results in extra writes and therefore reduces performance. - * - * Results: - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_FFlush(FCGX_Stream *stream); - -/* - *====================================================================== - * Both Readers and Writers - *====================================================================== - */ - -/* - *---------------------------------------------------------------------- - * - * FCGX_FClose -- - * - * Closes the stream. For writers, flushes any buffered - * output. - * - * Close is not a very useful operation since FCGX_Accept - * does it implicitly. Closing the out stream before the - * err stream results in an extra write if there's nothing - * in the err stream, and therefore reduces performance. - * - * Results: - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_FClose(FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetError -- - * - * Return the stream error code. 0 means no error, > 0 - * is an errno(2) error, < 0 is an FastCGI error. - * - *---------------------------------------------------------------------- - */ -DLLAPI int FCGX_GetError(FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_ClearError -- - * - * Clear the stream error code and end-of-file indication. - * - *---------------------------------------------------------------------- - */ -DLLAPI void FCGX_ClearError(FCGX_Stream *stream); - -/* - *---------------------------------------------------------------------- - * - * FCGX_CreateWriter -- - * - * Create a FCGX_Stream (used by cgi-fcgi). This shouldn't - * be needed by a FastCGI applictaion. - * - *---------------------------------------------------------------------- - */ -DLLAPI FCGX_Stream *FCGX_CreateWriter( - int socket, - int requestId, - int bufflen, - int streamType); - -/* - *---------------------------------------------------------------------- - * - * FCGX_FreeStream -- - * - * Free a FCGX_Stream (used by cgi-fcgi). This shouldn't - * be needed by a FastCGI applictaion. - * - *---------------------------------------------------------------------- - */ -DLLAPI void FCGX_FreeStream(FCGX_Stream **stream); - -/* ---------------------------------------------------------------------- - * - * Prevent the lib from accepting any new requests. Signal handler safe. - * - * ---------------------------------------------------------------------- - */ -DLLAPI void FCGX_ShutdownPending(void); - -#if defined (__cplusplus) || defined (c_plusplus) -} /* terminate extern "C" { */ -#endif - -#endif /* _FCGIAPP_H */ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgimisc.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgimisc.h deleted file mode 100644 index 0464455f658..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgimisc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * fcgimisc.h -- - * - * Miscellaneous definitions - * - * - * Copyright (c) 1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - * $Id: fcgimisc.h,v 1.3 2001/06/18 14:25:47 robs Exp $ - */ - -#ifndef _FCGIMISC_H -#define _FCGIMISC_H - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef TRUE -#define TRUE (1) -#endif - -#ifndef min -#define min(a,b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef max -#define max(a,b) ((a) > (b) ? (a) : (b)) -#endif - -#ifndef ASSERT -#define ASSERT(assertion) assert(assertion) -#endif - -#endif /* _FCGIMISC_H */ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgio.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgio.h deleted file mode 100644 index 6953772c73b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgio.h +++ /dev/null @@ -1,159 +0,0 @@ -// -// Provides support for FastCGI via C++ iostreams. -// -// $Id: fcgio.h,v 1.15 2002/02/25 13:16:11 robs Exp $ -// -// This work is based on routines written by George Feinberg. They -// have been mostly re-written and extensively changed by -// Michael Richards. -// -// Rewritten again with bug fixes and numerous enhancements by -// Michael Shell. -// -// And rewritten again by Rob Saccoccio. -// -// Special Thanks to Dietmar Kuehl for his help and the numerous custom -// streambuf examples on his web site. -// -// Copyright (c) 2000 Tux the Linux Penguin -// Copyright (c) 2001 Rob Saccoccio and Chelsea Networks -// -// You are free to use this software without charge or royalty -// as long as this notice is not removed or altered, and recognition -// is given to the author(s) -// -// This code is offered as-is without any warranty either expressed or -// implied; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. If it breaks, you get to keep -// both halves. - -#ifndef FCGIO_H -#define FCGIO_H - -#pragma warning(push) -#pragma warning(disable: 4996) -#pragma warning(disable: 4267) -#pragma warning(disable: 4244) - -#include - -#include "fcgiapp.h" - -#ifndef DLLAPI -#ifdef _WIN32 -#define DLLAPI __declspec(dllimport) -#else -#define DLLAPI -#endif -#endif - -#if ! HAVE_STREAMBUF_CHAR_TYPE -typedef char char_type; -#endif - -/* - * fcgi_streambuf - */ -class DLLAPI fcgi_streambuf : public std::streambuf -{ -public: - - // Note that if no buf is assigned (the default), iostream methods - // such as peek(), unget() and putback() will fail. If a buf is - // assigned, I/O is a bit less effecient and output streams will - // have to be flushed (or the streambuf destroyed) before the next - // call to "accept". - fcgi_streambuf(FCGX_Stream * fcgx, char * buf, int len); - - fcgi_streambuf(char_type * buf, std::streamsize len); - - fcgi_streambuf(FCGX_Stream * fcgx = 0); - - ~fcgi_streambuf(void); - - int attach(FCGX_Stream * fcgx); - -protected: - - // Consume the put area (if buffered) and c (if c is not EOF). - virtual int overflow(int); - - // Flush the put area (if buffered) and the FCGX buffer to the client. - virtual int sync(); - - // Remove and return the current character. - virtual int uflow(); - - // Fill the get area (if buffered) and return the current character. - virtual int underflow(); - - // Use a buffer. The only reasons that a buffer would be useful is - // to support the use of the unget()/putback() or seek() methods. Using - // a buffer will result in less efficient I/O. Note: the underlying - // FastCGI library (FCGX) maintains its own input and output buffers. - virtual std::streambuf * setbuf(char_type * buf, std::streamsize len); - - virtual std::streamsize xsgetn(char_type * s, std::streamsize n); - virtual std::streamsize xsputn(const char_type * s, std::streamsize n); - -private: - - FCGX_Stream * fcgx; - - // buf is just handy to have around - char_type * buf; - - // this isn't kept by the base class - std::streamsize bufsize; - - void init(FCGX_Stream * fcgx, char_type * buf, std::streamsize bufsize); - - void reset(void); -}; - -/* - * fcgi_istream - deprecated - */ -class DLLAPI fcgi_istream : public std::istream -{ -public: - - // deprecated - fcgi_istream(FCGX_Stream * fcgx = 0); - - // deprecated - ~fcgi_istream(void) {} - - // deprecated - virtual void attach(FCGX_Stream * fcgx); - -private: - - fcgi_streambuf fcgi_strmbuf; -}; - -/* - * fcgi_ostream - deprecated - */ -class DLLAPI fcgi_ostream : public std::ostream -{ -public: - - // deprecated - fcgi_ostream(FCGX_Stream * fcgx = 0); - - // deprecated - ~fcgi_ostream(void) {} - - // deprecated - virtual void attach(FCGX_Stream *fcgx); - -private: - - fcgi_streambuf fcgi_strmbuf; -}; - - -#pragma warning(pop) - -#endif /* FCGIO_H */ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgios.h b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgios.h deleted file mode 100644 index de7c3c7cf6b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/include/fcgios.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * fcgios.h -- - * - * Description of file. - * - * - * Copyright (c) 1996 Open Market, Inc. - * All rights reserved. - * - * This file contains proprietary and confidential information and - * remains the unpublished property of Open Market, Inc. Use, - * disclosure, or reproduction is prohibited except as permitted by - * express written license agreement with Open Market, Inc. - * - * Bill Snapper - * snapper@openmarket.com - */ -#ifndef _FCGIOS_H -#define _FCGIOS_H - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#include -#endif - -#include "fcgi_config.h" - -#ifdef HAVE_SYS_TIME_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#if defined (c_plusplus) || defined (__cplusplus) -extern "C" { -#endif - -#ifdef _WIN32 -#define OS_Errno GetLastError() -#define OS_SetErrno(err) SetLastError(err) -#ifndef O_NONBLOCK -#define O_NONBLOCK 0x0004 /* no delay */ -#endif -#else /* !_WIN32 */ -#define OS_Errno errno -#define OS_SetErrno(err) errno = (err) -#endif /* !_WIN32 */ - -#ifndef DLLAPI -#ifdef _WIN32 -#define DLLAPI __declspec(dllimport) -#else -#define DLLAPI -#endif -#endif - - -/* This is the initializer for a "struct timeval" used in a select() call - * right after a new request is accept()ed to determine readablity. Its - * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets). - * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware. - * Making this as small as possible, yet remain reliable would be best. - * 2 seconds is very conservative. 0,0 is not reliable. The shorter the - * timeout, the faster request processing will recover. The longer the - * timeout, the more likely this application being "busy" will cause other - * requests to abort and cause more dead sockets that need this timeout. */ -#define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0 - -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#endif - -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif - -#ifndef STDERR_FILENO -#define STDERR_FILENO 2 -#endif - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif - -#ifndef X_OK -#define X_OK 0x01 -#endif - -#ifndef _CLIENTDATA -# if defined(__STDC__) || defined(__cplusplus) - typedef void *ClientData; -# else - typedef int *ClientData; -# endif /* __STDC__ */ -#define _CLIENTDATA -#endif - -typedef void (*OS_AsyncProc) (ClientData clientData, int len); - -DLLAPI int OS_LibInit(int stdioFds[3]); -DLLAPI void OS_LibShutdown(void); -DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog); -DLLAPI int OS_FcgiConnect(char *bindPath); -DLLAPI int OS_Read(int fd, char * buf, size_t len); -DLLAPI int OS_Write(int fd, char * buf, size_t len); -DLLAPI int OS_SpawnChild(char *execPath, int listenFd); -DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr, - ClientData clientData); -DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len, - OS_AsyncProc procPtr, ClientData clientData); -DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len, - OS_AsyncProc procPtr, ClientData clientData); -DLLAPI int OS_Close(int fd); -DLLAPI int OS_CloseRead(int fd); -DLLAPI int OS_DoIo(struct timeval *tmo); -DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs); -DLLAPI int OS_IpcClose(int ipcFd); -DLLAPI int OS_IsFcgi(int sock); -DLLAPI void OS_SetFlags(int fd, int flags); - -DLLAPI void OS_ShutdownPending(void); - -#if defined (__cplusplus) || defined (c_plusplus) -} /* terminate extern "C" { */ -#endif - -#endif /* _FCGIOS_H */ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/install-sh b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/install-sh deleted file mode 100644 index e9de23842dc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/Makefile.am b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/Makefile.am deleted file mode 100644 index 0f1461566a3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# $Id: Makefile.am,v 1.9 2001/12/22 03:16:20 robs Exp $ - -INCLUDEDIR = ../include -CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include - -INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \ - $(INCLUDEDIR)/fcgiapp.h \ - $(INCLUDEDIR)/fcgimisc.h \ - $(INCLUDEDIR)/fcgi_stdio.h \ - $(INCLUDEDIR)/fcgios.h - -lib_LTLIBRARIES = libfcgi.la @LIBFCGIXX@ -EXTRA_LTLIBRARIES = libfcgi++.la - -libfcgi_la_SOURCES = $(INCLUDE_FILES) \ - fcgiapp.c \ - fcgi_stdio.c \ - os_@SYSTEM@.c -libfcgi_la_CC = @PTHREAD_CC@ -libfcgi_la_CFLAGS = @PTHREAD_CFLAGS@ - -libfcgi___la_SOURCES = $(INCLUDE_FILES) \ - $(INCLUDEDIR)/fcgio.h \ - fcgio.cpp -libfcgi___la_CFLAGS = @PTHREAD_CFLAGS@ -libfcgi___la_LDFLAGS = -lfcgi -rpath @libdir@ - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/Makefile.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/Makefile.in deleted file mode 100644 index 420ca0bd9ba..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/Makefile.in +++ /dev/null @@ -1,454 +0,0 @@ -# Makefile.in generated automatically by automake 1.5 from Makefile.am. - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# $Id: Makefile.am,v 1.9 2001/12/22 03:16:20 robs Exp $ - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AMTAR = @AMTAR@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -CXX = @CXX@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -ECHO = @ECHO@ -ECHO_CPP = @ECHO_CPP@ -EXEEXT = @EXEEXT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBFCGIXX = @LIBFCGIXX@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PTHREAD_CC = @PTHREAD_CC@ -PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -SYSTEM = @SYSTEM@ -THREADED = @THREADED@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ - -INCLUDEDIR = ../include -CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/include - -INCLUDE_FILES = $(INCLUDEDIR)/fastcgi.h \ - $(INCLUDEDIR)/fcgiapp.h \ - $(INCLUDEDIR)/fcgimisc.h \ - $(INCLUDEDIR)/fcgi_stdio.h \ - $(INCLUDEDIR)/fcgios.h - - -lib_LTLIBRARIES = libfcgi.la @LIBFCGIXX@ -EXTRA_LTLIBRARIES = libfcgi++.la - -libfcgi_la_SOURCES = $(INCLUDE_FILES) \ - fcgiapp.c \ - fcgi_stdio.c \ - os_@SYSTEM@.c - -libfcgi_la_CC = @PTHREAD_CC@ -libfcgi_la_CFLAGS = @PTHREAD_CFLAGS@ - -libfcgi___la_SOURCES = $(INCLUDE_FILES) \ - $(INCLUDEDIR)/fcgio.h \ - fcgio.cpp - -libfcgi___la_CFLAGS = @PTHREAD_CFLAGS@ -libfcgi___la_LDFLAGS = -lfcgi -rpath @libdir@ -subdir = libfcgi -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/fcgi_config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(lib_LTLIBRARIES) - -libfcgi___la_LIBADD = -am_libfcgi___la_OBJECTS = fcgio.lo -libfcgi___la_OBJECTS = $(am_libfcgi___la_OBJECTS) -libfcgi_la_LDFLAGS = -libfcgi_la_LIBADD = -am_libfcgi_la_OBJECTS = libfcgi_la-fcgiapp.lo libfcgi_la-fcgi_stdio.lo \ - libfcgi_la-os_@SYSTEM@.lo -libfcgi_la_OBJECTS = $(am_libfcgi_la_OBJECTS) - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -@AMDEP_TRUE@DEP_FILES = $(DEPDIR)/fcgio.Plo \ -@AMDEP_TRUE@ $(DEPDIR)/libfcgi_la-fcgi_stdio.Plo \ -@AMDEP_TRUE@ $(DEPDIR)/libfcgi_la-fcgiapp.Plo \ -@AMDEP_TRUE@ $(DEPDIR)/libfcgi_la-os_@SYSTEM@.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CXXFLAGS = @CXXFLAGS@ -DIST_SOURCES = $(libfcgi___la_SOURCES) $(libfcgi_la_SOURCES) -DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(libfcgi___la_SOURCES) $(libfcgi_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .cpp .lo .o .obj - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign libfcgi/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && \ - CONFIG_HEADERS= CONFIG_LINKS= \ - CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$p; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) -libfcgi++.la: $(libfcgi___la_OBJECTS) $(libfcgi___la_DEPENDENCIES) - $(CXXLINK) $(libfcgi___la_LDFLAGS) $(libfcgi___la_OBJECTS) $(libfcgi___la_LIBADD) $(LIBS) -libfcgi_la-fcgiapp.lo: fcgiapp.c -libfcgi_la-fcgi_stdio.lo: fcgi_stdio.c -libfcgi_la-os_@SYSTEM@.lo: os_@SYSTEM@.c -libfcgi.la: $(libfcgi_la_OBJECTS) $(libfcgi_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libfcgi_la_LDFLAGS) $(libfcgi_la_OBJECTS) $(libfcgi_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/fcgio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libfcgi_la-fcgi_stdio.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libfcgi_la-fcgiapp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libfcgi_la-os_@SYSTEM@.Plo@am__quote@ - -distclean-depend: - -rm -rf $(DEPDIR) - -.c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< - -.c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` - -.c.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< - -libfcgi_la-fcgiapp.o: fcgiapp.c -@AMDEP_TRUE@ source='fcgiapp.c' object='libfcgi_la-fcgiapp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-fcgiapp.Po' tmpdepfile='$(DEPDIR)/libfcgi_la-fcgiapp.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-fcgiapp.o `test -f fcgiapp.c || echo '$(srcdir)/'`fcgiapp.c - -libfcgi_la-fcgiapp.obj: fcgiapp.c -@AMDEP_TRUE@ source='fcgiapp.c' object='libfcgi_la-fcgiapp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-fcgiapp.Po' tmpdepfile='$(DEPDIR)/libfcgi_la-fcgiapp.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-fcgiapp.obj `cygpath -w fcgiapp.c` - -libfcgi_la-fcgiapp.lo: fcgiapp.c -@AMDEP_TRUE@ source='fcgiapp.c' object='libfcgi_la-fcgiapp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-fcgiapp.Plo' tmpdepfile='$(DEPDIR)/libfcgi_la-fcgiapp.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-fcgiapp.lo `test -f fcgiapp.c || echo '$(srcdir)/'`fcgiapp.c - -libfcgi_la-fcgi_stdio.o: fcgi_stdio.c -@AMDEP_TRUE@ source='fcgi_stdio.c' object='libfcgi_la-fcgi_stdio.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-fcgi_stdio.Po' tmpdepfile='$(DEPDIR)/libfcgi_la-fcgi_stdio.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-fcgi_stdio.o `test -f fcgi_stdio.c || echo '$(srcdir)/'`fcgi_stdio.c - -libfcgi_la-fcgi_stdio.obj: fcgi_stdio.c -@AMDEP_TRUE@ source='fcgi_stdio.c' object='libfcgi_la-fcgi_stdio.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-fcgi_stdio.Po' tmpdepfile='$(DEPDIR)/libfcgi_la-fcgi_stdio.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-fcgi_stdio.obj `cygpath -w fcgi_stdio.c` - -libfcgi_la-fcgi_stdio.lo: fcgi_stdio.c -@AMDEP_TRUE@ source='fcgi_stdio.c' object='libfcgi_la-fcgi_stdio.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-fcgi_stdio.Plo' tmpdepfile='$(DEPDIR)/libfcgi_la-fcgi_stdio.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-fcgi_stdio.lo `test -f fcgi_stdio.c || echo '$(srcdir)/'`fcgi_stdio.c - -libfcgi_la-os_@SYSTEM@.o: os_@SYSTEM@.c -@AMDEP_TRUE@ source='os_@SYSTEM@.c' object='libfcgi_la-os_@SYSTEM@.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-os_@SYSTEM@.Po' tmpdepfile='$(DEPDIR)/libfcgi_la-os_@SYSTEM@.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-os_@SYSTEM@.o `test -f os_@SYSTEM@.c || echo '$(srcdir)/'`os_@SYSTEM@.c - -libfcgi_la-os_@SYSTEM@.obj: os_@SYSTEM@.c -@AMDEP_TRUE@ source='os_@SYSTEM@.c' object='libfcgi_la-os_@SYSTEM@.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-os_@SYSTEM@.Po' tmpdepfile='$(DEPDIR)/libfcgi_la-os_@SYSTEM@.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-os_@SYSTEM@.obj `cygpath -w os_@SYSTEM@.c` - -libfcgi_la-os_@SYSTEM@.lo: os_@SYSTEM@.c -@AMDEP_TRUE@ source='os_@SYSTEM@.c' object='libfcgi_la-os_@SYSTEM@.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libfcgi_la-os_@SYSTEM@.Plo' tmpdepfile='$(DEPDIR)/libfcgi_la-os_@SYSTEM@.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfcgi_la_CFLAGS) $(CFLAGS) -c -o libfcgi_la-os_@SYSTEM@.lo `test -f os_@SYSTEM@.c || echo '$(srcdir)/'`os_@SYSTEM@.c -CCDEPMODE = @CCDEPMODE@ - -.cpp.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< - -.cpp.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CXXCOMPILE) -c -o $@ `cygpath -w $<` - -.cpp.lo: -@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(LTCXXCOMPILE) -c -o $@ `test -f $< || echo '$(srcdir)/'`$< -CXXDEPMODE = @CXXDEPMODE@ -uninstall-info-am: - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) - -GTAGS: - here=`CDPATH=: && cd $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ - if test -f $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - $(mkinstalldirs) "$(distdir)/$$dir"; \ - fi; \ - if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir) \ - || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) - -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-libLTLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES - -.PHONY: GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool distclean distclean-compile \ - distclean-depend distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am \ - install-libLTLIBRARIES install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool tags uninstall \ - uninstall-am uninstall-info-am uninstall-libLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgi_stdio.c b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgi_stdio.c deleted file mode 100644 index 5a1c69dd98e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgi_stdio.c +++ /dev/null @@ -1,809 +0,0 @@ -/* - * fcgi_stdio.c -- - * - * FastCGI-stdio compatibility package - * - * - * Copyright (c) 1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - */ - -#pragma warning(push) -#pragma warning(disable: 4996) -#pragma warning(disable: 4267) -#pragma warning(disable: 4244) - -#ifndef lint -static const char rcsid[] = "$Id: fcgi_stdio.c,v 1.14 2001/09/01 01:09:30 robs Exp $"; -#endif /* not lint */ - -#include /* for errno */ -#include /* for va_arg */ -#include /* for malloc */ -#include /* for strerror */ - -#include "fcgi_config.h" - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef _WIN32 -//#define DLLAPI __declspec(dllexport) -#endif - -#include "fcgiapp.h" -#include "fcgios.h" -#include "fcgimisc.h" - -#define NO_FCGI_DEFINES -#include "fcgi_stdio.h" -#undef NO_FCGI_DEFINES - -#ifndef _WIN32 - -extern char **environ; - -#ifdef HAVE_FILENO_PROTO -#include -#else -extern int fileno(FILE *stream); -#endif - -extern FILE *fdopen(int fildes, const char *type); -extern FILE *popen(const char *command, const char *type); -extern int pclose(FILE *stream); - -#else /* _WIN32 */ - -#define popen _popen -#define pclose _pclose - -#endif /* _WIN32 */ - -FCGI_FILE _fcgi_sF[3]; - - -/* - *---------------------------------------------------------------------- - * - * FCGI_Accept -- - * - * Accepts a new request from the HTTP server and creates - * a conventional execution environment for the request. - * - * If the application was invoked as a FastCGI server, - * the first call to FCGI_Accept indicates that the application - * has completed its initialization and is ready to accept - * a request. Subsequent calls to FCGI_Accept indicate that - * the application has completed its processing of the - * current request and is ready to accept a new request. - * - * If the application was invoked as a CGI program, the first - * call to FCGI_Accept is essentially a no-op and the second - * call returns EOF (-1). - * - * Results: - * 0 for successful call, -1 for error (application should exit). - * - * Side effects: - * If the application was invoked as a FastCGI server, - * and this is not the first call to this procedure, - * FCGI_Accept first performs the equivalent of FCGI_Finish. - * - * On every call, FCGI_Accept accepts the new request and - * reads the FCGI_PARAMS stream into an environment array, - * i.e. a NULL-terminated array of strings of the form - * ``name=value''. It assigns a pointer to this array - * to the global variable environ, used by the standard - * library function getenv. It creates new FCGI_FILE *s - * representing input from the HTTP server, output to the HTTP - * server, and error output to the HTTP server, and assigns these - * new files to stdin, stdout, and stderr respectively. - * - * DO NOT mutate or retain pointers to environ or any values - * contained in it (e.g. to the result of calling getenv(3)), - * since these are freed by the next call to FCGI_Finish or - * FCGI_Accept. In particular do not use setenv(3) or putenv(3) - * in conjunction with FCGI_Accept. - * - *---------------------------------------------------------------------- - */ -static int acceptCalled = FALSE; -static int isCGI = FALSE; - -int FCGI_Accept(void) -{ - if(!acceptCalled) { - /* - * First call to FCGI_Accept. Is application running - * as FastCGI or as CGI? - */ - isCGI = FCGX_IsCGI(); - acceptCalled = TRUE; - atexit(&FCGI_Finish); - } else if(isCGI) { - /* - * Not first call to FCGI_Accept and running as CGI means - * application is done. - */ - return(EOF); - } - if(isCGI) { - FCGI_stdin->stdio_stream = stdin; - FCGI_stdin->fcgx_stream = NULL; - FCGI_stdout->stdio_stream = stdout; - FCGI_stdout->fcgx_stream = NULL; - FCGI_stderr->stdio_stream = stderr; - FCGI_stderr->fcgx_stream = NULL; - } else { - FCGX_Stream *in, *out, *error; - FCGX_ParamArray envp; - int acceptResult = FCGX_Accept(&in, &out, &error, &envp); - if(acceptResult < 0) { - return acceptResult; - } - FCGI_stdin->stdio_stream = NULL; - FCGI_stdin->fcgx_stream = in; - FCGI_stdout->stdio_stream = NULL; - FCGI_stdout->fcgx_stream = out; - FCGI_stderr->stdio_stream = NULL; - FCGI_stderr->fcgx_stream = error; - environ = envp; - } - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_Finish -- - * - * Finishes the current request from the HTTP server. - * - * Side effects: - * - * Flushes any buffered output to the HTTP server. Then frees - * all storage allocated by the previous call, including all - * storage reachable from the value of environ set by the previous - * call to FCGI_Accept. - * - * DO NOT use stdin, stdout, stderr, or environ between calling - * FCGI_Finish and calling FCGI_Accept. - * - * DO NOT mutate or retain pointers to environ or any values - * contained in it (e.g. to the result of calling getenv(3)), - * since these are freed by the next call to FCGI_Finish or - * FCGI_Accept. In particular do not use setenv(3) or putenv(3) - * in conjunction with FCGI_Accept. - * - *---------------------------------------------------------------------- - */ -void FCGI_Finish(void) -{ - if(!acceptCalled || isCGI) { - return; - } - FCGX_Finish(); - FCGI_stdin->fcgx_stream = NULL; - FCGI_stdout->fcgx_stream = NULL; - FCGI_stderr->fcgx_stream = NULL; - environ = NULL; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_StartFilterData -- - * - * - * The current request is for the filter role, and stdin is - * positioned at EOF of FCGI_STDIN. The call repositions - * stdin to the start of FCGI_DATA. - * If the preconditions are not met (e.g. FCGI_STDIN has not - * been read to EOF), the call sets the stream error code to - * FCGX_CALL_SEQ_ERROR. - * - * Results: - * 0 for a normal return, < 0 for error - * - *---------------------------------------------------------------------- - */ -int FCGI_StartFilterData(void) -{ - if(FCGI_stdin->stdio_stream) { - return -1; - } else { - return FCGX_StartFilterData(FCGI_stdin->fcgx_stream); - } -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_SetExitStatus -- - * - * Sets the exit status for the current request. The exit status - * is the status code the request would have exited with, had - * the request been run as a CGI program. You can call - * FCGI_SetExitStatus several times during a request; the last call - * before the request ends (by calling FCGI_Accept) determines the - * value. - * - *---------------------------------------------------------------------- - */ -void FCGI_SetExitStatus(int status) -{ - if(FCGI_stdin->fcgx_stream) { - FCGX_SetExitStatus(status, FCGI_stdin->fcgx_stream); - } -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_perror -- - * - * Wrapper for function defined in H&S Section 11.2 - * - *---------------------------------------------------------------------- - */ -void FCGI_perror(const char *str) -{ - FCGI_fputs(str, FCGI_stderr); - FCGI_fputs(": ", FCGI_stderr); - FCGI_fputs(strerror(OS_Errno), FCGI_stderr); - return; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_OpenFromFILE -- - * - * Constructs a new FCGI_FILE * from the FILE *stream. - * - * Results: - * NULL if stream == NULL or storage could not be allocated, - * otherwise the new FCGI_FILE *. - * - *---------------------------------------------------------------------- - */ -static FCGI_FILE *FCGI_OpenFromFILE(FILE *stream) -{ - FCGI_FILE *fp; - - if (stream == NULL) - return NULL; - - fp = (FCGI_FILE *) malloc(sizeof(FCGI_FILE)); - if (fp != NULL) - { - fp->stdio_stream = stream; - fp->fcgx_stream = NULL; - } - - return fp; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fopen, FCGI_fclose, FCGI_fflush, FCGI_freopen -- - * - * Wrappers for functions defined in H&S Section 15.2 - * - *---------------------------------------------------------------------- - */ -FCGI_FILE *FCGI_fopen(const char *path, const char *mode) -{ - FILE * file = fopen(path, mode); - FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file); - - if (file && !fcgi_file) - fclose(file); - - return fcgi_file; -} - -int FCGI_fclose(FCGI_FILE *fp) -{ - int n = EOF; - if(fp->stdio_stream) { - n = fclose(fp->stdio_stream); - fp->stdio_stream = NULL; - } else if(fp->fcgx_stream) { - n = FCGX_FClose(fp->fcgx_stream); - fp->fcgx_stream = NULL; - } - if((fp != FCGI_stdin) && (fp != FCGI_stdout) && (fp != FCGI_stderr)) { - free(fp); - } - return n; -} - -int FCGI_fflush(FCGI_FILE *fp) -{ - if(fp == NULL) - return fflush(NULL); - if(fp->stdio_stream) - return fflush(fp->stdio_stream); - else if(fp->fcgx_stream) - return FCGX_FFlush(fp->fcgx_stream); - return EOF; -} - -FCGI_FILE *FCGI_freopen(const char *path, const char *mode, - FCGI_FILE *fp) -{ - if(fp->stdio_stream) { - fp->stdio_stream = freopen(path, mode, fp->stdio_stream); - if(fp->stdio_stream == NULL) - return NULL; - else - return fp; - } else if(fp->fcgx_stream) { - (void) FCGX_FClose(fp->fcgx_stream); - fp->stdio_stream = fopen(path, mode); - if(fp->stdio_stream == NULL) - return NULL; - else { - fp->fcgx_stream = NULL; - return fp; - } - } - return NULL; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_setvbuf, FCGI_setbuf -- - * - * Wrappers for functions defined in H&S Section 15.3 - * - *---------------------------------------------------------------------- - */ -int FCGI_setvbuf(FCGI_FILE *fp, char *buf, int bufmode, size_t size) -{ - if(fp->stdio_stream) - return setvbuf(fp->stdio_stream, buf, bufmode, size); - else { - return -1; - } -} - -void FCGI_setbuf(FCGI_FILE *fp, char *buf) -{ - if(fp->stdio_stream) - setbuf(fp->stdio_stream, buf); -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fseek, FCGI_ftell, FCGI_rewind, FCGI_fgetpos, FCGI_fsetpos -- - * - * Wrappers for functions defined in H&S Section 15.5 - * - *---------------------------------------------------------------------- - */ -int FCGI_fseek(FCGI_FILE *fp, long offset, int whence) -{ - if(fp->stdio_stream) - return fseek(fp->stdio_stream, offset, whence); - else { - OS_SetErrno(ESPIPE); - return -1; - } -} - -int FCGI_ftell(FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return ftell(fp->stdio_stream); - else { - OS_SetErrno(ESPIPE); - return -1; - } -} - -void FCGI_rewind(FCGI_FILE *fp) -{ - if(fp->stdio_stream) - rewind(fp->stdio_stream); - else - OS_SetErrno(ESPIPE); -} - -#ifdef HAVE_FPOS -int FCGI_fgetpos(FCGI_FILE *fp, fpos_t *pos) -{ - if(fp->stdio_stream) - return fgetpos(fp->stdio_stream, pos); - else { - OS_SetErrno(ESPIPE); - return -1; - } -} - -int FCGI_fsetpos(FCGI_FILE *fp, const fpos_t *pos) -{ - if(fp->stdio_stream) - return fsetpos(fp->stdio_stream, pos); - else { - OS_SetErrno(ESPIPE); - return -1; - } -} -#endif - -/* - *---------------------------------------------------------------------- - * - * FCGI_fgetc, FCGI_getchar, FCGI_ungetc -- - * - * Wrappers for functions defined in H&S Section 15.6 - * - * XXX: getc and getchar are generally defined as macros - * for performance reasons - * - *---------------------------------------------------------------------- - */ -int FCGI_fgetc(FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return fgetc(fp->stdio_stream); - else if(fp->fcgx_stream) - return FCGX_GetChar(fp->fcgx_stream); - return EOF; -} - -int FCGI_getchar(void) -{ - return FCGI_fgetc(FCGI_stdin); -} - -int FCGI_ungetc(int c, FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return ungetc(c, fp->stdio_stream); - else if(fp->fcgx_stream) - return FCGX_UnGetChar(c, fp->fcgx_stream); - return EOF; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fgets, FCGI_gets -- - * - * Wrappers for functions defined in H&S Section 15.7 - * - *---------------------------------------------------------------------- - */ -char *FCGI_fgets(char *str, int size, FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return fgets(str, size, fp->stdio_stream); - else if(fp->fcgx_stream) - return FCGX_GetLine(str, size, fp->fcgx_stream); - return NULL; -} - -/* - * The gets() function reads characters from the standard input stream - * into the array pointed to by str until a newline character is read - * or an end-of-file condition is encountered. The newline character - * is discarded and the string is terminated with a null character. - */ -char *FCGI_gets(char *str) -{ - char *s; - int c; - - for (s = str; ((c = FCGI_getchar()) != '\n');) { - if(c == EOF) { - if(s == str) - return NULL; - else - break; - } else - *s++ = (char) c; - } - *s = 0; - return str; -} - -/* - *---------------------------------------------------------------------- - * - * Wrappers for functions defined in H&S Section 15.8 - * - * XXX: missing: fscanf, scanf - * - *---------------------------------------------------------------------- - */ - -/* - *---------------------------------------------------------------------- - * - * FCGI_fputc, FCGI_putchar -- - * - * Wrappers for functions defined in H&S Section 15.9 - * - * XXX: putc and putchar are generally defined as macros - * for performance reasons - * - *---------------------------------------------------------------------- - */ -int FCGI_fputc(int c, FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return fputc(c, fp->stdio_stream); - else if(fp->fcgx_stream) - return FCGX_PutChar(c, fp->fcgx_stream); - else return EOF; -} - -int FCGI_putchar(int c) -{ - return FCGI_fputc(c, FCGI_stdout); -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fputs, FCGI_puts - * - * Wrappers for functions defined in H&S Section 15.10 - * - *---------------------------------------------------------------------- - */ -int FCGI_fputs(const char *str, FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return fputs(str, fp->stdio_stream); - else if(fp->fcgx_stream) - return FCGX_PutS(str, fp->fcgx_stream); - return EOF; -} - -int FCGI_puts(const char *str) -{ - int n; - if(FCGI_stdout->stdio_stream) { - n = fputs(str, FCGI_stdout->stdio_stream); - if(n < 0) - return n; - else - return fputc('\n', FCGI_stdout->stdio_stream); - } else if(FCGI_stdout->fcgx_stream) { - n = FCGX_PutS(str, FCGI_stdout->fcgx_stream); - if(n < 0) - return n; - else - return FCGX_PutChar('\n', FCGI_stdout->fcgx_stream); - } - return EOF; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fprintf, FCGI_printf -- - * - * Wrappers for functions defined in H&S Section 15.11 - * - *---------------------------------------------------------------------- - */ -int FCGI_fprintf(FCGI_FILE *fp, const char *format, ...) -{ - va_list ap; - int n = 0; - va_start(ap, format); - if(fp->stdio_stream) - n = vfprintf(fp->stdio_stream, format, ap); - else if(fp->fcgx_stream) - n = FCGX_VFPrintF(fp->fcgx_stream, format, ap); - va_end(ap); - return n; -} - -int FCGI_printf(const char *format, ...) -{ - va_list ap; - int n; - va_start(ap, format); - n = FCGI_vfprintf(FCGI_stdout, format, ap); - va_end(ap); - return n; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_vfprintf, FCGI_vprintf -- - * - * Wrappers for functions defined in H&S Section 15.12 - * - *---------------------------------------------------------------------- - */ -int FCGI_vfprintf(FCGI_FILE *fp, const char *format, va_list ap) -{ - if(fp->stdio_stream) - return vfprintf(fp->stdio_stream, format, ap); - else if(fp->fcgx_stream) - return FCGX_VFPrintF(fp->fcgx_stream, format, ap); - return EOF; -} - -int FCGI_vprintf(const char *format, va_list ap) -{ - if(FCGI_stdout->stdio_stream) - return vfprintf(FCGI_stdout->stdio_stream, format, ap); - else if(FCGI_stdout->fcgx_stream) - return FCGX_VFPrintF(FCGI_stdout->fcgx_stream, format, ap); - return EOF; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fread, FCGI_fwrite -- - * - * Wrappers for functions defined in H&S Section 15.13 - * - *---------------------------------------------------------------------- - */ -size_t FCGI_fread(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp) -{ - int n; - if(fp->stdio_stream) - return fread(ptr, size, nmemb, fp->stdio_stream); - else if(fp->fcgx_stream) { - if((size * nmemb) == 0) { - return 0; - } - n = FCGX_GetStr((char *) ptr, size * nmemb, fp->fcgx_stream); - return (n/size); - } - return (size_t)EOF; -} - -size_t FCGI_fwrite(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp) -{ - int n; - if(fp->stdio_stream) - return fwrite(ptr, size, nmemb, fp->stdio_stream); - else if(fp->fcgx_stream) { - if((size * nmemb) == 0) { - return 0; - } - n = FCGX_PutStr((char *) ptr, size * nmemb, fp->fcgx_stream); - return (n/size); - } - return (size_t)EOF; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_feof, FCGI_ferror, FCGI_clearerr -- - * - * Wrappers for functions defined in H&S Section 15.14 - * - *---------------------------------------------------------------------- - */ -int FCGI_feof(FCGI_FILE *fp) -{ - if(fp->stdio_stream) { - return feof(fp->stdio_stream); - } else if (fp->fcgx_stream){ - return FCGX_HasSeenEOF(fp->fcgx_stream); - } - return -1; - -} - -int FCGI_ferror(FCGI_FILE *fp) -{ - if(fp->stdio_stream) { - return ferror(fp->stdio_stream); - } else if(fp->fcgx_stream) { - return FCGX_GetError(fp->fcgx_stream); - } - return -1; -} - -void FCGI_clearerr(FCGI_FILE *fp) -{ - if(fp->stdio_stream) { - clearerr(fp->stdio_stream); - } else if(fp->fcgx_stream) { - FCGX_ClearError(fp->fcgx_stream); - } - return; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_tmpfile -- - * - * Wrappers for function defined in H&S Section 15.16 - * - *---------------------------------------------------------------------- - */ -FCGI_FILE *FCGI_tmpfile(void) -{ - FILE * file = tmpfile(); - FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file); - - if (file && !fcgi_file) - fclose(file); - - return fcgi_file; -} - -/* - *---------------------------------------------------------------------- - * - * FCGI_fileno, FCGI_fdopen, FCGI_popen, FCGI_pclose -- - * - * Wrappers for POSIX, X/OPEN functions not in ISO C - * - *---------------------------------------------------------------------- - */ -int FCGI_fileno(FCGI_FILE *fp) -{ - if(fp->stdio_stream) - return fileno(fp->stdio_stream); - else - return -1; -} - -FCGI_FILE *FCGI_fdopen(int fd, const char *mode) -{ - FILE * file = fdopen(fd, mode); - FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file); - - if (file && !fcgi_file) - fclose(file); - - return fcgi_file; -} - -FCGI_FILE *FCGI_popen(const char *cmd, const char *type) -{ - FILE * file = popen(cmd, type); - FCGI_FILE * fcgi_file = FCGI_OpenFromFILE(file); - - if (file && !fcgi_file) - pclose(file); - - return fcgi_file; -} - -int FCGI_pclose(FCGI_FILE *fp) -{ - int n = EOF; - if (fp->stdio_stream) { - n = pclose(fp->stdio_stream); - fp->stdio_stream = NULL; - } else if(fp->fcgx_stream) { - /* - * The caller is deeply confused; don't free the storage. - */ - return EOF; - } - if((fp != FCGI_stdin) && (fp != FCGI_stdout) && (fp != FCGI_stderr)) { - free(fp); - } - return n; -} - -#pragma warning(pop) \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgiapp.c b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgiapp.c deleted file mode 100644 index 3228e99978a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgiapp.c +++ /dev/null @@ -1,2316 +0,0 @@ -/* - * fcgiapp.c -- - * - * FastCGI application library: request-at-a-time - * - * - * Copyright (c) 1996 Open Market, Inc. - * - * See the file "LICENSE.TERMS" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - * - */ -#pragma warning(push) -#pragma warning(disable: 4996) -#pragma warning(disable: 4267) -#pragma warning(disable: 4244) -#pragma warning(disable: 4311) - -#ifndef lint -static const char rcsid[] = "$Id: fcgiapp.c,v 1.34 2001/12/12 22:54:10 robs Exp $"; -#endif /* not lint */ - -#include -#include -#include /* for fcntl */ -#include -#include /* for memchr() */ -#include -#include -#include -#include -#include - -#include "fcgi_config.h" - -#ifdef HAVE_SYS_SOCKET_H -#include /* for getpeername */ -#endif - -#ifdef HAVE_SYS_TIME_H -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifdef HAVE_LIMITS_H -#include -#endif - -#ifdef _WIN32 -//#define DLLAPI __declspec(dllexport) -#endif - -#include "fcgimisc.h" -#include "fastcgi.h" -#include "fcgios.h" -#include "fcgiapp.h" - -/* - * This is a workaround for one version of the HP C compiler - * (c89 on HP-UX 9.04, also Stratus FTX), which will dump core - * if given 'long double' for varargs. - */ -#ifdef HAVE_VA_ARG_LONG_DOUBLE_BUG -#define LONG_DOUBLE double -#else -#define LONG_DOUBLE long double -#endif - -/* - * Globals - */ -static int libInitialized = 0; -static int isFastCGI = -1; -static char *webServerAddressList = NULL; -static FCGX_Request the_request; - -void FCGX_ShutdownPending(void) -{ - OS_ShutdownPending(); -} - -static void *Malloc(size_t size) -{ - void *result = malloc(size); - ASSERT(size == 0 || result != NULL); - return result; -} - -static char *StringCopy(char *str) -{ - int strLen = strlen(str); - char *newString = (char *)Malloc(strLen + 1); - memcpy(newString, str, strLen); - newString[strLen] = '\000'; - return newString; -} - - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetChar -- - * - * Reads a byte from the input stream and returns it. - * - * Results: - * The byte, or EOF (-1) if the end of input has been reached. - * - *---------------------------------------------------------------------- - */ -int FCGX_GetChar(FCGX_Stream *stream) -{ - if (stream->isClosed || ! stream->isReader) - return EOF; - - if (stream->rdNext != stream->stop) - return *stream->rdNext++; - - stream->fillBuffProc(stream); - if (stream->isClosed) - return EOF; - - stream->stopUnget = stream->rdNext; - if (stream->rdNext != stream->stop) - return *stream->rdNext++; - - ASSERT(stream->isClosed); /* bug in fillBufProc if not */ - return EOF; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetStr -- - * - * Reads up to n consecutive bytes from the input stream - * into the character array str. Performs no interpretation - * of the input bytes. - * - * Results: - * Number of bytes read. If result is smaller than n, - * the end of input has been reached. - * - *---------------------------------------------------------------------- - */ -int FCGX_GetStr(char *str, int n, FCGX_Stream *stream) -{ - int m, bytesMoved; - - if (stream->isClosed || ! stream->isReader || n <= 0) { - return 0; - } - /* - * Fast path: n bytes are already available - */ - if(n <= (stream->stop - stream->rdNext)) { - memcpy(str, stream->rdNext, n); - stream->rdNext += n; - return n; - } - /* - * General case: stream is closed or buffer fill procedure - * needs to be called - */ - bytesMoved = 0; - for (;;) { - if(stream->rdNext != stream->stop) { - m = min(n - bytesMoved, stream->stop - stream->rdNext); - memcpy(str, stream->rdNext, m); - bytesMoved += m; - stream->rdNext += m; - if(bytesMoved == n) - return bytesMoved; - str += m; - } - if(stream->isClosed || !stream->isReader) - return bytesMoved; - stream->fillBuffProc(stream); - if (stream->isClosed) - return bytesMoved; - - stream->stopUnget = stream->rdNext; - } -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetLine -- - * - * Reads up to n-1 consecutive bytes from the input stream - * into the character array str. Stops before n-1 bytes - * have been read if '\n' or EOF is read. The terminating '\n' - * is copied to str. After copying the last byte into str, - * stores a '\0' terminator. - * - * Results: - * NULL if EOF is the first thing read from the input stream, - * str otherwise. - * - *---------------------------------------------------------------------- - */ -char *FCGX_GetLine(char *str, int n, FCGX_Stream *stream) -{ - int c; - char *p = str; - - n--; - while (n > 0) { - c = FCGX_GetChar(stream); - if(c == EOF) { - if(p == str) - return NULL; - else - break; - } - *p++ = (char) c; - n--; - if(c == '\n') - break; - } - *p = '\0'; - return str; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_UnGetChar -- - * - * Pushes back the character c onto the input stream. One - * character of pushback is guaranteed once a character - * has been read. No pushback is possible for EOF. - * - * Results: - * Returns c if the pushback succeeded, EOF if not. - * - *---------------------------------------------------------------------- - */ -int FCGX_UnGetChar(int c, FCGX_Stream *stream) { - if(c == EOF - || stream->isClosed - || !stream->isReader - || stream->rdNext == stream->stopUnget) - return EOF; - --(stream->rdNext); - *stream->rdNext = (unsigned char) c; - return c; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_HasSeenEOF -- - * - * Returns EOF if end-of-file has been detected while reading - * from stream; otherwise returns 0. - * - * Note that FCGX_HasSeenEOF(s) may return 0, yet an immediately - * following FCGX_GetChar(s) may return EOF. This function, like - * the standard C stdio function feof, does not provide the - * ability to peek ahead. - * - * Results: - * EOF if end-of-file has been detected, 0 if not. - * - *---------------------------------------------------------------------- - */ -int FCGX_HasSeenEOF(FCGX_Stream *stream) { - return (stream->isClosed) ? EOF : 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_PutChar -- - * - * Writes a byte to the output stream. - * - * Results: - * The byte, or EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -int FCGX_PutChar(int c, FCGX_Stream *stream) -{ - if(stream->wrNext != stream->stop) - return (*stream->wrNext++ = (unsigned char) c); - if(stream->isClosed || stream->isReader) - return EOF; - stream->emptyBuffProc(stream, FALSE); - if(stream->wrNext != stream->stop) - return (*stream->wrNext++ = (unsigned char) c); - ASSERT(stream->isClosed); /* bug in emptyBuffProc if not */ - return EOF; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_PutStr -- - * - * Writes n consecutive bytes from the character array str - * into the output stream. Performs no interpretation - * of the output bytes. - * - * Results: - * Number of bytes written (n) for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -int FCGX_PutStr(const char *str, int n, FCGX_Stream *stream) -{ - int m, bytesMoved; - - /* - * Fast path: room for n bytes in the buffer - */ - if(n <= (stream->stop - stream->wrNext)) { - memcpy(stream->wrNext, str, n); - stream->wrNext += n; - return n; - } - /* - * General case: stream is closed or buffer empty procedure - * needs to be called - */ - bytesMoved = 0; - for (;;) { - if(stream->wrNext != stream->stop) { - m = min(n - bytesMoved, stream->stop - stream->wrNext); - memcpy(stream->wrNext, str, m); - bytesMoved += m; - stream->wrNext += m; - if(bytesMoved == n) - return bytesMoved; - str += m; - } - if(stream->isClosed || stream->isReader) - return -1; - stream->emptyBuffProc(stream, FALSE); - } -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_PutS -- - * - * Writes a character string to the output stream. - * - * Results: - * number of bytes written for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -int FCGX_PutS(const char *str, FCGX_Stream *stream) -{ - return FCGX_PutStr(str, strlen(str), stream); -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_FPrintF -- - * - * Performs output formatting and writes the results - * to the output stream. - * - * Results: - * number of bytes written for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -int FCGX_FPrintF(FCGX_Stream *stream, const char *format, ...) -{ - int result; - va_list ap; - va_start(ap, format); - result = FCGX_VFPrintF(stream, format, ap); - va_end(ap); - return result; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_VFPrintF -- - * - * Performs output formatting and writes the results - * to the output stream. - * - * Results: - * number of bytes written for normal return, - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ - -#define PRINTF_BUFFLEN 100 - /* - * More than sufficient space for all unmodified conversions - * except %s and %f. - */ -#define FMT_BUFFLEN 25 - /* - * Max size of a format specifier is 1 + 5 + 7 + 7 + 2 + 1 + slop - */ -static void CopyAndAdvance(char **destPtr, char **srcPtr, int n); - -int FCGX_VFPrintF(FCGX_Stream *stream, const char *format, va_list arg) -{ - char *f, *fStop, *percentPtr, *p, *fmtBuffPtr, *buffPtr; - int op, performedOp, sizeModifier, buffCount = 0, buffLen, specifierLength; - int fastPath, n, auxBuffLen = 0, buffReqd, minWidth, precision, exp; - char *auxBuffPtr = NULL; - int streamCount = 0; - char fmtBuff[FMT_BUFFLEN]; - char buff[PRINTF_BUFFLEN]; - - int intArg; - short shortArg; - long longArg; - unsigned unsignedArg; - unsigned long uLongArg; - unsigned short uShortArg; - char *charPtrArg = NULL; - void *voidPtrArg; - int *intPtrArg; - long *longPtrArg; - short *shortPtrArg; - double doubleArg = 0.0; - LONG_DOUBLE lDoubleArg = 0.0L; - - fmtBuff[0] = '%'; - f = (char *) format; - fStop = f + strlen(f); - while (f != fStop) { - percentPtr = (char *)memchr(f, '%', fStop - f); - if(percentPtr == NULL) percentPtr = fStop; - if(percentPtr != f) { - if(FCGX_PutStr(f, percentPtr - f, stream) < 0) - goto ErrorReturn; - streamCount += percentPtr - f; - f = percentPtr; - if(f == fStop) break; - } - fastPath = TRUE; - /* - * The following loop always executes either once or twice. - */ - for (;;) { - if(fastPath) { - /* - * Fast path: Scan optimistically, hoping that no flags, - * minimum field width, or precision are specified. - * Use the preallocated buffer, which is large enough - * for all fast path cases. If the conversion specifier - * is really more complex, run the loop a second time - * using the slow path. - * Note that fast path execution of %s bypasses the buffer - * and %f is not attempted on the fast path due to - * its large buffering requirements. - */ - op = *(percentPtr + 1); - switch(op) { - case 'l': - case 'L': - case 'h': - sizeModifier = op; - op = *(percentPtr + 2); - fmtBuff[1] = (char) sizeModifier; - fmtBuff[2] = (char) op; - fmtBuff[3] = '\0'; - specifierLength = 3; - break; - default: - sizeModifier = ' '; - fmtBuff[1] = (char) op; - fmtBuff[2] = '\0'; - specifierLength = 2; - break; - } - buffPtr = buff; - buffLen = PRINTF_BUFFLEN; - } else { - /* - * Slow path: Scan the conversion specifier and construct - * a new format string, compute an upper bound on the - * amount of buffering that sprintf will require, - * and allocate a larger buffer if necessary. - */ - p = percentPtr + 1; - fmtBuffPtr = &fmtBuff[1]; - /* - * Scan flags - */ - n = strspn(p, "-0+ #"); - if(n > 5) - goto ErrorReturn; - CopyAndAdvance(&fmtBuffPtr, &p, n); - /* - * Scan minimum field width - */ - n = strspn(p, "0123456789"); - if(n == 0) { - if(*p == '*') { - minWidth = va_arg(arg, int); - if(abs(minWidth) > 999999) - goto ErrorReturn; - /* - * The following use of strlen rather than the - * value returned from sprintf is because SUNOS4 - * returns a char * instead of an int count. - */ - sprintf(fmtBuffPtr, "%d", minWidth); - fmtBuffPtr += strlen(fmtBuffPtr); - p++; - } else { - minWidth = 0; - } - } else if(n <= 6) { - minWidth = strtol(p, NULL, 10); - CopyAndAdvance(&fmtBuffPtr, &p, n); - } else { - goto ErrorReturn; - } - /* - * Scan precision - */ - if(*p == '.') { - CopyAndAdvance(&fmtBuffPtr, &p, 1); - n = strspn(p, "0123456789"); - if(n == 0) { - if(*p == '*') { - precision = va_arg(arg, int); - if(precision < 0) precision = 0; - if(precision > 999999) - goto ErrorReturn; - /* - * The following use of strlen rather than the - * value returned from sprintf is because SUNOS4 - * returns a char * instead of an int count. - */ - sprintf(fmtBuffPtr, "%d", precision); - fmtBuffPtr += strlen(fmtBuffPtr); - p++; - } else { - precision = 0; - } - } else if(n <= 6) { - precision = strtol(p, NULL, 10); - CopyAndAdvance(&fmtBuffPtr, &p, n); - } else { - goto ErrorReturn; - } - } else { - precision = -1; - } - /* - * Scan size modifier and conversion operation - */ - switch(*p) { - case 'l': - case 'L': - case 'h': - sizeModifier = *p; - CopyAndAdvance(&fmtBuffPtr, &p, 1); - break; - default: - sizeModifier = ' '; - break; - } - op = *p; - CopyAndAdvance(&fmtBuffPtr, &p, 1); - ASSERT(fmtBuffPtr - fmtBuff < FMT_BUFFLEN); - *fmtBuffPtr = '\0'; - specifierLength = p - percentPtr; - /* - * Bound the required buffer size. For s and f - * conversions this requires examining the argument. - */ - switch(op) { - case 'd': - case 'i': - case 'u': - case 'o': - case 'x': - case 'X': - case 'c': - case 'p': - buffReqd = max(precision, 46); - break; - case 's': - charPtrArg = va_arg(arg, char *); - if (!charPtrArg) charPtrArg = "(null)"; - if(precision == -1) { - buffReqd = strlen(charPtrArg); - } else { - p = (char *)memchr(charPtrArg, '\0', precision); - buffReqd = - (p == NULL) ? precision : p - charPtrArg; - } - break; - case 'f': - switch(sizeModifier) { - case ' ': - doubleArg = va_arg(arg, double); - frexp(doubleArg, &exp); - break; - case 'L': - lDoubleArg = va_arg(arg, LONG_DOUBLE); - /* XXX Need to check for the presence of - * frexpl() and use it if available */ - frexp((double) lDoubleArg, &exp); - break; - default: - goto ErrorReturn; - } - if(precision == -1) precision = 6; - buffReqd = precision + 3 + ((exp > 0) ? exp/3 : 0); - break; - case 'e': - case 'E': - case 'g': - case 'G': - if(precision == -1) precision = 6; - buffReqd = precision + 8; - break; - case 'n': - case '%': - default: - goto ErrorReturn; - break; - } - buffReqd = max(buffReqd + 10, minWidth); - /* - * Allocate the buffer - */ - if(buffReqd <= PRINTF_BUFFLEN) { - buffPtr = buff; - buffLen = PRINTF_BUFFLEN; - } else { - if(auxBuffPtr == NULL || buffReqd > auxBuffLen) { - if(auxBuffPtr != NULL) free(auxBuffPtr); - auxBuffPtr = (char *)Malloc(buffReqd); - auxBuffLen = buffReqd; - if(auxBuffPtr == NULL) - goto ErrorReturn; - } - buffPtr = auxBuffPtr; - buffLen = auxBuffLen; - } - } - /* - * This giant switch statement requires the following variables - * to be set up: op, sizeModifier, arg, buffPtr, fmtBuff. - * When fastPath == FALSE and op == 's' or 'f', the argument - * has been read into charPtrArg, doubleArg, or lDoubleArg. - * The statement produces the boolean performedOp, TRUE iff - * the op/sizeModifier were executed and argument consumed; - * if performedOp, the characters written into buffPtr[] - * and the character count buffCount (== EOF meaning error). - * - * The switch cases are arranged in the same order as in the - * description of fprintf in section 15.11 of Harbison and Steele. - */ - performedOp = TRUE; - switch(op) { - case 'd': - case 'i': - switch(sizeModifier) { - case ' ': - intArg = va_arg(arg, int); - sprintf(buffPtr, fmtBuff, intArg); - buffCount = strlen(buffPtr); - break; - case 'l': - longArg = va_arg(arg, long); - sprintf(buffPtr, fmtBuff, longArg); - buffCount = strlen(buffPtr); - break; - case 'h': - shortArg = (short) va_arg(arg, int); - sprintf(buffPtr, fmtBuff, shortArg); - buffCount = strlen(buffPtr); - break; - default: - goto ErrorReturn; - } - break; - case 'u': - case 'o': - case 'x': - case 'X': - switch(sizeModifier) { - case ' ': - unsignedArg = va_arg(arg, unsigned); - sprintf(buffPtr, fmtBuff, unsignedArg); - buffCount = strlen(buffPtr); - break; - case 'l': - uLongArg = va_arg(arg, unsigned long); - sprintf(buffPtr, fmtBuff, uLongArg); - buffCount = strlen(buffPtr); - break; - case 'h': - uShortArg = (unsigned short) va_arg(arg, int); - sprintf(buffPtr, fmtBuff, uShortArg); - buffCount = strlen(buffPtr); - break; - default: - goto ErrorReturn; - } - break; - case 'c': - switch(sizeModifier) { - case ' ': - intArg = va_arg(arg, int); - sprintf(buffPtr, fmtBuff, intArg); - buffCount = strlen(buffPtr); - break; - case 'l': - /* - * XXX: Allowed by ISO C Amendment 1, but - * many platforms don't yet support wint_t - */ - goto ErrorReturn; - default: - goto ErrorReturn; - } - break; - case 's': - switch(sizeModifier) { - case ' ': - if(fastPath) { - buffPtr = va_arg(arg, char *); - buffCount = strlen(buffPtr); - buffLen = buffCount + 1; - } else { - sprintf(buffPtr, fmtBuff, charPtrArg); - buffCount = strlen(buffPtr); - } - break; - case 'l': - /* - * XXX: Don't know how to convert a sequence - * of wide characters into a byte stream, or - * even how to predict the buffering required. - */ - goto ErrorReturn; - default: - goto ErrorReturn; - } - break; - case 'p': - if(sizeModifier != ' ') - goto ErrorReturn; - voidPtrArg = va_arg(arg, void *); - sprintf(buffPtr, fmtBuff, voidPtrArg); - buffCount = strlen(buffPtr); - break; - case 'n': - switch(sizeModifier) { - case ' ': - intPtrArg = va_arg(arg, int *); - *intPtrArg = streamCount; - break; - case 'l': - longPtrArg = va_arg(arg, long *); - *longPtrArg = streamCount; - break; - case 'h': - shortPtrArg = (short *) va_arg(arg, short *); - *shortPtrArg = (short) streamCount; - break; - default: - goto ErrorReturn; - } - buffCount = 0; - break; - case 'f': - if(fastPath) { - performedOp = FALSE; - break; - } - switch(sizeModifier) { - case ' ': - sprintf(buffPtr, fmtBuff, doubleArg); - buffCount = strlen(buffPtr); - break; - case 'L': - sprintf(buffPtr, fmtBuff, lDoubleArg); - buffCount = strlen(buffPtr); - break; - default: - goto ErrorReturn; - } - break; - case 'e': - case 'E': - case 'g': - case 'G': - switch(sizeModifier) { - case ' ': - doubleArg = va_arg(arg, double); - sprintf(buffPtr, fmtBuff, doubleArg); - buffCount = strlen(buffPtr); - break; - case 'L': - lDoubleArg = va_arg(arg, LONG_DOUBLE); - sprintf(buffPtr, fmtBuff, lDoubleArg); - buffCount = strlen(buffPtr); - break; - default: - goto ErrorReturn; - } - break; - case '%': - if(sizeModifier != ' ') - goto ErrorReturn; - buff[0] = '%'; - buffCount = 1; - break; - case '\0': - goto ErrorReturn; - default: - performedOp = FALSE; - break; - } /* switch(op) */ - if(performedOp) break; - if(!fastPath) - goto ErrorReturn; - fastPath = FALSE; - } /* for (;;) */ - ASSERT(buffCount < buffLen); - if(buffCount > 0) { - if(FCGX_PutStr(buffPtr, buffCount, stream) < 0) - goto ErrorReturn; - streamCount += buffCount; - } else if(buffCount < 0) { - goto ErrorReturn; - } - f += specifierLength; - } /* while(f != fStop) */ - goto NormalReturn; - ErrorReturn: - streamCount = -1; - NormalReturn: - if(auxBuffPtr != NULL) free(auxBuffPtr); - return streamCount; -} - -/* - * Copy n characters from *srcPtr to *destPtr, then increment - * both *srcPtr and *destPtr by n. - */ -static void CopyAndAdvance(char **destPtr, char **srcPtr, int n) -{ - char *dest = *destPtr; - char *src = *srcPtr; - int i; - for (i = 0; i < n; i++) - *dest++ = *src++; - *destPtr = dest; - *srcPtr = src; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_FFlush -- - * - * Flushes any buffered output. - * - * Server-push is a legitimate application of FCGX_FFlush. - * Otherwise, FCGX_FFlush is not very useful, since FCGX_Accept - * does it implicitly. FCGX_FFlush may reduce performance - * by increasing the total number of operating system calls - * the application makes. - * - * Results: - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -int FCGX_FFlush(FCGX_Stream *stream) -{ - if(stream->isClosed || stream->isReader) - return 0; - stream->emptyBuffProc(stream, FALSE); - return (stream->isClosed) ? -1 : 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_FClose -- - * - * Performs FCGX_FFlush and closes the stream. - * - * This is not a very useful operation, since FCGX_Accept - * does it implicitly. Closing the out stream before the - * err stream results in an extra write if there's nothing - * in the err stream, and therefore reduces performance. - * - * Results: - * EOF (-1) if an error occurred. - * - *---------------------------------------------------------------------- - */ -int FCGX_FClose(FCGX_Stream *stream) -{ - if (stream == NULL) return 0; - - if(!stream->wasFCloseCalled) { - if(!stream->isReader) { - stream->emptyBuffProc(stream, TRUE); - } - stream->wasFCloseCalled = TRUE; - stream->isClosed = TRUE; - if(stream->isReader) { - stream->wrNext = stream->stop = stream->rdNext; - } else { - stream->rdNext = stream->stop = stream->wrNext; - } - } - return (stream->FCGI_errno == 0) ? 0 : EOF; -} - -/* - *---------------------------------------------------------------------- - * - * SetError -- - * - * An error has occurred; save the error code in the stream - * for diagnostic purposes and set the stream state so that - * reads return EOF and writes have no effect. - * - *---------------------------------------------------------------------- - */ -static void SetError(FCGX_Stream *stream, int FCGI_errno) -{ - /* - * Preserve only the first error. - */ - if(stream->FCGI_errno == 0) { - stream->FCGI_errno = FCGI_errno; - } - - stream->isClosed = TRUE; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetError -- - * - * Return the stream error code. 0 means no error, > 0 - * is an errno(2) error, < 0 is an FCGX_errno error. - * - *---------------------------------------------------------------------- - */ -int FCGX_GetError(FCGX_Stream *stream) { - return stream->FCGI_errno; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_ClearError -- - * - * Clear the stream error code and end-of-file indication. - * - *---------------------------------------------------------------------- - */ -void FCGX_ClearError(FCGX_Stream *stream) { - stream->FCGI_errno = 0; - /* - * stream->isClosed = FALSE; - * XXX: should clear isClosed but work is needed to make it safe - * to do so. For example, if an application calls FClose, gets - * an I/O error on the write, calls ClearError and retries - * the FClose, FClose (really EmptyBuffProc) will write a second - * EOF record. If an application calls PutChar instead of FClose - * after the ClearError, the application will write more data. - * The stream's state must discriminate between various states - * of the stream that are now all lumped under isClosed. - */ -} - -/* - *====================================================================== - * Parameters - *====================================================================== - */ - -/* - * A vector of pointers representing the parameters received - * by a FastCGI application server, with the vector's length - * and last valid element so adding new parameters is efficient. - */ - -typedef struct Params { - FCGX_ParamArray vec; /* vector of strings */ - int length; /* number of string vec can hold */ - char **cur; /* current item in vec; *cur == NULL */ -} Params; -typedef Params *ParamsPtr; - -/* - *---------------------------------------------------------------------- - * - * NewParams -- - * - * Creates a new Params structure. - * - * Results: - * Pointer to the new structure. - * - *---------------------------------------------------------------------- - */ -static ParamsPtr NewParams(int length) -{ - ParamsPtr result; - result = (Params *)Malloc(sizeof(Params)); - result->vec = (char **)Malloc(length * sizeof(char *)); - result->length = length; - result->cur = result->vec; - *result->cur = NULL; - return result; -} - -/* - *---------------------------------------------------------------------- - * - * FreeParams -- - * - * Frees a Params structure and all the parameters it contains. - * - * Side effects: - * env becomes invalid. - * - *---------------------------------------------------------------------- - */ -static void FreeParams(ParamsPtr *paramsPtrPtr) -{ - ParamsPtr paramsPtr = *paramsPtrPtr; - char **p; - if(paramsPtr == NULL) { - return; - } - for (p = paramsPtr->vec; p < paramsPtr->cur; p++) { - free(*p); - } - free(paramsPtr->vec); - free(paramsPtr); - *paramsPtrPtr = NULL; -} - -/* - *---------------------------------------------------------------------- - * - * PutParam -- - * - * Add a name/value pair to a Params structure. - * - * Results: - * None. - * - * Side effects: - * Parameters structure updated. - * - *---------------------------------------------------------------------- - */ -static void PutParam(ParamsPtr paramsPtr, char *nameValue) -{ - int size; - - *paramsPtr->cur++ = nameValue; - size = paramsPtr->cur - paramsPtr->vec; - if(size >= paramsPtr->length) { - paramsPtr->length *= 2; - paramsPtr->vec = (FCGX_ParamArray)realloc(paramsPtr->vec, paramsPtr->length * sizeof(char *)); - paramsPtr->cur = paramsPtr->vec + size; - } - *paramsPtr->cur = NULL; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_GetParam -- obtain value of FCGI parameter in environment - * - * - * Results: - * Value bound to name, NULL if name not present in the - * environment envp. Caller must not mutate the result - * or retain it past the end of this request. - * - *---------------------------------------------------------------------- - */ -char *FCGX_GetParam(const char *name, FCGX_ParamArray envp) -{ - int len; - char **p; - - if (name == NULL || envp == NULL) return NULL; - - len = strlen(name); - - for (p = envp; *p; ++p) { - if((strncmp(name, *p, len) == 0) && ((*p)[len] == '=')) { - return *p+len+1; - } - } - return NULL; -} - -/* - *---------------------------------------------------------------------- - * - * Start of FastCGI-specific code - * - *---------------------------------------------------------------------- - */ - -/* - *---------------------------------------------------------------------- - * - * ReadParams -- - * - * Reads FastCGI name-value pairs from stream until EOF. Converts - * each pair to name=value format and adds it to Params structure. - * - *---------------------------------------------------------------------- - */ -static int ReadParams(Params *paramsPtr, FCGX_Stream *stream) -{ - int nameLen, valueLen; - unsigned char lenBuff[3]; - char *nameValue; - - while((nameLen = FCGX_GetChar(stream)) != EOF) { - /* - * Read name length (one or four bytes) and value length - * (one or four bytes) from stream. - */ - if((nameLen & 0x80) != 0) { - if(FCGX_GetStr((char *) &lenBuff[0], 3, stream) != 3) { - SetError(stream, FCGX_PARAMS_ERROR); - return -1; - } - nameLen = ((nameLen & 0x7f) << 24) + (lenBuff[0] << 16) - + (lenBuff[1] << 8) + lenBuff[2]; - } - if((valueLen = FCGX_GetChar(stream)) == EOF) { - SetError(stream, FCGX_PARAMS_ERROR); - return -1; - } - if((valueLen & 0x80) != 0) { - if(FCGX_GetStr((char *) &lenBuff[0], 3, stream) != 3) { - SetError(stream, FCGX_PARAMS_ERROR); - return -1; - } - valueLen = ((valueLen & 0x7f) << 24) + (lenBuff[0] << 16) - + (lenBuff[1] << 8) + lenBuff[2]; - } - /* - * nameLen and valueLen are now valid; read the name and value - * from stream and construct a standard environment entry. - */ - nameValue = (char *)Malloc(nameLen + valueLen + 2); - if(FCGX_GetStr(nameValue, nameLen, stream) != nameLen) { - SetError(stream, FCGX_PARAMS_ERROR); - free(nameValue); - return -1; - } - *(nameValue + nameLen) = '='; - if(FCGX_GetStr(nameValue + nameLen + 1, valueLen, stream) - != valueLen) { - SetError(stream, FCGX_PARAMS_ERROR); - free(nameValue); - return -1; - } - *(nameValue + nameLen + valueLen + 1) = '\0'; - PutParam(paramsPtr, nameValue); - } - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * MakeHeader -- - * - * Constructs an FCGI_Header struct. - * - *---------------------------------------------------------------------- - */ -static FCGI_Header MakeHeader( - int type, - int requestId, - int contentLength, - int paddingLength) -{ - FCGI_Header header; - ASSERT(contentLength >= 0 && contentLength <= FCGI_MAX_LENGTH); - ASSERT(paddingLength >= 0 && paddingLength <= 0xff); - header.version = FCGI_VERSION_1; - header.type = (unsigned char) type; - header.requestIdB1 = (unsigned char) ((requestId >> 8) & 0xff); - header.requestIdB0 = (unsigned char) ((requestId ) & 0xff); - header.contentLengthB1 = (unsigned char) ((contentLength >> 8) & 0xff); - header.contentLengthB0 = (unsigned char) ((contentLength ) & 0xff); - header.paddingLength = (unsigned char) paddingLength; - header.reserved = 0; - return header; -} - -/* - *---------------------------------------------------------------------- - * - * MakeEndRequestBody -- - * - * Constructs an FCGI_EndRequestBody struct. - * - *---------------------------------------------------------------------- - */ -static FCGI_EndRequestBody MakeEndRequestBody( - int appStatus, - int protocolStatus) -{ - FCGI_EndRequestBody body; - body.appStatusB3 = (unsigned char) ((appStatus >> 24) & 0xff); - body.appStatusB2 = (unsigned char) ((appStatus >> 16) & 0xff); - body.appStatusB1 = (unsigned char) ((appStatus >> 8) & 0xff); - body.appStatusB0 = (unsigned char) ((appStatus ) & 0xff); - body.protocolStatus = (unsigned char) protocolStatus; - memset(body.reserved, 0, sizeof(body.reserved)); - return body; -} - -/* - *---------------------------------------------------------------------- - * - * MakeUnknownTypeBody -- - * - * Constructs an FCGI_MakeUnknownTypeBody struct. - * - *---------------------------------------------------------------------- - */ -static FCGI_UnknownTypeBody MakeUnknownTypeBody( - int type) -{ - FCGI_UnknownTypeBody body; - body.type = (unsigned char) type; - memset(body.reserved, 0, sizeof(body.reserved)); - return body; -} - -/* - *---------------------------------------------------------------------- - * - * AlignInt8 -- - * - * Returns the smallest integer greater than or equal to n - * that's a multiple of 8. - * - *---------------------------------------------------------------------- - */ -static int AlignInt8(unsigned n) { - return (n + 7) & (UINT_MAX - 7); -} - -/* - *---------------------------------------------------------------------- - * - * AlignPtr8 -- - * - * Returns the smallest pointer greater than or equal to p - * that's a multiple of 8. - * - *---------------------------------------------------------------------- - */ -static unsigned char *AlignPtr8(unsigned char *p) { - unsigned long u = (unsigned long) p; - u = ((u + 7) & (ULONG_MAX - 7)) - u; - return p + u; -} - - -/* - * State associated with a stream - */ -typedef struct FCGX_Stream_Data { - unsigned char *buff; /* buffer after alignment */ - int bufflen; /* number of bytes buff can store */ - unsigned char *mBuff; /* buffer as returned by Malloc */ - unsigned char *buffStop; /* reader: last valid byte + 1 of entire buffer. - * stop generally differs from buffStop for - * readers because of record structure. - * writer: buff + bufflen */ - int type; /* reader: FCGI_PARAMS or FCGI_STDIN - * writer: FCGI_STDOUT or FCGI_STDERR */ - int eorStop; /* reader: stop stream at end-of-record */ - int skip; /* reader: don't deliver content bytes */ - int contentLen; /* reader: bytes of unread content */ - int paddingLen; /* reader: bytes of unread padding */ - int isAnythingWritten; /* writer: data has been written to ipcFd */ - int rawWrite; /* writer: write data without stream headers */ - FCGX_Request *reqDataPtr; /* request data not specific to one stream */ -} FCGX_Stream_Data; - -/* - *---------------------------------------------------------------------- - * - * WriteCloseRecords -- - * - * Writes an EOF record for the stream content if necessary. - * If this is the last writer to close, writes an FCGI_END_REQUEST - * record. - * - *---------------------------------------------------------------------- - */ -static void WriteCloseRecords(struct FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - /* - * Enter rawWrite mode so final records won't be encapsulated as - * stream data. - */ - data->rawWrite = TRUE; - /* - * Generate EOF for stream content if needed. - */ - if(!(data->type == FCGI_STDERR - && stream->wrNext == data->buff - && !data->isAnythingWritten)) { - FCGI_Header header; - header = MakeHeader(data->type, data->reqDataPtr->requestId, 0, 0); - FCGX_PutStr((char *) &header, sizeof(header), stream); - }; - /* - * Generate FCGI_END_REQUEST record if needed. - */ - if(data->reqDataPtr->nWriters == 1) { - FCGI_EndRequestRecord endRequestRecord; - endRequestRecord.header = MakeHeader(FCGI_END_REQUEST, - data->reqDataPtr->requestId, - sizeof(endRequestRecord.body), 0); - endRequestRecord.body = MakeEndRequestBody( - data->reqDataPtr->appStatus, FCGI_REQUEST_COMPLETE); - FCGX_PutStr((char *) &endRequestRecord, - sizeof(endRequestRecord), stream); - } - data->reqDataPtr->nWriters--; -} - - - -static int write_it_all(int fd, char *buf, int len) -{ - int wrote; - - while (len) { - wrote = OS_Write(fd, buf, len); - if (wrote < 0) - return wrote; - len -= wrote; - buf += wrote; - } - return len; -} - -/* - *---------------------------------------------------------------------- - * - * EmptyBuffProc -- - * - * Encapsulates any buffered stream content in a FastCGI - * record. Writes the data, making the buffer empty. - * - *---------------------------------------------------------------------- - */ -static void EmptyBuffProc(struct FCGX_Stream *stream, int doClose) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - int cLen, eLen; - /* - * If the buffer contains stream data, fill in the header. - * Pad the record to a multiple of 8 bytes in length. Padding - * can't overflow the buffer because the buffer is a multiple - * of 8 bytes in length. If the buffer contains no stream - * data, reclaim the space reserved for the header. - */ - if(!data->rawWrite) { - cLen = stream->wrNext - data->buff - sizeof(FCGI_Header); - if(cLen > 0) { - eLen = AlignInt8(cLen); - /* - * Giving the padding a well-defined value keeps Purify happy. - */ - memset(stream->wrNext, 0, eLen - cLen); - stream->wrNext += eLen - cLen; - *((FCGI_Header *) data->buff) - = MakeHeader(data->type, - data->reqDataPtr->requestId, cLen, eLen - cLen); - } else { - stream->wrNext = data->buff; - } - } - if(doClose) { - WriteCloseRecords(stream); - }; - if (stream->wrNext != data->buff) { - data->isAnythingWritten = TRUE; - if (write_it_all(data->reqDataPtr->ipcFd, (char *)data->buff, stream->wrNext - data->buff) < 0) { - SetError(stream, OS_Errno); - return; - } - stream->wrNext = data->buff; - } - /* - * The buffer is empty. - */ - if(!data->rawWrite) { - stream->wrNext += sizeof(FCGI_Header); - } -} - -/* - * Return codes for Process* functions - */ -#define STREAM_RECORD 0 -#define SKIP 1 -#define BEGIN_RECORD 2 -#define MGMT_RECORD 3 - -/* - *---------------------------------------------------------------------- - * - * ProcessManagementRecord -- - * - * Reads and responds to a management record. The only type of - * management record this library understands is FCGI_GET_VALUES. - * The only variables that this library's FCGI_GET_VALUES - * understands are FCGI_MAX_CONNS, FCGI_MAX_REQS, and FCGI_MPXS_CONNS. - * Ignore other FCGI_GET_VALUES variables; respond to other - * management records with a FCGI_UNKNOWN_TYPE record. - * - *---------------------------------------------------------------------- - */ -static int ProcessManagementRecord(int type, FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - ParamsPtr paramsPtr = NewParams(3); - char **pPtr; - char response[64]; /* 64 = 8 + 3*(1+1+14+1)* + padding */ - char *responseP = &response[FCGI_HEADER_LEN]; - char *name, value = '\0'; - int len, paddedLen; - if(type == FCGI_GET_VALUES) { - ReadParams(paramsPtr, stream); - if((FCGX_GetError(stream) != 0) || (data->contentLen != 0)) { - FreeParams(¶msPtr); - return FCGX_PROTOCOL_ERROR; - } - for (pPtr = paramsPtr->vec; pPtr < paramsPtr->cur; pPtr++) { - name = *pPtr; - *(strchr(name, '=')) = '\0'; - if(strcmp(name, FCGI_MAX_CONNS) == 0) { - value = '1'; - } else if(strcmp(name, FCGI_MAX_REQS) == 0) { - value = '1'; - } else if(strcmp(name, FCGI_MPXS_CONNS) == 0) { - value = '0'; - } else { - name = NULL; - } - if(name != NULL) { - len = strlen(name); - sprintf(responseP, "%c%c%s%c", len, 1, name, value); - responseP += len + 3; - } - } - len = responseP - &response[FCGI_HEADER_LEN]; - paddedLen = AlignInt8(len); - *((FCGI_Header *) response) - = MakeHeader(FCGI_GET_VALUES_RESULT, FCGI_NULL_REQUEST_ID, - len, paddedLen - len); - FreeParams(¶msPtr); - } else { - paddedLen = len = sizeof(FCGI_UnknownTypeBody); - ((FCGI_UnknownTypeRecord *) response)->header - = MakeHeader(FCGI_UNKNOWN_TYPE, FCGI_NULL_REQUEST_ID, - len, 0); - ((FCGI_UnknownTypeRecord *) response)->body - = MakeUnknownTypeBody(type); - } - if (write_it_all(data->reqDataPtr->ipcFd, response, FCGI_HEADER_LEN + paddedLen) < 0) { - SetError(stream, OS_Errno); - return -1; - } - - return MGMT_RECORD; -} - -/* - *---------------------------------------------------------------------- - * - * ProcessBeginRecord -- - * - * Reads an FCGI_BEGIN_REQUEST record. - * - * Results: - * BEGIN_RECORD for normal return. FCGX_PROTOCOL_ERROR for - * protocol error. SKIP for attempt to multiplex - * connection. -1 for error from write (errno in stream). - * - * Side effects: - * In case of BEGIN_RECORD return, stores requestId, role, - * keepConnection values, and sets isBeginProcessed = TRUE. - * - *---------------------------------------------------------------------- - */ -static int ProcessBeginRecord(int requestId, FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - FCGI_BeginRequestBody body; - if(requestId == 0 || data->contentLen != sizeof(body)) { - return FCGX_PROTOCOL_ERROR; - } - if(data->reqDataPtr->isBeginProcessed) { - /* - * The Web server is multiplexing the connection. This library - * doesn't know how to handle multiplexing, so respond with - * FCGI_END_REQUEST{protocolStatus = FCGI_CANT_MPX_CONN} - */ - FCGI_EndRequestRecord endRequestRecord; - endRequestRecord.header = MakeHeader(FCGI_END_REQUEST, - requestId, sizeof(endRequestRecord.body), 0); - endRequestRecord.body - = MakeEndRequestBody(0, FCGI_CANT_MPX_CONN); - if (write_it_all(data->reqDataPtr->ipcFd, (char *)&endRequestRecord, sizeof(endRequestRecord)) < 0) { - SetError(stream, OS_Errno); - return -1; - } - - return SKIP; - } - /* - * Accept this new request. Read the record body. - */ - data->reqDataPtr->requestId = requestId; - if(FCGX_GetStr((char *) &body, sizeof(body), stream) - != sizeof(body)) { - return FCGX_PROTOCOL_ERROR; - } - data->reqDataPtr->keepConnection = (body.flags & FCGI_KEEP_CONN); - data->reqDataPtr->role = (body.roleB1 << 8) + body.roleB0; - data->reqDataPtr->isBeginProcessed = TRUE; - return BEGIN_RECORD; -} - -/* - *---------------------------------------------------------------------- - * - * ProcessHeader -- - * - * Interprets FCGI_Header. Processes FCGI_BEGIN_REQUEST and - * management records here; extracts information from stream - * records (FCGI_PARAMS, FCGI_STDIN) into stream. - * - * Results: - * >= 0 for a normal return, < 0 for error - * - * Side effects: - * XXX: Many (more than there used to be). - * If !stream->isRequestIdSet, ProcessHeader initializes - * stream->requestId from header and sets stream->isRequestIdSet - * to TRUE. ProcessHeader also sets stream->contentLen to header's - * contentLength, and sets stream->paddingLen to the header's - * paddingLength. - * - *---------------------------------------------------------------------- - */ -static int ProcessHeader(FCGI_Header header, FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - int requestId; - if(header.version != FCGI_VERSION_1) { - return FCGX_UNSUPPORTED_VERSION; - } - requestId = (header.requestIdB1 << 8) - + header.requestIdB0; - data->contentLen = (header.contentLengthB1 << 8) - + header.contentLengthB0; - data->paddingLen = header.paddingLength; - if(header.type == FCGI_BEGIN_REQUEST) { - return ProcessBeginRecord(requestId, stream); - } - if(requestId == FCGI_NULL_REQUEST_ID) { - return ProcessManagementRecord(header.type, stream); - } - if(requestId != data->reqDataPtr->requestId) { - return SKIP; - } - if(header.type != data->type) { - return FCGX_PROTOCOL_ERROR; - } - return STREAM_RECORD; -} - -/* - *---------------------------------------------------------------------- - * - * FillBuffProc -- - * - * Reads bytes from the ipcFd, supplies bytes to a stream client. - * - *---------------------------------------------------------------------- - */ -static void FillBuffProc(FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - FCGI_Header header; - int headerLen = 0; - int status, count; - - for (;;) { - /* - * If data->buff is empty, do a read. - */ - if(stream->rdNext == data->buffStop) { - count = OS_Read(data->reqDataPtr->ipcFd, (char *)data->buff, - data->bufflen); - if(count <= 0) { - SetError(stream, (count == 0 ? FCGX_PROTOCOL_ERROR : OS_Errno)); - return; - } - stream->rdNext = data->buff; - data->buffStop = data->buff + count; - } - /* - * Now data->buff is not empty. If the current record contains - * more content bytes, deliver all that are present in data->buff. - */ - if(data->contentLen > 0) { - count = min(data->contentLen, data->buffStop - stream->rdNext); - data->contentLen -= count; - if(!data->skip) { - stream->wrNext = stream->stop = stream->rdNext + count; - return; - } else { - stream->rdNext += count; - if(data->contentLen > 0) { - continue; - } else { - data->skip = FALSE; - } - } - } - /* - * If the current record (whose content has been fully consumed by - * the client) was padded, skip over the padding bytes. - */ - if(data->paddingLen > 0) { - count = min(data->paddingLen, data->buffStop - stream->rdNext); - data->paddingLen -= count; - stream->rdNext += count; - if(data->paddingLen > 0) { - continue; - } - } - /* - * All done with the current record, including the padding. - * If we're in a recursive call from ProcessHeader, deliver EOF. - */ - if(data->eorStop) { - stream->stop = stream->rdNext; - stream->isClosed = TRUE; - return; - } - /* - * Fill header with bytes from the input buffer. - */ - count = min((int)sizeof(header) - headerLen, - data->buffStop - stream->rdNext); - memcpy(((char *)(&header)) + headerLen, stream->rdNext, count); - headerLen += count; - stream->rdNext += count; - if(headerLen < sizeof(header)) { - continue; - }; - headerLen = 0; - /* - * Interpret header. eorStop prevents ProcessHeader from reading - * past the end-of-record when using stream to read content. - */ - data->eorStop = TRUE; - stream->stop = stream->rdNext; - status = ProcessHeader(header, stream); - data->eorStop = FALSE; - stream->isClosed = FALSE; - switch(status) { - case STREAM_RECORD: - /* - * If this stream record header marked the end of stream - * data deliver EOF to the stream client, otherwise loop - * and deliver data. - * - * XXX: If this is final stream and - * stream->rdNext != data->buffStop, buffered - * data is next request (server pipelining)? - */ - if(data->contentLen == 0) { - stream->wrNext = stream->stop = stream->rdNext; - stream->isClosed = TRUE; - return; - } - break; - case SKIP: - data->skip = TRUE; - break; - case BEGIN_RECORD: - /* - * If this header marked the beginning of a new - * request, return role information to caller. - */ - return; - break; - case MGMT_RECORD: - break; - default: - ASSERT(status < 0); - SetError(stream, status); - return; - break; - } - } -} - -/* - *---------------------------------------------------------------------- - * - * NewStream -- - * - * Creates a stream to read or write from an open ipcFd. - * The stream performs reads/writes of up to bufflen bytes. - * - *---------------------------------------------------------------------- - */ -static FCGX_Stream *NewStream( - FCGX_Request *reqDataPtr, int bufflen, int isReader, int streamType) -{ - /* - * XXX: It would be a lot cleaner to have a NewStream that only - * knows about the type FCGX_Stream, with all other - * necessary data passed in. It appears that not just - * data and the two procs are needed for initializing stream, - * but also data->buff and data->buffStop. This has implications - * for procs that want to swap buffers, too. - */ - FCGX_Stream *stream = (FCGX_Stream *)Malloc(sizeof(FCGX_Stream)); - FCGX_Stream_Data *data = (FCGX_Stream_Data *)Malloc(sizeof(FCGX_Stream_Data)); - data->reqDataPtr = reqDataPtr; - bufflen = AlignInt8(min(max(bufflen, 32), FCGI_MAX_LENGTH + 1)); - data->bufflen = bufflen; - data->mBuff = (unsigned char *)Malloc(bufflen); - data->buff = AlignPtr8(data->mBuff); - if(data->buff != data->mBuff) { - data->bufflen -= 8; - } - if(isReader) { - data->buffStop = data->buff; - } else { - data->buffStop = data->buff + data->bufflen; - } - data->type = streamType; - data->eorStop = FALSE; - data->skip = FALSE; - data->contentLen = 0; - data->paddingLen = 0; - data->isAnythingWritten = FALSE; - data->rawWrite = FALSE; - - stream->data = data; - stream->isReader = isReader; - stream->isClosed = FALSE; - stream->wasFCloseCalled = FALSE; - stream->FCGI_errno = 0; - if(isReader) { - stream->fillBuffProc = FillBuffProc; - stream->emptyBuffProc = NULL; - stream->rdNext = data->buff; - stream->stop = stream->rdNext; - stream->stopUnget = data->buff; - stream->wrNext = stream->stop; - } else { - stream->fillBuffProc = NULL; - stream->emptyBuffProc = EmptyBuffProc; - stream->wrNext = data->buff + sizeof(FCGI_Header); - stream->stop = data->buffStop; - stream->stopUnget = NULL; - stream->rdNext = stream->stop; - } - return stream; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_FreeStream -- - * - * Frees all storage allocated when *streamPtr was created, - * and nulls out *streamPtr. - * - *---------------------------------------------------------------------- - */ -void FCGX_FreeStream(FCGX_Stream **streamPtr) -{ - FCGX_Stream *stream = *streamPtr; - FCGX_Stream_Data *data; - if(stream == NULL) { - return; - } - data = (FCGX_Stream_Data *)stream->data; - data->reqDataPtr = NULL; - free(data->mBuff); - free(data); - free(stream); - *streamPtr = NULL; -} - -/* - *---------------------------------------------------------------------- - * - * SetReaderType -- - * - * Re-initializes the stream to read data of the specified type. - * - *---------------------------------------------------------------------- - */ -static FCGX_Stream *SetReaderType(FCGX_Stream *stream, int streamType) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - ASSERT(stream->isReader); - data->type = streamType; - data->eorStop = FALSE; - data->skip = FALSE; - data->contentLen = 0; - data->paddingLen = 0; - stream->wrNext = stream->stop = stream->rdNext; - stream->isClosed = FALSE; - return stream; -} - -/* - *---------------------------------------------------------------------- - * - * NewReader -- - * - * Creates a stream to read streamType records for the given - * request. The stream performs OS reads of up to bufflen bytes. - * - *---------------------------------------------------------------------- - */ -static FCGX_Stream *NewReader(FCGX_Request *reqDataPtr, int bufflen, int streamType) -{ - return NewStream(reqDataPtr, bufflen, TRUE, streamType); -} - -/* - *---------------------------------------------------------------------- - * - * NewWriter -- - * - * Creates a stream to write streamType FastCGI records, using - * the ipcFd and RequestId contained in *reqDataPtr. - * The stream performs OS writes of up to bufflen bytes. - * - *---------------------------------------------------------------------- - */ -static FCGX_Stream *NewWriter(FCGX_Request *reqDataPtr, int bufflen, int streamType) -{ - return NewStream(reqDataPtr, bufflen, FALSE, streamType); -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_CreateWriter -- - * - * Creates a stream to write streamType FastCGI records, using - * the given ipcFd and request Id. This function is provided - * for use by cgi-fcgi. In order to be defensive against misuse, - * this function leaks a little storage; cgi-fcgi doesn't care. - * - *---------------------------------------------------------------------- - */ -FCGX_Stream *FCGX_CreateWriter( - int ipcFd, - int requestId, - int bufflen, - int streamType) -{ - FCGX_Request *reqDataPtr = (FCGX_Request *)Malloc(sizeof(FCGX_Request)); - reqDataPtr->ipcFd = ipcFd; - reqDataPtr->requestId = requestId; - /* - * Suppress writing an FCGI_END_REQUEST record. - */ - reqDataPtr->nWriters = 2; - return NewWriter(reqDataPtr, bufflen, streamType); -} - -/* - *====================================================================== - * Control - *====================================================================== - */ - -/* - *---------------------------------------------------------------------- - * - * FCGX_IsCGI -- - * - * This routine determines if the process is running as a CGI or - * FastCGI process. The distinction is made by determining whether - * FCGI_LISTENSOCK_FILENO is a listener ipcFd or the end of a - * pipe (ie. standard in). - * - * Results: - * TRUE if the process is a CGI process, FALSE if FastCGI. - * - *---------------------------------------------------------------------- - */ -int FCGX_IsCGI(void) -{ - if (isFastCGI != -1) { - return !isFastCGI; - } - - if (!libInitialized) { - int rc = FCGX_Init(); - if (rc) { - /* exit() isn't great, but hey */ - exit((rc < 0) ? rc : -rc); - } - } - - isFastCGI = OS_IsFcgi(FCGI_LISTENSOCK_FILENO); - - return !isFastCGI; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_Finish -- - * - * Finishes the current request from the HTTP server. - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ - -void FCGX_Finish(void) -{ - FCGX_Finish_r(&the_request); -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_Finish_r -- - * - * Finishes the current request from the HTTP server. - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ -void FCGX_Finish_r(FCGX_Request *reqDataPtr) -{ - int close; - - if (reqDataPtr == NULL) { - return; - } - - close = !reqDataPtr->keepConnection; - - /* This should probably use a 'status' member instead of 'in' */ - if (reqDataPtr->in) { - close |= FCGX_FClose(reqDataPtr->err); - close |= FCGX_FClose(reqDataPtr->out); - - close |= FCGX_GetError(reqDataPtr->in); - } - - FCGX_Free(reqDataPtr, close); -} - -void FCGX_Free(FCGX_Request * request, int close) -{ - if (request == NULL) - return; - - FCGX_FreeStream(&request->in); - FCGX_FreeStream(&request->out); - FCGX_FreeStream(&request->err); - FreeParams(&request->paramsPtr); - - if (close) { - OS_IpcClose(request->ipcFd); - request->ipcFd = -1; - } -} - -int FCGX_OpenSocket(const char *path, int backlog) -{ - int rc = OS_CreateLocalIpcFd(path, backlog); - if (rc == FCGI_LISTENSOCK_FILENO && isFastCGI == 0) { - /* XXX probably need to call OS_LibInit() again for Win */ - isFastCGI = 1; - } - return rc; -} - -int FCGX_InitRequest(FCGX_Request *request, int sock, int flags) -{ - memset(request, 0, sizeof(FCGX_Request)); - - /* @@@ Should check that sock is open and listening */ - request->listen_sock = sock; - - /* @@@ Should validate against "known" flags */ - request->flags = flags; - - request->ipcFd = -1; - - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_Init -- - * - * Initilize the FCGX library. This is called by FCGX_Accept() - * but must be called by the user when using FCGX_Accept_r(). - * - * Results: - * 0 for successful call. - * - *---------------------------------------------------------------------- - */ -int FCGX_Init(void) -{ - char *p; - - if (libInitialized) { - return 0; - } - - FCGX_InitRequest(&the_request, FCGI_LISTENSOCK_FILENO, 0); - - if (OS_LibInit(NULL) == -1) { - return OS_Errno ? OS_Errno : -9997; - } - - p = getenv("FCGI_WEB_SERVER_ADDRS"); - webServerAddressList = p ? StringCopy(p) : NULL; - - libInitialized = 1; - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_Accept -- - * - * Accepts a new request from the HTTP server. - * - * Results: - * 0 for successful call, -1 for error. - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * Creates input, output, and error streams and - * assigns them to *in, *out, and *err respectively. - * Creates a parameters data structure to be accessed - * via getenv(3) (if assigned to environ) or by FCGX_GetParam - * and assigns it to *envp. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ - -int FCGX_Accept( - FCGX_Stream **in, - FCGX_Stream **out, - FCGX_Stream **err, - FCGX_ParamArray *envp) -{ - int rc; - - if (! libInitialized) { - rc = FCGX_Init(); - if (rc) { - return rc; - } - } - - rc = FCGX_Accept_r(&the_request); - - *in = the_request.in; - *out = the_request.out; - *err = the_request.err; - *envp = the_request.envp; - - return rc; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_Accept_r -- - * - * Accepts a new request from the HTTP server. - * - * Results: - * 0 for successful call, -1 for error. - * - * Side effects: - * - * Finishes the request accepted by (and frees any - * storage allocated by) the previous call to FCGX_Accept. - * Creates input, output, and error streams and - * assigns them to *in, *out, and *err respectively. - * Creates a parameters data structure to be accessed - * via getenv(3) (if assigned to environ) or by FCGX_GetParam - * and assigns it to *envp. - * - * DO NOT retain pointers to the envp array or any strings - * contained in it (e.g. to the result of calling FCGX_GetParam), - * since these will be freed by the next call to FCGX_Finish - * or FCGX_Accept. - * - *---------------------------------------------------------------------- - */ -int FCGX_Accept_r(FCGX_Request *reqDataPtr) -{ - if (!libInitialized) { - return -9998; - } - - /* Finish the current request, if any. */ - FCGX_Finish_r(reqDataPtr); - - for (;;) { - /* - * If a connection isn't open, accept a new connection (blocking). - * If an OS error occurs in accepting the connection, - * return -1 to the caller, who should exit. - */ - if (reqDataPtr->ipcFd < 0) { - int fail_on_intr = reqDataPtr->flags & FCGI_FAIL_ACCEPT_ON_INTR; - - reqDataPtr->ipcFd = OS_Accept(reqDataPtr->listen_sock, fail_on_intr, webServerAddressList); - if (reqDataPtr->ipcFd < 0) { - return (errno > 0) ? (0 - errno) : -9999; - } - } - /* - * A connection is open. Read from the connection in order to - * get the request's role and environment. If protocol or other - * errors occur, close the connection and try again. - */ - reqDataPtr->isBeginProcessed = FALSE; - reqDataPtr->in = NewReader(reqDataPtr, 8192, 0); - FillBuffProc(reqDataPtr->in); - if(!reqDataPtr->isBeginProcessed) { - goto TryAgain; - } - { - char *roleStr; - switch(reqDataPtr->role) { - case FCGI_RESPONDER: - roleStr = "FCGI_ROLE=RESPONDER"; - break; - case FCGI_AUTHORIZER: - roleStr = "FCGI_ROLE=AUTHORIZER"; - break; - case FCGI_FILTER: - roleStr = "FCGI_ROLE=FILTER"; - break; - default: - goto TryAgain; - } - reqDataPtr->paramsPtr = NewParams(30); - PutParam(reqDataPtr->paramsPtr, StringCopy(roleStr)); - } - SetReaderType(reqDataPtr->in, FCGI_PARAMS); - if(ReadParams(reqDataPtr->paramsPtr, reqDataPtr->in) >= 0) { - /* - * Finished reading the environment. No errors occurred, so - * leave the connection-retry loop. - */ - break; - } - - /* - * Close the connection and try again. - */ -TryAgain: - FCGX_Free(reqDataPtr, 1); - - } /* for (;;) */ - /* - * Build the remaining data structures representing the new - * request and return successfully to the caller. - */ - SetReaderType(reqDataPtr->in, FCGI_STDIN); - reqDataPtr->out = NewWriter(reqDataPtr, 8192, FCGI_STDOUT); - reqDataPtr->err = NewWriter(reqDataPtr, 512, FCGI_STDERR); - reqDataPtr->nWriters = 2; - reqDataPtr->envp = reqDataPtr->paramsPtr->vec; - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_StartFilterData -- - * - * stream is an input stream for a FCGI_FILTER request. - * stream is positioned at EOF on FCGI_STDIN. - * Repositions stream to the start of FCGI_DATA. - * If the preconditions are not met (e.g. FCGI_STDIN has not - * been read to EOF) sets the stream error code to - * FCGX_CALL_SEQ_ERROR. - * - * Results: - * 0 for a normal return, < 0 for error - * - *---------------------------------------------------------------------- - */ - -int FCGX_StartFilterData(FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - if(data->reqDataPtr->role != FCGI_FILTER - || !stream->isReader - || !stream->isClosed - || data->type != FCGI_STDIN) { - SetError(stream, FCGX_CALL_SEQ_ERROR); - return -1; - } - SetReaderType(stream, FCGI_DATA); - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * FCGX_SetExitStatus -- - * - * Sets the exit status for stream's request. The exit status - * is the status code the request would have exited with, had - * the request been run as a CGI program. You can call - * SetExitStatus several times during a request; the last call - * before the request ends determines the value. - * - *---------------------------------------------------------------------- - */ - -void FCGX_SetExitStatus(int status, FCGX_Stream *stream) -{ - FCGX_Stream_Data *data = (FCGX_Stream_Data *)stream->data; - data->reqDataPtr->appStatus = status; -} - -#pragma warning(pop) diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgio.cpp b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgio.cpp deleted file mode 100644 index 73139c70313..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/fcgio.cpp +++ /dev/null @@ -1,202 +0,0 @@ -// -// $Id: fcgio.cpp,v 1.13 2002/02/24 20:12:22 robs Exp $ -// -// Allows you communicate with FastCGI streams using C++ iostreams -// -// ORIGINAL AUTHOR: George Feinberg -// REWRITTEN BY: Michael Richards 06/20/1999 -// REWRITTEN AGAIN BY: Michael Shell 02/23/2000 -// REWRITTEN AGAIN BY: Rob Saccoccio 11 Nov 2001 -// -// Copyright (c) 2000 Tux the Linux Penguin -// -// You are free to use this software without charge or royalty -// as long as this notice is not removed or altered, and recognition -// is given to the author(s) -// -// This code is offered as-is without any warranty either expressed or -// implied; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. - -#pragma warning(push) -#pragma warning(disable: 4996) -#pragma warning(disable: 4267) -#pragma warning(disable: 4244) - -#ifdef _WIN32 -#define DLLAPI __declspec(dllexport) -#endif - -#include -#include "fcgio.h" - -using std::streambuf; -using std::istream; -using std::ostream; -using std::streamsize; - -fcgi_streambuf::fcgi_streambuf(FCGX_Stream * fs, char * b, int bs) -{ - init(fs, b, bs); -} - -fcgi_streambuf::fcgi_streambuf(char_type * b, streamsize bs) -{ - init(0, b, bs); -} - -fcgi_streambuf::fcgi_streambuf(FCGX_Stream * fs) -{ - init(fs, 0, 0); -} - -fcgi_streambuf::~fcgi_streambuf(void) -{ - overflow(EOF); - // FCGX_Finish()/FCGX_Accept() will flush and close -} - -void fcgi_streambuf::init(FCGX_Stream * fs, char_type * b, streamsize bs) -{ - this->fcgx = fs; - this->buf = 0; - this->bufsize = 0; - setbuf(b, bs); -} - -int fcgi_streambuf::overflow(int c) -{ - if (this->bufsize) - { - int plen = pptr() - pbase(); - - if (plen) - { - if (FCGX_PutStr(pbase(), plen, this->fcgx) != plen) return EOF; - pbump(-plen); - } - } - - if (c != EOF) - { - if (FCGX_PutChar(c, this->fcgx) != c) return EOF; - } - - return 0; -} - -// default base class behaviour seems to be inconsistent -int fcgi_streambuf::sync() -{ - if (overflow(EOF)) return EOF; - if (FCGX_FFlush(this->fcgx)) return EOF; - return 0; -} - -// uflow() removes the char, underflow() doesn't -int fcgi_streambuf::uflow() -{ - int rv = underflow(); - if (this->bufsize) gbump(1); - return rv; -} - -// Note that the expected behaviour when there is no buffer varies -int fcgi_streambuf::underflow() -{ - if (this->bufsize) - { - if (in_avail() == 0) - { - int glen = FCGX_GetStr(eback(), this->bufsize, this->fcgx); - if (glen <= 0) return EOF; - - setg(eback(), eback(), eback() + glen); - } - - return (unsigned char) *gptr(); - } - else - { - return FCGX_GetChar(this->fcgx); - } -} - -void fcgi_streambuf::reset(void) -{ - // it should be ok to set up both the get and put areas - setg(this->buf, this->buf, this->buf); - setp(this->buf, this->buf + this->bufsize); -} - -std::streambuf * fcgi_streambuf::setbuf(char_type * b, streamsize bs) -{ - // XXX support moving data from an old buffer - if (this->bufsize) return 0; - - this->buf = b; - this->bufsize = bs; - - // the base setbuf() *has* to be called - streambuf::setbuf(b, bs); - - reset(); - - return this; -} - -int fcgi_streambuf::attach(FCGX_Stream * fs) -{ - this->fcgx = fs; - - if (this->bufsize) - { - reset(); - } - - return 0; -} - -streamsize fcgi_streambuf::xsgetn(char_type * s, streamsize n) -{ - if (n > INT_MAX) return 0; - return (this->bufsize) - ? streambuf::xsgetn(s, n) - : (streamsize) FCGX_GetStr((char *) s, (int) n, this->fcgx); -} - -streamsize fcgi_streambuf::xsputn(const char_type * s, streamsize n) -{ - if (n > INT_MAX) return 0; - return (this->bufsize) - ? streambuf::xsputn(s, n) - : (streamsize) FCGX_PutStr((char *) s, (int) n, this->fcgx); -} - -// deprecated -fcgi_istream::fcgi_istream(FCGX_Stream * fs) : - istream(&fcgi_strmbuf) -{ - fcgi_strmbuf.attach(fs); -} - -// deprecated -void fcgi_istream::attach(FCGX_Stream * fs) -{ - fcgi_strmbuf.attach(fs); -} - -// deprecated -fcgi_ostream::fcgi_ostream(FCGX_Stream * fs) : - ostream(&fcgi_strmbuf) -{ - fcgi_strmbuf.attach(fs); -} - -// deprecated -void fcgi_ostream::attach(FCGX_Stream * fs) -{ - fcgi_strmbuf.attach(fs); -} - -#pragma warning(pop) \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/libfcgi.mak b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/libfcgi.mak deleted file mode 100644 index 85c751b15d9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/libfcgi.mak +++ /dev/null @@ -1,311 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on libfcgi.dsp - -!IF "$(CFG)" == "" -CFG=release -!ENDIF - -!IF "$(CFG)" != "release" && "$(CFG)" != "debug" -!MESSAGE Invalid configuration "$(CFG)" specified. -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libfcgi.mak" CFG="debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "release" - -OUTDIR=.\..\libfcgi\Release -INTDIR=.\..\libfcgi\Release -# Begin Custom Macros -OutDir=.\..\libfcgi\Release -# End Custom Macros - -ALL : "$(OUTDIR)\libfcgi.dll" - - -CLEAN : - -@erase "$(INTDIR)\fcgi_stdio.obj" - -@erase "$(INTDIR)\fcgiapp.obj" - -@erase "$(INTDIR)\fcgio.obj" - -@erase "$(INTDIR)\os_win32.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\libfcgi.dll" - -@erase "$(OUTDIR)\libfcgi.exp" - -@erase "$(OUTDIR)\libfcgi.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MD /W3 /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\libfcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\libfcgi.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=Ws2_32.lib /nologo /dll /pdb:none /machine:I386 /out:"$(OUTDIR)\libfcgi.dll" /implib:"$(OUTDIR)\libfcgi.lib" -LINK32_OBJS= \ - "$(INTDIR)\fcgi_stdio.obj" \ - "$(INTDIR)\fcgiapp.obj" \ - "$(INTDIR)\fcgio.obj" \ - "$(INTDIR)\os_win32.obj" - -"$(OUTDIR)\libfcgi.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "debug" - -OUTDIR=.\..\libfcgi\Debug -INTDIR=.\..\libfcgi\Debug -# Begin Custom Macros -OutDir=.\..\libfcgi\Debug -# End Custom Macros - -ALL : "$(OUTDIR)\libfcgi.dll" "$(OUTDIR)\libfcgi.bsc" - - -CLEAN : - -@erase "$(INTDIR)\fcgi_stdio.obj" - -@erase "$(INTDIR)\fcgi_stdio.sbr" - -@erase "$(INTDIR)\fcgiapp.obj" - -@erase "$(INTDIR)\fcgiapp.sbr" - -@erase "$(INTDIR)\fcgio.obj" - -@erase "$(INTDIR)\fcgio.sbr" - -@erase "$(INTDIR)\os_win32.obj" - -@erase "$(INTDIR)\os_win32.sbr" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\libfcgi.bsc" - -@erase "$(OUTDIR)\libfcgi.dll" - -@erase "$(OUTDIR)\libfcgi.exp" - -@erase "$(OUTDIR)\libfcgi.lib" - -@erase "$(OUTDIR)\libfcgi.map" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libfcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\libfcgi.bsc" -BSC32_SBRS= \ - "$(INTDIR)\fcgi_stdio.sbr" \ - "$(INTDIR)\fcgiapp.sbr" \ - "$(INTDIR)\fcgio.sbr" \ - "$(INTDIR)\os_win32.sbr" - -"$(OUTDIR)\libfcgi.bsc" : "$(OUTDIR)" $(BSC32_SBRS) - $(BSC32) @<< - $(BSC32_FLAGS) $(BSC32_SBRS) -<< - -LINK32=link.exe -LINK32_FLAGS=Ws2_32.lib /nologo /dll /profile /map:"$(INTDIR)\libfcgi.map" /debug /machine:I386 /out:"$(OUTDIR)\libfcgi.dll" /implib:"$(OUTDIR)\libfcgi.lib" -LINK32_OBJS= \ - "$(INTDIR)\fcgi_stdio.obj" \ - "$(INTDIR)\fcgiapp.obj" \ - "$(INTDIR)\fcgio.obj" \ - "$(INTDIR)\os_win32.obj" - -"$(OUTDIR)\libfcgi.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -..\libfcgi\fcgi_stdio.c : \ - "..\include\fcgi_config.h"\ - "..\include\fcgi_stdio.h"\ - "..\include\fcgiapp.h"\ - "..\include\fcgimisc.h"\ - "..\include\fcgios.h"\ - - -..\libfcgi\fcgiapp.c : \ - "..\include\fastcgi.h"\ - "..\include\fcgi_config.h"\ - "..\include\fcgiapp.h"\ - "..\include\fcgimisc.h"\ - "..\include\fcgios.h"\ - - -..\libfcgi\fcgio.cpp : \ - "..\include\fcgiapp.h"\ - "..\include\fcgio.h"\ - - -..\libfcgi\os_win32.c : \ - "..\include\fcgi_config.h"\ - "..\include\fcgimisc.h"\ - "..\include\fcgios.h"\ - - -!IF "$(CFG)" == "release" || "$(CFG)" == "debug" -SOURCE=..\libfcgi\fcgi_stdio.c - -!IF "$(CFG)" == "release" - - -"$(INTDIR)\fcgi_stdio.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "debug" - - -"$(INTDIR)\fcgi_stdio.obj" "$(INTDIR)\fcgi_stdio.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\libfcgi\fcgiapp.c - -!IF "$(CFG)" == "release" - - -"$(INTDIR)\fcgiapp.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "debug" - - -"$(INTDIR)\fcgiapp.obj" "$(INTDIR)\fcgiapp.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\libfcgi\fcgio.cpp - -!IF "$(CFG)" == "release" - -CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\libfcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -"$(INTDIR)\fcgio.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) @<< - $(CPP_SWITCHES) $(SOURCE) -<< - - -!ELSEIF "$(CFG)" == "debug" - -CPP_SWITCHES=/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\libfcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c - -"$(INTDIR)\fcgio.obj" "$(INTDIR)\fcgio.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) @<< - $(CPP_SWITCHES) $(SOURCE) -<< - - -!ENDIF - -SOURCE=..\libfcgi\os_unix.c -SOURCE=..\libfcgi\os_win32.c - -!IF "$(CFG)" == "release" - - -"$(INTDIR)\os_win32.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ELSEIF "$(CFG)" == "debug" - - -"$(INTDIR)\os_win32.obj" "$(INTDIR)\os_win32.sbr" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -!ENDIF - -SOURCE=..\libfcgi\strerror.c - -!ENDIF - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/os_unix.c b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/os_unix.c deleted file mode 100644 index 73e6a7f5152..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/os_unix.c +++ /dev/null @@ -1,1293 +0,0 @@ -/* - * os_unix.c -- - * - * Description of file. - * - * - * Copyright (c) 1995 Open Market, Inc. - * All rights reserved. - * - * This file contains proprietary and confidential information and - * remains the unpublished property of Open Market, Inc. Use, - * disclosure, or reproduction is prohibited except as permitted by - * express written license agreement with Open Market, Inc. - * - * Bill Snapper - * snapper@openmarket.com - */ - -#ifndef lint -static const char rcsid[] = "$Id: os_unix.c,v 1.37 2002/03/05 19:14:49 robs Exp $"; -#endif /* not lint */ - -#include "fcgi_config.h" - -#include - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#include -#include -#include -#include /* for fcntl */ -#include -#include /* for memchr() */ -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_NETDB_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include /* for getpeername */ -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "fastcgi.h" -#include "fcgimisc.h" -#include "fcgios.h" - -#ifndef INADDR_NONE -#define INADDR_NONE ((unsigned long) -1) -#endif - -/* - * This structure holds an entry for each oustanding async I/O operation. - */ -typedef struct { - OS_AsyncProc procPtr; /* callout completion procedure */ - ClientData clientData; /* caller private data */ - int fd; - int len; - int offset; - void *buf; - int inUse; -} AioInfo; - -/* - * Entries in the async I/O table are allocated 2 per file descriptor. - * - * Read Entry Index = fd * 2 - * Write Entry Index = (fd * 2) + 1 - */ -#define AIO_RD_IX(fd) (fd * 2) -#define AIO_WR_IX(fd) ((fd * 2) + 1) - -static int asyncIoInUse = FALSE; -static int asyncIoTableSize = 16; -static AioInfo *asyncIoTable = NULL; - -static int libInitialized = FALSE; - -static fd_set readFdSet; -static fd_set writeFdSet; - -static fd_set readFdSetPost; -static int numRdPosted = 0; -static fd_set writeFdSetPost; -static int numWrPosted = 0; -static int volatile maxFd = -1; - -static int shutdownPending = FALSE; -static int shutdownNow = FALSE; - -void OS_ShutdownPending() -{ - shutdownPending = TRUE; -} - -static void OS_Sigusr1Handler(int signo) -{ - OS_ShutdownPending(); -} - -static void OS_SigpipeHandler(int signo) -{ - ; -} - -static void installSignalHandler(int signo, const struct sigaction * act, int force) -{ - struct sigaction sa; - - sigaction(signo, NULL, &sa); - - if (force || sa.sa_handler == SIG_DFL) - { - sigaction(signo, act, NULL); - } -} - -static void OS_InstallSignalHandlers(int force) -{ - struct sigaction sa; - - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - sa.sa_handler = OS_SigpipeHandler; - installSignalHandler(SIGPIPE, &sa, force); - - sa.sa_handler = OS_Sigusr1Handler; - installSignalHandler(SIGUSR1, &sa, force); -} - -/* - *-------------------------------------------------------------- - * - * OS_LibInit -- - * - * Set up the OS library for use. - * - * NOTE: This function is really only needed for application - * asynchronous I/O. It will most likely change in the - * future to setup the multi-threaded environment. - * - * Results: - * Returns 0 if success, -1 if not. - * - * Side effects: - * Async I/O table allocated and initialized. - * - *-------------------------------------------------------------- - */ -int OS_LibInit(int stdioFds[3]) -{ - if(libInitialized) - return 0; - - asyncIoTable = (AioInfo *)malloc(asyncIoTableSize * sizeof(AioInfo)); - if(asyncIoTable == NULL) { - errno = ENOMEM; - return -1; - } - memset((char *) asyncIoTable, 0, - asyncIoTableSize * sizeof(AioInfo)); - - FD_ZERO(&readFdSet); - FD_ZERO(&writeFdSet); - FD_ZERO(&readFdSetPost); - FD_ZERO(&writeFdSetPost); - - OS_InstallSignalHandlers(FALSE); - - libInitialized = TRUE; - - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_LibShutdown -- - * - * Shutdown the OS library. - * - * Results: - * None. - * - * Side effects: - * Memory freed, fds closed. - * - *-------------------------------------------------------------- - */ -void OS_LibShutdown() -{ - if(!libInitialized) - return; - - free(asyncIoTable); - asyncIoTable = NULL; - libInitialized = FALSE; - return; -} - -/* - *---------------------------------------------------------------------- - * - * OS_BuildSockAddrUn -- - * - * Using the pathname bindPath, fill in the sockaddr_un structure - * *servAddrPtr and the length of this structure *servAddrLen. - * - * The format of the sockaddr_un structure changed incompatibly in - * 4.3BSD Reno. Digital UNIX supports both formats, other systems - * support one or the other. - * - * Results: - * 0 for normal return, -1 for failure (bindPath too long). - * - *---------------------------------------------------------------------- - */ - -static int OS_BuildSockAddrUn(const char *bindPath, - struct sockaddr_un *servAddrPtr, - int *servAddrLen) -{ - int bindPathLen = strlen(bindPath); - -#ifdef HAVE_SOCKADDR_UN_SUN_LEN /* 4.3BSD Reno and later: BSDI, DEC */ - if(bindPathLen >= sizeof(servAddrPtr->sun_path)) { - return -1; - } -#else /* 4.3 BSD Tahoe: Solaris, HPUX, DEC, ... */ - if(bindPathLen > sizeof(servAddrPtr->sun_path)) { - return -1; - } -#endif - memset((char *) servAddrPtr, 0, sizeof(*servAddrPtr)); - servAddrPtr->sun_family = AF_UNIX; - memcpy(servAddrPtr->sun_path, bindPath, bindPathLen); -#ifdef HAVE_SOCKADDR_UN_SUN_LEN /* 4.3BSD Reno and later: BSDI, DEC */ - *servAddrLen = sizeof(servAddrPtr->sun_len) - + sizeof(servAddrPtr->sun_family) - + bindPathLen + 1; - servAddrPtr->sun_len = *servAddrLen; -#else /* 4.3 BSD Tahoe: Solaris, HPUX, DEC, ... */ - *servAddrLen = sizeof(servAddrPtr->sun_family) + bindPathLen; -#endif - return 0; -} -union SockAddrUnion { - struct sockaddr_un unixVariant; - struct sockaddr_in inetVariant; -}; - -/* - * OS_CreateLocalIpcFd -- - * - * This procedure is responsible for creating the listener socket - * on Unix for local process communication. It will create a - * domain socket or a TCP/IP socket bound to "localhost" and return - * a file descriptor to it to the caller. - * - * Results: - * Listener socket created. This call returns either a valid - * file descriptor or -1 on error. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -int OS_CreateLocalIpcFd(const char *bindPath, int backlog) -{ - int listenSock, servLen; - union SockAddrUnion sa; - int tcp = FALSE; - unsigned long tcp_ia = 0; - char *tp; - short port = 0; - char host[MAXPATHLEN]; - - strcpy(host, bindPath); - if((tp = strchr(host, ':')) != 0) { - *tp++ = 0; - if((port = atoi(tp)) == 0) { - *--tp = ':'; - } else { - tcp = TRUE; - } - } - if(tcp) { - if (!*host || !strcmp(host,"*")) { - tcp_ia = htonl(INADDR_ANY); - } else { - tcp_ia = inet_addr(host); - if (tcp_ia == INADDR_NONE) { - struct hostent * hep; - hep = gethostbyname(host); - if ((!hep) || (hep->h_addrtype != AF_INET || !hep->h_addr_list[0])) { - fprintf(stderr, "Cannot resolve host name %s -- exiting!\n", host); - exit(1); - } - if (hep->h_addr_list[1]) { - fprintf(stderr, "Host %s has multiple addresses ---\n", host); - fprintf(stderr, "you must choose one explicitly!!!\n"); - exit(1); - } - tcp_ia = ((struct in_addr *) (hep->h_addr))->s_addr; - } - } - } - - if(tcp) { - listenSock = socket(AF_INET, SOCK_STREAM, 0); - if(listenSock >= 0) { - int flag = 1; - if(setsockopt(listenSock, SOL_SOCKET, SO_REUSEADDR, - (char *) &flag, sizeof(flag)) < 0) { - fprintf(stderr, "Can't set SO_REUSEADDR.\n"); - exit(1001); - } - } - } else { - listenSock = socket(AF_UNIX, SOCK_STREAM, 0); - } - if(listenSock < 0) { - return -1; - } - - /* - * Bind the listening socket. - */ - if(tcp) { - memset((char *) &sa.inetVariant, 0, sizeof(sa.inetVariant)); - sa.inetVariant.sin_family = AF_INET; - sa.inetVariant.sin_addr.s_addr = tcp_ia; - sa.inetVariant.sin_port = htons(port); - servLen = sizeof(sa.inetVariant); - } else { - unlink(bindPath); - if(OS_BuildSockAddrUn(bindPath, &sa.unixVariant, &servLen)) { - fprintf(stderr, "Listening socket's path name is too long.\n"); - exit(1000); - } - } - if(bind(listenSock, (struct sockaddr *) &sa.unixVariant, servLen) < 0 - || listen(listenSock, backlog) < 0) { - perror("bind/listen"); - exit(errno); - } - - return listenSock; -} - -/* - *---------------------------------------------------------------------- - * - * OS_FcgiConnect -- - * - * Create the socket and connect to the remote application if - * possible. - * - * This was lifted from the cgi-fcgi application and was abstracted - * out because Windows NT does not have a domain socket and must - * use a named pipe which has a different API altogether. - * - * Results: - * -1 if fail or a valid file descriptor if connection succeeds. - * - * Side effects: - * Remote connection established. - * - *---------------------------------------------------------------------- - */ -int OS_FcgiConnect(char *bindPath) -{ - union SockAddrUnion sa; - int servLen, resultSock; - int connectStatus; - char *tp; - char host[MAXPATHLEN]; - short port = 0; - int tcp = FALSE; - - strcpy(host, bindPath); - if((tp = strchr(host, ':')) != 0) { - *tp++ = 0; - if((port = atoi(tp)) == 0) { - *--tp = ':'; - } else { - tcp = TRUE; - } - } - if(tcp == TRUE) { - struct hostent *hp; - if((hp = gethostbyname((*host ? host : "localhost"))) == NULL) { - fprintf(stderr, "Unknown host: %s\n", bindPath); - exit(1000); - } - sa.inetVariant.sin_family = AF_INET; - memcpy(&sa.inetVariant.sin_addr, hp->h_addr, hp->h_length); - sa.inetVariant.sin_port = htons(port); - servLen = sizeof(sa.inetVariant); - resultSock = socket(AF_INET, SOCK_STREAM, 0); - } else { - if(OS_BuildSockAddrUn(bindPath, &sa.unixVariant, &servLen)) { - fprintf(stderr, "Listening socket's path name is too long.\n"); - exit(1000); - } - resultSock = socket(AF_UNIX, SOCK_STREAM, 0); - } - - ASSERT(resultSock >= 0); - connectStatus = connect(resultSock, (struct sockaddr *) &sa.unixVariant, - servLen); - if(connectStatus >= 0) { - return resultSock; - } else { - /* - * Most likely (errno == ENOENT || errno == ECONNREFUSED) - * and no FCGI application server is running. - */ - close(resultSock); - return -1; - } -} - -/* - *-------------------------------------------------------------- - * - * OS_Read -- - * - * Pass through to the unix read function. - * - * Results: - * Returns number of byes read, 0, or -1 failure: errno - * contains actual error. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -int OS_Read(int fd, char * buf, size_t len) -{ - if (shutdownNow) return -1; - return(read(fd, buf, len)); -} - -/* - *-------------------------------------------------------------- - * - * OS_Write -- - * - * Pass through to unix write function. - * - * Results: - * Returns number of byes read, 0, or -1 failure: errno - * contains actual error. - * - * Side effects: - * none. - * - *-------------------------------------------------------------- - */ -int OS_Write(int fd, char * buf, size_t len) -{ - if (shutdownNow) return -1; - return(write(fd, buf, len)); -} - -/* - *---------------------------------------------------------------------- - * - * OS_SpawnChild -- - * - * Spawns a new FastCGI listener process. - * - * Results: - * 0 if success, -1 if error. - * - * Side effects: - * Child process spawned. - * - *---------------------------------------------------------------------- - */ -int OS_SpawnChild(char *appPath, int listenFd) -{ - int forkResult; - - forkResult = fork(); - if(forkResult < 0) { - exit(errno); - } - - if(forkResult == 0) { - /* - * Close STDIN unconditionally. It's used by the parent - * process for CGI communication. The FastCGI applciation - * will be replacing this with the FastCGI listenFd IF - * STDIN_FILENO is the same as FCGI_LISTENSOCK_FILENO - * (which it is on Unix). Regardless, STDIN, STDOUT, and - * STDERR will be closed as the FastCGI process uses a - * multiplexed socket in their place. - */ - close(STDIN_FILENO); - - /* - * If the listenFd is already the value of FCGI_LISTENSOCK_FILENO - * we're set. If not, change it so the child knows where to - * get the listen socket from. - */ - if(listenFd != FCGI_LISTENSOCK_FILENO) { - dup2(listenFd, FCGI_LISTENSOCK_FILENO); - close(listenFd); - } - - close(STDOUT_FILENO); - close(STDERR_FILENO); - - /* - * We're a child. Exec the application. - * - * XXX: entire environment passes through - */ - execl(appPath, appPath, NULL); - /* - * XXX: Can't do this as we've already closed STDERR!!! - * - * perror("exec"); - */ - exit(errno); - } - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_AsyncReadStdin -- - * - * This initiates an asynchronous read on the standard - * input handle. - * - * The abstraction is necessary because Windows NT does not - * have a clean way of "select"ing a file descriptor for - * I/O. - * - * Results: - * -1 if error, 0 otherwise. - * - * Side effects: - * Asynchronous bit is set in the readfd variable and - * request is enqueued. - * - *-------------------------------------------------------------- - */ -int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr, - ClientData clientData) -{ - int index = AIO_RD_IX(STDIN_FILENO); - - asyncIoInUse = TRUE; - ASSERT(asyncIoTable[index].inUse == 0); - asyncIoTable[index].procPtr = procPtr; - asyncIoTable[index].clientData = clientData; - asyncIoTable[index].fd = STDIN_FILENO; - asyncIoTable[index].len = len; - asyncIoTable[index].offset = 0; - asyncIoTable[index].buf = buf; - asyncIoTable[index].inUse = 1; - FD_SET(STDIN_FILENO, &readFdSet); - if(STDIN_FILENO > maxFd) - maxFd = STDIN_FILENO; - return 0; -} - -static void GrowAsyncTable(void) -{ - int oldTableSize = asyncIoTableSize; - - asyncIoTableSize = asyncIoTableSize * 2; - asyncIoTable = (AioInfo *)realloc(asyncIoTable, asyncIoTableSize * sizeof(AioInfo)); - if(asyncIoTable == NULL) { - errno = ENOMEM; - exit(errno); - } - memset((char *) &asyncIoTable[oldTableSize], 0, - oldTableSize * sizeof(AioInfo)); - -} - -/* - *-------------------------------------------------------------- - * - * OS_AsyncRead -- - * - * This initiates an asynchronous read on the file - * handle which may be a socket or named pipe. - * - * We also must save the ProcPtr and ClientData, so later - * when the io completes, we know who to call. - * - * We don't look at any results here (the ReadFile may - * return data if it is cached) but do all completion - * processing in OS_Select when we get the io completion - * port done notifications. Then we call the callback. - * - * Results: - * -1 if error, 0 otherwise. - * - * Side effects: - * Asynchronous I/O operation is queued for completion. - * - *-------------------------------------------------------------- - */ -int OS_AsyncRead(int fd, int offset, void *buf, int len, - OS_AsyncProc procPtr, ClientData clientData) -{ - int index = AIO_RD_IX(fd); - - ASSERT(asyncIoTable != NULL); - asyncIoInUse = TRUE; - - if(fd > maxFd) - maxFd = fd; - - while (index >= asyncIoTableSize) { - GrowAsyncTable(); - } - - ASSERT(asyncIoTable[index].inUse == 0); - asyncIoTable[index].procPtr = procPtr; - asyncIoTable[index].clientData = clientData; - asyncIoTable[index].fd = fd; - asyncIoTable[index].len = len; - asyncIoTable[index].offset = offset; - asyncIoTable[index].buf = buf; - asyncIoTable[index].inUse = 1; - FD_SET(fd, &readFdSet); - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_AsyncWrite -- - * - * This initiates an asynchronous write on the "fake" file - * descriptor (which may be a file, socket, or named pipe). - * We also must save the ProcPtr and ClientData, so later - * when the io completes, we know who to call. - * - * We don't look at any results here (the WriteFile generally - * completes immediately) but do all completion processing - * in OS_DoIo when we get the io completion port done - * notifications. Then we call the callback. - * - * Results: - * -1 if error, 0 otherwise. - * - * Side effects: - * Asynchronous I/O operation is queued for completion. - * - *-------------------------------------------------------------- - */ -int OS_AsyncWrite(int fd, int offset, void *buf, int len, - OS_AsyncProc procPtr, ClientData clientData) -{ - int index = AIO_WR_IX(fd); - - asyncIoInUse = TRUE; - - if(fd > maxFd) - maxFd = fd; - - while (index >= asyncIoTableSize) { - GrowAsyncTable(); - } - - ASSERT(asyncIoTable[index].inUse == 0); - asyncIoTable[index].procPtr = procPtr; - asyncIoTable[index].clientData = clientData; - asyncIoTable[index].fd = fd; - asyncIoTable[index].len = len; - asyncIoTable[index].offset = offset; - asyncIoTable[index].buf = buf; - asyncIoTable[index].inUse = 1; - FD_SET(fd, &writeFdSet); - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_Close -- - * - * Closes the descriptor. This is a pass through to the - * Unix close. - * - * Results: - * 0 for success, -1 on failure - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -int OS_Close(int fd) -{ - if (fd == -1) - return 0; - - if (asyncIoInUse) { - int index = AIO_RD_IX(fd); - - FD_CLR(fd, &readFdSet); - FD_CLR(fd, &readFdSetPost); - if (asyncIoTable[index].inUse != 0) { - asyncIoTable[index].inUse = 0; - } - - FD_CLR(fd, &writeFdSet); - FD_CLR(fd, &writeFdSetPost); - index = AIO_WR_IX(fd); - if (asyncIoTable[index].inUse != 0) { - asyncIoTable[index].inUse = 0; - } - - if (maxFd == fd) { - maxFd--; - } - } - - /* - * shutdown() the send side and then read() from client until EOF - * or a timeout expires. This is done to minimize the potential - * that a TCP RST will be sent by our TCP stack in response to - * receipt of additional data from the client. The RST would - * cause the client to discard potentially useful response data. - */ - - if (shutdown(fd, 1) == 0) - { - struct timeval tv; - fd_set rfds; - int rv; - char trash[1024]; - - FD_ZERO(&rfds); - - do - { - FD_SET(fd, &rfds); - tv.tv_sec = 2; - tv.tv_usec = 0; - rv = select(fd + 1, &rfds, NULL, NULL, &tv); - } - while (rv > 0 && read(fd, trash, sizeof(trash)) > 0); - } - - return close(fd); -} - -/* - *-------------------------------------------------------------- - * - * OS_CloseRead -- - * - * Cancel outstanding asynchronous reads and prevent subsequent - * reads from completing. - * - * Results: - * Socket or file is shutdown. Return values mimic Unix shutdown: - * 0 success, -1 failure - * - *-------------------------------------------------------------- - */ -int OS_CloseRead(int fd) -{ - if(asyncIoTable[AIO_RD_IX(fd)].inUse != 0) { - asyncIoTable[AIO_RD_IX(fd)].inUse = 0; - FD_CLR(fd, &readFdSet); - } - - return shutdown(fd, 0); -} - -/* - *-------------------------------------------------------------- - * - * OS_DoIo -- - * - * This function was formerly OS_Select. It's purpose is - * to pull I/O completion events off the queue and dispatch - * them to the appropriate place. - * - * Results: - * Returns 0. - * - * Side effects: - * Handlers are called. - * - *-------------------------------------------------------------- - */ -int OS_DoIo(struct timeval *tmo) -{ - int fd, len, selectStatus; - OS_AsyncProc procPtr; - ClientData clientData; - AioInfo *aioPtr; - fd_set readFdSetCpy; - fd_set writeFdSetCpy; - - asyncIoInUse = TRUE; - FD_ZERO(&readFdSetCpy); - FD_ZERO(&writeFdSetCpy); - - for(fd = 0; fd <= maxFd; fd++) { - if(FD_ISSET(fd, &readFdSet)) { - FD_SET(fd, &readFdSetCpy); - } - if(FD_ISSET(fd, &writeFdSet)) { - FD_SET(fd, &writeFdSetCpy); - } - } - - /* - * If there were no completed events from a prior call, see if there's - * any work to do. - */ - if(numRdPosted == 0 && numWrPosted == 0) { - selectStatus = select((maxFd+1), &readFdSetCpy, &writeFdSetCpy, - NULL, tmo); - if(selectStatus < 0) { - exit(errno); - } - - for(fd = 0; fd <= maxFd; fd++) { - /* - * Build up a list of completed events. We'll work off of - * this list as opposed to looping through the read and write - * fd sets since they can be affected by a callbacl routine. - */ - if(FD_ISSET(fd, &readFdSetCpy)) { - numRdPosted++; - FD_SET(fd, &readFdSetPost); - FD_CLR(fd, &readFdSet); - } - - if(FD_ISSET(fd, &writeFdSetCpy)) { - numWrPosted++; - FD_SET(fd, &writeFdSetPost); - FD_CLR(fd, &writeFdSet); - } - } - } - - if(numRdPosted == 0 && numWrPosted == 0) - return 0; - - for(fd = 0; fd <= maxFd; fd++) { - /* - * Do reads and dispatch callback. - */ - if(FD_ISSET(fd, &readFdSetPost) - && asyncIoTable[AIO_RD_IX(fd)].inUse) { - - numRdPosted--; - FD_CLR(fd, &readFdSetPost); - aioPtr = &asyncIoTable[AIO_RD_IX(fd)]; - - len = read(aioPtr->fd, aioPtr->buf, aioPtr->len); - - procPtr = aioPtr->procPtr; - aioPtr->procPtr = NULL; - clientData = aioPtr->clientData; - aioPtr->inUse = 0; - - (*procPtr)(clientData, len); - } - - /* - * Do writes and dispatch callback. - */ - if(FD_ISSET(fd, &writeFdSetPost) && - asyncIoTable[AIO_WR_IX(fd)].inUse) { - - numWrPosted--; - FD_CLR(fd, &writeFdSetPost); - aioPtr = &asyncIoTable[AIO_WR_IX(fd)]; - - len = write(aioPtr->fd, aioPtr->buf, aioPtr->len); - - procPtr = aioPtr->procPtr; - aioPtr->procPtr = NULL; - clientData = aioPtr->clientData; - aioPtr->inUse = 0; - (*procPtr)(clientData, len); - } - } - return 0; -} - -/* - * Not all systems have strdup(). - * @@@ autoconf should determine whether or not this is needed, but for now.. - */ -static char * str_dup(const char * str) -{ - char * sdup = (char *) malloc(strlen(str) + 1); - - if (sdup) - strcpy(sdup, str); - - return sdup; -} - -/* - *---------------------------------------------------------------------- - * - * ClientAddrOK -- - * - * Checks if a client address is in a list of allowed addresses - * - * Results: - * TRUE if address list is empty or client address is present - * in the list, FALSE otherwise. - * - *---------------------------------------------------------------------- - */ -static int ClientAddrOK(struct sockaddr_in *saPtr, const char *clientList) -{ - int result = FALSE; - char *clientListCopy, *cur, *next; - - if (clientList == NULL || *clientList == '\0') { - return TRUE; - } - - clientListCopy = str_dup(clientList); - - for (cur = clientListCopy; cur != NULL; cur = next) { - next = strchr(cur, ','); - if (next != NULL) { - *next++ = '\0'; - } - if (inet_addr(cur) == saPtr->sin_addr.s_addr) { - result = TRUE; - break; - } - } - - free(clientListCopy); - return result; -} - -/* - *---------------------------------------------------------------------- - * - * AcquireLock -- - * - * On platforms that implement concurrent calls to accept - * on a shared listening ipcFd, returns 0. On other platforms, - * acquires an exclusive lock across all processes sharing a - * listening ipcFd, blocking until the lock has been acquired. - * - * Results: - * 0 for successful call, -1 in case of system error (fatal). - * - * Side effects: - * This process now has the exclusive lock. - * - *---------------------------------------------------------------------- - */ -static int AcquireLock(int sock, int fail_on_intr) -{ -#ifdef USE_LOCKING - do { - struct flock lock; - lock.l_type = F_WRLCK; - lock.l_start = 0; - lock.l_whence = SEEK_SET; - lock.l_len = 0; - - if (fcntl(sock, F_SETLKW, &lock) != -1) - return 0; - } while (errno == EINTR - && ! fail_on_intr - && ! shutdownPending); - - return -1; - -#else - return 0; -#endif -} - -/* - *---------------------------------------------------------------------- - * - * ReleaseLock -- - * - * On platforms that implement concurrent calls to accept - * on a shared listening ipcFd, does nothing. On other platforms, - * releases an exclusive lock acquired by AcquireLock. - * - * Results: - * 0 for successful call, -1 in case of system error (fatal). - * - * Side effects: - * This process no longer holds the lock. - * - *---------------------------------------------------------------------- - */ -static int ReleaseLock(int sock) -{ -#ifdef USE_LOCKING - do { - struct flock lock; - lock.l_type = F_UNLCK; - lock.l_start = 0; - lock.l_whence = SEEK_SET; - lock.l_len = 0; - - if (fcntl(sock, F_SETLK, &lock) != -1) - return 0; - } while (errno == EINTR); - - return -1; - -#else - return 0; -#endif -} - -/********************************************************************** - * Determine if the errno resulting from a failed accept() warrants a - * retry or exit(). Based on Apache's http_main.c accept() handling - * and Stevens' Unix Network Programming Vol 1, 2nd Ed, para. 15.6. - */ -static int is_reasonable_accept_errno (const int error) -{ - switch (error) { -#ifdef EPROTO - /* EPROTO on certain older kernels really means ECONNABORTED, so - * we need to ignore it for them. See discussion in new-httpd - * archives nh.9701 search for EPROTO. Also see nh.9603, search - * for EPROTO: There is potentially a bug in Solaris 2.x x<6, and - * other boxes that implement tcp sockets in userland (i.e. on top of - * STREAMS). On these systems, EPROTO can actually result in a fatal - * loop. See PR#981 for example. It's hard to handle both uses of - * EPROTO. */ - case EPROTO: -#endif -#ifdef ECONNABORTED - case ECONNABORTED: -#endif - /* Linux generates the rest of these, other tcp stacks (i.e. - * bsd) tend to hide them behind getsockopt() interfaces. They - * occur when the net goes sour or the client disconnects after the - * three-way handshake has been done in the kernel but before - * userland has picked up the socket. */ -#ifdef ECONNRESET - case ECONNRESET: -#endif -#ifdef ETIMEDOUT - case ETIMEDOUT: -#endif -#ifdef EHOSTUNREACH - case EHOSTUNREACH: -#endif -#ifdef ENETUNREACH - case ENETUNREACH: -#endif - return 1; - - default: - return 0; - } -} - -/********************************************************************** - * This works around a problem on Linux 2.0.x and SCO Unixware (maybe - * others?). When a connect() is made to a Unix Domain socket, but its - * not accept()ed before the web server gets impatient and close()s, an - * accept() results in a valid file descriptor, but no data to read. - * This causes a block on the first read() - which never returns! - * - * Another approach to this is to write() to the socket to provoke a - * SIGPIPE, but this is a pain because of the FastCGI protocol, the fact - * that whatever is written has to be universally ignored by all FastCGI - * web servers, and a SIGPIPE handler has to be installed which returns - * (or SIGPIPE is ignored). - * - * READABLE_UNIX_FD_DROP_DEAD_TIMEVAL = 2,0 by default. - * - * Making it shorter is probably safe, but I'll leave that to you. Making - * it 0,0 doesn't work reliably. The shorter you can reliably make it, - * the faster your application will be able to recover (waiting 2 seconds - * may _cause_ the problem when there is a very high demand). At any rate, - * this is better than perma-blocking. - */ -static int is_af_unix_keeper(const int fd) -{ - struct timeval tval = { READABLE_UNIX_FD_DROP_DEAD_TIMEVAL }; - fd_set read_fds; - - FD_ZERO(&read_fds); - FD_SET(fd, &read_fds); - - return select(fd + 1, &read_fds, NULL, NULL, &tval) >= 0 && FD_ISSET(fd, &read_fds); -} - -/* - *---------------------------------------------------------------------- - * - * OS_Accept -- - * - * Accepts a new FastCGI connection. This routine knows whether - * we're dealing with TCP based sockets or NT Named Pipes for IPC. - * - * Results: - * -1 if the operation fails, otherwise this is a valid IPC fd. - * - * Side effects: - * New IPC connection is accepted. - * - *---------------------------------------------------------------------- - */ -int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs) -{ - int socket = -1; - union { - struct sockaddr_un un; - struct sockaddr_in in; - } sa; - - for (;;) { - if (AcquireLock(listen_sock, fail_on_intr)) - return -1; - - for (;;) { - do { -#ifdef HAVE_SOCKLEN - socklen_t len = sizeof(sa); -#else - int len = sizeof(sa); -#endif - if (shutdownPending) break; - /* There's a window here */ - - socket = accept(listen_sock, (struct sockaddr *)&sa, &len); - } while (socket < 0 - && errno == EINTR - && ! fail_on_intr - && ! shutdownPending); - - if (socket < 0) { - if (shutdownPending || ! is_reasonable_accept_errno(errno)) { - int errnoSave = errno; - - ReleaseLock(listen_sock); - - if (! shutdownPending) { - errno = errnoSave; - } - - return (-1); - } - errno = 0; - } - else { /* socket >= 0 */ - int set = 1; - - if (sa.in.sin_family != AF_INET) - break; - -#ifdef TCP_NODELAY - /* No replies to outgoing data, so disable Nagle */ - setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char *)&set, sizeof(set)); -#endif - - /* Check that the client IP address is approved */ - if (ClientAddrOK(&sa.in, webServerAddrs)) - break; - - close(socket); - } /* socket >= 0 */ - } /* for(;;) */ - - if (ReleaseLock(listen_sock)) - return (-1); - - if (sa.in.sin_family != AF_UNIX || is_af_unix_keeper(socket)) - break; - - close(socket); - } /* while(1) - lock */ - - return (socket); -} - -/* - *---------------------------------------------------------------------- - * - * OS_IpcClose - * - * OS IPC routine to close an IPC connection. - * - * Results: - * - * - * Side effects: - * IPC connection is closed. - * - *---------------------------------------------------------------------- - */ -int OS_IpcClose(int ipcFd) -{ - return OS_Close(ipcFd); -} - -/* - *---------------------------------------------------------------------- - * - * OS_IsFcgi -- - * - * Determines whether this process is a FastCGI process or not. - * - * Results: - * Returns 1 if FastCGI, 0 if not. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -int OS_IsFcgi(int sock) -{ - union { - struct sockaddr_in in; - struct sockaddr_un un; - } sa; -#ifdef HAVE_SOCKLEN - socklen_t len = sizeof(sa); -#else - int len = sizeof(sa); -#endif - - errno = 0; - - if (getpeername(sock, (struct sockaddr *)&sa, &len) != 0 && errno == ENOTCONN) { - return TRUE; - } - else { - return FALSE; - } -} - -/* - *---------------------------------------------------------------------- - * - * OS_SetFlags -- - * - * Sets selected flag bits in an open file descriptor. - * - *---------------------------------------------------------------------- - */ -void OS_SetFlags(int fd, int flags) -{ - int val; - if((val = fcntl(fd, F_GETFL, 0)) < 0) { - exit(errno); - } - val |= flags; - if(fcntl(fd, F_SETFL, val) < 0) { - exit(errno); - } -} diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/os_win32.c b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/os_win32.c deleted file mode 100644 index cf72280a5e0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/libfcgi/os_win32.c +++ /dev/null @@ -1,1896 +0,0 @@ -/* - * os_win32.c -- - * - * - * Copyright (c) 1995 Open Market, Inc. - * All rights reserved. - * - * This file contains proprietary and confidential information and - * remains the unpublished property of Open Market, Inc. Use, - * disclosure, or reproduction is prohibited except as permitted by - * express written license agreement with Open Market, Inc. - * - * Bill Snapper - * snapper@openmarket.com - * - * (Special thanks to Karen and Bill. They made my job much easier and - * significantly more enjoyable.) - */ - -#pragma warning(push) -#pragma warning(disable: 4996) -#pragma warning(disable: 4267) -#pragma warning(disable: 4244) -#pragma warning(disable: 4311) -#pragma warning(disable: 4312) - -#ifndef lint -static const char rcsid[] = "$Id: os_win32.c,v 1.33 2002/03/05 18:15:15 robs Exp $"; -#endif /* not lint */ - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include -#include -#include - -#define DLLAPI __declspec(dllexport) - -#include "fcgimisc.h" -#include "fcgios.h" - -#define WIN32_OPEN_MAX 128 /* XXX: Small hack */ - -/* - * millisecs to wait for a client connection before checking the - * shutdown flag (then go back to waiting for a connection, etc). - */ -#define ACCEPT_TIMEOUT 1000 - -#define MUTEX_VARNAME "_FCGI_MUTEX_" -#define SHUTDOWN_EVENT_NAME "_FCGI_SHUTDOWN_EVENT_" -#define LOCALHOST "localhost" - -static HANDLE hIoCompPort = INVALID_HANDLE_VALUE; -static HANDLE hStdinCompPort = INVALID_HANDLE_VALUE; -static HANDLE hStdinThread = INVALID_HANDLE_VALUE; - -static HANDLE stdioHandles[3] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, - INVALID_HANDLE_VALUE}; - -// This is a nail for listening to more than one port.. -static HANDLE acceptMutex = INVALID_HANDLE_VALUE; - -static BOOLEAN shutdownPending = FALSE; -static BOOLEAN shutdownNow = FALSE; - -/* - * An enumeration of the file types - * supported by the FD_TABLE structure. - * - * XXX: Not all currently supported. This allows for future - * functionality. - */ -typedef enum { - FD_UNUSED, - FD_FILE_SYNC, - FD_FILE_ASYNC, - FD_SOCKET_SYNC, - FD_SOCKET_ASYNC, - FD_PIPE_SYNC, - FD_PIPE_ASYNC -} FILE_TYPE; - -typedef union { - HANDLE fileHandle; - SOCKET sock; - unsigned int value; -} DESCRIPTOR; - -/* - * Structure used to map file handle and socket handle - * values into values that can be used to create unix-like - * select bitmaps, read/write for both sockets/files. - */ -struct FD_TABLE { - DESCRIPTOR fid; - FILE_TYPE type; - char *path; - DWORD Errno; - unsigned long instance; - int status; - int offset; /* only valid for async file writes */ - LPDWORD offsetHighPtr; /* pointers to offset high and low words */ - LPDWORD offsetLowPtr; /* only valid for async file writes (logs) */ - HANDLE hMapMutex; /* mutex handle for multi-proc offset update */ - LPVOID ovList; /* List of associated OVERLAPPED_REQUESTs */ -}; - -/* - * XXX Note there is no dyanmic sizing of this table, so if the - * number of open file descriptors exceeds WIN32_OPEN_MAX the - * app will blow up. - */ -static struct FD_TABLE fdTable[WIN32_OPEN_MAX]; - -static CRITICAL_SECTION fdTableCritical; - -struct OVERLAPPED_REQUEST { - OVERLAPPED overlapped; - unsigned long instance; /* file instance (won't match after a close) */ - OS_AsyncProc procPtr; /* callback routine */ - ClientData clientData; /* callback argument */ - ClientData clientData1; /* additional clientData */ -}; -typedef struct OVERLAPPED_REQUEST *POVERLAPPED_REQUEST; - -static const char *bindPathPrefix = "\\\\.\\pipe\\FastCGI\\"; - -static FILE_TYPE listenType = FD_UNUSED; - -// XXX This should be a DESCRIPTOR -static HANDLE hListen = INVALID_HANDLE_VALUE; - -static BOOLEAN libInitialized = FALSE; - -/* - *-------------------------------------------------------------- - * - * Win32NewDescriptor -- - * - * Set up for I/O descriptor masquerading. - * - * Results: - * Returns "fake id" which masquerades as a UNIX-style "small - * non-negative integer" file/socket descriptor. - * Win32_* routine below will "do the right thing" based on the - * descriptor's actual type. -1 indicates failure. - * - * Side effects: - * Entry in fdTable is reserved to represent the socket/file. - * - *-------------------------------------------------------------- - */ -static int Win32NewDescriptor(FILE_TYPE type, int fd, int desiredFd) -{ - int index = -1; - - EnterCriticalSection(&fdTableCritical); - - /* - * If desiredFd is set, try to get this entry (this is used for - * mapping stdio handles). Otherwise try to get the fd entry. - * If this is not available, find a the first empty slot. . - */ - if (desiredFd >= 0 && desiredFd < WIN32_OPEN_MAX) - { - if (fdTable[desiredFd].type == FD_UNUSED) - { - index = desiredFd; - } - } - else if (fd > 0) - { - if (fd < WIN32_OPEN_MAX && fdTable[fd].type == FD_UNUSED) - { - index = fd; - } - else - { - int i; - - for (i = 1; i < WIN32_OPEN_MAX; ++i) - { - if (fdTable[i].type == FD_UNUSED) - { - index = i; - break; - } - } - } - } - - if (index != -1) - { - fdTable[index].fid.value = fd; - fdTable[index].type = type; - fdTable[index].path = NULL; - fdTable[index].Errno = NO_ERROR; - fdTable[index].status = 0; - fdTable[index].offset = -1; - fdTable[index].offsetHighPtr = fdTable[index].offsetLowPtr = NULL; - fdTable[index].hMapMutex = NULL; - fdTable[index].ovList = NULL; - } - - LeaveCriticalSection(&fdTableCritical); - return index; -} - -/* - *-------------------------------------------------------------- - * - * StdinThread-- - * - * This thread performs I/O on stadard input. It is needed - * because you can't guarantee that all applications will - * create standard input with sufficient access to perform - * asynchronous I/O. Since we don't want to block the app - * reading from stdin we make it look like it's using I/O - * completion ports to perform async I/O. - * - * Results: - * Data is read from stdin and posted to the io completion - * port. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -static void StdinThread(void * startup) -{ - int doIo = TRUE; - unsigned long fd; - unsigned long bytesRead; - POVERLAPPED_REQUEST pOv; - - // Touch the arg to prevent warning - startup = NULL; - - while(doIo) { - /* - * Block until a request to read from stdin comes in or a - * request to terminate the thread arrives (fd = -1). - */ - if (!GetQueuedCompletionStatus(hStdinCompPort, &bytesRead, &fd, - (LPOVERLAPPED *)&pOv, (DWORD)-1) && !pOv) { - doIo = 0; - break; - } - - ASSERT((fd == STDIN_FILENO) || (fd == -1)); - if(fd == -1) { - doIo = 0; - break; - } - ASSERT(pOv->clientData1 != NULL); - - if(ReadFile(stdioHandles[STDIN_FILENO], pOv->clientData1, bytesRead, - &bytesRead, NULL)) { - PostQueuedCompletionStatus(hIoCompPort, bytesRead, - STDIN_FILENO, (LPOVERLAPPED)pOv); - } else { - doIo = 0; - break; - } - } - - ExitThread(0); -} - -void OS_ShutdownPending(void) -{ - shutdownPending = TRUE; -} - -static void ShutdownRequestThread(void * arg) -{ - HANDLE shutdownEvent = (HANDLE) arg; - - WaitForSingleObject(shutdownEvent, INFINITE); - - shutdownPending = TRUE; - - if (listenType == FD_PIPE_SYNC) - { - // Its a hassle to get ConnectNamedPipe to return early, - // so just wack the whole process - yes, this will toast - // any requests in progress, but at least its a clean - // shutdown (its better than TerminateProcess()) - exit(0); - } - - // FD_SOCKET_SYNC: When in Accept(), select() is used to poll - // the shutdownPending flag - yeah this isn't pretty either - // but its only one process doing it if an Accept mutex is used. - // This at least buys no toasted requests. -} - -/* - *-------------------------------------------------------------- - * - * OS_LibInit -- - * - * Set up the OS library for use. - * - * Results: - * Returns 0 if success, -1 if not. - * - * Side effects: - * Sockets initialized, pseudo file descriptors setup, etc. - * - *-------------------------------------------------------------- - */ -int OS_LibInit(int stdioFds[3]) -{ - WORD wVersion; - WSADATA wsaData; - int err; - int fakeFd; - char *cLenPtr = NULL; - char *val = NULL; - - if(libInitialized) - return 0; - - InitializeCriticalSection(&fdTableCritical); - - /* - * Initialize windows sockets library. - */ - wVersion = MAKEWORD(2,0); - err = WSAStartup( wVersion, &wsaData ); - if (err) { - fprintf(stderr, "Error starting Windows Sockets. Error: %d", - WSAGetLastError()); - exit(111); - } - - /* - * Create the I/O completion port to be used for our I/O queue. - */ - if (hIoCompPort == INVALID_HANDLE_VALUE) { - hIoCompPort = CreateIoCompletionPort (INVALID_HANDLE_VALUE, NULL, - 0, 1); - if(hIoCompPort == INVALID_HANDLE_VALUE) { - printf("

OS_LibInit Failed CreateIoCompletionPort! ERROR: %d

\r\n\r\n", - GetLastError()); - return -1; - } - } - - /* - * If a shutdown event is in the env, save it (I don't see any to - * remove it from the environment out from under the application). - * Spawn a thread to wait on the shutdown request. - */ - val = getenv(SHUTDOWN_EVENT_NAME); - if (val != NULL) - { - HANDLE shutdownEvent = (HANDLE) atoi(val); - - if (_beginthread(ShutdownRequestThread, 0, shutdownEvent) == -1) - { - return -1; - } - } - - if (acceptMutex == INVALID_HANDLE_VALUE) - { - /* If an accept mutex is in the env, use it */ - val = getenv(MUTEX_VARNAME); - if (val != NULL) - { - acceptMutex = (HANDLE) atoi(val); - } - } - - /* - * Determine if this library is being used to listen for FastCGI - * connections. This is communicated by STDIN containing a - * valid handle to a listener object. In this case, both the - * "stdout" and "stderr" handles will be INVALID (ie. closed) by - * the starting process. - * - * The trick is determining if this is a pipe or a socket... - * - * XXX: Add the async accept test to determine socket or handle to a - * pipe!!! - */ - if((GetStdHandle(STD_OUTPUT_HANDLE) == INVALID_HANDLE_VALUE) && - (GetStdHandle(STD_ERROR_HANDLE) == INVALID_HANDLE_VALUE) && - (GetStdHandle(STD_INPUT_HANDLE) != INVALID_HANDLE_VALUE) ) - { - DWORD pipeMode = PIPE_READMODE_BYTE | PIPE_WAIT; - HANDLE oldStdIn = GetStdHandle(STD_INPUT_HANDLE); - - // Move the handle to a "low" number - if (! DuplicateHandle(GetCurrentProcess(), oldStdIn, - GetCurrentProcess(), &hListen, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - { - return -1; - } - - if (! SetStdHandle(STD_INPUT_HANDLE, hListen)) - { - return -1; - } - - CloseHandle(oldStdIn); - - /* - * Set the pipe handle state so that it operates in wait mode. - * - * NOTE: The listenFd is not mapped to a pseudo file descriptor - * as all work done on it is contained to the OS library. - * - * XXX: Initial assumption is that SetNamedPipeHandleState will - * fail if this is an IP socket... - */ - if (SetNamedPipeHandleState(hListen, &pipeMode, NULL, NULL)) - { - listenType = FD_PIPE_SYNC; - } - else - { - listenType = FD_SOCKET_SYNC; - } - } - - /* - * If there are no stdioFds passed in, we're done. - */ - if(stdioFds == NULL) { - libInitialized = 1; - return 0; - } - - /* - * Setup standard input asynchronous I/O. There is actually a separate - * thread spawned for this purpose. The reason for this is that some - * web servers use anonymous pipes for the connection between itself - * and a CGI application. Anonymous pipes can't perform asynchronous - * I/O or use I/O completion ports. Therefore in order to present a - * consistent I/O dispatch model to an application we emulate I/O - * completion port behavior by having the standard input thread posting - * messages to the hIoCompPort which look like a complete overlapped - * I/O structure. This keeps the event dispatching simple from the - * application perspective. - */ - stdioHandles[STDIN_FILENO] = GetStdHandle(STD_INPUT_HANDLE); - - if(!SetHandleInformation(stdioHandles[STDIN_FILENO], - HANDLE_FLAG_INHERIT, 0)) { -/* - * XXX: Causes error when run from command line. Check KB - err = GetLastError(); - DebugBreak(); - exit(99); - */ - } - - if ((fakeFd = Win32NewDescriptor(FD_PIPE_SYNC, - (int)stdioHandles[STDIN_FILENO], - STDIN_FILENO)) == -1) { - return -1; - } else { - /* - * Set stdin equal to our pseudo FD and create the I/O completion - * port to be used for async I/O. - */ - stdioFds[STDIN_FILENO] = fakeFd; - } - - /* - * Create the I/O completion port to be used for communicating with - * the thread doing I/O on standard in. This port will carry read - * and possibly thread termination requests to the StdinThread. - */ - if (hStdinCompPort == INVALID_HANDLE_VALUE) { - hStdinCompPort = CreateIoCompletionPort (INVALID_HANDLE_VALUE, NULL, - 0, 1); - if(hStdinCompPort == INVALID_HANDLE_VALUE) { - printf("

OS_LibInit Failed CreateIoCompletionPort: STDIN! ERROR: %d

\r\n\r\n", - GetLastError()); - return -1; - } - } - - /* - * Create the thread that will read stdin if the CONTENT_LENGTH - * is non-zero. - */ - if((cLenPtr = getenv("CONTENT_LENGTH")) != NULL && - atoi(cLenPtr) > 0) { - hStdinThread = (HANDLE) _beginthread(StdinThread, 0, NULL); - if (hStdinThread == (HANDLE) -1) { - printf("

OS_LibInit Failed to create STDIN thread! ERROR: %d

\r\n\r\n", - GetLastError()); - return -1; - } - } - - /* - * STDOUT will be used synchronously. - * - * XXX: May want to convert this so that it could be used for OVERLAPPED - * I/O later. If so, model it after the Stdin I/O as stdout is - * also incapable of async I/O on some servers. - */ - stdioHandles[STDOUT_FILENO] = GetStdHandle(STD_OUTPUT_HANDLE); - if(!SetHandleInformation(stdioHandles[STDOUT_FILENO], - HANDLE_FLAG_INHERIT, FALSE)) { - DebugBreak(); - exit(99); - } - - if ((fakeFd = Win32NewDescriptor(FD_PIPE_SYNC, - (int)stdioHandles[STDOUT_FILENO], - STDOUT_FILENO)) == -1) { - return -1; - } else { - /* - * Set stdout equal to our pseudo FD - */ - stdioFds[STDOUT_FILENO] = fakeFd; - } - - stdioHandles[STDERR_FILENO] = GetStdHandle(STD_ERROR_HANDLE); - if(!SetHandleInformation(stdioHandles[STDERR_FILENO], - HANDLE_FLAG_INHERIT, FALSE)) { - DebugBreak(); - exit(99); - } - if ((fakeFd = Win32NewDescriptor(FD_PIPE_SYNC, - (int)stdioHandles[STDERR_FILENO], - STDERR_FILENO)) == -1) { - return -1; - } else { - /* - * Set stderr equal to our pseudo FD - */ - stdioFds[STDERR_FILENO] = fakeFd; - } - - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_LibShutdown -- - * - * Shutdown the OS library. - * - * Results: - * None. - * - * Side effects: - * Memory freed, handles closed. - * - *-------------------------------------------------------------- - */ -void OS_LibShutdown() -{ - - if (hIoCompPort != INVALID_HANDLE_VALUE) - { - CloseHandle(hIoCompPort); - hIoCompPort = INVALID_HANDLE_VALUE; - } - - if (hStdinCompPort != INVALID_HANDLE_VALUE) - { - CloseHandle(hStdinCompPort); - hStdinCompPort = INVALID_HANDLE_VALUE; - } - - if (acceptMutex != INVALID_HANDLE_VALUE) - { - ReleaseMutex(acceptMutex); - } - - DisconnectNamedPipe(hListen); - - CancelIo(hListen); - - - WSACleanup(); -} - -/* - *-------------------------------------------------------------- - * - * Win32FreeDescriptor -- - * - * Free I/O descriptor entry in fdTable. - * - * Results: - * Frees I/O descriptor entry in fdTable. - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -static void Win32FreeDescriptor(int fd) -{ - /* Catch it if fd is a bogus value */ - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - - EnterCriticalSection(&fdTableCritical); - - if (fdTable[fd].type != FD_UNUSED) - { - switch (fdTable[fd].type) - { - case FD_FILE_SYNC: - case FD_FILE_ASYNC: - - /* Free file path string */ - ASSERT(fdTable[fd].path != NULL); - free(fdTable[fd].path); - fdTable[fd].path = NULL; - break; - - default: - break; - } - - ASSERT(fdTable[fd].path == NULL); - - fdTable[fd].type = FD_UNUSED; - fdTable[fd].path = NULL; - fdTable[fd].Errno = NO_ERROR; - fdTable[fd].offsetHighPtr = fdTable[fd].offsetLowPtr = NULL; - - if (fdTable[fd].hMapMutex != NULL) - { - CloseHandle(fdTable[fd].hMapMutex); - fdTable[fd].hMapMutex = NULL; - } - } - - LeaveCriticalSection(&fdTableCritical); - - return; -} - -static short getPort(const char * bindPath) -{ - short port = 0; - char * p = strchr(bindPath, ':'); - - if (p && *++p) - { - char buf[6]; - - strncpy(buf, p, 6); - buf[5] = '\0'; - - port = (short) atoi(buf); - } - - return port; -} - -/* - * OS_CreateLocalIpcFd -- - * - * This procedure is responsible for creating the listener pipe - * on Windows NT for local process communication. It will create a - * named pipe and return a file descriptor to it to the caller. - * - * Results: - * Listener pipe created. This call returns either a valid - * pseudo file descriptor or -1 on error. - * - * Side effects: - * Listener pipe and IPC address are stored in the FCGI info - * structure. - * 'errno' will set on errors (-1 is returned). - * - *---------------------------------------------------------------------- - */ -int OS_CreateLocalIpcFd(const char *bindPath, int backlog) -{ - int pseudoFd = -1; - short port = getPort(bindPath); - - if (acceptMutex == INVALID_HANDLE_VALUE) - { - acceptMutex = CreateMutex(NULL, FALSE, NULL); - if (acceptMutex == NULL) return -2; - if (! SetHandleInformation(acceptMutex, HANDLE_FLAG_INHERIT, TRUE)) return -3; - } - - // There's nothing to be gained (at the moment) by a shutdown Event - - if (port && *bindPath != ':' && strncmp(bindPath, LOCALHOST, strlen(LOCALHOST))) - { - fprintf(stderr, "To start a service on a TCP port can not " - "specify a host name.\n" - "You should either use \"localhost:\" or " - " just use \":.\"\n"); - exit(1); - } - - listenType = (port) ? FD_SOCKET_SYNC : FD_PIPE_ASYNC; - - if (port) - { - SOCKET listenSock; - struct sockaddr_in sockAddr; - int sockLen = sizeof(sockAddr); - - memset(&sockAddr, 0, sizeof(sockAddr)); - sockAddr.sin_family = AF_INET; - sockAddr.sin_addr.s_addr = htonl(INADDR_ANY); - sockAddr.sin_port = htons(port); - - listenSock = socket(AF_INET, SOCK_STREAM, 0); - if (listenSock == INVALID_SOCKET) - { - return -4; - } - - if (bind(listenSock, (struct sockaddr *) &sockAddr, sockLen) ) - { - return -12; - } - - if (listen(listenSock, backlog)) - { - return -5; - } - - pseudoFd = Win32NewDescriptor(listenType, listenSock, -1); - - if (pseudoFd == -1) - { - closesocket(listenSock); - return -6; - } - - hListen = (HANDLE) listenSock; - } - else - { - HANDLE hListenPipe = INVALID_HANDLE_VALUE; - char *pipePath = malloc(strlen(bindPathPrefix) + strlen(bindPath) + 1); - - if (! pipePath) - { - return -7; - } - - strcpy(pipePath, bindPathPrefix); - strcat(pipePath, bindPath); - - hListenPipe = CreateNamedPipe(pipePath, - PIPE_ACCESS_DUPLEX, - PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_READMODE_BYTE, - PIPE_UNLIMITED_INSTANCES, - 4096, 4096, 0, NULL); - - free(pipePath); - - if (hListenPipe == INVALID_HANDLE_VALUE) - { - return -8; - } - - if (! SetHandleInformation(hListenPipe, HANDLE_FLAG_INHERIT, TRUE)) - { - return -9; - } - - pseudoFd = Win32NewDescriptor(listenType, (int) hListenPipe, -1); - - if (pseudoFd == -1) - { - CloseHandle(hListenPipe); - return -10; - } - - hListen = (HANDLE) hListenPipe; - } - - return pseudoFd; -} - -/* - *---------------------------------------------------------------------- - * - * OS_FcgiConnect -- - * - * Create the pipe pathname connect to the remote application if - * possible. - * - * Results: - * -1 if fail or a valid handle if connection succeeds. - * - * Side effects: - * Remote connection established. - * - *---------------------------------------------------------------------- - */ -int OS_FcgiConnect(char *bindPath) -{ - short port = getPort(bindPath); - int pseudoFd = -1; - - if (port) - { - struct hostent *hp; - char *host = NULL; - struct sockaddr_in sockAddr; - int sockLen = sizeof(sockAddr); - SOCKET sock; - - if (*bindPath != ':') - { - char * p = strchr(bindPath, ':'); - int len = p - bindPath + 1; - - host = malloc(len); - strncpy(host, bindPath, len); - host[len] = '\0'; - } - - hp = gethostbyname(host ? host : LOCALHOST); - - if (host) - { - free(host); - } - - if (hp == NULL) - { - fprintf(stderr, "Unknown host: %s\n", bindPath); - return -1; - } - - memset(&sockAddr, 0, sizeof(sockAddr)); - sockAddr.sin_family = AF_INET; - memcpy(&sockAddr.sin_addr, hp->h_addr, hp->h_length); - sockAddr.sin_port = htons(port); - - sock = socket(AF_INET, SOCK_STREAM, 0); - if (sock == INVALID_SOCKET) - { - return -1; - } - - if (! connect(sock, (struct sockaddr *) &sockAddr, sockLen)) - { - closesocket(sock); - return -1; - } - - pseudoFd = Win32NewDescriptor(FD_SOCKET_SYNC, sock, -1); - if (pseudoFd == -1) - { - closesocket(sock); - return -1; - } - } - else - { - char *pipePath = malloc(strlen(bindPathPrefix) + strlen(bindPath) + 1); - HANDLE hPipe; - - if (! pipePath) - { - return -1; - } - - strcpy(pipePath, bindPathPrefix); - strcat(pipePath, bindPath); - - hPipe = CreateFile(pipePath, - GENERIC_WRITE | GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_WRITE, - NULL, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - NULL); - - free(pipePath); - - if( hPipe == INVALID_HANDLE_VALUE) - { - return -1; - } - - pseudoFd = Win32NewDescriptor(FD_PIPE_ASYNC, (int) hPipe, -1); - - if (pseudoFd == -1) - { - CloseHandle(hPipe); - return -1; - } - - /* - * Set stdin equal to our pseudo FD and create the I/O completion - * port to be used for async I/O. - */ - if (! CreateIoCompletionPort(hPipe, hIoCompPort, pseudoFd, 1)) - { - Win32FreeDescriptor(pseudoFd); - CloseHandle(hPipe); - return -1; - } - } - - return pseudoFd; -} - -/* - *-------------------------------------------------------------- - * - * OS_Read -- - * - * Pass through to the appropriate NT read function. - * - * Results: - * Returns number of byes read. Mimics unix read:. - * n bytes read, 0 or -1 failure: errno contains actual error - * - * Side effects: - * None. - * - *-------------------------------------------------------------- - */ -int OS_Read(int fd, char * buf, size_t len) -{ - DWORD bytesRead; - int ret = -1; - - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - - if (shutdownNow) return -1; - - switch (fdTable[fd].type) - { - case FD_FILE_SYNC: - case FD_FILE_ASYNC: - case FD_PIPE_SYNC: - case FD_PIPE_ASYNC: - - if (ReadFile(fdTable[fd].fid.fileHandle, buf, len, &bytesRead, NULL)) - { - ret = bytesRead; - } - else - { - fdTable[fd].Errno = GetLastError(); - } - - break; - - case FD_SOCKET_SYNC: - case FD_SOCKET_ASYNC: - - ret = recv(fdTable[fd].fid.sock, buf, len, 0); - if (ret == SOCKET_ERROR) - { - fdTable[fd].Errno = WSAGetLastError(); - ret = -1; - } - - break; - - default: - - ASSERT(0); - } - - return ret; -} - -/* - *-------------------------------------------------------------- - * - * OS_Write -- - * - * Perform a synchronous OS write. - * - * Results: - * Returns number of bytes written. Mimics unix write: - * n bytes written, 0 or -1 failure (??? couldn't find man page). - * - * Side effects: - * none. - * - *-------------------------------------------------------------- - */ -int OS_Write(int fd, char * buf, size_t len) -{ - DWORD bytesWritten; - int ret = -1; - - ASSERT(fd >= 0 && fd < WIN32_OPEN_MAX); - - if (shutdownNow) return -1; - - switch (fdTable[fd].type) - { - case FD_FILE_SYNC: - case FD_FILE_ASYNC: - case FD_PIPE_SYNC: - case FD_PIPE_ASYNC: - - if (WriteFile(fdTable[fd].fid.fileHandle, buf, len, &bytesWritten, NULL)) - { - ret = bytesWritten; - } - else - { - fdTable[fd].Errno = GetLastError(); - } - - break; - - case FD_SOCKET_SYNC: - case FD_SOCKET_ASYNC: - - ret = send(fdTable[fd].fid.sock, buf, len, 0); - if (ret == SOCKET_ERROR) - { - fdTable[fd].Errno = WSAGetLastError(); - ret = -1; - } - - break; - - default: - - ASSERT(0); - } - - return ret; -} - -/* - *---------------------------------------------------------------------- - * - * OS_SpawnChild -- - * - * Spawns a new server listener process, and stores the information - * relating to the child in the supplied record. A wait handler is - * registered on the child's completion. This involves creating - * a process on NT and preparing a command line with the required - * state (currently a -childproc flag and the server socket to use - * for accepting connections). - * - * Results: - * 0 if success, -1 if error. - * - * Side effects: - * Child process spawned. - * - *---------------------------------------------------------------------- - */ -int OS_SpawnChild(char *execPath, int listenFd) -{ - STARTUPINFO StartupInfo; - PROCESS_INFORMATION pInfo; - BOOL success; - - memset((void *)&StartupInfo, 0, sizeof(STARTUPINFO)); - StartupInfo.cb = sizeof (STARTUPINFO); - StartupInfo.lpReserved = NULL; - StartupInfo.lpReserved2 = NULL; - StartupInfo.cbReserved2 = 0; - StartupInfo.lpDesktop = NULL; - - /* - * FastCGI on NT will set the listener pipe HANDLE in the stdin of - * the new process. The fact that there is a stdin and NULL handles - * for stdout and stderr tells the FastCGI process that this is a - * FastCGI process and not a CGI process. - */ - StartupInfo.dwFlags = STARTF_USESTDHANDLES; - /* - * XXX: Do I have to dup the handle before spawning the process or is - * it sufficient to use the handle as it's reference counted - * by NT anyway? - */ - StartupInfo.hStdInput = fdTable[listenFd].fid.fileHandle; - StartupInfo.hStdOutput = INVALID_HANDLE_VALUE; - StartupInfo.hStdError = INVALID_HANDLE_VALUE; - - /* - * Make the listener socket inheritable. - */ - success = SetHandleInformation(StartupInfo.hStdInput, HANDLE_FLAG_INHERIT, - TRUE); - if(!success) { - exit(99); - } - - /* - * XXX: Might want to apply some specific security attributes to the - * processes. - */ - success = CreateProcess(execPath, /* LPCSTR address of module name */ - NULL, /* LPCSTR address of command line */ - NULL, /* Process security attributes */ - NULL, /* Thread security attributes */ - TRUE, /* Inheritable Handes inherited. */ - 0, /* DWORD creation flags */ - NULL, /* Use parent environment block */ - NULL, /* Address of current directory name */ - &StartupInfo, /* Address of STARTUPINFO */ - &pInfo); /* Address of PROCESS_INFORMATION */ - if(success) { - return 0; - } else { - return -1; - } -} - -/* - *-------------------------------------------------------------- - * - * OS_AsyncReadStdin -- - * - * This initiates an asynchronous read on the standard - * input handle. This handle is not guaranteed to be - * capable of performing asynchronous I/O so we send a - * message to the StdinThread to do the synchronous read. - * - * Results: - * -1 if error, 0 otherwise. - * - * Side effects: - * Asynchronous message is queued to the StdinThread and an - * overlapped structure is allocated/initialized. - * - *-------------------------------------------------------------- - */ -int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr, - ClientData clientData) -{ - POVERLAPPED_REQUEST pOv; - - ASSERT(fdTable[STDIN_FILENO].type != FD_UNUSED); - - pOv = (POVERLAPPED_REQUEST)malloc(sizeof(struct OVERLAPPED_REQUEST)); - ASSERT(pOv); - memset((void *)pOv, 0, sizeof(struct OVERLAPPED_REQUEST)); - pOv->clientData1 = (ClientData)buf; - pOv->instance = fdTable[STDIN_FILENO].instance; - pOv->procPtr = procPtr; - pOv->clientData = clientData; - - PostQueuedCompletionStatus(hStdinCompPort, len, STDIN_FILENO, - (LPOVERLAPPED)pOv); - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_AsyncRead -- - * - * This initiates an asynchronous read on the file - * handle which may be a socket or named pipe. - * - * We also must save the ProcPtr and ClientData, so later - * when the io completes, we know who to call. - * - * We don't look at any results here (the ReadFile may - * return data if it is cached) but do all completion - * processing in OS_Select when we get the io completion - * port done notifications. Then we call the callback. - * - * Results: - * -1 if error, 0 otherwise. - * - * Side effects: - * Asynchronous I/O operation is queued for completion. - * - *-------------------------------------------------------------- - */ -int OS_AsyncRead(int fd, int offset, void *buf, int len, - OS_AsyncProc procPtr, ClientData clientData) -{ - DWORD bytesRead; - POVERLAPPED_REQUEST pOv; - - /* - * Catch any bogus fd values - */ - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - /* - * Confirm that this is an async fd - */ - ASSERT(fdTable[fd].type != FD_UNUSED); - ASSERT(fdTable[fd].type != FD_FILE_SYNC); - ASSERT(fdTable[fd].type != FD_PIPE_SYNC); - ASSERT(fdTable[fd].type != FD_SOCKET_SYNC); - - pOv = (POVERLAPPED_REQUEST)malloc(sizeof(struct OVERLAPPED_REQUEST)); - ASSERT(pOv); - memset((void *)pOv, 0, sizeof(struct OVERLAPPED_REQUEST)); - /* - * Only file offsets should be non-zero, but make sure. - */ - if (fdTable[fd].type == FD_FILE_ASYNC) - if (fdTable[fd].offset >= 0) - pOv->overlapped.Offset = fdTable[fd].offset; - else - pOv->overlapped.Offset = offset; - pOv->instance = fdTable[fd].instance; - pOv->procPtr = procPtr; - pOv->clientData = clientData; - bytesRead = fd; - /* - * ReadFile returns: TRUE success, FALSE failure - */ - if (!ReadFile(fdTable[fd].fid.fileHandle, buf, len, &bytesRead, - (LPOVERLAPPED)pOv)) { - fdTable[fd].Errno = GetLastError(); - if(fdTable[fd].Errno == ERROR_NO_DATA || - fdTable[fd].Errno == ERROR_PIPE_NOT_CONNECTED) { - PostQueuedCompletionStatus(hIoCompPort, 0, fd, (LPOVERLAPPED)pOv); - return 0; - } - if(fdTable[fd].Errno != ERROR_IO_PENDING) { - PostQueuedCompletionStatus(hIoCompPort, 0, fd, (LPOVERLAPPED)pOv); - return -1; - } - fdTable[fd].Errno = 0; - } - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_AsyncWrite -- - * - * This initiates an asynchronous write on the "fake" file - * descriptor (which may be a file, socket, or named pipe). - * We also must save the ProcPtr and ClientData, so later - * when the io completes, we know who to call. - * - * We don't look at any results here (the WriteFile generally - * completes immediately) but do all completion processing - * in OS_DoIo when we get the io completion port done - * notifications. Then we call the callback. - * - * Results: - * -1 if error, 0 otherwise. - * - * Side effects: - * Asynchronous I/O operation is queued for completion. - * - *-------------------------------------------------------------- - */ -int OS_AsyncWrite(int fd, int offset, void *buf, int len, - OS_AsyncProc procPtr, ClientData clientData) -{ - DWORD bytesWritten; - POVERLAPPED_REQUEST pOv; - - /* - * Catch any bogus fd values - */ - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - /* - * Confirm that this is an async fd - */ - ASSERT(fdTable[fd].type != FD_UNUSED); - ASSERT(fdTable[fd].type != FD_FILE_SYNC); - ASSERT(fdTable[fd].type != FD_PIPE_SYNC); - ASSERT(fdTable[fd].type != FD_SOCKET_SYNC); - - pOv = (POVERLAPPED_REQUEST)malloc(sizeof(struct OVERLAPPED_REQUEST)); - ASSERT(pOv); - memset((void *)pOv, 0, sizeof(struct OVERLAPPED_REQUEST)); - /* - * Only file offsets should be non-zero, but make sure. - */ - if (fdTable[fd].type == FD_FILE_ASYNC) - /* - * Only file opened via OS_AsyncWrite with - * O_APPEND will have an offset != -1. - */ - if (fdTable[fd].offset >= 0) - /* - * If the descriptor has a memory mapped file - * handle, take the offsets from there. - */ - if (fdTable[fd].hMapMutex != NULL) { - /* - * Wait infinitely; this *should* not cause problems. - */ - WaitForSingleObject(fdTable[fd].hMapMutex, INFINITE); - - /* - * Retrieve the shared offset values. - */ - pOv->overlapped.OffsetHigh = *(fdTable[fd].offsetHighPtr); - pOv->overlapped.Offset = *(fdTable[fd].offsetLowPtr); - - /* - * Update the shared offset values for the next write - */ - *(fdTable[fd].offsetHighPtr) += 0; /* XXX How do I handle overflow */ - *(fdTable[fd].offsetLowPtr) += len; - - ReleaseMutex(fdTable[fd].hMapMutex); - } else - pOv->overlapped.Offset = fdTable[fd].offset; - else - pOv->overlapped.Offset = offset; - pOv->instance = fdTable[fd].instance; - pOv->procPtr = procPtr; - pOv->clientData = clientData; - bytesWritten = fd; - /* - * WriteFile returns: TRUE success, FALSE failure - */ - if (!WriteFile(fdTable[fd].fid.fileHandle, buf, len, &bytesWritten, - (LPOVERLAPPED)pOv)) { - fdTable[fd].Errno = GetLastError(); - if(fdTable[fd].Errno != ERROR_IO_PENDING) { - PostQueuedCompletionStatus(hIoCompPort, 0, fd, (LPOVERLAPPED)pOv); - return -1; - } - fdTable[fd].Errno = 0; - } - if (fdTable[fd].offset >= 0) - fdTable[fd].offset += len; - return 0; -} - -/* - *-------------------------------------------------------------- - * - * OS_Close -- - * - * Closes the descriptor with routine appropriate for - * descriptor's type. - * - * Results: - * Socket or file is closed. Return values mimic Unix close: - * 0 success, -1 failure - * - * Side effects: - * Entry in fdTable is marked as free. - * - *-------------------------------------------------------------- - */ -int OS_Close(int fd) -{ - int ret = 0; - - /* - * Catch it if fd is a bogus value - */ - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - ASSERT(fdTable[fd].type != FD_UNUSED); - - switch (fdTable[fd].type) { - case FD_PIPE_SYNC: - case FD_PIPE_ASYNC: - case FD_FILE_SYNC: - case FD_FILE_ASYNC: - - break; - - case FD_SOCKET_SYNC: - case FD_SOCKET_ASYNC: - - /* - * shutdown() the send side and then read() from client until EOF - * or a timeout expires. This is done to minimize the potential - * that a TCP RST will be sent by our TCP stack in response to - * receipt of additional data from the client. The RST would - * cause the client to discard potentially useful response data. - */ - - if (shutdown(fdTable[fd].fid.sock, SD_SEND) == 0) - { - struct timeval tv; - fd_set rfds; - int sock = fdTable[fd].fid.sock; - int rv; - char trash[1024]; - - FD_ZERO(&rfds); - - do - { - FD_SET(sock, &rfds); - tv.tv_sec = 2; - tv.tv_usec = 0; - rv = select(sock + 1, &rfds, NULL, NULL, &tv); - } - while (rv > 0 && recv(sock, trash, sizeof(trash), 0) > 0); - } - - closesocket(fdTable[fd].fid.sock); - - break; - - default: - - ret = -1; /* fake failure */ - } - - Win32FreeDescriptor(fd); - return ret; -} - -/* - *-------------------------------------------------------------- - * - * OS_CloseRead -- - * - * Cancel outstanding asynchronous reads and prevent subsequent - * reads from completing. - * - * Results: - * Socket or file is shutdown. Return values mimic Unix shutdown: - * 0 success, -1 failure - * - *-------------------------------------------------------------- - */ -int OS_CloseRead(int fd) -{ - int ret = 0; - - /* - * Catch it if fd is a bogus value - */ - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - ASSERT(fdTable[fd].type == FD_SOCKET_ASYNC - || fdTable[fd].type == FD_SOCKET_SYNC); - - if (shutdown(fdTable[fd].fid.sock,0) == SOCKET_ERROR) - ret = -1; - return ret; -} - -/* - *-------------------------------------------------------------- - * - * OS_DoIo -- - * - * This function was formerly OS_Select. It's purpose is - * to pull I/O completion events off the queue and dispatch - * them to the appropriate place. - * - * Results: - * Returns 0. - * - * Side effects: - * Handlers are called. - * - *-------------------------------------------------------------- - */ -int OS_DoIo(struct timeval *tmo) -{ - unsigned long fd; - unsigned long bytes; - POVERLAPPED_REQUEST pOv; - struct timeb tb; - int ms; - int ms_last; - int err; - - /* XXX - * We can loop in here, but not too long, as wait handlers - * must run. - * For cgi stdin, apparently select returns when io completion - * ports don't, so don't wait the full timeout. - */ - if(tmo) - ms = (tmo->tv_sec*1000 + tmo->tv_usec/1000) / 2; - else - ms = 1000; - ftime(&tb); - ms_last = tb.time*1000 + tb.millitm; - while (ms >= 0) { - if(tmo && (ms = tmo->tv_sec*1000 + tmo->tv_usec/1000)> 100) - ms = 100; - if (!GetQueuedCompletionStatus(hIoCompPort, &bytes, &fd, - (LPOVERLAPPED *)&pOv, ms) && !pOv) { - err = WSAGetLastError(); - return 0; /* timeout */ - } - - ASSERT((fd >= 0) && (fd < WIN32_OPEN_MAX)); - /* call callback if descriptor still valid */ - ASSERT(pOv); - if(pOv->instance == fdTable[fd].instance) - (*pOv->procPtr)(pOv->clientData, bytes); - free(pOv); - - ftime(&tb); - ms -= (tb.time*1000 + tb.millitm - ms_last); - ms_last = tb.time*1000 + tb.millitm; - } - return 0; -} - -static int isAddrOK(struct sockaddr_in * inet_sockaddr, const char * okAddrs) -{ - static const char *token = " ,;:\t"; - char *ipaddr; - char *p; - - if (okAddrs == NULL) return TRUE; - - ipaddr = inet_ntoa(inet_sockaddr->sin_addr); - p = strstr(okAddrs, ipaddr); - - if (p == NULL) return FALSE; - - if (p == okAddrs) - { - p += strlen(ipaddr); - return (strchr(token, *p) != NULL); - } - - if (strchr(token, *--p) != NULL) - { - p += strlen(ipaddr) + 1; - return (strchr(token, *p) != NULL); - } - - return FALSE; -} - -#ifndef NO_WSAACEPT -static int CALLBACK isAddrOKCallback(LPWSABUF lpCallerId, - LPWSABUF dc0, - LPQOS dc1, - LPQOS dc2, - LPWSABUF dc3, - LPWSABUF dc4, - GROUP *dc5, - DWORD data) -{ - struct sockaddr_in *sockaddr = (struct sockaddr_in *) lpCallerId->buf; - - // Touch the args to avoid warnings - dc0 = NULL; dc1 = NULL; dc2 = NULL; dc3 = NULL; dc4 = NULL; dc5 = NULL; - - if ((void *) data == NULL) return CF_ACCEPT; - - if (sockaddr->sin_family != AF_INET) return CF_ACCEPT; - - return isAddrOK(sockaddr, (const char *) data) ? CF_ACCEPT : CF_REJECT; -} -#endif - -static void printLastError(const char * text) -{ - LPVOID buf; - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - 0, - (LPTSTR) &buf, - 0, - NULL - ); - - fprintf(stderr, "%s: %s\n", text, (LPCTSTR) buf); - LocalFree(buf); -} - -static int acceptNamedPipe() -{ - int ipcFd = -1; - - if (! ConnectNamedPipe(hListen, NULL)) - { - switch (GetLastError()) - { - case ERROR_PIPE_CONNECTED: - - // A client connected after CreateNamedPipe but - // before ConnectNamedPipe. Its a good connection. - - break; - - case ERROR_IO_PENDING: - - // The NamedPipe was opened with an Overlapped structure - // and there is a pending io operation. mod_fastcgi - // did this in 2.2.12 (fcgi_pm.c v1.52). - - case ERROR_PIPE_LISTENING: - - // The pipe handle is in nonblocking mode. - - case ERROR_NO_DATA: - - // The previous client closed its handle (and we failed - // to call DisconnectNamedPipe) - - default: - - printLastError("unexpected ConnectNamedPipe() error"); - } - } - - ipcFd = Win32NewDescriptor(FD_PIPE_SYNC, (int) hListen, -1); - if (ipcFd == -1) - { - DisconnectNamedPipe(hListen); - } - - return ipcFd; -} - -static int acceptSocket(const char *webServerAddrs) -{ - SOCKET hSock; - int ipcFd = -1; - - for (;;) - { - struct sockaddr sockaddr; - int sockaddrLen = sizeof(sockaddr); - - for (;;) - { - const struct timeval timeout = {1, 0}; - fd_set readfds; - - FD_ZERO(&readfds); - -#pragma warning( disable : 4127 ) - FD_SET((unsigned int) hListen, &readfds); -#pragma warning( default : 4127 ) - - if (select(0, &readfds, NULL, NULL, &timeout) == 0) - { - if (shutdownPending) - { - OS_LibShutdown(); - return -1; - } - } - else - { - break; - } - } - -#if NO_WSAACEPT - hSock = accept((SOCKET) hListen, &sockaddr, &sockaddrLen); - - if (hSock == INVALID_SOCKET) - { - break; - } - - if (isAddrOK((struct sockaddr_in *) &sockaddr, webServerAddrs)) - { - break; - } - - closesocket(hSock); -#else - hSock = WSAAccept((unsigned int) hListen, - &sockaddr, - &sockaddrLen, - isAddrOKCallback, - (DWORD) webServerAddrs); - - if (hSock != INVALID_SOCKET) - { - break; - } - - if (WSAGetLastError() != WSAECONNREFUSED) - { - break; - } -#endif - } - - if (hSock == INVALID_SOCKET) - { - /* Use FormatMessage() */ - fprintf(stderr, "accept()/WSAAccept() failed: %d", WSAGetLastError()); - return -1; - } - - ipcFd = Win32NewDescriptor(FD_SOCKET_SYNC, hSock, -1); - if (ipcFd == -1) - { - closesocket(hSock); - } - - return ipcFd; -} - -/* - *---------------------------------------------------------------------- - * - * OS_Accept -- - * - * Accepts a new FastCGI connection. This routine knows whether - * we're dealing with TCP based sockets or NT Named Pipes for IPC. - * - * fail_on_intr is ignored in the Win lib. - * - * Results: - * -1 if the operation fails, otherwise this is a valid IPC fd. - * - *---------------------------------------------------------------------- - */ -int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs) -{ - int ipcFd = -1; - - // Touch args to prevent warnings - listen_sock = 0; fail_on_intr = 0; - - // @todo Muliple listen sockets and sockets other than 0 are not - // supported due to the use of globals. - - if (shutdownPending) - { - OS_LibShutdown(); - return -1; - } - - // The mutex is to keep other processes (and threads, when supported) - // from going into the accept cycle. The accept cycle needs to - // periodically break out to check the state of the shutdown flag - // and there's no point to having more than one thread do that. - - if (acceptMutex != INVALID_HANDLE_VALUE) - { - if (WaitForSingleObject(acceptMutex, INFINITE) == WAIT_FAILED) - { - printLastError("WaitForSingleObject() failed"); - return -1; - } - } - - if (shutdownPending) - { - OS_LibShutdown(); - } - else if (listenType == FD_PIPE_SYNC) - { - ipcFd = acceptNamedPipe(); - } - else if (listenType == FD_SOCKET_SYNC) - { - ipcFd = acceptSocket(webServerAddrs); - } - else - { - fprintf(stderr, "unknown listenType (%d)\n", listenType); - } - - if (acceptMutex != INVALID_HANDLE_VALUE) - { - ReleaseMutex(acceptMutex); - } - - return ipcFd; -} - -/* - *---------------------------------------------------------------------- - * - * OS_IpcClose - * - * OS IPC routine to close an IPC connection. - * - * Results: - * - * - * Side effects: - * IPC connection is closed. - * - *---------------------------------------------------------------------- - */ -int OS_IpcClose(int ipcFd) -{ - if (ipcFd == -1) return 0; - - /* - * Catch it if fd is a bogus value - */ - ASSERT((ipcFd >= 0) && (ipcFd < WIN32_OPEN_MAX)); - ASSERT(fdTable[ipcFd].type != FD_UNUSED); - - switch (listenType) - { - case FD_PIPE_SYNC: - /* - * Make sure that the client (ie. a Web Server in this case) has - * read all data from the pipe before we disconnect. - */ - if (! FlushFileBuffers(fdTable[ipcFd].fid.fileHandle)) return -1; - - if (! DisconnectNamedPipe(fdTable[ipcFd].fid.fileHandle)) return -1; - - /* fall through */ - - case FD_SOCKET_SYNC: - - OS_Close(ipcFd); - break; - - case FD_UNUSED: - default: - - exit(106); - break; - } - - return 0; -} - -/* - *---------------------------------------------------------------------- - * - * OS_IsFcgi -- - * - * Determines whether this process is a FastCGI process or not. - * - * Results: - * Returns 1 if FastCGI, 0 if not. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ -int OS_IsFcgi(int sock) -{ - // Touch args to prevent warnings - sock = 0; - - /* XXX This is broken for sock */ - - return (listenType != FD_UNUSED); -} - -/* - *---------------------------------------------------------------------- - * - * OS_SetFlags -- - * - * Sets selected flag bits in an open file descriptor. Currently - * this is only to put a SOCKET into non-blocking mode. - * - *---------------------------------------------------------------------- - */ -void OS_SetFlags(int fd, int flags) -{ - unsigned long pLong = 1L; - int err; - - if (fdTable[fd].type == FD_SOCKET_SYNC && flags == O_NONBLOCK) { - if (ioctlsocket(fdTable[fd].fid.sock, FIONBIO, &pLong) == - SOCKET_ERROR) { - exit(WSAGetLastError()); - } - if (!CreateIoCompletionPort((HANDLE)fdTable[fd].fid.sock, - hIoCompPort, fd, 1)) { - err = GetLastError(); - exit(err); - } - - fdTable[fd].type = FD_SOCKET_ASYNC; - } - return; -} - -#pragma warning(pop) \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/ltmain.sh b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/ltmain.sh deleted file mode 100644 index 5959c479b0e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/ltmain.sh +++ /dev/null @@ -1,4946 +0,0 @@ -# ltmain.sh - Provide generalized library-building support services. -# NOTE: Changing this file will not affect anything until you rerun configure. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Check that we have a working $echo. -if test "X$1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$0" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" - -# Parse our command line options once, thoroughly. -while test $# -gt 0 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - execute_dlfiles="$execute_dlfiles $arg" - ;; - *) - eval "$prev=\$arg" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - exit 0 - ;; - - --config) - sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0 - exit 0 - ;; - - --debug) - echo "$progname: enabling shell trace mode" - set -x - ;; - - --dry-run | -n) - run=: - ;; - - --features) - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - exit 0 - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --quiet | --silent) - show=: - ;; - - -dlopen) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 -fi - -if test -z "$show_help"; then - - # Infer the operation mode. - if test -z "$mode"; then - case $nonopt in - *cc | *++ | gcc* | *-gcc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - prev= - lastarg= - srcfile="$nonopt" - suppress_output= - - user_target=no - for arg - do - case $prev in - "") ;; - xcompiler) - # Aesthetically quote the previous argument. - prev= - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - - case $arg in - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; - esac - - # Accept any command-line options. - case $arg in - -o) - if test "$user_target" != "no"; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit 1 - fi - user_target=next - ;; - - -static) - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - lastarg="$lastarg $arg" - done - IFS="$save_ifs" - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - - # Add the arguments to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - continue - ;; - esac - - case $user_target in - next) - # The next one is the -o target name - user_target=yes - continue - ;; - yes) - # We got the output file - user_target=set - libobj="$arg" - continue - ;; - esac - - # Accept the current argument as the source file. - lastarg="$srcfile" - srcfile="$arg" - - # Aesthetically quote the previous argument. - - # Backslashify any backslashes, double quotes, and dollar signs. - # These are the only characters that are still specially - # interpreted inside of double-quoted scrings. - lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` - - # Double-quote args containing other shell metacharacters. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - case $lastarg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" - ;; - esac - - # Add the previous argument to base_compile. - if test -z "$base_compile"; then - base_compile="$lastarg" - else - base_compile="$base_compile $lastarg" - fi - done - - case $user_target in - set) - ;; - no) - # Get the name of the library object. - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` - ;; - *) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit 1 - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - xform='[cCFSfmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.asm) xform=asm ;; - *.c++) xform=c++ ;; - *.cc) xform=cc ;; - *.cpp) xform=cpp ;; - *.cxx) xform=cxx ;; - *.f90) xform=f90 ;; - *.for) xform=for ;; - esac - - libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - exit 1 - ;; - esac - - if test -z "$base_compile"; then - $echo "$modename: you must specify a compilation command" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $libobj" - else - removelist="$libobj" - fi - - $run $rm $removelist - trap "$run $rm $removelist; exit 1" 1 2 15 - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit 1" 1 2 15 - else - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $run ln "$0" "$lockfile" 2>/dev/null; do - $show "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - echo "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - echo $srcfile > "$lockfile" - fi - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $srcfile $pic_flag -DPIC" - else - # Don't build PIC code - command="$base_compile $srcfile" - fi - if test "$build_old_libs" = yes; then - lo_libobj="$libobj" - dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$libobj"; then - dir="$objdir" - else - dir="$dir/$objdir" - fi - libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - - if test -d "$dir"; then - $show "$rm $libobj" - $run $rm $libobj - else - $show "$mkdir $dir" - $run $mkdir $dir - status=$? - if test $status -ne 0 && test ! -d $dir; then - exit $status - fi - fi - fi - if test "$compiler_o_lo" = yes; then - output_obj="$libobj" - command="$command -o $output_obj" - elif test "$compiler_c_o" = yes; then - output_obj="$obj" - command="$command -o $output_obj" - fi - - $run $rm "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - test -n "$output_obj" && $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then - echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed, then go on to compile the next one - if test x"$output_obj" != x"$libobj"; then - $show "$mv $output_obj $libobj" - if $run $mv $output_obj $libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # If we have no pic_flag, then copy the object into place and finish. - if (test -z "$pic_flag" || test "$pic_mode" != default) && - test "$build_old_libs" = yes; then - # Rename the .lo from within objdir to obj - if test -f $obj; then - $show $rm $obj - $run $rm $obj - fi - - $show "$mv $libobj $obj" - if $run $mv $libobj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` - libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - # Now arrange that obj and lo_libobj become the same file - $show "(cd $xdir && $LN_S $baseobj $libobj)" - if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then - exit 0 - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Allow error messages only from the first compilation. - suppress_output=' >/dev/null 2>&1' - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $srcfile" - else - # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $srcfile $pic_flag -DPIC" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - output_obj="$obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - $run $rm "$output_obj" - $show "$command" - if $run eval "$command"; then : - else - $run $rm $removelist - exit 1 - fi - - if test "$need_locks" = warn && - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then - echo "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit 1 - fi - - # Just move the object if needed - if test x"$output_obj" != x"$obj"; then - $show "$mv $output_obj $obj" - if $run $mv $output_obj $obj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - - # Create an invalid libtool object if no PIC, so that we do not - # accidentally link it into a program. - if test "$build_libtool_libs" != yes; then - $show "echo timestamp > $libobj" - $run eval "echo timestamp > \$libobj" || exit $? - else - # Move the .lo from within objdir - $show "$mv $libobj $lo_libobj" - if $run $mv $libobj $lo_libobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - fi - fi - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - $run $rm "$lockfile" - fi - - exit 0 - ;; - - # libtool link mode - link | relink) - modename="$modename: link" - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invokation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args="$nonopt" - compile_command="$nonopt" - finalize_command="$nonopt" - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - - avoid_version=no - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -all-static | -static) - if test "X$arg" = "X-all-static"; then - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test $# -gt 0; do - arg="$1" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit 1 - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - finalize_command="$finalize_command $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n $prev - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit 1 - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit 1 - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -o) prev=output ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit 1 - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.lo | *.$objext) - # A library or standard object. - if test "$prev" = dlfiles; then - # This file was specified with -dlopen. - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $arg" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` - prev= - else - case $arg in - *.lo) libobjs="$libobjs $arg" ;; - *) objs="$objs $arg" ;; - esac - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - libs="$libs $deplib" - done - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit 1 - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test $linkmode = prog; then - # Determine which files to process - case $pass in - dlopen) - libs="$dlfiles" - save_deplibs="$deplibs" # Collect dlpreopened libraries - deplibs= - ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -l*) - if test $linkmode = oldlib && test $linkmode = obj; then - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2 - continue - fi - if test $pass = conv; then - deplibs="$deplib $deplibs" - continue - fi - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - ;; # -l - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test $pass = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test $pass = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test $pass = scan; then - deplibs="$deplib $deplibs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test $pass = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test $pass = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - if test "$deplibs_check_method" != pass_all; then - echo - echo "*** Warning: This library needs some functionality provided by $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - else - echo - echo "*** Warning: Linking the shared library $output against the" - echo "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test $pass != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test $found = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test $linkmode = oldlib && test $linkmode = obj; }; then - # Add dl[pre]opened files of deplib - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test $pass = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - tmp_libs="$tmp_libs $deplib" - done - elif test $linkmode != prog && test $linkmode != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - exit 1 - fi - continue - fi # $pass = conv - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - # This library was specified with -dlopen. - if test $pass = dlopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. - dlprefiles="$dlprefiles $lib" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi # $installed = yes - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - # This library was specified with -dlpreopen. - if test $pass = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit 1 - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test $linkmode = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" - fi - continue - fi - - if test $linkmode = prog && test $pass != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test $linkalldeplibs = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - link_static=no # Whether the deplib will be linked statically - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # Link against this shared library - - if test "$linkmode,$pass" = "prog,link" || - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - if test $linkmode = prog; then - # We need to hardcode the library path - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - fi - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - soname=`echo $soroot | sed -e 's/^.*\///'` - newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n $old_archive_from_expsyms_cmds - - if test $linkmode = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test $linkmode = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test $linkmode = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - add="-l$name" - fi - - if test $linkmode = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test $linkmode = prog; then - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - - # Try to link the static library - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - echo "*** Warning: This library needs some functionality provided by $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** Therefore, libtool will create a static module, that should work " - echo "*** as long as the dlopening application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test $linkmode = lib; then - if test -n "$dependency_libs" && - { test $hardcode_into_libs != yes || test $build_old_libs = yes || - test $link_static = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - tmp_libs="$tmp_libs $deplib" - done - - if test $link_all_deplibs != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="-L$absdir/$objdir" - else - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - path="-L$absdir" - fi - ;; - *) continue ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$deplibs $path" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test $pass = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test $pass != dlopen; then - test $pass != scan && dependency_libs="$newdependency_libs" - if test $pass != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - *) - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - if test "$pass" = "conv" && - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then - libs="$deplibs" # reset libs - deplibs= - fi - done # for pass - if test $linkmode = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 - exit 1 - else - echo - echo "*** Warning: Linking the shared library $output against the non-libtool" - echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - libext=al - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - current="$2" - revision="$3" - age="$4" - - # Check that each of the things are valid numbers. - case $current in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $revision in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - case $age in - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - esac - - if test $age -gt $current; then - $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix) - major=`expr $current - $age + 1` - verstring="sgi$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test $loop != 0; do - iface=`expr $revision - $loop` - loop=`expr $loop - 1` - verstring="sgi$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test $loop != 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $echo "$modename: unknown library version type \`$version_type'" 1>&2 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit 1 - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - verstring="0.0" - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs. - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - for path in $notinst_path; do - lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` - deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test $build_libtool_need_lc = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | sed 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | sed 10q \ - | egrep "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name="`expr $a_deplib : '-l\(.*\)'`" - # If $name is empty we are operating on a -L argument. - if test -n "$name" && test "$name" != "0"; then - libname=`eval \\$echo \"$libname_spec\"` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - if eval echo \"$potent_lib\" 2>/dev/null \ - | sed 10q \ - | egrep "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - echo "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test $allow_undefined = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test $hardcode_into_libs = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - test -z "$dlname" && dlname=$soname - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - ;; - - prog) - case $host in - *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;; - esac - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" - $run $rm $export_symbols - $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' - $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' - $run eval 'mv "$nlist"T "$nlist"' - fi - fi - - for arg in $dlprefiles; do - $show "extracting global C symbols from \`$arg'" - name=`echo "$arg" | sed -e 's%^.*/%%'` - $run eval 'echo ": $name " >> "$nlist"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[] = -{\ -" - - sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ - -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ - < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr_t) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DPIC";; - esac - esac - - # Now compile the dynamic symbol file. - $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? - - # Clean up the generated files. - $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit 1 - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test $need_relink = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit 0 - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="cd `pwd`; $relink_command" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - if test "X$echo" = "X$SHELL $0 --fallback-echo"; then - case $0 in - [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; - *) qecho="$SHELL `pwd`/$0 --fallback-echo";; - esac - qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` - else - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`echo $output|sed 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) exeext=.exe ;; - *) exeext= ;; - esac - $rm $output - trap "$rm $output; exit 1" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if (eval \$relink_command); then : - else - $rm \"\$progdir/\$file\" - exit 1 - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # win32 systems need to use the prog path for dll - # lookup to work - *-*-cygwin* | *-*-pw32*) - $echo >> $output "\ - exec \$progdir/\$program \${1+\"\$@\"} -" - ;; - - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \$progdir\\\\\$program \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - # Export the path to the program. - PATH=\"\$progdir:\$PATH\" - export PATH - - exec \$program \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit 1 - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" - chmod +x $output - fi - exit 0 - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - case $xlib in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - eval cmds=\"$old_archive_from_new_cmds\" - else - # Ensure that we have .o objects in place in case we decided - # not to build a shared library, and have fallen back to building - # static libs even though --disable-static was passed! - for oldobj in $oldobjs; do - if test ! -f $oldobj; then - xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$oldobj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` - obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` - $show "(cd $xdir && ${LN_S} $obj $baseobj)" - $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? - fi - done - - eval cmds=\"$old_archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - - # Only create the output if not a dry run. - if test -z "$run"; then - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - if test -z "$libdir"; then - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - newdlprefiles="$newdlprefiles $libdir/$name" - done - dlprefiles="$newdlprefiles" - fi - $rm $output - # place dlname in correct position for cygwin - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test $need_relink = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit 0 - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then - # Aesthetically quote it. - arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg="$nonopt" - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest="$arg" - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) prev="-f" ;; - -g) prev="-g" ;; - -m) prev="-m" ;; - -o) prev="-o" ;; - -s) - stripme=" -s" - continue - ;; - -*) ;; - - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - prev= - else - dest="$arg" - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit 1 - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test $# -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - if test -n "$relink_command"; then - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - continue - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test $# -gt 0; then - # Delete the old symlinks, and create new ones. - for linkname - do - if test "$linkname" != "$realname"; then - $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" - fi - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - eval cmds=\"$postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit 0 - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - notinst_deplibs= - relink_command= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Check the variables that should have been set. - if test -z "$notinst_deplibs"; then - $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 - exit 1 - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - done - - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : - else - $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 - continue - fi - file=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyways - case $install_prog,$host in - /usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`echo $destfile | sed -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - if test -n "$stripme" && test -n "$striplib"; then - $show "$old_striplib $oldlib" - $run eval "$old_striplib $oldlib" || exit $? - fi - - # Do each command in the postinstall commands. - eval cmds=\"$old_postinstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec $SHELL $0 --finish$current_libdirs - exit 1 - fi - - exit 0 - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - eval cmds=\"$finish_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || admincmds="$admincmds - $cmd" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = ":" && exit 0 - - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - echo " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - echo "See any operating system documentation about shared libraries for" - echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "----------------------------------------------------------------------" - exit 0 - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit 1 - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit 1 - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved enviroment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now actually exec the command. - eval "exec \$cmd$args" - - $echo "$modename: cannot exec \$cmd$args" - exit 1 - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit 0 - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - - rmdirs= - - for file in $files; do - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - if test "X$dir" = "X$file"; then - dir=. - objdir="$objdir" - else - objdir="$dir/$objdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test $mode = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test $mode = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test $mode = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - eval cmds=\"$postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - eval cmds=\"$old_postuninstall_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" - if test $? != 0 && test "$rmforce" != yes; then - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - if test "$build_old_libs" = yes; then - oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` - rmfiles="$rmfiles $dir/$oldobj" - fi - ;; - - *) - # Do a test to see if this is a libtool program. - if test $mode = clean && - (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - relink_command= - . $dir/$file - - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - fi - ;; - esac - $show "$rm $rmfiles" - $run $rm $rmfiles || exit_status=1 - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 - ;; - esac - - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit 1 -fi # test -z "$show_help" - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE." - exit 0 - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit 1 - ;; -esac - -echo -$echo "Try \`$modename --help' for more information about other modes." - -exit 0 - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/missing b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/missing deleted file mode 100644 index 0a7fb5a2ace..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/missing +++ /dev/null @@ -1,283 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing 0.3 - GNU automake" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then - # We have makeinfo, but it failed. - exit 1 - fi - - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - tar) - shift - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - fi - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar ${1+"$@"} && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar ${1+"$@"} && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" ${1+"$@"} && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" ${1+"$@"} && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/mkinstalldirs b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/mkinstalldirs deleted file mode 100644 index f7928c7f661..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1 2001/09/21 15:05:21 skimo Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/ChangeLog b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/ChangeLog deleted file mode 100644 index bb5046be811..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/ChangeLog +++ /dev/null @@ -1,229 +0,0 @@ -Version 0.67 -- 22 December 2002 Sven Verdoolaege - - o Fixes for pure perl version based on report and patch - from "Kurtis D. Rader" - o FCGI_UndoBinding perl 5.8.0 compatibility - Reported by Marko Asplund - o Fix problem with fcgi_config.h on win32. - Reported by Igor Franchuk - o Add minimal tests - -Version 0.66 -- 5 September 2002 Sven Verdoolaege - - o perl 5.8.0 compatibility fix by Autrijus - o library fixes from Rob - -Version 0.65 -- 19 February 2002 Sven Verdoolaege - - o fix perl 5.005 compatibility problem - o fix strict warning - -Version 0.64 -- 25 September 2001 Sven Verdoolaege -Version 0.63 -- 24 September 2001 Sven Verdoolaege - - o Update build process - -Version 0.62 -- 21 September 2001 Sven Verdoolaege - - o Move version number to separate file - -Version 0.61 -- 20 September 2001 Sven Verdoolaege - - o Fix refcounting bug - o Add GetEnvironment for pure version - o Add LastCall method - o Allow filehandle for Request's socket parameter - o library fixes ("Rob Saccoccio" ) - -Version 0.60 -- 8 July 2001 Sven Verdoolaege - - o Allow specification of purity on command line - (suggested by Rob Brown ) - o Fix bug in pure perl implementation - o Don't try to compile anything on pure perl build - o Add BINMODE method - o Add comment on socket permissions - -Version 0.59 -- 31 December 2000 Sven Verdoolaege - - o preliminary pure perl implementation - o copy win32 configuration file instead of moving it - o convert echo.fpl to new interface - -Version 0.58 -- 15 November 2000 Sven Verdoolaege - - o fix bug introduced in 0.57 - -Version 0.57 -- 12 November 2000 Sven Verdoolaege - - o don't flush unbound request - -Version 0.56 -- 3 November 2000 Sven Verdoolaege - - o add example remote.fpl - o provide access to the Request parameters - o add IsFastCGI method - o fix warn handler (Andrew Pimlott ) - -Version 0.55 -- 18 October 2000 Sven Verdoolaege - - o small documentation fix - o compilation issues with older perls fixed - o library initialization when using sockets fixed - -Version 0.54 -- 8 October 2000 Sven Verdoolaege - - o library fixes ("Rob Saccoccio" ) - o compilation issues with newer gcc - o completely untested OPEN and READLINE methods - -Version 0.53 -- 10 July 2000 Sven Verdoolaege - - o sfio version compiles again - -Version 0.52 -- 12 April 2000 Sven Verdoolaege - -Version 0.51 -- 12 April 2000 Sven Verdoolaege - -Version 0.50 -- 10 April 2000 Sven Verdoolaege - -Version 0.49 -- 9 April 2000 Sven Verdoolaege - - o General clean-ups - o Allow attaching/detaching - o Changed DESTROY behaviour - o Fixed default warn/die handler of old interface - o Document new interface - -Version 0.48 -- 27 August 1999 Sven Verdoolaege - - o perl 5.005_60 compatibility - o locking on platforms that need it - o support for remote connections - -Version 0.47 -- 31 July 1999 Sven Verdoolaege - - o move PRINTF into correct package - o deprecated set_exit_status - o general cleanup, moving old non thread safe interface - from xs to perl - -Version 0.46 -- 30 July 1999 Sven Verdoolaege - - o new thread safe interface - o new threaded example program - -Version 0.45 -- 8 March 1999 Sven Verdoolaege - - o FCGI.pm now part of the devel kit - o library fixes ("Rob Saccoccio" ) - o allow bypassing of installation of handlers - o ActivePerl compatibility (Murray Nesbitt ) - -Version 0.43 -- 22 December 1998 Sven Verdoolaege - - o POST on bigendians (Paul GABORIT ) - o Some win32 changes (Monty ) - o library fixes ("Rob Saccoccio" ) - -Version 0.42 -- 28 August 1998 Sven Verdoolaege - - o environ fixes ? - o print NULLs (Ken Alexander ) - o PRINTF support - o set version in FCGI.pm - o library fixes ("Rob Saccoccio" ) - -Version 0.41 -- 29 July 1998 Sven Verdoolaege - - o Compiles with perl 5.005 - -Version 0.40 -- 15 July 1998 Sven Verdoolaege - - o Added default die hook - o Minimal documentation - -Version 0.39 -- 3 July 1998 Sven Verdoolaege - - o Fixed read bug - -Version 0.38 -- 28 June 1998 Sven Verdoolaege - - o Fixed flush bug - o Added default warn hook - -Version 0.37 -- 27 June 1998 Sven Verdoolaege - - o More support for tied handles - o Added flush function - -Version 0.36 -- 23 June 1998 Sven Verdoolaege - - o More support for tied handles (GETC and autoflushing) - -Version 0.35 -- 22 June 1998 Sven Verdoolaege - - o Added forgotten typemap - -Version 0.34 -- 17 June 1998 Sven Verdoolaege - - o No longer force sfio less compile - o Update os_unix.c from fcgi2.0b2.1 - o Small documentation changes - -Version 0.33 -- 16 June 1998 Sven Verdoolaege - - o More support for tied handles - -Version 0.32 -- 16 June 1998 Sven Verdoolaege - - o Preliminary support for tied handles (doesn't require sfio) - o Force sfio less compile - o Changed protoype of set_exit_status - -Version 0.31 -- 13 July 1997 Sven Verdoolaege - - o Applied solaris accept patch from - Chip Salzenberg - o Preliminary support glibc's cookie mechanism - -Version 0.30 -- 24 June 1997 Sven Verdoolaege - - o Added forgotten library files - -Version 0.29 -- 10 June 1997 Sven Verdoolaege - - o Updated library files from fastcgi 2.02b - o Use installed library/include file if found - -Version 0.28 -- 24 February 1997 Sven Verdoolaege - - o Intialization of %ENV did not change environ. Fixed. - Problem reported by Jan Drehmer - -Version 0.26 -- 19 February 1997 Sven Verdoolaege - - o Flush output when $| is set to eliminate a problem reported - by echo@echo.cica.fr - -Version 0.25 -- 13 October 1996 Sven Verdoolaege - - o Eliminate some warnings - o Check whether perl is compiled with sfio support - -Version 0.25 -- 25 September 1996 Sven Verdoolaege - - o First public release - o Additional bugfixes - -Version 0.21 -- 20 September 1996 Sven Verdoolaege - - o Bugfix - -Version 0.2 -- 19 September 1996 Sven Verdoolaege - - o First Version based on sfio - -Version 0.1 -- 12 June 1996 - - o Original version from Open Market's FastCGI Developer's Kit diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/FCGI.PL b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/FCGI.PL deleted file mode 100644 index b1b4dfc5dfc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/FCGI.PL +++ /dev/null @@ -1,570 +0,0 @@ -use Config; -use ExtUtils::MakeMaker; - -do 'FCGI.cfg' or die "no FCGI.cfg"; - -open OUT, ">FCGI.pm"; - -print "Generating FCGI.pm\n"; -print OUT <<'EOP'; -# $Id: FCGI.PL,v 1.37 2002/12/15 20:02:48 skimo Exp $ - -package FCGI; - -require Exporter; -require DynaLoader; - -@ISA = qw(Exporter DynaLoader); -# Items to export into callers namespace by default. Note: do not export -# names by default without a very good reason. Use EXPORT_OK instead. -# Do not simply export all your public functions/methods/constants. -@EXPORT = qw( - -); - -EOP - -print OUT '$VERSION = '.MM->parse_version('version.pm').";\n\n"; - -print OUT "bootstrap FCGI;\n" unless ($pure); - -print OUT <<'EOP' if ($pure); -use Symbol; -use POSIX 'ENOTCONN'; - -use constant VERSION_1 => 1; - -use constant BEGIN_REQUEST => 1; -use constant PARAMS => 4; -use constant FCGI_STDIN => 5; -use constant FCGI_STDOUT => 6; -use constant FCGI_STDERR => 7; - -use constant RESPONDER => 1; -use constant AUTHORIZER => 2; -use constant FILTER => 3; - -%FCGI::rolenames = (RESPONDER, "RESPONDER", - AUTHORIZER, "AUTHORIZER", - FILTER, "FILTER", - ); - -# This only works on Unix; anyone familiar with Windows is welcome -# to give a hand here -sub IsFastCGI { - my ($req) = @_; - $req->{isfastcgi} = - (!defined getpeername shift->{listen_sock}) && $! == ENOTCONN - unless exists $req->{isfastcgi}; - return $req->{isfastcgi}; -} - -sub GetEnvironment { - return shift->{'env'}; -} - -sub read_nv_len { - my ($stream) = @_; - my $buf; - return undef unless read $stream, $buf, 1, 0; - my ($len) = unpack("C", $buf); - if ($len & 0x80) { - $buf = pack("C", $len & 0x7F); - return undef unless read $stream, $buf, 3, 1; - $len = unpack("N", $buf); - } - $len; -} - -sub RequestX { - my $self = { - in => shift, - out => shift, - err => shift, - env => shift, - socket => shift, - flags => shift, - last => 0, - }; - open $self->{listen_sock}, "<&=0"; - bless $self, "FCGI"; -} - -my $run_once = 0; - -sub Accept { - my ($req) = @_; - - unless ($req->IsFastCGI()) { - return -1 if $run_once; - - $run_once = 1; - return 0; - } - $req->Finish(); - $req->{socket} = gensym(); - if ($req->{last} || !accept($req->{socket}, $req->{listen_sock})) { - $req->{error} = "accept"; - return -1; - } - my ($type, $id, $body) = $req->read_record(); - if ($type != BEGIN_REQUEST) { - $req->{error} = "begin request"; - return -1; - } - my ($role, $flags) = unpack("nC", $body); - $req->{role} = $role; - $req->{flags} = $flags; - $req->{id} = $id; - - %{$req->{env}} = (); - $req->{env}{FCGI_ROLE} = $FCGI::rolenames{$req->{role}}; - my $param = FCGI::Stream->new($req, PARAMS); - my ($nlen, $vlen); - while (defined($nlen = read_nv_len($param)) && - defined($vlen = read_nv_len($param))) { - my ($name, $val); - read $param, $name, $nlen; - read $param, $val, $vlen; - $req->{env}{$name} = $val; - } - $req->Bind; - $req->{accepted} = 1; - - return 0; -} - -sub UndoBindings { - my ($req) = @_; - untie ${$req->{in}}; - untie ${$req->{out}}; - untie ${$req->{err}}; - $req->{bound} = 0; -} - -sub Bind { - my ($req) = @_; - tie ${$req->{in}}, 'FCGI::Stream', $req, FCGI_STDIN; - tie ${$req->{out}}, 'FCGI::Stream', $req, FCGI_STDOUT; - tie ${$req->{err}}, 'FCGI::Stream', $req, FCGI_STDERR; - $req->{bound} = 1; -} - -sub Attach { - my ($req) = @_; - $req->Bind() if ($req->{accepted} && !$req->{bound}); -} - -sub Detach { - my ($req) = @_; - $req->UndoBindings() if ($req->{accepted} && $req->{bound}); -} - -sub Finish { - my ($req) = @_; - return unless $req->{accepted}; - if ($req->{bound}) { - $req->UndoBindings(); - # apparently these are harmful - # close ${$req->{out}}; - # close ${$req->{err}}; - } - $req->{accepted} = 0; -} - -sub LastCall { - shift->{last} = 1; -} - -sub DESTROY { - shift->Finish(); -} - -sub read_record { - my ($self) = @_; - my ($header, $body); - - read($self->{socket}, $header, 8); - my ($version, $type, $id, $clen, $plen) = unpack("CCnnC", $header); - read($self->{socket}, $body, $clen+$plen); - $body = undef if $clen == 0; - ($type, $id, $body); -} - -sub read { - my ($self, $rtype, $len) = @_; - while (length $self->{buf} < $len) { - my ($type, $id, $buf) = $self->read_record(); - return undef unless defined $buf; - if ($type != $rtype) { - $self->{error} = "unexpected stream type"; - return 0; - } - $self->{buf} .= $buf; - } - my ($newbuf, $result) = (substr($self->{buf}, $len), - substr($self->{buf}, 0, $len)); - $self->{buf} = $newbuf; - $result; -} - -sub Flush { - my ($req) = @_; -} - -sub write { - my ($self, $type, $content, $len) = @_; - return unless $len > 0; - $self->write_record($type, $content, $len); -} - -sub write_record { - my ($self, $type, $content, $length) = @_; - my $offset = 0; - while ($length > 0) { - my $len = $length > 32*1024 ? 32*1024 : $length; - my $padlen = (8 - ($len % 8)) % 8; - my $templ = "CCnnCxa${len}x$padlen"; - my $data = pack($templ, - VERSION_1, $type, $self->{id}, $len, $padlen, - substr($content, $offset, $len)); - syswrite $self->{socket}, $data; - $length -= $len; - $offset += $len; - } -} - -{ package FCGI::Stream; - -sub new { - my ($class, $src, $type) = @_; - my $handle = do { \local *FH }; - tie($$handle, $class, $src, $type); - $handle; -} - -sub TIEHANDLE { - my ($class, $src, $type) = @_; - bless { src => $src, type => $type }, $class; -} - -sub READ { - my ($stream, undef, $len, $offset) = @_; - my ($ref) = \$_[1]; - my $buf = $stream->{src}->read($stream->{type}, $len); - return undef unless defined $buf; - substr($$ref, $offset, 0, $buf); - length $buf; -} - -sub PRINT { - my ($stream) = shift; - for (@_) { - $stream->{src}->write($stream->{type}, $_, length($_)); - } -} - -sub CLOSE { - my ($stream) = @_; - $stream->{src}->write_record($stream->{type}, undef, 0); -} - -} - -EOP -print OUT while ; -close OUT; -__END__ - -# Preloaded methods go here. - -# Autoload methods go after __END__, and are processed by the autosplit program. - -*FAIL_ACCEPT_ON_INTR = sub() { 1 }; - -sub Request(;***$*$) { - my @defaults = (\*STDIN, \*STDOUT, \*STDERR, \%ENV, 0, 0); - $_[4] = fileno($_[4]) if defined($_[4]) && defined(fileno($_[4])); - splice @defaults,0,@_,@_; - RequestX(@defaults); -} - -sub accept() { - warn "accept called as a method; you probably wanted to call Accept" if @_; - if (defined %FCGI::ENV) { - %ENV = %FCGI::ENV; - } else { - %FCGI::ENV = %ENV; - } - my $rc = Accept($global_request); - for (keys %FCGI::ENV) { - $ENV{$_} = $FCGI::ENV{$_} unless exists $ENV{$_}; - } - - # not SFIO - $SIG{__WARN__} = $warn_handler if (tied (*STDIN)); - $SIG{__DIE__} = $die_handler if (tied (*STDIN)); - - return $rc; -} - -sub finish() { - warn "finish called as a method; you probably wanted to call Finish" if @_; - %ENV = %FCGI::ENV if (defined %FCGI::ENV); - - # not SFIO - if (tied (*STDIN)) { - delete $SIG{__WARN__} if ($SIG{__WARN__} == $warn_handler); - delete $SIG{__DIE__} if ($SIG{__DIE__} == $die_handler); - } - - Finish ($global_request); -} - -sub flush() { - warn "flush called as a method; you probably wanted to call Flush" if @_; - Flush($global_request); -} - -sub detach() { - warn "detach called as a method; you probably wanted to call Detach" if @_; - Detach($global_request); -} - -sub attach() { - warn "attach called as a method; you probably wanted to call Attach" if @_; - Attach($global_request); -} - -# deprecated -sub set_exit_status { -} - -sub start_filter_data() { - StartFilterData($global_request); -} - -$global_request = Request(); -$warn_handler = sub { print STDERR @_ }; -$die_handler = sub { print STDERR @_ unless $^S }; - -package FCGI::Stream; - -sub PRINTF { - shift->PRINT(sprintf(shift, @_)); -} - -sub BINMODE { -} - -sub READLINE { - my $stream = shift; - my ($s, $c); - my $rs = $/ eq '' ? "\n\n" : $/; - my $l = substr $rs, -1; - my $len = length $rs; - - $c = $stream->GETC(); - if ($/ eq '') { - while ($c eq "\n") { - $c = $stream->GETC(); - } - } - while (defined $c) { - $s .= $c; - last if $c eq $l and substr($s, -$len) eq $rs; - $c = $stream->GETC(); - } - $s; -} - -sub OPEN { - $_[0]->CLOSE; - if (@_ == 2) { - return open($_[0], $_[1]); - } else { - my $rc; - eval("$rc = open($_[0], $_[1], $_[2])"); - die $@ if $@; - return $rc; - } -} - -# Apparently some use fileno to determine if a filehandle is open, -# so we might want to return a defined, but meaningless value. -# An alternative would be to return the fcgi stream fd. -# sub FILENO { -2 } - -1; - -=pod - -=head1 NAME - -FCGI - Fast CGI module - -=head1 SYNOPSIS - - use FCGI; - - my $count = 0; - my $request = FCGI::Request(); - - while($request->Accept() >= 0) { - print("Content-type: text/html\r\n\r\n", ++$count); - } - -=head1 DESCRIPTION - -Functions: - -=over 4 - -=item FCGI::Request - -Creates a request handle. It has the following optional parameters: - -=over 8 - -=item input perl file handle (default: \*STDIN) - -=item output perl file handle (default: \*STDOUT) - -=item error perl file handle (default: \*STDERR) - -These filehandles will be setup to act as input/output/error -on succesful Accept. - -=item environment hash reference (default: \%ENV) - -The hash will be populated with the environment. - -=item socket (default: 0) - -Socket to communicate with the server. -Can be the result of the OpenSocket function. -For the moment, it's the file descriptor of the socket -that should be passed. This may change in the future. - -You should only use your own socket if your program -is not started by a process manager such as mod_fastcgi -(except for the FastCgiExternalServer case) or cgi-fcgi. -If you use the option, you have to let your FastCGI -server know which port (and possibly server) your program -is listening on. -See remote.pl for an example. - -=item flags (default: 0) - -Possible values: - -=over 12 - -=item FCGI::FAIL_ACCEPT_ON_INTR - -If set, Accept will fail if interrupted. -It not set, it will just keep on waiting. - -=back - -=back - -Example usage: - my $req = FCGI::Request; - -or: - my %env; - my $in = new IO::Handle; - my $out = new IO::Handle; - my $err = new IO::Handle; - my $req = FCGI::Request($in, $out, $err, \%env); - -=item FCGI::OpenSocket(path, backlog) - -Creates a socket suitable to use as an argument to Request. - -=over 8 - -=item path - -Pathname of socket or colon followed by local tcp port. -Note that some systems take file permissions into account -on Unix domain sockets, so you'll have to make sure that -the server can write to the created file, by changing -the umask before the call and/or changing permissions and/or -group of the file afterwards. - -=item backlog - -Maximum length of the queue of pending connections. -If a connection -request arrives with the queue full the client may receive -an error with an indication of ECONNREFUSED. - -=back - -=item FCGI::CloseSocket(socket) - -Close a socket opened with OpenSocket. - -=item $req->Accept() - -Accepts a connection on $req, attaching the filehandles and -populating the environment hash. -Returns 0 on success. -If a connection has been accepted before, the old -one will be finished first. - -Note that unlike with the old interface, no die and warn -handlers are installed by default. This means that if -you are not running an sfio enabled perl, any warn or -die message will not end up in the server's log by default. -It is advised you set up die and warn handlers yourself. -FCGI.pm contains an example of die and warn handlers. - -=item $req->Finish() - -Finishes accepted connection. -Also detaches filehandles. - -=item $req->Flush() - -Flushes accepted connection. - -=item $req->Detach() - -Temporarily detaches filehandles on an accepted connection. - -=item $req->Attach() - -Re-attaches filehandles on an accepted connection. - -=item $req->LastCall() - -Tells the library not to accept any more requests on this handle. -It should be safe to call this method from signal handlers. - -Note that this method is still experimental and everything -about it, including its name, is subject to change. - -=item $env = $req->GetEnvironment() - -Returns the environment parameter passed to FCGI::Request. - -=item ($in, $out, $err) = $req->GetHandles() - -Returns the file handle parameters passed to FCGI::Request. - -=item $isfcgi = $req->IsFastCGI() - -Returns whether or not the program was run as a FastCGI. - -=back - -=head1 AUTHOR - -Sven Verdoolaege - -=cut - -__END__ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/FCGI.XL b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/FCGI.XL deleted file mode 100644 index 01742cc904e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/FCGI.XL +++ /dev/null @@ -1,625 +0,0 @@ -use Config; - -open OUT, ">FCGI.xs"; - -print "Generating FCGI.xs for Perl version $]\n"; -#unless (exists $Config{apiversion} && $Config{apiversion} >= 5.005) -unless ($] >= 5.005) { - for (qw(sv_undef diehook warnhook in_eval)) { - print OUT "#define PL_$_ $_\n" - } -} -print OUT while ; -close OUT; -__END__ -/* $Id: FCGI.XL,v 1.9 2002/11/11 13:51:20 skimo Exp $ */ - -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" - -#include "fcgi_config.h" -#include "fcgiapp.h" -#include "fastcgi.h" - -#ifndef FALSE -#define FALSE (0) -#endif - -#ifndef TRUE -#define TRUE (1) -#endif - -#ifndef dTHX -#define dTHX -#endif - -#ifndef INT2PTR -#define INT2PTR(a,b) ((a) (b)) -#endif - -#ifdef USE_SFIO -typedef struct -{ - Sfdisc_t disc; - FCGX_Stream *stream; -} FCGI_Disc; - -static ssize_t -sffcgiread(f, buf, n, disc) -Sfio_t* f; /* stream involved */ -Void_t* buf; /* buffer to read into */ -size_t n; /* number of bytes to read */ -Sfdisc_t* disc; /* discipline */ -{ - return FCGX_GetStr(buf, n, ((FCGI_Disc *)disc)->stream); -} - -static ssize_t -sffcgiwrite(f, buf, n, disc) -Sfio_t* f; /* stream involved */ -const Void_t* buf; /* buffer to read into */ -size_t n; /* number of bytes to read */ -Sfdisc_t* disc; /* discipline */ -{ - n = FCGX_PutStr(buf, n, ((FCGI_Disc *)disc)->stream); - FCGX_FFlush(((FCGI_Disc *)disc)->stream); - return n; -} - -Sfdisc_t * -sfdcnewfcgi(stream) - FCGX_Stream *stream; -{ - FCGI_Disc* disc; - - New(1000,disc,1,FCGI_Disc); - if (!disc) return (Sfdisc_t *)disc; - - disc->disc.exceptf = (Sfexcept_f)NULL; - disc->disc.seekf = (Sfseek_f)NULL; - disc->disc.readf = sffcgiread; - disc->disc.writef = sffcgiwrite; - disc->stream = stream; - return (Sfdisc_t *)disc; -} - -Sfdisc_t * -sfdcdelfcgi(disc) - Sfdisc_t* disc; -{ - Safefree(disc); - return 0; -} -#endif - -#if defined(USE_LOCKING) && defined(USE_THREADS) -static perl_mutex accept_mutex; -#endif - -typedef struct FCGP_Request { - int accepted; - int bound; - SV* svin; - SV* svout; - SV* sverr; - GV* gv[3]; - HV* hvEnv; - FCGX_Request* requestPtr; -#ifdef USE_SFIO - int sfcreated[3]; - IO* io[3]; -#endif -} FCGP_Request; - -static void FCGI_Finish(FCGP_Request* request); - -static void -FCGI_Flush(FCGP_Request* request) -{ - dTHX; - - if(!request->bound) { - return; - } -#ifdef USE_SFIO - sfsync(IoOFP(GvIOp(request->gv[1]))); - sfsync(IoOFP(GvIOp(request->gv[2]))); -#else - FCGX_FFlush(INT2PTR(FCGX_Stream *, SvIV((SV*) SvRV(request->svout)))); - FCGX_FFlush(INT2PTR(FCGX_Stream *, SvIV((SV*) SvRV(request->sverr)))); -#endif -} - -static void -FCGI_UndoBinding(FCGP_Request* request) -{ - dTHX; - -#ifdef USE_SFIO - sfdcdelfcgi(sfdisc(IoIFP(request->io[0]), SF_POPDISC)); - sfdcdelfcgi(sfdisc(IoOFP(request->io[1]), SF_POPDISC)); - sfdcdelfcgi(sfdisc(IoOFP(request->io[2]), SF_POPDISC)); -#else -# ifdef USE_PERLIO - sv_unmagic((SV *)GvIOp(request->gv[0]), 'q'); - sv_unmagic((SV *)GvIOp(request->gv[1]), 'q'); - sv_unmagic((SV *)GvIOp(request->gv[2]), 'q'); -# else - sv_unmagic((SV *)request->gv[0], 'q'); - sv_unmagic((SV *)request->gv[1], 'q'); - sv_unmagic((SV *)request->gv[2], 'q'); -# endif -#endif - request->bound = FALSE; -} - -static void -FCGI_Bind(FCGP_Request* request) -{ - dTHX; - -#ifdef USE_SFIO - sfdisc(IoIFP(request->io[0]), sfdcnewfcgi(request->requestPtr->in)); - sfdisc(IoOFP(request->io[1]), sfdcnewfcgi(request->requestPtr->out)); - sfdisc(IoOFP(request->io[2]), sfdcnewfcgi(request->requestPtr->err)); -#else -# ifdef USE_PERLIO - /* For tied filehandles, we apply tiedscalar magic to the IO - slot of the GP rather than the GV itself. */ - - if (!GvIOp(request->gv[1])) - GvIOp(request->gv[1]) = newIO(); - if (!GvIOp(request->gv[2])) - GvIOp(request->gv[2]) = newIO(); - if (!GvIOp(request->gv[0])) - GvIOp(request->gv[0]) = newIO(); - - sv_magic((SV *)GvIOp(request->gv[1]), request->svout, 'q', Nullch, 0); - sv_magic((SV *)GvIOp(request->gv[2]), request->sverr, 'q', Nullch, 0); - sv_magic((SV *)GvIOp(request->gv[0]), request->svin, 'q', Nullch, 0); -# else - sv_magic((SV *)request->gv[1], request->svout, 'q', Nullch, 0); - sv_magic((SV *)request->gv[2], request->sverr, 'q', Nullch, 0); - sv_magic((SV *)request->gv[0], request->svin, 'q', Nullch, 0); -# endif -#endif - request->bound = TRUE; -} - -static void -populate_env(envp, hv) -char **envp; -HV *hv; -{ - int i; - char *p, *p1; - SV *sv; - dTHX; - - hv_clear(hv); - for(i = 0; ; i++) { - if((p = envp[i]) == NULL) { - break; - } - p1 = strchr(p, '='); - assert(p1 != NULL); - sv = newSVpv(p1 + 1, 0); - /* call magic for this value ourselves */ - hv_store(hv, p, p1 - p, sv, 0); - SvSETMAGIC(sv); - } -} - -static int -FCGI_IsFastCGI(FCGP_Request* request) -{ - static int isCGI = -1; /* -1: not checked; 0: FCGI; 1: CGI */ - - if (request->requestPtr->listen_sock == FCGI_LISTENSOCK_FILENO) { - if (isCGI == -1) - isCGI = FCGX_IsCGI(); - return !isCGI; - } - - /* A explicit socket is being used -> assume FastCGI */ - return 1; -} - -static int -FCGI_Accept(FCGP_Request* request) -{ - dTHX; - - if (!FCGI_IsFastCGI(request)) { - static int been_here = 0; - - /* - * Not first call to FCGI_Accept and running as CGI means - * application is done. - */ - if (been_here) - return EOF; - - been_here = 1; - } else { -#ifdef USE_SFIO - int i; -#endif - FCGX_Request *fcgx_req = request->requestPtr; - int acceptResult; - - FCGI_Finish(request); -#if defined(USE_LOCKING) && defined(USE_THREADS) - MUTEX_LOCK(&accept_mutex); -#endif - acceptResult = FCGX_Accept_r(fcgx_req); -#if defined(USE_LOCKING) && defined(USE_THREADS) - MUTEX_UNLOCK(&accept_mutex); -#endif - if(acceptResult < 0) { - return acceptResult; - } - - populate_env(fcgx_req->envp, request->hvEnv); - -#ifdef USE_SFIO - for (i = 0; i < 3; ++i) { - request->io[i] = GvIOn(request->gv[i]); - if (!(i == 0 ? IoIFP(request->io[i]) - : IoOFP(request->io[i]))) { - IoIFP(request->io[i]) = sftmp(0); - /*IoIFP(request->io[i]) = sfnew(NULL, NULL, SF_UNBOUND, 0, - SF_STRING | (i ? SF_WRITE : SF_READ));*/ - if (i != 0) - IoOFP(request->io[i]) = IoIFP(request->io[i]); - request->sfcreated[i] = TRUE; - } - } -#else - if (!request->svout) { - newSVrv(request->svout = newSV(0), "FCGI::Stream"); - newSVrv(request->sverr = newSV(0), "FCGI::Stream"); - newSVrv(request->svin = newSV(0), "FCGI::Stream"); - } - sv_setiv(SvRV(request->svout), INT2PTR(IV, fcgx_req->out)); - sv_setiv(SvRV(request->sverr), INT2PTR(IV, fcgx_req->err)); - sv_setiv(SvRV(request->svin), INT2PTR(IV, fcgx_req->in)); -#endif - FCGI_Bind(request); - request->accepted = TRUE; - } - return 0; -} - -static void -FCGI_Finish(FCGP_Request* request) -{ -#ifdef USE_SFIO - int i; -#endif - int was_bound; - dTHX; - - if(!request->accepted) { - return; - } - - if (was_bound = request->bound) { - FCGI_UndoBinding(request); - } -#ifdef USE_SFIO - for (i = 0; i < 3; ++i) { - if (request->sfcreated[i]) { - sfclose(IoIFP(request->io[i])); - IoIFP(request->io[i]) = IoOFP(request->io[i]) = Nullfp; - request->sfcreated[i] = FALSE; - } - } -#endif - if (was_bound) - FCGX_Finish_r(request->requestPtr); - else - FCGX_Free(request->requestPtr, 1); - request->accepted = FALSE; -} - -static int -FCGI_StartFilterData(FCGP_Request* request) -{ - return request->requestPtr->in ? - FCGX_StartFilterData(request->requestPtr->in) : -1; -} - -static FCGP_Request * -FCGI_Request(in, out, err, env, socket, flags) - GV* in; - GV* out; - GV* err; - HV* env; - int socket; - int flags; -{ - FCGX_Request* fcgx_req; - FCGP_Request* req; - - Newz(551, fcgx_req, 1, FCGX_Request); - FCGX_InitRequest(fcgx_req, socket, flags); - Newz(551, req, 1, FCGP_Request); - req->requestPtr = fcgx_req; - SvREFCNT_inc(in); - req->gv[0] = in; - SvREFCNT_inc(out); - req->gv[1] = out; - SvREFCNT_inc(err); - req->gv[2] = err; - SvREFCNT_inc(env); - req->hvEnv = env; - - return req; -} - -static void -FCGI_Release_Request(FCGP_Request *req) -{ - SvREFCNT_dec(req->gv[0]); - SvREFCNT_dec(req->gv[1]); - SvREFCNT_dec(req->gv[2]); - SvREFCNT_dec(req->hvEnv); - FCGI_Finish(req); - Safefree(req->requestPtr); - Safefree(req); -} - -static void -FCGI_Init() -{ -#if defined(USE_LOCKING) && defined(USE_THREADS) - dTHX; - - MUTEX_INIT(&accept_mutex); -#endif - - FCGX_Init(); -} - -typedef FCGX_Stream * FCGI__Stream; -typedef FCGP_Request * FCGI; -typedef GV* GLOBREF; -typedef HV* HASHREF; - -MODULE = FCGI PACKAGE = FCGI PREFIX = FCGI_ - -BOOT: - FCGI_Init(); - -SV * -RequestX(in, out, err, env, socket, flags) - GLOBREF in; - GLOBREF out; - GLOBREF err; - HASHREF env; - int socket; - int flags; - - PROTOTYPE: ***$$$ - CODE: - RETVAL = sv_setref_pv(newSV(0), "FCGI", - FCGI_Request(in, out, err, env, socket, flags)); - - OUTPUT: - RETVAL - -int -OpenSocket(path, backlog) - char* path; - int backlog; - - PROTOTYPE: $$ - CODE: - RETVAL = FCGX_OpenSocket(path, backlog); - OUTPUT: - RETVAL - -void -CloseSocket(socket) - int socket; - - PROTOTYPE: $ - CODE: - close(socket); - -int -FCGI_Accept(request) - - FCGI request; - - PROTOTYPE: $ - -void -FCGI_Finish(request) - FCGI request; - - PROTOTYPE: $ - -void -FCGI_Flush(request) - FCGI request; - - PROTOTYPE: $ - -HV * -GetEnvironment(request) - FCGI request; - - PROTOTYPE: $ - - CODE: - RETVAL = request->hvEnv; - - OUTPUT: - RETVAL - -void -GetHandles(request) - FCGI request; - - PROTOTYPE: $ - - PREINIT: - int i; - - PPCODE: - EXTEND(sp,3); - for (i = 0; i < 3; ++i) - PUSHs(sv_2mortal(newRV((SV *) request->gv[i]))); - -int -FCGI_IsFastCGI(request) - FCGI request; - - PROTOTYPE: $ - -void -Detach(request) - FCGI request; - - PROTOTYPE: $ - - CODE: - if (request->accepted && request->bound) - FCGI_UndoBinding(request); - -void -Attach(request) - FCGI request; - - PROTOTYPE: $ - - CODE: - if (request->accepted && !request->bound) - FCGI_Bind(request); - -void -LastCall(request) - FCGI request; - - PROTOTYPE: $ - - CODE: - FCGX_ShutdownPending(); - -int -FCGI_StartFilterData(request) - - FCGI request; - - PROTOTYPE: $ - -void -DESTROY(request) - FCGI request; - - CODE: - FCGI_Release_Request(request); - - - -MODULE = FCGI PACKAGE = FCGI::Stream - -#ifndef USE_SFIO - -void -PRINT(stream, ...) - FCGI::Stream stream; - - PREINIT: - int n; - - CODE: - for (n = 1; n < items; ++n) { - STRLEN len; - register char *tmps = (char *)SvPV(ST(n),len); - FCGX_PutStr(tmps, len, stream); - } - if (SvTRUEx(perl_get_sv("|", FALSE))) - FCGX_FFlush(stream); - -int -WRITE(stream, bufsv, len, ...) - FCGI::Stream stream; - SV * bufsv; - int len; - - PREINIT: - int offset; - char * buf; - STRLEN blen; - int n; - - CODE: - offset = (items == 4) ? (int)SvIV(ST(3)) : 0; - buf = SvPV(bufsv, blen); - if (offset < 0) offset += blen; - if (len > blen - offset) - len = blen - offset; - if (offset < 0 || offset >= blen || - (n = FCGX_PutStr(buf+offset, len, stream)) < 0) - ST(0) = &PL_sv_undef; - else { - ST(0) = sv_newmortal(); - sv_setpvf(ST(0), "%c", n); - } - -int -READ(stream, bufsv, len, ...) - FCGI::Stream stream; - SV * bufsv; - int len; - - PREINIT: - int offset; - char * buf; - - CODE: - offset = (items == 4) ? (int)SvIV(ST(3)) : 0; - if (! SvOK(bufsv)) - sv_setpvn(bufsv, "", 0); - buf = SvGROW(bufsv, len+offset+1); - len = FCGX_GetStr(buf+offset, len, stream); - SvCUR_set(bufsv, len+offset); - *SvEND(bufsv) = '\0'; - (void)SvPOK_only(bufsv); - SvSETMAGIC(bufsv); - RETVAL = len; - - OUTPUT: - RETVAL - -SV * -GETC(stream) - FCGI::Stream stream; - - PREINIT: - int retval; - - CODE: - if ((retval = FCGX_GetChar(stream)) != -1) { - ST(0) = sv_newmortal(); - sv_setpvf(ST(0), "%c", retval); - } else ST(0) = &PL_sv_undef; - -bool -CLOSE(stream) - FCGI::Stream stream; - -# ALIAS: -# DESTROY = 1 - - CODE: - RETVAL = FCGX_FClose(stream) != -1; - - OUTPUT: - RETVAL - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/MANIFEST b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/MANIFEST deleted file mode 100644 index 07ded824730..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/MANIFEST +++ /dev/null @@ -1,16 +0,0 @@ -ChangeLog -FCGI.PL -FCGI.XL -MANIFEST -Makefile.PL -README -configure -configure.in -configure.readme -echo.PL -fcgi_config.h.in -remote.PL -test.pl -threaded.PL -typemap -version.pm diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/Makefile.PL b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/Makefile.PL deleted file mode 100644 index 380e5f831fa..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/Makefile.PL +++ /dev/null @@ -1,156 +0,0 @@ -# $Id: Makefile.PL,v 1.33 2002/12/15 19:40:19 skimo Exp $ - -use ExtUtils::MakeMaker; -use IO::File; -use Config; -use Cwd 'cwd'; -use Getopt::Long; - -@h1 = qw(fastcgi.h fcgiapp.h fcgimisc.h fcgios.h); -@h = (@h1, 'fcgi_config.h'); -@o = qw(FCGI.o); -@dist1 = qw(LICENSE.TERMS); -@dist2 = qw(fcgiapp.c os_unix.c os_win32.c); -@dist3 = (@h1, qw(fcgi_config_x86.h)); - -GetOptions ("pure-perl!" => \$pure, - "use-installed:s" => \$useinstalled); -$pure = "0" unless defined $pure; -open(CFG,">FCGI.cfg"); -print CFG "\$pure = $pure;1;\n"; -close CFG; - -$libfound = 0; -@libs = (); - -if (! $pure) { - my $cwd = cwd(); - my $devkit = "$cwd/.."; - - if (defined $useinstalled) { - require ExtUtils::Liblist; - my $libspec = $useinstalled ? "-L$useinstalled/lib " : ""; - $libspec .= "-lfcgi"; - my @l = MM->ext($libspec); - if ($l[0] || $l[1] || $l[2]) { - $prefix = "$useinstalled/include" if $useinstalled; - $libfound = 1; - push @libs, $libspec; - } - } - if (!$libfound && -d "$devkit/libfcgi" && -d "$devkit/include") { - # devkit - if (grep { ! -f "$devkit/include/$_" } @dist3 - or grep { ! -f "$devkit/libfcgi/$_" } @dist2) - { - warn "This appears to be a FastCGI devkit distribution, " . - "but one or more FastCGI library files are missing. \n" . - "Please check the integrity of the distribution.\n"; - exit -1; - } - - my $extrarules = join "\n", - map { $b = $_; $b =~ s/\.c$//; my $s="$devkit/libfcgi/$b.c"; - "$b\$(OBJ_EXT): $s\n\t". - '$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) '."$s\n"; } - @dist2; - eval 'package MY; sub postamble { $extrarules; }'; - $prefix = $devkit; - } -} - -$sys = $^O eq 'MSWin32' ? 'win32' : 'unix'; -push @o, "fcgiapp.o", "os_$sys.o" unless $libfound; -$inc = '-I.' unless $libfound; -$inc .= " -I$prefix/include" if $prefix; - -push(@extras, CAPI => 'TRUE') - if ($] >= 5.005 and $^O eq 'MSWin32' - and $Config{archname} =~ /-object\b/i); - -push(@extras, - ABSTRACT => 'Fast CGI module', - AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)') - if ($ExtUtils::MakeMaker::VERSION >= 5.4301); - -$plfiles = { 'echo.PL' => 'echo.fpl', - 'remote.PL' => 'remote.fpl', - 'threaded.PL' => 'threaded.fpl', - 'FCGI.PL' => 'FCGI.pm', - }; -$plfiles->{'FCGI.XL'} = 'FCGI.xs' unless $pure; -if ($pure) { - push @extras, - LINKTYPE => ' '; -} else { - - if ("$sys" eq "win32") { - push @libs, ":nosearch -lws2_32"; - push @extras, 'DEFINE' => '-DDLLAPI=__declspec(dllexport)'; - } - - push @extras, - 'LIBS' => [ "@libs" ], - 'OBJECT' => "@o", - 'INC' => $inc; -} - -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. - -# Work around bug in previous versions of MakeMaker -WriteMakefile(NAME => 'FCGI') - if $ExtUtils::MakeMaker::VERSION <= 5.4302; - -$mm = MM->new({ - 'NAME' => 'FCGI', - 'VERSION_FROM' => 'version.pm', - 'dist' => { 'COMPRESS' => 'gzip -9f', - 'SUFFIX' => 'gz', - 'PREOP' => '$(CP) '.join(' ', - map {"../$_"} @dist1, - (map {"libfcgi/$_"} @dist2), - map {"include/$_"} @dist3).' $(DISTVNAME);'. - '$(CP) MANIFEST MANIFEST.old;'. - 'echo -e '. join('\\\n',@dist1,@dist2,@dist3) . - '>> $(DISTVNAME)/MANIFEST', - 'POSTOP' => - '$(MV) MANIFEST.old MANIFEST', - }, - 'clean' => { FILES => 'config.cache fcgi_config.h' . - ' FCGI.xs FCGI.c FCGI.cfg ' . - (join ' ', values %$plfiles)}, - 'PL_FILES' => $plfiles, - PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'}, - @extras, -}); -# don't install oldinterface pod -delete $mm->{MAN3PODS}{oldinterface.pod}; -$mm->flush; - -exit if -f 'fcgi_config.h' or $libfound or $pure; - -# CPAN and no installed lib found -if ($sys eq "win32") { - # configure will almost certainly not run on a normal NT install, - # use the pregenerated configuration file - - use File::Copy qw(copy); - print "Using prebuilt fcgi_config.h file for Windows\n"; - unlink("fcgi_config.h"); - my $confdir = $prefix ? "$prefix/include/" : ''; - die $! unless copy("${confdir}fcgi_config_x86.h","fcgi_config.h"); - - # Win can't deal with existence of FCGI.xs or absence of FCGI.c - unlink("FCGI.xs"); - open(F, ">FCGI.c"); close(F); - $now = time; $before = $now - 600; - utime $before, $before, "FCGI.c"; - utime $now, $now, "FCGI.PL"; -} else { - print "Running ./configure for you\n"; - print "Please read configure.readme for information on how to run it yourself\n"; - - $ENV{'CC'} = $Config{'cc'}; - system("$Config{sh} configure"); -} diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/README b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/README deleted file mode 100644 index 50d96eebcdc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/README +++ /dev/null @@ -1,64 +0,0 @@ -$Id: README,v 1.7 2001/10/04 08:08:34 skimo Exp $ - - Copyright (c) 1996 Open Market, Inc. - See the file "LICENSE.TERMS" for information on usage and redistribution - of this file, and for a DISCLAIMER OF ALL WARRANTIES. - - Copyright (c) 1996-1998 Sven Verdoolaege - No additional restrictions/warranties. - -This is a Fast CGI module for perl. It's based on the FCGI module -that comes with Open Market's FastCGI Developer's Kit, but does -not require you to recompile perl. - -It even no longer requires perl to be compiled with sfio. -To compile with sfio you'll need at least perl 5.003_02 and you'll have -to have configured it with eg './Configure -Duseperlio -Dusesfio'. -(See the INSTALL file that comes with the perl distribution.) -To compile without sfio you'll need an even more recent perl version. -(perl 5.004 and up should be fine.) - -See http://www.fastcgi.com/ for more information about fastcgi. -Lincoln D. Stein's perl CGI module also contains some information -about fastcgi programming. - -See echo.fpl for an example on how to use this module. - -To install, do the usual - -perl Makefile.PL -make -make install - -If you want to use the (experimental) pure perl version, that -doesn't require a compiler and currently only works on Unix, -you have to pass the --pure-perl option as in -"perl Makefile.PL --pure-perl". - -Note that the pure version does not support Window's Named Pipes. -Support for Named Pipes is not a requirement of the FastCGI specification. -Named Pipes are used by mod_fastcgi and the FastCGI application library as a -replacement for Unix sockets. mod_fastcgi uses Named Pipes on Windows (Unix -sockets on Unix) by default (see the mod_fastcgi docs for more information). - -If you want the module to use a previously installed fcgi library -instead of the included files, use the --use-installed option, -optionally followed by the name of the directory in which it can -be found. - -To configure the library Makefile.PL will run ./configure . -You may want to run it yourself beforehand because its findings -may not always be correct. -The configure.readme file describes how to run ./configure (and only that). - -If you're on a solaris system and your installed fcgi library is 2.02b -or earlier, you'll probably want to use the included files. - -The old interface of the FCGI module installs die and warn -handlers that merely print the error/warning to STDERR (the -default handlers print directly to stderr, which isn't redirected -in the non sfio case). I'm not very happy with the result. -Suggestions welcome. - -Sven Verdoolaege -skimo@kotnet.org diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/aclocal.m4 b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/aclocal.m4 deleted file mode 100644 index 1cdf23f2e8f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/aclocal.m4 +++ /dev/null @@ -1,472 +0,0 @@ -# aclocal.m4 generated automatically by aclocal 1.5 - -# Copyright 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Like AC_CONFIG_HEADER, but automatically create stamp file. - -# serial 3 - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. We must strip everything past the first ":", -# and everything past the last "/". - -AC_PREREQ([2.12]) - -AC_DEFUN([AM_CONFIG_HEADER], -[ifdef([AC_FOREACH],dnl - [dnl init our file count if it isn't already - m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) - dnl prepare to store our destination file list for use in config.status - AC_FOREACH([_AM_File], [$1], - [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) - m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) - dnl and add it to the list of files AC keeps track of, along - dnl with our hook - AC_CONFIG_HEADERS(_AM_File, -dnl COMMANDS, [, INIT-CMDS] -[# update the timestamp -echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" -][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS - m4_popdef([_AM_Dest])])],dnl -[AC_CONFIG_HEADER([$1]) - AC_OUTPUT_COMMANDS( - ifelse(patsubst([$1], [[^ ]], []), - [], - [test -z "$CONFIG_HEADERS" || echo timestamp >dnl - patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl -[am_indx=1 -for am_file in $1; do - case " \$CONFIG_HEADERS " in - *" \$am_file "*) - am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` - if test -n "\$am_dir"; then - am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` - for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do - am_tmpdir=\$am_tmpdir\$am_subdir/ - if test ! -d \$am_tmpdir; then - mkdir \$am_tmpdir - fi - done - fi - echo timestamp > "\$am_dir"stamp-h\$am_indx - ;; - esac - am_indx=\`expr \$am_indx + 1\` -done]) -])]) # AM_CONFIG_HEADER - -# _AM_DIRNAME(PATH) -# ----------------- -# Like AS_DIRNAME, only do it during macro expansion -AC_DEFUN([_AM_DIRNAME], - [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, - m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, - m4_if(m4_regexp([$1], [^/.*]), -1, - [.], - m4_patsubst([$1], [^\(/\).*], [\1])), - m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), - m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl -]) # _AM_DIRNAME - -dnl $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ - -AC_DEFUN(FCGI_COMMON_CHECKS, [ - AC_CHECK_TYPE([ssize_t], [int]) - - AC_MSG_CHECKING([for sun_len in sys/un.h]) - AC_EGREP_HEADER([sun_len], [sys/un.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1], - [Define if sockaddr_un in sys/un.h contains a sun_len component])], - AC_MSG_RESULT([no])) - - AC_MSG_CHECKING([for fpos_t in stdio.h]) - AC_EGREP_HEADER([fpos_t], [stdio.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FPOS], [1], - [Define if the fpos_t typedef is in stdio.h])], - AC_MSG_RESULT([no])) - - AC_CHECK_HEADERS([sys/socket.h netdb.h netinet/in.h arpa/inet.h]) - AC_CHECK_HEADERS([sys/time.h limits.h sys/param.h unistd.h]) - - AC_MSG_CHECKING([for a fileno() prototype in stdio.h]) - AC_EGREP_HEADER([fileno], [stdio.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_FILENO_PROTO], [1], - [Define if there's a fileno() prototype in stdio.h])], - AC_MSG_RESULT([no])) - - if test "$HAVE_SYS_SOCKET_H"; then - AC_MSG_CHECKING([for socklen_t in sys/socket.h]) - AC_EGREP_HEADER([socklen_t], [sys/socket.h], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_SOCKLEN], [1], - [Define if the socklen_t typedef is in sys/socket.h])], - AC_MSG_RESULT([no])) - fi - - #-------------------------------------------------------------------- - # Do we need cross-process locking on this platform? - #-------------------------------------------------------------------- - AC_MSG_CHECKING([whether cross-process locking is required by accept()]) - case "`uname -sr`" in - IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0) - AC_MSG_RESULT([yes]) - AC_DEFINE([USE_LOCKING], [1], - [Define if cross-process locking is required by accept()]) - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac - - #-------------------------------------------------------------------- - # Does va_arg(arg, long double) crash the compiler? - # hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler) - #-------------------------------------------------------------------- - AC_MSG_CHECKING([whether va_arg(arg, long double) crashes the compiler]) - AC_TRY_COMPILE([#include ], - [long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double);], - AC_MSG_RESULT([no]), - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_VA_ARG_LONG_DOUBLE_BUG], [1], - [Define if va_arg(arg, long double) crashes the compiler])]) - - AC_C_CONST -]) - - -dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -dnl -dnl This macro figures out how to build C programs using POSIX -dnl threads. It sets the PTHREAD_LIBS output variable to the threads -dnl library and linker flags, and the PTHREAD_CFLAGS output variable -dnl to any special C compiler flags that are needed. (The user can also -dnl force certain compiler flags/libs to be tested by setting these -dnl environment variables.) -dnl -dnl Also sets PTHREAD_CC to any special C compiler that is needed for -dnl multi-threaded programs (defaults to the value of CC otherwise). -dnl (This is necessary on AIX to use the special cc_r compiler alias.) -dnl -dnl If you are only building threads programs, you may wish to -dnl use these variables in your default LIBS, CFLAGS, and CC: -dnl -dnl LIBS="$PTHREAD_LIBS $LIBS" -dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" -dnl CC="$PTHREAD_CC" -dnl -dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute -dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE -dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). -dnl -dnl ACTION-IF-FOUND is a list of shell commands to run if a threads -dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands -dnl to run it if it is not found. If ACTION-IF-FOUND is not specified, -dnl the default action will define HAVE_PTHREAD. -dnl -dnl Please let the authors know if this macro fails on any platform, -dnl or if you have any other suggestions or comments. This macro was -dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org) -dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread -dnl macros posted by AFC to the autoconf macro repository. We are also -dnl grateful for the helpful feedback of numerous users. -dnl -dnl @version $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ -dnl @author Steven G. Johnson and Alejandro Forero Cuervo - -AC_DEFUN([ACX_PTHREAD], [ -AC_REQUIRE([AC_CANONICAL_HOST]) -acx_pthread_ok=no - -# First, check if the POSIX threads header, pthread.h, is available. -# If it isn't, don't bother looking for the threads libraries. -AC_CHECK_HEADER(pthread.h, , acx_pthread_ok=noheader) - -# We must check for the threads library under a number of different -# names; the ordering is very important because some systems -# (e.g. DEC) have both -lpthread and -lpthreads, where one of the -# libraries is broken (non-POSIX). - -# First of all, check if the user has set any of the PTHREAD_LIBS, -# etcetera environment variables, and if threads linking works using -# them: -if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) - AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) - AC_MSG_RESULT($acx_pthread_ok) - if test x"$acx_pthread_ok" = xno; then - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" - fi - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" -fi - -# Create a list of thread flags to try. Items starting with a "-" are -# C compiler flags, and other items are library names, except for "none" -# which indicates that we try without any flags at all. - -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" - -# The ordering *is* (sometimes) important. Some notes on the -# individual items follow: - -# pthreads: AIX (must check this before -lpthread) -# none: in case threads are in libc; should be tried before -Kthread and -# other compiler flags to prevent continual compiler warnings -# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) -# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) -# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) -# -pthreads: Solaris/gcc -# -mthreads: Mingw32/gcc, Lynx/gcc -# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it -# doesn't hurt to check since this sometimes defines pthreads too; -# also defines -D_REENTRANT) -# pthread: Linux, etcetera -# --thread-safe: KAI C++ - -case "${host_cpu}-${host_os}" in - *solaris*) - - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthread or - # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, - # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags" - ;; -esac - -if test x"$acx_pthread_ok" = xno; then -for flag in $acx_pthread_flags; do - - case $flag in - none) - AC_MSG_CHECKING([whether pthreads work without any flags]) - ;; - - -*) - AC_MSG_CHECKING([whether pthreads work with $flag]) - PTHREAD_CFLAGS="$flag" - ;; - - *) - AC_MSG_CHECKING([for the pthreads library -l$flag]) - PTHREAD_LIBS="-l$flag" - ;; - esac - - save_LIBS="$LIBS" - save_CFLAGS="$CFLAGS" - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) - # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init - # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. - AC_TRY_LINK([#include ], - [pthread_t th; pthread_join(th, 0); - pthread_attr_init(0); pthread_cleanup_push(0, 0); - pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], - [acx_pthread_ok=yes]) - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - AC_MSG_RESULT($acx_pthread_ok) - if test "x$acx_pthread_ok" = xyes; then - break; - fi - - PTHREAD_LIBS="" - PTHREAD_CFLAGS="" -done -fi - -# Various other checks: -if test "x$acx_pthread_ok" = xyes; then - save_LIBS="$LIBS" - LIBS="$PTHREAD_LIBS $LIBS" - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $PTHREAD_CFLAGS" - - # Detect AIX lossage: threads are created detached by default - # and the JOINABLE attribute has a nonstandard name (UNDETACHED). - AC_MSG_CHECKING([for joinable pthread attribute]) - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_JOINABLE;], - ok=PTHREAD_CREATE_JOINABLE, ok=unknown) - if test x"$ok" = xunknown; then - AC_TRY_LINK([#include ], - [int attr=PTHREAD_CREATE_UNDETACHED;], - ok=PTHREAD_CREATE_UNDETACHED, ok=unknown) - fi - if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then - AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok, - [Define to the necessary symbol if this constant - uses a non-standard name on your system.]) - fi - AC_MSG_RESULT(${ok}) - if test x"$ok" = xunknown; then - AC_MSG_WARN([we do not know how to create joinable pthreads]) - fi - - AC_MSG_CHECKING([if more special flags are required for pthreads]) - flag=no - case "${host_cpu}-${host_os}" in - *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";; - *solaris* | alpha*-osf*) flag="-D_REENTRANT";; - esac - AC_MSG_RESULT(${flag}) - if test "x$flag" != xno; then - PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" - fi - - LIBS="$save_LIBS" - CFLAGS="$save_CFLAGS" - - # More AIX lossage: must compile with cc_r - AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC}) -else - PTHREAD_CC="$CC" -fi - -AC_SUBST(PTHREAD_LIBS) -AC_SUBST(PTHREAD_CFLAGS) -AC_SUBST(PTHREAD_CC) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$acx_pthread_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) - : -else - acx_pthread_ok=no - $2 -fi - -])dnl ACX_PTHREAD - - - -dnl @synopsis AC_PROG_CC_WARNINGS([ANSI]) -dnl -dnl Enables a reasonable set of warnings for the C compiler. Optionally, -dnl if the first argument is nonempty, turns on flags which enforce and/or -dnl enable proper ANSI C if such flags are known to the compiler used. -dnl -dnl Currently this macro knows about GCC, Solaris C compiler, -dnl Digital Unix C compiler, C for AIX Compiler, HP-UX C compiler, -dnl and IRIX C compiler. -dnl -dnl @version $Id: acinclude.m4,v 1.2 2001/12/21 03:12:50 robs Exp $ -dnl @author Ville Laurikari -dnl -AC_DEFUN([AC_PROG_CC_WARNINGS], [ - ansi=$1 - if test -z "$ansi"; then - msg="for C compiler warning flags" - else - msg="for C compiler warning and ANSI conformance flags" - fi - AC_CACHE_CHECK($msg, ac_cv_prog_cc_warnings, [ - if test -n "$CC"; then - cat > conftest.c <&1 | grep "Xc.*strict ANSI C" > /dev/null 2>&1 && - $CC -c -v -Xc conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-v" - else - ac_cv_prog_cc_warnings="-v -Xc" - fi - - dnl HP-UX C compiler - elif $CC > /dev/null 2>&1 && - $CC -c -Aa +w1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="+w1" - else - ac_cv_prog_cc_warnings="+w1 -Aa" - fi - - dnl Digital Unix C compiler - elif ! $CC > /dev/null 2>&1 && - $CC -c -verbose -w0 -warnprotos -std1 conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos" - else - ac_cv_prog_cc_warnings="-verbose -w0 -warnprotos -std1" - fi - - dnl C for AIX Compiler - elif $CC > /dev/null 2>&1 | grep AIX > /dev/null 2>&1 && - $CC -c -qlanglvl=ansi -qinfo=all conftest.c > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" - else - ac_cv_prog_cc_warnings="-qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd -qlanglvl=ansi" - fi - - dnl IRIX C compiler - elif $CC -fullwarn -ansi -ansiE > /dev/null 2>&1 && - test -f conftest.o; then - if test -z "$ansi"; then - ac_cv_prog_cc_warnings="-fullwarn" - else - ac_cv_prog_cc_warnings="-fullwarn -ansi -ansiE" - fi - - fi - rm -f conftest.* - fi - if test -n "$ac_cv_prog_cc_warnings"; then - CFLAGS="$CFLAGS $ac_cv_prog_cc_warnings" - else - ac_cv_prog_cc_warnings="unknown" - fi - ]) -]) - - - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/configure b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/configure deleted file mode 100644 index cdf6f468270..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/configure +++ /dev/null @@ -1,3116 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by Autoconf 2.52. -# -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Name of the executable. -as_me=`echo "$0" |sed 's,.*[\\/],,'` - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -as_executable_p="test -f" - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - -# NLS nuisances. -$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } -$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } -$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } -$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } -$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } -$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } -$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } -$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -cross_compiling=no -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_SYS_STAT_H -# include -#endif -#if STDC_HEADERS -# include -# include -#else -# if HAVE_STDLIB_H -# include -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include -# endif -# include -#endif -#if HAVE_STRINGS_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif -#if HAVE_UNISTD_H -# include -#endif" - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: should be removed in autoconf 3.0. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat < if you have libraries in a - nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -EOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue - cd $ac_subdir - # A "../" for each directory in /$ac_subdir. - ac_dots=`echo $ac_subdir | - sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` - - case $srcdir in - .) # No --srcdir option. We are building in place. - ac_sub_srcdir=$srcdir ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_sub_srcdir=$srcdir/$ac_subdir ;; - *) # Relative path. - ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; - esac - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_sub_srcdir/configure.gnu; then - echo - $SHELL $ac_sub_srcdir/configure.gnu --help=recursive - elif test -f $ac_sub_srcdir/configure; then - echo - $SHELL $ac_sub_srcdir/configure --help=recursive - elif test -f $ac_sub_srcdir/configure.ac || - test -f $ac_sub_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\EOF - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -EOF - exit 0 -fi -exec 5>config.log -cat >&5 </dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -PATH = $PATH - -_ASUNAME -} >&5 - -cat >&5 <\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - ac_sep=" " ;; - *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" - ac_sep=" " ;; - esac - # Get rid of the leading space. -done - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - echo >&5 - echo "## ----------------- ##" >&5 - echo "## Cache variables. ##" >&5 - echo "## ----------------- ##" >&5 - echo >&5 - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} >&5 - sed "/^$/d" confdefs.h >conftest.log - if test -s conftest.log; then - echo >&5 - echo "## ------------ ##" >&5 - echo "## confdefs.h. ##" >&5 - echo "## ------------ ##" >&5 - echo >&5 - cat conftest.log >&5 - fi - (echo; echo) >&5 - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" >&5 - echo "$as_me: exit $exit_status" >&5 - rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:854: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - cat "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:865: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:873: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:889: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:893: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:899: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:901: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:903: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. It doesn't matter if - # we pass some twice (in addition to the command line arguments). - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` - ac_configure_args="$ac_configure_args '$ac_arg'" - ;; - *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" - ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:922: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:924: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac -echo "#! $SHELL" >conftest.sh -echo "exit 0" >>conftest.sh -chmod +x conftest.sh -if { (echo "$as_me:944: PATH=\".;.\"; conftest.sh") >&5 - (PATH=".;."; conftest.sh) 2>&5 - ac_status=$? - echo "$as_me:947: \$? = $ac_status" >&5 - (exit $ac_status); }; then - ac_path_separator=';' -else - ac_path_separator=: -fi -PATH_SEPARATOR="$ac_path_separator" -rm -f conftest.sh - - ac_config_headers="$ac_config_headers fcgi_config.h" - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:966: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:981: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:989: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:992: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:1001: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1016: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:1024: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:1027: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1040: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1055: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1063: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1066: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:1075: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1090: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:1098: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:1101: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:1114: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue -fi -ac_cv_prog_CC="cc" -echo "$as_me:1134: found $ac_dir/$ac_word" >&5 -break -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" ${1+"$@"} - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1156: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1159: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1170: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1185: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:1193: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:1196: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:1209: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else - ac_save_IFS=$IFS; IFS=$ac_path_separator -ac_dummy="$PATH" -for ac_dir in $ac_dummy; do - IFS=$ac_save_IFS - test -z "$ac_dir" && ac_dir=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1224: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:1232: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:1235: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - -test -z "$CC" && { { echo "$as_me:1247: error: no acceptable cc found in \$PATH" >&5 -echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:1252:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1255: \"$ac_compiler --version &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 - ac_status=$? - echo "$as_me:1258: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:1260: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 - ac_status=$? - echo "$as_me:1263: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:1265: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 - ac_status=$? - echo "$as_me:1268: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line 1272 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:1288: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1291: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:1294: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. -for ac_file in `ls a.exe conftest.exe 2>/dev/null; - ls a.out conftest 2>/dev/null; - ls a.* conftest.* 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; - a.out ) # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool --akim. - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:1317: error: C compiler cannot create executables" >&5 -echo "$as_me: error: C compiler cannot create executables" >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:1323: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:1328: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:1334: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1337: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:1344: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:1352: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:1359: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1361: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:1364: checking for executable suffix" >&5 -echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1366: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:1369: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:1385: error: cannot compute EXEEXT: cannot compile and link" >&5 -echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:1391: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:1397: checking for object suffix" >&5 -echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 1403 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1415: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1418: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -{ { echo "$as_me:1430: error: cannot compute OBJEXT: cannot compile" >&5 -echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:1437: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:1441: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 1447 "configure" -#include "confdefs.h" - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:1462: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1465: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1468: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1471: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:1483: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:1489: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 1495 "configure" -#include "confdefs.h" - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:1507: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1510: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1513: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1516: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:1526: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:1553: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1556: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1559: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1562: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line 1574 "configure" -#include "confdefs.h" -#include -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:1587: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1590: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1593: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1596: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line 1606 "configure" -#include "confdefs.h" -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:1618: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:1621: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1624: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1627: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:1659: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line 1680 "configure" -#include "confdefs.h" -#include - Syntax error -_ACEOF -if { (eval echo "$as_me:1685: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:1691: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line 1714 "configure" -#include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:1718: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:1724: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:1761: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line 1771 "configure" -#include "confdefs.h" -#include - Syntax error -_ACEOF -if { (eval echo "$as_me:1776: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:1782: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line 1805 "configure" -#include "confdefs.h" -#include -_ACEOF -if { (eval echo "$as_me:1809: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:1815: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:1843: error: C preprocessor \"$CPP\" fails sanity check" >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -echo "$as_me:1854: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 1860 "configure" -#include "confdefs.h" -#include -#include -#include -#include - -_ACEOF -if { (eval echo "$as_me:1868: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:1874: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no -fi -rm -f conftest.err conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line 1896 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line 1914 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -#line 1935 "configure" -#include "confdefs.h" -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:1961: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:1964: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:1966: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:1969: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_header_stdc=no -fi -rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:1982: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:1998: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 2004 "configure" -#include "confdefs.h" -$ac_includes_default -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2010: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2013: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2016: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2019: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:2029: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line 2047 "configure" -#include "confdefs.h" -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:2096: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2099: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2102: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2105: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:2122: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:2125: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - - echo "$as_me:2130: checking for ssize_t" >&5 -echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6 -if test "${ac_cv_type_ssize_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 2136 "configure" -#include "confdefs.h" -$ac_includes_default -int -main () -{ -if ((ssize_t *) 0) - return 0; -if (sizeof (ssize_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2151: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2154: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2157: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2160: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_type_ssize_t=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_type_ssize_t=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:2170: result: $ac_cv_type_ssize_t" >&5 -echo "${ECHO_T}$ac_cv_type_ssize_t" >&6 -if test $ac_cv_type_ssize_t = yes; then - : -else - -cat >>confdefs.h <&5 -echo $ECHO_N "checking for sun_len in sys/un.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 2185 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "sun_len" >/dev/null 2>&1; then - echo "$as_me:2192: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_SOCKADDR_UN_SUN_LEN 1 -EOF - -else - echo "$as_me:2200: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - echo "$as_me:2205: checking for fpos_t in stdio.h" >&5 -echo $ECHO_N "checking for fpos_t in stdio.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 2208 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "fpos_t" >/dev/null 2>&1; then - echo "$as_me:2215: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_FPOS 1 -EOF - -else - echo "$as_me:2223: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - -for ac_header in sys/socket.h netdb.h netinet/in.h arpa/inet.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:2231: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 2237 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:2241: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:2247: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:2266: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 2285 "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:2289: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - egrep -v '^ *\+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:2295: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_ext -fi -echo "$as_me:2314: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 -echo $ECHO_N "checking for a fileno() prototype in stdio.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 2327 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "fileno" >/dev/null 2>&1; then - echo "$as_me:2334: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_FILENO_PROTO 1 -EOF - -else - echo "$as_me:2342: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - if test "$HAVE_SYS_SOCKET_H"; then - echo "$as_me:2348: checking for socklen_t in sys/socket.h" >&5 -echo $ECHO_N "checking for socklen_t in sys/socket.h... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 2351 "configure" -#include "confdefs.h" -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "socklen_t" >/dev/null 2>&1; then - echo "$as_me:2358: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_SOCKLEN 1 -EOF - -else - echo "$as_me:2366: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest* - - fi - - #-------------------------------------------------------------------- - # Do we need cross-process locking on this platform? - #-------------------------------------------------------------------- - echo "$as_me:2376: checking whether cross-process locking is required by accept()" >&5 -echo $ECHO_N "checking whether cross-process locking is required by accept()... $ECHO_C" >&6 - case "`uname -sr`" in - IRIX\ 5.* | SunOS\ 5.* | UNIX_System_V\ 4.0) - echo "$as_me:2380: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define USE_LOCKING 1 -EOF - - ;; - *) - echo "$as_me:2389: result: no" >&5 -echo "${ECHO_T}no" >&6 - ;; - esac - - #-------------------------------------------------------------------- - # Does va_arg(arg, long double) crash the compiler? - # hpux 9.04 compiler does and so does Stratus FTX (uses HP's compiler) - #-------------------------------------------------------------------- - echo "$as_me:2398: checking whether va_arg(arg, long double) crashes the compiler" >&5 -echo $ECHO_N "checking whether va_arg(arg, long double) crashes the compiler... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 2401 "configure" -#include "confdefs.h" -#include -int -main () -{ -long double lDblArg; va_list arg; lDblArg = va_arg(arg, long double); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2413: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2416: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2419: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2422: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:2424: result: no" >&5 -echo "${ECHO_T}no" >&6 -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:2429: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -cat >>confdefs.h <<\EOF -#define HAVE_VA_ARG_LONG_DOUBLE_BUG 1 -EOF - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - - echo "$as_me:2439: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 2445 "configure" -#include "confdefs.h" - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:2503: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:2506: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2509: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:2512: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_c_const=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:2522: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\EOF -#define const -EOF - -fi - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overriden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if cmp -s $cache_file confcache; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:2611: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -SHELL=\${CONFIG_SHELL-$SHELL} -ac_cs_invocation="\$0 \$@" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Name of the executable. -as_me=`echo "$0" |sed 's,.*[\\/],,'` - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -as_executable_p="test -f" - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - -# NLS nuisances. -$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } -$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } -$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } -$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } -$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } -$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } -$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } -$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } - -exec 6>&1 - -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\EOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration headers: -$config_headers - -Report bugs to ." -EOF - -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - shift - set dummy "$ac_option" "$ac_optarg" ${1+"$@"} - shift - ;; - -*);; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_need_defaults=false;; - esac - - case $1 in - # Handling of the options. -EOF -cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:2778: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - shift - CONFIG_FILES="$CONFIG_FILES $1" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - shift - CONFIG_HEADERS="$CONFIG_HEADERS $1" - ac_need_defaults=false;; - - # This is an error. - -*) { { echo "$as_me:2797: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -exec 5>>config.log -cat >&5 << _ACEOF - -## ----------------------- ## -## Running config.status. ## -## ----------------------- ## - -This file was extended by $as_me 2.52, executed with - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - > $ac_cs_invocation -on `(hostname || uname -n) 2>/dev/null | sed 1q` - -_ACEOF -EOF - -cat >>$CONFIG_STATUS <<\EOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "fcgi_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS fcgi_config.h" ;; - *) { { echo "$as_me:2833: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/cs$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - { (exit 1); exit 1; } -} - -EOF - -cat >>$CONFIG_STATUS <<\EOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:2903: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:2914: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:2927: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -EOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\EOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -EOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\EOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -EOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # egrep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\EOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated automatically by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated automatically by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:3044: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - { case "$ac_dir" in - [\\/]* | ?:[\\/]* ) as_incr_dir=;; - *) as_incr_dir=.;; -esac -as_dummy="$ac_dir" -for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do - case $as_mkdir_dir in - # Skip DOS drivespec - ?:) as_incr_dir=$as_mkdir_dir ;; - *) - as_incr_dir=$as_incr_dir/$as_mkdir_dir - test -d "$as_incr_dir" || mkdir "$as_incr_dir" - ;; - esac -done; } - - fi - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi - # Run the commands associated with the file. - case $ac_file in - fcgi_config.h ) # update the timestamp -echo timestamp >"./stamp-h1" - ;; - esac -done -EOF - -cat >>$CONFIG_STATUS <<\EOF - -{ (exit 0); exit 0; } -EOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/configure.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/configure.in deleted file mode 100644 index 4f5240f9d06..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/configure.in +++ /dev/null @@ -1,16 +0,0 @@ -dnl $Id: configure.in,v 1.9 2001/09/22 09:30:45 skimo Exp $ -dnl -dnl This file is an input file used by the GNU "autoconf" program to -dnl generate the file "configure", which is run during the build -dnl to configure the system for the local environment. - -AC_INIT - -AM_CONFIG_HEADER([fcgi_config.h]) - -AC_PROG_CC -AC_PROG_CPP - -FCGI_COMMON_CHECKS - -AC_OUTPUT diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/echo.PL b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/echo.PL deleted file mode 100644 index a8f9decfd88..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/echo.PL +++ /dev/null @@ -1,67 +0,0 @@ -use Config; - -open OUT, ">echo.fpl"; -print OUT "#!$Config{perlpath}\n"; -print OUT while ; -close OUT; -chmod 0755, "echo.fpl"; -__END__ -# -# echo-perl -- -# -# Produce a page containing all FastCGI inputs -# -# Copyright (c) 1996 Open Market, Inc. -# -# See the file "LICENSE.TERMS" for information on usage and redistribution -# of this file, and for a DISCLAIMER OF ALL WARRANTIES. -# -# $Id: echo.PL,v 1.2 2000/12/14 13:46:23 skimo Exp $ -# -# Changed by skimo to demostrate autoflushing 1997/02/19 -# - -use FCGI; -use strict; - -sub print_env { - my($label, $envp) = @_; - print("$label:
\n
\n");
-    my @keys = sort keys(%$envp);
-    foreach my $key (@keys) {
-        print("$key=$$envp{$key}\n");
-    }
-    print("

\n"); -} - -my %env; -my $req = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%env); -my $count = 0; -while($req->Accept() >= 0) { - print("Content-type: text/html\r\n\r\n", - "FastCGI echo (Perl)\n", - "

FastCGI echo (Perl)

\n", - "Request number ", ++$count, "

\n"); - my $len = 0 + $env{'CONTENT_LENGTH'}; - if($len == 0) { - print("No data from standard input.

\n"); - } else { - print("Standard input:
\n

\n");
-        for(my $i = 0; $i < $len; $i++) {
-            my $ch = getc(STDIN);
-            if($ch eq "") {
-                print("Error: Not enough bytes received ",
-                      "on standard input

\n"); - last; - } - print($ch); - } - print("\n

\n"); - } - print_env("Request environment", \%env); - print "More on its way ... wait a few seconds\n
\n
"; - $req->Flush(); - sleep(3); - print_env("Initial environment", \%ENV); - $req->Finish(); -} diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/fcgi_config.h.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/fcgi_config.h.in deleted file mode 100644 index c32284d1d40..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/fcgi_config.h.in +++ /dev/null @@ -1,76 +0,0 @@ -/* fcgi_config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define if there's a fileno() prototype in stdio.h */ -#undef HAVE_FILENO_PROTO - -/* Define if the fpos_t typedef is in stdio.h */ -#undef HAVE_FPOS - -/* Define if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define if sockaddr_un in sys/un.h contains a sun_len component */ -#undef HAVE_SOCKADDR_UN_SUN_LEN - -/* Define if the socklen_t typedef is in sys/socket.h */ -#undef HAVE_SOCKLEN - -/* Define if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define if you have the header file. */ -#undef HAVE_STRING_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define if va_arg(arg, long double) crashes the compiler */ -#undef HAVE_VA_ARG_LONG_DOUBLE_BUG - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if cross-process locking is required by accept() */ -#undef USE_LOCKING - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `int' if does not define. */ -#undef ssize_t diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/oldinterface.pod b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/oldinterface.pod deleted file mode 100644 index bb288a19089..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/oldinterface.pod +++ /dev/null @@ -1,50 +0,0 @@ -=head1 NAME - -FCGI - Fast CGI module - -=head1 SYNOPSIS - - use FCGI; - - $count = 0; - while(FCGI::accept() >= 0) { - print("Content-type: text/html\r\n\r\n", ++$count); - } - -=head1 DESCRIPTION - -Functions: - -=over 4 - -=item FCGI::accept() - -Accepts a connection. Returns 0 on success. -If a connection has been accepted before, the old -one will be finished first. - -=item FCGI::finish() - -Finishes accepted connection. - -=item FCGI::flush() - -Flushes accepted connection. - -=item FCGI::set_exit_status(status) - -Sets the exit status that finish returns to the server. - -=item FCGI::start_filter_data() - -Does anyone use this function ? - -=back - -=head1 AUTHOR - -Sven Verdoolaege - -=cut - -__END__ diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/remote.PL b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/remote.PL deleted file mode 100644 index bcfdd7f1aa3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/remote.PL +++ /dev/null @@ -1,36 +0,0 @@ -use Config; - -open OUT, ">remote.fpl"; -print OUT "#!$Config{perlpath}\n"; -print OUT while ; -close OUT; -chmod 0755, "remote.fpl"; -__END__ -# An example of using a remote script with an Apache webserver. -# Run this Perl program on "otherhost" to bind port 8888 and wait -# for FCGI requests from the webserver. - -## Sample Apache configuration on the webserver to refer to the -## remote script on "otherhost" -# -# AddHandler fastcgi-script fcgi -# FastCgiExternalServer /path-to/cgi-bin/external.fcgi -host otherhost:8888 -# - -# Access the URL: http://webserver/cgi-bin/external.fcgi - -# Contributed by Don Bindner - -use FCGI; - -my $socket = FCGI::OpenSocket( ":8888", 5 ); -my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, - \%ENV, $socket ); - -my $count; -while( $request->Accept() >= 0 ) { - print "Content-type: text/html\r\n\r\n"; - print ++$count; -} - -FCGI::CloseSocket( $socket ); diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/threaded.PL b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/threaded.PL deleted file mode 100644 index f8a8c62fd77..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/threaded.PL +++ /dev/null @@ -1,52 +0,0 @@ -use Config; - -open OUT, ">threaded.fpl"; -print OUT "#!$Config{perlpath}\n"; -print OUT while ; -close OUT; -chmod 0755, "threaded.fpl"; -__END__ - -use FCGI; -use Thread; -use IO::Handle; - -use constant THREAD_COUNT => 5; - -sub doit { - my $k = shift; - my %env; - my $in = new IO::Handle; - my $out = new IO::Handle; - my $err = new IO::Handle; - - my $request = FCGI::Request($in, $out, $err, \%env); - - while ($request->Accept() >= 0) { - print $out - "Content-type: text/html\r\n", - "\r\n", - "FastCGI Hello! (multi-threaded perl, fcgiapp library)", - "

FastCGI Hello! (multi-threaded perl, fcgiapp library)

", - "Request counts for ", THREAD_COUNT ," threads ", - "running on host $env{SERVER_NAME}

"; - - { - lock(@count); - - ++$count[$k]; - - for(my $i = 0; $i < THREAD_COUNT; ++$i) { - print $out $count[$i]; - print $out " "; - } - } - $request->Flush(); - sleep(1); - } -} - -for ($t = 1; $t < THREAD_COUNT; ++$t) { - new Thread \&doit, $t; -} -doit(0); diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/typemap b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/typemap deleted file mode 100644 index 62618be3487..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/typemap +++ /dev/null @@ -1,17 +0,0 @@ -TYPEMAP -FCGI T_PTROBJ -FCGI::Stream T_PTROBJ -GLOBREF T_GLOBREF -HASHREF T_HASHREF - -INPUT -T_GLOBREF - if (SvROK($arg) && isGV(SvRV($arg))) { - $var = (GV*)SvRV($arg); - } else - croak(\"$var is not a GLOB reference\"); -T_HASHREF - if (SvROK($arg) && SvTYPE(SvRV($arg)) == SVt_PVHV) { - $var = (HV*)SvRV($arg); - } else - croak(\"$var is not a reference to a hash\"); diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/version.pm b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/version.pm deleted file mode 100644 index 1f2ec8d3769..00000000000 --- a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/perl/version.pm +++ /dev/null @@ -1,3 +0,0 @@ -package FCGI; - -$VERSION = '0.67'; diff --git a/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/stamp-h.in b/src/utils/mp_gpprof_server/libraries/fcgi-2.4.0/stamp-h.in deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/GP.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/GP/GP.dsw deleted file mode 100644 index c69db83e67c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/GP.dsw +++ /dev/null @@ -1,53 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gpstress"=.\gpstress\gpstress.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gptest"=.\gptest\gptest.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gptestc"=.\gptestc\gptestc.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/GP/changelog.txt deleted file mode 100644 index d9553492a2c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/changelog.txt +++ /dev/null @@ -1,182 +0,0 @@ -Changelog for: GameSpy Presence & Messaging SDK --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -12-12-2007 1.13.00 RMV RELEASE Released to Developer Site -12-12-2007 1.12.15 RMV OTHER Updated gptest app to include block list functions and cleaned up buddy messaging -12-05-2007 1.12.14 SN OTHER Added test for searching unique nickes across namespaces -11-27-2007 1.12.13 SAH CLEANUP Moved extern "c" block below includes to prevent linker errors -11-19-2007 1.12.12 SAH OTHER Marked gpFindPlayers and gpSetInvitableGames as DEPRECATED - SAH CLEANUP Removed gpFindPlayers and gpSetInvitableGames from MFC app -11-13-2007 1.12.11 SAH OTHER Modified GP MFC App to support Blocked Lists - SAH FIX Fixed bug where blocked list was deleted from disabling info cache -11-12-2007 1.12.10 MWJ FEATURE Added/updated Add/Remove Block List error messages -11-09-2007 1.12.09 SAH CLEANUP Switched to using a darray for NP Id lookup transactions - SAH FIX Fixed NP Block List Add to keep trying if NP returns busy -11-08-2007 1.12.08 SAH CLEANUP Removed gpGetBlockedList to replace with more consistent functions - SAH FEATURE Added gpGetNumBlocked, gpGetBlockedProfile, gpIsBlocked -11-05-2007 1.12.07 SAH FEATURE Added NP Block List mirroring for gpAddtoBlockedList - SAH FEATURE Added initial support for PS3 NP Block List Syncing -10-30-2007 1.12.06 SAH FEATURE Added BlockedList support and buddy/block list retrieval upon login - SAH FIX Fixed bug causing infoCache to not save when disconnect called before destroy - SAH FIX Fixed memory leak from infoCacheBuddyOnly not freeing up status data -10-23-2007 1.12.05 SAH FIX Fixed NP Sync so it only destroys NP if GP was the one that initialized it -10-11-2007 1.12.04 SAH FIX Fixed gpiPS3.c to use gpSendBuddyRequest to remove errors using GSI_UNICODE -09-14-2007 1.12.03 SAH FEATURE Added initial support for PS3 NP Buddy Syncing - SAH FIX Fixed two bugs in gpSearch.c - searches causing assert and missing unicode support -09-11-2007 1.12.02 DES FEATURE Added support for a search by uniquenick across multiple namespaces -08-23-2007 1.12.01 SAH OTHER Added gpRegisterCdKey to gptest MFC sample -08-06-2007 1.12.00 RMV RELEASE Released to Developer Site -07-27-2007 1.11.03 BED FEATURE Added gpRegisterCdKey -07-19-2007 1.11.02 SAH FIX Added explicit typecasts to remove compiler warnings, Fixed DS project -07-10-2007 1.11.01 RMV FIX Fixed gptest/gptestc Project files to get rid of Unicode warnings - RMV FIX Fixed memory allocation to prevent possible use of uninitialized pointer in gp.c -06-07-2007 1.11.00 SN RELEASE Releasing to developer site -06-07-2007 1.11.00 SN FEATURE Added newer style buddy status info - SN FEATURE Replaced old TCP peer to peer code with UDP Layer - SN FEATURE Added keys/values pair feature -05-22-2007 1.10.05 DES FEATURE Added gpGetInfoNoWait -05-17-2007 1.10.04 DES FIX Added a few explicit casts to avoid warnings -02-21-2007 1.10.03 SN FEATURE Added a version of get reverse buddies that allows a specified list of profiles to be passed in. -01-16-2007 1.10.02 DES FEATURE Added X360 support -12-21-2006 1.10.01 DES FEATURE Added initial support for quiet mode -12-15-2006 1.10.00 MJW RELEASE Released to Developer Site -12-13-2006 1.09.69 SN FIX Removed connection state change to allow the internal disconnect function to change the state -10-05-2006 1.09.68 SAH FIX Updated MacOSX Makefile -09-28-2006 1.09.67 SAH FIX Fixed PS3 project to work with PS3 095.00x SDK; changed included libaries in linker input. -08-07-2006 1.09.66 SAH FIX fixed gpGetBuddyStatus to set 'status' output to '\0' if it encounters NULL data -08-04-2006 1.09.65 SAH OTHER Changed ctime/gmtime calls to gsi time wrapper calls -08-03-2006 1.09.64 DDW FEATURE Added support for automatic login ticket renewal -08-02-2006 1.09.63 DDW OTHER Added productID to GUI for gptest sample -08-02-2006 1.09.62 SAH RELEASE Releasing to developer site -07-31-2006 1.09.62 SAH FIX Fixed PS3 project file - added post-build step to create *.SELF for execution -07-25-2006 1.09.61 SAH FIX Fixed NITRO project, include for crt0.o now above others so it add correct file -07-24-2006 1.09.60 SAH FIX Removed #ifdef _PS3 for socket calls (changed platformSocket.h to typecast calls) -07-06-2006 1.09.59 SAH FIX Fixed PSP project file to not explicitly include the PSP linker file -06-30-2006 1.09.58 SAH FIX Fixed NITRO project & linker command file (to work with CW 2.0/NitroSDK 3.1) - SAH FIX Fixed Linux makefile -06-27-2006 1.09.57 SAH FIX Removed unused variables in gpiInfo.c and gpiSearch.c -06-26-2006 1.09.56 BMS FEATURE Passwords no longer go over the wire in cleartext -05-31-2006 1.09.55 SAH RELEASE Releasing to developer site - SAH FIX Fixed Linux makefile -05-30-2006 1.09.54 SAH FIX Fixed PS3 project to work with newest PS3(084_001 SDK) release -05-25-2006 1.09.53 SAH FIX Added PS3 required typecasts - SAH FIX Changed PSP project warning levels - SAH FIX Fixed PS3 project to compile with 084_001 SDK -05-22-2006 1.09.52 SAH FIX Added GSI_UNUSED calls to get rid of codewarrior warnings -05-19-2006 1.09.51 SAH FIX Added gsTestMain.c to nitro CodeWarrior project -05-15-2006 1.09.50 SAH FIX Added "PS3 Release" configuration to project -05-08-2006 1.09.49 SAH FIX Changed some sprintf calls on empty string to strcpy -04-27-2006 1.09.48 BMS FEATURE Updates to Fedreg implementation: login and profile update also needed partner ID. -04-25-2006 1.09.47 SAH RELEASE Releasing to developer site -04-24-2006 1.09.47 SAH FIX Fixed Nitro project files to work on build machine -04-13-2006 1.09.46 SAH FIX Replaced all (rcode == SOCKET_ERROR) w/ (gsiSocketIsError(rcode)) -04-12-2006 1.09.45 BMS FEATURE Updates for Fedreg. Includes new partner ID parameter on gpInitialize. -02-27-2006 1.09.44 SN FIX Added check to determine if hard coded IP was used for connection manager -02-03-2006 1.09.43 SN FIX Added checks for character string limits within gpConnectNewUser -01-26-2006 1.09.42 SN FIX Added psp prodg solution and project to sgv -01-19-2006 1.09.42 RH FIX Changed gpSendBuddyUTM message type from char * to gsi_char *. -12-16-2005 1.09.41 SN OTHER Cleaned up projects to missing common code if any -12-12-2005 1.09.40 SN FIX Removed connection closed check, eliminating false timeouts -11-18-2005 1.09.40 SN FEATURE Added timeout errors to searches which are non-fatal. -11-17-2005 1.09.39 DES FIX Updated Nitro Makefile. - DES FIX Fixed Unicode incompatibility in gptestc. -11-14-2005 1.09.38 DES FIX Updated the OSX Makefile. - DES FEATURE Added support for GSI_DOMAIN_NAME -11-03-2005 1.09.37 BED FEATURE Added ps3 makefile. -09-21-2005 1.09.36 DES FEATURE Updated DS support - DES FEATURE Updated to use the common debug code - DES FIX All connection operation errors are now fatal errors - DES CLEANUP Cleaned up gptestc and added a firewall option -09-16-2005 1.09.35 BED FEATURE Added a callback for buddy revoke notifications. -08-19-2005 1.09.34 BED FIX Update linux makefile -08-11-2005 1.09.33 BED FEATURE Added support for Buddy UTMs (part one, text messages on separate channel) -07-28-2005 1.09.32 SN RELEASE Releasing to developer site. -07-27-2005 1.09.32 SN FEATURE Added support for new style responses for both gpdeleteprofile and buddy authorizations. -06-03-2005 1.09.31 SN RELEASE Releasing to developer site. -05-26-2005 1.09.31 SN FIX Fixed the setinfo function that sent passwords in clear text. Now passwords are encrypted for security purposes. -05-05-2005 1.09.30 BED FIX Updated projects to use new common folder -04-29-2005 1.09.29 SN OTHER Created a Visual Studio .NET project -04-28-2005 1.09.29 SN RELEASE Releasing to developer site. -04-27-2005 1.09.29 DES RELEASE Limited release to Nintendo DS developers. -04-27-2005 1.09.29 DES CLEANUP Extra printfs in gptestc. - DES FEATURE Always assume a firewall on the DS. -04-25-2005 1.09.28 DES FIX Cleaned up a Nitro warning. - DES CLEANUP General cleanup of gptestc. - DES CLEANUP Disable Win32 linker warning. -04-04-2005 1.09.27 SN RELEASE Releasing to developer site. -04-01-2005 1.09.27 DDW FIX Use gsi_time in transfer file structure to match nonport definition -03-30-2005 1.09.26 SN FIX Changed size of unique nick to match DB size plus null character -03-30-2005 1.09.25 SN FIX Fixed case where time was of type long instead of 32 bit int -03-28-2005 1.09.24 SN FIX Fixed bug with all transfers being deleted when deleting only those associated with a single peer -03-18-2005 1.09.24 DES FIX Fixed typo in parameter explanation. -03-14-2005 1.09.23 DES FEATURE Nintendo DS support -12-28-2004 1.09.22 SN FIX Added const qualifiers to function parameters not modified -09-24-2004 1.09.21 BED FIX SDK now allows you to delete buddies that it doesn't have a status for. -09-16-2004 1.09.20 SN RELEASE Releasing to developer site. -08-31-2004 1.09.20 SN FIX Added call to reset the GP internal connection structure fixing memory leaks -08-27-2004 1.09.19 DES CLEANUP Removed MacOS style includes - DES CLEANUP Removed headers already included in nonport.h - XGD bug in caching profile marketing info - DES CLEANUP Updated Win32 project configurations - DES CLEANUP Fixed warnings under OSX - DES CLEANUP Updated OSX Makefile -08-05-2004 1.09.18 SN RELEASE Releasing to developer site. -07-19-2004 1.09.18 SN FIX Updated code with explicit casts to remove implicit cast error - when compiling at highest level and warnings treated as errors. -06-25-2004 1.09.18 BED FEATURE Added location string to gpInvitePlayer -06-24-2004 1.09.17 BED FEATURE Now encrypting password and cdkey for gpNewUser -06-18-2004 1.09.16 BED RELEASE Releasing to developer site. -06-17-2004 1.09.16 DDW FEATURE Added login ticket support -06-16-2004 1.09.15 BED FEATURE Added PS2 Insock support -05-20-2004 1.09.14 BED RELEASE Releasing to developer site. -05-20-2004 1.09.14 BED FEATURE Added state GP_INFO_CACHING_BUDDY_ONLY. -04-05-2004 1.09.13 BED FIX Fixed small allocation bug in Unicode interface. -03-30-2004 1.09.12 BED FIX Removed misc compiler warnings for VC7 strict compiling. -01-10-2004 1.09.11 BED FIX Fixed typo'd length for email addresses in gpNewUser. -01-08-2004 1.09.10 BED FIX ProfileID was not initialized when receiving a buddy message in UNICODE mode. -01-03-2004 1.09.09 DES FIX Receive and send buffer sizes are now set on incoming Peer sockets. -11-10-2003 1.09.08 DES RELEASE Releasing to developer site. -11-07-2003 1.09.08 BED FIX Removed CodeWarrior strictest warnings. -11-07-2003 1.09.07 DES FIX Updated the linux and PS2 makefiles. -11-04-2003 1.09.06 DES FEATURE Added availability check code. -11-03-2003 1.09.05 BED FIX Converting email and passwords to Ascii instead of UTF8 now. - FIX Removed misc. strict warnings in sample. -10-29-2003 1.09.04 DES FEATURE Pass the gamename to the backend when connecting or searching. -10-21-2003 1.09.03 BED RELEASE Releasing to developer site. (UNIQUE NICK AND UNICODE SUPPORT) -10-21-2003 1.09.03 DES FEATURE Updated gptest to handle new connect methods. -10-17-2003 1.09.02 DES FIX Changed gptest to use the default GameSpy namespace. -10-16-2003 1.09.01 DES FIX The desirednick pased to gpSuggestUniqueNick now has a - length of GP_UNIQUENICK_LEN instead of GP_NICK_LEN. -09-22-2003 1.09.00 DES FEATURE Added support for unique nicks. - FEATURE Added support for associating a cdkey with a unique nick. - FEATURE Added a namespaceID parameter to gpInitialize for setting the current namespace. - FEATURE Added gpConnectPreAuthenticated for logging in from a partner system. - FIX Minor internal cleanup and fixes. -09-14-2003 1.08.17 DES FIX Removed Unicode defines for gptest debug project. -09-08-2003 1.08.16 BED FEATURE Added wrapper for UNICODE support. -07-24-2003 1.08.15 DES RELEASE Releasing to developer site. -07-24-2003 1.08.15 DES CLEANUP Removed unused gpiSendInfo(). - CLEANUP Fixed up NOFILE usage to prevent warnings. -07-18-2003 1.08.14 BED FEATURE Added CodeWarrior (PS2) sample project file. - BED CLEANUP General cleanup to remove CodeWarrior warnings. -07-17-2003 1.08.13 DES CLEANUP Cleaned up the PS2 Makefile, it now uses Makefile.commmon. -07-16-2003 1.08.12 BED FEATURE Added ProDG sample project files. -07-14-2003 1.08.11 DES FIX Changed check for __mips64 to check for _PS2. -07-10-2003 1.08.10 BED CLEANUP Changed GP to use GSI_UNUSED for silencing unused variable warnings. - CLEANUP Added newline to end of gpiUtility.c to silence compiler warning. -05-09-2003 1.08.09 DES CLEANUP Removed Dreamcast support. - FIX Metrowerks for Win32 is no longer falsely identified as MacOS. -04-08-2003 1.08.08 JED FIX Cleanup up code to remove multiple DevStudio level4 compiler warnings -03-26-2003 1.08.07 DES FIX gpiDisconnect now checks if sockets are valid before attempting to close them. -03-20-2003 1.08.06 DES FEATURE The productID is now reported to the backend on connect. -03-03-2003 1.08.05 DES CLEANUP General cleanup to remove warnings. -12-19-2002 1.08.04 DES RELEASE Releasing to developer site. -12-19-2002 1.08.04 DES CLEANUP Removed assert.h includes. -12-16-2002 1.08.03 DES FIX Set listen call to use SOMAXCONN for the backlog paramter. - CLEANUP Removed call to GOAClearSocketError. -12-13-2002 1.08.02 DES FEATURE Added PS2 eenet stack support. - CLEANUP Cleaned up code to remove PS2 compiler warnings. -12-11-2002 1.08.01 DES OTHER Moved SetSendBufferSize(), GetSendBufferSize(), and GetReceiveBufferSize() to nonport. -09-25-2002 1.08.00 DDW OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp.c deleted file mode 100644 index 90e0dafd706..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp.c +++ /dev/null @@ -1,4318 +0,0 @@ -/* -gp.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include -#include -#include "gpi.h" - -//FUNCTIONS -/////////// -GPResult gpInitialize( - GPConnection * connection, - int productID, - int namespaceID, - int partnerID -) -{ - // Check if the backend is available. - ///////////////////////////////////// - if(__GSIACResult != GSIACAvailable) - return GP_PARAMETER_ERROR; - - // Error check. - /////////////// - if(connection == NULL) - return GP_PARAMETER_ERROR; - - return gpiInitialize(connection, productID, namespaceID, partnerID); -} - -void gpDestroy( - GPConnection * connection -) -{ - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return; - - gpiDestroy(connection); -} - -GPResult gpEnable( - GPConnection * connection, - GPEnum state -) -{ - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - return gpiEnable(connection, state); -} - -GPResult gpDisable( - GPConnection * connection, - GPEnum state -) -{ - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - return gpiDisable(connection, state); -} - -GPResult gpProcess( - GPConnection * connection -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - return gpiProcess(connection, 0); -} - -GPResult gpSetCallback( - GPConnection * connection, - GPEnum func, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - int index; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Find which callback. - /////////////////////// - index = func; - if((index < 0) || (index >= GPI_NUM_CALLBACKS)) - Error(connection, GP_PARAMETER_ERROR, "Invalid func."); - - // Set the info. - //////////////// - iconnection->callbacks[index].callback = callback; - iconnection->callbacks[index].param = param; - - return GP_NO_ERROR; -} - -GPResult gpConnectA( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((nick == NULL) || (nick[0] == '\0')) - return GP_PARAMETER_ERROR; - if((email == NULL) || (email[0] == '\0')) - return GP_PARAMETER_ERROR; - if((password == NULL) || (password[0] == '\0')) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - GPConnectResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do it. - ///////// - return gpiConnect(connection, nick, "", email, password, "", "", NULL, firewall, GPIFalse, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpConnectW( - GPConnection * connection, - const unsigned short nick[GP_NICK_LEN], - const unsigned short email[GP_EMAIL_LEN], - const unsigned short password[GP_PASSWORD_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char nick_A[GP_NICK_LEN]; - char email_A[GP_EMAIL_LEN]; - char password_A[GP_PASSWORD_LEN]; - - UCS2ToAsciiString(nick, nick_A); - UCS2ToAsciiString(email, email_A); - UCS2ToAsciiString(password, password_A); - - return gpConnectA(connection, nick_A, email_A, password_A, firewall, blocking, callback, param); -} -#endif - -GPResult gpConnectNewUserA( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((nick == NULL) || (nick[0] == '\0')) - return GP_PARAMETER_ERROR; - if(uniquenick == NULL) - uniquenick = ""; - if((email == NULL) || (email[0] == '\0')) - return GP_PARAMETER_ERROR; - if((password == NULL) || (password[0] == '\0')) - return GP_PARAMETER_ERROR; - if(cdkey && (cdkey[0] == '\0')) - cdkey = NULL; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check the length of the nick. - //////////////////////////////// - if(strlen(nick) >= GP_NICK_LEN) - Error(connection, GP_PARAMETER_ERROR, "Nick too long."); - - // Check the length of the uniquenick. - ////////////////////////////////////// - if(strlen(uniquenick) >= GP_UNIQUENICK_LEN) - Error(connection, GP_PARAMETER_ERROR, "Uniquenick too long."); - - // Check the length of the email. - ///////////////////////////////// - if(strlen(email) >= GP_EMAIL_LEN) - Error(connection, GP_PARAMETER_ERROR, "Email too long."); - - // Check the length of the password. - //////////////////////////////////// - if(strlen(password) >= GP_PASSWORD_LEN) - Error(connection, GP_PARAMETER_ERROR, "Password too long."); - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - GPConnectResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do it. - ///////// - return gpiConnect(connection, nick, uniquenick, email, password, "", "", cdkey, firewall, GPITrue, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpConnectNewUserW( - GPConnection * connection, - const unsigned short nick[GP_NICK_LEN], - const unsigned short uniquenick[GP_UNIQUENICK_LEN], - const unsigned short email[GP_EMAIL_LEN], - const unsigned short password[GP_PASSWORD_LEN], - const unsigned short cdkey[GP_CDKEY_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char nick_A[GP_NICK_LEN]; - char uniquenick_A[GP_UNIQUENICK_LEN]; - char email_A[GP_NICK_LEN]; - char password_A[GP_NICK_LEN]; - char cdkey_A[GP_CDKEY_LEN]; - - UCS2ToAsciiString(nick, nick_A); - UCS2ToAsciiString(uniquenick, uniquenick_A); - UCS2ToAsciiString(email, email_A); - UCS2ToAsciiString(password, password_A); - UCS2ToAsciiString(cdkey, cdkey_A); - - return gpConnectNewUserA(connection, nick_A, uniquenick_A, email_A, password_A, cdkey_A, firewall, blocking, callback, param); -} -#endif - -GPResult gpConnectUniqueNickA( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((uniquenick == NULL) || (uniquenick[0] == '\0')) - return GP_PARAMETER_ERROR; - if((password == NULL) || (password[0] == '\0')) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - GPConnectResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do it. - ///////// - return gpiConnect(connection, "", uniquenick, "", password, "", "", NULL, firewall, GPIFalse, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpConnectUniqueNickW( - GPConnection * connection, - const unsigned short uniquenick[GP_UNIQUENICK_LEN], - const unsigned short password[GP_PASSWORD_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char uniquenick_A[GP_UNIQUENICK_LEN]; - char password_A[GP_NICK_LEN]; - - UCS2ToAsciiString(uniquenick, uniquenick_A); - UCS2ToAsciiString(password, password_A); - - return gpConnectUniqueNickA(connection, uniquenick_A, password_A, firewall, blocking, callback, param); -} -#endif - -GPResult gpConnectPreAuthenticatedA -( - GPConnection * connection, - const char authtoken[GP_AUTHTOKEN_LEN], - const char partnerchallenge[GP_PARTNERCHALLENGE_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((authtoken == NULL) || (authtoken[0] == '\0')) - return GP_PARAMETER_ERROR; - if((partnerchallenge == NULL) || (partnerchallenge[0] == '\0')) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - GPConnectResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do it. - ///////// - return gpiConnect(connection, "", "", "", "", authtoken, partnerchallenge, NULL, firewall, GPIFalse, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpConnectPreAuthenticatedW -( - GPConnection * connection, - const unsigned short authtoken[GP_AUTHTOKEN_LEN], - const unsigned short partnerchallenge[GP_PARTNERCHALLENGE_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char authtoken_A[GP_AUTHTOKEN_LEN]; - char partnerchallenge_A[GP_PARTNERCHALLENGE_LEN]; - - UCS2ToAsciiString(authtoken, authtoken_A); - UCS2ToAsciiString(partnerchallenge, partnerchallenge_A); - - return gpConnectPreAuthenticatedA(connection, authtoken_A, partnerchallenge_A, firewall, blocking, callback, param); -} -#endif - -void gpDisconnect( - GPConnection * connection -) -{ - GPIConnection * iconnection; - int oldState; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return; - - // Make a note of connection state prior to reset - ///////////////////////////////////////////////// - oldState = iconnection->connectState; - - gpiDisconnect(connection, GPITrue); - //Added by Saad Nader - //08-28-2004; fix for memory leaks after being disconnected abruptly - //////////////////////////////////////////////// - gpiReset(connection); - - // If we were connected prior, set to disconnected to save off info cache - ////////////////////////////////////////////////////////////////////////// - if (oldState == GPI_CONNECTED) - iconnection->connectState = GPI_DISCONNECTED; - -} - -GPResult gpIsConnected -( - GPConnection * connection, - GPEnum * connected -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Set the flag. - //////////////// - if(iconnection->connectState == GPI_CONNECTED) - *connected = GP_CONNECTED; - else - *connected = GP_NOT_CONNECTED; - - return GP_NO_ERROR; -} - -GPResult gpCheckUserA( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check the length of the nick. - //////////////////////////////// - if(strlen(nick) >= GP_NICK_LEN) - Error(connection, GP_PARAMETER_ERROR, "Nick too long."); - - // Check the length of the email. - ///////////////////////////////// - if(strlen(email) >= GP_EMAIL_LEN) - Error(connection, GP_PARAMETER_ERROR, "Email too long."); - - // Check the length of the password. - //////////////////////////////////// - if(password && (strlen(password) >= GP_PASSWORD_LEN)) - Error(connection, GP_PARAMETER_ERROR, "Password too long."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPCheckResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do the check. - //////////////// - return gpiCheckUser(connection, nick, email, password, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpCheckUserW( - GPConnection * connection, - const unsigned short nick[GP_NICK_LEN], - const unsigned short email[GP_EMAIL_LEN], - const unsigned short password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char nick_A[GP_NICK_LEN]; - char email_A[GP_NICK_LEN]; - char password_A[GP_NICK_LEN]; - - UCS2ToAsciiString(nick, nick_A); - UCS2ToAsciiString(email, email_A); - UCS2ToAsciiString(password, password_A); - - return gpCheckUserA(connection, nick_A, email_A, password_A, blocking, callback, param); -} -#endif - -GPResult gpNewUserA( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((nick == NULL) || (nick[0] == '\0')) - return GP_PARAMETER_ERROR; - if(uniquenick == NULL) - uniquenick = ""; - if((email == NULL) || (email[0] == '\0')) - return GP_PARAMETER_ERROR; - if((password == NULL) || (password[0] == '\0')) - return GP_PARAMETER_ERROR; - if(cdkey && (cdkey[0] == '\0')) - cdkey = NULL; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check the length of the nick. - //////////////////////////////// - if(strlen(nick) >= GP_NICK_LEN) - Error(connection, GP_PARAMETER_ERROR, "Nick too long."); - - // Check the length of the uniquenick. - ////////////////////////////////////// - if(strlen(uniquenick) >= GP_UNIQUENICK_LEN) - Error(connection, GP_PARAMETER_ERROR, "Uniquenick too long."); - - // Check the length of the email. - ///////////////////////////////// - if(strlen(email) >= GP_EMAIL_LEN) - Error(connection, GP_PARAMETER_ERROR, "Email too long."); - - // Check the length of the password. - //////////////////////////////////// - if(strlen(password) >= GP_PASSWORD_LEN) - Error(connection, GP_PARAMETER_ERROR, "Password too long."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPNewUserResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Creat the new user. - ////////////////////// - return gpiNewUser(connection, nick, uniquenick, email, password, cdkey, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpNewUserW( - GPConnection * connection, - const unsigned short nick[GP_NICK_LEN], - const unsigned short uniquenick[GP_UNIQUENICK_LEN], - const unsigned short email[GP_EMAIL_LEN], - const unsigned short password[GP_PASSWORD_LEN], - const unsigned short cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char nick_A[GP_NICK_LEN]; - char uniquenick_A[GP_UNIQUENICK_LEN]; - char email_A[GP_EMAIL_LEN]; - char password_A[GP_PASSWORD_LEN]; - char cdkey_A[GP_CDKEY_LEN]; - - UCS2ToAsciiString(nick, nick_A); - UCS2ToAsciiString(uniquenick, uniquenick_A); - UCS2ToAsciiString(email, email_A); - UCS2ToAsciiString(password, password_A); - UCS2ToAsciiString(cdkey, cdkey_A); - - return gpNewUserA(connection, nick_A, uniquenick_A, email_A, password_A, cdkey_A, blocking, callback, param); -} -#endif - -GPResult gpSuggestUniqueNickA( - GPConnection * connection, - const char desirednick[GP_NICK_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check the length of the desirednick. - /////////////////////////////////////// - if(strlen(desirednick) >= GP_UNIQUENICK_LEN) - Error(connection, GP_PARAMETER_ERROR, "Desirednick too long."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPSuggestUniqueNickResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Creat the new user. - ////////////////////// - return gpiSuggestUniqueNick(connection, desirednick, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpSuggestUniqueNickW( - GPConnection * connection, - const unsigned short desirednick[GP_NICK_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char desirednick_A[GP_UNIQUENICK_LEN]; - - UCS2ToAsciiString(desirednick, desirednick_A); - - return gpSuggestUniqueNickA(connection, desirednick_A, blocking, callback, param); -} -#endif - -GPResult gpRegisterUniqueNickA( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((uniquenick == NULL) || (uniquenick[0] == '\0')) - return GP_PARAMETER_ERROR; - if(cdkey && (cdkey[0] == '\0')) - cdkey = NULL; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPRegisterUniqueNickResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiRegisterUniqueNick(connection, uniquenick, cdkey, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpRegisterUniqueNickW( - GPConnection * connection, - const unsigned short uniquenick[GP_UNIQUENICK_LEN], - const unsigned short cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char uniquenick_A[GP_UNIQUENICK_LEN]; - char cdkey_A[GP_CDKEY_LEN]; - - UCS2ToAsciiString(uniquenick, uniquenick_A); - UCS2ToAsciiString(cdkey, cdkey_A); - - return gpRegisterUniqueNickA(connection, uniquenick_A, cdkey_A, blocking, callback, param); -} -#endif - - -GPResult gpRegisterCdKeyA( - GPConnection * connection, - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - if((cdkey == NULL) || (cdkey[0] == '\0')) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPRegisterCdKeyResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiRegisterCdKey(connection, cdkey, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpRegisterCdKeyW( - GPConnection * connection, - const gsi_char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char cdkey_A[GP_CDKEY_LEN]; - UCS2ToAsciiString(cdkey, cdkey_A); - return gpRegisterCdKeyA(connection, cdkey_A, blocking, callback, param); -} -#endif - -GPResult gpGetErrorCode( - GPConnection * connection, - GPErrorCode * errorCode -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Error check. - /////////////// - if(errorCode == NULL) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - *errorCode = (GPErrorCode)0; - return GP_NO_ERROR; - } - - // Set the code. - //////////////// - *errorCode = iconnection->errorCode; - - return GP_NO_ERROR; -} - -GPResult gpGetErrorStringA( - GPConnection * connection, - char errorString[GP_ERROR_STRING_LEN] -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Error check. - /////////////// - if(errorString == NULL) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - errorString[0] = '\0'; - return GP_NO_ERROR; - } - - // Copy the error string. - ///////////////////////// - strzcpy(errorString, iconnection->errorString, GP_ERROR_STRING_LEN); - return GP_NO_ERROR; -} -#ifdef GSI_UNICODE -GPResult gpGetErrorStringW( - GPConnection * connection, - unsigned short errorString[GP_ERROR_STRING_LEN] -) -{ - char errorString_A[GP_ERROR_STRING_LEN]; - GPResult result; - - result = gpGetErrorStringA(connection, errorString_A); - AsciiToUCS2String(errorString_A, errorString); - return result; -} -#endif - -GPResult gpNewProfileA( - GPConnection * connection, - const char nick[GP_NICK_LEN], - GPEnum replace, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check for no nick. - // PANTS|05.18.00 - ///////////////////// - if((nick == NULL) || (nick[0] == '\0')) - Error(connection, GP_PARAMETER_ERROR, "Invalid nick."); - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - GPNewProfileResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiNewProfile(connection, nick, replace, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpNewProfileW( - GPConnection * connection, - const unsigned short nick[GP_NICK_LEN], - GPEnum replace, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char nick_A[GP_NICK_LEN]; - - // Since we don't currently allow UNICODE nicknames, make sure the first byte is empty - // (We make this check as an early alert to devlopers that the parameter is invalid) - // (Even if it's bypassed, the server will still reject the name.) - int i = 0; - for (; (i < GP_NICK_LEN) && (nick[i] != 0); i++) - { - if ((nick[i] & 0xFF00) != 0) - return GP_PARAMETER_ERROR; - } - - // Convert to ascii and call "A" version - UCS2ToAsciiString(nick, nick_A); - return gpNewProfileA(connection, nick_A, replace, blocking, callback, param); -} -#endif - -GPResult gpDeleteProfile( - GPConnection * connection, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - GPDeleteProfileResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiDeleteProfile(connection, callback, param); -} - -GPResult gpProfileFromID( - GPConnection * connection, - GPProfile * profile, - int id -) -{ - GSI_UNUSED(connection); - - // Set the profile. - // This function is depreciated & may be removed from future versions. - ////////////////////////////////////////////////////////////////////// - *profile = id; - - return GP_NO_ERROR; -} - -// gpIDFromProfile -////////////////// -GPResult gpIDFromProfile( - GPConnection * connection, - GPProfile profile, - int * id -) -{ - GSI_UNUSED(connection); - - // ID is the same as GPProfile - // This function is depreciated & may be removed from future versions. - ////////////////////////////////////////////////////////////////////// - *id = profile; - - return GP_NO_ERROR; -} - -// gpUserIDFromProfile -////////////////// -GPResult gpUserIDFromProfile( - GPConnection * connection, - GPProfile profile, - int * userid -) -{ - GPIConnection * iconnection; - GPIProfile * pProfile; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - *userid = 0; - return GP_NO_ERROR; - } - - // Get the profile object. - ////////////////////////// - if(!gpiGetProfile(connection, profile, &pProfile)) - Error(connection, GP_PARAMETER_ERROR, "Invalid profile."); - - // Set the id. - ////////////// - *userid = pProfile->userId; - - return GP_NO_ERROR; -} - - -GPResult gpProfileSearchA( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char firstname[GP_FIRSTNAME_LEN], - const char lastname[GP_LASTNAME_LEN], - int icquin, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPProfileSearchResponseArg arg; - memset(&arg, 0, sizeof(arg)); - arg.more = GP_DONE; - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do the search. - ///////////////// - return gpiProfileSearch(connection, nick, uniquenick, email, firstname, lastname, icquin, 0, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpProfileSearchW( - GPConnection * connection, - const unsigned short nick[GP_NICK_LEN], - const unsigned short uniquenick[GP_UNIQUENICK_LEN], - const unsigned short email[GP_EMAIL_LEN], - const unsigned short firstname[GP_FIRSTNAME_LEN], - const unsigned short lastname[GP_LASTNAME_LEN], - int icquin, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char nick_A[GP_NICK_LEN]; - char uniquenick_A[GP_UNIQUENICK_LEN]; - char email_A[GP_NICK_LEN]; - char firstname_A[GP_NICK_LEN]; - char lastname_A[GP_NICK_LEN]; - - UCS2ToAsciiString(nick, nick_A); // nicknames are ascii - UCS2ToAsciiString(uniquenick, uniquenick_A); - UCS2ToAsciiString(email, email_A); - UCS2ToAsciiString(firstname, firstname_A); - UCS2ToAsciiString(lastname, lastname_A); - - return gpProfileSearchA(connection, nick_A, uniquenick_A, email_A, firstname_A, lastname_A, icquin, blocking, callback, param); -} -#endif - -GPResult gpProfileSearchUniquenickA( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const int namespaceIDs[GP_MAX_NAMESPACEIDS], - int numNamespaces, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL) || (namespaceIDs == NULL) || (numNamespaces < 1)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPProfileSearchResponseArg arg; - memset(&arg, 0, sizeof(arg)); - arg.more = GP_DONE; - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do the search. - ///////////////// - return gpiProfileSearchUniquenick(connection, uniquenick, namespaceIDs, numNamespaces, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpProfileSearchUniquenickW( - GPConnection * connection, - const unsigned short uniquenick[GP_UNIQUENICK_LEN], - const int namespaceIDs[GP_MAX_NAMESPACEIDS], - int numNamespaces, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char uniquenick_A[GP_UNIQUENICK_LEN]; - - UCS2ToAsciiString(uniquenick, uniquenick_A); - - return gpProfileSearchUniquenickA(connection, uniquenick_A, namespaceIDs, numNamespaces, blocking, callback, param); -} -#endif - -GPResult gpGetInfo( - GPConnection * connection, - GPProfile profile, - GPEnum checkCache, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL) || (profile == 0)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPGetInfoResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiGetInfo(connection, profile, checkCache, blocking, callback, param); -} - -GPResult gpGetInfoNoWait( - GPConnection * connection, - GPProfile profile, - GPGetInfoResponseArg * arg -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL) || (profile == 0) || (arg == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - { - memset(arg, 0, sizeof(arg)); - return GP_NO_ERROR; - } - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiGetInfoNoWait(connection, profile, arg); -} - -GPResult gpSetInfoi( - GPConnection * connection, - GPEnum info, - int value -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiSetInfoi(connection, info, value); -} - -GPResult gpSetInfosA( - GPConnection * connection, - GPEnum info, - const char * value -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiSetInfos(connection, info, value); -} -#ifdef GSI_UNICODE -GPResult gpSetInfosW( - GPConnection * connection, - GPEnum info, - const unsigned short* value -) -{ - char* value_A = UCS2ToUTF8StringAlloc(value); - GPResult result = gpSetInfosA(connection, info, value_A); - gsifree(value_A); - return result; -} -#endif - -GPResult gpSetInfod( - GPConnection * connection, - GPEnum info, - int day, - int month, - int year -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiSetInfod(connection, info, day, month, year); -} - -GPResult gpSetInfoMask( - GPConnection * connection, - GPEnum mask -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiSetInfoMask(connection, mask); -} - -GPResult gpSendBuddyRequestA( - GPConnection * connection, - GPProfile profile, - const char reason[GP_REASON_LEN] -) -{ - GPIConnection * iconnection; - char reasonFixed[GP_REASON_LEN]; - int i; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Error check. - /////////////// - if(reason == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid reason."); - - // Replace backslashes in reason. - ///////////////////////////////// - strzcpy(reasonFixed, reason, GP_REASON_LEN); - for(i = 0 ; reasonFixed[i] ; i++) - if(reasonFixed[i] == '\\') - reasonFixed[i] = '/'; - - // Send the request. - //////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\addbuddy\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\newprofileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profile); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\reason\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, reasonFixed); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} -#ifdef GSI_UNICODE -GPResult gpSendBuddyRequestW( - GPConnection * connection, - GPProfile profile, - const unsigned short reason[GP_REASON_LEN] -) -{ - char reason_A[GP_REASON_LEN]; - UCS2ToUTF8String(reason, reason_A); - return gpSendBuddyRequestA(connection, profile, reason_A); -} -#endif - -GPResult gpAuthBuddyRequest( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiAuthBuddyRequest(connection, profile); -} - -GPResult gpDenyBuddyRequest( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - GPIProfile * pProfile; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for simulation mode. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Get the profile. - /////////////////// - if(!gpiGetProfile(connection, profile, &pProfile)) - return GP_NO_ERROR; - - // freeclear the sig if no more requests. - //////////////////////////////////// - pProfile->requestCount--; - if(!iconnection->infoCaching && (pProfile->requestCount <= 0)) - { - freeclear(pProfile->authSig); - if(gpiCanFreeProfile(pProfile)) - gpiRemoveProfile(connection, pProfile); - } - - return GP_NO_ERROR; -} - -GPResult gpGetNumBuddies( - GPConnection * connection, - int * numBuddies -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - *numBuddies = 0; - return GP_NO_ERROR; - } - - // Set the number of buddies. - ///////////////////////////// - *numBuddies = iconnection->profileList.numBuddies; - - return GP_NO_ERROR; -} - -#ifndef GP_NEW_STATUS_INFO -GPResult gpGetBuddyStatus( - GPConnection * connection, - int index, - GPBuddyStatus * status -) -{ - GPIConnection * iconnection; - int num; - GPIProfile * profile; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - memset(status, 0, sizeof(GPBuddyStatus)); - return GP_NO_ERROR; - } - - // Check for a NULL status. - /////////////////////////// - if(status == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid status."); - - // Check the buddy index. - ///////////////////////// - num = iconnection->profileList.numBuddies; - if((index < 0) || (index >= num)) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - // Find the buddy with this index. - ////////////////////////////////// - profile = gpiFindBuddy(connection, index); - if(!profile) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - - assert(profile->buddyStatus); - status->profile = (GPProfile)profile->profileId; - status->status = profile->buddyStatus->status; -#ifndef GSI_UNICODE - if(profile->buddyStatus->statusString) - strzcpy(status->statusString, profile->buddyStatus->statusString, GP_STATUS_STRING_LEN); - else - status->statusString[0] = '\0'; - - - if(profile->buddyStatus->locationString) - strzcpy(status->locationString, profile->buddyStatus->locationString, GP_LOCATION_STRING_LEN); - else - status->locationString[0] = '\0'; - -#else - if(profile->buddyStatus->statusString) - UTF8ToUCS2String(profile->buddyStatus->statusString, status->statusString); - else - status->statusString[0] = '\0'; - - if(profile->buddyStatus->locationString) - UTF8ToUCS2String(profile->buddyStatus->locationString, status->locationString); - else - status->locationString[0] = '\0'; - -#endif - status->ip = profile->buddyStatus->ip; - status->port = profile->buddyStatus->port; - status->quietModeFlags = profile->buddyStatus->quietModeFlags; - - return GP_NO_ERROR; -} -#endif - -#ifdef GP_NEW_STATUS_INFO -GPResult gpGetBuddyStatusInfo( - GPConnection * connection, - int index, - GPBuddyStatusInfo * statusInfo -) -{ - GPIConnection * iconnection; - int num; - GPIProfile * profile; - GPIBuddyStatus *buddyStatus; - GPIBuddyStatusInfo * buddyStatusInfo; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - memset(statusInfo, 0, sizeof(GPBuddyStatusInfo)); - return GP_NO_ERROR; - } - - // Check for a NULL status. - /////////////////////////// - if(statusInfo == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid status."); - - // Check the buddy index. - ///////////////////////// - num = iconnection->profileList.numBuddies; - if((index < 0) || (index >= num)) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - // Find the buddy with this index. - ////////////////////////////////// - profile = gpiFindBuddy(connection, index); - if(!profile) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - - buddyStatus = profile->buddyStatus; - buddyStatusInfo = profile->buddyStatusInfo; - assert(buddyStatus || buddyStatusInfo); - - statusInfo->profile = (GPProfile)profile->profileId; - if (buddyStatus) - { - statusInfo->statusState = buddyStatus->status; -#ifndef GSI_UNICODE - if(buddyStatus->statusString) - strzcpy(statusInfo->richStatus, buddyStatus->statusString, GP_RICH_STATUS_LEN); - else - statusInfo->richStatus[0] = '\0'; - statusInfo->gameType[0] = '\0'; - statusInfo->gameVariant[0] = '\0'; - statusInfo->gameMapName[0] = '\0'; -#else - if(buddyStatus->statusString) - UTF8ToUCS2String(buddyStatus->statusString, statusInfo->richStatus); - else - statusInfo->richStatus[0] = '\0'; - statusInfo->gameType[0] = '\0'; - statusInfo->gameVariant[0] = '\0'; - statusInfo->gameMapName[0] = '\0'; -#endif - statusInfo->buddyIp = buddyStatus->ip; - statusInfo->buddyPort = buddyStatus->port; - statusInfo->quietModeFlags = buddyStatus->quietModeFlags; - statusInfo->newStatusInfoFlag = GP_NEW_STATUS_INFO_NOT_SUPPORTED; - } - else if (buddyStatusInfo) - { - statusInfo->statusState = buddyStatusInfo->statusState; - statusInfo->buddyIp = buddyStatusInfo->buddyIp; - statusInfo->buddyPort = buddyStatusInfo->buddyPort; - statusInfo->hostIp = buddyStatusInfo->hostIp; - statusInfo->hostPrivateIp = buddyStatusInfo->hostPrivateIp; - statusInfo->queryPort = buddyStatusInfo->queryPort; - statusInfo->hostPort = buddyStatusInfo->hostPort; - statusInfo->sessionFlags = buddyStatusInfo->sessionFlags; - statusInfo->quietModeFlags = buddyStatusInfo->quietModeFlags; - statusInfo->newStatusInfoFlag = GP_NEW_STATUS_INFO_SUPPORTED; -#ifndef GSI_UNICODE - strzcpy(statusInfo->richStatus, buddyStatusInfo->richStatus, GP_RICH_STATUS_LEN); - strzcpy(statusInfo->gameType, buddyStatusInfo->gameType, GP_STATUS_BASIC_STR_LEN); - strzcpy(statusInfo->gameVariant, buddyStatusInfo->gameVariant, GP_STATUS_BASIC_STR_LEN); - strzcpy(statusInfo->gameMapName, buddyStatusInfo->gameMapName, GP_STATUS_BASIC_STR_LEN); -#else - UTF8ToUCS2String(buddyStatusInfo->richStatus, statusInfo->richStatus); - UTF8ToUCS2String(buddyStatusInfo->gameType, statusInfo->gameType); - UTF8ToUCS2String(buddyStatusInfo->gameVariant, statusInfo->gameVariant); - UTF8ToUCS2String(buddyStatusInfo->gameMapName, statusInfo->gameMapName); -#endif - } - - return GP_NO_ERROR; -} - -GPResult gpSetBuddyAddr( - GPConnection *connection, - int index, - unsigned int buddyIp, - unsigned short buddyPort -) -{ - GPIConnection * iconnection; - int num; - GPIProfile * profile; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check the buddy index. - ///////////////////////// - num = iconnection->profileList.numBuddies; - if((index < 0) || (index >= num)) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - // Find the buddy with this index. - ////////////////////////////////// - profile = gpiFindBuddy(connection, index); - if(!profile) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - if (buddyIp == 0 || buddyPort == 0) - Error(connection, GP_PARAMETER_ERROR, "Invalid IP and port"); - if (profile->buddyStatusInfo) - { - profile->buddyStatusInfo->buddyIp = buddyIp; - profile->buddyStatusInfo->buddyPort = buddyPort; - } - return GP_NO_ERROR; -} -#endif - -GPResult gpGetBuddyIndex( - GPConnection * connection, - GPProfile profile, - int * index -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - *index = 0; - return GP_NO_ERROR; - } - - // Get the index. - ///////////////// - if(gpiGetProfile(connection, profile, &pProfile) && pProfile->buddyStatus) - *index = pProfile->buddyStatus->buddyIndex; - else if (gpiGetProfile(connection, profile, &pProfile) && pProfile->buddyStatusInfo) - *index = pProfile->buddyStatusInfo->buddyIndex; - else - *index = -1; - - return GP_NO_ERROR; -} - -int gpIsBuddy( - GPConnection * connection, - GPProfile profile -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return 0; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return 0; - - // Get the index. - ///////////////// - if(gpiGetProfile(connection, profile, &pProfile) && pProfile->buddyStatus) - return 1; - else if (gpiGetProfile(connection, profile, &pProfile) &&pProfile->buddyStatusInfo) - return 1; - - return 0; -} - -int gpIsBuddyConnectionOpen( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - GPIPeer *aPeer; - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return 0; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return 0; - - aPeer = gpiGetPeerByProfile(connection, profile); - - if (aPeer == NULL || !gpiIsPeerConnected(aPeer)) - return 0; // not connected - else - return 1; // connected -} - -GPResult gpDeleteBuddy( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Delete the buddy. - //////////////////// - CHECK_RESULT(gpiDeleteBuddy(connection, profile, GPITrue)); - - return GP_NO_ERROR; -} - -GPResult gpAddToBlockedList( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Add em to the internal list - remove buddy status if already a buddy - /////////////////////////////////////////////////////////////////////// - return gpiAddToBlockedList(connection, profile); -} - -GPResult gpRemoveFromBlockedList( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Remove blocked association from internal list if it's there - ////////////////////////////////////////////////////////////// - return gpiRemoveFromBlockedList(connection, profile); -} - -GPResult gpGetNumBlocked( - GPConnection * connection, - int * numBlocked -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - *numBlocked = 0; - return GP_NO_ERROR; - } - - // Set the number of blocked profiles - ///////////////////////////////////// - *numBlocked = iconnection->profileList.numBlocked; - - return GP_NO_ERROR; -} - -GPResult gpGetBlockedProfile( - GPConnection * connection, - int index, - GPProfile * profile -) -{ - GPIConnection * iconnection; - int num; - GPIProfile * pProfile; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for a NULL profile. - //////////////////////////// - if(profile == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid profile container"); - - // Check the block index. - ///////////////////////// - num = iconnection->profileList.numBlocked; - if((index < 0) || (index >= num)) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - // Find the blocked profile with this index. - //////////////////////////////////////////// - pProfile = gpiFindBlockedProfile(connection, index); - if(!pProfile) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - *profile = (GPProfile)pProfile->profileId; - - return GP_NO_ERROR; -} - -gsi_bool gpIsBlocked( - GPConnection * connection, - GPProfile profile -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return gsi_false; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return gsi_false; - - // Get the index. - ///////////////// - if(gpiGetProfile(connection, profile, &pProfile) && pProfile->blocked) - return gsi_true; - - return gsi_false; -} - -#ifndef GP_NEW_STATUS_INFO -GPResult gpSetStatusA( - GPConnection * connection, - GPEnum status, - const char statusString[GP_STATUS_STRING_LEN], - const char locationString[GP_LOCATION_STRING_LEN] -) -{ - char statusStringFixed[GP_STATUS_STRING_LEN]; - char locationStringFixed[GP_LOCATION_STRING_LEN]; - GPIConnection * iconnection; - int i; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Error check. - /////////////// - if(statusString == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid statusString."); - if(locationString == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid locationString."); - - // Replace backslashes with slashes. - //////////////////////////////////// - strzcpy(statusStringFixed, statusString, GP_STATUS_STRING_LEN); - for(i = 0 ; statusStringFixed[i] ; i++) - if(statusStringFixed[i] == '\\') - statusStringFixed[i] = '/'; - strzcpy(locationStringFixed, locationString, GP_LOCATION_STRING_LEN); - for(i = 0 ; locationStringFixed[i] ; i++) - if(locationStringFixed[i] == '\\') - locationStringFixed[i] = '/'; - - // Don't send it if its the same as the previous. - ///////////////////////////////////////////////// - if((status == iconnection->lastStatusState) && - (strcmp(statusStringFixed, iconnection->lastStatusString) == 0) && - (strcmp(locationStringFixed, iconnection->lastLocationString) == 0)) - { - return GP_NO_ERROR; - } - - // Copy off the new status. - /////////////////////////// - iconnection->lastStatusState = status; -#ifndef GSI_UNICODE - strzcpy(iconnection->lastStatusString, statusStringFixed, GP_STATUS_STRING_LEN); - strzcpy(iconnection->lastLocationString, locationStringFixed, GP_LOCATION_STRING_LEN); -#else - UTF8ToUCS2StringLen(iconnection->lastStatusString, iconnection->lastStatusString_W, GP_STATUS_STRING_LEN); - UTF8ToUCS2StringLen(iconnection->lastStatusString, iconnection->lastLocationString_W, GP_LOCATION_STRING_LEN); -#endif - - // Send the new status. - /////////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\status\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, status); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\statstring\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, statusStringFixed); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\locstring\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, locationStringFixed); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} -#ifdef GSI_UNICODE -GPResult gpSetStatusW( - GPConnection * connection, - GPEnum status, - const unsigned short statusString[GP_STATUS_STRING_LEN], - const unsigned short locationString[GP_LOCATION_STRING_LEN] -) -{ - char statusString_A[GP_STATUS_STRING_LEN]; - char locationString_A[GP_LOCATION_STRING_LEN]; - UCS2ToUTF8String(statusString, statusString_A); - UCS2ToUTF8String(locationString, locationString_A); - return gpSetStatusA(connection, status, statusString_A, locationString_A); -} -#endif -#endif - -#ifdef GP_NEW_STATUS_INFO -GPResult gpSetStatusInfoA( - GPConnection *connection, - GPEnum statusState, - unsigned int hostIp, - unsigned int hostPrivateIp, - unsigned short queryPort, - unsigned short hostPort, - unsigned int sessionFlags, - const char *richStatus, - int richStatusLen, - const char *gameType, - int gameTypeLen, - const char *gameVariant, - int gameVariantLen, - const char *gameMapName, - int gameMapNameLen -) -{ - GPIConnection * iconnection; - -#ifndef GSI_UNICODE - char gameTypeFixed[GP_STATUS_BASIC_STR_LEN]; - char gameVariantFixed[GP_STATUS_BASIC_STR_LEN]; - char gameMapNameFixed[GP_STATUS_BASIC_STR_LEN]; -#else - char *gameTypeFixed; - char *gameVariantFixed; - char *gameMapNameFixed; -#endif - - GS_ASSERT(connection != NULL); - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Error check. - /////////////// - GS_ASSERT(richStatus != NULL); - if (richStatus == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid richStatus."); - -#ifndef GSI_UNICODE - GS_ASSERT(richStatusLen <= GP_RICH_STATUS_LEN); - GS_ASSERT(gameTypeLen <= GP_STATUS_BASIC_STR_LEN); - GS_ASSERT(gameVariantLen <= GP_STATUS_BASIC_STR_LEN); - GS_ASSERT(gameMapNameLen <= GP_STATUS_BASIC_STR_LEN); - - if (gameType == NULL) - strncpy(gameTypeFixed, "", GP_STATUS_BASIC_STR_LEN); - else - strncpy(gameTypeFixed, gameType, GP_STATUS_BASIC_STR_LEN); - if (gameVariant == NULL) - strncpy(gameVariantFixed, "", GP_STATUS_BASIC_STR_LEN); - else - strncpy(gameVariantFixed, gameVariant, GP_STATUS_BASIC_STR_LEN); - if (gameMapName == NULL) - strncpy(gameMapNameFixed, "", GP_STATUS_BASIC_STR_LEN); - else - strncpy(gameMapNameFixed, gameMapName, GP_STATUS_BASIC_STR_LEN); - - // Don't send it if its the same as the previous. - ///////////////////////////////////////////////// - if((statusState == iconnection->lastStatusState) && - (strcmp(richStatus, iconnection->richStatus) == 0) && - (strcmp(gameTypeFixed, iconnection->gameType) == 0) && - (strcmp(gameVariantFixed, iconnection->gameVariant) == 0) && - (strcmp(gameMapNameFixed, iconnection->gameMapName) == 0) && - (sessionFlags == iconnection->sessionFlags) && - (hostIp == iconnection->hostIp) && - (hostPrivateIp == iconnection->hostPrivateIp) && - (queryPort == iconnection->queryPort) && - (hostPort == iconnection->hostPort)) - { - return GP_NO_ERROR; - } -#else - gameTypeFixed = goastrdup(gameType); - gameVariantFixed = goastrdup(gameVariant); - gameMapNameFixed = goastrdup(gameMapName); -#endif - - iconnection->lastStatusState = statusState; - iconnection->hostIp = hostIp; - iconnection->hostPrivateIp = hostPrivateIp; - iconnection->queryPort = queryPort; - iconnection->hostPort = hostPort; - iconnection->sessionFlags = sessionFlags; - -#ifndef GSI_UNICODE - strzcpy(iconnection->gameType, gameTypeFixed, GP_STATUS_BASIC_STR_LEN); - strzcpy(iconnection->gameVariant, gameVariantFixed, GP_STATUS_BASIC_STR_LEN); - strzcpy(iconnection->gameMapName, gameMapNameFixed, GP_STATUS_BASIC_STR_LEN); - strzcpy(iconnection->richStatus, richStatus, GP_RICH_STATUS_LEN); -#endif - - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\statusinfo\\\\state\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, statusState); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\hostIp\\"); - gpiAppendUIntToBuffer(connection, &iconnection->outputBuffer, ntohl(hostIp)); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\hprivIp\\"); - gpiAppendUIntToBuffer(connection, &iconnection->outputBuffer, ntohl(hostPrivateIp)); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\qport\\"); - gpiAppendUShortToBuffer(connection, &iconnection->outputBuffer, queryPort); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\hport\\"); - gpiAppendUShortToBuffer(connection, &iconnection->outputBuffer, hostPort); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sessflags\\"); - gpiAppendUIntToBuffer(connection, &iconnection->outputBuffer, sessionFlags); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\richStatus\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, richStatus); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\gameType\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, gameTypeFixed); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\gameVariant\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, gameVariantFixed); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\gameMapName\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, gameMapNameFixed); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - GSI_UNUSED(richStatusLen); - GSI_UNUSED(gameTypeLen); - GSI_UNUSED(gameVariantLen); - GSI_UNUSED(gameMapNameLen); - return GP_NO_ERROR; -} - -#ifdef GSI_UNICODE -GPResult gpSetStatusInfoW( - GPConnection *connection, - GPEnum statusState, - unsigned int hostIp, - unsigned int hostPrivateIp, - unsigned short queryPort, - unsigned short hostPort, - unsigned int sessionFlags, - const unsigned short *richStatus, - int richStatusLen, - const unsigned short *gameType, - int gameTypeLen, - const unsigned short *gameVariant, - int gameVariantLen, - const unsigned short *gameMapName, - int gameMapNameLen - ) -{ - char *richStatus_A, *gameType_A, *gameVariant_A, *gameMapName_A; - GPResult aResult; - GPIConnection * iconnection; - GS_ASSERT(connection != NULL); - GS_ASSERT(richStatusLen <= GP_RICH_STATUS_LEN); - GS_ASSERT(gameTypeLen <= GP_STATUS_BASIC_STR_LEN); - GS_ASSERT(gameVariantLen <= GP_STATUS_BASIC_STR_LEN); - GS_ASSERT(gameMapNameLen <= GP_STATUS_BASIC_STR_LEN); - GS_ASSERT(richStatus != NULL); - - if (connection != NULL && (*connection != NULL)) - iconnection = (GPIConnection *)*connection; - else return GP_PARAMETER_ERROR; - - if (richStatus == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid richStatus."); - - if (richStatusLen <= GP_RICH_STATUS_LEN) - richStatus_A = UCS2ToUTF8StringAlloc(richStatus); - else - richStatus_A = UCS2ToUTF8StringAlloc((UCS2String)_T("")); - if (gameType && (gameTypeLen <= GP_STATUS_BASIC_STR_LEN)) - gameType_A = UCS2ToUTF8StringAlloc(gameType); - else - gameType_A = UCS2ToUTF8StringAlloc((UCS2String)_T("")); - if (gameVariant && (gameVariantLen <= GP_STATUS_BASIC_STR_LEN)) - gameVariant_A = UCS2ToUTF8StringAlloc(gameVariant); - else - gameVariant_A = UCS2ToUTF8StringAlloc((UCS2String)_T("")); - if (gameMapName && (gameMapNameLen <= GP_STATUS_BASIC_STR_LEN)) - gameMapName_A = UCS2ToUTF8StringAlloc(gameMapName); - else - gameMapName_A = UCS2ToUTF8StringAlloc((UCS2String)_T("")); - - if ((statusState == iconnection->lastStatusState) && - (sessionFlags == iconnection->sessionFlags) && - (hostIp == iconnection->hostIp) && - (hostPrivateIp == iconnection->hostPrivateIp) && - (queryPort == iconnection->queryPort) && - (hostPort == iconnection->hostPort) && - (_tcscmp(richStatus, iconnection->richStatus_W) == 0) && - (_tcscmp(gameType, iconnection->gameType_W) == 0) && - (_tcscmp(gameVariant, iconnection->gameVariant_W) == 0) && - (_tcscmp(gameMapName, iconnection->gameMapName_W) == 0)) - { - return GP_NO_ERROR; - } - _tcsncpy(iconnection->richStatus_W, richStatus, GP_RICH_STATUS_LEN); - _tcsncpy(iconnection->gameType_W, gameType, GP_STATUS_BASIC_STR_LEN); - _tcsncpy(iconnection->gameVariant_W, gameVariant, GP_STATUS_BASIC_STR_LEN); - _tcsncpy(iconnection->gameMapName_W, gameMapName, GP_STATUS_BASIC_STR_LEN); - - aResult = gpSetStatusInfoA(connection, statusState, hostIp, hostPrivateIp, queryPort, hostPort, - sessionFlags, richStatus_A, (int)strlen(richStatus_A), gameType_A, (int)strlen(gameType_A), - gameVariant_A, (int)strlen(gameVariant_A), gameMapName_A, (int)strlen(gameMapName_A)); - gsifree(richStatus_A); - gsifree(gameType_A); - gsifree(gameVariant_A); - gsifree(gameMapName_A); - return aResult; -} -#endif - -GPResult gpAddStatusInfoKeyA(GPConnection *connection, const char *keyName, const char *keyValue) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if ((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if ( iconnection->simulation ) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if (iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiStatusInfoAddKey(connection, iconnection->extendedInfoKeys, keyName, keyValue); -} - -#ifdef GSI_UNICODE -GPResult gpAddStatusInfoKeyW(GPConnection *connection, const unsigned short *keyName, const unsigned short *keyValue) -{ - GPResult aResult; - char *keyName_A = UCS2ToUTF8StringAlloc(keyName); - char *keyValue_A = UCS2ToUTF8StringAlloc(keyValue); - aResult = gpAddStatusInfoKeyA(connection, keyName_A, keyValue_A); - gsifree(keyName_A); - gsifree(keyValue_A); - return aResult; -} -#endif - -GPResult gpSetStatusInfoKeyA(GPConnection *connection, const char *keyName, const char *keyValue) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if ((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if ( iconnection->simulation ) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if (iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiStatusInfoSetKey(connection, iconnection->extendedInfoKeys, keyName, keyValue); -} - -#ifdef GSI_UNICODE -GPResult gpSetStatusInfoKeyW(GPConnection *connection, const unsigned short *keyName, const unsigned short *keyValue) -{ - GPResult aResult; - char *keyName_A = UCS2ToUTF8StringAlloc(keyName); - char *keyValue_A = UCS2ToUTF8StringAlloc(keyValue); - aResult = gpSetStatusInfoKeyA(connection, keyName_A, keyValue_A); - gsifree(keyName_A); - gsifree(keyValue_A); - return aResult; -} -#endif - -GPResult gpDelStatusInfoKeyA(GPConnection *connection, const char *keyName) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if ((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if ( iconnection->simulation ) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if (iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiStatusInfoDelKey(connection, iconnection->extendedInfoKeys, keyName); -} - -#ifdef GSI_UNICODE -GPResult gpDelStatusInfoKeyW(GPConnection *connection, const unsigned short *keyName) -{ - GPResult aResult; - char *keyName_A = UCS2ToUTF8StringAlloc(keyName); - aResult = gpDelStatusInfoKeyA(connection, keyName_A); - gsifree(keyName_A); - return aResult; -} -#endif - -GPResult gpGetStatusInfoKeyValA(GPConnection *connection, const char *keyName, char **keyValue) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if ((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if ( iconnection->simulation ) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if (iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - return gpiStatusInfoGetKey(connection, iconnection->extendedInfoKeys, keyName, keyValue); -} -#ifdef GSI_UNICODE -GPResult gpGetStatusInfoKeyValW(GPConnection *connection, const unsigned short *keyName, unsigned short **keyValue) -{ - GPResult aResult; - char *keyValue_A; - - char *keyName_A = UCS2ToUTF8StringAlloc(keyName); - - aResult = gpGetStatusInfoKeyValA(connection, keyName_A, &keyValue_A); - *keyValue = UTF8ToUCS2StringAlloc(keyValue_A); - - gsifree(keyName_A); - gsifree(keyValue_A); - return aResult; -} -#endif - - - -GPResult gpGetBuddyStatusInfoKeys(GPConnection *connection, int index, GPCallback callback, void *userData) -{ - GPIConnection *iconnection; - GPIProfile * pProfile; - GPResult aResult; - GPIPeerOp *aPeerOp; - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - pProfile = gpiFindBuddy(connection, index); - if (!pProfile) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - - if (pProfile->buddyStatus) - CallbackError(connection, GP_PARAMETER_ERROR, GP_BM_EXT_INFO_NOT_SUPPORTED, "The profile does not support extended info keys.") - - if (!pProfile->buddyStatusInfo && !pProfile->buddyStatus) - CallbackError(connection, GP_PARAMETER_ERROR, GP_BM_NOT_BUDDY, "The profile used to get extended info keys is not a buddy.") - - if (pProfile->buddyStatusInfo && pProfile->buddyStatusInfo->statusState == GP_OFFLINE) - CallbackError(connection, GP_NETWORK_ERROR, GP_BM_BUDDY_OFFLINE, "The profile used to get extended info keys is offline."); - - aPeerOp = (GPIPeerOp *)gsimalloc(sizeof(GPIPeerOp)); - aPeerOp->callback = callback; - aPeerOp->next = NULL; - aPeerOp->state = GPI_PEER_OP_STATE_REQUESTED; - aPeerOp->type = GPI_BM_KEYS_REQUEST; - aPeerOp->userData = userData; - aPeerOp->timeout = current_time() + GPI_PEER_OP_TIMEOUT; - aResult = gpiSendBuddyMessage(connection, pProfile->profileId, GPI_BM_KEYS_REQUEST, "Keys?", GP_DONT_ROUTE, aPeerOp); - return aResult; -} -#endif - -GPResult gpSendBuddyMessageA( - GPConnection * connection, - GPProfile profile, - const char * message -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Error check. - /////////////// - if(message == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid message."); - - return gpiSendBuddyMessage(connection, profile, GPI_BM_MESSAGE, message, 0, NULL); -} -#ifdef GSI_UNICODE -GPResult gpSendBuddyMessageW( - GPConnection * connection, - GPProfile profile, - const unsigned short* message -) -{ - char* message_A; - GPResult result; - - assert(message != NULL); - message_A = UCS2ToUTF8StringAlloc(message); // convert to UTF8 - result = gpSendBuddyMessageA(connection, profile, message_A); // send - gsifree(message_A); // free the converted string - return result; -} -#endif - -GPResult gpSendBuddyUTMA( - GPConnection * connection, - GPProfile profile, - const char * message, - int sendOption -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Error check. - /////////////// - if(message == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid message."); - - return gpiSendBuddyMessage(connection, profile, GPI_BM_UTM, message, sendOption, NULL); -} - -#ifdef GSI_UNICODE -GPResult gpSendBuddyUTMW( - GPConnection * connection, - GPProfile profile, - const unsigned short* message, - int sendOption -) -{ - char* message_A; - GPResult result; - - assert(message != NULL); - message_A = UCS2ToUTF8StringAlloc(message); // convert to UTF8 - result = gpSendBuddyUTMA(connection, profile, message_A, sendOption); // send - gsifree(message_A); // free the converted string - return result; -} -#endif - -GPResult gpIsValidEmailA( - GPConnection * connection, - const char email[GP_EMAIL_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check the length of the email. - ///////////////////////////////// - if(strlen(email) >= GP_EMAIL_LEN) - Error(connection, GP_PARAMETER_ERROR, "Email too long."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPIsValidEmailResponseArg arg; - memset(&arg, 0, sizeof(arg)); -#ifndef GSI_UNICODE - strzcpy(arg.email, email, GP_EMAIL_LEN); -#else - UTF8ToUCS2String(email, arg.email); -#endif - arg.isValid = GP_INVALID; - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do the validation. - ///////////////////// - return gpiIsValidEmail(connection, email, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpIsValidEmailW( - GPConnection * connection, - const unsigned short email[GP_EMAIL_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char email_A[GP_EMAIL_LEN]; - UCS2ToAsciiString(email, email_A); - return gpIsValidEmailA(connection, email_A, blocking,callback, param); -} -#endif - -GPResult gpGetUserNicksA( - GPConnection * connection, - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Check the length of the email. - ///////////////////////////////// - if(strlen(email) >= GP_EMAIL_LEN) - Error(connection, GP_PARAMETER_ERROR, "Email too long."); - - // Check the length of the password. - //////////////////////////////////// - if(strlen(password) >= GP_PASSWORD_LEN) - Error(connection, GP_PARAMETER_ERROR, "Password too long."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPGetUserNicksResponseArg arg; - memset(&arg, 0, sizeof(arg)); -#ifndef GSI_UNICODE - strzcpy(arg.email, email, GP_EMAIL_LEN); -#else - AsciiToUCS2String(email, arg.email); -#endif - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Do the validation. - ///////////////////// - return gpiGetUserNicks(connection, email, password, blocking, callback, param); -} -#ifdef GSI_UNICODE -GPResult gpGetUserNicksW( - GPConnection * connection, - const unsigned short email[GP_EMAIL_LEN], - const unsigned short password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - char email_A[GP_EMAIL_LEN]; - char password_A[GP_PASSWORD_LEN]; - UCS2ToAsciiString(email, email_A); - UCS2ToAsciiString(password, password_A); - return gpGetUserNicksA(connection, email_A, password_A, blocking, callback, param); -} -#endif - -GPResult gpSetInvitableGames( - GPConnection * connection, - int numProductIDs, - const int * productIDs -) -{ - GPIConnection * iconnection; - int i; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Error check. - /////////////// - if(numProductIDs < 0) - Error(connection, GP_PARAMETER_ERROR, "Invalid numProductIDs."); - if((numProductIDs > 0) && (productIDs == NULL)) - Error(connection, GP_PARAMETER_ERROR, "Invalid productIDs."); - - // Send the list. - ///////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\inviteto\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\products\\"); - for(i = 0 ; i < numProductIDs ; i++) - { - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, productIDs[i]); - if(i < (numProductIDs - 1)) - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, ","); - } - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult gpFindPlayers( - GPConnection * connection, - int productID, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPFindPlayersResponseArg arg; - memset(&arg, 0, sizeof(arg)); - arg.productID = productID; - arg.numMatches = 0; - arg.matches = NULL; - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Start the find. - ////////////////// - return gpiFindPlayers(connection, productID, blocking, callback, param); -} - -GPResult gpInvitePlayerA( - GPConnection * connection, - GPProfile profile, - int productID, - const char location[GP_LOCATION_STRING_LEN] -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Send the invite. - /////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\pinvite\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profile); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\productid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, productID); - - if (location && location[0]) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\location\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, location); - } - - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} -#ifdef GSI_UNICODE -GPResult gpInvitePlayerW( - GPConnection * connection, - GPProfile profile, - int productID, - const gsi_char location[GP_LOCATION_STRING_LEN] -) -{ - char location_A[GP_LOCATION_STRING_LEN]; - UCS2ToAsciiString(location, location_A); - return gpInvitePlayerA(connection, profile, productID, location_A); -} -#endif - -GPResult gpGetReverseBuddies( - GPConnection * connection, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPGetReverseBuddiesResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Start the search. - //////////////////// - return gpiOthersBuddy(connection, blocking, callback, param); -} - -GPResult gpGetReversBuddiesList( GPConnection * connection, - GPProfile *targets, int numOfTargets, - GPEnum blocking, - GPCallback callback, - void * param) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for no callback. - ///////////////////////// - if(callback == NULL) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - { - GPGetReverseBuddiesListResponseArg arg; - memset(&arg, 0, sizeof(arg)); - callback(connection, &arg, param); - return GP_NO_ERROR; - } - - // Start the search. - //////////////////// - return gpiOthersBuddyList(connection, targets, numOfTargets, blocking, callback, param); - -} - - -GPResult gpRevokeBuddyAuthorization( - GPConnection * connection, - GPProfile profile -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - return GP_NO_ERROR; - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Send the invite. - /////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\revoke\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profile); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - - -GPResult gpGetLoginTicket( - GPConnection * connection, - char loginTicket[GP_LOGIN_TICKET_LEN] -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - memcpy(loginTicket, iconnection->loginTicket, GP_LOGIN_TICKET_LEN); - return GP_NO_ERROR; -} - -GPResult gpSetQuietMode( - GPConnection * connection, - GPEnum flags -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Store the flags locally. - /////////////////////////// - iconnection->quietModeFlags = flags; - - // Check for a connection. - ////////////////////////// - if(iconnection->connectState == GPI_CONNECTED) - { - // Send the flags. - ////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\quiet\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->quietModeFlags); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - } - - return GP_NO_ERROR; -} - -#ifndef NOFILE -void gpSetInfoCacheFilenameA( - const char * filename -) -{ - gpiSetInfoCacheFilename(filename); -} -void gpSetInfoCacheFilenameW( - const unsigned short * filename -) -{ - char* filename_A = UCS2ToUTF8StringAlloc(filename); - gpiSetInfoCacheFilename(filename_A); - gsifree(filename_A); -} - -static GPResult gpiAddSendingFileA( - GPConnection * connection, - GPITransfer * transfer, - const char * path, - const char * name -) -{ - GPIFile * file = NULL; - int size = 0; - gsi_time modTime = 0; - - // Check for a bad path or name. - //////////////////////////////// - if(!path && !name) - Error(connection, GP_PARAMETER_ERROR, "File missing path and name."); - if(path && !path[0]) - Error(connection, GP_PARAMETER_ERROR, "Empty path."); - if(name && !name[0]) - Error(connection, GP_PARAMETER_ERROR, "Empty name."); - - // Check that the file exists and is readable. - ////////////////////////////////////////////// - if(path) - { - FILE * fileVerify; - - fileVerify = fopen(path, "r"); - if(!fileVerify) - Error(connection, GP_PARAMETER_ERROR, "Can't find file."); - - if(!gpiGetTransferFileInfo(fileVerify, &size, &modTime)) - { - fclose(fileVerify); - Error(connection, GP_PARAMETER_ERROR, "Can't get info on file."); - } - - fclose(fileVerify); - } - - // Validate the name. - ///////////////////// - if(name) - { - size_t len; - - len = strlen(name); - - if(strstr(name, "//") || strstr(name, "\\\\")) - Error(connection, GP_PARAMETER_ERROR, "Empty directory in filename."); - if(strstr(name, "./") || strstr(name, ".\\") || (name[len - 1] == '.')) - Error(connection, GP_PARAMETER_ERROR, "Directory level in filename."); - if((name[0] == '/') || (name[0] == '\\')) - Error(connection, GP_PARAMETER_ERROR, "Filename can't start with a slash."); - if(strcspn(name, ":*?\"<>|\n") != len) - Error(connection, GP_PARAMETER_ERROR, "Invalid character in filename."); - } - // The name is the path's title. - //////////////////////////////// - else - { - const char * str; - - // Find the end of the path. - //////////////////////////// - name = strrchr(path, '/'); - str = strrchr(path, '\\'); - if(str > name) - name = str; - - // Point the name at the title. - /////////////////////////////// - if(name) - name++; - else - name = path; - } - - // Add this to the list. - //////////////////////// - file = gpiAddFileToTransfer(transfer, path, name); - if(!file) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Set the size and time. - ///////////////////////// - file->size = size; - file->modTime = modTime; - - // Update the total size. - ///////////////////////// - transfer->totalSize += size; - - return GP_NO_ERROR; -} -#ifdef GSI_UNICODE -static GPResult gpiAddSendingFileW( - GPConnection * connection, - GPITransfer * transfer, - const unsigned short * path, - const unsigned short * name -) -{ - char* path_A = UCS2ToUTF8StringAlloc(path); - char* name_A = UCS2ToUTF8StringAlloc(name); - GPResult result = gpiAddSendingFileA(connection, transfer, path_A, name_A); - gsifree(path_A); - gsifree(name_A); - return result; -} -#endif - - -GPResult gpSendFilesA( - GPConnection * connection, - GPTransfer * transfer, - GPProfile profile, - const char * message, - gpSendFilesCallback callback, - void * param -) -{ - GPIConnection * iconnection; - GPITransfer * pTransfer; - GPResult result; - const gsi_char * path; - const gsi_char * name; - int numFiles; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Check for simulation mode. - ///////////////////////////// - if(iconnection->simulation) - Error(connection, GP_PARAMETER_ERROR, "Cannot send files in simulation mode."); - - // Check for disconnected. - ////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - Error(connection, GP_PARAMETER_ERROR, "The connection has already been disconnected."); - - // Check other stuff. - ///////////////////// - if(!callback) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - if(!iconnection->callbacks[GPI_TRANSFER_CALLBACK].callback) - Error(connection, GP_PARAMETER_ERROR, "No callback."); - - // No message is an empty message. - ////////////////////////////////// - if(!message) - message = ""; - - // Create the transfer object. - ////////////////////////////// - CHECK_RESULT(gpiNewSenderTransfer(connection, &pTransfer, profile)); - - // Fill in the message. - /////////////////////// - pTransfer->message = goastrdup(message); - if(!pTransfer->message) - { - gpiFreeTransfer(connection, pTransfer); - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - - // Add all the files. - ///////////////////// - numFiles = 0; - do - { - path = NULL; - name = NULL; - callback(connection, numFiles++, &path, &name, param); - if(path && !path[0]) - path = NULL; - if(name && !name[0]) - name = NULL; - - if(name || path) - { -#ifndef GSI_UNICODE - result = gpiAddSendingFileA(connection, pTransfer, path, name); -#else - result = gpiAddSendingFileW(connection, pTransfer, path, name); -#endif - if(result != GP_NO_ERROR) - { - gpiFreeTransfer(connection, pTransfer); - return result; - } - } - } - while(name || path); - - // Check that we got at least 1 file. - ///////////////////////////////////// - if(!ArrayLength(pTransfer->files)) - { - gpiFreeTransfer(connection, pTransfer); - Error(connection, GP_PARAMETER_ERROR, "No files to send."); - } - - // Ping the receiver. - ///////////////////// - result = gpiSendBuddyMessage(connection, profile, GPI_BM_PING, "1", 0, NULL); - if(result != GP_NO_ERROR) - { - gpiFreeTransfer(connection, pTransfer); - return result; - } - - // Successful so far. - ///////////////////// - if(transfer) - *transfer = pTransfer->localID; - - return GP_NO_ERROR; -} -GPResult gpSendFilesW( - GPConnection * connection, - GPTransfer * transfer, - GPProfile profile, - const unsigned short* message, - gpSendFilesCallback callback, - void * param -) -{ - char* message_A = NULL; - GPResult result; - - if (message == NULL) - return gpSendFilesA(connection, transfer, profile, NULL, callback, param); - - message_A = UCS2ToUTF8StringAlloc(message); - result = gpSendFilesA(connection, transfer, profile, message_A, callback, param); - gsifree(message_A); - return result; -} - -GPResult gpAcceptTransferA( - GPConnection * connection, - GPTransfer transfer, - const char * message -) -{ - GPITransfer * pTransfer; - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Check that we have a directory set. - ////////////////////////////////////// - if(!pTransfer->baseDirectory) - Error(connection, GP_PARAMETER_ERROR, "No transfer directory set."); - - // Check if this transfer has been cancelled. - ///////////////////////////////////////////// - if(pTransfer->state & GPITransferCancelled) - Error(connection, GP_PARAMETER_ERROR, "Transfer already cancelled."); - - // Send a reply. - //////////////// - CHECK_RESULT(gpiSendTransferReply(connection, &pTransfer->transferID, pTransfer->peer, GPI_ACCEPTED, message)); - - // We're now transferring. - ////////////////////////// - pTransfer->state = GPITransferTransferring; - - // Set the current file index to the first file. - //////////////////////////////////////////////// - pTransfer->currentFile = 0; - - return GP_NO_ERROR; -} -GPResult gpAcceptTransferW( - GPConnection * connection, - GPTransfer transfer, - const unsigned short * message -) -{ - char* message_A = NULL; - GPResult result; - - if (message == NULL) - return gpAcceptTransferA(connection, transfer, NULL); - - message_A = UCS2ToUTF8StringAlloc(message); - result = gpAcceptTransferA(connection, transfer, message_A); - gsifree(message_A); - return result; -} - - -GPResult gpRejectTransferA( - GPConnection * connection, - GPTransfer transfer, - const char * message -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - return GP_NO_ERROR; - - // Check if this transfer has been cancelled. - ///////////////////////////////////////////// - if(pTransfer->state & GPITransferCancelled) - return GP_NO_ERROR; - - // Send the reply. - ////////////////// - gpiSendTransferReply(connection, &pTransfer->transferID, pTransfer->peer, GPI_REJECTED, message); - - // Free the transfer. - ///////////////////// - gpiFreeTransfer(connection, pTransfer); - - return GP_NO_ERROR; -} -GPResult gpRejectTransferW( - GPConnection * connection, - GPTransfer transfer, - const unsigned short* message -) -{ - char* message_A = NULL; - GPResult result; - - if (message == NULL) - return gpRejectTransferA(connection, transfer, NULL); - - message_A = UCS2ToUTF8StringAlloc(message); - result = gpRejectTransferA(connection, transfer, message_A); - gsifree(message_A); - return result; -} - -GPResult gpFreeTransfer( - GPConnection * connection, - GPTransfer transfer -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - return GP_NO_ERROR; - - // Check if this should be a reject. - //////////////////////////////////// - if(!pTransfer->sender && (pTransfer->state == GPITransferWaiting)) - return gpRejectTransfer(connection, transfer, NULL); - - // Check for cancelling. - //////////////////////// - if(pTransfer->state < GPITransferComplete) - gpiCancelTransfer(connection, pTransfer); - - // Free the transfer. - ///////////////////// - gpiFreeTransfer(connection, pTransfer); - - return GP_NO_ERROR; -} - -GPResult gpSetTransferData( - GPConnection * connection, - GPTransfer transfer, - void * userData -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Set the data. - //////////////// - pTransfer->userData = userData; - - return GP_NO_ERROR; -} - -void * gpGetTransferData( - GPConnection * connection, - GPTransfer transfer -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - return NULL; - - // Return the data. - /////////////////// - return pTransfer->userData; -} - -GPResult gpSetTransferDirectoryA( - GPConnection * connection, - GPTransfer transfer, - const char * directory -) -{ - GPITransfer * pTransfer; - char lastChar; - - if(!directory || !directory[0]) - Error(connection, GP_PARAMETER_ERROR, "Invalid directory."); - lastChar = directory[strlen(directory) - 1]; - if((lastChar != '\\') && (lastChar != '/')) - Error(connection, GP_PARAMETER_ERROR, "Invalid directory."); - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // This has to be set before transferring. - ////////////////////////////////////////// - if(pTransfer->sender) - Error(connection, GP_PARAMETER_ERROR, "Sender has no transfer directory."); - if(pTransfer->state != GPITransferWaiting) - Error(connection, GP_PARAMETER_ERROR, "Can only set transfer directory before transferring."); - - // Free any existing directory. - /////////////////////////////// - if(pTransfer->baseDirectory) - gsifree(pTransfer->baseDirectory); - pTransfer->baseDirectory = NULL; - - // Set the directory. - ///////////////////// - pTransfer->baseDirectory = goastrdup(directory); - if(!pTransfer->baseDirectory) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - return GP_NO_ERROR; -} -GPResult gpSetTransferDirectoryW( - GPConnection * connection, - GPTransfer transfer, - const unsigned short * directory -) -{ - char* directory_A = UCS2ToUTF8StringAlloc(directory); - GPResult result = gpSetTransferDirectoryA(connection, transfer, directory_A); - gsifree(directory_A); - return result; -} - -GPResult gpSetTransferThrottle( - GPConnection * connection, - GPTransfer transfer, - int throttle -) -{ - GPITransfer * pTransfer; - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - - // Negative means no throttle. - ////////////////////////////// - if(throttle < 0) - throttle = -1; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Store the throttle setting. - ////////////////////////////// - pTransfer->throttle = throttle; - - // Send the rate. - ///////////////// - CHECK_RESULT(gpiPeerStartTransferMessage(connection, pTransfer->peer, GPI_BM_FILE_TRANSFER_THROTTLE, (GPITransferID_st)&pTransfer->transferID)); - gpiSendOrBufferString(connection, pTransfer->peer, "\\rate\\"); - gpiSendOrBufferInt(connection, pTransfer->peer, throttle); - gpiPeerFinishTransferMessage(connection, pTransfer->peer, NULL, 0); - - // If we're the sender, call the callback. - ////////////////////////////////////////// - if(pTransfer->sender) - { - GPTransferCallbackArg * arg; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = pTransfer->localID; - arg->type = GP_TRANSFER_THROTTLE; - arg->num = throttle; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - } - - return GP_NO_ERROR; -} - -GPResult gpGetTransferThrottle( - GPConnection * connection, - GPTransfer transfer, - int * throttle -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the throttle. - //////////////////// - *throttle = pTransfer->throttle; - - return GP_NO_ERROR; -} - -GPResult gpGetTransferProfile( - GPConnection * connection, - GPTransfer transfer, - GPProfile * profile -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the profile. - /////////////////// - *profile = pTransfer->profile; - - return GP_NO_ERROR; -} - -GPResult gpGetTransferSide( - GPConnection * connection, - GPTransfer transfer, - GPEnum * side -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the side. - //////////////// - if(pTransfer->sender) - *side = GP_TRANSFER_SENDER; - else - *side = GP_TRANSFER_RECEIVER; - - return GP_NO_ERROR; -} - -GPResult gpGetTransferSize( - GPConnection * connection, - GPTransfer transfer, - int * size -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the size. - //////////////// - *size = pTransfer->totalSize; - - return GP_NO_ERROR; -} - -GPResult gpGetTransferProgress( - GPConnection * connection, - GPTransfer transfer, - int * progress -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the progress. - //////////////////// - *progress = pTransfer->progress; - - return GP_NO_ERROR; -} - -GPResult gpGetNumFiles( - GPConnection * connection, - GPTransfer transfer, - int * num -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the progress. - //////////////////// - *num = ArrayLength(pTransfer->files); - - return GP_NO_ERROR; -} - -GPResult gpGetCurrentFile( - GPConnection * connection, - GPTransfer transfer, - int * index -) -{ - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the current file. - //////////////////////// - *index = pTransfer->currentFile; - - return GP_NO_ERROR; -} - -GPResult gpSkipFile( - GPConnection * connection, - GPTransfer transfer, - int index -) -{ - GPIFile * file; - GPITransfer * pTransfer; - GPTransferCallbackArg * arg; - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection*)*connection; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the file. - //////////////// - if((index < 0) || (index >= ArrayLength(pTransfer->files))) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - file = (GPIFile *)ArrayNth(pTransfer->files, index); - - // Are we already past this file? - ///////////////////////////////// - if(index < pTransfer->currentFile) - return GP_NO_ERROR; - - // Did we not get to this file yet? - /////////////////////////////////// - if(pTransfer->currentFile != index) - { - // Mark it. - /////////// - file->flags |= GPI_FILE_SKIP; - - // If we're receiving, let the sender know we want to skip it. - ////////////////////////////////////////////////////////////// - if(!pTransfer->sender) - gpiSkipFile(connection, pTransfer, index, GPI_SKIP_USER_SKIP); - - return GP_NO_ERROR; - } - - // If we're receiving, delete our temp file. - //////////////////////////////////////////// - if(!pTransfer->sender && (index == pTransfer->currentFile) && file->file) - { - fclose(file->file); - file->file = NULL; - remove(file->path); - } - - // Skip the current file. - ///////////////////////// - gpiSkipCurrentFile(connection, pTransfer, GPI_SKIP_USER_SKIP); - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = pTransfer->localID; - arg->index = index; - arg->type = GP_FILE_SKIP; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - return GP_NO_ERROR; -} - -GPResult gpGetFileName( - GPConnection * connection, - GPTransfer transfer, - int index, - gsi_char ** name -) -{ - GPIFile * file; - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the file. - //////////////// - if((index < 0) || (index >= ArrayLength(pTransfer->files))) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - file = (GPIFile *)ArrayNth(pTransfer->files, index); - - // Get the name. - //////////////// -#ifndef GSI_UNICODE - *name = file->name; -#else - *name = file->name_W; -#endif - - return GP_NO_ERROR; -} - - -GPResult gpGetFilePath( - GPConnection * connection, - GPTransfer transfer, - int index, - gsi_char ** path -) -{ - GPIFile * file; - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the file. - //////////////// - if((index < 0) || (index >= ArrayLength(pTransfer->files))) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - file = (GPIFile *)ArrayNth(pTransfer->files, index); - - // Get the path. - //////////////// -#ifndef GSI_UNICODE - *path = file->path; -#else - *path = file->path_W; -#endif - - return GP_NO_ERROR; -} - -GPResult gpGetFileSize( - GPConnection * connection, - GPTransfer transfer, - int index, - int * size -) -{ - GPIFile * file; - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the file. - //////////////// - if((index < 0) || (index >= ArrayLength(pTransfer->files))) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - file = (GPIFile *)ArrayNth(pTransfer->files, index); - - // Get the size. - //////////////// - *size = file->size; - - return GP_NO_ERROR; -} - -GPResult gpGetFileProgress( - GPConnection * connection, - GPTransfer transfer, - int index, - int * progress -) -{ - GPIFile * file; - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the file. - //////////////// - if((index < 0) || (index >= ArrayLength(pTransfer->files))) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - file = (GPIFile *)ArrayNth(pTransfer->files, index); - - // Get the progress. - //////////////////// - *progress = file->progress; - - return GP_NO_ERROR; -} - -GPResult gpGetFileModificationTime( - GPConnection * connection, - GPTransfer transfer, - int index, - gsi_time * modTime -) -{ - GPIFile * file; - GPITransfer * pTransfer; - - // Get the transfer. - //////////////////// - pTransfer = gpiFindTransferByLocalID(connection, transfer); - if(!pTransfer) - Error(connection, GP_PARAMETER_ERROR, "Invalid transfer."); - - // Get the file. - //////////////// - if((index < 0) || (index >= ArrayLength(pTransfer->files))) - Error(connection, GP_PARAMETER_ERROR, "Invalid index."); - file = (GPIFile *)ArrayNth(pTransfer->files, index); - - // Get the modTime. - /////////////////// - *modTime = file->modTime; - - return GP_NO_ERROR; -} - -GPResult gpGetNumTransfers( - GPConnection * connection, - int * num -) -{ - GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for NULL. - ////////////////// - if(num == NULL) - Error(connection, GP_PARAMETER_ERROR, "NULL pointer."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Set num. - /////////// - *num = ArrayLength(iconnection->transfers); - - return GP_NO_ERROR; -} - -GPResult gpGetTransfer( - GPConnection * connection, - int index, - GPTransfer * transfer -) -{ - GPIConnection * iconnection; - int localID; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return GP_PARAMETER_ERROR; - - // Check for NULL. - ////////////////// - if(transfer == NULL) - Error(connection, GP_PARAMETER_ERROR, "NULL pointer."); - - // Get the connection object. - ///////////////////////////// - iconnection = (GPIConnection *)*connection; - - // Get the local ID. - //////////////////// - localID = gpiGetTransferLocalIDByIndex(connection, index); - - // Check if it was a bad index. - /////////////////////////////// - if(localID == -1) - Error(connection, GP_PARAMETER_ERROR, "Index out of range."); - - // Set the transfer they want. - ////////////////////////////// - *transfer = localID; - - return GP_NO_ERROR; -} -#endif - -#ifdef _DEBUG -void gpProfilesReport( - GPConnection * connection, - void (* report)(const char * output) -) -{ - //GPIConnection * iconnection; - - // Error check. - /////////////// - if((connection == NULL) || (*connection == NULL)) - return; - - // Get the connection object. - ///////////////////////////// - //iconnection = (GPIConnection *)*connection; - - gpiReport(connection, report); -} -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp.h deleted file mode 100644 index b0ea430af23..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp.h +++ /dev/null @@ -1,1631 +0,0 @@ -/* -gp.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ -#ifndef _GP_H_ -#define _GP_H_ - -// necessary for gsi_char and UNICODE support -#include "../common/gsCommon.h" - -#ifdef __cplusplus -extern "C" { -#endif - -//ENUMS -//////// -typedef enum _GPEnum -{ - // Callbacks - //////////// - GP_ERROR = 0, - GP_RECV_BUDDY_REQUEST, - GP_RECV_BUDDY_STATUS, - GP_RECV_BUDDY_MESSAGE, - GP_RECV_BUDDY_UTM, - GP_RECV_GAME_INVITE, - GP_TRANSFER_CALLBACK, - GP_RECV_BUDDY_AUTH, - GP_RECV_BUDDY_REVOKE, - - // Global States. - ///////////////// - GP_INFO_CACHING = 0x0100, - GP_SIMULATION, - GP_INFO_CACHING_BUDDY_AND_BLOCK_ONLY, - - // Blocking - /////////// - GP_BLOCKING = 1, - GP_NON_BLOCKING = 0, - - // Firewall - /////////// - GP_FIREWALL = 1, - GP_NO_FIREWALL = 0, - - // Check Cache - ////////////// - GP_CHECK_CACHE = 1, - GP_DONT_CHECK_CACHE = 0, - - // Is Valid Email. - // PANTS|02.15.00 - ////////////////// - GP_VALID = 1, - GP_INVALID = 0, - - // Fatal Error. - /////////////// - GP_FATAL = 1, - GP_NON_FATAL = 0, - - // Sex - ////// - GP_MALE = 0x0500, - GP_FEMALE, - GP_PAT, - - // Profile Search. - ////////////////// - GP_MORE = 0x0600, - GP_DONE, - - // Set Info - /////////// - GP_NICK = 0x0700, - GP_UNIQUENICK, - GP_EMAIL, - GP_PASSWORD, - GP_FIRSTNAME, - GP_LASTNAME, - GP_ICQUIN, - GP_HOMEPAGE, - GP_ZIPCODE, - GP_COUNTRYCODE, - GP_BIRTHDAY, - GP_SEX, - GP_CPUBRANDID, - GP_CPUSPEED, - GP_MEMORY, - GP_VIDEOCARD1STRING, - GP_VIDEOCARD1RAM, - GP_VIDEOCARD2STRING, - GP_VIDEOCARD2RAM, - GP_CONNECTIONID, - GP_CONNECTIONSPEED, - GP_HASNETWORK, - GP_OSSTRING, - GP_AIMNAME, // PANTS|03.20.01 - GP_PIC, - GP_OCCUPATIONID, - GP_INDUSTRYID, - GP_INCOMEID, - GP_MARRIEDID, - GP_CHILDCOUNT, - GP_INTERESTS1, - - // New Profile. - /////////////// - GP_REPLACE = 1, - GP_DONT_REPLACE = 0, - - // Is Connected. - //////////////// - GP_CONNECTED = 1, - GP_NOT_CONNECTED = 0, - - // Public mask. - /////////////// - GP_MASK_NONE = 0x00000000, - GP_MASK_HOMEPAGE = 0x00000001, - GP_MASK_ZIPCODE = 0x00000002, - GP_MASK_COUNTRYCODE = 0x00000004, - GP_MASK_BIRTHDAY = 0x00000008, - GP_MASK_SEX = 0x00000010, - GP_MASK_EMAIL = 0x00000020, - GP_MASK_ALL = 0xFFFFFFFF, - - // Status - ///////// - GP_OFFLINE = 0, - GP_ONLINE = 1, - GP_PLAYING = 2, - GP_STAGING = 3, - GP_CHATTING = 4, - GP_AWAY = 5, - - // Session flags - ///////////////// - GP_SESS_IS_CLOSED = 0x00000001, - GP_SESS_IS_OPEN = 0x00000002, - GP_SESS_HAS_PASSWORD = 0x00000004, - GP_SESS_IS_BEHIND_NAT = 0x00000008, - GP_SESS_IS_RANKED = 0x000000010, - - - // CPU Brand ID - /////////////// - GP_INTEL = 1, - GP_AMD, - GP_CYRIX, - GP_MOTOROLA, - GP_ALPHA, - - // Connection ID. - ///////////////// - GP_MODEM = 1, - GP_ISDN, - GP_CABLEMODEM, - GP_DSL, - GP_SATELLITE, - GP_ETHERNET, - GP_WIRELESS, - - // Transfer callback type. - // *** the transfer is ended when these types are received - ////////////////////////// - GP_TRANSFER_SEND_REQUEST = 0x800, // arg->num == numFiles - GP_TRANSFER_ACCEPTED, - GP_TRANSFER_REJECTED, // *** - GP_TRANSFER_NOT_ACCEPTING, // *** - GP_TRANSFER_NO_CONNECTION, // *** - GP_TRANSFER_DONE, // *** - GP_TRANSFER_CANCELLED, // *** - GP_TRANSFER_LOST_CONNECTION, // *** - GP_TRANSFER_ERROR, // *** - GP_TRANSFER_THROTTLE, // arg->num == Bps - GP_FILE_BEGIN, - GP_FILE_PROGRESS, // arg->num == numBytes - GP_FILE_END, - GP_FILE_DIRECTORY, - GP_FILE_SKIP, - GP_FILE_FAILED, // arg->num == error - - // GP_FILE_FAILED error - /////////////////////// - GP_FILE_READ_ERROR = 0x900, - GP_FILE_WRITE_ERROR, - GP_FILE_DATA_ERROR, - - // Transfer Side. - ///////////////// - GP_TRANSFER_SENDER = 0xA00, - GP_TRANSFER_RECEIVER, - - // UTM send options. - //////////////////// - GP_DONT_ROUTE = 0xB00, // only send direct - - // Quiet mode flags. - //////////////////// - GP_SILENCE_NONE = 0x00000000, - GP_SILENCE_MESSAGES = 0x00000001, - GP_SILENCE_UTMS = 0x00000002, - GP_SILENCE_LIST = 0x00000004, // includes requests, auths, and revokes - GP_SILENCE_ALL = 0xFFFFFFFF, - - // Flags for checking if newer version of status info is supported - GP_NEW_STATUS_INFO_SUPPORTED = 0xC00, - GP_NEW_STATUS_INFO_NOT_SUPPORTED = 0xC01 -} GPEnum; - -//RESULTS -////////// -typedef enum _GPResult -{ - GP_NO_ERROR, - GP_MEMORY_ERROR, - GP_PARAMETER_ERROR, - GP_NETWORK_ERROR, - GP_SERVER_ERROR, - GP_MISC_ERROR, - GP_COUNT -} GPResult; - -//ERROR CODES -///////////// -//#define GP_ERROR_TYPE(errorCode) ((errorCode) >> 8) -typedef enum _GPErrorCode -{ - // General. - /////////// - GP_GENERAL = 0x0000, - GP_PARSE, - GP_NOT_LOGGED_IN, - GP_BAD_SESSKEY, - GP_DATABASE, - GP_NETWORK, - GP_FORCED_DISCONNECT, - GP_CONNECTION_CLOSED, - GP_UDP_LAYER, - - // Login. - ///////// - GP_LOGIN = 0x0100, - GP_LOGIN_TIMEOUT, - - GP_LOGIN_BAD_NICK, - GP_LOGIN_BAD_EMAIL, - GP_LOGIN_BAD_PASSWORD, - GP_LOGIN_BAD_PROFILE, - GP_LOGIN_PROFILE_DELETED, - GP_LOGIN_CONNECTION_FAILED, - GP_LOGIN_SERVER_AUTH_FAILED, - GP_LOGIN_BAD_UNIQUENICK, - GP_LOGIN_BAD_PREAUTH, - - // Newuser. - /////////// - GP_NEWUSER = 0x0200, - GP_NEWUSER_BAD_NICK, - GP_NEWUSER_BAD_PASSWORD, - GP_NEWUSER_UNIQUENICK_INVALID, - GP_NEWUSER_UNIQUENICK_INUSE, - - // Updateui. - //////////// - GP_UPDATEUI = 0x0300, - GP_UPDATEUI_BAD_EMAIL, - - // Newprofile. - ////////////// - GP_NEWPROFILE = 0x0400, - GP_NEWPROFILE_BAD_NICK, - GP_NEWPROFILE_BAD_OLD_NICK, - - // Updatepro. - ///////////// - GP_UPDATEPRO = 0x0500, - GP_UPDATEPRO_BAD_NICK, - - // Addbuddy. - //////////// - GP_ADDBUDDY = 0x0600, - GP_ADDBUDDY_BAD_FROM, - GP_ADDBUDDY_BAD_NEW, - GP_ADDBUDDY_ALREADY_BUDDY, - - // Authadd. - /////////// - GP_AUTHADD = 0x0700, - GP_AUTHADD_BAD_FROM, - GP_AUTHADD_BAD_SIG, - - // Status. - ////////// - GP_STATUS = 0x0800, - - // Bm. - ////// - GP_BM = 0x0900, - GP_BM_NOT_BUDDY, - GP_BM_EXT_INFO_NOT_SUPPORTED, - GP_BM_BUDDY_OFFLINE, - - // Getprofile. - ////////////// - GP_GETPROFILE = 0x0A00, - GP_GETPROFILE_BAD_PROFILE, - - // Delbuddy. - //////////// - GP_DELBUDDY = 0x0B00, - GP_DELBUDDY_NOT_BUDDY, - - // Delprofile. - ///////////// - GP_DELPROFILE = 0x0C00, - GP_DELPROFILE_LAST_PROFILE, - - // Search. - ////////// - GP_SEARCH = 0x0D00, - GP_SEARCH_CONNECTION_FAILED, - GP_SEARCH_TIMED_OUT, - - // Check. - ///////// - GP_CHECK = 0x0E00, - GP_CHECK_BAD_EMAIL, - GP_CHECK_BAD_NICK, - GP_CHECK_BAD_PASSWORD, - - // Revoke. - ////////// - GP_REVOKE = 0x0F00, - GP_REVOKE_NOT_BUDDY, - - // Registeruniquenick. - ////////////////////// - GP_REGISTERUNIQUENICK = 0x1000, - GP_REGISTERUNIQUENICK_TAKEN, - GP_REGISTERUNIQUENICK_RESERVED, - GP_REGISTERUNIQUENICK_BAD_NAMESPACE, - - // Register cdkey. - ////////////////// - GP_REGISTERCDKEY = 0x1100, - GP_REGISTERCDKEY_BAD_KEY, - GP_REGISTERCDKEY_ALREADY_SET, - GP_REGISTERCDKEY_ALREADY_TAKEN, - - // AddBlock. - //////////// - GP_ADDBLOCK = 0x1200, - GP_ADDBLOCK_ALREADY_BLOCKED, - - // RemoveBlock. - /////////////// - GP_REMOVEBLOCK = 0x1300, - GP_REMOVEBLOCK_NOT_BLOCKED - -} GPErrorCode; - -//STRING LENGTHS -//////////////// -#define GP_NICK_LEN 31 -#define GP_UNIQUENICK_LEN 21 -#define GP_FIRSTNAME_LEN 31 -#define GP_LASTNAME_LEN 31 -#define GP_EMAIL_LEN 51 -#define GP_PASSWORD_LEN 31 -#define GP_PASSWORDENC_LEN ((((GP_PASSWORD_LEN+2)*4)/3)+1) -#define GP_HOMEPAGE_LEN 76 -#define GP_ZIPCODE_LEN 11 -#define GP_COUNTRYCODE_LEN 3 -#define GP_PLACE_LEN 128 -#define GP_AIMNAME_LEN 51 -#define GP_REASON_LEN 1025 -#define GP_STATUS_STRING_LEN 256 -#define GP_LOCATION_STRING_LEN 256 -#define GP_ERROR_STRING_LEN 256 -#define GP_AUTHTOKEN_LEN 256 -#define GP_PARTNERCHALLENGE_LEN 256 -#define GP_CDKEY_LEN 65 -#define GP_CDKEYENC_LEN ((((GP_CDKEY_LEN+2)*4)/3)+1) -#define GP_LOGIN_TICKET_LEN 25 - -#define GP_RICH_STATUS_LEN 256 -#define GP_STATUS_BASIC_STR_LEN 33 - -// Random number seed for PASSWORDENC and CDKEYENC -// MUST MATCH SERVER - If you change this, you'll have to -// release an updated server -#define GP_XOR_SEED 0x79707367 // "gspy" - -// Well known values for partner ID. -#define GP_PARTNERID_GAMESPY 0 -#define GP_PARTNERID_IGN 10 - -// Maximum number of namespaces that can be searched for a uniquenick -#define GP_MAX_NAMESPACEIDS 16 - -//TYPES -//////// -// GPConnection -/////////////// -typedef void * GPConnection; - -// GPProfile -//////////// -typedef int GPProfile; - -// GPTransfer -///////////// -typedef int GPTransfer; - -// GPCallback -///////////// -typedef void (* GPCallback)( - GPConnection * connection, - void * arg, - void * param -); - -//STRUCTURES -///////////// -// GPErrorArg -///////////// -typedef struct -{ - GPResult result; - GPErrorCode errorCode; - gsi_char * errorString; - GPEnum fatal; -} GPErrorArg; - -// GPConnectResponseArg -//////////////////////// -typedef struct -{ - GPResult result; - GPProfile profile; - gsi_char uniquenick[GP_UNIQUENICK_LEN]; -} GPConnectResponseArg; - -// GPNewUserResponseArg -/////////////////////// -typedef struct -{ - GPResult result; - GPProfile profile; -} GPNewUserResponseArg; - -// GPCheckResponseArg -///////////////////// -typedef struct -{ - GPResult result; - GPProfile profile; -} GPCheckResponseArg; - -// GPSuggestUniqueNickResponseArg -///////////////////////////////// -typedef struct -{ - GPResult result; - int numSuggestedNicks; - gsi_char ** suggestedNicks; -} GPSuggestUniqueNickResponseArg; - -// GPRegisterUniqueNickResponseArg -////////////////////////////////// -typedef struct -{ - GPResult result; -} GPRegisterUniqueNickResponseArg; - -// GPRegisterCdKeyResponseArg -////////////////////////////////// -typedef struct -{ - GPResult result; -} GPRegisterCdKeyResponseArg; - -// GPNewProfileResponseArg -////////////////////////// -typedef struct -{ - GPResult result; - GPProfile profile; -} GPNewProfileResponseArg; - -// GPDeleteProfileResponseArg -///////////////////////////// - -typedef struct -{ - GPResult result; - GPProfile profile; -} GPDeleteProfileResponseArg; - -// GPProfileSearchMatch -/////////////////////// -typedef struct -{ - GPProfile profile; - gsi_char nick[GP_NICK_LEN]; - gsi_char uniquenick[GP_UNIQUENICK_LEN]; - int namespaceID; - gsi_char firstname[GP_FIRSTNAME_LEN]; - gsi_char lastname[GP_LASTNAME_LEN]; - gsi_char email[GP_EMAIL_LEN]; -} GPProfileSearchMatch; - -// GPProfileSearchResponseArg -///////////////////////////// -typedef struct -{ - GPResult result; - int numMatches; - GPEnum more; - GPProfileSearchMatch * matches; -} GPProfileSearchResponseArg; - -// GPGetInfoResponseArg -/////////////////////// -typedef struct -{ - GPResult result; - GPProfile profile; - gsi_char nick[GP_NICK_LEN]; - gsi_char uniquenick[GP_UNIQUENICK_LEN]; - gsi_char email[GP_EMAIL_LEN]; - gsi_char firstname[GP_FIRSTNAME_LEN]; - gsi_char lastname[GP_LASTNAME_LEN]; - gsi_char homepage[GP_HOMEPAGE_LEN]; - int icquin; - gsi_char zipcode[GP_ZIPCODE_LEN]; - gsi_char countrycode[GP_COUNTRYCODE_LEN]; - float longitude; // negative is west, positive is east. (0, 0) means unknown. - float latitude; // negative is south, positive is north. (0, 0) means unknown. - gsi_char place[GP_PLACE_LEN]; // e.g., "USA|California|Irvine", "South Korea|Seoul", "Turkey" - int birthday; - int birthmonth; - int birthyear; - GPEnum sex; - GPEnum publicmask; - gsi_char aimname[GP_AIMNAME_LEN]; - int pic; - int occupationid; - int industryid; - int incomeid; - int marriedid; - int childcount; - int interests1; - int ownership1; - int conntypeid; -} GPGetInfoResponseArg; - -// GPRecvBuddyRequestArg -//////////////////////// -typedef struct -{ - GPProfile profile; - unsigned int date; - gsi_char reason[GP_REASON_LEN]; -} GPRecvBuddyRequestArg; - -// GPBuddyStatus -//////////////// -typedef struct -{ - GPProfile profile; - GPEnum status; - gsi_char statusString[GP_STATUS_STRING_LEN]; - gsi_char locationString[GP_LOCATION_STRING_LEN]; - unsigned int ip; - int port; - GPEnum quietModeFlags; -} GPBuddyStatus; - - -// BETA -//GPBuddyStatusInfo -/////////////////// -typedef struct -{ - GPProfile profile; - GPEnum statusState; - unsigned int buddyIp; - unsigned short buddyPort; - unsigned int hostIp; - unsigned int hostPrivateIp; - unsigned short queryPort; - unsigned short hostPort; - unsigned int sessionFlags; - gsi_char richStatus[GP_RICH_STATUS_LEN]; - gsi_char gameType[GP_STATUS_BASIC_STR_LEN]; - gsi_char gameVariant[GP_STATUS_BASIC_STR_LEN]; - gsi_char gameMapName[GP_STATUS_BASIC_STR_LEN]; - GPEnum quietModeFlags; - GPEnum newStatusInfoFlag; -} GPBuddyStatusInfo; - -//GPGetBuddyStatusInfoKeysArg -///////////////////////////// -typedef struct -{ - GPProfile profile; - gsi_char **keys; - gsi_char **values; - int numKeys; - -} GPGetBuddyStatusInfoKeysArg; - - -// GPRecvBuddyStatusArg -/////////////////////// -typedef struct -{ - GPProfile profile; - unsigned int date; - int index; -} GPRecvBuddyStatusArg; - -// GPRecvBuddyMessageArg -//////////////////////// -typedef struct -{ - GPProfile profile; - unsigned int date; - gsi_char * message; -} GPRecvBuddyMessageArg; - -typedef struct -{ - GPProfile profile; - unsigned int date; - gsi_char * message; -} GPRecvBuddyUTMArg; - -typedef struct -{ - GPProfile profile; - unsigned int date; -} GPRecvBuddyAuthArg; - -typedef struct -{ - GPProfile profile; - unsigned int date; -} GPRecvBuddyRevokeArg; - -// GPTransferCallbackArg; -///////////////////////// -typedef struct -{ - GPTransfer transfer; - GPEnum type; - int index; - int num; - gsi_char * message; -} GPTransferCallbackArg; - -// GPIsValidEmailResponseArg -//////////////////////////// -typedef struct -{ - GPResult result; - gsi_char email[GP_EMAIL_LEN]; - GPEnum isValid; -} GPIsValidEmailResponseArg; - -// GPGetUserNicksResponseArg -//////////////////////////// -typedef struct -{ - GPResult result; - gsi_char email[GP_EMAIL_LEN]; - int numNicks; // If 0, then the email/password did not match. - gsi_char ** nicks; - gsi_char ** uniquenicks; -} GPGetUserNicksResponseArg; - -// GPRecvGameInviteArg -////////////////////// -typedef struct -{ - GPProfile profile; - int productID; - gsi_char location[GP_LOCATION_STRING_LEN]; -} GPRecvGameInviteArg; - -// GPFindPlayerMatch -//////////////////// -typedef struct -{ - GPProfile profile; - gsi_char nick[GP_NICK_LEN]; - GPEnum status; - gsi_char statusString[GP_STATUS_STRING_LEN]; -} GPFindPlayerMatch; - -// GPFindPlayersResponseArg -/////////////////////////// -typedef struct -{ - GPResult result; - int productID; //PANTS|06.06.00 - added by request for JED - int numMatches; - GPFindPlayerMatch * matches; -} GPFindPlayersResponseArg; - -// GPGetReverseBuddiesResponseArg -///////////////////////////////// -typedef struct -{ - GPResult result; - int numProfiles; - GPProfileSearchMatch * profiles; -} GPGetReverseBuddiesResponseArg; - -typedef struct -{ - GPProfile profile; - gsi_char uniqueNick[GP_UNIQUENICK_LEN]; -} GPUniqueMatch; - -typedef struct -{ - GPResult result; - int numOfUniqueMatchs; - GPUniqueMatch *matches; -} GPGetReverseBuddiesListResponseArg; - - -//GLOBALS -///////// -/* The hostnames of the connection manager -server and the search manager server. -If the app resolves either or both hostnames, -the IP(s) can be stored in the string(s) before -calling gpInitialize */ -extern char GPConnectionManagerHostname[64]; -extern char GPSearchManagerHostname[64]; - - -//FUNCTIONS -//////////// -#ifndef GSI_UNICODE -#define gpConnect gpConnectA -#define gpConnectNewUser gpConnectNewUserA -#define gpConnectUniqueNick gpConnectUniqueNickA -#define gpConnectPreAuthenticated gpConnectPreAuthenticatedA -#define gpCheckUser gpCheckUserA -#define gpNewUser gpNewUserA -#define gpSuggestUniqueNick gpSuggestUniqueNickA -#define gpRegisterUniqueNick gpRegisterUniqueNickA -#define gpRegisterCdKey gpRegisterCdKeyA -#define gpGetErrorString gpGetErrorStringA -#define gpNewProfile gpNewProfileA -#define gpProfileSearch gpProfileSearchA -#define gpProfileSearchUniquenick gpProfileSearchUniquenickA -#define gpSetInfos gpSetInfosA -#define gpSendBuddyRequest gpSendBuddyRequestA -#ifndef GP_NEW_STATUS_INFO -#define gpSetStatus gpSetStatusA -#endif -#ifdef GP_NEW_STATUS_INFO -// BETA -#define gpSetStatusInfo gpSetStatusInfoA -#endif -#define gpSendBuddyMessage gpSendBuddyMessageA -#define gpSendBuddyUTM gpSendBuddyUTMA -#define gpIsValidEmail gpIsValidEmailA -#define gpGetUserNicks gpGetUserNicksA -#define gpSetInfoCacheFilename gpSetInfoCacheFilenameA -#define gpSendFiles gpSendFilesA -#define gpAcceptTransfer gpAcceptTransferA -#define gpRejectTransfer gpRejectTransferA -#define gpSetTransferDirectory gpSetTransferDirectoryA -#define gpGetFileName gpGetFileNameA -#define gpGetFilePath gpGetFilePathA -#define gpInvitePlayer gpInvitePlayerA -#ifdef GP_NEW_STATUS_INFO -// BETA -#define gpAddStatusInfoKey gpAddStatusInfoKeyA -#define gpSetStatusInfoKey gpSetStatusInfoKeyA -#define gpGetStatusInfoKeyVal gpGetStatusInfoKeyValA -#define gpDelStatusInfoKey gpDelStatusInfoKeyA -#endif -#else -#define gpConnect gpConnectW -#define gpConnectNewUser gpConnectNewUserW -#define gpConnectUniqueNick gpConnectUniqueNickW -#define gpConnectPreAuthenticated gpConnectPreAuthenticatedW -#define gpCheckUser gpCheckUserW -#define gpNewUser gpNewUserW -#define gpSuggestUniqueNick gpSuggestUniqueNickW -#define gpRegisterUniqueNick gpRegisterUniqueNickW -#define gpRegisterCdKey gpRegisterCdKeyW -#define gpGetErrorString gpGetErrorStringW -#define gpNewProfile gpNewProfileW -#define gpProfileSearch gpProfileSearchW -#define gpProfileSearchUniquenick gpProfileSearchUniquenickW -#define gpSetInfos gpSetInfosW -#define gpSendBuddyRequest gpSendBuddyRequestW -#ifndef GP_NEW_STATUS_INFO -#define gpSetStatus gpSetStatusW -#endif -#ifdef GP_NEW_STATUS_INFO -// BETA -#define gpSetStatusInfo gpSetStatusInfoW -#endif -#define gpSendBuddyMessage gpSendBuddyMessageW -#define gpSendBuddyUTM gpSendBuddyUTMW -#define gpIsValidEmail gpIsValidEmailW -#define gpGetUserNicks gpGetUserNicksW -#define gpSetInfoCacheFilename gpSetInfoCacheFilenameW -#define gpSendFiles gpSendFilesW -#define gpAcceptTransfer gpAcceptTransferW -#define gpRejectTransfer gpRejectTransferW -#define gpSetTransferDirectory gpSetTransferDirectoryW -#define gpGetFileName gpGetFileNameW -#define gpGetFilePath gpGetFilePathW -#define gpInvitePlayer gpInvitePlayerW -// #ifdef GP_NEW_STATUS_INFO -// BETA -// #define gpAddStatusInfoKey gpAddStatusInfoKeyW -// #define gpSetStatusInfoKey gpSetStatusInfoKeyW -// #define gpGetStatusInfoKeyVal gpGetStatusInfoKeyValW -// #define gpDelStatusInfoKey gpDelStatusInfoKeyW -// #endif -#endif - -// gpInitialize -/////////////// -GPResult gpInitialize -( - GPConnection * connection, - int productID, // The productID is a unique ID that identifies your product - int namespaceID, // The namespaceID identified which namespace to login under. A namespaceID of 0 indicates that no - // namespace should be used. A namespaceID of 1 represents the default GameSpy namespace - int partnerID // The partnerID identifies the account system being used. - // Use GP_PARTNERID_GAMESPY for GSID accounts. - // Use GP_PARTNERID_IGN for IGN accounts. -); - -// gpDestroy -//////////// -void gpDestroy( - GPConnection * connection -); - -// gpEnable -/////////// -GPResult gpEnable -( - GPConnection * connection, - GPEnum state -); - -// gpDisable -//////////// -GPResult gpDisable -( - GPConnection * connection, - GPEnum state -); - -// gpProcess -//////////// -GPResult gpProcess -( - GPConnection * connection -); - -// gpSetCallback -//////////////// -GPResult gpSetCallback -( - GPConnection * connection, - GPEnum func, - GPCallback callback, - void * param -); - -// gpConnect -//////////// -GPResult gpConnect -( - GPConnection * connection, - const gsi_char nick[GP_NICK_LEN], - const gsi_char email[GP_EMAIL_LEN], - const gsi_char password[GP_PASSWORD_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpConnectNewUser -/////////////////// -GPResult gpConnectNewUser -( - GPConnection * connection, - const gsi_char nick[GP_NICK_LEN], - const gsi_char uniquenick[GP_UNIQUENICK_LEN], - const gsi_char email[GP_EMAIL_LEN], - const gsi_char password[GP_PASSWORD_LEN], - const gsi_char cdkey[GP_CDKEY_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpConnectUniqueNick -////////////////////// -GPResult gpConnectUniqueNick -( - GPConnection * connection, - const gsi_char uniquenick[GP_UNIQUENICK_LEN], - const gsi_char password[GP_PASSWORD_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpConnectPreAuthenticated -//////////////////////////// -GPResult gpConnectPreAuthenticated -( - GPConnection * connection, - const gsi_char authtoken[GP_AUTHTOKEN_LEN], - const gsi_char partnerchallenge[GP_PARTNERCHALLENGE_LEN], - GPEnum firewall, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpDisconnect -/////////////// -void gpDisconnect -( - GPConnection * connection -); - -// gpIsConnected -//////////////// -GPResult gpIsConnected -( - GPConnection * connection, - GPEnum * connected -); - -// gpCheckUser -////////////// -GPResult gpCheckUser -( - GPConnection * connection, - const gsi_char nick[GP_NICK_LEN], - const gsi_char email[GP_EMAIL_LEN], - const gsi_char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpNewUser -//////////// -GPResult gpNewUser -( - GPConnection * connection, - const gsi_char nick[GP_NICK_LEN], - const gsi_char uniquenick[GP_UNIQUENICK_LEN], - const gsi_char email[GP_EMAIL_LEN], - const gsi_char password[GP_PASSWORD_LEN], - const gsi_char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpSuggestUniqueNick -////////////////////// -GPResult gpSuggestUniqueNick -( - GPConnection * connection, - const gsi_char desirednick[GP_UNIQUENICK_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpRegisterUniqueNick -/////////////////////// -GPResult gpRegisterUniqueNick -( - GPConnection * connection, - const gsi_char uniquenick[GP_UNIQUENICK_LEN], - const gsi_char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpRegisterCdKey -/////////////////////// -GPResult gpRegisterCdKey -( - GPConnection * connection, - const gsi_char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpGetErrorCode -///////////////// -GPResult gpGetErrorCode( - GPConnection * connection, - GPErrorCode * errorCode -); - -// gpGetErrorString -/////////////////// -GPResult gpGetErrorString( - GPConnection * connection, - gsi_char errorString[GP_ERROR_STRING_LEN] -); - -// gpNewProfile -/////////////// -GPResult gpNewProfile( - GPConnection * connection, - const gsi_char nick[GP_NICK_LEN], - GPEnum replace, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpDeleteProfile -////////////////// -GPResult gpDeleteProfile( - GPConnection * connection, - GPCallback callback, - void * param -); - -// gpProfileFromID -// PANTS|09.11.00 - A GPProfile is now the same -// as a profileid. This function is no longer needed -// and will be removed in a future version of GP. -///////////////////////////////////////////////////// -GPResult gpProfileFromID( - GPConnection * connection, - GPProfile * profile, - int id -); - -// gpIDFromProfile -// PANTS|09.11.00 - A GPProfile is now the same -// as a profileid. This function is no longer needed -// and will be removed in a future version of GP. -///////////////////////////////////////////////////// -GPResult gpIDFromProfile( - GPConnection * connection, - GPProfile profile, - int * id -); - -// gpUserIDFromProfile -////////////////// -GPResult gpUserIDFromProfile( - GPConnection * connection, - GPProfile profile, - int * userid -); - -// gpProfileSearch -////////////////// -GPResult gpProfileSearch( - GPConnection * connection, - const gsi_char nick[GP_NICK_LEN], - const gsi_char uniquenick[GP_UNIQUENICK_LEN], - const gsi_char email[GP_EMAIL_LEN], - const gsi_char firstname[GP_FIRSTNAME_LEN], - const gsi_char lastname[GP_LASTNAME_LEN], - int icquin, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpProfileSearchUniquenick -//////////////////////////// -GPResult gpProfileSearchUniquenick( - GPConnection * connection, - const gsi_char uniquenick[GP_UNIQUENICK_LEN], - const int namespaceIDs[GP_MAX_NAMESPACEIDS], - int numNamespaces, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpGetInfo -//////////// -GPResult gpGetInfo( - GPConnection * connection, - GPProfile profile, - GPEnum checkCache, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpGetInfoNoWait -////////////////// -GPResult gpGetInfoNoWait( - GPConnection * connection, - GPProfile profile, - GPGetInfoResponseArg * arg -); - -// gpSetInfoi -///////////// -GPResult gpSetInfoi( - GPConnection * connection, - GPEnum info, - int value -); - -// gpSetInfos -///////////// -GPResult gpSetInfos( - GPConnection * connection, - GPEnum info, - const gsi_char * value -); - -// gpSetInfod -///////////// -GPResult gpSetInfod( - GPConnection * connection, - GPEnum info, - int day, - int month, - int year -); - -// gpSetInfoMask -//////////////// -GPResult gpSetInfoMask( - GPConnection * connection, - GPEnum mask -); - -// gpSendBuddyRequest -///////////////////// -GPResult gpSendBuddyRequest( - GPConnection * connection, - GPProfile profile, - const gsi_char reason[GP_REASON_LEN] -); - -// gpAuthBuddyRequest -///////////////////// -GPResult gpAuthBuddyRequest( - GPConnection * connection, - GPProfile profile -); - -// gpDenyBuddyRequest -// PANTS|09.11.00 -///////////////////// -GPResult gpDenyBuddyRequest( - GPConnection * connection, - GPProfile profile -); - -// gpDeleteBuddy -//////////////// -GPResult gpDeleteBuddy( - GPConnection * connection, - GPProfile profile -); - -// gpAddToBlockedList -///////////////////// -GPResult gpAddToBlockedList( - GPConnection * connection, - GPProfile profile -); - -// gpRemoveFromBlockedList -///////////////////// -GPResult gpRemoveFromBlockedList( - GPConnection * connection, - GPProfile profile -); - -// gpGetNumBlocked -////////////////// -GPResult gpGetNumBlocked( - GPConnection * connection, - int * numBlocked -); - -// gpGetBlockedProfile -///////////////////// -GPResult gpGetBlockedProfile( - GPConnection * connection, - int index, - GPProfile * profile -); - -// gpIsBlocked -// returns gsi_true if blocked, gsi_false if not blocked -//////////////////////////////////////////////////////// -gsi_bool gpIsBlocked( - GPConnection * connection, - GPProfile profile -); - -// gpGetNumBuddies -////////////////// -GPResult gpGetNumBuddies( - GPConnection * connection, - int * numBuddies -); - -// gpGetBuddyStatus -/////////////////// -#ifndef GP_NEW_STATUS_INFO -GPResult gpGetBuddyStatus( - GPConnection * connection, - int index, - GPBuddyStatus * status -); -#endif - -#ifdef GP_NEW_STATUS_INFO -// -////////////////////////////// -GPResult gpGetBuddyStatusInfo( - GPConnection * connection, - int index, - GPBuddyStatusInfo * statusInfo -); - -GPResult gpSetBuddyAddr( - GPConnection *connection, - int index, - unsigned int buddyIp, - unsigned short buddyPort -); -#endif -// gpGetBuddyIndex -////////////////// -GPResult gpGetBuddyIndex( - GPConnection * connection, - GPProfile profile, - int * index -); - -// gpIsBuddy -// returns 1 if a buddy, 0 if not a buddy -//////////// -int gpIsBuddy( - GPConnection * connection, - GPProfile profile -); - -int gpIsBuddyConnectionOpen( - GPConnection * connection, - GPProfile profile -); - -// gpSetStatus -////////////// -#ifndef GP_NEW_STATUS_INFO -GPResult gpSetStatus( - GPConnection * connection, - GPEnum status, - const gsi_char statusString[GP_STATUS_STRING_LEN], - const gsi_char locationString[GP_LOCATION_STRING_LEN] -); -#endif - -#ifdef GP_NEW_STATUS_INFO -GPResult gpSetStatusInfo( - GPConnection *connection, - GPEnum statusState, - unsigned int hostIp, - unsigned int hostPrivateIp, - unsigned short queryPort, - unsigned short hostPort, - unsigned int sessionFlags, - const gsi_char *richStatus, - int richStatusLen, - const gsi_char *gameType, - int gameTypeLen, - const gsi_char *gameVariant, - int gameVariantLen, - const gsi_char *gameMapName, - int gameMapNameLen -); - -GPResult gpAddStatusInfoKey(GPConnection *connection, const gsi_char *keyName, const gsi_char *keyValue); -GPResult gpSetStatusInfoKey(GPConnection *connection, const gsi_char *keyName, const gsi_char *keyValue); -GPResult gpGetStatusInfoKeyVal(GPConnection *connection, const gsi_char *keyName, gsi_char **keyValue); -GPResult gpDelStatusInfoKey(GPConnection *connection, const gsi_char *keyName); - -GPResult gpGetBuddyStatusInfoKeys(GPConnection *connection, int index, GPCallback callback, void *userData); -#endif -// gpSendBuddyMessage -///////////////////// -GPResult gpSendBuddyMessage( - GPConnection * connection, - GPProfile profile, - const gsi_char * message -); - -// gpSendBuddyUTM -///////////////////// -GPResult gpSendBuddyUTM( - GPConnection * connection, - GPProfile profile, - const gsi_char * message, - int sendOption // GP_DONT_ROUTE -); - - -// PANTS|02.15.00 -// Added gpIsValidEmail and gpGetUserNicks for login wizard. -//////////////////////////////////////////////////////////// - -// gpIsValidEmail -///////////////// -GPResult gpIsValidEmail( - GPConnection * connection, - const gsi_char email[GP_EMAIL_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpGetUserNicks -///////////////// -GPResult gpGetUserNicks( - GPConnection * connection, - const gsi_char email[GP_EMAIL_LEN], - const gsi_char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -// *DEPRECATED* -// gpSetInvitableGames -////////////////////// -GPResult gpSetInvitableGames( - GPConnection * connection, - int numProductIDs, - const int * productIDs -); - -// *DEPRECATED* -// gpFindPlayers -//////////////// -GPResult gpFindPlayers( - GPConnection * connection, - int productID, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpInvitePlayer -///////////////// -GPResult gpInvitePlayer( - GPConnection * connection, - GPProfile profile, - int productID, - const gsi_char location[GP_LOCATION_STRING_LEN] -); - -// gpGetReverseBuddies -// Get profiles that have you on their buddy list. -////////////////////////////////////////////////// -GPResult gpGetReverseBuddies( - GPConnection * connection, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpGetReverseBuddiesList -// Get profile ids and unique nicks for profiles -// that have you on their buddy list. -////////////////////////////////////////////////// -GPResult gpGetReversBuddiesList( GPConnection * connection, - GPProfile *targets, int numOfTargets, - GPEnum blocking, - GPCallback callback, - void * param -); - -// gpRevokeBuddyAuthorization -///////////////////////////// -GPResult gpRevokeBuddyAuthorization( - GPConnection * connection, - GPProfile profile -); - -// gpSetCdKey -GPResult gpSetCdKey( - GPConnection * connection, - const gsi_char cdkeyhash, - GPCallback callback -); - -// gpGetLoginTicket -///////////////////////////// -GPResult gpGetLoginTicket( - GPConnection * connection, - char loginTicket[GP_LOGIN_TICKET_LEN] -); - -// gpSetQuietMode -///////////////// -GPResult gpSetQuietMode( - GPConnection * connection, - GPEnum flags -); - -#ifndef NOFILE - -// gpiSetInfoCacheFilename -// Should be called before gpIntialize. -/////////////////////////////////////// -void gpSetInfoCacheFilename( - const gsi_char * filename -); - -/////////////////// -// FILE TRANSFER // -/////////////////// -typedef void (* gpSendFilesCallback)( - GPConnection * connection, - int index, - const gsi_char ** path, - const gsi_char ** name, - void * param -); - -GPResult gpSendFiles( - GPConnection * connection, - GPTransfer * transfer, - GPProfile profile, - const gsi_char * message, - gpSendFilesCallback callback, - void * param -); - -GPResult gpAcceptTransfer( - GPConnection * connection, - GPTransfer transfer, - const gsi_char * message -); - -GPResult gpRejectTransfer( - GPConnection * connection, - GPTransfer transfer, - const gsi_char * message -); - -GPResult gpFreeTransfer( - GPConnection * connection, - GPTransfer transfer -); - -GPResult gpSetTransferData( - GPConnection * connection, - GPTransfer transfer, - void * userData -); - -void * gpGetTransferData( - GPConnection * connection, - GPTransfer transfer -); - -GPResult gpSetTransferDirectory( - GPConnection * connection, - GPTransfer transfer, - const gsi_char * directory -); - -// NOTE: THROTTLING IS NOT CURRENTLY IMPLEMENTED -GPResult gpSetTransferThrottle( - GPConnection * connection, - GPTransfer transfer, - int throttle -); - -// NOTE: THROTTLING IS NOT CURRENTLY IMPLEMENTED -GPResult gpGetTransferThrottle( - GPConnection * connection, - GPTransfer transfer, - int * throttle -); - -GPResult gpGetTransferProfile( - GPConnection * connection, - GPTransfer transfer, - GPProfile * profile -); - -GPResult gpGetTransferSide( - GPConnection * connection, - GPTransfer transfer, - GPEnum * side -); - -GPResult gpGetTransferSize( - GPConnection * connection, - GPTransfer transfer, - int * size -); - -GPResult gpGetTransferProgress( - GPConnection * connection, - GPTransfer transfer, - int * progress -); - -GPResult gpGetNumFiles( - GPConnection * connection, - GPTransfer transfer, - int * num -); - -GPResult gpGetCurrentFile( - GPConnection * connection, - GPTransfer transfer, - int * index -); - -GPResult gpSkipFile( - GPConnection * connection, - GPTransfer transfer, - int index -); - -GPResult gpGetFileName( - GPConnection * connection, - GPTransfer transfer, - int index, - gsi_char ** name -); - -GPResult gpGetFilePath( - GPConnection * connection, - GPTransfer transfer, - int index, - gsi_char ** path -); - -GPResult gpGetFileSize( - GPConnection * connection, - GPTransfer transfer, - int index, - int * size -); - -GPResult gpGetFileProgress( - GPConnection * connection, - GPTransfer transfer, - int index, - int * progress -); - -GPResult gpGetFileModificationTime( - GPConnection * connection, - GPTransfer transfer, - int index, - gsi_time * modTime -); - -GPResult gpGetNumTransfers( - GPConnection * connection, - int * num -); - -GPResult gpGetTransfer( - GPConnection * connection, - int index, - GPTransfer * transfer -); -#endif - -#ifdef _DEBUG -// gpProfilesReport -// PANTS|09.11.00 -/////////////////// -void gpProfilesReport( - GPConnection * connection, - void (* report)(const char * output) -); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp_vs2005.sln b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp_vs2005.sln deleted file mode 100644 index baafcf0638e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp_vs2005.sln +++ /dev/null @@ -1,65 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpstress_vs2005", "gpstress\gpstress_vs2005.vcproj", "{ADC08350-16C5-4822-A04A-1AD5133CF64D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gptest_vs2005", "gptest\gptest_vs2005.vcproj", "{E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gptestc_vs2005", "gptestc\gptestc_vs2005.vcproj", "{36F25843-777E-492D-B420-3D43953AB26B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BBA094FA-6655-401E-8B11-135A0BE83F9D}" - ProjectSection(SolutionItems) = preProject - changelog.txt = changelog.txt - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 4 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfsapp1:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gptest\\gptest_vs2005.vcproj - SccProjectName1 = gptest - SccLocalPath1 = gptest - SccProjectUniqueName2 = gptestc\\gptestc_vs2005.vcproj - SccProjectName2 = gptestc - SccLocalPath2 = gptestc - SccProjectUniqueName3 = gpstress\\gpstress_vs2005.vcproj - SccProjectName3 = gpstress - SccLocalPath3 = gpstress - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release|Win32 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Debug|Win32.ActiveCfg = Debug|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Debug|Win32.Build.0 = Debug|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Release|Win32.ActiveCfg = Release|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Release|Win32.Build.0 = Release|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {ADC08350-16C5-4822-A04A-1AD5133CF64D}.Unicode Release|Win32.Build.0 = Release|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Debug|Win32.ActiveCfg = Debug|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Debug|Win32.Build.0 = Debug|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Release|Win32.ActiveCfg = Release|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Release|Win32.Build.0 = Release|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {E6B3FC4E-7F99-47F1-A57E-55ED2F3863A8}.Unicode Release|Win32.Build.0 = Release|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Debug|Win32.ActiveCfg = Debug|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Debug|Win32.Build.0 = Debug|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Release|Win32.ActiveCfg = Release|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Release|Win32.Build.0 = Release|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 - {36F25843-777E-492D-B420-3D43953AB26B}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp_vs2005.vssscc b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp_vs2005.vssscc deleted file mode 100644 index 6cb031bcf51..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gp_vs2005.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpi.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpi.c deleted file mode 100644 index acd1fc701e3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpi.c +++ /dev/null @@ -1,821 +0,0 @@ -/* -gpi.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 345, 362 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - -#include -#include -#include "gpi.h" - -// DEFINES -////////// -#define KEEPALIVE_TIMEOUT (60 * 2000) - -// This is so VisualAssist will know about these functions. -/////////////////////////////////////////////////////////// -#if 0 -void MD5Init(MD5_CTX *); -void MD5Update(MD5_CTX *, unsigned char *, unsigned int); -void MD5Final(unsigned char [16], MD5_CTX *); -void MD5Print(unsigned char [16], char[33]); -void MD5Digest(unsigned char *, unsigned int, char[33]); -#endif - -//FUNCTIONS -/////////// -GPResult -gpiInitialize( - GPConnection * connection, - int productID, - int namespaceID, - int partnerID -) -{ - GPIConnection * iconnection; - int i; - GPResult result; - - // Set the connection to NULL in case of error. - /////////////////////////////////////////////// - *connection = NULL; - - // Allocate the connection. - /////////////////////////// - iconnection = (GPIConnection *)gsimalloc(sizeof(GPIConnection)); - if(iconnection == NULL) - return GP_MEMORY_ERROR; - - // Initialize connection-specific variables. - //////////////////////////////////////////// - memset(iconnection, 0, sizeof(GPIConnection)); - iconnection->errorString[0] = '\0'; - iconnection->errorCode = (GPErrorCode)0; - iconnection->infoCaching = GPITrue; - iconnection->infoCachingBuddyAndBlockOnly = GPIFalse; - iconnection->simulation = GPIFalse; - iconnection->firewall = GPIFalse; - iconnection->productID = productID; - iconnection->namespaceID = namespaceID; - iconnection->partnerID = partnerID; - -#ifdef GSI_UNICODE - iconnection->errorString_W[0] = '\0'; -#endif - - if(!gpiInitProfiles((GPConnection *)&iconnection)) - { - freeclear(iconnection); - return GP_MEMORY_ERROR; - } - iconnection->diskCache = NULL; - for(i = 0 ; i < GPI_NUM_CALLBACKS ; i++) - { - iconnection->callbacks[i].callback = NULL; - iconnection->callbacks[i].param = NULL; - } - - // Reset connection-specific stuff. - /////////////////////////////////// - result = gpiReset((GPConnection *)&iconnection); - if(result != GP_NO_ERROR) - { - gpiDestroy((GPConnection *)&iconnection); - return result; - } - - // Initialize the sockets library. - ////////////////////////////////// - SocketStartUp(); - - // Seed the random number generator. - //////////////////////////////////// - srand((unsigned int)current_time()); - -#ifndef NOFILE - // Load profiles cached on disk. - //////////////////////////////// - result = gpiLoadDiskProfiles((GPConnection *)&iconnection); - if(result != GP_NO_ERROR) - { - gpiDestroy((GPConnection *)&iconnection); - return result; - } -#endif - -#ifndef NOFILE - result = gpiInitTransfers((GPConnection *)&iconnection); - if(result != GP_NO_ERROR) - { - gpiDestroy((GPConnection *)&iconnection); - return result; - } -#endif - - // Set the connection. - ////////////////////// - *connection = (GPConnection)iconnection; - - return GP_NO_ERROR; -} - -void -gpiDestroy( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Cleanup connection-specific stuff. - ///////////////////////////////////// - gpiDisconnect(connection, GPITrue); - gpiStatusInfoKeysDestroy(connection); - -#ifdef _PS3 - // Destroy NP - ///////////// - if (iconnection->npInitialized) - gpiDestroyNpBasic(connection); -#endif - -#ifndef NOFILE - // Write the profile info to disk. - // BD - Don't update if we never connected. - ////////////////////////////////// - if(iconnection->infoCaching && iconnection->connectState != GPI_NOT_CONNECTED) - { - if(gpiSaveDiskProfiles(connection) != GP_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_HotError, - "Error saving profiles to disk."); - } - } -#endif - - // Free the profile list. - ///////////////////////// - TableFree(iconnection->profileList.profileTable); - -#ifndef NOFILE - // Free the transfers. - ////////////////////// - gpiCleanupTransfers(connection); -#endif - - // Free the memory. - /////////////////// - freeclear(iconnection); - - // Set the connection pointer to NULL. - ////////////////////////////////////// - *connection = NULL; -} - -static GPIBool -gpiResetProfile( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ - GSI_UNUSED(connection); - GSI_UNUSED(data); - - profile->buddyStatus = NULL; - profile->buddyStatusInfo = NULL; - profile->authSig = NULL; - profile->requestCount = 0; - profile->peerSig = NULL; - profile->blocked = gsi_false; - profile->buddyOrBlockCache = gsi_false; - - return GPITrue; -} - -GPResult -gpiReset( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPResult result; - iconnection->nick[0] = '\0'; - iconnection->uniquenick[0] = '\0'; - iconnection->email[0] = '\0'; - iconnection->cmSocket = INVALID_SOCKET; - iconnection->connectState = GPI_NOT_CONNECTED; - - iconnection->socketBuffer.len = 0; - iconnection->socketBuffer.pos = 0; - iconnection->socketBuffer.size = 0; - freeclear(iconnection->socketBuffer.buffer); - iconnection->socketBuffer.buffer = NULL; - - iconnection->inputBufferSize = 0; - freeclear(iconnection->inputBuffer); - iconnection->inputBuffer = NULL; - - iconnection->outputBuffer.len = 0; - iconnection->outputBuffer.pos = 0; - iconnection->outputBuffer.size = 0; - freeclear(iconnection->outputBuffer.buffer); - iconnection->outputBuffer.buffer = NULL; - - iconnection->updateproBuffer.len = 0; - iconnection->updateproBuffer.pos = 0; - iconnection->updateproBuffer.size = 0; - freeclear(iconnection->updateproBuffer.buffer); - iconnection->updateproBuffer.buffer = NULL; - - iconnection->updateuiBuffer.len = 0; - iconnection->updateuiBuffer.pos = 0; - iconnection->updateuiBuffer.size = 0; - freeclear(iconnection->updateuiBuffer.buffer); - iconnection->updateuiBuffer.buffer = NULL; - gpiStatusInfoKeysDestroy(connection); - result = gpiStatusInfoKeysInit((GPConnection *)&iconnection); - if (result != GP_NO_ERROR) - { - gpiDestroy((GPConnection *)&iconnection); - return result; - } - //iconnection->peerSocket = INVALID_SOCKET; - iconnection->nextOperationID = 2; - while(iconnection->operationList != NULL) - gpiRemoveOperation(connection, iconnection->operationList); - iconnection->operationList = NULL; - iconnection->profileList.numBuddies = 0; - iconnection->profileList.numBlocked = 0; - gpiProfileMap(connection, gpiResetProfile, NULL); - iconnection->userid = 0; - iconnection->profileid = 0; - iconnection->sessKey = 0; - iconnection->numSearches = 0; - iconnection->fatalError = GPIFalse; - iconnection->peerList = NULL; - iconnection->lastStatusState = (GPEnum)-1; - iconnection->lastStatusString[0] = '\0'; - iconnection->lastLocationString[0] = '\0'; - iconnection->kaTransmit = 0; - -#ifdef GSI_UNICODE - iconnection->nick_W[0] = '\0'; - iconnection->uniquenick_W[0] = '\0'; - iconnection->email_W[0] = '\0'; - iconnection->lastStatusString_W[0] = '\0'; - iconnection->lastLocationString_W[0] = '\0'; -#endif - - return GP_NO_ERROR; -} - -GPResult -gpiProcessConnectionManager( - GPConnection * connection -) -{ - char * next; - char * str; - int id; - GPIOperation * operation; - char * tempPtr; - int len; - GPIBool connClosed = GPIFalse; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPResult result; - GPIBool loop; - gsi_time now = current_time(); - - // Loop through the rest while waiting for any blocking operations. - /////////////////////////////////////////////////////////////////// - do - { - // Add any waiting info to the output buffer. - ///////////////////////////////////////////// - gpiAddLocalInfo(connection, &iconnection->outputBuffer); - - // Send anything that needs to be sent. - /////////////////////////////////////// - if ( iconnection->outputBuffer.len > 0 ) - iconnection->kaTransmit = now; // data already being transmitted. We don't need to send keep alives - CHECK_RESULT(gpiSendFromBuffer(connection, iconnection->cmSocket, &iconnection->outputBuffer, &connClosed, GPITrue, "CM")); - - // Read everything the connection manager sent. - /////////////////////////////////////////////// - result = gpiRecvToBuffer(connection, iconnection->cmSocket, &iconnection->socketBuffer, &len, &connClosed, "CM"); - if(result != GP_NO_ERROR) - { - if(result == GP_NETWORK_ERROR) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error reading from the server."); - - return result; - } - - // Check if we have a completed command. - //////////////////////////////////////// - while((next = strstr(iconnection->socketBuffer.buffer, "\\final\\")) != NULL) - { - // Received command. Connection is still valid - ////////////////////////////////////////////// - iconnection->kaTransmit = now; - - // NUL terminate the command. - ///////////////////////////// - next[0] = '\0'; - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "CMD: %s\n", iconnection->socketBuffer.buffer); - - // Copy the command to the input buffer. - //////////////////////////////////////// - len = (next - iconnection->socketBuffer.buffer); - if(len > iconnection->inputBufferSize) - { - iconnection->inputBufferSize += max(GPI_READ_SIZE, len); - tempPtr = (char*)gsirealloc(iconnection->inputBuffer, (unsigned int)iconnection->inputBufferSize + 1); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - iconnection->inputBuffer = tempPtr; - } - memcpy(iconnection->inputBuffer, iconnection->socketBuffer.buffer, (unsigned int)len + 1); - - // Point to the start of the next one. - ////////////////////////////////////// - next += 7; - - // Move the rest of the connect buffer up to the front. - /////////////////////////////////////////////////////// - iconnection->socketBuffer.len -= (next - iconnection->socketBuffer.buffer); - memmove(iconnection->socketBuffer.buffer, next, (unsigned int)iconnection->socketBuffer.len + 1); - - // Check for an id. - /////////////////// - str = strstr(iconnection->inputBuffer, "\\id\\"); - if(str != NULL) - { - // Get the id. - ////////////// - id = atoi(str + 4); - - // Try and match the id with an operation. - ////////////////////////////////////////// - if(!gpiFindOperationByID(connection, &operation, id)) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_HotError, - "No matching operation found for id %d\n", id); - } - else - { - // Process the operation. - ///////////////////////// - CHECK_RESULT(gpiProcessOperation(connection, operation, iconnection->inputBuffer)); - } - } - // This is an unsolicited message. - ////////////////////////////////// - else - { - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, iconnection->inputBuffer, GPITrue)) - { - return GP_SERVER_ERROR; - } - else if(strncmp(iconnection->inputBuffer, "\\bm\\", 4) == 0) - { - CHECK_RESULT(gpiProcessRecvBuddyMessage(connection, iconnection->inputBuffer)); - } - else if(strncmp(iconnection->inputBuffer, "\\ka\\", 4) == 0) - { - // Ignore the keep-alive. - ///////////////////////// - } - else if(strncmp(iconnection->inputBuffer, "\\lt\\", 4) == 0) - { - // Process the login ticket - ///////////////////////// - gpiValueForKey(iconnection->inputBuffer, "\\lt\\", iconnection->loginTicket, sizeof(iconnection->loginTicket)); - } - else if(strncmp(iconnection->inputBuffer, "\\bsi\\", 5) == 0) - { - CHECK_RESULT(gpiProcessRecvBuddyStatusInfo(connection, iconnection->inputBuffer)); - } - else if(strncmp(iconnection->inputBuffer, "\\bdy\\", 5) == 0) - { - // Process the buddy list - retrieved upon login before final login response - // * Note: this only gets the list of your buddies so at least you'll know who - // is a buddy while the status of each is asynchronously updated. - ////////////////////////////////////////////////////////////////////////////// - CHECK_RESULT(gpiProcessRecvBuddyList(connection, iconnection->inputBuffer)); - } - else if(strncmp(iconnection->inputBuffer, "\\blk\\", 5) == 0) - { - // Process the block list - retrieved upon login before final login response - ////////////////////////////////////////////////////////////////////////////// - CHECK_RESULT(gpiProcessRecvBlockedList(connection, iconnection->inputBuffer)); - } - else - { - // This is an unrecognized message. - /////////////////////////////////// - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_HotError, - "Received an unrecognized message.\n"); - } - } - } - - - // Check for a closed connection. - ///////////////////////////////// - if(connClosed && iconnection->connectState != GPI_PROFILE_DELETING) - { - // We've been disconnected. - /////////////////////////// - // Let gpiDisconnect change the state to GPI_DISCONNECTED - //iconnection->connectState = GPI_DISCONNECTED; - gpiSetError(connection, GP_CONNECTION_CLOSED, "The server has closed the connection."); - gpiCallErrorCallback(connection, GP_NETWORK_ERROR, GP_FATAL); - return GP_NO_ERROR; - } - - //PANTS|05.23.00 - removed sleep - //crt - added it back 6/13/00 - //PANTS|07.10.00 - only sleep if looping - loop = gpiOperationsAreBlocking(connection); - if(loop) - msleep(10); - } - while(loop); - - // Send Keep-Alive. Just need TCP to ack the data - ///////////////////////////////////////////////// - if ( now - iconnection->kaTransmit > KEEPALIVE_TIMEOUT ) - { - // keep alive packet will be sent next think - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\ka\\\\final\\"); - iconnection->kaTransmit = now; - } - - return GP_NO_ERROR; -} - -GPResult -gpiProcess( - GPConnection * connection, - int blockingOperationID -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIOperation * operation; - GPIOperation * delOperation; - GPResult result = GP_NO_ERROR; - GPIBool loop; - - assert((iconnection->connectState == GPI_NOT_CONNECTED) || - (iconnection->connectState == GPI_CONNECTING) || - (iconnection->connectState == GPI_NEGOTIATING) || - (iconnection->connectState == GPI_CONNECTED) || - (iconnection->connectState == GPI_DISCONNECTED) || - (iconnection->connectState == GPI_PROFILE_DELETING)); - - // Check if no connection was attempted. - //////////////////////////////////////// -/* if(iconnection->connectState == GPI_NOT_CONNECTED) - return GP_NO_ERROR; - - // Check for a disconnection. - ///////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - return GP_NO_ERROR; -*/ - // Check if we're connecting. - ///////////////////////////// - if(iconnection->connectState == GPI_CONNECTING) - { - do - { - result = gpiCheckConnect(connection); - //PANTS|07.10.00 - only sleep if looping - loop = (((result == GP_NO_ERROR) && (blockingOperationID != 0) && (iconnection->connectState == GPI_CONNECTING))) ? GPITrue:GPIFalse; - if(loop) - msleep(10); - } - while(loop); - - if(result != GP_NO_ERROR) - { - // Find the connect operation. - ////////////////////////////// - if(gpiFindOperationByID(connection, &operation, 1)) - { - operation->result = GP_SERVER_ERROR; - } - else - { - // Couldn't find the connect operation. - /////////////////////////////////////// - assert(0); - } - } - } - - // Only do this stuff if we're connected. - ///////////////////////////////////////// - if((iconnection->connectState == GPI_CONNECTED) || (iconnection->connectState == GPI_NEGOTIATING) || - (iconnection->connectState == GPI_PROFILE_DELETING)) - { -#ifdef _PS3 - // initialize NP during the sync delay, if initialized wait for status == online - //////////////////////////////////////////////////////////////////////////////// - if (iconnection->npInitialized && !iconnection->npStatusRetrieved) - gpiCheckNpStatus(connection); - - // TODO: handle non-fatal errors (consider all errors from sync non-fatal?) - if (iconnection->npInitialized && iconnection->npStatusRetrieved) - { - // Delay sync after initialization to ensure block list has been received - ///////////////////////////////////////////////////////////////////////// - if ((current_time() - iconnection->loginTime) > GPI_NP_SYNC_DELAY) - { - if (iconnection->npPerformBuddySync) - gpiSyncNpBuddies(connection); - if (iconnection->npPerformBlockSync) - gpiSyncNpBlockList(connection); - } - - // Need to check callback for lookups - gpiProcessNp(connection); - } -#endif - - // Process the connection. - ////////////////////////// - if(result == GP_NO_ERROR) - result = gpiProcessConnectionManager(connection); - - // Process peer messaging stuff. - //////////////////////////////// - if(result == GP_NO_ERROR) - result = gpiProcessPeers(connection); - -#ifndef NOFILE - // Process transfers. - ///////////////////// - if(result == GP_NO_ERROR) - result = gpiProcessTransfers(connection); -#endif - } - - // Process searches. - //////////////////// - if(result == GP_NO_ERROR) - result = gpiProcessSearches(connection); - - // Look for failed operations. - ////////////////////////////// - for(operation = iconnection->operationList ; operation != NULL ; ) - { - if(operation->result != GP_NO_ERROR) - { - gpiFailedOpCallback(connection, operation); - delOperation = operation; - operation = operation->pnext; - gpiRemoveOperation(connection, delOperation); - } - else - { - operation = operation->pnext; - } - } - - // Call callbacks. - ////////////////// - CHECK_RESULT(gpiProcessCallbacks(connection, blockingOperationID)); - - if(iconnection->fatalError) - { - gpiDisconnect(connection, GPIFalse); - gpiReset(connection); - } - else - { - //assert(!((result != GP_NO_ERROR) && (iconnection->connectState != GPI_CONNECTED))); - } - - return result; -} - -GPResult -gpiEnable( - GPConnection * connection, - GPEnum state -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Enable the state. - //////////////////// - switch(state) - { - case GP_INFO_CACHING: - iconnection->infoCaching = GPITrue; - break; - - case GP_SIMULATION: - iconnection->simulation = GPITrue; - break; - - case GP_INFO_CACHING_BUDDY_AND_BLOCK_ONLY: - iconnection->infoCachingBuddyAndBlockOnly = GPITrue; - break; - - default: - Error(connection, GP_PARAMETER_ERROR, "Invalid state."); - } - - return GP_NO_ERROR; -} - -static GPIBool gpiFreeProfileInfo( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ - GSI_UNUSED(data); - - gpiFreeInfoCache(profile); - freeclear(profile->peerSig); - - if(gpiCanFreeProfile(profile)) - { - gpiRemoveProfile(connection, profile); - return GPIFalse; - } - - return GPITrue; -} - -GPResult -gpiDisable( - GPConnection * connection, - GPEnum state -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - if(state == GP_INFO_CACHING) - { - iconnection->infoCaching = GPIFalse; - - // freeclear everyone's info. - //////////////////////// - while(!gpiProfileMap(connection, gpiFreeProfileInfo, NULL)) { }; - } - else if(state == GP_SIMULATION) - { - iconnection->simulation = GPIFalse; - } - else if(state == GP_INFO_CACHING_BUDDY_AND_BLOCK_ONLY) - { - iconnection->infoCachingBuddyAndBlockOnly = GPIFalse; - } - else - { - Error(connection, GP_PARAMETER_ERROR, "Invalid state."); - } - - return GP_NO_ERROR; -} - -#ifdef _DEBUG -static int nProfiles; -static int nUserID; -static int nBuddyStatus; -static int nBuddyMemory; -static int nInfoCache; -static int nInfoMemory; -static int nAuthSig; -static int nPeerSig; -static int nTotalMemory; -static int nBlocked; - -static GPIBool -gpiReportProfile( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ - int temp; - - GSI_UNUSED(connection); - GSI_UNUSED(data); - - nProfiles++; - nTotalMemory += sizeof(GPIProfile); - if(profile->userId) nUserID++; - if(profile->buddyStatus) - { - nBuddyStatus++; - temp = sizeof(GPIBuddyStatus); - if(profile->buddyStatus->statusString) - temp += (int)(strlen(profile->buddyStatus->statusString) + 1); - if(profile->buddyStatus->locationString) - temp += (int)(strlen(profile->buddyStatus->locationString) + 1); -#ifdef GSI_UNICODE -// if(profile->buddyStatus->statusString_W) -// temp += (wcslen(profile->buddyStatus->statusString_W) + 2); -// if(profile->buddyStatus->locationString_W) -// temp += (wcslen(profile->buddyStatus->locationString_W) + 2); -#endif - nBuddyMemory += temp; - nTotalMemory += temp; - } - if(profile->cache) - { - nInfoCache++; - temp = sizeof(GPIInfoCache); - if(profile->cache->nick) - temp += (int)(strlen(profile->cache->nick) + 1); - if(profile->cache->uniquenick) - temp += (int)(strlen(profile->cache->uniquenick) + 1); - if(profile->cache->email) - temp += (int)(strlen(profile->cache->email) + 1); - if(profile->cache->firstname) - temp += (int)(strlen(profile->cache->firstname) + 1); - if(profile->cache->lastname) - temp += (int)(strlen(profile->cache->lastname) + 1); - if(profile->cache->homepage) - temp += (int)(strlen(profile->cache->homepage) + 1); - nInfoMemory += temp; - nTotalMemory += temp; - } - if(profile->authSig) nAuthSig++; - if(profile->peerSig) nPeerSig++; - if(profile->blocked) nBlocked++; - - return GPITrue; -} - -void -gpiReport( - GPConnection * connection, - void (* report)(const char * output) -) -{ - char buf[128]; - - nProfiles = 0; - nUserID = 0; - nBuddyStatus = 0; - nBuddyMemory = 0; - nInfoCache = 0; - nInfoMemory = 0; - nAuthSig = 0; - nPeerSig = 0; - nTotalMemory = 0; - nBlocked = 0; - - report("START PROFILE MAP"); - report("-----------------"); - gpiProfileMap(connection, gpiReportProfile, NULL); - - sprintf(buf, "%d profiles %d bytes (%d avg)", nProfiles, nTotalMemory, nTotalMemory / max(nProfiles, 1)); - report(buf); - if(nProfiles) - { - sprintf(buf, "UserID: %d (%d%%)", nUserID, nUserID * 100 / nProfiles); - report(buf); - sprintf(buf, "BuddyStatus: %d (%d%%) %d bytes (%d avg)", nBuddyStatus, nBuddyStatus * 100 / nProfiles, nBuddyMemory, nBuddyMemory / max(nBuddyStatus, 1)); - report(buf); - sprintf(buf, "InfoCache: %d (%d%%) %d bytes (%d avg)", nInfoCache, nInfoCache * 100 / nProfiles, nInfoMemory, nInfoMemory / max(nInfoCache, 1)); - report(buf); - sprintf(buf, "AuthSig: %d (%d%%)", nAuthSig, nAuthSig * 100 / nProfiles); - report(buf); - sprintf(buf, "PeerSig: %d (%d%%)", nPeerSig, nPeerSig * 100 / nProfiles); - report(buf); - sprintf(buf, "Blocked: %d (%d%%)", nBlocked, nBlocked * 100 / nProfiles); - report(buf); - } - - report("---------------"); - report("END PROFILE MAP"); - - -} -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpi.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpi.h deleted file mode 100644 index 0c23ad39a0b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpi.h +++ /dev/null @@ -1,231 +0,0 @@ -/* -gpi.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPI_H_ -#define _GPI_H_ - -//INCLUDES -////////// -#include "../common/gsCommon.h" -#include "../common/gsAvailable.h" -#include "../common/gsUdpEngine.h" -#include "../hashtable.h" -#include "../darray.h" -#include "../md5.h" -#include "gp.h" - -// Extended message support -#define GPI_NEW_AUTH_NOTIFICATION (1<<0) -#define GPI_NEW_REVOKE_NOTIFICATION (1<<1) - -// New Status Info support -#define GPI_NEW_STATUS_NOTIFICATION (1<<2) - -// Buddy List + Block List retrieval on login -#define GPI_NEW_LIST_RETRIEVAL_ON_LOGIN (1<<3) - -// Extended SDK features -#ifndef GPI_SDKREV -#ifdef GP_NEW_STATUS_INFO -#define GPI_SDKREV (GPI_NEW_AUTH_NOTIFICATION | GPI_NEW_REVOKE_NOTIFICATION | GPI_NEW_STATUS_NOTIFICATION | GPI_NEW_LIST_RETRIEVAL_ON_LOGIN) -#else -#define GPI_SDKREV (GPI_NEW_AUTH_NOTIFICATION | GPI_NEW_REVOKE_NOTIFICATION | GPI_NEW_LIST_RETRIEVAL_ON_LOGIN) -#endif -#endif - -// New UDP Layer port -#define GPI_PEER_PORT 6500 - -//TYPES -/////// -// Boolean. -/////////// -typedef enum _GPIBool -{ - GPIFalse, - GPITrue -} GPIBool; - -#include "gpiUtility.h" -#include "gpiCallback.h" -#include "gpiOperation.h" -#include "gpiConnect.h" -#include "gpiBuffer.h" -#include "gpiInfo.h" -#include "gpiProfile.h" -#include "gpiPeer.h" -#include "gpiSearch.h" -#include "gpiBuddy.h" -#include "gpiTransfer.h" -#include "gpiUnique.h" -#include "gpiKeys.h" - -// For PS3 NP Sync functionality -#ifdef _PS3 -#include "gpiPS3.h" -#endif - -// Connection data. -/////////////////// -typedef struct -{ - char errorString[GP_ERROR_STRING_LEN]; - GPIBool infoCaching; - GPIBool infoCachingBuddyAndBlockOnly; - GPIBool simulation; - GPIBool firewall; - char nick[GP_NICK_LEN]; - char uniquenick[GP_UNIQUENICK_LEN]; - char email[GP_EMAIL_LEN]; - char password[GP_PASSWORD_LEN]; - int sessKey; - int userid; - int profileid; - int partnerID; - GPICallback callbacks[GPI_NUM_CALLBACKS]; - SOCKET cmSocket; - int connectState; - GPIBuffer socketBuffer; - char * inputBuffer; - int inputBufferSize; - GPIBuffer outputBuffer; - // Replaced by UDP Layer - //SOCKET peerSocket; - char mHeader[GS_UDP_MSG_HEADER_LEN]; - unsigned short peerPort; - int nextOperationID; - int numSearches; - - // new style status info - GPEnum lastStatusState; - unsigned int hostIp; - unsigned int hostPrivateIp; - unsigned short queryPort; - unsigned short hostPort; - unsigned int sessionFlags; - - char richStatus[GP_RICH_STATUS_LEN]; - char gameType[GP_STATUS_BASIC_STR_LEN]; - char gameVariant[GP_STATUS_BASIC_STR_LEN]; - char gameMapName[GP_STATUS_BASIC_STR_LEN]; - - // New Status Info extended info Keys - DArray extendedInfoKeys; - - // Deprecated - char lastStatusString[GP_STATUS_STRING_LEN]; - char lastLocationString[GP_LOCATION_STRING_LEN]; - - GPErrorCode errorCode; - GPIBool fatalError; - FILE * diskCache; - GPIOperation * operationList; - GPIProfileList profileList; - GPIPeer * peerList; - GPICallbackData * callbackList; - GPICallbackData * lastCallback; - GPIBuffer updateproBuffer; - GPIBuffer updateuiBuffer; - DArray transfers; - unsigned int nextTransferID; - int productID; - int namespaceID; - char loginTicket[GP_LOGIN_TICKET_LEN]; - GPEnum quietModeFlags; - gsi_time kaTransmit; - -#ifdef GSI_UNICODE - unsigned short errorString_W[GP_ERROR_STRING_LEN]; - unsigned short nick_W[GP_NICK_LEN]; - unsigned short uniquenick_W[GP_UNIQUENICK_LEN]; - unsigned short email_W[GP_EMAIL_LEN]; - unsigned short password_W[GP_PASSWORD_LEN]; - - // Deprecated - unsigned short lastStatusString_W[GP_STATUS_STRING_LEN]; - unsigned short lastLocationString_W[GP_LOCATION_STRING_LEN]; - - unsigned short richStatus_W[GP_RICH_STATUS_LEN]; - unsigned short gameType_W[GP_STATUS_BASIC_STR_LEN]; - unsigned short gameVariant_W[GP_STATUS_BASIC_STR_LEN]; - unsigned short gameMapName_W[GP_STATUS_BASIC_STR_LEN]; -#endif - -#ifdef _PS3 - // NP sync info - gsi_bool npInitialized; - gsi_bool npStatusRetrieved; - gsi_bool npBasicGameInitialized; - gsi_bool npLookupGameInitialized; - gsi_bool npPerformBuddySync; - gsi_bool npPerformBlockSync; - gsi_bool npSyncLock; - int npLookupTitleCtxId; - DArray npTransactionList; - gsi_time loginTime; -#endif - -} GPIConnection; - -//FUNCTIONS -/////////// -GPResult -gpiInitialize( - GPConnection * connection, - int productID, - int namespaceID, - int partnerID -); - -void -gpiDestroy( - GPConnection * connection -); - -GPResult -gpiReset( - GPConnection * connection -); - -GPResult -gpiProcessConnectionManager( - GPConnection * connection -); - -GPResult -gpiProcess( - GPConnection * connection, - int blockingOperationID -); - -GPResult -gpiEnable( - GPConnection * connection, - GPEnum state -); - -GPResult -gpiDisable( - GPConnection * connection, - GPEnum state -); - -#ifdef _DEBUG -void -gpiReport( - GPConnection * connection, - void (* report)(const char * output) -); -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuddy.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuddy.c deleted file mode 100644 index 84f9bd47ce2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuddy.c +++ /dev/null @@ -1,1070 +0,0 @@ -/* -gpiBuddy.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4311) //lines: 977 -#pragma warning(disable: 4312) //lines: 1039, 1064 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -//INCLUDES -////////// -#include -#include -#include "gpi.h" - -//FUNCTIONS -/////////// -static GPResult -gpiSendAuthBuddyRequest( - GPConnection * connection, - GPIProfile * profile -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Send the auth. - ///////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\authadd\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\fromprofileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profile->profileId); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sig\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, profile->authSig); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult -gpiProcessRecvBuddyMessage( - GPConnection * connection, - const char * input -) -{ - char buffer[4096]; - int type; - int profileid; - time_t date; - GPICallback callback; - GPIProfile * profile; - GPIBuddyStatus * buddyStatus; - char intValue[16]; - char * str; - unsigned short port; - int productID; - GPIConnection * iconnection = (GPIConnection*)*connection; - char strTemp[max(GP_STATUS_STRING_LEN, GP_LOCATION_STRING_LEN)]; - - // Check the type of bm. - //////////////////////// - if(!gpiValueForKey(input, "\\bm\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - type = atoi(buffer); - - // Get the profile this is from. - //////////////////////////////// - if(!gpiValueForKey(input, "\\f\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - profileid = atoi(buffer); - - // Get the time. - //////////////// - if(!gpiValueForKey(input, "\\date\\", buffer, sizeof(buffer))) - date = time(NULL); - else - date = atoi(buffer); - - // What type of message is this? - //////////////////////////////// - switch(type) - { - case GPI_BM_MESSAGE: - // Call the callback. - ///////////////////// - callback = iconnection->callbacks[GPI_RECV_BUDDY_MESSAGE]; - if(callback.callback != NULL) - { - GPRecvBuddyMessageArg * arg; - arg = (GPRecvBuddyMessageArg *)gsimalloc(sizeof(GPRecvBuddyMessageArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - if(!gpiValueForKey(input, "\\msg\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); -#ifndef GSI_UNICODE - arg->message = (char *)gsimalloc(strlen(buffer) + 1); - if(arg->message == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - strcpy(arg->message, buffer); - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; -#else - arg->message = (unsigned short*)gsimalloc(strlen(buffer)*2+2); - if(arg->message == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - UTF8ToUCS2String(buffer, arg->message); - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; -#endif - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_MESSAGE)); - } - break; - case GPI_BM_UTM: - // Call the callback. - ///////////////////// - callback = iconnection->callbacks[GPI_RECV_BUDDY_UTM]; - if(callback.callback != NULL) - { - GPRecvBuddyUTMArg * arg; - arg = (GPRecvBuddyUTMArg *)gsimalloc(sizeof(GPRecvBuddyUTMArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - if(!gpiValueForKey(input, "\\msg\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); -#ifndef GSI_UNICODE - arg->message = (char *)gsimalloc(strlen(buffer) + 1); - if(arg->message == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - strcpy(arg->message, buffer); - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; -#else - arg->message = (unsigned short*)gsimalloc(strlen(buffer)*2+2); - if(arg->message == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - UTF8ToUCS2String(buffer, arg->message); - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; -#endif - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_BUDDYUTM)); - } - break; - - case GPI_BM_REQUEST: - // Get the profile, adding if needed. - ///////////////////////////////////// - profile = gpiProfileListAdd(connection, profileid); - if(!profile) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Get the reason. - ////////////////// - if(!gpiValueForKey(input, "\\msg\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Find where the sig starts. - ///////////////////////////// - str = strstr(buffer, "|signed|"); - if(str == NULL) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the sig out of the message. - ////////////////////////////////// - *str = '\0'; - str += 8; - if(strlen(str) != 32) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - freeclear(profile->authSig); - profile->authSig = goastrdup(str); - profile->requestCount++; - - // Call the callback. - ///////////////////// - callback = iconnection->callbacks[GPI_RECV_BUDDY_REQUEST]; - if(callback.callback != NULL) - { - GPRecvBuddyRequestArg * arg; - arg = (GPRecvBuddyRequestArg *)gsimalloc(sizeof(GPRecvBuddyRequestArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); -#ifndef GSI_UNICODE - strzcpy(arg->reason, buffer, GP_REASON_LEN); -#else - UTF8ToUCS2String(buffer, arg->reason); -#endif - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_BUDDDYREQUEST)); - } - break; - - case GPI_BM_AUTH: - // call the callback - callback = iconnection->callbacks[GPI_RECV_BUDDY_AUTH]; - if(callback.callback != NULL) - { - GPRecvBuddyAuthArg * arg; - arg = (GPRecvBuddyAuthArg *)gsimalloc(sizeof(GPRecvBuddyAuthArg)); - - if (arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_BUDDYAUTH)); - } - break; - - case GPI_BM_REVOKE: - // call the callback - callback = iconnection->callbacks[GPI_RECV_BUDDY_REVOKE]; - if(callback.callback != NULL) - { - GPRecvBuddyRevokeArg * arg; - arg = (GPRecvBuddyRevokeArg *)gsimalloc(sizeof(GPRecvBuddyRevokeArg)); - - if (arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->profile = (GPProfile)profileid; - arg->date = (unsigned int)date; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_BUDDYREVOKE)); - } - break; - - - case GPI_BM_STATUS: - // Get the profile, adding if needed. - ///////////////////////////////////// - profile = gpiProfileListAdd(connection, profileid); - if(!profile) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Make sure profile wasn't blocked prior to getting the status update - ////////////////////////////////////////////////////////////////////// - if (!profile->blocked) - { - // This is a buddy. - /////////////////// - if(!profile->buddyStatus) - { - profile->buddyStatus = (GPIBuddyStatus *)gsimalloc(sizeof(GPIBuddyStatus)); - if(!profile->buddyStatus) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(profile->buddyStatus, 0, sizeof(GPIBuddyStatus)); - if (profile->buddyStatusInfo) - { - profile->buddyStatus->buddyIndex = profile->buddyStatusInfo->buddyIndex; - gpiRemoveBuddyStatusInfo(profile->buddyStatusInfo); - profile->buddyStatusInfo = NULL; - } - else - profile->buddyStatus->buddyIndex = iconnection->profileList.numBuddies++; - } - - // Get the buddy status. - //////////////////////// - buddyStatus = profile->buddyStatus; - - // Get the msg. - /////////////// - if(!gpiValueForKey(input, "\\msg\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the status. - ////////////////// - if(!gpiValueForKey(buffer, "|s|", intValue, sizeof(intValue))) - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - } - else - { - buddyStatus->status = (GPEnum)atoi(intValue); - } - // Get the status string. - ///////////////////////// - freeclear(buddyStatus->statusString); - if(!gpiValueForKey(buffer, "|ss|", strTemp, GP_STATUS_STRING_LEN)) - strTemp[0] = '\0'; - buddyStatus->statusString = goastrdup(strTemp); - if(!buddyStatus->statusString) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Get the location string. - /////////////////////////// - freeclear(buddyStatus->locationString); - if(!gpiValueForKey(buffer, "|ls|", strTemp, GP_LOCATION_STRING_LEN)) - strTemp[0] = '\0'; - buddyStatus->locationString = goastrdup(strTemp); - if(!buddyStatus->locationString) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Get the ip. - ////////////// - if(!gpiValueForKey(buffer, "|ip|", intValue, sizeof(intValue))) - buddyStatus->ip = 0; - else - buddyStatus->ip = htonl((unsigned int)atoi(intValue)); - - // Get the port. - //////////////// - if(!gpiValueForKey(buffer, "|p|", intValue, sizeof(intValue))) - buddyStatus->port = 0; - else - { - port = (unsigned short)atoi(intValue); - buddyStatus->port = htons(port); - } - - // Get the quiet mode flags. - //////////////////////////// - if(!gpiValueForKey(buffer, "|qm|", intValue, sizeof(intValue))) - buddyStatus->quietModeFlags = GP_SILENCE_NONE; - else - buddyStatus->quietModeFlags = (GPEnum)atoi(intValue); - - // Call the callback. - ///////////////////// - callback = iconnection->callbacks[GPI_RECV_BUDDY_STATUS]; - if(callback.callback != NULL) - { - GPRecvBuddyStatusArg * arg; - arg = (GPRecvBuddyStatusArg *)gsimalloc(sizeof(GPRecvBuddyStatusArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - arg->profile = (GPProfile)profileid; - arg->index = buddyStatus->buddyIndex; - arg->date = (unsigned int)date; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_STATUS)); - } - } - break; - - case GPI_BM_INVITE: - // Get the msg. - /////////////// - if(!gpiValueForKey(input, "\\msg\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Find the productid. - ////////////////////// - str = strstr(buffer, "|p|"); - if(str == NULL) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Skip the |p|. - //////////////// - str += 3; - if(str[0] == '\0') - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the productid. - ///////////////////// - productID = atoi(str); - - // Find the location string (optional - older versions won't have) - str = strstr(buffer, "|l|"); - if(str != NULL) - strzcpy(strTemp, (str+3), sizeof(strTemp)); - else - strTemp[0] = '\0'; // no location, set to empty string - - // Call the callback. - ///////////////////// - callback = iconnection->callbacks[GPI_RECV_GAME_INVITE]; - if(callback.callback != NULL) - { - GPRecvGameInviteArg * arg; - arg = (GPRecvGameInviteArg *)gsimalloc(sizeof(GPRecvGameInviteArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - arg->profile = (GPProfile)profileid; - arg->productID = productID; -#ifdef GSI_UNICODE - AsciiToUCS2String(strTemp, arg->location); -#else - strcpy(arg->location, strTemp); -#endif - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, 0)); - } - break; - - case GPI_BM_PING: - // Get the msg. - /////////////// - if(!gpiValueForKey(input, "\\msg\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Send back a pong. - //////////////////// - gpiSendBuddyMessage(connection, profileid, GPI_BM_PONG, "1", 0, NULL); - - break; - -#ifndef NOFILE - case GPI_BM_PONG: - // Lets the transfers handle this. - ////////////////////////////////// - gpiTransfersHandlePong(connection, profileid, NULL); - - break; -#endif - } - - return GP_NO_ERROR; -} - -GPResult gpiProcessRecvBuddyStatusInfo(GPConnection *connection, const char *input) -{ - char buffer[1024]; - int profileid; - time_t date; - GPICallback callback; - GPIProfile * profile; - GPIBuddyStatusInfo * buddyStatusInfo; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // This is what the message should look like. Its broken up for easy viewing. - // - // "\bsi\\state\\profile\\bip\\bport\\hostip\\hprivip\" - // "\qport\\hport\\sessflags\\rstatus\\gameType\" - // "\gameVnt\\gameMn\\product\\qmodeflags\" - //////////////////////////////// - date = time(NULL); - // Get the buddy's profile - //////////////////////////////// - if(!gpiValueForKey(input, "\\profile\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - profileid = atoi(buffer); - - // Get the profile from the SDK's list, adding it if needed. - ///////////////////////////////////// - profile = gpiProfileListAdd(connection, profileid); - if(!profile) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Make sure profile wasn't blocked prior to getting the status update - ////////////////////////////////////////////////////////////////////// - if (!profile->blocked) - { - // This is a buddy. - /////////////////// - if(!profile->buddyStatusInfo) - { - profile->buddyStatusInfo = (GPIBuddyStatusInfo *)gsimalloc(sizeof(GPIBuddyStatusInfo)); - if(!profile->buddyStatusInfo) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(profile->buddyStatusInfo, 0, sizeof(GPIBuddyStatusInfo)); - if (profile->buddyStatus) - { - profile->buddyStatusInfo->buddyIndex = profile->buddyStatus->buddyIndex; - gpiRemoveBuddyStatus(profile->buddyStatus); - profile->buddyStatus = NULL; - } - else - profile->buddyStatusInfo->buddyIndex = iconnection->profileList.numBuddies++; - profile->buddyStatusInfo->extendedInfoKeys = ArrayNew(sizeof(GPIKey), GPI_INITIAL_NUM_KEYS, gpiStatusInfoKeyFree); - if (!profile->buddyStatusInfo->extendedInfoKeys) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - - // extract the buddy status information and - // fill in appropriate information. - ///////////////////////////////////////////// - buddyStatusInfo = profile->buddyStatusInfo; - - if (!gpiValueForKey(input, "\\state\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->statusState = (GPEnum)atoi(buffer); - - if (!gpiValueForKey(input, "\\bip\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->buddyIp = htonl((unsigned int)atoi(buffer)); - - if (!gpiValueForKey(input, "\\bport\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->buddyPort = (unsigned short)atoi(buffer); - - if (!gpiValueForKey(input, "\\hostip\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->hostIp = htonl((unsigned int)atoi(buffer)); - - if (!gpiValueForKey(input, "\\hprivip\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->hostPrivateIp = htonl((unsigned int)atoi(buffer)); - - if (!gpiValueForKey(input, "\\qport\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->queryPort = (unsigned short)atoi(buffer); - - if (!gpiValueForKey(input, "\\hport\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->hostPort = (unsigned short)atoi(buffer); - - if (!gpiValueForKey(input, "\\sessflags\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->sessionFlags = (unsigned int)atoi(buffer); - - freeclear(buddyStatusInfo->richStatus); - if (!gpiValueForKey(input, "\\rstatus\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->richStatus = goastrdup(buffer); - - freeclear(buddyStatusInfo->gameType); - if (!gpiValueForKey(input, "\\gameType\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->gameType = goastrdup(buffer); - - freeclear(buddyStatusInfo->gameVariant); - if (!gpiValueForKey(input, "\\gameVnt\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->gameVariant = goastrdup(buffer); - - freeclear(buddyStatusInfo->gameMapName); - if (!gpiValueForKey(input, "\\gameMn\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->gameMapName = goastrdup(buffer); - - if (!gpiValueForKey(input, "\\product\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->productId = (int)atoi(buffer); - - if (!gpiValueForKey(input, "\\qmodeflags\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - buddyStatusInfo->quietModeFlags = (GPEnum)atoi(buffer); - - callback = iconnection->callbacks[GPI_RECV_BUDDY_STATUS]; - if (callback.callback != NULL) - { - GPRecvBuddyStatusArg *anArg; - anArg = (GPRecvBuddyStatusArg *)gsimalloc(sizeof(GPRecvBuddyStatusArg)); - if (anArg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - anArg->date = (unsigned int)date; - anArg->index = buddyStatusInfo->buddyIndex; - anArg->profile = profileid; - - CHECK_RESULT(gpiAddCallback(connection, callback, anArg, NULL, 0)); - } - } - return GP_NO_ERROR; - -} - -GPResult -gpiProcessRecvBuddyList( - GPConnection * connection, - const char * input -) -{ - int i=0, j=0; - int num = 0; - int index = 0; - char c; - char *str = NULL; - char buffer[512]; - GPIProfile * profile; - GPProfile profileid; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // Process Buddy List Retrieval msg - Format like: - /* =============================================== - \bdy\\list\\final\ - =============================================== */ - - if(!gpiValueForKeyWithIndex(input, "\\bdy\\", &index, buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - num = atoi(buffer); - - // Check to make sure list is there - /////////////////////////////////// - str = strstr(input, "\\list\\"); - if (str == NULL) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Then increment index to get ready for parsing - //////////////////////////////////////////////// - str += 6; - index += 6; - - for (i=0; i < num; i++) - { - if (i==0) - { - // Manually grab first profile in list - comma delimiter - //////////////////////////////////////////////////////// - for(j=0 ; (j < sizeof(buffer)) && ((c = str[j]) != '\0') && (c != ',') ; j++) - { - buffer[j] = c; - } - buffer[min(j, sizeof(buffer) - 1)] = '\0'; - index += j; - } - else - { - if(!gpiValueForKeyWithIndex(input, ",", &index, buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - } - - profileid = atoi(buffer); - - // Get the profile, adding if needed. - ///////////////////////////////////// - profile = gpiProfileListAdd(connection, profileid); - if(!profile) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Mark as offline buddy for now until we get the real status - ///////////////////////////////////////////////////////////// -#ifdef GP_NEW_STATUS_INFO - // Use new status info as placeholder - profile->buddyStatusInfo = (GPIBuddyStatusInfo *)gsimalloc(sizeof(GPIBuddyStatusInfo)); - if(!profile->buddyStatusInfo) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(profile->buddyStatusInfo, 0, sizeof(GPIBuddyStatusInfo)); - - profile->buddyStatusInfo->extendedInfoKeys = ArrayNew(sizeof(GPIKey), GPI_INITIAL_NUM_KEYS, gpiStatusInfoKeyFree); - if (!profile->buddyStatusInfo->extendedInfoKeys) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - profile->buddyStatusInfo->buddyIndex = iconnection->profileList.numBuddies++; - profile->buddyStatusInfo->statusState = GP_OFFLINE; -#else - // Use buddy status as placeholder - profile->buddyStatus = (GPIBuddyStatus *)gsimalloc(sizeof(GPIBuddyStatus)); - if(!profile->buddyStatus) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(profile->buddyStatus, 0, sizeof(GPIBuddyStatus)); - profile->buddyStatus->buddyIndex = iconnection->profileList.numBuddies++; - profile->buddyStatus->status = GP_OFFLINE; -#endif - } - - return GP_NO_ERROR; -} - -GPResult -gpiSendServerBuddyMessage( - GPConnection * connection, - int profileid, - int type, - const char * message -) -{ - char buffer[3501]; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Copy the message into an internal buffer. - //////////////////////////////////////////// - strzcpy(buffer, message, sizeof(buffer)); - - // Setup the message. - ///////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\bm\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, type); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\t\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profileid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\msg\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, buffer); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult -gpiSendBuddyMessage( - GPConnection * connection, - int profileid, - int type, - const char * message, - int sendOption, - GPIPeerOp *peerOp -) -{ - GPIPeer * peer; - GPIProfile * profile; - //GPIConnection *iconnection = (GPIConnection *)*connection; - peer = gpiGetPeerByProfile(connection, profileid); - if(!peer) - { - // Check if we should send this through the server. - //////////////////////////////////////////////////// - if(!gpiGetProfile(connection, profileid, &profile) || - (!profile->buddyStatusInfo || !profile->buddyStatusInfo->buddyPort)) - { - if (sendOption == GP_DONT_ROUTE) - return GP_NETWORK_ERROR; - return gpiSendServerBuddyMessage(connection, profileid, type, message); - } - - // Create a new peer connection for this message. - ///////////////////////////////////////////////// - peer = gpiAddPeer(connection, profileid, GPITrue); - if(!peer) - return GP_MEMORY_ERROR; - - // Check if we need a sig. - ////////////////////////// - if(!profile->peerSig) - { - // Get the sig. - /////////////// - CHECK_RESULT(gpiPeerGetSig(connection, peer)); - } - else - { - // Try to connect to the peer. - ////////////////////////////// - CHECK_RESULT(gpiPeerStartConnect(connection, peer)); - } - } - else if (peer->state == GPI_PEER_DISCONNECTED) - { - if (gpiGetProfile(connection, profileid, &profile)) - { - // clear the buddy port to prevent future messages from - // being sent via UDP layer - if (profile->buddyStatusInfo) - profile->buddyStatusInfo->buddyPort = 0; - - // send the message through the server - if (sendOption == GP_DONT_ROUTE) - return GP_NETWORK_ERROR; - if (type < 100) - return gpiSendServerBuddyMessage(connection, profileid, type, message); - } - } - - if (peerOp) - { - gpiPeerAddOp(peer, peerOp); - } - // Copy the message. - //////////////////// - CHECK_RESULT(gpiPeerAddMessage(connection, peer, type, message)); - - return GP_NO_ERROR; -} - -GPResult gpiBuddyHandleKeyRequest(GPConnection *connection, GPIPeer *peer) -{ - char *message; - - // get all the keys and put them in the message part of bm - ////////////////////////////////////////////////////////// - CHECK_RESULT(gpiSaveKeysToBuffer(connection, &message)); - - // Done in case we haven't set any keys - if (message == NULL) - message = ""; - - CHECK_RESULT(gpiSendBuddyMessage(connection, peer->profile, GPI_BM_KEYS_REPLY, message, GP_DONT_ROUTE, NULL)); - - if (strcmp(message, "")!= 0) - freeclear(message); - return GP_NO_ERROR; -} - -GPResult gpiBuddyHandleKeyReply(GPConnection *connection, GPIPeer *peer, char *buffer) -{ - GPIProfile *pProfile; - - // Get the profile object to store the keys internally - ////////////////////////////////////////////////////// - - if(!gpiGetProfile(connection, peer->profile, &pProfile)) - Error(connection, GP_PARAMETER_ERROR, "Invalid profile."); - - // calculate the B64Decoded string len - if (strcmp(buffer, "") == 0) - { - GPIPeerOp *anIterator; - - for (anIterator = peer->peerOpQueue.first; anIterator != NULL; anIterator = anIterator->next) - if (anIterator->type == GPI_BM_KEYS_REQUEST) - break; - - if (!anIterator) - { - return GP_NO_ERROR; - } - else if (anIterator->type == GPI_BM_KEYS_REQUEST && anIterator->callback) - { - GPGetBuddyStatusInfoKeysArg *arg = (GPGetBuddyStatusInfoKeysArg *)gsimalloc(sizeof(GPGetBuddyStatusInfoKeysArg)); - GPICallback callback; - callback.callback = anIterator->callback; - callback.param = anIterator->userData; - - arg->keys = NULL; - arg->numKeys = 0; - arg->values = NULL; - arg->profile = peer->profile; - gpiAddCallback(connection, callback, arg, NULL, 0); - gpiPeerRemoveOp(peer, anIterator); - } - } - else - { - int decodedLen = 0, - index = 0, numKeys, i; - char keyName[512]; - char keyVal[512]; - char decodeKey[512]; - char decodeVal[512]; - gsi_char **keys; - gsi_char **values; - GPIPeerOp *anIterator; - char *checkKey = NULL; - - // start by getting the number of keys - gpiReadKeyAndValue(connection, buffer, &index, keyName, keyVal); - - // do not continue further if the header is missing - if (strcmp(keyName, "keys") != 0) - CallbackError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading keys reply message"); - - numKeys = atoi(keyVal); - - if (numKeys == 0) - { - GPIPeerOp *anIterator; - - for (anIterator = peer->peerOpQueue.first; anIterator != NULL; anIterator = anIterator->next) - if (anIterator->type == GPI_BM_KEYS_REQUEST) - break; - - if (!anIterator) - { - return GP_NO_ERROR; - } - else if (anIterator->type == GPI_BM_KEYS_REQUEST && anIterator->callback) - { - GPGetBuddyStatusInfoKeysArg *arg = (GPGetBuddyStatusInfoKeysArg *)gsimalloc(sizeof(GPGetBuddyStatusInfoKeysArg)); - GPICallback callback; - callback.callback = anIterator->callback; - callback.param = anIterator->userData; - - arg->keys = NULL; - arg->numKeys = 0; - arg->values = NULL; - arg->profile = peer->profile; - gpiAddCallback(connection, callback, arg, NULL, 0); - gpiPeerRemoveOp(peer, anIterator); - } - } - else - { - keys = (gsi_char **)gsimalloc(sizeof(gsi_char *) * numKeys); - values = (gsi_char **)gsimalloc(sizeof(gsi_char *) * numKeys); - - for (i = 0; i < numKeys; i++) - { - gpiReadKeyAndValue(connection, buffer, &index, keyName, keyVal); - B64Decode(keyName, decodeKey, (int)strlen(keyName), &decodedLen, 2); - decodeKey[decodedLen] = '\0'; - B64Decode(keyVal, decodeVal, (int)strlen(keyVal), &decodedLen, 2); - decodeVal[decodedLen] = '\0'; - #ifdef GSI_UNICODE - keys[i] = UTF8ToUCS2StringAlloc(decodeKey); - values[i]= UTF8ToUCS2StringAlloc(decodeVal); - #else - keys[i] = goastrdup(decodeKey); - values[i] = goastrdup(decodeVal); - #endif - - if (gpiStatusInfoCheckKey(connection, pProfile->buddyStatusInfo->extendedInfoKeys, decodeKey, &checkKey) == GP_NO_ERROR - && checkKey == NULL) - { - gpiStatusInfoAddKey(connection, pProfile->buddyStatusInfo->extendedInfoKeys, decodeKey, decodeVal); - } - else - { - gpiStatusInfoSetKey(connection, pProfile->buddyStatusInfo->extendedInfoKeys, decodeKey, decodeVal); - } - } - - for (anIterator = peer->peerOpQueue.first; anIterator != NULL; anIterator = anIterator->next) - if (anIterator->type == GPI_BM_KEYS_REQUEST) - break; - - if (!anIterator) - { - return GP_NO_ERROR; - } - else if (anIterator->type == GPI_BM_KEYS_REQUEST && anIterator->callback) - { - GPICallback callback; - GPGetBuddyStatusInfoKeysArg *arg = (GPGetBuddyStatusInfoKeysArg *)gsimalloc(sizeof(GPGetBuddyStatusInfoKeysArg)); - - callback.callback = anIterator->callback; - callback.param = anIterator->userData; - - // allocate a key array that points to each extended info key for that player - arg->numKeys = numKeys; - - arg->keys = keys; - arg->values = values; - arg->profile = peer->profile; - - gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_BUDDYKEYS); - gpiPeerRemoveOp(peer, anIterator); - } - } - } - - return GP_NO_ERROR; -} - -GPResult gpiAuthBuddyRequest -( - GPConnection * connection, - GPProfile profile -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Get the profile object. - ////////////////////////// - if(!gpiGetProfile(connection, profile, &pProfile)) - Error(connection, GP_PARAMETER_ERROR, "Invalid profile."); - - // Check for a valid sig. - ///////////////////////// - if(!pProfile->authSig) - Error(connection, GP_PARAMETER_ERROR, "Invalid profile."); - - // Send the request. - //////////////////// - CHECK_RESULT(gpiSendAuthBuddyRequest(connection, pProfile)); - - // freeclear the sig if no more requests. - //////////////////////////////////// - pProfile->requestCount--; - if(!iconnection->infoCaching && (pProfile->requestCount <= 0)) - { - freeclear(pProfile->authSig); - if(gpiCanFreeProfile(pProfile)) - gpiRemoveProfile(connection, pProfile); - } - - return GP_NO_ERROR; -} - -GPIBool -gpiFixBuddyIndices( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ -#ifndef _PS2 - int baseIndex = (int)(unsigned long)data; -#else - int baseIndex = (int)data; -#endif - - GSI_UNUSED(connection); - - if(profile->buddyStatus && (profile->buddyStatus->buddyIndex > baseIndex)) - profile->buddyStatus->buddyIndex--; - else if (profile->buddyStatusInfo && profile->buddyStatusInfo->buddyIndex > baseIndex) - profile->buddyStatusInfo->buddyIndex--; - return GPITrue; -} - -GPResult -gpiDeleteBuddy( - GPConnection * connection, - GPProfile profile, - GPIBool sendServerRequest -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection = (GPIConnection*)*connection; - int index; - - // Get the profile object. - ////////////////////////// - if(!gpiGetProfile(connection, profile, &pProfile)) - Error(connection, GP_PARAMETER_ERROR, "Invalid profile."); - - // Check that this is a buddy. - ////////////////////////////// - // Removed - 092404 BED - User could be a buddy even though we don't have the status - //if(!pProfile->buddyStatus) - // Error(connection, GP_PARAMETER_ERROR, "Profile not a buddy."); - - // Send the request. - //////////////////// - if (GPITrue == sendServerRequest) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\delbuddy\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\delprofileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, pProfile->profileId); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - } - - // Need to fix up the buddy indexes. - //////////////////////////////////// - if (pProfile->buddyStatus) - { - index = pProfile->buddyStatus->buddyIndex; - assert(index >= 0); - freeclear(pProfile->buddyStatus->statusString); - freeclear(pProfile->buddyStatus->locationString); - freeclear(pProfile->buddyStatus); - if(gpiCanFreeProfile(pProfile)) - gpiRemoveProfile(connection, pProfile); - iconnection->profileList.numBuddies--; - assert(iconnection->profileList.numBuddies >= 0); -#ifndef _PS2 - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)(unsigned long)index); -#else - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)index); -#endif - } - if (pProfile->buddyStatusInfo) - { - index = pProfile->buddyStatusInfo->buddyIndex; - assert(index >= 0); - freeclear(pProfile->buddyStatusInfo->richStatus); - freeclear(pProfile->buddyStatusInfo->gameType); - freeclear(pProfile->buddyStatusInfo->gameVariant); - freeclear(pProfile->buddyStatusInfo->gameMapName); - if (pProfile->buddyStatusInfo->extendedInfoKeys) - { - ArrayFree(pProfile->buddyStatusInfo->extendedInfoKeys); - pProfile->buddyStatusInfo->extendedInfoKeys = NULL; - } - freeclear(pProfile->buddyStatusInfo); - - if(gpiCanFreeProfile(pProfile)) - gpiRemoveProfile(connection, pProfile); - iconnection->profileList.numBuddies--; - assert(iconnection->profileList.numBuddies >= 0); -#ifndef _PS2 - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)(unsigned long)index); -#else - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)index); -#endif - } - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuddy.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuddy.h deleted file mode 100644 index 3b62d6d0e26..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuddy.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -gpiBuddy.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIBUDDY_H_ -#define _GPIBUDDY_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -// Types of bm's. -///////////////// -#define GPI_BM_MESSAGE 1 -#define GPI_BM_REQUEST 2 -#define GPI_BM_REPLY 3 // only used on the backend -#define GPI_BM_AUTH 4 -#define GPI_BM_UTM 5 -#define GPI_BM_REVOKE 6 // remote buddy removed from local list -#define GPI_BM_STATUS 100 -#define GPI_BM_INVITE 101 -#define GPI_BM_PING 102 -#define GPI_BM_PONG 103 -#define GPI_BM_KEYS_REQUEST 104 -#define GPI_BM_KEYS_REPLY 105 -#define GPI_BM_FILE_SEND_REQUEST 200 -#define GPI_BM_FILE_SEND_REPLY 201 -#define GPI_BM_FILE_BEGIN 202 -#define GPI_BM_FILE_END 203 -#define GPI_BM_FILE_DATA 204 -#define GPI_BM_FILE_SKIP 205 -#define GPI_BM_FILE_TRANSFER_THROTTLE 206 -#define GPI_BM_FILE_TRANSFER_CANCEL 207 -#define GPI_BM_FILE_TRANSFER_KEEPALIVE 208 - -//FUNCTIONS -/////////// -GPResult -gpiProcessRecvBuddyMessage( - GPConnection * connection, - const char * input -); - -GPResult gpiProcessRecvBuddyStatusInfo(GPConnection *connection, const char *input); - -GPResult -gpiProcessRecvBuddyList( - GPConnection * connection, - const char * input -); - -GPResult -gpiSendServerBuddyMessage( - GPConnection * connection, - int profileid, - int type, - const char * message -); - -GPResult -gpiSendBuddyMessage( - GPConnection * connection, - int profileid, - int type, - const char * message, - int sendOptions, - GPIPeerOp *peerOp -); - -GPResult gpiBuddyHandleKeyRequest(GPConnection *connection, GPIPeer *peer); -GPResult gpiBuddyHandleKeyReply(GPConnection *connection, GPIPeer *peer, char *buffer); - -GPResult -gpiAuthBuddyRequest( - GPConnection * connection, - GPProfile profile -); - -GPIBool -gpiFixBuddyIndices( - GPConnection * connection, - GPIProfile * profile, - void * data -); - -GPResult -gpiDeleteBuddy( - GPConnection * connection, - GPProfile profile, - GPIBool sendServerRequest -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuffer.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuffer.c deleted file mode 100644 index 40d1db7417a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuffer.c +++ /dev/null @@ -1,771 +0,0 @@ -/* -gpiBuffer.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 720 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -//INCLUDES -////////// -#include -#include -#include "gpi.h" - -//DEFINES -///////// -#define GPI_DUMP_NET_TRAFFIC - -//FUNCTIONS -/////////// -GPResult -gpiAppendCharToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - char c -) -{ - int len; - int size; - char * output; - - assert(outputBuffer != NULL); - - // Init locals. - /////////////// - len = outputBuffer->len; - size = outputBuffer->size; - output = outputBuffer->buffer; - - // Check if it needs to be resized. - /////////////////////////////////// - if(size == len) - { - size += GPI_READ_SIZE; - output = (char*)gsirealloc(output, (unsigned int)size + 1); - if(output == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - - // Do the copy. - /////////////// - output[len] = c; - output[len + 1] = '\0'; - - // Update the buffer info. - ////////////////////////// - outputBuffer->len++; - outputBuffer->size = size; - outputBuffer->buffer = output; - - return GP_NO_ERROR; -} - -GPResult -gpiAppendStringToBufferLen( - GPConnection * connection, - GPIBuffer * outputBuffer, - const char * string, - int stringLen -) -{ - int len; - int size; - char * output; - - assert(string != NULL); - assert(stringLen >= 0); - assert(outputBuffer != NULL); - - if(!string) - return GP_NO_ERROR; - - // Init locals. - /////////////// - len = outputBuffer->len; - size = outputBuffer->size; - output = outputBuffer->buffer; - - // Check if it needs to be resized. - /////////////////////////////////// - if((size - len) < stringLen) - { - size += max(GPI_READ_SIZE, stringLen); - output = (char*)gsirealloc(output, (unsigned int)size + 1); - if(output == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - - // Do the copy. - /////////////// - memcpy(&output[len], string, (unsigned int)stringLen); - output[len + stringLen] = '\0'; - - // Update the buffer info. - ////////////////////////// - outputBuffer->len += stringLen; - outputBuffer->size = size; - outputBuffer->buffer = output; - - return GP_NO_ERROR; -} - -GPResult -gpiAppendStringToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - const char * buffer -) -{ - return gpiAppendStringToBufferLen(connection, outputBuffer, buffer, (int)strlen(buffer)); -} - -GPResult gpiAppendShortToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - short num) -{ - char shortVal[8]; - sprintf(shortVal, "%d", num); - return gpiAppendStringToBuffer(connection, outputBuffer, shortVal); -} - -GPResult gpiAppendUShortToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - unsigned short num) -{ - char shortVal[8]; - sprintf(shortVal, "%u", num); - return gpiAppendStringToBuffer(connection, outputBuffer, shortVal); -} - -GPResult -gpiAppendIntToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - int num -) -{ - char intValue[16]; - sprintf(intValue,"%d",num); - return gpiAppendStringToBuffer(connection, outputBuffer, intValue); -} - -GPResult -gpiAppendUIntToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - unsigned int num -) -{ - char intValue[16]; - sprintf(intValue,"%u",num); - return gpiAppendStringToBuffer(connection, outputBuffer, intValue); -} - -static GPResult -gpiSendData( - GPConnection * connection, - SOCKET sock, - const char * buffer, - int bufferLen, - GPIBool * closed, - int * sent, - char id[3] -) -{ - int rcode; - - rcode = send(sock, buffer, bufferLen, 0); - if(gsiSocketIsError(rcode)) - { - rcode = GOAGetLastError(sock); - if((rcode != WSAEWOULDBLOCK) && (rcode != WSAEINPROGRESS) && (rcode != WSAETIMEDOUT) ) - { - // handle peer connections specially - if((id[0] == 'P') && (id[1] == 'R')) - return GP_NETWORK_ERROR; - CallbackError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error sending on a socket."); - } - - *sent = 0; - *closed = GPIFalse; - } - else if(rcode == 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Comment, - "SENDXXXX(%s): Connection closed\n", id); - - *sent = 0; - *closed = GPITrue; - } - else - { - #if defined(GPI_DUMP_NET_TRAFFIC) && defined(GSI_COMMON_DEBUG) - { - static int sendCount; - char *buf = (char *)gsimalloc((size_t)(rcode + 1)); - memcpy(buf, buffer, (size_t)rcode); - buf[rcode] = '\0'; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_RawDump, "SENT%04d(%s): %s\n", sendCount++, id, buf); - freeclear(buf); - } - #elif defined(GSI_COMMON_DEBUG) - { - static int sendCount; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "SENT%04d(%s): %d\n", sendCount++, id, rcode); - } - #endif - - *sent = rcode; - *closed = GPIFalse; - } - - return GP_NO_ERROR; -} - -GPResult -gpiSendOrBufferChar( - GPConnection * connection, - GPIPeer_st peer, - char c -) -{ - //GPIBool closed; - //int sent; -/* - assert(peer->outputBuffer.buffer != NULL); - - // Only try to send if the buffer is empty and there are no messages. - ///////////////////////////////////////////////////////////////////// - if(!(peer->outputBuffer.len - peer->outputBuffer.pos) && !ArrayLength(peer->messages)) - { - CHECK_RESULT(gpiSendData(connection, peer->sock, &c, 1, &closed, &sent, "PT")); - if(sent) - return GP_NO_ERROR; - } - - // Buffer if not sent. - ////////////////////// - return gpiAppendCharToBuffer(connection, &peer->outputBuffer, c); - */ - GSI_UNUSED(c); - GSI_UNUSED(peer); - GSI_UNUSED(connection); - return GP_NO_ERROR; -} - -GPResult -gpiSendOrBufferStringLenToPeer( - GPConnection * connection, - GPIPeer_st peer, - const char * string, - int stringLen -) -{ - GPIConnection *iconnection; - - unsigned int sent; - unsigned int total; - unsigned int remaining; - - assert(peer->outputBuffer.buffer != NULL); - - sent = 0; - iconnection = (GPIConnection *)*connection; - remaining = (unsigned int)stringLen; - total = 0; - - // Check for nothing to send. - ///////////////////////////// - if(stringLen == 0) - return GP_NO_ERROR; - - // Only try to send if the buffer is empty and there are no messages. - ///////////////////////////////////////////////////////////////////// - if(!(peer->outputBuffer.len - peer->outputBuffer.pos) && !ArrayLength(peer->messages)) - { - if ((int)remaining <= (gsUdpEngineGetPeerOutBufferFreeSpace(peer->ip, peer->port) - GS_UDP_RELIABLE_MSG_HEADER - GS_UDP_MSG_HEADER_LEN)) - { - gsUdpEngineSendMessage(peer->ip, peer->port, iconnection->mHeader, (unsigned char *)string, remaining, gsi_true); - total = remaining; - remaining = 0; - } - else - { - unsigned int freeSpace = (unsigned int)gsUdpEngineGetPeerOutBufferFreeSpace(peer->ip, peer->port); - if (freeSpace > (GS_UDP_MSG_HEADER_LEN + GS_UDP_RELIABLE_MSG_HEADER)) - { - sent = freeSpace - (GS_UDP_MSG_HEADER_LEN + GS_UDP_RELIABLE_MSG_HEADER); - gsUdpEngineSendMessage(peer->ip, peer->port, iconnection->mHeader, (unsigned char *)string, - sent, gsi_true); - total = sent; - remaining -= sent; - } - } - - } - - // Buffer what wasn't sent. - /////////////////////////// - if(remaining) - CHECK_RESULT(gpiAppendStringToBufferLen(connection, &peer->outputBuffer, &string[total], (int)remaining)); - - return GP_NO_ERROR; -} - -/* -GPResult -gpiSendOrBufferStringLen( - GPConnection * connection, - GPIPeer_st peer, - const char * string, - int stringLen - ) -{ - - GPIBool closed; - int sent; - int total; - int remaining; - - - assert(peer->outputBuffer.buffer != NULL); - - remaining = stringLen; - total = 0; - - // Check for nothing to send. - ///////////////////////////// - if(stringLen == 0) - return GP_NO_ERROR; - - // Only try to send if the buffer is empty and there are no messages. - ///////////////////////////////////////////////////////////////////// - if(!(peer->outputBuffer.len - peer->outputBuffer.pos) && !ArrayLength(peer->messages)) - { - do - { - CHECK_RESULT(gpiSendData(connection, peer->sock, &string[total], remaining, &closed, &sent, "PT")); - if(sent) - { - total += sent; - remaining -= sent; - } - } - while(sent && remaining); - } - - // Buffer what wasn't sent. - /////////////////////////// - if(remaining) - CHECK_RESULT(gpiAppendStringToBufferLen(connection, &peer->outputBuffer, &string[total], remaining)); - - - GSI_UNUSED(stringLen); - GSI_UNUSED(string); - GSI_UNUSED(peer); - GSI_UNUSED(connection); - return GP_NO_ERROR; -} -*/ - -GPResult -gpiSendOrBufferString( - GPConnection * connection, - GPIPeer_st peer, - char * string -) -{ - return gpiSendOrBufferStringLenToPeer(connection, peer, string, (int)strlen(string)); -} - -GPResult -gpiSendOrBufferInt( - GPConnection * connection, - GPIPeer_st peer, - int num -) -{ - char intValue[16]; - sprintf(intValue,"%d",num); - return gpiSendOrBufferString(connection, peer, intValue); -} - -GPResult -gpiSendOrBufferUInt( - GPConnection * connection, - GPIPeer_st peer, - unsigned int num -) -{ - char intValue[16]; - sprintf(intValue,"%u",num); - return gpiSendOrBufferString(connection, peer, intValue); -} - -GPResult -gpiRecvToBuffer( - GPConnection * connection, - SOCKET sock, - GPIBuffer * inputBuffer, - int * bytesRead, - GPIBool * connClosed, - char id[3] -) -{ - char * buffer; - int len; - int size; - int rcode; - int total; - GPIBool closed; - - assert(sock != INVALID_SOCKET); - assert(inputBuffer != NULL); - assert(bytesRead != NULL); - assert(connClosed != NULL); - - // Init locals. - /////////////// - buffer = inputBuffer->buffer; - len = inputBuffer->len; - size = inputBuffer->size; - total = 0; - closed = GPIFalse; - - do - { - // Check if the buffer needs to be resized. - /////////////////////////////////////////// - if((len + GPI_READ_SIZE) > size) - { - size = (len + GPI_READ_SIZE); - buffer = (char *)gsirealloc(buffer, (unsigned int)size + 1); - if(buffer == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - - // Read from the network. - rcode = recv(sock, &buffer[len], size - len, 0); - - - if(gsiSocketIsError(rcode)) - { - int error = GOAGetLastError(sock); - if((error != WSAEWOULDBLOCK) && (error != WSAEINPROGRESS) && (error != WSAETIMEDOUT) ) - { - Error(connection, GP_NETWORK_ERROR, "There was an error reading from a socket."); - } - } - else if(rcode == 0) - { - // Check for a closed connection. - ///////////////////////////////// - closed = GPITrue; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Comment, - "RECVXXXX(%s): Connection closed\n", id); - } - else - { - #if defined(GPI_DUMP_NET_TRAFFIC) && defined(GSI_COMMON_DEBUG) - { - static int recvCount; - char *buf = (char *)gsimalloc((size_t)(rcode + 1)); - memcpy(buf, &buffer[len], (size_t)rcode); - buf[rcode] = '\0'; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "RECV%04d(%s): %s\n", recvCount++, id, buf); - freeclear(buf); - } - #elif defined(GSI_COMMON_DEBUG) - { - static int recvCount; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "RECV%04d(%s): %d\n", recvCount++, id, rcode); - } - #endif - // Update the buffer len. - ///////////////////////// - len += rcode; - - // Update the total. - //////////////////// - total += rcode; - } - - buffer[len] = '\0'; - } - while((rcode >= 0) && !closed && (total < (128 * 1024))); - - if(total) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "RECVTOTL(%s): %d\n", id, total); - } - - // Set output stuff. - //////////////////// - inputBuffer->buffer = buffer; - inputBuffer->len = len; - inputBuffer->size = size; - *bytesRead = total; - *connClosed = closed; - - GSI_UNUSED(id); //to get rid of codewarrior warnings - - return GP_NO_ERROR; -} - -GPResult -gpiSendFromBuffer( - GPConnection * connection, - SOCKET sock, - GPIBuffer * outputBuffer, - GPIBool * connClosed, - GPIBool clipSentData, - char id[3] -) -{ - GPIBool closed; - int sent; - int total; - int remaining; - char * buffer; - int pos; - int len; - - assert(outputBuffer != NULL); - - buffer = outputBuffer->buffer; - len = outputBuffer->len; - pos = outputBuffer->pos; - remaining = (len - pos); - total = 0; - - // Check for nothing to send. - ///////////////////////////// - if(remaining == 0) - return GP_NO_ERROR; - - do - { - CHECK_RESULT(gpiSendData(connection, sock, &buffer[pos + total], remaining, &closed, &sent, id)); - if(sent) - { - total += sent; - remaining -= sent; - } - } - while(sent && remaining); - - if(clipSentData) - { - if(total > 0) - { - memmove(buffer, &buffer[total], (unsigned int)remaining + 1); - len -= total; - } - } - else - { - pos += total; - } - - assert(len >= 0); - assert(pos >= 0); - assert(pos <= len); - - // Set outputs. - /////////////// - outputBuffer->len = len; - outputBuffer->pos = pos; - if(connClosed) - *connClosed = closed; - - return GP_NO_ERROR; -} - -GPResult gpiSendBufferToPeer(GPConnection * connection, unsigned int ip, unsigned short port, - GPIBuffer * outputBuffer, GPIBool *closed, GPIBool clipSentData) -{ - GPIConnection *iconnection = (GPIConnection *)*connection; - //GPIBool closed; - unsigned int remaining; - unsigned char * buffer; - unsigned int pos; - unsigned int len; - unsigned int total = 0; - GSUdpPeerState aPeerState; - assert(outputBuffer != NULL); - - buffer = (unsigned char *)outputBuffer->buffer; - len = (unsigned int)outputBuffer->len; - pos = (unsigned int)outputBuffer->pos; - remaining = (len - pos); - - // Check for nothing to send. - ///////////////////////////// - if(remaining == 0) - return GP_NO_ERROR; - - // length of message remaining must be smaller than total buffer size minus gt2 reliable msg header size minus - // in order to send the message in one shot. - if ((int)remaining <= (gsUdpEngineGetPeerOutBufferFreeSpace(ip, port) - GS_UDP_RELIABLE_MSG_HEADER - GS_UDP_MSG_HEADER_LEN)) - { - gsUdpEngineSendMessage(ip, port, iconnection->mHeader, &buffer[pos], remaining, gsi_true); - total = remaining; - remaining = 0; - } - else - { - unsigned int freeSpace =0; - unsigned int sendAmount = 0; - do - { - freeSpace = (unsigned int)gsUdpEngineGetPeerOutBufferFreeSpace(ip, port); - sendAmount = freeSpace - (GS_UDP_MSG_HEADER_LEN + GS_UDP_RELIABLE_MSG_HEADER); - if (sendAmount <= (GS_UDP_MSG_HEADER_LEN + GS_UDP_RELIABLE_MSG_HEADER)) - break; - if (gsUdpEngineSendMessage(ip, port, iconnection->mHeader, &buffer[pos+total], sendAmount, gsi_true) == GS_UDP_SEND_FAILED) - break; - total += sendAmount; - remaining -= sendAmount; - }while (remaining); - } - - if(clipSentData) - { - if (total > 0) - { - memmove(buffer, &buffer[total], remaining + 1); - len -= total; - } - } - else - { - pos += total; - } - // Set outputs. - /////////////// - outputBuffer->len = (int)len; - outputBuffer->pos = (int)pos; - - gsUdpEngineGetPeerState(ip, port, &aPeerState); - if (aPeerState == GS_UDP_PEER_CLOSED) - *closed = GPITrue; - else - *closed = GPIFalse; - - return GP_NO_ERROR; -} - -GPResult -gpiReadMessageFromBuffer( - GPConnection * connection, - GPIBuffer * inputBuffer, - char ** message, - int * type, - int * plen -) -{ - char * str; - int len; - char intValue[16]; - - // Default. - /////////// - *message = NULL; - - // Check for not enough data. - ///////////////////////////// - if(inputBuffer->len < 5) - return GP_NO_ERROR; - - // Find the end of the header. - ////////////////////////////// - str = strchr(inputBuffer->buffer, '\n'); - if(str != NULL) - { - // Check that this is the msg. - ////////////////////////////// - if(strncmp(str - 5, "\\msg\\", 5) != 0) - return GP_NETWORK_ERROR; - - // Cap the header. - ////////////////// - *str = '\0'; - - // Read the header. - /////////////////// - if(!gpiValueForKey(inputBuffer->buffer, "\\m\\", intValue, sizeof(intValue))) - return GP_NETWORK_ERROR; - *type = atoi(intValue); - - // Get the length. - ////////////////// - if(!gpiValueForKey(inputBuffer->buffer, "\\len\\", intValue, sizeof(intValue))) - return GP_NETWORK_ERROR; - len = atoi(intValue); - len++; - - // Is the whole message available? - ////////////////////////////////// - if(inputBuffer->len > ((str - inputBuffer->buffer) + len)) - { - // Does it not end with a NUL? - ////////////////////////////// - if(str[len] != '\0') - return GP_NETWORK_ERROR; - - // Set the message stuff. - ///////////////////////// - *message = &str[1]; - *plen = (len - 1); - - // Set the position to the end of the message. - ////////////////////////////////////////////// - inputBuffer->pos = ((str - inputBuffer->buffer) + len + 1); - } - else - { - // Put the LF back. - /////////////////// - *str = '\n'; - } - } - - GSI_UNUSED(connection); - return GP_NO_ERROR; -} - -GPResult -gpiClipBufferToPosition( - GPConnection * connection, - GPIBuffer * buffer -) -{ - if(!buffer || !buffer->buffer || !buffer->pos) - return GP_NO_ERROR; - - buffer->len -= buffer->pos; - if(buffer->len) - memmove(buffer->buffer, buffer->buffer + buffer->pos, (unsigned int)buffer->len); - buffer->buffer[buffer->len] = '\0'; - buffer->pos = 0; - - GSI_UNUSED(connection); - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuffer.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuffer.h deleted file mode 100644 index 2a2b7a7113e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiBuffer.h +++ /dev/null @@ -1,167 +0,0 @@ -/* -gpiBuffer.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIBUFFER_H_ -#define _GPIBUFFER_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//TYPES -/////// -// A buffer. -//////////// -typedef struct -{ - char * buffer; - int size; - int len; - int pos; -} GPIBuffer; - -typedef struct GPIPeer_s * GPIPeer_st; - -//FUNCTIONS -/////////// -GPResult -gpiAppendCharToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - char c -); - -GPResult -gpiAppendStringToBufferLen( - GPConnection * connection, - GPIBuffer * outputBuffer, - const char * string, - int stringLen -); - -GPResult -gpiAppendStringToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - const char * buffer -); - -GPResult gpiAppendShortToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - short num -); - -GPResult gpiAppendUShortToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - unsigned short num -); - -GPResult -gpiAppendIntToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - int num -); - -GPResult -gpiAppendUIntToBuffer( - GPConnection * connection, - GPIBuffer * outputBuffer, - unsigned int num -); - -GPResult -gpiSendOrBufferChar( - GPConnection * connection, - GPIPeer_st peer, - char c -); - -/* -GPResult -gpiSendOrBufferStringLen( - GPConnection * connection, - GPIPeer_st peer, - const char * string, - int stringLen -); -*/ -GPResult -gpiSendOrBufferStringLenToPeer( - GPConnection * connection, - GPIPeer_st peer, - const char * string, - int stringLen -); - -GPResult -gpiSendOrBufferString( - GPConnection * connection, - GPIPeer_st peer, - char * string -); - -GPResult -gpiSendOrBufferInt( - GPConnection * connection, - GPIPeer_st peer, - int num -); - -GPResult -gpiSendOrBufferUInt( - GPConnection * connection, - GPIPeer_st peer, - unsigned int num -); - -GPResult -gpiSendFromBuffer( - GPConnection * connection, - SOCKET sock, - GPIBuffer * outputBuffer, - GPIBool * connClosed, - GPIBool clipSentData, - char id[3] -); - -GPResult -gpiRecvToBuffer( - GPConnection * connection, - SOCKET sock, - GPIBuffer * inputBuffer, - int * bytesRead, - GPIBool * connClosed, - char id[3] -); - -GPResult -gpiReadMessageFromBuffer( - GPConnection * connection, - GPIBuffer * inputBuffer, - char ** message, - int * type, - int * len -); - -GPResult -gpiClipBufferToPosition( - GPConnection * connection, - GPIBuffer * buffer -); - -GPResult gpiSendBufferToPeer(GPConnection * connection, unsigned int ip, unsigned short port, - GPIBuffer * outputBuffer, GPIBool *closed, GPIBool clipSentData); -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiCallback.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiCallback.c deleted file mode 100644 index 4de1049cc28..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiCallback.c +++ /dev/null @@ -1,277 +0,0 @@ -/* -gpiCallback.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include -#include "gpi.h" - -//FUNCTIONS -/////////// -void -gpiCallErrorCallback( - GPConnection * connection, - GPResult result, - GPEnum fatal -) -{ - GPICallback callback; - GPIConnection * iconnection = (GPIConnection*)*connection; - - assert(iconnection != NULL); - assert(result != GP_NO_ERROR); - assert((fatal == GP_FATAL) || (fatal == GP_NON_FATAL)); - - if(fatal == GP_FATAL) - iconnection->fatalError = GPITrue; - - callback = iconnection->callbacks[GPI_ERROR]; - if(callback.callback != NULL) - { - GPErrorArg * arg; - arg = (GPErrorArg *)gsimalloc(sizeof(GPErrorArg)); - - if(arg != NULL) - { - arg->result = result; - arg->fatal = fatal; - arg->errorCode = iconnection->errorCode; -#ifndef GSI_UNICODE - arg->errorString = iconnection->errorString; -#else - arg->errorString = iconnection->errorString_W; -#endif - - } - - gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_ERROR); - } -} - -GPResult -gpiAddCallback( - GPConnection * connection, - GPICallback callback, - void * arg, - const struct GPIOperation_s * operation, - int type -) -{ - GPICallbackData * data; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Allocate the callback data. - ////////////////////////////// - data = (GPICallbackData *)gsimalloc(sizeof(GPICallbackData)); - if(data == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - data->callback = callback; - data->arg = arg; - if(operation != NULL) - data->operationID = operation->id; - else - data->operationID = 0; - data->type = type; - data->pnext = NULL; - - // Update the list. - /////////////////// - if(iconnection->callbackList == NULL) - iconnection->callbackList = data; - if(iconnection->lastCallback != NULL) - iconnection->lastCallback->pnext = data; - iconnection->lastCallback = data; - - return GP_NO_ERROR; -} - -static void -gpiCallCallback( - GPConnection * connection, - GPICallbackData * data -) -{ - // Call the callback. - ///////////////////// - assert(data->callback.callback != NULL); - assert(data->arg != NULL); - data->callback.callback(connection, data->arg, data->callback.param); - if(data->type == GPI_ADD_MESSAGE) - { - freeclear(((GPRecvBuddyMessageArg *)data->arg)->message); - } - else if (data->type == GPI_ADD_BUDDYUTM) - { - freeclear(((GPRecvBuddyUTMArg *)data->arg)->message); - } - else if(data->type == GPI_ADD_NICKS) - { - int i; - GPGetUserNicksResponseArg * arg = (GPGetUserNicksResponseArg *)data->arg; - - for(i = 0 ; i < arg->numNicks ; i++) - { - freeclear(arg->nicks[i]); - freeclear(arg->uniquenicks[i]); - } - freeclear(arg->nicks); - freeclear(arg->uniquenicks) - } - else if(data->type == GPI_ADD_PMATCH) - { - GPFindPlayersResponseArg * arg = (GPFindPlayersResponseArg *)data->arg; - - freeclear(arg->matches); - } - else if(data->type == GPI_ADD_TRANSFER_CALLBACK) - { - GPTransferCallbackArg * arg = (GPTransferCallbackArg *)data->arg; - - if(arg->message) - freeclear(arg->message); - } - else if(data->type == GPI_ADD_REVERSE_BUDDIES) - { - GPGetReverseBuddiesResponseArg * arg = (GPGetReverseBuddiesResponseArg *)data->arg; - - if(arg->profiles) - freeclear(arg->profiles); - } - else if(data->type == GPI_ADD_SUGGESTED_UNIQUE) - { - int i; - GPSuggestUniqueNickResponseArg * arg = (GPSuggestUniqueNickResponseArg *)data->arg; - - for(i = 0 ; i < arg->numSuggestedNicks ; i++) - { - freeclear(arg->suggestedNicks[i]); - } - freeclear(arg->suggestedNicks); - } - else if (data->type == GPI_ADD_BUDDYREVOKE) - { - GPRecvBuddyRevokeArg * arg = (GPRecvBuddyRevokeArg *)data->arg; - - // Remove the profile from our local lists AFTER the callback has been called - gpiDeleteBuddy(connection, arg->profile, GPIFalse); - } - else if (data->type == GPI_ADD_REVERSE_BUDDIES_LIST) - { - GPGetReverseBuddiesListResponseArg * arg = (GPGetReverseBuddiesListResponseArg *)data->arg; - - if(arg->matches) - freeclear(arg->matches); - } - else if (data->type == GPI_ADD_BUDDYKEYS) - { - GPGetBuddyStatusInfoKeysArg *arg = (GPGetBuddyStatusInfoKeysArg *)data->arg; - if (arg->numKeys != 0) - { - int i; - for (i=0; i < arg->numKeys; i++) - { - freeclear(arg->keys[i]); - freeclear(arg->values[i]); - } - freeclear(arg->keys); - freeclear(arg->values); - } - } - freeclear(data->arg); - freeclear(data); -} - -GPResult -gpiProcessCallbacks( - GPConnection * connection, - int blockingOperationID -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPICallbackData * list; - GPICallbackData * last; - GPICallbackData * pcurr; - GPICallbackData * pnext; - GPICallbackData * pprev; - - if(blockingOperationID != 0) - { - list = iconnection->callbackList; - last = iconnection->lastCallback; - iconnection->callbackList = NULL; - iconnection->lastCallback = NULL; - - pprev = NULL; - for(pcurr = list ; pcurr != NULL ; ) - { - pnext = pcurr->pnext; - - if((pcurr->operationID == blockingOperationID) || (pcurr->type == GPI_ADD_ERROR)) - { - // Take this one out of the list. - ///////////////////////////////// - if(pprev != NULL) - pprev->pnext = pcurr->pnext; - else - list = pcurr->pnext; - if(last == pcurr) - last = pprev; - - // Call the callback. - ///////////////////// - gpiCallCallback(connection, pcurr); - } - else - { - pprev = pcurr; - } - - pcurr = pnext; - } - - // Were callbacks added within the callback? - //////////////////////////////////////////// - if(iconnection->callbackList != NULL) - { - iconnection->lastCallback->pnext = list; - iconnection->lastCallback = last; - } - else - { - // Reset the list. - ////////////////// - iconnection->callbackList = list; - iconnection->lastCallback = last; - } - - return GP_NO_ERROR; - } - - while(iconnection->callbackList != NULL) - { - list = iconnection->callbackList; - iconnection->callbackList = NULL; - iconnection->lastCallback = NULL; - - for(pcurr = list ; pcurr != NULL ; pcurr = pnext) - { - pnext = pcurr->pnext; - - // Call the callback. - ///////////////////// - gpiCallCallback(connection, pcurr); - } - } - - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiCallback.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiCallback.h deleted file mode 100644 index 599d090911a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiCallback.h +++ /dev/null @@ -1,109 +0,0 @@ -/* -gpiCallback.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPICALLBACK_H_ -#define _GPICALLBACK_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -// Unsolicited Callbacks. -///////////////////////// -enum GPICallbackId -{ - GPI_ERROR = GP_ERROR, - GPI_RECV_BUDDY_REQUEST = GP_RECV_BUDDY_REQUEST, - GPI_RECV_BUDDY_STATUS = GP_RECV_BUDDY_STATUS, - GPI_RECV_BUDDY_MESSAGE = GP_RECV_BUDDY_MESSAGE, - GPI_RECV_BUDDY_UTM = GP_RECV_BUDDY_UTM, - GPI_RECV_GAME_INVITE = GP_RECV_GAME_INVITE, - GPI_TRANSFER_CALLBACK = GP_TRANSFER_CALLBACK, - GPI_RECV_BUDDY_AUTH = GP_RECV_BUDDY_AUTH, - GPI_RECV_BUDDY_REVOKE = GP_RECV_BUDDY_REVOKE, - GPI_NUM_CALLBACKS -}; - -// Add type - not 0 only for a few. -/////////////////////////////////// -enum GPIAddCallbackType -{ - GPI_ADD_NORMAL, - GPI_ADD_ERROR, - GPI_ADD_MESSAGE, - GPI_ADD_NICKS, - GPI_ADD_PMATCH, - GPI_ADD_STATUS, - GPI_ADD_BUDDDYREQUEST, - GPI_ADD_TRANSFER_CALLBACK, - GPI_ADD_REVERSE_BUDDIES, - GPI_ADD_SUGGESTED_UNIQUE, - GPI_ADD_BUDDYAUTH, - GPI_ADD_BUDDYUTM, - GPI_ADD_BUDDYREVOKE, - GPI_ADD_REVERSE_BUDDIES_LIST, - GPI_ADD_BUDDYKEYS, - GPI_NUM_ADD_CALLBACK_TYPES -}; - - -//TYPES -/////// -// A Callback. -////////////// -typedef struct -{ - GPCallback callback; - void * param; -} GPICallback; - -// Data for a pending callback. -/////////////////////////////// -typedef struct GPICallbackData -{ - GPICallback callback; - void * arg; - int type; - int operationID; - struct GPICallbackData * pnext; -} GPICallbackData; - -//FUNCTIONS -/////////// -void -gpiCallErrorCallback( - GPConnection * connection, - GPResult result, - GPEnum fatal -); - -typedef struct GPIOperation_s *GPIOperation_st; - -GPResult -gpiAddCallback( - GPConnection * connection, - GPICallback callback, - void * arg, - const struct GPIOperation_s * operation, - int type -); - -GPResult -gpiProcessCallbacks( - GPConnection * connection, - int blockingOperationID -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiConnect.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiConnect.c deleted file mode 100644 index 5c4ecc89329..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiConnect.c +++ /dev/null @@ -1,993 +0,0 @@ -/* -gpiConnect.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4267) //lines: 379, 415, 739 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -//INCLUDES -////////// -#include -#include -#include "gpi.h" -#include - - -//DEFINES -///////// -// Connection Manager Address. -////////////////////////////// -#define GPI_CONNECTION_MANAGER_NAME "gpcm." GSI_DOMAIN_NAME -#define GPI_CONNECTION_MANAGER_PORT 29900 - -#define GPI_UDP_HEADER "gamespygp" -// Random String stuff. -/////////////////////// -#define RANDSTRING "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" -//this is off by one -//#define RANDOMCHAR() (RANDSTRING[(rand() * sizeof(RANDSTRING)) / (RAND_MAX + 1)]) -#define RANDOMCHAR() (RANDSTRING[rand() % (sizeof(RANDSTRING) - 1)]) - -//GLOBALS -///////// -char GPConnectionManagerHostname[64] = GPI_CONNECTION_MANAGER_NAME; - -//FUNCTIONS -/////////// -static void randomString( - char * buffer, - int numChars -) -{ - int i; - - for(i = 0 ; i < numChars ; i++) - buffer[i] = RANDOMCHAR(); - buffer[i] = '\0'; -} - -static GPResult -gpiStartConnect( - GPConnection * connection, - GPIOperation * operation -) -{ - struct sockaddr_in address; - int rcode; - //int len; - GPIConnection * iconnection = (GPIConnection*)*connection; - struct hostent * host; - - GSUdpErrorCode anError; - strncpy(iconnection->mHeader, GPI_UDP_HEADER, GS_UDP_MSG_HEADER_LEN); - - if (!gsUdpEngineIsInitialized()) - { - unsigned short peerPort = GPI_PEER_PORT; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Notice, - "Initializing UDP Layer\n"); - anError = gsUdpEngineInitialize(peerPort, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (anError != GS_UDP_NO_ERROR) - { - while (anError != GS_UDP_NO_ERROR && peerPort < GPI_PEER_PORT + 100) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Comment, - "Port %d failed, trying next port\n", peerPort); - anError = gsUdpEngineInitialize(++peerPort, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - } - if (anError != GS_UDP_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_HotError, - "Tryed all 100 ports after default port, giving up.\n"); - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_UDP_LAYER, - "There was error starting the UDP layer."); - } - } - if (!iconnection->firewall) - { - iconnection->peerPort = peerPort; - } - } - else - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Notice, - "UDP Layer already initialized, using existing port.\n"); - iconnection->peerPort = gsUdpEngineGetLocalPort(); - } - anError = gsUdpEngineAddMsgHandler(iconnection->mHeader, iconnection->mHeader, NULL, gpiPeerAcceptedCallback, gpiPeerLeftCallback, - gpiPeerPingReplyCallback, gpiPeerMessageCallback, connection); - if (anError != GS_UDP_NO_ERROR) - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_UDP_LAYER, "There was an error starting the UDP Layer."); - } - if(iconnection->firewall) - { - - /* - // Create the peer listening socket. - //////////////////////////////////// - iconnection->peerSocket = socket(AF_INET, SOCK_STREAM, 0); - if(iconnection->peerSocket == INVALID_SOCKET) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error creating a socket."); - - // Make it non-blocking. - //////////////////////// - rcode = SetSockBlocking(iconnection->peerSocket,0); - if (rcode == 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error making a socket non-blocking."); - // Bind the socket. - /////////////////// - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - rcode = bind(iconnection->peerSocket, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if(gsiSocketIsError(rcode)) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error binding a socket."); - - // Start listening on the socket. - ///////////////////////////////// - rcode = listen(iconnection->peerSocket, SOMAXCONN); - if(gsiSocketIsError(rcode)) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error listening on a socket."); - - // Get the socket's port. - ///////////////////////// - len = sizeof(struct sockaddr_in); - rcode = getsockname(iconnection->peerSocket, (struct sockaddr *)&address, &len); - - if (gsiSocketIsError(rcode)) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error getting a socket's addres."); - iconnection->peerPort = address.sin_port; - */ - - - iconnection->peerPort = 0; - } - /* - else - { - // Deprecated TCP code; Replaced by UDP Layer - // No local port. - ///////////////// - //iconnection->peerSocket = INVALID_SOCKET; - - // Set to nothing because NN will determine this - ////////////////////////// - //iconnection->peerPort = 0; - } - */ - - - - // Create the cm socket. - //////////////////////// - iconnection->cmSocket = socket(AF_INET, SOCK_STREAM, 0); - if(iconnection->cmSocket == INVALID_SOCKET) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error creating a socket."); - - // Make it non-blocking. - //////////////////////// - rcode = SetSockBlocking(iconnection->cmSocket,0); - if(rcode == 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error making a socket non-blocking."); -/* - // Bind the socket. - /////////////////// - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - rcode = bind(iconnection->cmSocket, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if (gsiSocketIsError(rcode)) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error binding a socket."); -*/ - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - // Get the server host. - /////////////////////// - if (inet_addr(GPConnectionManagerHostname) == INADDR_NONE) - { - host = gethostbyname(GPConnectionManagerHostname); - if(host == NULL) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "Could not resolve connection mananger host name."); - address.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; - //printf("Resolved Hostname and copied address: %s\n", inet_ntoa(address.sin_addr)); - } - else - { - address.sin_addr.s_addr = inet_addr(GPConnectionManagerHostname); - //printf("Using hardcoded address: %s", GPConnectionManagerHostname); - } - - // Connect the socket. - ////////////////////// - assert(address.sin_addr.s_addr != 0); - address.sin_port = htons(GPI_CONNECTION_MANAGER_PORT); - rcode = connect(iconnection->cmSocket, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if (gsiSocketIsError(rcode)) - { - int error = GOAGetLastError(iconnection->cmSocket); - if((error != WSAEWOULDBLOCK) && (error != WSAEINPROGRESS) && (error != WSAETIMEDOUT)) - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error connecting a socket."); - } - } - - // We're waiting for the connect to complete. - ///////////////////////////////////////////// - operation->state = GPI_CONNECTING; - iconnection->connectState = GPI_CONNECTING; - - return GP_NO_ERROR; -} - -GPResult -gpiConnect( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - const char authtoken[GP_AUTHTOKEN_LEN], - const char partnerchallenge[GP_PARTNERCHALLENGE_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum firewall, - GPIBool newuser, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnectData * data; - GPIOperation * operation; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPResult result; - - // Reset if this connection was already used. - ///////////////////////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - CHECK_RESULT(gpiReset(connection)); - - // Error check. - /////////////// - if(iconnection->connectState != GPI_NOT_CONNECTED) - Error(connection, GP_PARAMETER_ERROR, "Invalid connection."); - - // Get the firewall setting. - //////////////////////////// -#if defined(GS_WIRELESS_DEVICE) - GSI_UNUSED(firewall); - iconnection->firewall = GPITrue; -#else - switch(firewall) - { - case GP_FIREWALL: - iconnection->firewall = GPITrue; - break; - case GP_NO_FIREWALL: - iconnection->firewall = GPIFalse; - break; - default: - Error(connection, GP_PARAMETER_ERROR, "Invalid firewall."); - } -#endif - - // Get the nick, uniquenick, email, and password. - ///////////////////////////////////////////////// - strzcpy(iconnection->nick, nick, GP_NICK_LEN); - strzcpy(iconnection->uniquenick, uniquenick, GP_UNIQUENICK_LEN); - strzcpy(iconnection->email, email, GP_EMAIL_LEN); - strzcpy(iconnection->password, password, GP_PASSWORD_LEN); - -#ifdef GSI_UNICODE - // Create the _W version in addition - UTF8ToUCS2StringLen(iconnection->nick, iconnection->nick_W, GP_NICK_LEN); - UTF8ToUCS2StringLen(iconnection->uniquenick, iconnection->uniquenick_W, GP_UNIQUENICK_LEN); - UTF8ToUCS2StringLen(iconnection->email, iconnection->email_W, GP_EMAIL_LEN); - UTF8ToUCS2StringLen(iconnection->password, iconnection->password_W, GP_PASSWORD_LEN); -#endif - - // Lowercase the email. - /////////////////////// - _strlwr(iconnection->email); - -#ifdef GSI_UNICODE - // Update the UCS2 version (emails are ASCII anyhow so lowercasing didn't data) - AsciiToUCS2String(iconnection->email, iconnection->email_W); -#endif - - // Create a connect operation data struct. - ////////////////////////////////////////// - data = (GPIConnectData *)gsimalloc(sizeof(GPIConnectData)); - if(data == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(data, 0, sizeof(GPIConnectData)); - - // Check for new user. - ////////////////////// - data->newuser = newuser; - - // Store pre-auth data. - /////////////////////// - if(authtoken[0] && partnerchallenge[0]) - { - strzcpy(data->authtoken, authtoken, GP_AUTHTOKEN_LEN); - strzcpy(data->partnerchallenge, partnerchallenge, GP_PARTNERCHALLENGE_LEN); - } - - // Store cdkey if we have one. - ////////////////////////////// - if(cdkey) - strzcpy(data->cdkey, cdkey, GP_CDKEY_LEN); - - // Add the operation to the list. - ///////////////////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_CONNECT, data, &operation, blocking, callback, param)); - - // Start it. - //////////// - result = gpiStartConnect(connection, operation); - if(result != GP_NO_ERROR) - { - operation->result = result; - gpiFailedOpCallback(connection, operation); - gpiDisconnect(connection, GPIFalse); - return result; - } - - // Process it if blocking. - ////////////////////////// - if(operation->blocking) - CHECK_RESULT(gpiProcess(connection, operation->id)); - - return GP_NO_ERROR; -} - -static GPResult -gpiSendLogin( - GPConnection * connection, - GPIConnectData * data -) -{ - char buffer[512]; - char response[33]; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfile * profile; - char * passphrase; - char userBuffer[GP_NICK_LEN + GP_EMAIL_LEN]; - char partnerBuffer[11]; - char * user; - - // Construct the user challenge. - //////////////////////////////// - randomString(data->userChallenge, sizeof(data->userChallenge) - 1); - - // Hash the password. - ///////////////////// - if(data->partnerchallenge[0]) - passphrase = data->partnerchallenge; - else - passphrase = iconnection->password; - MD5Digest((unsigned char*)passphrase, strlen(passphrase), data->passwordHash); - - // Construct the user. - ////////////////////// - if(iconnection->partnerID != GP_PARTNERID_GAMESPY) - { - sprintf(partnerBuffer, "%d@", iconnection->partnerID); - } - else - { - // GS ID's do not stash the partner ID in the auth challenge to support legacy clients. - strcpy(partnerBuffer, ""); - } - - if(data->authtoken[0]) - user = data->authtoken; - else if(iconnection->uniquenick[0]) - { - sprintf(userBuffer, "%s%s", partnerBuffer, iconnection->uniquenick); - user = userBuffer; - } - else - { - sprintf(userBuffer, "%s%s@%s", partnerBuffer, iconnection->nick, iconnection->email); - user = userBuffer; - } - - // Construct the response. - ////////////////////////// - sprintf(buffer, "%s%s%s%s%s%s", - data->passwordHash, - " ", - user, - data->userChallenge, - data->serverChallenge, - data->passwordHash); - MD5Digest((unsigned char *)buffer, strlen(buffer), response); - - // Check for an existing profile. - ///////////////////////////////// - if(iconnection->infoCaching) - { - gpiFindProfileByUser(connection, iconnection->nick, iconnection->email, &profile); - if(profile != NULL) - { - // Get the userid and profileid. - //////////////////////////////// - iconnection->userid = profile->userId; - iconnection->profileid = profile->profileId; - } - } - - // Construct the outgoing message. - ////////////////////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\login\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\challenge\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, data->userChallenge); - if(data->authtoken[0]) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\authtoken\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, data->authtoken); - } - else if(iconnection->uniquenick[0]) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\uniquenick\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->uniquenick); - } - else - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\user\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->nick); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "@"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->email); - } - if(iconnection->userid != 0) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\userid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->userid); - } - if(iconnection->profileid != 0) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->profileid); - } - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->partnerID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\response\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, response); - if(iconnection->firewall == GP_FIREWALL) - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\firewall\\1"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\port\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->peerPort); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\productid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->productID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\gamename\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, __GSIACGamename); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->namespaceID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sdkrevision\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, GPI_SDKREV); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\quiet\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->quietModeFlags); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\1"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -static GPResult -gpiSendNewuser( - GPConnection * connection, - GPIConnectData * data -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - size_t i; - const int useAlternateEncoding = 1; - - // Encrypt the password (xor with random values) - char passwordenc[GP_PASSWORDENC_LEN]; - gpiEncodeString(iconnection->password, passwordenc); - - // Construct the outgoing message. - ////////////////////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\newuser\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\email\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->email); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\nick\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->nick); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\passwordenc\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, passwordenc); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\productid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->productID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\gamename\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, __GSIACGamename); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->namespaceID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\uniquenick\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->uniquenick); - if(data->cdkey[0]) - { - // Encrypt the cdkey (xor with random values) - char cdkeyxor[GP_CDKEY_LEN]; - char cdkeyenc[GP_CDKEYENC_LEN]; - size_t cdkeylen = strlen(data->cdkey); - - Util_RandSeed((unsigned long)GP_XOR_SEED); - for (i=0; i < cdkeylen; i++) - { - // XOR each character with the next rand - char aRand = (char)Util_RandInt(0, 0xFF); - cdkeyxor[i] = (char)(data->cdkey[i] ^ aRand); - } - cdkeyxor[i] = '\0'; - - // Base 64 it (printable chars only) - B64Encode(cdkeyxor, cdkeyenc, (int)cdkeylen, useAlternateEncoding); - - //gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\cdkey\\"); - //gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, data->cdkey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\cdkeyenc\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, cdkeyenc); - } - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->partnerID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\1"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult -gpiProcessConnect( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - char buffer[512]; - char check[33]; - char uniquenick[GP_UNIQUENICK_LEN]; - GPIConnectData * data; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPICallback callback; - GPIProfile * profile; - char userBuffer[GP_NICK_LEN + GP_EMAIL_LEN]; - char partnerBuffer[11]; - char * user; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPIFalse)) - { - // Is this a deleted profile? - ///////////////////////////// - if((iconnection->errorCode == GP_LOGIN_PROFILE_DELETED) && iconnection->profileid) - { - // Remove this profile object. - ////////////////////////////// - gpiRemoveProfileByID(connection, iconnection->profileid); - - // If we have the profileid/userid cached, lose them. - ///////////////////////////////////////////////////// - iconnection->userid = 0; - iconnection->profileid = 0; - } - // Check for creating an existing profile. - ////////////////////////////////////////// - else if(iconnection->errorCode == GP_NEWUSER_BAD_NICK) - { - // Store the pid. - ///////////////// - if(gpiValueForKey(input, "\\pid\\", buffer, sizeof(buffer))) - iconnection->profileid = atoi(buffer); - } - - // Call the callbacks. - ////////////////////// - CallbackFatalError(connection, GP_SERVER_ERROR, iconnection->errorCode, iconnection->errorString); - } - - // Get a pointer to the data. - ///////////////////////////// - data = (GPIConnectData*)operation->data; - - switch(operation->state) - { - case GPI_CONNECTING: - // This should be \lc\1. - //////////////////////// - if(strncmp(input, "\\lc\\1", 5) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the server challenge. - //////////////////////////// - if(!gpiValueForKey(input, "\\challenge\\", data->serverChallenge, sizeof(data->serverChallenge))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Check if this is a new user. - /////////////////////////////// - if(data->newuser) - { - // Send a new user message. - /////////////////////////// - CHECK_RESULT(gpiSendNewuser(connection, data)); - - // Update the operation's state. - //////////////////////////////// - operation->state = GPI_REQUESTING; - } - else - { - // Send a login message. - //////////////////////// - CHECK_RESULT(gpiSendLogin(connection, data)); - - // Update the operation's state. - //////////////////////////////// - operation->state = GPI_LOGIN; - } - - break; - - case GPI_REQUESTING: - // This should be \nur\. - //////////////////////// - if(strncmp(input, "\\nur\\", 5) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the userid. - ////////////////// - if(!gpiValueForKey(input, "\\userid\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexepected data was received from the server."); - iconnection->userid = atoi(buffer); - - // Get the profileid. - ///////////////////// - if(!gpiValueForKey(input, "\\profileid\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexepected data was received from the server."); - iconnection->profileid = atoi(buffer); - - // Send a login request. - //////////////////////// - CHECK_RESULT(gpiSendLogin(connection, data)); - - // Update the operation's state. - //////////////////////////////// - operation->state = GPI_LOGIN; - - break; - - case GPI_LOGIN: - // This should be \lc\2. - //////////////////////// - if(strncmp(input, "\\lc\\2", 5) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the sesskey. - /////////////////// - if(!gpiValueForKey(input, "\\sesskey\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexepected data was received from the server."); - iconnection->sessKey = atoi(buffer); - - // Get the userid. - ////////////////// - if(!gpiValueForKey(input, "\\userid\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexepected data was received from the server."); - iconnection->userid = atoi(buffer); - - // Get the profileid. - ///////////////////// - if(!gpiValueForKey(input, "\\profileid\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexepected data was received from the server."); - iconnection->profileid = atoi(buffer); - - // Get the uniquenick. - ////////////////////// - if(!gpiValueForKey(input, "\\uniquenick\\", uniquenick, sizeof(uniquenick))) - uniquenick[0] = '\0'; - - // Get the loginticket. - ////////////////////// - if(!gpiValueForKey(input, "\\lt\\", iconnection->loginTicket, sizeof(iconnection->loginTicket))) - iconnection->loginTicket[0] = '\0'; - - - // Construct the user. - ////////////////////// - if(iconnection->partnerID != GP_PARTNERID_GAMESPY) - { - sprintf(partnerBuffer, "%d@", iconnection->partnerID); - } - else - { - // GS ID's do not stash the partner ID in the auth challenge to support legacy clients. - strcpy(partnerBuffer, ""); - } - - if(data->authtoken[0]) - user = data->authtoken; - else if(iconnection->uniquenick[0]) - { - sprintf(userBuffer, "%s%s", partnerBuffer, iconnection->uniquenick); - user = userBuffer; - } - else - { - sprintf(userBuffer, "%s%s@%s", partnerBuffer, iconnection->nick, iconnection->email); - user = userBuffer; - } - - // Construct the check. - /////////////////////// - sprintf(buffer, "%s%s%s%s%s%s", - data->passwordHash, - " ", - user, - data->serverChallenge, - data->userChallenge, - data->passwordHash); - MD5Digest((unsigned char *)buffer, strlen(buffer), check); - - // Get the proof. - ///////////////// - if(!gpiValueForKey(input, "\\proof\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexepected data was received from the server."); - - // Check the server authentication. - /////////////////////////////////// - if(memcmp(check, buffer, 32) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_LOGIN_SERVER_AUTH_FAILED, "Could not authenticate server."); - - // Add the local profile to the list. - ///////////////////////////////////// - if(iconnection->infoCaching) - { - profile = gpiProfileListAdd(connection, iconnection->profileid); - profile->profileId = iconnection->profileid; - profile->userId = iconnection->userid; - } - - // Set the connect state. - ///////////////////////// - iconnection->connectState = GPI_CONNECTED; - - // Call the connect-response callback. - ////////////////////////////////////// - callback = operation->callback; - if(callback.callback != NULL) - { - GPConnectResponseArg * arg; - arg = (GPConnectResponseArg *)gsimalloc(sizeof(GPConnectResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPConnectResponseArg)); - - arg->profile = (GPProfile)iconnection->profileid; - arg->result = GP_NO_ERROR; -#ifndef GSI_UNICODE - strzcpy(arg->uniquenick, uniquenick, GP_UNIQUENICK_LEN); -#else - UTF8ToUCS2StringLen(uniquenick, arg->uniquenick, GP_UNIQUENICK_LEN); -#endif - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - - // This operation is complete. - ////////////////////////////// - gpiRemoveOperation(connection, operation); - - // Get the local profile's info. - //////////////////////////////// -#if 0 - gpiAddOperation(connection, GPI_GET_INFO, NULL, &operation, GP_NON_BLOCKING, NULL, NULL); - gpiSendGetInfo(connection, iconnection->profileid, operation->id); -#endif - - -#ifdef _PS3 - // We just connected, so setup buddy sync && start NP init - // For future, we can limit syncs by setting flags to turn on/off here - ////////////////////////////////////////////////////////////////////// - iconnection->npPerformBuddySync = gsi_true; - iconnection->npPerformBlockSync = gsi_true; - iconnection->loginTime = current_time(); - - if (!iconnection->npInitialized) - gpiInitializeNpBasic(connection); -#endif - - break; - - default: - break; - } - - return GP_NO_ERROR; -} - -GPResult -gpiCheckConnect( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int state; - - // Check if the connection is completed. - //////////////////////////////////////// - CHECK_RESULT(gpiCheckSocketConnect(connection, iconnection->cmSocket, &state)); - - // Check for a failed attempt. - ////////////////////////////// - if(state == GPI_DISCONNECTED) - CallbackFatalError(connection, GP_SERVER_ERROR, GP_LOGIN_CONNECTION_FAILED, "The server has refused the connection."); - - // Check if not finished connecting. - //////////////////////////////////// - if(state == GPI_NOT_CONNECTED) - return GP_NO_ERROR; - - // We're now negotiating the connection. - //////////////////////////////////////// - assert(state == GPI_CONNECTED); - iconnection->connectState = GPI_NEGOTIATING; - - return GP_NO_ERROR; -} - -static GPIBool -gpiDisconnectCleanupProfile( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GSI_UNUSED(data); - - // Even if we cache buddy/block info, free it up to get rid of mem - // leaks, just don't remove the profile until we save the cache. - ////////////////////////////////////////////////////////////////// - if(profile->buddyStatus) - { - profile->buddyOrBlockCache = gsi_true; - freeclear(profile->buddyStatus->statusString); - freeclear(profile->buddyStatus->locationString); - freeclear(profile->buddyStatus); - } - if (profile->buddyStatusInfo) - { - profile->buddyOrBlockCache = gsi_true; - freeclear(profile->buddyStatusInfo->richStatus); - freeclear(profile->buddyStatusInfo->gameType); - freeclear(profile->buddyStatusInfo->gameVariant); - freeclear(profile->buddyStatusInfo->gameMapName); - if (profile->buddyStatusInfo->extendedInfoKeys) - { - ArrayFree(profile->buddyStatusInfo->extendedInfoKeys); - profile->buddyStatusInfo->extendedInfoKeys = NULL; - } - freeclear(profile->buddyStatusInfo); - } - if (profile->blocked) - profile->buddyOrBlockCache = gsi_true; - - freeclear(profile->authSig); - freeclear(profile->peerSig); - profile->requestCount = 0; - - // Remove Profile if: - // (there is no info to cache) or - // (we only cache buddies/blocked and the user is not a buddy or a block) - if ((!profile->cache) || - (iconnection->infoCachingBuddyAndBlockOnly==GPITrue && !profile->buddyOrBlockCache)) - { - gpiRemoveProfile(connection, profile); - return GPIFalse; - } - - return GPITrue; -} - -void -gpiDisconnect( - GPConnection * connection, - GPIBool tellServer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIPeer * peer; - GPIPeer * delPeer; - GPIBool connClosed; - - // Check if we're already disconnected. - // PANTS|05.15.00 - /////////////////////////////////////// - if(iconnection->connectState == GPI_DISCONNECTED) - return; - - // Skip most of this stuff if we never actually connected. - // PANTS|05.16.00 - ////////////////////////////////////////////////////////// - if(iconnection->connectState != GPI_NOT_CONNECTED) - { - // Are we connected? - //////////////////// - if(tellServer && (iconnection->connectState == GPI_CONNECTED)) - { - // Send the disconnect. - /////////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\logout\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - } - - // Always flush remaining messages. - // PANTS|05.16.00 - /////////////////////////////////// - gpiSendFromBuffer(connection, iconnection->cmSocket, &iconnection->outputBuffer, &connClosed, GPITrue, "CM"); - - // Cleanup the connection. - ////////////////////////// - if(iconnection->cmSocket != INVALID_SOCKET) - { - shutdown(iconnection->cmSocket, 2); - closesocket(iconnection->cmSocket); - iconnection->cmSocket = INVALID_SOCKET; - } - - if(/*iconnection->peerSocket != INVALID_SOCKET*/ gsUdpEngineIsInitialized()) - { - //shutdown(iconnection->peerSocket, 2); - //closesocket(iconnection->peerSocket); - //iconnection->peerSocket = INVALID_SOCKET; - gsUdpEngineRemoveMsgHandler(iconnection->mHeader); - if (gsUdpEngineNoMoreMsgHandlers() && gsUdpEngineNoApp()) - gsUdpEngineShutdown(); - } - - // We're disconnected. - ////////////////////// - iconnection->connectState = GPI_DISCONNECTED; - - // Don't keep the userid/profileid. - /////////////////////////////////// - iconnection->userid = 0; - iconnection->profileid = 0; - } - - // freeclear all the memory. - /////////////////////// - freeclear(iconnection->socketBuffer.buffer); - freeclear(iconnection->inputBuffer); - freeclear(iconnection->outputBuffer.buffer); - freeclear(iconnection->updateproBuffer.buffer); - freeclear(iconnection->updateuiBuffer.buffer); - while(iconnection->operationList != NULL) - gpiRemoveOperation(connection, iconnection->operationList); - iconnection->operationList = NULL; - for(peer = iconnection->peerList ; peer != NULL ; ) - { - delPeer = peer; - peer = peer->pnext; - gpiDestroyPeer(connection, delPeer); - } - iconnection->peerList = NULL; - - // Cleanup buddies. - // This is not optimal - because we can't continue the mapping - // after freeing a profile, we need to start it all over again. - /////////////////////////////////////////////////////////////// - while(!gpiProfileMap(connection, gpiDisconnectCleanupProfile, NULL)) { }; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiConnect.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiConnect.h deleted file mode 100644 index b9910bf062f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiConnect.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -gpiConnect.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPICONNECT_H_ -#define _GPICONNECT_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -// Connect States. -////////////////// -#define GPI_NOT_CONNECTED 0 -#define GPI_CONNECTING 1 -#define GPI_NEGOTIATING 2 -#define GPI_CONNECTED 3 -#define GPI_DISCONNECTED 4 -#define GPI_PROFILE_DELETING 5 - -//FUNCTIONS -/////////// -GPResult -gpiConnect( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - const char authtoken[GP_AUTHTOKEN_LEN], - const char partnerchallenge[GP_PARTNERCHALLENGE_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum firewall, - GPIBool newuser, - GPEnum blocking, - GPCallback callback, - void * param -); - -void -gpiDisconnect( - GPConnection * connection, - GPIBool tellServer -); - -GPResult -gpiProcessConnect( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -GPResult -gpiCheckConnect( - GPConnection * connection -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiInfo.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiInfo.c deleted file mode 100644 index 60ae65f00a8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiInfo.c +++ /dev/null @@ -1,1286 +0,0 @@ -/* -gpiInfo.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include "gpi.h" - -//FUNCTIONS -/////////// -static GPIBool -gpiIsValidDate( - int day, - int month, - int year -) -{ - // Check for a blank. - ///////////////////// - if((day == 0) && (month == 0) && (year == 0)) - return GPITrue; - - // Check for negatives. - /////////////////////// - if((day < 0) || (month < 0) || (year < 0)) - return GPIFalse; - - // Validate the day of the month. - ///////////////////////////////// - switch(month) - { - // No month. - //////////// - case 0: - // Can't specify a day without a month. - /////////////////////////////////////// - if(day != 0) - return GPIFalse; - break; - - // 31-day month. - //////////////// - case 1: - case 3: - case 5: - case 7: - case 8: - case 10: - case 12: - if(day > 31) - return GPIFalse; - break; - - // 30-day month. - //////////////// - case 4: - case 6: - case 9: - case 11: - if(day > 30) - return GPIFalse; - break; - - // 28/29-day month. - /////////////////// - case 2: - // Leap year? - ///////////// - if((((year % 4) == 0) && ((year % 100) != 0)) || ((year % 400) == 0)) - { - if(day > 29) - return GPIFalse; - } - else - { - if(day > 28) - return GPIFalse; - } - break; - - // Invalid month. - ///////////////// - default: - return GPIFalse; - } - - // Check that the date is in the valid range. - // 01.01.1900 - 06.06.2079 - // PANTS|02.14.2000 - ///////////////////////////////////////////// - if(year < 1900) - return GPIFalse; - if(year > 2079) - return GPIFalse; - if(year == 2079) - { - if(month > 6) - return GPIFalse; - if((month == 6) && (day > 6)) - return GPIFalse; - } - - return GPITrue; -} - -static GPResult -gpiDateToInt( - GPConnection * connection, - int * date, - int day, - int month, - int year -) -{ - int temp; - - // Pack the day/month/year into an int. - // 31-22: day - // 23-16: month - // 15-00: year - /////////////////////////////////////// - - // Error check. - /////////////// - assert(gpiIsValidDate(day, month, year)); - if(!gpiIsValidDate(day, month, year)) - Error(connection, GP_PARAMETER_ERROR, "Invalid date."); - - // Pack! - //////// - temp = 0; - temp |= (day << 24); - temp |= (month << 16); - temp |= year; - - // Set it. - ////////// - *date = temp; - - return GP_NO_ERROR; -} - -static GPResult -gpiIntToDate( - GPConnection * connection, - int date, - int * day, - int * month, - int * year -) -{ - int d; - int m; - int y; - - // Unpack the int into a day/month/year. - // 31-22: day - // 23-16: month - // 15-00: year - //////////////////////////////////////// - - // Split up the date. - ///////////////////// - d = ((date >> 24) & 0xFF); - m = ((date >> 16) & 0xFF); - y = (date & 0xFFFF); - - // Error check. - /////////////// - assert(gpiIsValidDate(d, m, y)); - if(!gpiIsValidDate(d, m, y)) - Error(connection, GP_PARAMETER_ERROR, "Invalid date."); - - // It's all good. - ///////////////// - *day = d; - *month = m; - *year = y; - - return GP_NO_ERROR; -} - -void -gpiInfoCacheToArg( - const GPIInfoCache * cache, - GPGetInfoResponseArg * arg -) -{ -#ifndef GSI_UNICODE - // Copy.... - /////////// - if(cache->nick) - strzcpy(arg->nick, cache->nick, GP_NICK_LEN); - else - arg->nick[0] = '\0'; - if(cache->uniquenick) - strzcpy(arg->uniquenick, cache->uniquenick, GP_UNIQUENICK_LEN); - else - arg->uniquenick[0] = '\0'; - if(cache->email) - strzcpy(arg->email, cache->email, GP_EMAIL_LEN); - else - arg->email[0] = '\0'; - if(cache->firstname) - strzcpy(arg->firstname, cache->firstname, GP_FIRSTNAME_LEN); - else - arg->firstname[0] = '\0'; - if(cache->lastname) - strzcpy(arg->lastname, cache->lastname, GP_LASTNAME_LEN); - else - arg->lastname[0] = '\0'; - if(cache->homepage) - strzcpy(arg->homepage, cache->homepage, GP_HOMEPAGE_LEN); - else - arg->homepage[0] = '\0'; - arg->icquin = cache->icquin; - strzcpy(arg->zipcode, cache->zipcode, GP_ZIPCODE_LEN); - strzcpy(arg->countrycode, cache->countrycode, GP_COUNTRYCODE_LEN); - arg->longitude = cache->longitude; - arg->latitude = cache->latitude; - if(cache->place) - strzcpy(arg->place, cache->place, GP_PLACE_LEN); - else - arg->place[0] = '\0'; - arg->birthday = cache->birthday; - arg->birthmonth = cache->birthmonth; - arg->birthyear = cache->birthyear; - arg->sex = (GPEnum)cache->sex; - arg->publicmask = (GPEnum)cache->publicmask; - if(cache->aimname) - strzcpy(arg->aimname, cache->aimname, GP_AIMNAME_LEN); - else - arg->aimname[0] = '\0'; -#else - // Copy.... - /////////// - if(cache->nick) - UTF8ToUCS2StringLen(cache->nick, arg->nick, GP_NICK_LEN); - else - arg->nick[0] = '\0'; - if(cache->uniquenick) - UTF8ToUCS2StringLen(cache->uniquenick, arg->uniquenick, GP_UNIQUENICK_LEN); - else - arg->uniquenick[0] = '\0'; - if(cache->email) - UTF8ToUCS2StringLen(cache->email, arg->email, GP_EMAIL_LEN); - else - arg->email[0] = '\0'; - if(cache->firstname) - UTF8ToUCS2StringLen(cache->firstname, arg->firstname, GP_FIRSTNAME_LEN); - else - arg->firstname[0] = '\0'; - if(cache->lastname) - UTF8ToUCS2StringLen(cache->lastname, arg->lastname, GP_LASTNAME_LEN); - else - arg->lastname[0] = '\0'; - if(cache->homepage) - UTF8ToUCS2StringLen(cache->homepage, arg->homepage, GP_HOMEPAGE_LEN); - else - arg->homepage[0] = '\0'; - UTF8ToUCS2StringLen(cache->zipcode, arg->zipcode, GP_ZIPCODE_LEN); - UTF8ToUCS2StringLen(cache->countrycode, arg->countrycode, GP_COUNTRYCODE_LEN); - if(cache->place) - UTF8ToUCS2StringLen(cache->place, arg->place, GP_PLACE_LEN); - else - arg->place[0] = '\0'; - if(cache->aimname) - UTF8ToUCS2StringLen(cache->aimname, arg->aimname, GP_AIMNAME_LEN); - else - arg->aimname[0] = '\0'; -#endif - - // Non string members - arg->icquin = cache->icquin; - arg->longitude = cache->longitude; - arg->latitude = cache->latitude; - - arg->birthday = cache->birthday; - arg->birthmonth = cache->birthmonth; - arg->birthyear = cache->birthyear; - arg->sex = (GPEnum)cache->sex; - arg->publicmask = (GPEnum)cache->publicmask; - - arg->pic = cache->pic; - arg->occupationid = cache->occupationid; - arg->industryid = cache->industryid; - arg->incomeid = cache->incomeid; - arg->marriedid = cache->marriedid; - arg->childcount = cache->childcount; - arg->interests1 = cache->interests1; - arg->ownership1 = cache->ownership1; - arg->conntypeid = cache->conntypeid; -} - -GPResult -gpiProcessGetInfo( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - GPIInfoCache infoCache; - char buffer[64]; - int profileid; - GPIProfile * profile; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPICallback callback; - GPIPeer * peer; - char nick[GP_NICK_LEN]; - char uniquenick[GP_UNIQUENICK_LEN]; - char email[GP_EMAIL_LEN]; - char firstname[GP_FIRSTNAME_LEN]; - char lastname[GP_LASTNAME_LEN]; - char homepage[GP_HOMEPAGE_LEN]; - char aimname[GP_AIMNAME_LEN]; - GPIBool saveSig; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // This should be \pi\. - /////////////////////// - if(strncmp(input, "\\pi\\", 4) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the profile id. - ////////////////////// - if(!gpiValueForKey(input, "\\profileid\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - profileid = atoi(buffer); - assert(profileid > 0); - - // Get the profile - we might not have a profile object. - //////////////////////////////////////////////////////// - gpiGetProfile(connection, (GPProfile)profileid, &profile); - - // Setup the info cache. - //////////////////////// - memset(&infoCache, 0, sizeof(GPIInfoCache)); - infoCache.nick = nick; - infoCache.uniquenick = uniquenick; - infoCache.email = email; - infoCache.firstname = firstname; - infoCache.lastname = lastname; - infoCache.homepage = homepage; - infoCache.aimname = aimname; - - // Parse the info. - ////////////////// - if(!gpiValueForKey(input, "\\nick\\", infoCache.nick, GP_NICK_LEN)) - infoCache.nick[0] = '\0'; - if(!gpiValueForKey(input, "\\uniquenick\\", infoCache.uniquenick, GP_UNIQUENICK_LEN)) - infoCache.uniquenick[0] = '\0'; - if(!gpiValueForKey(input, "\\email\\", infoCache.email, GP_EMAIL_LEN)) - infoCache.email[0] = '\0'; - if(!gpiValueForKey(input, "\\firstname\\", infoCache.firstname, GP_FIRSTNAME_LEN)) - infoCache.firstname[0] = '\0'; - if(!gpiValueForKey(input, "\\lastname\\", infoCache.lastname, GP_LASTNAME_LEN)) - infoCache.lastname[0] = '\0'; - if(!gpiValueForKey(input, "\\icquin\\", buffer, sizeof(buffer))) - infoCache.icquin = -1; - else - infoCache.icquin = atoi(buffer); - if(!gpiValueForKey(input, "\\homepage\\", infoCache.homepage, GP_HOMEPAGE_LEN)) - infoCache.homepage[0] = '\0'; - if(!gpiValueForKey(input, "\\zipcode\\", infoCache.zipcode, sizeof(infoCache.zipcode))) - infoCache.zipcode[0] = '\0'; - if(!gpiValueForKey(input, "\\countrycode\\", infoCache.countrycode, sizeof(infoCache.countrycode))) - infoCache.countrycode[0] = '\0'; - if(!gpiValueForKey(input, "\\lon\\", buffer, sizeof(buffer))) - infoCache.longitude = 0; - else - infoCache.longitude = (float)atof(buffer); - if(!gpiValueForKey(input, "\\lat\\", buffer, sizeof(buffer))) - infoCache.latitude = 0; - else - infoCache.latitude = (float)atof(buffer); - if(!gpiValueForKey(input, "\\loc\\", infoCache.place, GP_PLACE_LEN)) - infoCache.place[0] = '\0'; - if(!gpiValueForKey(input, "\\birthday\\", buffer, sizeof(buffer))) - { - infoCache.birthday = 0; - infoCache.birthmonth = 0; - infoCache.birthyear = 0; - } - else - { - CHECK_RESULT(gpiIntToDate(connection, atoi(buffer), &infoCache.birthday, &infoCache.birthmonth, &infoCache.birthyear)); - } - if(!gpiValueForKey(input, "\\sex\\", buffer, sizeof(buffer))) - infoCache.sex = GP_PAT; - else if(buffer[0] == '0') - infoCache.sex = GP_MALE; - else if(buffer[0] == '1') - infoCache.sex = GP_FEMALE; - else - infoCache.sex = GP_PAT; - if(!gpiValueForKey(input, "\\pmask\\", buffer, sizeof(buffer))) - infoCache.publicmask = 0xFFFFFFFF; - else - infoCache.publicmask = atoi(buffer); - if(!gpiValueForKey(input, "\\aim\\", infoCache.aimname, GP_AIMNAME_LEN)) - infoCache.aimname[0] = '\0'; - if(!gpiValueForKey(input, "\\pic\\", buffer, sizeof(buffer))) - infoCache.pic = 0; - else - infoCache.pic = atoi(buffer); - if(!gpiValueForKey(input, "\\occ\\", buffer, sizeof(buffer))) - infoCache.occupationid = 0; - else - infoCache.occupationid = atoi(buffer); - if(!gpiValueForKey(input, "\\ind\\", buffer, sizeof(buffer))) - infoCache.industryid = 0; - else - infoCache.industryid = atoi(buffer); - if(!gpiValueForKey(input, "\\inc\\", buffer, sizeof(buffer))) - infoCache.incomeid = 0; - else - infoCache.incomeid = atoi(buffer); - if(!gpiValueForKey(input, "\\mar\\", buffer, sizeof(buffer))) - infoCache.marriedid = 0; - else - infoCache.marriedid = atoi(buffer); - if(!gpiValueForKey(input, "\\chc\\", buffer, sizeof(buffer))) - infoCache.childcount = 0; - else - infoCache.childcount = atoi(buffer); - if(!gpiValueForKey(input, "\\i1\\", buffer, sizeof(buffer))) - infoCache.interests1 = 0; - else - infoCache.interests1 = atoi(buffer); - if(!gpiValueForKey(input, "\\o1\\", buffer, sizeof(buffer))) - infoCache.ownership1 = 0; - else - infoCache.ownership1 = atoi(buffer); - if(!gpiValueForKey(input, "\\conn\\", buffer, sizeof(buffer))) - infoCache.conntypeid = 0; - else - infoCache.conntypeid = atoi(buffer); - - // Get the peer sig. - //////////////////// - if(!gpiValueForKey(input, "\\sig\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - saveSig = iconnection->infoCaching; - - // Is there a pending peer connection looking for a sig? - //////////////////////////////////////////////////////// - for(peer = iconnection->peerList ; peer != NULL ; peer = peer->pnext) - { - // Is it the same profile? - ////////////////////////// - if(peer->profile == profileid) - { - // Is it getting the sig? - ///////////////////////// - if(peer->state == GPI_PEER_GETTING_SIG) - { - // We need to make sure there's an actual profile object. - ///////////////////////////////////////////////////////// - if(!profile) - profile = gpiProfileListAdd(connection, profileid); - - // It got it. - ///////////// - peer->state = GPI_PEER_GOT_SIG; - - saveSig = GPITrue; - } - } - } - - // Cache info? - ////////////// - if(!profile && iconnection->infoCaching) - profile = gpiProfileListAdd(connection, profileid); - - // Set the peer sig. - //////////////////// - if(saveSig) - { - freeclear(profile->peerSig); - profile->peerSig = goastrdup(buffer); - } - - // Caching info? - //////////////// - if(iconnection->infoCaching) - gpiSetInfoCache(connection, profile, &infoCache); - - // Call the callback. - ///////////////////// - callback = operation->callback; - if(callback.callback != NULL) - { - GPGetInfoResponseArg * arg; - arg = (GPGetInfoResponseArg *)gsimalloc(sizeof(GPGetInfoResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - gpiInfoCacheToArg(&infoCache, arg); - arg->result = GP_NO_ERROR; - arg->profile = (GPProfile)profileid; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - - // This operation is complete. - ////////////////////////////// - gpiRemoveOperation(connection, operation); - - return GP_NO_ERROR; -} - -GPResult -gpiAddLocalInfo( - GPConnection * connection, - GPIBuffer * buffer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Add updatepro info. - ////////////////////// - if(iconnection->updateproBuffer.len > 0) - { - gpiAppendStringToBuffer(connection, buffer, "\\updatepro\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, buffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, buffer, iconnection->updateproBuffer.buffer); - gpiAppendStringToBuffer(connection, buffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, buffer, iconnection->partnerID); - gpiAppendStringToBuffer(connection, buffer, "\\final\\"); - - iconnection->updateproBuffer.len = 0; - } - - // Add updateui info. - ////////////////////// - if(iconnection->updateuiBuffer.len > 0) - { - gpiAppendStringToBuffer(connection, buffer, "\\updateui\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, buffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, buffer, iconnection->updateuiBuffer.buffer); - gpiAppendStringToBuffer(connection, buffer, "\\final\\"); - - iconnection->updateuiBuffer.len = 0; - } - - return GP_NO_ERROR; -} - -static GPResult -gpiSendLocalInfo( - GPConnection * connection, - const char * info, - const char * value -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - CHECK_RESULT(gpiAppendStringToBuffer(connection, &iconnection->updateproBuffer, info)); - CHECK_RESULT(gpiAppendStringToBuffer(connection, &iconnection->updateproBuffer, value)); - - return GP_NO_ERROR; -} - -static GPResult -gpiSendUserInfo( - GPConnection * connection, - const char * info, - const char * value -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - CHECK_RESULT(gpiAppendStringToBuffer(connection, &iconnection->updateuiBuffer, info)); - CHECK_RESULT(gpiAppendStringToBuffer(connection, &iconnection->updateuiBuffer, value)); - - return GP_NO_ERROR; -} - -GPResult -gpiSetInfoi( - GPConnection * connection, - GPEnum info, - int value -) -{ - char intValue[16]; - - // Check the info param. - //////////////////////// - switch(info) - { - case GP_ZIPCODE: - // Error check. - /////////////// - if(value < 0) - Error(connection, GP_PARAMETER_ERROR, "Invalid zipcode."); - - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\zipcode\\", intValue)); - - break; - - case GP_SEX: - // Check the sex type. - ////////////////////// - switch(value) - { - case GP_MALE: - CHECK_RESULT(gpiSendLocalInfo(connection, "\\sex\\", "0")); - break; - - case GP_FEMALE: - CHECK_RESULT(gpiSendLocalInfo(connection, "\\sex\\", "1")); - break; - - case GP_PAT: - CHECK_RESULT(gpiSendLocalInfo(connection, "\\sex\\", "2")); - break; - - default: - Error(connection, GP_PARAMETER_ERROR, "Invalid sex."); - } - - break; - - case GP_ICQUIN: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\icquin\\", intValue)); - - break; - - case GP_CPUBRANDID: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\cpubrandid\\", intValue)); - - break; - - case GP_CPUSPEED: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\cpuspeed\\", intValue)); - - break; - - case GP_MEMORY: - // Divide by 16. - //////////////// - value /= 16; - - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\memory\\", intValue)); - - break; - - case GP_VIDEOCARD1RAM: - // Divide by 4. - /////////////// - value /= 4; - - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\videocard1ram\\", intValue)); - - break; - - case GP_VIDEOCARD2RAM: - // Divide by 4. - /////////////// - value /= 4; - - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\videocard2ram\\", intValue)); - - break; - - case GP_CONNECTIONID: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\connectionid\\", intValue)); - - break; - - case GP_CONNECTIONSPEED: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\connectionspeed\\", intValue)); - - break; - - case GP_HASNETWORK: - // A boolean. - ///////////// - if(value) - value = 1; - - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendUserInfo(connection, "\\hasnetwork\\", intValue)); - - break; - - case GP_PIC: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\pic\\", intValue)); - - break; - - case GP_OCCUPATIONID: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\occ\\", intValue)); - - break; - - case GP_INDUSTRYID: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\ind\\", intValue)); - - break; - - case GP_INCOMEID: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\inc\\", intValue)); - - break; - - case GP_MARRIEDID: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\mar\\", intValue)); - - break; - - case GP_CHILDCOUNT: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\chc\\", intValue)); - - break; - - case GP_INTERESTS1: - // Convert it to a string. - ////////////////////////// - sprintf(intValue,"%d",value); - - // Send it to the server. - ///////////////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\i1\\", intValue)); - - break; - - default: - Error(connection, GP_PARAMETER_ERROR, "Invalid info."); - } - - return GP_NO_ERROR; -} - -GPResult -gpiSetInfos( - GPConnection * connection, - GPEnum info, - const char * value -) -{ - - GPIConnection * iconnection = (GPIConnection*)*connection; - char buffer[256]; - char sex; - - //password encryption stuff - char passwordenc[GP_PASSWORDENC_LEN]; - - // Error check. - /////////////// - if(value == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid value."); - - // Check the info param. - //////////////////////// - switch(info) - { - case GP_NICK: - if(!value[0]) - Error(connection, GP_PARAMETER_ERROR, "Invalid value."); - strzcpy(buffer, value, GP_NICK_LEN); - strzcpy(iconnection->nick, buffer, GP_NICK_LEN); -#ifdef GSI_UNICODE - UTF8ToUCS2StringLen(iconnection->nick, iconnection->nick_W, GP_NICK_LEN); // update the UCS2 version -#endif - CHECK_RESULT(gpiSendLocalInfo(connection, "\\nick\\", buffer)); - break; - - case GP_UNIQUENICK: - if(!value[0]) - Error(connection, GP_PARAMETER_ERROR, "Invalid value."); - strzcpy(buffer, value, GP_UNIQUENICK_LEN); - strzcpy(iconnection->uniquenick, buffer, GP_UNIQUENICK_LEN); -#ifdef GSI_UNICODE - UTF8ToUCS2StringLen(iconnection->uniquenick, iconnection->uniquenick_W, GP_UNIQUENICK_LEN); -#endif - CHECK_RESULT(gpiSendLocalInfo(connection, "\\uniquenick\\", buffer)); - break; - - case GP_EMAIL: - if(!value[0]) - Error(connection, GP_PARAMETER_ERROR, "Invalid value."); - strzcpy(buffer, value, GP_EMAIL_LEN); - _strlwr(buffer); - strzcpy(iconnection->email, buffer, GP_EMAIL_LEN); -#ifdef GSI_UNICODE - UTF8ToUCS2StringLen(iconnection->email, iconnection->email_W, GP_EMAIL_LEN); -#endif - CHECK_RESULT(gpiSendUserInfo(connection, "\\email\\", buffer)); - break; - - case GP_PASSWORD: - if(!value[0]) - Error(connection, GP_PARAMETER_ERROR, "Invalid value."); - strzcpy(buffer, value, GP_PASSWORD_LEN); - strzcpy(iconnection->password, buffer, GP_PASSWORD_LEN); -#ifdef GSI_UNICODE - UTF8ToUCS2StringLen(iconnection->password, iconnection->password_W, GP_PASSWORD_LEN); -#endif - gpiEncodeString(iconnection->password, passwordenc); - CHECK_RESULT(gpiSendUserInfo(connection, "\\passwordenc\\", passwordenc)); - break; - - case GP_FIRSTNAME: - strzcpy(buffer, value, GP_FIRSTNAME_LEN); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\firstname\\", buffer)); - break; - - case GP_LASTNAME: - strzcpy(buffer, value, GP_LASTNAME_LEN); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\lastname\\", buffer)); - break; - - case GP_HOMEPAGE: - strzcpy(buffer, value, GP_HOMEPAGE_LEN); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\homepage\\", buffer)); - break; - - case GP_ZIPCODE: - strzcpy(buffer, value, GP_ZIPCODE_LEN); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\zipcode\\", buffer)); - break; - - case GP_COUNTRYCODE: - // Error check. - /////////////// - if(strlen(value) != 2) - Error(connection, GP_PARAMETER_ERROR, "Invalid countrycode."); - - strzcpy(buffer, value, GP_COUNTRYCODE_LEN); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\countrycode\\", buffer)); - break; - - case GP_SEX: - sex = (char)toupper(value[0]); - if(sex == 'M') - strcpy(buffer, "0"); - else if(sex == 'F') - strcpy(buffer, "1"); - else - strcpy(buffer, "2"); - - CHECK_RESULT(gpiSendLocalInfo(connection, "\\sex\\", buffer)); - break; - - case GP_ICQUIN: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\icquin\\", buffer)); - break; - - case GP_CPUSPEED: - CHECK_RESULT(gpiSetInfoi(connection, GP_CPUSPEED, atoi(value))); - break; - - case GP_MEMORY: - CHECK_RESULT(gpiSetInfoi(connection, GP_MEMORY, atoi(value))); - break; - - case GP_VIDEOCARD1STRING: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\videocard1string\\", buffer)); - break; - - case GP_VIDEOCARD1RAM: - CHECK_RESULT(gpiSetInfoi(connection, GP_VIDEOCARD1RAM, atoi(value))); - break; - - case GP_VIDEOCARD2STRING: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\videocard2string\\", buffer)); - break; - - case GP_VIDEOCARD2RAM: - CHECK_RESULT(gpiSetInfoi(connection, GP_VIDEOCARD2RAM, atoi(value))); - break; - - case GP_CONNECTIONSPEED: - CHECK_RESULT(gpiSetInfoi(connection, GP_CONNECTIONSPEED, atoi(value))); - break; - - case GP_HASNETWORK: - CHECK_RESULT(gpiSetInfoi(connection, GP_HASNETWORK, atoi(value))); - break; - - case GP_OSSTRING: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\osstring\\", buffer)); - break; - - case GP_AIMNAME: - strzcpy(buffer, value, GP_AIMNAME_LEN); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\aim\\", buffer)); - break; - - case GP_PIC: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\pic\\", buffer)); - break; - - case GP_OCCUPATIONID: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\occ\\", buffer)); - break; - - case GP_INDUSTRYID: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\ind\\", buffer)); - break; - - case GP_INCOMEID: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\inc\\", buffer)); - break; - - case GP_MARRIEDID: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\mar\\", buffer)); - break; - - case GP_CHILDCOUNT: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\chc\\", buffer)); - break; - - case GP_INTERESTS1: - strzcpy(buffer, value, sizeof(buffer)); - CHECK_RESULT(gpiSendLocalInfo(connection, "\\i1\\", buffer)); - break; - - default: - Error(connection, GP_PARAMETER_ERROR, "Invalid info."); - } - - return GP_NO_ERROR; -} - -GPResult -gpiSetInfod( - GPConnection * connection, - GPEnum info, - int day, - int month, - int year -) -{ - int date; - char intValue[16]; - - // Birthday is the only date supported. - /////////////////////////////////////// - if(info != GP_BIRTHDAY) - Error(connection, GP_PARAMETER_ERROR, "Invalid info."); - - // Convert the date into our internal format. - ///////////////////////////////////////////// - CHECK_RESULT(gpiDateToInt(connection, &date, day, month, year)); - - // Convert the int to a string. - /////////////////////////////// - sprintf(intValue,"%d",date); - - // Send the date. - ///////////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\birthday\\", intValue)); - - return GP_NO_ERROR; -} - -GPResult -gpiSetInfoMask( - GPConnection * connection, - GPEnum mask -) -{ - char buffer[16]; - - // Convert the mask to a string. - //////////////////////////////// - sprintf(buffer,"%d",mask); - - // Send it. - /////////// - CHECK_RESULT(gpiSendLocalInfo(connection, "\\publicmask\\", buffer)); - - return GP_NO_ERROR; - -} - -GPResult -gpiSendGetInfo( - GPConnection * connection, - int profileid, - int operationid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\getprofile\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profileid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, operationid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult -gpiGetInfo( - GPConnection * connection, - GPProfile profile, - GPEnum checkCache, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIOperation * operation = NULL; - GPIBool useCache; - GPResult result; - int id; - - // Check checkCache. - //////////////////// - useCache = (checkCache == GP_CHECK_CACHE) ? GPITrue:GPIFalse; - - // Check the info cache state. - ////////////////////////////// - if(!iconnection->infoCaching) - useCache = GPIFalse; - - // Check for using cached info. - /////////////////////////////// - if(callback && useCache && gpiGetProfile(connection, profile, &pProfile) && pProfile->cache) - { - GPICallback gpiCallback; - GPGetInfoResponseArg * arg; - - arg = (GPGetInfoResponseArg *)gsimalloc(sizeof(GPGetInfoResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - gpiInfoCacheToArg(pProfile->cache, arg); - arg->result = GP_NO_ERROR; - arg->profile = profile; - - gpiCallback.callback = callback; - gpiCallback.param = param; - - // Add a dummy operation. - ///////////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_GET_INFO, NULL, &operation, GP_BLOCKING, callback, param)); - id = operation->id; - - // Add the callback. - //////////////////// - CHECK_RESULT(gpiAddCallback(connection, gpiCallback, arg, operation, 0)); - - // Remove the dummy operation. - ////////////////////////////// - gpiRemoveOperation(connection, operation); - } - else - { - // Add the operation. - ///////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_GET_INFO, NULL, &operation, blocking, callback, param)); - id = operation->id; - - // Send a request for info. - /////////////////////////// - result = gpiSendGetInfo(connection, profile, operation->id); - CHECK_RESULT(result); - } - - // Process it if blocking. - ////////////////////////// - if(blocking) - { - result = gpiProcess(connection, id); - CHECK_RESULT(result); - } - - return GP_NO_ERROR; -} - -GPResult -gpiGetInfoNoWait( - GPConnection * connection, - GPProfile profile, - GPGetInfoResponseArg * arg -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Check the info cache state. - ////////////////////////////// - if(!iconnection->infoCaching) - return GP_NETWORK_ERROR; - - // Check to see if we have the info cached. - /////////////////////////////////////////// - if(!gpiGetProfile(connection, profile, &pProfile) || !pProfile->cache) - return GP_NETWORK_ERROR; - - // Fill in the arg. - /////////////////// - gpiInfoCacheToArg(pProfile->cache, arg); - arg->result = GP_NO_ERROR; - arg->profile = profile; - - return GP_NO_ERROR; -} - -GPIBool -gpiSetInfoCache( - GPConnection * connection, - pGPIProfile profile, - const GPIInfoCache * cache -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Check if we're caching info. - /////////////////////////////// - if(!iconnection->infoCaching) - return GPITrue; - - // Free any old cached info. - //////////////////////////// - gpiFreeInfoCache(profile); - - // Allocate the new info. - ///////////////////////// - profile->cache = (GPIInfoCache *)gsimalloc(sizeof(GPIInfoCache)); - - // Copy in the new info. - //////////////////////// - if(profile->cache) - { - *profile->cache = *cache; - profile->cache->nick = goastrdup(cache->nick); - profile->cache->uniquenick = goastrdup(cache->uniquenick); - profile->cache->email = goastrdup(cache->email); - profile->cache->firstname = goastrdup(cache->firstname); - profile->cache->lastname = goastrdup(cache->lastname); - profile->cache->homepage = goastrdup(cache->homepage); - profile->cache->aimname = goastrdup(cache->aimname); - } - - return (profile->cache != NULL) ? GPITrue:GPIFalse; -} - -void -gpiFreeInfoCache( - pGPIProfile profile -) -{ - if(!profile->cache) - return; - - freeclear(profile->cache->nick); - freeclear(profile->cache->uniquenick); - freeclear(profile->cache->email); - freeclear(profile->cache->firstname); - freeclear(profile->cache->lastname); - freeclear(profile->cache->homepage); - freeclear(profile->cache->aimname); - freeclear(profile->cache); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiInfo.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiInfo.h deleted file mode 100644 index 79fe4bbcf52..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiInfo.h +++ /dev/null @@ -1,144 +0,0 @@ -/* -gpiInfo.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIINFO_H_ -#define _GPIINFO_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//TYPES -/////// -// Profile info cache. -////////////////////// -typedef struct -{ - char * nick; - char * uniquenick; - char * email; - char * firstname; - char * lastname; - char * homepage; - int icquin; - char zipcode[GP_ZIPCODE_LEN]; - char countrycode[GP_COUNTRYCODE_LEN]; - float longitude; // negative is west, positive is east. (0, 0) means unknown. - float latitude; // negative is south, positive is north. (0, 0) means unknown. - char place[GP_PLACE_LEN]; // e.g., "USA|California|Irvine", "South Korea|Seoul", "Turkey" - int birthday; - int birthmonth; - int birthyear; - GPEnum sex; - int publicmask; - char * aimname; - int pic; - int occupationid; - int industryid; - int incomeid; - int marriedid; - int childcount; - int interests1; - int ownership1; - int conntypeid; -} GPIInfoCache; - -//FUNCTIONS -/////////// -GPResult -gpiSetInfoi( - GPConnection * connection, - GPEnum info, - int value -); - -GPResult -gpiSetInfos( - GPConnection * connection, - GPEnum info, - const char * value -); - -GPResult -gpiSetInfod( - GPConnection * connection, - GPEnum info, - int day, - int month, - int year -); - -GPResult -gpiSetInfoMask( - GPConnection * connection, - GPEnum mask -); - -void -gpiInfoCacheToArg( - const GPIInfoCache * cache, - GPGetInfoResponseArg * arg -); - -GPResult -gpiGetInfo( - GPConnection * connection, - GPProfile profile, - GPEnum checkCache, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult -gpiGetInfoNoWait( - GPConnection * connection, - GPProfile profile, - GPGetInfoResponseArg * arg -); - -GPResult -gpiProcessGetInfo( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -GPResult -gpiSendGetInfo( - GPConnection * connection, - int profileid, - int operationid -); - -GPResult -gpiAddLocalInfo( - GPConnection * connection, - GPIBuffer * buffer -); - -typedef struct GPIProfile *pGPIProfile; - -GPIBool -gpiSetInfoCache( - GPConnection * connection, - pGPIProfile profile, - const GPIInfoCache * cache -); - -void -gpiFreeInfoCache( - pGPIProfile profile -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiKeys.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiKeys.c deleted file mode 100644 index 009259a2a0e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiKeys.c +++ /dev/null @@ -1,196 +0,0 @@ -#include "gpi.h" - -void gpiStatusInfoKeyFree(void *element) -{ - GPIKey *aKey = (GPIKey *)element; - freeclear(aKey->keyName); - freeclear(aKey->keyValue); -} - -GPResult gpiStatusInfoKeysInit(GPConnection * connection) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - iconnection->extendedInfoKeys = ArrayNew(sizeof(GPIKey), GPI_INITIAL_NUM_KEYS, gpiStatusInfoKeyFree); - if(!iconnection->extendedInfoKeys) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - return GP_NO_ERROR; -} - -void gpiStatusInfoKeysDestroy(GPConnection * connection) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - if (iconnection->extendedInfoKeys) - { - ArrayFree(iconnection->extendedInfoKeys); - iconnection->extendedInfoKeys = NULL; - } -} - -int gpiStatusInfoKeyCompFunc(const void *elem1, const void *elem2) -{ - GPIKey *key1 = (GPIKey *)elem1, - *key2 = (GPIKey *)elem2; - return strcmp(key1->keyName, key2->keyName); -} - -GPResult gpiStatusInfoAddKey(GPConnection *connection, DArray keys, const char *theKeyName, const char *theKeyValue) -{ - GPIKey aKey; - GS_ASSERT(keys); - GS_ASSERT(theKeyName); - GS_ASSERT(theKeyValue); - - if (!theKeyName) - Error(connection, GP_PARAMETER_ERROR, "Invalid key name"); - if (!theKeyValue) - Error(connection, GP_PARAMETER_ERROR, "Invalid key value"); - - aKey.keyName = goastrdup(theKeyName); - aKey.keyValue = goastrdup(theKeyValue); - - ArrayInsertSorted(keys, &aKey, gpiStatusInfoKeyCompFunc); - - return GP_NO_ERROR; -} - -GPResult gpiStatusInfoDelKey(GPConnection *connection, DArray keys, const char *keyName) -{ - GPIKey aKey; - int anIndex; - GS_ASSERT(keys); - GS_ASSERT(keyName); - - if (!keyName) - Error(connection, GP_PARAMETER_ERROR, "Invalid key name"); - - aKey.keyName = goastrdup(keyName); - anIndex = ArraySearch(keys, &aKey, gpiStatusInfoKeyCompFunc, 0, 1); - if (anIndex != NOT_FOUND) - { - ArrayDeleteAt(keys, anIndex); - } - - freeclear(aKey.keyName); - return GP_NO_ERROR; -} - -GPResult gpiStatusInfoSetKey(GPConnection *connection, DArray keys, const char *keyName, const char *newKeyValue) -{ - GPIKey aKey; - int anIndex; - GS_ASSERT(keys); - GS_ASSERT(keyName); - - if (!keyName) - Error(connection, GP_PARAMETER_ERROR, "Invalid key name"); - - aKey.keyName = goastrdup(keyName); - anIndex = ArraySearch(keys, &aKey, gpiStatusInfoKeyCompFunc, 0, 1); - if (anIndex != NOT_FOUND) - { - GPIKey *aKeyFound = (GPIKey *)ArrayNth(keys, anIndex); - gsifree(aKeyFound->keyValue); - aKeyFound->keyValue = goastrdup(newKeyValue); - } - freeclear(aKey.keyName); - return GP_NO_ERROR; -} - -GPResult gpiStatusInfoGetKey(GPConnection *connection, DArray keys, const char *keyName, char **keyValue) -{ - GPIKey aKey; - int anIndex; - GS_ASSERT(keys); - GS_ASSERT(keyName); - - if (!keyName) - Error(connection, GP_PARAMETER_ERROR, "Invalid key name"); - - aKey.keyName = goastrdup(keyName); - anIndex = ArraySearch(keys, &aKey, gpiStatusInfoKeyCompFunc, 0, 1); - if (anIndex != NOT_FOUND) - { - GPIKey *aKeyFound = (GPIKey *)ArrayNth(keys, anIndex); - *keyValue = goastrdup(aKeyFound->keyValue); - } - freeclear(aKey.keyName); - return GP_NO_ERROR; -} - -GPResult gpiStatusInfoCheckKey(GPConnection *connection, DArray keys, const char *keyName, char **keyValue) -{ - GPIKey aKey; - int anIndex; - GS_ASSERT(keys); - GS_ASSERT(keyName); - - if (!keyName) - Error(connection, GP_PARAMETER_ERROR, "Invalid key name"); - - aKey.keyName = goastrdup(keyName); - anIndex = ArraySearch(keys, &aKey, gpiStatusInfoKeyCompFunc, 0, 1); - if (anIndex != NOT_FOUND) - { - GPIKey *aKeyFound = (GPIKey *)ArrayNth(keys, anIndex); - *keyValue = aKeyFound->keyValue; - } - freeclear(aKey.keyName); - return GP_NO_ERROR; -} - -GPResult gpiSaveKeysToBuffer(GPConnection *connection, char **buffer) -{ - GPIConnection *iconnection = (GPIConnection *)*connection; - char *tempPoint; - int sizeKeys = 0, i, bytesWritten; - int base64KeyNameLen, base64KeyValLen; - int aLength = ArrayLength(iconnection->extendedInfoKeys); - - char keysHeader[64]; - sprintf(keysHeader, "\\keys\\%d", aLength); - - // figure out the size of the buffer to allocate - // by adding up the key value pairs with backslashes - for (i = 0; i < aLength; i++) - { - GPIKey *aKey = (GPIKey *)ArrayNth(iconnection->extendedInfoKeys, i); - if (strlen(aKey->keyName) % 3 != 0) - base64KeyNameLen = (int)(strlen(aKey->keyName) * 4 / 3) + (int)(4 - (strlen(aKey->keyName) % 3)); - else - base64KeyNameLen = (int)(strlen(aKey->keyName) * 4 / 3); - if (strlen(aKey->keyValue) % 3 != 0) - base64KeyValLen= (int)(strlen(aKey->keyValue) * 4 / 3) + (int)(4 - (strlen(aKey->keyValue) % 3)); - else - base64KeyValLen = (int)(strlen(aKey->keyValue) * 4 / 3); - sizeKeys += 1 + base64KeyNameLen + 1 + base64KeyValLen; - } - *buffer = (char *)gsimalloc(strlen(keysHeader) + (size_t)sizeKeys + 1); - if (*buffer == NULL) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Memory, GSIDebugLevel_HotError, "gpiSaveKeysToBuffer: buffer Out of memory."); - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - bytesWritten = sprintf(*buffer, keysHeader); - tempPoint = *buffer + bytesWritten; - for (i = 0; i < aLength; i++) - { - GPIKey *aKey = (GPIKey *)ArrayNth(iconnection->extendedInfoKeys, i); - strcat(tempPoint, "\\"); - tempPoint++; - B64Encode(aKey->keyName, tempPoint, (int)strlen(aKey->keyName), 2); - if (strlen(aKey->keyName) % 3 != 0) - tempPoint+= (int)(strlen(aKey->keyName) * 4 / 3) + (4 - (strlen(aKey->keyName) % 3)); - else - tempPoint+= (int)(strlen(aKey->keyName) * 4 / 3); - strcat(tempPoint, "\\"); - tempPoint++; - B64Encode(aKey->keyValue, tempPoint, (int)strlen(aKey->keyValue), 2); - if (strlen(aKey->keyValue) % 3 != 0) - tempPoint+= (int)(strlen(aKey->keyValue) * 4 / 3) + (4 - (strlen(aKey->keyValue) % 3)); - else - tempPoint+= (int)(strlen(aKey->keyValue) * 4 / 3); - } - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiKeys.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiKeys.h deleted file mode 100644 index 10a13effbe8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiKeys.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _GPIKEYS_H_ -#define _GPIKEYS_H_ - -#include "gpi.h" -#define GPI_INITIAL_NUM_KEYS 1 - -typedef struct -{ - char *keyName; - char *keyValue; -} GPIKey; - -void gpiStatusInfoKeyFree(void *element); -GPResult gpiStatusInfoKeysInit(GPConnection * connection); -void gpiStatusInfoKeysDestroy(GPConnection * connection); -int gpiStatusInfoKeyCompFunc(const void *elem1, const void *elem2); -GPResult gpiStatusInfoAddKey(GPConnection *connection, DArray keys, const char *theKeyName, const char *theKeyValue); -GPResult gpiStatusInfoDelKey(GPConnection *connection, DArray keys, const char *keyName); -GPResult gpiStatusInfoSetKey(GPConnection *connection, DArray keys, const char *keyName, const char *newKeyValue); -GPResult gpiStatusInfoGetKey(GPConnection *connection, DArray keys, const char *keyName, char **keyValue); -GPResult gpiSaveKeysToBuffer(GPConnection *connection, char **buffer); -GPResult gpiStatusInfoCheckKey(GPConnection *connection, DArray keys, const char *keyName, char **keyValue); -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiOperation.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiOperation.c deleted file mode 100644 index bcb14803459..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiOperation.c +++ /dev/null @@ -1,363 +0,0 @@ -/* -gpiOperation.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include -#include "gpi.h" - -//FUNCTIONS -/////////// -GPResult -gpiFailedOpCallback( - GPConnection * connection, - const GPIOperation * operation -) -{ - GPICallback callback; - GPIConnection * iconnection = (GPIConnection*)*connection; - - assert(connection != NULL); - assert(*connection != NULL); - assert(operation != NULL); - - callback = operation->callback; - if(callback.callback != NULL) - { - // Handle based on operation type. - ////////////////////////////////// - switch(operation->type) - { - case GPI_CONNECT: - { - GPConnectResponseArg * arg; - arg = (GPConnectResponseArg *)gsimalloc(sizeof(GPConnectResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPConnectResponseArg)); - arg->result = operation->result; - if(iconnection->errorCode == GP_NEWUSER_BAD_NICK) - { - arg->profile = (GPProfile)iconnection->profileid; - iconnection->profileid = 0; - } - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - } - case GPI_NEW_PROFILE: - { - GPNewProfileResponseArg * arg; - arg = (GPNewProfileResponseArg *)gsimalloc(sizeof(GPNewProfileResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPNewProfileResponseArg)); - arg->result = operation->result; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - } - case GPI_DELETE_PROFILE: - { - GPDeleteProfileResponseArg * arg; - arg = (GPDeleteProfileResponseArg *)gsimalloc(sizeof(GPDeleteProfileResponseArg)); - if (arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPDeleteProfileResponseArg)); - arg->result = operation->result; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - - } - case GPI_GET_INFO: - { - GPGetInfoResponseArg * arg; - arg = (GPGetInfoResponseArg *)gsimalloc(sizeof(GPGetInfoResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPGetInfoResponseArg)); - arg->result = operation->result; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - } - case GPI_PROFILE_SEARCH: - { - GPProfileSearchResponseArg * arg; - arg = (GPProfileSearchResponseArg *)gsimalloc(sizeof(GPProfileSearchResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPProfileSearchResponseArg)); - arg->result = operation->result; - ((GPProfileSearchResponseArg *)arg)->matches = NULL; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - } - case GPI_REGISTER_UNIQUENICK: - { - GPRegisterUniqueNickResponseArg * arg; - arg = (GPRegisterUniqueNickResponseArg *)gsimalloc(sizeof(GPRegisterUniqueNickResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPRegisterUniqueNickResponseArg)); - arg->result = operation->result; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - } - case GPI_REGISTER_CDKEY: - { - GPRegisterCdKeyResponseArg * arg; - arg = (GPRegisterCdKeyResponseArg *)gsimalloc(sizeof(GPRegisterCdKeyResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(arg, 0, sizeof(GPRegisterCdKeyResponseArg)); - arg->result = operation->result; - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - break; - } - default: - assert(0); - } - } - - return GP_NO_ERROR; -} - -GPResult -gpiAddOperation( - GPConnection * connection, - int type, - void * data, - GPIOperation ** op, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIOperation * operation; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Create a new operation struct. - ///////////////////////////////// - operation = (GPIOperation *)gsimalloc(sizeof(GPIOperation)); - if(operation == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Set the data. - //////////////// - operation->type = type; - operation->data = data; - operation->blocking = (GPIBool)blocking; - operation->state = GPI_START; - if(type == GPI_CONNECT) - { - // Connect is always ID 1. - ////////////////////////// - operation->id = 1; - } - else - { - operation->id = iconnection->nextOperationID++; - if(iconnection->nextOperationID < 2) - iconnection->nextOperationID = 2; - } - operation->result = GP_NO_ERROR; - operation->callback.callback = callback; - operation->callback.param = param; - - // Add it to the list. - ////////////////////// - operation->pnext = iconnection->operationList; - iconnection->operationList = operation; - - *op = operation; - return GP_NO_ERROR; -} - -void -gpiDestroyOperation( - GPConnection * connection, - GPIOperation * operation -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Search? - ////////// - if(operation->type == GPI_PROFILE_SEARCH) - { - GPISearchData * data = (GPISearchData *)operation->data; - - // One less. - //////////// - iconnection->numSearches--; - assert(iconnection->numSearches >= 0); - - // Close the socket. - //////////////////// - shutdown(data->sock, 2); - closesocket(data->sock); - - // freeclear the buffers. - //////////////////// - freeclear(data->outputBuffer.buffer); - freeclear(data->inputBuffer.buffer); - } - - // freeclear the data. - ///////////////// - freeclear(operation->data); - - // freeclear the operation struct. - ///////////////////////////// - freeclear(operation); -} - -void -gpiRemoveOperation( - GPConnection * connection, - GPIOperation * operation -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIOperation * pcurr = iconnection->operationList; - GPIOperation * pprev = NULL; - - // Go through the list of operations. - ///////////////////////////////////// - while(pcurr != NULL) - { - // Check for a match. - ///////////////////// - if(pcurr == operation) - { - // Update the list. - /////////////////// - if(pprev == NULL) - iconnection->operationList = pcurr->pnext; - else - pprev->pnext = operation->pnext; - - gpiDestroyOperation(connection, operation); - - return; - } - - pprev = pcurr; - pcurr = pcurr->pnext; - } -} - -GPIBool -gpiFindOperationByID( - const GPConnection * connection, - GPIOperation ** operation, - int id -) -{ - GPIOperation * op; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Go through the list of operations. - ///////////////////////////////////// - for(op = iconnection->operationList ; op != NULL ; op = op->pnext) - { - // Check the id. - //////////////// - if(op->id == id) - { - // Found it. - //////////// - if(operation != NULL) - *operation = op; - return GPITrue; - } - } - - // Didn't find it. - ////////////////// - if(operation != NULL) - *operation = NULL; - return GPIFalse; -} - -GPIBool -gpiOperationsAreBlocking( - const GPConnection * connection -) -{ - GPIOperation * operation; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Loop through the operations. - /////////////////////////////// - for(operation = iconnection->operationList ; operation != NULL ; operation = operation->pnext) - { - // Check if it's blocking. - ////////////////////////// - if((operation->blocking) && (operation->type != GPI_PROFILE_SEARCH)) - return GPITrue; - } - - // Nothing was blocking. - //////////////////////// - return GPIFalse; -} - -GPResult -gpiProcessOperation( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - GPResult result = GP_NO_ERROR; - - // Check the operation type. - //////////////////////////// - switch(operation->type) - { - case GPI_CONNECT: - result = gpiProcessConnect(connection, operation, input); - break; - - case GPI_NEW_PROFILE: - result = gpiProcessNewProfile(connection, operation, input); - break; - - case GPI_DELETE_PROFILE: - result = gpiProcessDeleteProfle(connection, operation, input); - break; - - case GPI_GET_INFO: - result = gpiProcessGetInfo(connection, operation, input); - break; - - case GPI_REGISTER_UNIQUENICK: - result = gpiProcessRegisterUniqueNick(connection, operation, input); - break; - - case GPI_REGISTER_CDKEY: - result = gpiProcessRegisterCdKey(connection, operation, input); - break; - - default: - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiProcessOperation was passed an operation with an invalid type (%d)\n", operation->type); - assert(0); - break; - } - - if(result != GP_NO_ERROR) - operation->result = result; - - return result; -} - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiOperation.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiOperation.h deleted file mode 100644 index 06204cac1a0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiOperation.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -gpiOperation.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIOPERATION_H_ -#define _GPIOPERATION_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -// Operation Types. -/////////////////// -#define GPI_CONNECT 0 -#define GPI_NEW_PROFILE 1 -#define GPI_GET_INFO 2 -#define GPI_PROFILE_SEARCH 3 -#define GPI_REGISTER_UNIQUENICK 4 -#define GPI_DELETE_PROFILE 5 -#define GPI_REGISTER_CDKEY 6 -// Operation States. -//////////////////// -#define GPI_START 0 -//#define GPI_CONNECTING 1 -#define GPI_LOGIN 2 -#define GPI_REQUESTING 3 -#define GPI_WAITING 4 -#define GPI_FINISHING 5 - -//TYPES -/////// -// Operation data. -////////////////// -typedef struct GPIOperation_s -{ - int type; - void * data; - GPIBool blocking; - GPICallback callback; - int state; - int id; - GPResult result; - struct GPIOperation_s * pnext; -} GPIOperation; - -// Connect operation data. -////////////////////////// -typedef struct -{ - char serverChallenge[128]; - char userChallenge[33]; - char passwordHash[33]; - char authtoken[GP_AUTHTOKEN_LEN]; - char partnerchallenge[GP_PARTNERCHALLENGE_LEN]; - char cdkey[GP_CDKEY_LEN]; - GPIBool newuser; -} GPIConnectData; - -//FUNCTIONS -/////////// -GPResult -gpiAddOperation( - GPConnection * connection, - int type, - void * data, - GPIOperation ** op, - GPEnum blocking, - GPCallback callback, - void * param -); - -void -gpiRemoveOperation( - GPConnection * connection, - GPIOperation * operation -); - -void -gpiDestroyOperation( - GPConnection * connection, - GPIOperation * operation -); - -GPIBool -gpiFindOperationByID( - const GPConnection * connection, - GPIOperation ** operation, - int id -); - -GPIBool -gpiOperationsAreBlocking( - const GPConnection * connection -); - -GPResult -gpiProcessOperation( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -GPResult -gpiFailedOpCallback( - GPConnection * connection, - const GPIOperation * operation -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPS3.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPS3.c deleted file mode 100644 index cb11fbdc020..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPS3.c +++ /dev/null @@ -1,592 +0,0 @@ -/* -gpiPS3.c -GameSpy Presence SDK - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include -#include -#include "gpi.h" - -#ifdef _PS3 -//GLOBALS -////////// -uint8_t gpi_np_pool[SCE_NP_MIN_POOL_SIZE]; -SceNpCommunicationId gpi_communication_id = { - {'N','P','X','S','0','0','0','0','5'}, - '\0', - 0, - 0 -}; - -//FUNCTIONS -/////////// -int gpiNpBasicCallback( - int event, - int retCode, - uint32_t reqId, - void *arg -) -{ - // No-op - can ignore any events - //////////////////////////////// - return 0; -} - -GPResult gpiInitializeNpBasic( - GPConnection * connection -) -{ - int ret = 0; - GPIConnection * iconnection = (GPIConnection*)*connection; - - iconnection->npInitialized = gsi_true; - - // Initial NP init - after this we wait for status to get to online - //////////////////////////////////////////////////////////////////// - ret = sceNpInit(SCE_NP_MIN_POOL_SIZE, gpi_np_pool); - - if (ret == SCE_NP_ERROR_ALREADY_INITIALIZED) - { - // If already initialized - DO NOT terminate after sync (game might need it) - //////////////////////////////////////////////////////////////////////////// - iconnection->npBasicGameInitialized = gsi_true; - } - else if (ret < 0) - { - iconnection->npBasicGameInitialized = gsi_true; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiInitializeNpBasic: sceNpInit() failed, NP-functionality disabled. ret = 0x%x\n", ret); - return GP_MISC_ERROR; - } - else - iconnection->npBasicGameInitialized = gsi_false; //GP initialized, so destroy after complete - - return GP_NO_ERROR; -} - -// Freeing up transaction list darray -void gpiNpTransactionListFree(void *element) -{ - npIdLookupTrans *aTrans = (npIdLookupTrans *)element; - freeclear(aTrans->npIdForAdd); -} - - -GPResult gpiCheckNpStatus( - GPConnection * connection -) -{ - int ret = 0; - int status = SCE_NP_MANAGER_STATUS_OFFLINE; - SceNpId npId; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Get NP status - //////////////// - ret = sceNpManagerGetStatus(&status); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: sceNpGetStatus() failed. ret = 0x%x\n", ret); - } - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "gpiCheckNpStatus: sceNpGetStatus - status = %d\n", status); - - - // If NP status != online after the timeout period, stop syncing - //////////////////////////////////////////////////////////////// - if (status != SCE_NP_MANAGER_STATUS_ONLINE && (current_time() - iconnection->loginTime > GPI_NP_STATUS_TIMEOUT)) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: NP Status not online - timed out\n"); - - // Flag to stop the sync process - //////////////////////////////// - iconnection->npPerformBuddySync = gsi_false; - iconnection->npPerformBlockSync = gsi_false; - - return GP_MISC_ERROR; - } - - // Once status is online, finish NP init - //////////////////////////////////////// - if (status == SCE_NP_MANAGER_STATUS_ONLINE) - { - iconnection->loginTime = current_time(); - - // Note - we ignore error messages here - if something fails we really don't care - ///////////////////////////////////////////////////////////////////////////////// - if (!iconnection->npBasicGameInitialized) - { - ret = sceNpBasicInit(); //obsolete? - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: sceNpBasicInit() failed. ret = 0x%x\n", ret); - } - - ret = sceNpBasicRegisterHandler(&gpi_communication_id, gpiNpBasicCallback, NULL); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: sceNpBasicRegisterHandler() failed. ret = 0x%x\n", ret); - } - } - - ret = sceNpLookupInit(); - if (ret == SCE_NP_COMMUNITY_ERROR_ALREADY_INITIALIZED) - { - // If already initialized - DO NOT terminate after GP destroy (game might need it) - ////////////////////////////////////////////////////////////////////////////////// - iconnection->npLookupGameInitialized = gsi_true; - } - else if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: sceNpLookupInit() failed. ret = 0x%x\n", ret); - iconnection->npLookupGameInitialized = gsi_true; - } - else - iconnection->npLookupGameInitialized = gsi_false; - - // Regardless of game, create a title context id for GP to use for lookups - /////////////////////////////////////////////////////////////////////////// - ret = sceNpManagerGetNpId(&npId); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: sceNpManagerGetNpId() failed. ret = 0x%x\n", ret); - } - - ret = sceNpLookupCreateTitleCtx(&gpi_communication_id, &npId); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "gpiCheckNpStatus: sceNpLookupCreateTitleCtx() failed. ret = 0x%x\n", ret); - } - - iconnection->npLookupTitleCtxId = ret; - - // Mark status retrieval completed - ////////////////////////////////// - iconnection->npStatusRetrieved = gsi_true; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "gpiCheckNpStatus: NP is now initialized with status.\n"); - - iconnection->npTransactionList = ArrayNew(sizeof(npIdLookupTrans), 1, gpiNpTransactionListFree); - if (!iconnection->npTransactionList) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - - return GP_NO_ERROR; -} - -GPResult gpiDestroyNpBasic( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Explicitly destroy title context we used for lookup - ////////////////////////////////////////////////////// - if (iconnection->npLookupTitleCtxId >= 0) - sceNpLookupDestroyTitleCtx(iconnection->npLookupTitleCtxId); - - // Do not destroy NpLookup or NpBasic if Game is using it - ///////////////////////////////////////////////////////// - if (!iconnection->npLookupGameInitialized) - sceNpLookupTerm(); - - if (!iconnection->npBasicGameInitialized) - { - sceNpBasicUnregisterHandler(); - - // Obsolete? - sceNpBasicTerm(); - - sceNpTerm(); - } - - // Free up transaction list used for NP lookups - /////////////////////////////////////////////// - if (iconnection->npTransactionList) - ArrayFree(iconnection->npTransactionList); - - iconnection->npInitialized = gsi_false; - iconnection->npStatusRetrieved = gsi_false; - - return GP_NO_ERROR; -} - -GPResult gpiSyncNpBuddies( - GPConnection * connection -) -{ - int ret; - SceNpId npId; //Buffer to store friend list entry's NP ID - gsi_u32 i, count = 0; - GPIConnection * iconnection = (GPIConnection*)*connection; - - - // Flag sync as complete so we don't do it more than once per login - //////////////////////////////////////////////////////////////////// - iconnection->npPerformBuddySync = gsi_false; - - // Get buddy count - /////////////////// - ret = sceNpBasicGetFriendListEntryCount(&count); - if ( ret < 0 ) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3BuddySync: Failed to get NP friend list count\n"); - } - - // Loop through each buddy, check for existence of GSID account - /////////////////////////////////////////////////////////////// - for (i = 0; i < count; i++) - { - memset(&npId, 0x00, sizeof(npId)); - ret = sceNpBasicGetFriendListEntry(i, &npId); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3BuddySync: Failed to get NP friend entry #%d\n", i); - return GP_MISC_ERROR; - } - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BuddySync: NP friend entry #%d, npid = %s. Queueing Search.\n", i, npId.handle.data); - - gpiProfileSearchUniquenick(connection, npId.handle.data, &iconnection->namespaceID, - 1, GP_NON_BLOCKING, (GPCallback)gpiSyncNpBuddiesCallback, NULL); - } - - return GP_NO_ERROR; -} - -void gpiSyncNpBuddiesCallback( - GPConnection * pconnection, - GPProfileSearchResponseArg * arg, - void * param -) -{ - if(arg->result == GP_NO_ERROR) - { - if(arg->numMatches == 1) - { - // Check if already a buddy - //////////////////////////// - if (!gpIsBuddy(pconnection, arg->matches[0].profile)) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BuddySync: NP Buddy \"%s\" found in namespace %d. Sending Request.\n", - arg->matches[0].uniquenick, arg->matches[0].namespaceID); - - // Send the add request - //////////////////////// - gpSendBuddyRequest(pconnection, arg->matches[0].profile, _T("PS3 Buddy Sync")); - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BuddySync: \"%s\" is already a buddy\n", arg->matches[0].uniquenick); - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BuddySync: No suitable match found\n"); - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3BuddySync: Buddy Search FAILED!\n"); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -GPResult gpiSyncNpBlockList( - GPConnection * connection -) -{ - int ret; - SceNpId npId; //Buffer to store block list entry's NP ID - gsi_u32 i, count = 0; - GPIConnection * iconnection = (GPIConnection*)*connection; - - - // Flag sync as complete so we don't do it more than once per login - //////////////////////////////////////////////////////////////////// - iconnection->npPerformBlockSync = gsi_false; - - // Get block list count - /////////////////////// - ret = sceNpBasicGetBlockListEntryCount(&count); - if ( ret < 0 ) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3BlockSync: Failed to get NP block list count\n"); - } - - // Loop through each entry, check for existence of GSID account - /////////////////////////////////////////////////////////////// - for (i = 0; i < count; i++) - { - memset(&npId, 0x00, sizeof(npId)); - ret = sceNpBasicGetBlockListEntry(i, &npId); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3BlockSync: Failed to get NP block entry #%d\n", i); - return GP_MISC_ERROR; - } - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BlockSync: NP block entry #%d, npid = %s. Queueing Search.\n", i, npId.handle.data); - - gpiProfileSearchUniquenick(connection, npId.handle.data, &iconnection->namespaceID, - 1, GP_NON_BLOCKING, (GPCallback)gpiSyncNpBlockListCallback, NULL); - } - - return GP_NO_ERROR; -} - -void gpiSyncNpBlockListCallback( - GPConnection * pconnection, - GPProfileSearchResponseArg * arg, - void * param -) -{ - GPIProfile * pProfile; - GPIConnection * iconnection = (GPIConnection*)*pconnection; - - if(arg->result == GP_NO_ERROR) - { - if(arg->numMatches == 1) - { - // Check if already blocked - //////////////////////////// - if(!gpiGetProfile(pconnection, arg->matches[0].profile, &pProfile) || !pProfile->blocked) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BlockSync: NP Block Entry \"%s\" found in namespace %d. Adding to BlockedList.\n", - arg->matches[0].uniquenick, arg->matches[0].namespaceID); - - // Add to GP Blocked List - set lock to make sure we dont try to add to NP list - /////////////////////////////////////////////////////////////////////////////// - iconnection->npSyncLock = gsi_true; - gpiAddToBlockedList(pconnection, arg->matches[0].profile); - iconnection->npSyncLock = gsi_false; - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BlockSync: \"%s\" is already blocked\n", arg->matches[0].uniquenick); - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3BlockSync: No suitable match found\n"); - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3BlockSync: Block Entry Search FAILED!\n"); - - GSI_UNUSED(param); -} - -GPResult gpiAddToNpBlockList( - GPConnection * connection, - int profileid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - // TODO: consider developer method for cache input in order to check HDD cache? - - // If NP status not resolved, don't bother with lookup - /////////////////////////////////////////////////////// - if (!iconnection->npTransactionList || iconnection->npLookupTitleCtxId < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: Cancelling add - NP status not yet resolved.\n"); - return GP_NO_ERROR; - } - - // Do an info lookup to find out if this player has an NP account. - ///////////////////////////////////////////////////////////////// - gpiGetInfo(connection, profileid, GP_CHECK_CACHE, GP_NON_BLOCKING, - (GPCallback)gpiAddToNpBlockListInfoCallback, NULL); - - return GP_NO_ERROR; -} - -void gpiAddToNpBlockListInfoCallback( - GPConnection * pconnection, - GPGetInfoResponseArg * arg, - void * param -) -{ - SceNpOnlineId onlineId; - int ret; - npIdLookupTrans transaction; - GPIConnection * iconnection = (GPIConnection*)*pconnection; -#ifdef GSI_UNICODE - char asciiUniquenick[GP_UNIQUENICK_LEN]; -#endif - - if(arg->result == GP_NO_ERROR) - { - // Make sure its a PS3 uniquenick (e.g. we have the uniquenick) - /////////////////////////////////////////////////////////////// - if (_tcslen(arg->uniquenick) != 0) - { - memset(&onlineId, 0, sizeof(onlineId)); - -#ifdef GSI_UNICODE - UCS2ToAsciiString(arg->uniquenick, (char*)asciiUniquenick); - strncpy(onlineId.data, asciiUniquenick, SCE_NET_NP_ONLINEID_MAX_LENGTH); -#else - strncpy(onlineId.data, arg->uniquenick, SCE_NET_NP_ONLINEID_MAX_LENGTH); -#endif - - if (ArrayLength(iconnection->npTransactionList) < GPI_NP_NUM_TRANSACTIONS) - { - ret = sceNpLookupCreateTransactionCtx(iconnection->npLookupTitleCtxId); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: sceNpLookupCreateTransactionCtx() failed. ret = 0x%x\n", ret); - } - else - { - transaction.npIdForAdd = (SceNpId*)gsimalloc(sizeof(SceNpId)); - if(transaction.npIdForAdd == NULL) - { - sceNpLookupDestroyTransactionCtx(ret); - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: Out of memory.\n"); - return; - } - transaction.npTransId = ret; - transaction.npLookupDone = gsi_false; - ArrayAppend(iconnection->npTransactionList, &transaction); - - // Perform NP lookup to get the NpId - ///////////////////////////////////// - ret = sceNpLookupNpIdAsync(transaction.npTransId, &onlineId, - transaction.npIdForAdd, 0, NULL); - if (ret < 0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: sceNpLookupNpIdAsync() failed. ret = 0x%x\n", ret); - } - } - } - else - { - // Can only have a max of 32 simultaneous transactions (based on PS3 lib) - ///////////////////////////////////////////////////////////////////////// - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "PS3AddToNpBlockList: Transactions limit reached for np lookups\n"); - } - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: Profile [%d] does not have a uniquenick in namespace %d!\n", - arg->profile, iconnection->namespaceID); - } - else - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: Player Info lookup FAILED!\n"); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -GPResult gpiProcessNp(GPConnection * connection) -{ - int i, ret=0; - GPIConnection * iconnection = (GPIConnection*)*connection; - npIdLookupTrans * transaction; - - // Check for uninitialized transaction darray - ////////////////////////////////////////////// - if (!iconnection->npTransactionList) - return GP_NO_ERROR; - - // Need to process Sysutil for the Async lookups - ///////////////////////////////////////////////// - if (ArrayLength(iconnection->npTransactionList) > 0) - cellSysutilCheckCallback(); - - // Loop through all current transactions, check if complete - /////////////////////////////////////////////////////////// - for (i=0; i < ArrayLength(iconnection->npTransactionList); i++) - { - // Grab next transaction in the list - ///////////////////////////////////// - transaction = (npIdLookupTrans *)ArrayNth(iconnection->npTransactionList, i); - - if (!transaction->npLookupDone) - { - if (sceNpLookupPollAsync(transaction->npTransId, &ret)==0) - transaction->npLookupDone = gsi_true; - } - else - { - if (ret<0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: sceNpLookupWaitAsync. ret = 0x%x\n", ret); - if (ret == (int)SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_USER_NPID) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: Player '%s' is not an NP user.\n", - transaction->npIdForAdd->handle.data); - } - } - else - { - // Found an NpId, try to add - ///////////////////////////// - ret = sceNpBasicAddBlockListEntry(transaction->npIdForAdd); - if (ret == (int)SCE_NP_BASIC_ERROR_BUSY) - { - // Oh nice, NP is too busy to help us.... keep on trying - ///////////////////////////////////////////////////////// - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3AddToNpBlockList: SCE_NP_BASIC_ERROR_BUSY. continue trying to add to NP\n"); - return GP_NO_ERROR; - } - else if ( ret < 0 ) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: sceNpBasicAddBlockListEntry() failed. ret = 0x%x\n", ret); - } - else - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Comment, - "PS3AddToNpBlockList: Player '%s' added to NP Block list.\n", - transaction->npIdForAdd->handle.data); - } - } - - ret = sceNpLookupDestroyTransactionCtx(transaction->npTransId); - if (ret<0) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "PS3AddToNpBlockList: sceNpLookupDestroyTransactionCtx() failed. ret = 0x%x\n", ret); - } - - // Delete Transaction when its complete - //////////////////////////////////////// - ArrayDeleteAt(iconnection->npTransactionList, i); - } - } - - return GP_NO_ERROR; -} - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPS3.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPS3.h deleted file mode 100644 index fc09b15d9e2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPS3.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -gpiPS3.h -GameSpy Presence SDK - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIPS3_H_ -#define _GPIPS3_H_ - -//INCLUDES -////////// -#include "gpi.h" -#include -#include -#include - - -//DEFINES -///////// -#define GPI_NP_SYNC_DELAY 5000 //wait 5 seconds after login before doing any syncs -#define GPI_NP_STATUS_TIMEOUT 5000 //timeout after 5 second max if NP status is not online -#define GPI_NP_NUM_TRANSACTIONS 32 //Max num of simultaneous NP lookup transactions - -//STRUCTURES -//////////// -typedef struct -{ - int npTransId; - SceNpId *npIdForAdd; - gsi_bool npLookupDone; -} npIdLookupTrans; - -//FUNCTIONS -/////////// -GPResult gpiInitializeNpBasic(); -GPResult gpiCheckNpStatus(GPConnection * connection); -GPResult gpiDestroyNpBasic(GPConnection * connection); -GPResult gpiProcessNp(GPConnection * connection); -int gpiNpBasicCallback(int event, int retCode, uint32_t reqId, void *arg); - -GPResult gpiSyncNpBuddies(GPConnection * connection); -void gpiSyncNpBuddiesCallback(GPConnection * pconnection, GPProfileSearchResponseArg * arg, void * param); - -GPResult gpiSyncNpBlockList(GPConnection * connection); -void gpiSyncNpBlockListCallback(GPConnection * pconnection, GPProfileSearchResponseArg * arg, void * param); - -GPResult gpiAddToNpBlockList(GPConnection * connection, int profileid); -void gpiAddToNpBlockListInfoCallback(GPConnection * pconnection, GPGetInfoResponseArg * arg, void * param); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPeer.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPeer.c deleted file mode 100644 index b9b04fc0d71..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPeer.c +++ /dev/null @@ -1,1311 +0,0 @@ -/* -gpiPeer.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4267) //lines: 275 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - -//INCLUDES -////////// -#include -#include -#include -#include "gpi.h" - -//FUNCTIONS -/////////// -static GPResult -gpiProcessPeerInitiatingConnection( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - //int state; - char * str = NULL; - //int len; - GPIBool connClosed; - GPIProfile * pProfile; - GPResult result; - GSUdpPeerState aPeerState; - - GS_ASSERT(peer); - if (!peer) - return GP_NETWORK_ERROR; - - GS_ASSERT(peer->state != GPI_PEER_DISCONNECTED && peer->state != GPI_PEER_NOT_CONNECTED); - if (peer->state == GPI_PEER_DISCONNECTED || peer->state == GPI_PEER_NOT_CONNECTED) - return GP_NETWORK_ERROR; - // Check the state. - /////////////////// - switch(peer->state) - { - case GPI_PEER_GETTING_SIG: - // Do nothing - we're waiting for getinfo to get the sig. - ///////////////////////////////////////////////////////// - break; - - case GPI_PEER_GOT_SIG: - { - // Start the connect. - ///////////////////// - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_State, GSIDebugLevel_Verbose, "Got the peer signature for profileid: %d\n", peer->profile); - CHECK_RESULT(gpiPeerStartConnect(connection, peer)); - - break; - } - case GPI_PEER_CONNECTING: - { - // Check if the connect finished. - ///////////////////////////////// - /* - CHECK_RESULT(gpiCheckSocketConnect(connection, peer->sock, &state)); - if(state == GPI_DISCONNECTED) - { - Error(connection, GP_NETWORK_ERROR, "Error connecting to a peer."); - } - */ - - gsUdpEngineGetPeerState(peer->ip, peer->port, &aPeerState); - - if(aPeerState == GS_UDP_PEER_CONNECTED) - { - GPIPeer * pcurr; - GPIBool freePeerSig = GPITrue; - - // Get the profile object. - ////////////////////////// - if(!gpiGetProfile(connection, peer->profile, &pProfile)) - Error(connection, GP_NETWORK_ERROR, "Error connecting to a peer."); - - // Send the auth. - ///////////////// - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\auth\\"); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\pid\\"); - gpiAppendIntToBuffer(connection, &peer->outputBuffer, iconnection->profileid); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\nick\\"); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, iconnection->nick); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\sig\\"); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, pProfile->peerSig); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\final\\"); - - // Are there any other peers still connecting? - ////////////////////////////////////////////// - for(pcurr = iconnection->peerList ; pcurr != NULL ; pcurr = pcurr->pnext) - if((pcurr->profile == peer->profile) && (pcurr != peer)) - if(pcurr->state <= GPI_PEER_CONNECTING) - freePeerSig = GPIFalse; - - // freeclear it? - /////////// - if(freePeerSig) - { - freeclear(pProfile->peerSig); - if(gpiCanFreeProfile(pProfile)) - gpiRemoveProfile(connection, pProfile); - } - - // Update the state. - //////////////////// - peer->state = GPI_PEER_WAITING; - } - - break; - } - case GPI_PEER_WAITING: - { - // Check for a response. - //////////////////////// - //CHECK_RESULT(gpiRecvToBuffer(connection, peer->sock, &peer->inputBuffer, &len, &connClosed, "PR")); - - // Check for a final. - ///////////////////// - if (peer->inputBuffer.buffer) - str = strstr(peer->inputBuffer.buffer, "\\final\\"); - if(str != NULL) - { - str[0] = '\0'; - str += 7; - - // Was it rejected? - /////////////////// - if(strncmp(peer->inputBuffer.buffer, "\\anack\\", 7) == 0) - { - // Rejected. - //////////// - peer->nackCount++; - - // Is this more than once? - ////////////////////////// - if(peer->nackCount > 1) - { - // we shouldn't reach this case unless there is a problem with - // the server when getting a buddy's signature - - // Give up already. - /////////////////// - Error(connection, GP_NETWORK_ERROR, "Error getting buddy authorization."); - } - - // Try getting the latest sig. - ////////////////////////////// - CHECK_RESULT(gpiPeerGetSig(connection, peer)); - } - else if(strncmp(peer->inputBuffer.buffer, "\\aack\\", 6) != 0) - { - // Unknown message. - /////////////////// - Error(connection, GP_NETWORK_ERROR, "Error parsing buddy message."); - } - - // The connection has been established. - /////////////////////////////////////// - peer->state = GPI_PEER_CONNECTED; - peer->inputBuffer.len = 0; - } - - break; - } - // code should not reach here. - default: break; - } - - // Send stuff that needs to be sent. - //////////////////////////////////// - if(peer->outputBuffer.len > 0) - { - //result = gpiSendFromBuffer(connection, peer->sock, &peer->outputBuffer, &connClosed, GPITrue, "PR"); - result = gpiSendBufferToPeer(connection, peer->ip, peer->port, &peer->outputBuffer, &connClosed, GPITrue); - if(connClosed || (result != GP_NO_ERROR)) - peer->state = GPI_PEER_DISCONNECTED; - } - - return GP_NO_ERROR; -} - -static GPResult -gpiProcessPeerAcceptingConnection( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GSUdpPeerState aPeerState; - char * str; - //int len; - GPIBool connClosed; - char intValue[16]; - int pid; - char nick[GP_NICK_LEN]; - char sig[33]; - char sigCheck[33]; - char buffer[256]; - - // Check the state. - /////////////////// - GS_ASSERT(peer->state == GPI_PEER_WAITING); - if (peer->state != GPI_PEER_WAITING) - return GP_NETWORK_ERROR; - - // Read any pending info. - ///////////////////////// - //CHECK_RESULT(gpiRecvToBuffer(connection, peer->sock, &peer->inputBuffer, &len, &connClosed, "PR")); - gsUdpEngineGetPeerState(peer->ip, peer->port, &aPeerState); - - // Check for a closed connection. - ///////////////////////////////// - if(aPeerState == GS_UDP_PEER_CLOSED) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - - // Check for a final. - ///////////////////// - str = strstr(peer->inputBuffer.buffer, "\\final\\"); - if(str != NULL) - { - str[0] = '\0'; - str += 7; - - // Is it an auth? - ///////////////// - if(strncmp(peer->inputBuffer.buffer, "\\auth\\", 6) == 0) - { - // Get the pid. - /////////////// - if(!gpiValueForKey(peer->inputBuffer.buffer, "\\pid\\", intValue, sizeof(intValue))) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - pid = atoi(intValue); - - // Get the nick. - //////////////// - if(!gpiValueForKey(peer->inputBuffer.buffer, "\\nick\\", nick, sizeof(nick))) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - - // Get the sig. - /////////////// - if(!gpiValueForKey(peer->inputBuffer.buffer, "\\sig\\", sig, sizeof(sig))) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - - // Compute what the sig should be. - ////////////////////////////////// - sprintf(buffer, "%s%d%d", - iconnection->password, - iconnection->profileid, - pid); - MD5Digest((unsigned char *)buffer, strlen(buffer), sigCheck); - - // Check the sig. - ///////////////// - if(strcmp(sig, sigCheck) != 0) - { - // Bad sig. - /////////// - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\anack\\"); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\final\\"); - - gpiSendBufferToPeer(connection, peer->ip, peer->port, &peer->outputBuffer, &connClosed, GPITrue); - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - - // Send an ack. - /////////////// - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\aack\\"); - gpiAppendStringToBuffer(connection, &peer->outputBuffer, "\\final\\"); - - peer->state = GPI_PEER_CONNECTED; - peer->profile = (GPProfile)pid; - } - else - { - // Unrecognized command. - //////////////////////// - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - - // Update the buffer length. - //////////////////////////// - peer->inputBuffer.len = 0; - } - - return GP_NO_ERROR; -} - -GPResult -gpiPeerSendMessages( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIBool connClosed; - GPIMessage * message; - GPResult result; - - GS_ASSERT(peer); - if (!peer) - return GP_NETWORK_ERROR; - // Only send messages if there's nothing waiting in the output buffer. - ////////////////////////////////////////////////////////////////////// - if(peer->outputBuffer.len) - return GP_NO_ERROR; - - // Send outgoing messages. - ////////////////////////// - while(ArrayLength(peer->messages)) - { - // Get the first message. - ///////////////////////// - message = (GPIMessage *)ArrayNth(peer->messages, 0); - - // Send as much as possible. - //////////////////////////// - //result = gpiSendFromBuffer(connection, peer->sock, &message->buffer, &connClosed, GPIFalse, "PR"); - result = gpiSendBufferToPeer(connection, peer->ip, peer->port, &message->buffer, &connClosed, GPIFalse); - if(connClosed || (result != GP_NO_ERROR)) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - - // Did we not send it all? - ////////////////////////// - if(message->buffer.pos != message->buffer.len) - break; - - // Remove the message. - ////////////////////// - ArrayDeleteAt(peer->messages, 0); - } - - return GP_NO_ERROR; -} - -static GPResult -gpiProcessPeerConnected( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - //int len; - GSUdpPeerState aPeerState; - GPIBool connClosed; - GPICallback callback; - char * buffer; - int type; - int messageLen; - GPResult result; - - GS_ASSERT(peer); - if (!peer) - return GP_NETWORK_ERROR; - // Send stuff. - ////////////// - if(peer->outputBuffer.len) - { - //result = gpiSendFromBuffer(connection, peer->sock, &peer->outputBuffer, &connClosed, GPITrue, "PR"); - result = gpiSendBufferToPeer(connection, peer->ip, peer->port, &peer->outputBuffer, &connClosed, GPITrue); - if(connClosed || (result != GP_NO_ERROR)) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - } - - // Send outgoing messages. - ////////////////////////// - if(!peer->outputBuffer.len) - { - CHECK_RESULT(gpiPeerSendMessages(connection, peer)); - if(peer->state == GPI_PEER_DISCONNECTED) - return GP_NO_ERROR; - } - - // Read messages. - ///////////////// - /* - result = gpiRecvToBuffer(connection, peer->sock, &peer->inputBuffer, &len, &connClosed, "PR"); - if(result != GP_NO_ERROR) - { - peer->state = GPI_PEER_DISCONNECTED; - return GP_NO_ERROR; - } - */ - if(peer->inputBuffer.len > 0) - { - peer->timeout = (time(NULL) + GPI_PEER_TIMEOUT); - } - - // Grab the message header. - /////////////////////////// - do - { - // Read a message. - ////////////////// - CHECK_RESULT(gpiReadMessageFromBuffer(connection, &peer->inputBuffer, &buffer, &type, &messageLen)); - if(buffer != NULL) - { - // Got a message! - ///////////////// - switch(type) - { - case GPI_BM_MESSAGE: - callback = iconnection->callbacks[GPI_RECV_BUDDY_MESSAGE]; - if(callback.callback != NULL) - { - GPRecvBuddyMessageArg * arg; - - arg = (GPRecvBuddyMessageArg *)gsimalloc(sizeof(GPRecvBuddyMessageArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->profile = peer->profile; -#ifndef GSI_UNICODE - arg->message = goastrdup(buffer); -#else - arg->message = UTF8ToUCS2StringAlloc(buffer); -#endif - arg->date = (unsigned int)time(NULL); - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_MESSAGE)); - } - break; - - case GPI_BM_UTM: - callback = iconnection->callbacks[GPI_RECV_BUDDY_UTM]; - if (callback.callback != NULL) - { - GPRecvBuddyUTMArg * arg; - - arg = (GPRecvBuddyUTMArg *)gsimalloc(sizeof(GPRecvBuddyUTMArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->profile = peer->profile; -#ifndef GSI_UNICODE - arg->message = goastrdup(buffer); -#else - arg->message = UTF8ToUCS2StringAlloc(buffer); -#endif - arg->date = (unsigned int)time(NULL); - CHECK_RESULT(gpiAddCallback(connection, callback, arg, NULL, GPI_ADD_MESSAGE)); - } - break; - - case GPI_BM_PING: - // Send back a pong. - //////////////////// - gpiSendBuddyMessage(connection, peer->profile, GPI_BM_PONG, "1", 0, NULL); - - break; - -#ifndef NOFILE - case GPI_BM_PONG: - // Lets the transfers handle this. - ////////////////////////////////// - gpiTransfersHandlePong(connection, peer->profile, peer); - break; -#endif - case GPI_BM_KEYS_REQUEST: - CHECK_RESULT(gpiBuddyHandleKeyRequest(connection, peer)); - break; - case GPI_BM_KEYS_REPLY: - CHECK_RESULT(gpiBuddyHandleKeyReply(connection, peer, buffer)); - // Let the keys request reply handler take care of this. - //////////////////////////////////////////////////////// - break; - case GPI_BM_FILE_SEND_REQUEST: - case GPI_BM_FILE_SEND_REPLY: - case GPI_BM_FILE_BEGIN: - case GPI_BM_FILE_END: - case GPI_BM_FILE_DATA: - case GPI_BM_FILE_SKIP: - case GPI_BM_FILE_TRANSFER_THROTTLE: - case GPI_BM_FILE_TRANSFER_CANCEL: - case GPI_BM_FILE_TRANSFER_KEEPALIVE: - // Handle a transfer protocol message. - ////////////////////////////////////// - gpiHandleTransferMessage(connection, peer, type, peer->inputBuffer.buffer, buffer, messageLen); - - - break; - - default: - break; - } - - // Remove it from the buffer. - ///////////////////////////// - gpiClipBufferToPosition(connection, &peer->inputBuffer); - } - } - while(buffer); - - gsUdpEngineGetPeerState(peer->ip, peer->port, &aPeerState); - //if(connClosed) - if (aPeerState == GS_UDP_PEER_CLOSED) - peer->state = GPI_PEER_DISCONNECTED; - - return GP_NO_ERROR; -} - - -// Used to check for any timed out peer operations -// assumes peer is not NULL -// makes no assumption of the operation queue -void gpiCheckTimedOutPeerOperations(GPConnection * connection, GPIPeer *peer) -{ - GPIPeerOp *anIterator = peer->peerOpQueue.first; - GS_ASSERT(peer); - if (!peer) - return; - - while (anIterator && anIterator != peer->peerOpQueue.last) - { - if (anIterator->state != GPI_PEER_OP_STATE_FINISHED && current_time() > anIterator->timeout && anIterator->callback) - { - // currently only one type of peer operation exists - // when it's found, we need to provide the application with - // a result of no data - if (anIterator->type == GPI_BM_KEYS_REQUEST) - { - GPICallback callback; - GPGetBuddyStatusInfoKeysArg *arg = (GPGetBuddyStatusInfoKeysArg *)gsimalloc(sizeof(GPGetBuddyStatusInfoKeysArg)); - callback.callback = anIterator->callback; - callback.param = anIterator->userData; - arg->keys = NULL; - arg->numKeys = 0; - arg->values = NULL; - arg->profile = peer->profile; - gpiAddCallback(connection, callback, arg, NULL, 0); - - } - // The peer operation is removed regardless of type - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Notice, "Peer operation timed out"); - gpiPeerRemoveOp(peer, anIterator); - } - anIterator = anIterator->next; - } -} - - -static GPResult -gpiProcessPeer( - GPConnection * connection, - GPIPeer * peer -) -{ - GPResult result = GP_NO_ERROR; - - // This state should never get out of initialization. - ///////////////////////////////////////////////////// - GS_ASSERT(peer->state != GPI_PEER_NOT_CONNECTED); - if (peer->state == GPI_PEER_NOT_CONNECTED) - return GP_NETWORK_ERROR; - - // If we're not connected yet. - ////////////////////////////// - if(peer->state != GPI_PEER_CONNECTED) - { - if(peer->initiated) - result = gpiProcessPeerInitiatingConnection(connection, peer); - else - result = gpiProcessPeerAcceptingConnection(connection, peer); - } - - // If we're connected. - ////////////////////// - if((result == GP_NO_ERROR) && (peer->state == GPI_PEER_CONNECTED)) - { - result = gpiProcessPeerConnected(connection, peer); - gpiCheckTimedOutPeerOperations(connection, peer); - } - - return result; -} - -void -gpiDestroyPeer( - GPConnection * connection, - GPIPeer * peer -) -{ -#ifndef NOFILE - // Cleanup any transfers that use this peer. - //////////////////////////////////////////// - gpiTransferPeerDestroyed(connection, peer); -#endif - - //shutdown(peer->sock, 2); - //closesocket(peer->sock); - freeclear(peer->inputBuffer.buffer); - freeclear(peer->outputBuffer.buffer); - if(peer->messages) - { - ArrayFree(peer->messages); - peer->messages = NULL; - } - freeclear(peer); - - GSI_UNUSED(connection); -} - -void -gpiRemovePeer( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIPeer * pprev; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIMessage * message; - - GS_ASSERT(peer != NULL); - if (peer == NULL) - return; - - GS_ASSERT(iconnection->peerList); - if (iconnection->peerList == NULL) - return; - // Check if this is the first peer. - /////////////////////////////////// - if(iconnection->peerList == peer) - { - iconnection->peerList = peer->pnext; - } - else - { - // Find the previous peer. - ////////////////////////// - for(pprev = iconnection->peerList ; pprev->pnext != peer ; pprev = pprev->pnext) - { - if(pprev->pnext == NULL) - { - // Can't find this peer in the list! - //////////////////////////////////// - assert(0); - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "Tried to remove peer not in list."); - return; - } - } - pprev->pnext = peer->pnext; - } - - // Check for pending messages. - ////////////////////////////// - while(ArrayLength(peer->messages)) - { - // Get the next message. - //////////////////////// - message = (GPIMessage *)ArrayNth(peer->messages, 0); - - // Don't forward protocol messages. - /////////////////////////////////// - if(message->type < 100) - gpiSendServerBuddyMessage(connection, peer->profile, message->type, message->buffer.buffer + message->start); - - // Remove the message. - ////////////////////// - ArrayDeleteAt(peer->messages, 0); - } - - gpiDestroyPeer(connection, peer); -} - -GPResult gpiProcessPeers(GPConnection *connection) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIPeer * nextPeer; - GPIPeer * peer; - //SOCKET incoming; - GPResult result; - - /* - // Check for incoming peer connections. - /////////////////////////////////////// - if(iconnection->peerSocket != INVALID_SOCKET) - { - // Have to manually check if accept is possible since - // PS2 Insock only supports blocking sockets. - if (CanReceiveOnSocket(iconnection->peerSocket)) - { - incoming = accept(iconnection->peerSocket, NULL, NULL); - if(incoming != INVALID_SOCKET) - { - // This is a new peer. - ////////////////////// - peer = gpiAddPeer(connection, -1, GPIFalse); - if(peer) - { - peer->state = GPI_PEER_WAITING; - peer->sock = incoming; - SetSockBlocking(incoming, 0); - gpiSetPeerSocketSizes(peer->sock); - } - else - { - closesocket(incoming); - } - } - } - } - */ - gsUdpEngineThink(); - // Got through the list of peers. - ///////////////////////////////// - for(peer = iconnection->peerList ; peer != NULL ; peer = nextPeer) - { - // Store the next peer. - /////////////////////// - nextPeer = peer->pnext; - if(peer->state == GPI_PEER_DISCONNECTED) - { - // Remove it. - ///////////// - //gsDebug - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Notice, "Peer disconnected, pid: %d", peer->profile); - gpiRemovePeer(connection, peer); - } - else - { - // Process the peer. - //////////////////// - result = gpiProcessPeer(connection, peer); - - // Check for a disconnection or a timeout. - ////////////////////////////////////////// - if((peer->state == GPI_PEER_DISCONNECTED) || (result != GP_NO_ERROR) || (time(NULL) > peer->timeout)) - { - // Remove it. - ///////////// - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Notice, "Peer disconnected, pid: %d", peer->profile); - gpiRemovePeer(connection, peer); - } - } - } - - return GP_NO_ERROR; -} - -// NOTE: use this function when in a gp function -GPIPeer * gpiGetPeerByProfile(const GPConnection * connection, - int profileid) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIPeer * pcurr; - - // Go through the list of peers. - //////////////////////////////// - for(pcurr = iconnection->peerList ; pcurr != NULL ; pcurr = pcurr->pnext) - { - // Check for a match. - ///////////////////// - if(pcurr->profile == profileid) - { - // Got it. - ////////// - return pcurr; - } - } - - return NULL; -} - -// NOTE: use this function only when in a UDP layer callback -GPIPeer * gpiGetPeerByAddr(const GPConnection *connection, - unsigned int ip, - unsigned short port) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIPeer * pcurr; - - GS_ASSERT(ip); - GS_ASSERT(port); - if (!ip && !port) - return NULL; - // Go through the list of peers. - //////////////////////////////// - for(pcurr = iconnection->peerList ; pcurr != NULL ; pcurr = pcurr->pnext) - { - // Check for a match. - ///////////////////// - if(pcurr->ip == ip && pcurr->port == port) - { - // Got it. - ////////// - return pcurr; - } - } - - return NULL; -} - -gsi_bool gpiIsPeerConnected(GPIPeer *peer) -{ - GS_ASSERT(peer); - if (!peer) - return gsi_false; - - if (peer && peer->state != GPI_PEER_CONNECTED) - return gsi_false; - - return gsi_true; -} - -static void gpiFreeMessage(void * elem) -{ - GPIMessage * message = (GPIMessage *)elem; - - freeclear(message->buffer.buffer); -} - -GPIPeer * -gpiAddPeer( - GPConnection * connection, - int profileid, - GPIBool initiate -) -{ - GPIPeer * peer; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Create a new peer. - ///////////////////// - peer = (GPIPeer *)gsimalloc(sizeof(GPIPeer)); - if(peer == NULL) - return NULL; - memset(peer, 0, sizeof(GPIPeer)); - peer->state = GPI_PEER_NOT_CONNECTED; - peer->initiated = initiate; - //peer->sock = INVALID_SOCKET; - peer->profile = profileid; - peer->timeout = (time(NULL) + GPI_PEER_TIMEOUT); - peer->pnext = iconnection->peerList; - peer->messages = ArrayNew(sizeof(GPIMessage), 0, gpiFreeMessage); - iconnection->peerList = peer; - peer->peerOpQueue.first = NULL; - peer->peerOpQueue.last = NULL; - peer->peerOpQueue.opList = NULL; - return peer; -} - -GPResult -gpiPeerGetSig( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIOperation * operation; - - // Start a get info operation to get the sig. - ///////////////////////////////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_GET_INFO, NULL, &operation, GP_NON_BLOCKING, NULL, NULL)); - - // Send the get info. - ///////////////////// - CHECK_RESULT(gpiSendGetInfo(connection, peer->profile, operation->id)); - - // Set the state. - ///////////////// - peer->state = GPI_PEER_GETTING_SIG; - - return GP_NO_ERROR; -} - -GPResult -gpiPeerStartConnect( - GPConnection * connection, - GPIPeer * peer -) -{ - //int rcode; - //struct sockaddr_in address; - GPIProfile * profile; - GPIConnection * iconnection = (GPIConnection*)*connection; - GSUdpErrorCode anError; - - // Get the profile object. - ////////////////////////// - if(!gpiGetProfile(connection, peer->profile, &profile)) - Error(connection, GP_NETWORK_ERROR, "Error connecting to a peer."); - - /* - // Create the socket. - ///////////////////// - peer->sock = socket(AF_INET, SOCK_STREAM, 0); - if(peer->sock == INVALID_SOCKET) - CallbackError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error creating a socket."); - - // Make it non-blocking. - //////////////////////// - rcode = SetSockBlocking(peer->sock, 0); - if(rcode == 0) - CallbackError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error making a socket non-blocking."); - - // Bind the socket. - /////////////////// - -// BD: PS2 Insock has bug with binding to port 0 -// No sockets after the first will be able to bind - - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - rcode = bind(peer->sock, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if (gsiSocketIsError(rcode)) - CallbackError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error binding a socket."); - - // Set the socket sizes. - //////////////////////// - gpiSetPeerSocketSizes(peer->sock); - - // Connect the socket. - ////////////////////// - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - address.sin_addr.s_addr = profile->buddyStatus->ip; - address.sin_port = (gsi_u16)profile->buddyStatus->port; - rcode = connect(peer->sock, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if (gsiSocketIsError(rcode)) - { - int error = GOAGetLastError(peer->sock); - if((error != WSAEWOULDBLOCK) && (error != WSAEINPROGRESS) && (error != WSAETIMEDOUT) ) - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error connecting a socket."); - } - } - */ - - if (profile->buddyStatusInfo) - { - GSUdpPeerState aPeerState; - gsUdpEngineGetPeerState(profile->buddyStatusInfo->buddyIp , profile->buddyStatusInfo->buddyPort, &aPeerState); - if (aPeerState != GS_UDP_PEER_CONNECTED || aPeerState != GS_UDP_PEER_CONNECTING) - { - anError = gsUdpEngineStartTalkingToPeer(profile->buddyStatusInfo->buddyIp , profile->buddyStatusInfo->buddyPort, - iconnection->mHeader, GPI_PEER_TIMEOUT); - if (anError != GS_UDP_ADDRESS_ALREADY_IN_USE) - CallbackError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error starting communication with a peer."); - } - peer->ip = profile->buddyStatusInfo->buddyIp; - peer->port = profile->buddyStatusInfo->buddyPort; - } - // We're waiting for the connect to complete. - ///////////////////////////////////////////// - peer->state = GPI_PEER_CONNECTING; - - return GP_NO_ERROR; -} - -GPResult -gpiPeerAddMessage( - GPConnection * connection, - GPIPeer * peer, - int type, - const char * message -) -{ - GPIMessage gpiMessage; - int len; - - GS_ASSERT(peer != NULL); - GS_ASSERT(message != NULL); - - if (peer == NULL) - return GP_NETWORK_ERROR; - if (message == NULL) - return GP_NETWORK_ERROR; - - // Get the length. - ////////////////// - len = (int)strlen(message); - - // Clear the message. - ///////////////////// - memset(&gpiMessage, 0, sizeof(GPIMessage)); - - // Copy the type. - ///////////////// - gpiMessage.type = type; - - // Copy the header to the buffer. - ///////////////////////////////// - CHECK_RESULT(gpiAppendStringToBuffer(connection, &gpiMessage.buffer, "\\m\\")); - CHECK_RESULT(gpiAppendIntToBuffer(connection, &gpiMessage.buffer, type)); - CHECK_RESULT(gpiAppendStringToBuffer(connection, &gpiMessage.buffer, "\\len\\")); - CHECK_RESULT(gpiAppendIntToBuffer(connection, &gpiMessage.buffer, len)); - CHECK_RESULT(gpiAppendStringToBuffer(connection, &gpiMessage.buffer, "\\msg\\\n")); - - // Copy the message to the buffer. - ////////////////////////////////// - gpiMessage.start = gpiMessage.buffer.len; - CHECK_RESULT(gpiAppendStringToBufferLen(connection, &gpiMessage.buffer, message, len)); - CHECK_RESULT(gpiAppendCharToBuffer(connection, &gpiMessage.buffer, '\0')); - - // Add it to the list. - ////////////////////// - ArrayAppend(peer->messages, &gpiMessage); - - // Reset the timeout. - ///////////////////// - peer->timeout = (time(NULL) + GPI_PEER_TIMEOUT); - - return GP_NO_ERROR; -} - -GPResult -gpiPeerStartTransferMessage( - GPConnection * connection, - GPIPeer * peer, - int type, - const struct GPITransferID_s * transferID -) -{ - char buffer[64]; - GPITransferID tid; - tid.count = transferID->count; - tid.profileid = transferID->profileid; - tid.time = transferID->time; - - GS_ASSERT(transferID); - if (!transferID) - return GP_NETWORK_ERROR; - // Start the message. - ///////////////////// - sprintf(buffer, "\\m\\%d\\xfer\\%d %u %u", type, tid.profileid, tid.count, tid.time); - - return gpiSendOrBufferString(connection, peer, buffer); -} - -GPResult -gpiPeerFinishTransferMessage( - GPConnection * connection, - GPIPeer * peer, - const char * message, - int len -) -{ - char buffer[32]; - GS_ASSERT(peer != NULL); - if (!peer) - return GP_NETWORK_ERROR; - - // Check the message. - ///////////////////// - if(!message) - message = ""; - - if(len == -1) - len = (int)strlen(message); - - // Set the len and the message. - /////////////////////////////// - sprintf(buffer, "\\len\\%d\\msg\\\n", len); - CHECK_RESULT(gpiSendOrBufferString(connection, peer, buffer)); - - // Copy the message to the buffer. - ////////////////////////////////// - CHECK_RESULT(gpiSendOrBufferStringLenToPeer(connection, peer, message, len)); - CHECK_RESULT(gpiSendOrBufferChar(connection, peer, '\0')); - - // Reset the timeout. - ///////////////////// - peer->timeout = (time(NULL) + GPI_PEER_TIMEOUT); - - return GP_NO_ERROR; -} - -void gpiPeerLeftCallback(unsigned int ip, unsigned short port, GSUdpCloseReason reason, void *userData) -{ - - GPConnection *connection = (GPConnection *)userData; - GPIPeer *aPeer; - IN_ADDR anAddr; - anAddr.s_addr = ip; - aPeer = gpiGetPeerByAddr(connection, ip, port); - //gpiRemovePeer(connection, aPeer); - if (aPeer) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Notice, - "Peer left: addr: %s:%d, profile: %d\n", inet_ntoa(anAddr), port, aPeer->profile); - aPeer->state = GPI_PEER_DISCONNECTED; - } - - GSI_UNUSED(anAddr); - GSI_UNUSED(reason); -} - -void gpiPeerMessageCallback(unsigned int ip, unsigned short port, unsigned char *message, - unsigned int messageLength, gsi_bool reliable, void *userData) -{ - GPConnection *connection = (GPConnection *)userData; - GPIPeer *aPeer; - unsigned char * buff; - int writePos; - int size; - IN_ADDR anAddr; - anAddr.s_addr = ip; - aPeer = gpiGetPeerByAddr(connection, ip, port); - if (!aPeer) - { - aPeer = gpiAddPeer(connection, -1, GPIFalse); - if (aPeer) - { - aPeer->state = GPI_PEER_WAITING; - aPeer->ip = ip; - aPeer->port = port; - } - else - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Memory, GSIDebugLevel_HotError, - "gpiPeerMessageCallback: out of memory when allocating peer, addr: %s:%d", inet_ntoa(anAddr), port); - return; - } - } - - buff = (unsigned char *)aPeer->inputBuffer.buffer; - writePos = aPeer->inputBuffer.len; - size = aPeer->inputBuffer.size; - - // Check if the buffer needs to be resized. - /////////////////////////////////////////// - if((int)messageLength > (size - writePos)) - { - unsigned char *reallocedBuff; - size = (writePos + max(GPI_READ_SIZE,(int)messageLength)); - reallocedBuff = (unsigned char *)gsirealloc(buff, (unsigned int)size + 1); - if(reallocedBuff == NULL) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Memory, GSIDebugLevel_HotError, - "gpiPeerMessageCallback: out of memory when reallocating buffer, addr: %s:%d", inet_ntoa(anAddr), port); - gsifree(buff); - gpiSetErrorString(connection, "Out of memory."); - gpiCallErrorCallback(connection, GP_MEMORY_ERROR, GP_NON_FATAL); - return; - } - else - buff = reallocedBuff; - } - - memcpy(&buff[writePos], message, messageLength); - - aPeer->inputBuffer.buffer = (char *)buff; - aPeer->inputBuffer.len += messageLength; - aPeer->inputBuffer.size = size; - buff[aPeer->inputBuffer.len] = '\0'; - GSI_UNUSED(reliable); - GSI_UNUSED(anAddr); -} - -void gpiPeerAcceptedCallback(unsigned int ip, unsigned short port, - GSUdpErrorCode error, gsi_bool rejected, void *userData) -{ - GPConnection *connection = (GPConnection *)userData; - GPIPeer *aPeer; - IN_ADDR anAddr; - anAddr.s_addr = ip; - - aPeer = gpiGetPeerByAddr(connection, ip, port); - if (!aPeer) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_HotError, - "Peer does not exist: ip-port: %s:%d\n", inet_ntoa(anAddr), port); - } - else - { - if (rejected) - { - aPeer->state = GPI_PEER_DISCONNECTED; - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Notice, - "Peer Connection rejected: ip-port: %s:%d\n", inet_ntoa(anAddr), port); - return; - } - } - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Notice, - "Peer Connection accepted: ip-port: %s:%d\n", inet_ntoa(anAddr), port); - - GSI_UNUSED(userData); - GSI_UNUSED(rejected); - GSI_UNUSED(error); - GSI_UNUSED(anAddr); -} -void gpiPeerPingReplyCallback(unsigned int ip, unsigned short port, unsigned int latency, void *userData) -{ - GSI_UNUSED(userData); - GSI_UNUSED(latency); - GSI_UNUSED(port); - GSI_UNUSED(ip); -} - -// gpiPeerAddOp notes: -// Assumes non-null inputs! -// The queue should be empty when the first element is added. -// Any new element added will be added to the end of the queue. -void gpiPeerAddOp(GPIPeer *peer, GPIPeerOp *operation) -{ - GS_ASSERT(peer); - GS_ASSERT(operation); - - if (!peer || !operation) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_WarmError, "Peer operation not added"); - return; - } - // Three cases can occur: - // The list is empty - set all pointers to the new node - // The list has only one element - set the first element's next to the new - // and set the last element to the new - // The list has more than one element - add the new element to the end of - // the queue - if (peer->peerOpQueue.opList == NULL) - { - peer->peerOpQueue.first = operation; - peer->peerOpQueue.last = operation; - peer->peerOpQueue.opList = operation; - } - else if (peer->peerOpQueue.first == peer->peerOpQueue.last) - { - peer->peerOpQueue.first->next = operation; - peer->peerOpQueue.last = operation; - } - else - { - peer->peerOpQueue.last->next = operation; - peer->peerOpQueue.last = operation; - } - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Notice, "Peer Operation Added"); -} - -// gpiPeerRemoveOp: -// Assumes the list is NOT NULL otherwise it returns. -// Assumes the operation being passed in is on the queue. -// Assumes non-null inputs! -// Completed or Timed out Operations are deleted from queue by finding -// the operation passed in. Removal of operations don't necessarily -// happen in order. -void gpiPeerRemoveOp(GPIPeer *peer, GPIPeerOp *operation) -{ - GS_ASSERT(peer); - GS_ASSERT(operation); - if (!peer || !operation) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_WarmError, "Peer operation not removed"); - return; - } - - GS_ASSERT(peer->peerOpQueue.opList != NULL); - if (peer->peerOpQueue.opList == NULL) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_WarmError, "Peer operation not removed"); - return; - } - - if (peer->peerOpQueue.first == peer->peerOpQueue.last && peer->peerOpQueue.first == operation) - { - peer->peerOpQueue.opList = peer->peerOpQueue.first = peer->peerOpQueue.last = operation->next; - } - else if (peer->peerOpQueue.first == operation) - { - peer->peerOpQueue.first = peer->peerOpQueue.first->next; - peer->peerOpQueue.opList = peer->peerOpQueue.first; - } - else - { - GPIPeerOp *aPrevOp = NULL; - for(aPrevOp = peer->peerOpQueue.first ; aPrevOp->next != operation ; aPrevOp = aPrevOp->next) - { - if(aPrevOp->next == NULL) - { - // Can't find this peer in the list! - //////////////////////////////////// - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "Tried to remove peer operation not in list."); - return; - } - } - aPrevOp->next = operation->next; - } - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Misc, GSIDebugLevel_Notice, "Peer operation removed"); - freeclear(operation); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPeer.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPeer.h deleted file mode 100644 index 8e864b9e2c9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiPeer.h +++ /dev/null @@ -1,186 +0,0 @@ -/* -gpiPeer.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIPEER_H_ -#define _GPIPEER_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -// Peer states. -/////////////// -#define GPI_PEER_NOT_CONNECTED 100 -#define GPI_PEER_GETTING_SIG 101 -#define GPI_PEER_GOT_SIG 102 -#define GPI_PEER_CONNECTING 103 -#define GPI_PEER_WAITING 104 -#define GPI_PEER_CONNECTED 105 -#define GPI_PEER_DISCONNECTED 106 - -// Timeout for a peer connection, in milliseconds. -///////////////////////////////////////////// -#define GPI_PEER_TIMEOUT (10 * 1000) - -// Timeout for a peer operation, in milliseconds -//////////////////////////////////////////// -#define GPI_PEER_OP_TIMEOUT 60000 - -typedef enum -{ - GPI_PEER_OP_STATE_NONE, - GPI_PEER_OP_STATE_REQUESTED, - GPI_PEER_OP_STATE_FINISHED -} GPIPeerOpState; - -typedef struct GPITransferID_s * GPITransferID_st; - -//TYPES -/////// -// A peer message. -////////////////// -typedef struct GPIMessage -{ - GPIBuffer buffer; - int type; - int start; -} GPIMessage; - -typedef struct _GPIPeerOp -{ - GPIPeerOpState state; - void *userData; - GPCallback callback; - struct _GPIPeerOp * next; - int type; - gsi_time timeout; -} GPIPeerOp; - -typedef struct _GPIPeerOpQueue -{ - GPIPeerOp * opList; - GPIPeerOp * first; - GPIPeerOp * last; -} GPIPeerOpQueue; - -// A peer connection. -///////////////////// -typedef struct GPIPeer_s -{ - int state; - GPIBool initiated; - //SOCKET sock; - unsigned int ip; - unsigned short port; - GPProfile profile; - time_t timeout; - int nackCount; - GPIBuffer inputBuffer; - GPIBuffer outputBuffer; - DArray messages; - GPIPeerOpQueue peerOpQueue; - struct GPIPeer_s * pnext; -} GPIPeer; - -//FUNCTIONS -/////////// -GPResult -gpiProcessPeers( - GPConnection * connection -); - -GPResult -gpiPeerGetSig( - GPConnection * connection, - GPIPeer * peer -); - -GPResult -gpiPeerStartConnect( - GPConnection * connection, - GPIPeer * peer -); - -// NOTE: use this function when in a gp function -GPIPeer * gpiGetPeerByProfile(const GPConnection * connection, - int profileid); - -// NOTE: use this function only when in a UDP layer callback -GPIPeer *gpiGetPeerByAddr(const GPConnection *connection, - unsigned int ip, - unsigned short port); - -gsi_bool gpiIsPeerConnected(GPIPeer *peer); - -GPIPeer * -gpiAddPeer( - GPConnection * connection, - int profileid, - GPIBool initiate -); - -void -gpiDestroyPeer( - GPConnection * connection, - GPIPeer * peer -); - -void -gpiRemovePeer( - GPConnection * connection, - GPIPeer * peer -); - -GPResult -gpiPeerAddMessage( - GPConnection * connection, - GPIPeer * peer, - int type, - const char * message -); - -GPResult -gpiPeerStartTransferMessage( - GPConnection * connection, - GPIPeer * peer, - int type, - const struct GPITransferID_s * transferID -); - -GPResult -gpiPeerFinishTransferMessage( - GPConnection * connection, - GPIPeer * peer, - const char * message, - int len -); - -GPResult -gpiPeerSendMessages( - GPConnection * connection, - GPIPeer * peer -); - -void gpiPeerLeftCallback(unsigned int ip, unsigned short port, GSUdpCloseReason reason, void *userData); -void gpiPeerMessageCallback(unsigned int ip, unsigned short port, unsigned char *message, - unsigned int messageLength, gsi_bool reliable, void *userData); -void gpiPeerAcceptedCallback(unsigned int ip, unsigned short port, - GSUdpErrorCode error, gsi_bool rejected, void *userData); -void gpiPeerPingReplyCallback(unsigned int ip, unsigned short port, unsigned int latency, void *userData); - -void gpiPeerAddOp(GPIPeer *peer, GPIPeerOp *operation); -void gpiPeerRemoveOp(GPIPeer *peer, GPIPeerOp *operation); -void gpiCheckTimedOutPeerOperations(GPConnection * connection, GPIPeer * peer); -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiProfile.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiProfile.c deleted file mode 100644 index 07242669902..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiProfile.c +++ /dev/null @@ -1,1396 +0,0 @@ -/* -gpiProfile.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4312) //lines: 1164, 1186, 1265 -#pragma warning(disable: 4311) //lines: 1231 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -#define GPI_PROFILE_GROW_SIZE 16 -#define GPI_PROFILE_CACHE_VERSION 2 - -// GLOBALS -////////// -static char GPIInfoCacheFilename[FILENAME_MAX + 1] = "gp.info"; - -//FUNCTIONS -/////////// -static int -gpiProfilesTableHash( - const void *arg, - int numBuckets -) -{ - const GPIProfile * profile = (const GPIProfile *)arg; - return (profile->profileId % numBuckets); -} - -static int -gpiProfilesTableCompare( - const void * arg1, - const void * arg2 -) -{ - const GPIProfile * profile1 = (const GPIProfile *)arg1; - const GPIProfile * profile2 = (const GPIProfile *)arg2; - return (profile1->profileId - profile2->profileId); -} - -static void -gpiProfilesTableFree( - void *arg -) -{ - GPIProfile * profile = (GPIProfile *)arg; - if(profile->buddyStatus) - { - freeclear(profile->buddyStatus->statusString); - freeclear(profile->buddyStatus->locationString); - freeclear(profile->buddyStatus); - } - if (profile->buddyStatusInfo) - { - freeclear(profile->buddyStatusInfo->richStatus); - freeclear(profile->buddyStatusInfo->gameType); - freeclear(profile->buddyStatusInfo->gameVariant); - freeclear(profile->buddyStatusInfo->gameMapName); - if (profile->buddyStatusInfo->extendedInfoKeys) - { - ArrayFree(profile->buddyStatusInfo->extendedInfoKeys); - profile->buddyStatusInfo->extendedInfoKeys = NULL; - } - freeclear(profile->buddyStatusInfo); - } - gpiFreeInfoCache(profile); - freeclear(profile->authSig); - freeclear(profile->peerSig); -} - -GPIBool -gpiInitProfiles( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - iconnection->profileList.numBuddies = 0; - iconnection->profileList.numBlocked = 0; - iconnection->profileList.num = 0; - iconnection->profileList.profileTable = TableNew( - sizeof(GPIProfile), - 32, - gpiProfilesTableHash, - gpiProfilesTableCompare, - gpiProfilesTableFree); - if(!iconnection->profileList.profileTable) - return GPIFalse; - - return GPITrue; -} - -#ifndef NOFILE - -static GPResult -gpiOpenDiskProfiles( - GPConnection * connection, - GPIBool write, - GPIBool * failed -) -{ - FILE * fp = NULL; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Open the file. - ///////////////// - if(write) - fp = fopen(GPIInfoCacheFilename, "wt"); - else - fp = fopen(GPIInfoCacheFilename, "rt"); - if(fp == NULL) - { - *failed = GPITrue; - return GP_NO_ERROR; - } - - // Excellent. - ///////////// - iconnection->diskCache = fp; - *failed = GPIFalse; - - return GP_NO_ERROR; - - GSI_UNUSED(write); -} - -static void -gpiCloseDiskProfiles( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Close the file. - ////////////////// - fclose(iconnection->diskCache); - iconnection->diskCache = NULL; - - return; -} - -static GPResult -gpiReadDiskKeyValue( - GPConnection * connection, - GPIBool * failed, - char key[512], - char value[512] -) -{ - int c; - FILE * fp; - GPIConnection * iconnection = (GPIConnection*)*connection; - int i; - - // Grab the file pointer. - ///////////////////////// - fp = iconnection->diskCache; - - // Read the key. - //////////////// - i = 0; - do - { - if(i == 512) - { - *failed = GPITrue; - return GP_NO_ERROR; - } - c = fgetc(fp); - if((c == EOF) || (c == '\n')) - { - *failed = GPITrue; - return GP_NO_ERROR; - } - key[i++] = (char)c; - } - while(c != '='); - key[--i] = '\0'; - - // Check for no key. - //////////////////// - if(i == 0) - { - *failed = GPITrue; - return GP_NO_ERROR; - } - - // Read the value. - ////////////////// - i = 0; - do - { - if(i == 512) - { - *failed = GPITrue; - return GP_NO_ERROR; - } - c = fgetc(fp); - if(c == EOF) - { - c = '\n'; - } - value[i++] = (char)c; - } - while(c != '\n'); - value[--i] = '\0'; - - // Done. - //////// - *failed = GPIFalse; - return GP_NO_ERROR; - - GSI_UNUSED(value); - GSI_UNUSED(key); - GSI_UNUSED(connection); -} - -static GPResult -gpiReadDiskProfile( - GPConnection * connection, - GPIBool * failedOut -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - FILE * fp; - GPIProfile profile; - int c; - int rcode; - GPIBool failed; - char key[256]; - char value[256]; - GPIInfoCache infoCache; - GPIBool valid = GPIFalse; - GPIProfile * pProfile; - char nick[GP_NICK_LEN]; - char uniquenick[GP_UNIQUENICK_LEN]; - char email[GP_EMAIL_LEN]; - char firstname[GP_FIRSTNAME_LEN]; - char lastname[GP_LASTNAME_LEN]; - char homepage[GP_HOMEPAGE_LEN]; - char aimname[GP_AIMNAME_LEN]; - - // Grab the file pointer. - ///////////////////////// - fp = iconnection->diskCache; - - // Clear the temp profile. - ////////////////////////// - memset(&profile, 0, sizeof(GPIProfile)); - - // Clear the temp cache. - //////////////////////// - memset(&infoCache, 0, sizeof(GPIInfoCache)); - infoCache.nick = nick; - infoCache.uniquenick = uniquenick; - infoCache.email = email; - infoCache.firstname = firstname; - infoCache.lastname = lastname; - infoCache.homepage = homepage; - infoCache.aimname = aimname; - nick[0] = '\0'; - uniquenick[0] = '\0'; - email[0] = '\0'; - firstname[0] = '\0'; - lastname[0] = '\0'; - homepage[0] = '\0'; - aimname[0] = '\0'; - - // Read until we hit a [. - ///////////////////////// - do - { - c = fgetc(fp); - if(c == EOF) - { - *failedOut = GPITrue; - return GP_NO_ERROR; - } - } - while(c != '['); - - // Grab the profileid. - ////////////////////// - rcode = fscanf(fp, "%d]\n", &profile.profileId); - if(rcode != 1) - { - *failedOut = GPITrue; - return GP_NO_ERROR; - } - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_Comment, - "Reading profile %d from disk cache:\n", profile.profileId); - - // Read key/value pairs. - //////////////////////// - do - { - CHECK_RESULT(gpiReadDiskKeyValue(connection, &failed, key, value)); - if(!failed) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_Comment, - "%d: %s=%s\n", profile.profileId, key, value); - - // Set the data based on the key. - ///////////////////////////////// - if(strcmp(key, "userid") == 0) - { - profile.userId = atoi(value); - } - else if(strcmp(key, "nick") == 0) - { - strzcpy(infoCache.nick, value, GP_NICK_LEN); - } - else if(strcmp(key, "uniquenick") == 0) - { - strzcpy(infoCache.uniquenick, value, GP_UNIQUENICK_LEN); - } - else if(strcmp(key, "email") == 0) - { - strzcpy(infoCache.email, value, GP_EMAIL_LEN); - } - else if(strcmp(key, "firstname") == 0) - { - strzcpy(infoCache.firstname, value, GP_FIRSTNAME_LEN); - } - else if(strcmp(key, "lastname") == 0) - { - strzcpy(infoCache.lastname, value, GP_LASTNAME_LEN); - } - else if(strcmp(key, "homepage") == 0) - { - strzcpy(infoCache.homepage, value, GP_HOMEPAGE_LEN); - } - else if(strcmp(key, "icquin") == 0) - { - infoCache.icquin = atoi(value); - } - else if(strcmp(key, "zipcode") == 0) - { - strzcpy(infoCache.zipcode, value, GP_ZIPCODE_LEN); - } - else if(strcmp(key, "countrycode") == 0) - { - strzcpy(infoCache.countrycode, value, GP_COUNTRYCODE_LEN); - } - else if(strcmp(key, "birthday") == 0) - { - infoCache.birthday = atoi(value); - } - else if(strcmp(key, "birthmonth") == 0) - { - infoCache.birthmonth = atoi(value); - } - else if(strcmp(key, "birthyear") == 0) - { - infoCache.birthyear = atoi(value); - } - else if(strcmp(key, "sex") == 0) - { - if(toupper(value[0]) == 'M') - infoCache.sex = GP_MALE; - else if(toupper(value[0]) == 'F') - infoCache.sex = GP_FEMALE; - else - infoCache.sex = GP_PAT; - } - else if(strcmp(key, "publicmask") == 0) - { - infoCache.publicmask = atoi(value); - } - else if(strcmp(key, "aimname") == 0) - { - strzcpy(infoCache.aimname, value, GP_AIMNAME_LEN); - } - else if(strcmp(key, "pic") == 0) - { - infoCache.pic = atoi(value); - } - else if(strcmp(key, "occupationid") == 0) - { - infoCache.occupationid = atoi(value); - } - else if(strcmp(key, "industryid") == 0) - { - infoCache.industryid = atoi(value); - } - else if(strcmp(key, "incomeid") == 0) - { - infoCache.incomeid = atoi(value); - } - else if(strcmp(key, "marriedid") == 0) - { - infoCache.marriedid = atoi(value); - } - else if(strcmp(key, "childcount") == 0) - { - infoCache.childcount = atoi(value); - } - else if(strcmp(key, "interests1") == 0) - { - infoCache.interests1 = atoi(value); - } - else if(strcmp(key, "ownership1") == 0) - { - infoCache.ownership1 = atoi(value); - } - else if(strcmp(key, "conntypeid") == 0) - { - infoCache.conntypeid = atoi(value); - } - else if(strcmp(key, "valid") == 0) - { - valid = (GPIBool)atoi(value); - } - else - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_HotError, - "Unrecognized profile key: %s=%s\n", key, value); - } - } - } - while(!failed); - - // Create a new profile. - //////////////////////// - pProfile = gpiProfileListAdd(connection, profile.profileId); - if(pProfile) - { - // Copy the profile we've set up into the list. - /////////////////////////////////////////////// - *pProfile = profile; - - // Copy the info if valid. - ////////////////////////// - if(valid) - gpiSetInfoCache(connection, pProfile, &infoCache); - } - *failedOut = GPIFalse; - return GP_NO_ERROR; - - GSI_UNUSED(connection); -} - -static GPResult -gpiReadVersion( - const GPConnection * connection, - int * version -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - FILE * fp; - - // Grab the file pointer. - ///////////////////////// - fp = iconnection->diskCache; - - // Read the version. - //////////////////// - if(fscanf(fp, "%d\n", version) != 1) - *version = 0; - - return GP_NO_ERROR; - - GSI_UNUSED(connection); - GSI_UNUSED(version); -} - -static void -gpiWriteVersion( - GPConnection * connection, - int version -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - FILE * fp; - - // Grab the file pointer. - ///////////////////////// - fp = iconnection->diskCache; - - // Write the version. - ///////////////////// - fprintf(fp, "%d\n", version); - - GSI_UNUSED(connection); - GSI_UNUSED(version); -} - -GPResult -gpiLoadDiskProfiles( - GPConnection * connection -) -{ - GPIBool failed; - int count; - int version = 0; - - // Open the disk cache. - /////////////////////// - CHECK_RESULT(gpiOpenDiskProfiles(connection, GPIFalse, &failed)); - if(failed) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_HotError, - "Failed to open the disk cache file.\n"); - return GP_NO_ERROR; - } - - // Check the version. - ////////////////////// - CHECK_RESULT(gpiReadVersion(connection, &version)); - if(version == GPI_PROFILE_CACHE_VERSION) - { - // Read profiles. - ///////////////// - count = 0; - do - { - CHECK_RESULT(gpiReadDiskProfile(connection, &failed)); - if(!failed) - count++; - } - while(!failed); - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_Comment, - "Loaded %d profiles from disk cache.\n", count); - } - - // Close the cache. - /////////////////// - gpiCloseDiskProfiles(connection); - - return GP_NO_ERROR; -} - -static GPIBool -gpiSaveDiskProfile( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ - FILE * fp; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Grab the file pointer. - ///////////////////////// - fp = iconnection->diskCache; - - // Write the profile id. - //////////////////////// - fprintf(fp, "[%d]\n", profile->profileId); - - // Write the userid if not 0. - ///////////////////////////// - if(profile->userId != 0) - fprintf(fp, "userid=%d\n", profile->userId); - - // Is the cache valid? - ////////////////////// - if(profile->cache) - { - fprintf(fp, "valid=1\n"); - - fprintf(fp, "nick=%s\n", profile->cache->nick); - fprintf(fp, "uniquenick=%s\n", profile->cache->uniquenick); - fprintf(fp, "email=%s\n", profile->cache->email); - fprintf(fp, "firstname=%s\n", profile->cache->firstname); - fprintf(fp, "lastname=%s\n", profile->cache->lastname); - fprintf(fp, "homepage=%s\n", profile->cache->homepage); - fprintf(fp, "icquin=%d\n", profile->cache->icquin); - fprintf(fp, "zipcode=%s\n", profile->cache->zipcode); - fprintf(fp, "countrycode=%s\n", profile->cache->countrycode); - fprintf(fp, "birthday=%d\n", profile->cache->birthday); - fprintf(fp, "birthmonth=%d\n", profile->cache->birthmonth); - fprintf(fp, "birthyear=%d\n", profile->cache->birthyear); - if(profile->cache->sex == GP_MALE) - fprintf(fp, "sex=Male\n"); - if(profile->cache->sex == GP_FEMALE) - fprintf(fp, "sex=Female\n"); - if(profile->cache->sex == GP_PAT) - fprintf(fp, "sex=Pat\n"); - fprintf(fp, "publicmask=%d\n", profile->cache->publicmask); - fprintf(fp, "aimname=%s\n", profile->cache->aimname); - fprintf(fp, "pic=%d\n", profile->cache->pic); - fprintf(fp, "occupationid=%d\n", profile->cache->occupationid); - fprintf(fp, "industryid=%d\n", profile->cache->industryid); - fprintf(fp, "incomeid=%d\n", profile->cache->incomeid); - fprintf(fp, "marriedid=%d\n", profile->cache->marriedid); - fprintf(fp, "childcount=%d\n", profile->cache->childcount); - fprintf(fp, "interests1=%d\n", profile->cache->interests1); - fprintf(fp, "ownership1=%d\n", profile->cache->ownership1); - fprintf(fp, "conntypeid=%d\n", profile->cache->conntypeid); - } - - // End this profile. - //////////////////// - fprintf(fp, "\n"); - - GSI_UNUSED(data); - GSI_UNUSED(connection); - GSI_UNUSED(profile); - - return GPITrue; -} - -GPResult -gpiSaveDiskProfiles( - GPConnection * connection -) -{ - GPIBool failed; - - // Open the disk cache. - /////////////////////// - CHECK_RESULT(gpiOpenDiskProfiles(connection, GPITrue, &failed)); - if(failed) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_HotError, - "Failed to open the disk cache file.\n"); - return GP_NO_ERROR; - } - - // Write the version. - ///////////////////// - gpiWriteVersion(connection, GPI_PROFILE_CACHE_VERSION); - - // Save profiles. - ///////////////// - gpiProfileMap(connection, gpiSaveDiskProfile, NULL); - - // Close the cache. - /////////////////// - gpiCloseDiskProfiles(connection); - - return GP_NO_ERROR; -} - -#endif - -GPResult -gpiProcessNewProfile( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - char buffer[16]; - int pid; - GPICallback callback; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // This should be \npr\. - //////////////////////// - if(strncmp(input, "\\npr\\", 5) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Get the profile id. - ////////////////////// - if(!gpiValueForKey(input, "\\profileid\\", buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - pid = atoi(buffer); - - // Call the callback. - ///////////////////// - callback = operation->callback; - if(callback.callback != NULL) - { - GPNewProfileResponseArg * arg; - arg = (GPNewProfileResponseArg *)gsimalloc(sizeof(GPNewProfileResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - arg->profile = (GPProfile)pid; - arg->result = GP_NO_ERROR; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - - // Remove the operation. - //////////////////////// - gpiRemoveOperation(connection, operation); - - return GP_NO_ERROR; -} - -GPIProfile * -gpiProfileListAdd( - GPConnection * connection, - int id -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfileList * profileList = &iconnection->profileList; - GPIProfile profile; - GPIProfile * pProfile; - - assert(id > 0); - - // Check the parameters. 2000.02.14.JED was not checked in release build. - ///////////////////////////////////////////////////////////////////////// - if(id <= 0) - return NULL; - - // Check if this id is already in the list. - /////////////////////////////////////////// - if(gpiGetProfile(connection, (GPProfile)id, &pProfile)) - return pProfile; - - // Setup the new profile. - ///////////////////////// - memset(&profile, 0, sizeof(GPIProfile)); - profile.profileId = id; - profile.userId = 0; - profile.cache = NULL; - profile.authSig = NULL; - profile.peerSig = NULL; - profile.requestCount = 0; - - // Add it to the table. - /////////////////////// - TableEnter(profileList->profileTable, &profile); - - // One new one. - /////////////// - profileList->num++; - - // Get a pointer to the profile. - //////////////////////////////// - if(gpiGetProfile(connection, (GPProfile)id, &pProfile)) - return pProfile; - - // It wasn't added. - /////////////////// - return NULL; -} - -GPIBool -gpiGetProfile( - GPConnection * connection, - GPProfile profileid, - GPIProfile ** pProfile -) -{ - GPIProfile * profile; - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfile profileTemp; - - profileTemp.profileId = profileid; - profile = (GPIProfile *)TableLookup(iconnection->profileList.profileTable, &profileTemp); - if(pProfile) - *pProfile = profile; - - return ((profile != NULL) ? GPITrue:GPIFalse); -} - -GPResult -gpiNewProfile( - GPConnection * connection, - const char nick[31], - GPEnum replace, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIOperation * operation; - GPResult result; - char buffer[31]; - - // Error check. - /////////////// - if(nick == NULL) - Error(connection, GP_PARAMETER_ERROR, "Invalid nick."); - if((replace != GP_REPLACE) && (replace != GP_DONT_REPLACE)) - Error(connection, GP_PARAMETER_ERROR, "Invalid replace."); - - // Create a new operation. - ////////////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_NEW_PROFILE, NULL, &operation, blocking, callback, param)); - - // Send the request. - //////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\newprofile\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\nick\\"); - strzcpy(buffer, nick, GP_NICK_LEN); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, buffer); - if(replace == GP_REPLACE) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\replace\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, 1); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\oldnick\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, iconnection->nick); - } - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, operation->id); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); -/* - if(string.result != GP_NO_ERROR) - { - gpiRemoveOperation(connection, operation); - return string.result; - } -*/ - // Process it if blocking. - ////////////////////////// - if(operation->blocking) - { - result = gpiProcess(connection, operation->id); - if(result != GP_NO_ERROR) - { - gpiRemoveOperation(connection, operation); - return result; - } - } - - return GP_NO_ERROR; -} - -GPResult gpiProcessDeleteProfle -( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPICallback callback; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // This should be \dpr\. - //////////////////////// - if(strncmp(input, "\\dpr\\", 5) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - - // Call the callback. - ///////////////////// - callback = operation->callback; - if(callback.callback != NULL) - { - GPDeleteProfileResponseArg * arg; - arg = (GPDeleteProfileResponseArg *)gsimalloc(sizeof(GPDeleteProfileResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - arg->profile = iconnection->profileid; - arg->result = GP_NO_ERROR; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - - // Remove the operation. - //////////////////////// - gpiRemoveOperation(connection, operation); - - return GP_NO_ERROR; -} - - -GPResult -gpiDeleteProfile( - GPConnection * connection, - GPCallback callback, - void *param -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIOperation * operation; - GPResult result; - - CHECK_RESULT(gpiAddOperation(connection, GPI_DELETE_PROFILE, NULL, &operation, GP_BLOCKING, callback, param)); - // Send the message. - //////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\delprofile\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, operation->id); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - // Remove the profile object. - ///////////////////////////// - gpiRemoveProfileByID(connection, iconnection->profileid); - - // Disconnect the connection. - // PANTS|05.16.00 - ///////////////////////////// - iconnection->connectState = GPI_PROFILE_DELETING; - result = gpiProcess(connection, operation->id); - if (result != GP_NO_ERROR) - { - gpiRemoveOperation(connection, operation); - return result; - } - - gpiDisconnect(connection, GPIFalse); - return GP_NO_ERROR; -} - -void -gpiRemoveProfileByID( - GPConnection * connection, - int profileid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfile * profile; - - if(gpiGetProfile(connection, (GPProfile)profileid, &profile)) - TableRemove(iconnection->profileList.profileTable, profile); -} - -void -gpiRemoveProfile( - GPConnection * connection, - GPIProfile * profile -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - TableRemove(iconnection->profileList.profileTable, profile); -} - -typedef struct GPIFindProfileByUserData -{ - char * nick; - char * email; - GPIProfile ** profile; - GPIBool found; -} GPIFindProfileByUserData; - -static GPIBool gpiCheckProfileForUser( - GPConnection * connection, - GPIProfile * profile, - void *udata -) -{ - GPIFindProfileByUserData * data = (GPIFindProfileByUserData *)udata; - - GSI_UNUSED(connection); - - // Check for a valid cache. - /////////////////////////// - if(profile->cache) - { - // Check the nick and email. - //////////////////////////// - if((strcmp(data->nick, profile->cache->nick) == 0) && (strcmp(data->email, profile->cache->email) == 0)) - { - // Found it. - //////////// - *data->profile = profile; - data->found = GPITrue; - return GPIFalse; - } - } - - return GPITrue; -} - -GPResult -gpiFindProfileByUser( - GPConnection * connection, - char nick[GP_NICK_LEN], - char email[GP_EMAIL_LEN], - GPIProfile ** profile -) -{ - GPIFindProfileByUserData data; - - data.nick = nick; - data.email = email; - data.profile = profile; - data.found = GPIFalse; - - gpiProfileMap(connection, gpiCheckProfileForUser, &data); - - if(!data.found) - *profile = NULL; - - return GP_NO_ERROR; -} - -typedef struct GPIProfileMapData -{ - GPConnection * connection; - gpiProfileMapFunc func; - void * data; -} GPIProfileMapData; - -static int -gpiProfileMapCallback( - void *arg, - void *udata -) -{ - GPIProfile * profile = (GPIProfile *)arg; - GPIProfileMapData * data = (GPIProfileMapData *)udata; - return (int)data->func(data->connection, profile, data->data); -} - -GPIBool -gpiProfileMap( - GPConnection * connection, - gpiProfileMapFunc func, - void * data -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfileMapData mapData; - - mapData.connection = connection; - mapData.func = func; - mapData.data = data; - - return (!TableMapSafe2(iconnection->profileList.profileTable, gpiProfileMapCallback, &mapData)) ? GPITrue:GPIFalse; -} - -typedef struct GPIFindProfileData -{ - int index; - GPIProfile * profile; -} GPIFindProfileData; - -static GPIBool -gpiCheckForBuddy( - GPConnection * connection, - GPIProfile * profile, - void *udata -) -{ - GPIFindProfileData * data = (GPIFindProfileData *)udata; - if (profile->buddyStatus && (data->index == profile->buddyStatus->buddyIndex)) - { - data->profile = profile; - return GPIFalse; - } - else if (profile->buddyStatusInfo && (data->index == profile->buddyStatusInfo->buddyIndex)) - { - data->profile = profile; - return GPIFalse; - } - - GSI_UNUSED(connection); - - return GPITrue; -} - -GPIProfile * -gpiFindBuddy( - GPConnection * connection, - int buddyIndex -) -{ - GPIFindProfileData data; - - data.index = buddyIndex; - data.profile = NULL; - - gpiProfileMap(connection, gpiCheckForBuddy, &data); - - return data.profile; -} - -void gpiRemoveBuddyStatus(GPIBuddyStatus *buddyStatus) -{ - GS_ASSERT(buddyStatus); - - freeclear(buddyStatus->locationString); - freeclear(buddyStatus->statusString); - freeclear(buddyStatus); -} - -void gpiRemoveBuddyStatusInfo(GPIBuddyStatusInfo *buddyStatusInfo) -{ - GS_ASSERT(buddyStatusInfo); - - freeclear(buddyStatusInfo->richStatus); - freeclear(buddyStatusInfo->gameType); - freeclear(buddyStatusInfo->gameVariant); - freeclear(buddyStatusInfo->gameMapName); - ArrayFree(buddyStatusInfo->extendedInfoKeys); - buddyStatusInfo->extendedInfoKeys = NULL; - freeclear(buddyStatusInfo); -} - -GPIBool -gpiCanFreeProfile( - GPIProfile * profile -) -{ - return ((profile && !profile->cache && !profile->buddyStatus && !profile->buddyStatusInfo && !profile->peerSig && !profile->authSig && !profile->blocked)) ? GPITrue:GPIFalse; -} - -void gpiSetInfoCacheFilename( - const char filename[FILENAME_MAX + 1] -) -{ - strzcpy(GPIInfoCacheFilename, filename, sizeof(GPIInfoCacheFilename)); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Blocked List functionality -GPResult -gpiAddToBlockedList( - GPConnection * connection, - int profileid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfile * profile; - int index; - - // Check if profile already in list - /////////////////////////////////// - if(!gpiGetProfile(connection, profileid, &profile)) - { - // It's not, so Add profile - ///////////////////////////////////// - profile = gpiProfileListAdd(connection, profileid); - if(!profile) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - } - else - { - // Already in the list, nix the buddy status if it's a buddy - //////////////////////////////////////////////////////////// - if (profile->buddyStatus) - { - index = profile->buddyStatus->buddyIndex; - freeclear(profile->buddyStatus->statusString); - freeclear(profile->buddyStatus->locationString); - freeclear(profile->buddyStatus); - iconnection->profileList.numBuddies--; - assert(iconnection->profileList.numBuddies >= 0); -#ifndef _PS2 - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)(unsigned long)index); -#else - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)index); -#endif - } - if (profile->buddyStatusInfo) - { - index = profile->buddyStatusInfo->buddyIndex; - freeclear(profile->buddyStatusInfo->richStatus); - freeclear(profile->buddyStatusInfo->gameType); - freeclear(profile->buddyStatusInfo->gameVariant); - freeclear(profile->buddyStatusInfo->gameMapName); - if (profile->buddyStatusInfo->extendedInfoKeys) - { - ArrayFree(profile->buddyStatusInfo->extendedInfoKeys); - profile->buddyStatusInfo->extendedInfoKeys = NULL; - } - freeclear(profile->buddyStatusInfo); - - iconnection->profileList.numBuddies--; - assert(iconnection->profileList.numBuddies >= 0); -#ifndef _PS2 - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)(unsigned long)index); -#else - gpiProfileMap(connection, gpiFixBuddyIndices, (void *)index); -#endif - } - } - - // Set profile as blocked if it wasn't already - ////////////////////////////////////////////// - if (!profile->blocked) - { - profile->blocked = gsi_true; - profile->blockIndex = iconnection->profileList.numBlocked++; - -#ifdef _PS3 - // Only perform if profile isn't already locally blocked and the sync isnt taking place - /////////////////////////////////////////////////////////////////////////////////////// - if (!iconnection->npSyncLock) - gpiAddToNpBlockList(connection, profileid); -#endif - } - - // NOTE: There is no callback for this function simply in order to remain consistent - // with the existing GP structure. If an error occurs, it gets passed to the error callback - // else its considered the request was processed correctly. - - // Add to outgoing buffer - have server handle error check if block already exists (consistency) - ///////////////////////////////////////////////////////////////////////////////////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\addblock\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profileid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -static GPIBool -gpiFixBlockIndices( - GPConnection * connection, - GPIProfile * profile, - void * data -) -{ -#ifndef _PS2 - int baseIndex = (int)(unsigned long)data; -#else - int baseIndex = (int)data; -#endif - - GSI_UNUSED(connection); - - if(profile->blocked && (profile->blockIndex > baseIndex)) - profile->blockIndex--; - return GPITrue; -} - -GPResult -gpiRemoveFromBlockedList( - GPConnection * connection, - int profileid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIProfile * profile; - int index; - - // Grab the profile if already in list - ////////////////////////////////////// - if(gpiGetProfile(connection, profileid, &profile) && profile->blocked) - { - // Set profile as non-blocked - ///////////////////////////// - profile->blocked = gsi_false; - - iconnection->profileList.numBlocked--; - index = profile->blockIndex; - -#ifndef _PS2 - gpiProfileMap(connection, gpiFixBlockIndices, (void *)(unsigned long)index); -#else - gpiProfileMap(connection, gpiFixBlockIndices, (void *)index); -#endif - } - - // NOTE: There is no callback for this function simply in order to remain consistent - // with the existing GP structure. If an error occurs, it gets passed to the error callback - // else its considered the request was processed correctly. - - // Add to outgoing buffer - have server handle error check if block already removed (consistency) - ///////////////////////////////////////////////////////////////////////////////////////////////// - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\removeblock\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, profileid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -static GPIBool -gpiCheckForBlock( - GPConnection * connection, - GPIProfile * profile, - void *udata -) -{ - GPIFindProfileData * data = (GPIFindProfileData *)udata; - if (profile->blocked && data->index == profile->blockIndex) - { - data->profile = profile; - return GPIFalse; - } - - GSI_UNUSED(connection); - - return GPITrue; -} - -GPIProfile * -gpiFindBlockedProfile( - GPConnection * connection, - int blockIndex -) -{ - GPIFindProfileData data; - - data.index = blockIndex; - data.profile = NULL; - - gpiProfileMap(connection, gpiCheckForBlock, &data); - - return data.profile; -} - -GPResult -gpiProcessRecvBlockedList( - GPConnection * connection, - const char * input -) -{ - int i=0, j=0; - int num = 0; - int index = 0; - char c; - char *str = NULL; - char buffer[512]; - GPIProfile * profile; - GPProfile profileid; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // Process Block List Retrieval msg - Format like: - /* =============================================== - \blk\\list\\final\ - =============================================== */ - - if(!gpiValueForKeyWithIndex(input, "\\blk\\", &index, buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - num = atoi(buffer); - - // Check to make sure list is there - /////////////////////////////////// - str = strstr(input, "\\list\\"); - if (str == NULL) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Then increment index to get ready for parsing - //////////////////////////////////////////////// - str += 6; - index += 6; - - for (i=0; i < num; i++) - { - if (i==0) - { - // Manually grab first profile in list - comma delimiter - //////////////////////////////////////////////////////// - for(j=0 ; (j < sizeof(buffer)) && ((c = str[j]) != '\0') && (c != ',') ; j++) - { - buffer[j] = c; - } - buffer[min(j, sizeof(buffer) - 1)] = '\0'; - index += j; - } - else - { - if(!gpiValueForKeyWithIndex(input, ",", &index, buffer, sizeof(buffer))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - } - - profileid = atoi(buffer); - - // Get the profile, adding if needed. - ///////////////////////////////////// - profile = gpiProfileListAdd(connection, profileid); - if(!profile) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Mark as blocked, increment list counter - ////////////////////////////////////////// - profile->blocked = gsi_true; - profile->blockIndex = iconnection->profileList.numBlocked++; - } - - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiProfile.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiProfile.h deleted file mode 100644 index b2b7683dff2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiProfile.h +++ /dev/null @@ -1,229 +0,0 @@ -/* -gpiProfile.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIPROFILE_H_ -#define _GPIPROFILE_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -#define GPI_SIG_LEN 33 - -//TYPES -/////// -// The status for a buddy profile. -////////////////////////////////// - -// New Status Info -typedef struct _GPIBuddyStatusInfo -{ - int buddyIndex; - GPEnum statusState; - char *richStatus; - char *gameType; - char *gameVariant; - char *gameMapName; - unsigned int sessionFlags; - unsigned int buddyIp; - unsigned short buddyPort; - unsigned int hostIp; - unsigned int hostPrivateIp; - unsigned short queryPort; - unsigned short hostPort; - GPEnum quietModeFlags; - int productId; - // New Status Info extended info Keys - DArray extendedInfoKeys; -} GPIBuddyStatusInfo; - -// Old status -typedef struct -{ - int buddyIndex; - GPEnum status; - char * statusString; - char * locationString; - unsigned int ip; - unsigned short port; - GPEnum quietModeFlags; -} GPIBuddyStatus; - -// Profile data. -//////////////// -typedef struct GPIProfile -{ - int profileId; - int userId; - GPIBuddyStatus * buddyStatus; - GPIBuddyStatusInfo *buddyStatusInfo; - GPIInfoCache * cache; - char * authSig; - int requestCount; - char * peerSig; - gsi_bool blocked; - int blockIndex; - gsi_bool buddyOrBlockCache; -} GPIProfile; - -// A list of profiles. -////////////////////// -typedef struct -{ - HashTable profileTable; - int num; - int numBuddies; - int numBlocked; -} GPIProfileList; - -//FUNCTIONS -/////////// -GPIBool -gpiInitProfiles( - GPConnection * connection -); - -GPIProfile * -gpiProfileListAdd( - GPConnection * connection, - int id -); - -GPIBool -gpiGetProfile( - GPConnection * connection, - GPProfile profileid, - GPIProfile ** pProfile -); - -GPResult -gpiProcessNewProfile( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -GPResult -gpiNewProfile( - GPConnection * connection, - const char nick[GP_NICK_LEN], - GPEnum replace, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiProcessDeleteProfle -( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -GPResult gpiDeleteProfile( - GPConnection * connection, - GPCallback callback, - void * param -); - -void -gpiRemoveProfile( - GPConnection * connection, - GPIProfile * profile -); - -void -gpiRemoveProfileByID( - GPConnection * connection, - int profileid -); - -GPResult -gpiLoadDiskProfiles( - GPConnection * connection -); - -GPResult -gpiSaveDiskProfiles( - GPConnection * connection -); - -GPResult -gpiFindProfileByUser( - GPConnection * connection, - char nick[GP_NICK_LEN], - char email[GP_EMAIL_LEN], - GPIProfile ** profile -); - -// return false to stop the mapping -typedef GPIBool -(* gpiProfileMapFunc)( - GPConnection * connection, - GPIProfile * profile, - void * data -); - -GPIBool -gpiProfileMap( - GPConnection * connection, - gpiProfileMapFunc func, - void * data -); - -GPIProfile * -gpiFindBuddy( - GPConnection * connection, - int buddyIndex -); - -void gpiRemoveBuddyStatus(GPIBuddyStatus *buddyStatus); -void gpiRemoveBuddyStatusInfo(GPIBuddyStatusInfo *buddyStatusInfo); - -GPIBool -gpiCanFreeProfile( - GPIProfile * profile -); - -void gpiSetInfoCacheFilename( - const char filename[FILENAME_MAX + 1] -); - -// BLOCK LIST -GPResult -gpiAddToBlockedList( - GPConnection * connection, - int profileid -); - -GPResult -gpiRemoveFromBlockedList( - GPConnection * connection, - int profileid -); - -GPIProfile * -gpiFindBlockedProfile( - GPConnection * connection, - int blockIndex -); - -GPResult -gpiProcessRecvBlockedList( - GPConnection * connection, - const char * input -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiSearch.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiSearch.c deleted file mode 100644 index 52b2a1ee9e5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiSearch.c +++ /dev/null @@ -1,1656 +0,0 @@ -/* -gpiSearch.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include -#include -#include "gpi.h" - -//DEFINES -///////// -// Search Manager Address. -////////////////////////// -#define GPI_SEARCH_MANAGER_NAME "gpsp." GSI_DOMAIN_NAME -#define GPI_SEARCH_MANAGER_PORT 29901 - - -//GLOBALS -///////// -char GPSearchManagerHostname[64] = GPI_SEARCH_MANAGER_NAME; -//char GPSearchManagerHostname[64] = "localhost"; - -//FUNCTIONS -/////////// -static GPResult -gpiStartProfileSearch( - GPConnection * connection, - GPIOperation * operation -) -{ - GPISearchData * data = (GPISearchData*)operation->data; - int rcode; - struct sockaddr_in address; - struct hostent * host; - - // Initialize the buffer. - ///////////////////////// - data->inputBuffer.size = 4096; - data->inputBuffer.buffer = (char *)gsimalloc((unsigned int)data->inputBuffer.size + 1); - if(data->inputBuffer.buffer == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Create the socket. - ///////////////////// - data->sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if(data->sock == INVALID_SOCKET) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error creating a socket."); - - // Make it non-blocking. - //////////////////////// - rcode = SetSockBlocking(data->sock,0); - if(rcode == 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error making a socket non-blocking."); - - // Bind the socket. - /////////////////// - /* - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - rcode = bind(data->sock, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if (gsiSocketIsError(rcode)) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error binding a socket."); - */ - - // Get the server host. - /////////////////////// - host = gethostbyname(GPSearchManagerHostname); - if(host == NULL) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "Could not resolve search mananger host name."); - - // Connect the socket. - ////////////////////// - memset(&address, 0, sizeof(address)); - address.sin_family = AF_INET; - address.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; - assert(address.sin_addr.s_addr != 0); - address.sin_port = htons(GPI_SEARCH_MANAGER_PORT); - rcode = connect(data->sock, (struct sockaddr *)&address, sizeof(struct sockaddr_in)); - if (gsiSocketIsError(rcode)) - { - int error = GOAGetLastError(data->sock); - if((error != WSAEWOULDBLOCK) && (error != WSAEINPROGRESS) && (error != WSAETIMEDOUT) ) - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error connecting a socket."); - } - } - - // We're waiting for the connect to complete. - ///////////////////////////////////////////// - operation->state = GPI_CONNECTING; - data->searchStartTime = current_time(); - return GP_NO_ERROR; -} - -static GPResult -gpiInitSearchData( - GPConnection * connection, - GPISearchData ** searchData, - int type -) -{ - GPISearchData * data; - - // Init the data. - ///////////////// - data = (GPISearchData *)gsimalloc(sizeof(GPISearchData)); - if(data == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - memset(data, 0, sizeof(GPISearchData)); - data->type = type; - data->sock = INVALID_SOCKET; - data->inputBuffer.buffer = NULL; - data->inputBuffer.len = 0; - data->inputBuffer.pos = 0; - data->inputBuffer.size = 0; - data->outputBuffer.len = 0; - data->outputBuffer.pos = 0; - data->outputBuffer.size = 4096; - data->outputBuffer.buffer = (char *)gsimalloc((unsigned int)data->outputBuffer.size + 1); - if(data->outputBuffer.buffer == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - data->processing = GPIFalse; - data->remove = GPIFalse; - - *searchData = data; - - return GP_NO_ERROR; -} - -static GPResult -gpiStartSearch( - GPConnection * connection, - GPISearchData * data, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIOperation * operation; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // One more search. - /////////////////// - iconnection->numSearches++; - - // Create a new operation. - ////////////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_PROFILE_SEARCH, data, &operation, blocking, callback, param)); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartProfileSearch(connection, operation)); - - // Process it if blocking. - ////////////////////////// - if(operation->blocking) - CHECK_RESULT(gpiProcess(connection, operation->id)); - - return GP_NO_ERROR; -} - -GPResult -gpiProfileSearch( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char firstname[GP_FIRSTNAME_LEN], - const char lastname[GP_LASTNAME_LEN], - int icquin, - int skip, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Error check. - /////////////// - if((nick == NULL) || (*nick == '\0')) - if((email == NULL) || (*email == '\0')) - if((firstname == NULL) || (*firstname == '\0')) - if((lastname == NULL) || (*lastname == '\0')) - if(icquin == 0) - if((uniquenick == NULL) || (*uniquenick == '\0')) - Error(connection, GP_PARAMETER_ERROR, "No search criteria."); - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_PROFILE)); - - // Fill in the data. - //////////////////// - if(nick == NULL) - data->nick[0] = '\0'; - else - strzcpy(data->nick, nick, GP_NICK_LEN); - if(uniquenick == NULL) - data->uniquenick[0] = '\0'; - else - strzcpy(data->uniquenick, uniquenick, GP_UNIQUENICK_LEN); - if(email == NULL) - data->email[0] = '\0'; - else - strzcpy(data->email, email, GP_EMAIL_LEN); - _strlwr(data->email); - if(firstname == NULL) - data->firstname[0] = '\0'; - else - strzcpy(data->firstname, firstname, GP_FIRSTNAME_LEN); - if(lastname == NULL) - data->lastname[0] = '\0'; - else - strzcpy(data->lastname, lastname, GP_LASTNAME_LEN); - data->icquin = icquin; - if(skip < 0) - skip = 0; - data->skip = skip; - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult -gpiProfileSearchUniquenick( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const int namespaceIDs[], - int numNamespaces, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Error check. - /////////////// - if((uniquenick == NULL) || (*uniquenick == '\0')) - Error(connection, GP_PARAMETER_ERROR, "No search criteria."); - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_PROFILE_UNIQUENICK)); - - // Fill in the data. - //////////////////// - strzcpy(data->uniquenick, uniquenick, GP_UNIQUENICK_LEN); - if((namespaceIDs != NULL) && (numNamespaces > 0)) - { - data->numNamespaces = min(numNamespaces, GP_MAX_NAMESPACEIDS); - memcpy(data->namespaceIDs, namespaceIDs, sizeof(namespaceIDs[0]) * data->numNamespaces); - } - else - { - data->numNamespaces = 0; - } - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult -gpiIsValidEmail( - GPConnection * connection, - const char email[GP_EMAIL_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Error check. - /////////////// - if((email == NULL) || (*email == '\0') || (strlen(email) >= GP_EMAIL_LEN)) - Error(connection, GP_PARAMETER_ERROR, "Invalid e-mail."); - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_IS_VALID)); - - // Fill in the data. - //////////////////// - strzcpy(data->email, email, GP_EMAIL_LEN); - _strlwr(data->email); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult -gpiGetUserNicks( - GPConnection * connection, - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Error check. - /////////////// - if((email == NULL) || (*email == '\0') || (strlen(email) >= GP_EMAIL_LEN)) - Error(connection, GP_PARAMETER_ERROR, "Invalid e-mail."); - if((password == NULL) || (strlen(password) >= GP_PASSWORD_LEN)) - Error(connection, GP_PARAMETER_ERROR, "Invalid password."); - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_NICKS)); - - // Fill in the data. - //////////////////// - strzcpy(data->email, email, GP_EMAIL_LEN); - _strlwr(data->email); - strzcpy(data->password, password, GP_PASSWORD_LEN); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult -gpiFindPlayers( - GPConnection * connection, - int productID, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_PLAYERS)); - - // Fill in the data. - //////////////////// - data->productID = productID; - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult gpiCheckUser( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_CHECK)); - - // Fill in the data. - //////////////////// - strzcpy(data->email, email, GP_EMAIL_LEN); - _strlwr(data->email); - strzcpy(data->nick, nick, GP_NICK_LEN); - if(password) - strzcpy(data->password, password, GP_PASSWORD_LEN); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult gpiNewUser( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_NEWUSER)); - - // Fill in the data. - //////////////////// - strzcpy(data->email, email, GP_EMAIL_LEN); - strzcpy(data->nick, nick, GP_NICK_LEN); - strzcpy(data->password, password, GP_PASSWORD_LEN); - strzcpy(data->uniquenick, uniquenick, GP_UNIQUENICK_LEN); - if(cdkey) - strzcpy(data->cdkey, cdkey, GP_CDKEY_LEN); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult gpiOthersBuddy( - GPConnection * connection, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_OTHERS_BUDDY)); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult gpiOthersBuddyList( - GPConnection * connection, - int *profiles, - int numOfProfiles, - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_OTHERS_BUDDY_LIST)); - - data->revBuddyProfileIds = profiles; - data->numOfRevBuddyProfiles = numOfProfiles; - - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -GPResult gpiSuggestUniqueNick( - GPConnection * connection, - const char desirednick[GP_NICK_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPISearchData * data; - - // Init the data. - ///////////////// - CHECK_RESULT(gpiInitSearchData(connection, &data, GPI_SEARCH_SUGGEST_UNIQUE)); - - // Fill in the data. - //////////////////// - strzcpy(data->uniquenick, desirednick, GP_UNIQUENICK_LEN); - - // Start the search. - //////////////////// - CHECK_RESULT(gpiStartSearch(connection, data, blocking, callback, param)); - - return GP_NO_ERROR; -} - -static GPResult -gpiProcessSearch( - GPConnection * connection, - GPIOperation * operation -) -{ - int state; - GPISearchData * data; - char key[512]; - char value[512]; - GPIBool done; - int index; - int oldIndex; - GPIBool loop; - GPIBool more; - GPICallback callback; - GPIConnection * iconnection = (GPIConnection*)*connection; - int len; - GPIBool connClosed; - GPResult result; - void * tempPtr; - GPIBool doneParsingMatch; - int rcode; - int pid; - GPProfileSearchMatch * match; - GPUniqueMatch *uniqueNickMatch; - - //password encryption stuff - char passwordenc[GP_PASSWORDENC_LEN]; - - // Get a pointer to the data. - ///////////////////////////// - data = (GPISearchData*)operation->data; - - // Loop if blocking. - //////////////////// - if(operation->blocking) - loop = GPITrue; - else - loop = GPIFalse; - - if (!operation->blocking && (current_time() - data->searchStartTime > GPI_SEARCH_TIMEOUT)) - { - data->remove = GPITrue; - CallbackError(connection, GP_NETWORK_ERROR, GP_SEARCH_TIMED_OUT, "The search timed out"); - } - - do - { - // Send anything that needs to be sent. - /////////////////////////////////////// - CHECK_RESULT(gpiSendFromBuffer(connection, data->sock, &data->outputBuffer, &connClosed, GPITrue, "SM")); - - // Is it connecting? - //////////////////// - if(operation->state == GPI_CONNECTING) - { - // Check the connect state. - /////////////////////////// - CHECK_RESULT(gpiCheckSocketConnect(connection, data->sock, &state)); - - // Check for a failed attempt. - ////////////////////////////// - if(state == GPI_DISCONNECTED) - CallbackError(connection, GP_SERVER_ERROR, GP_SEARCH_CONNECTION_FAILED, "Could not connect to the search manager."); - - // Check if finished connecting. - //////////////////////////////// - if(state == GPI_CONNECTED) - { - // Send a request based on type. - //////////////////////////////// - if(data->type == GPI_SEARCH_PROFILE) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\search\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->profileid); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->partnerID); - if(data->nick[0] != '\0') - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\nick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->nick); - } - if(data->uniquenick[0] != '\0') - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\uniquenick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->uniquenick); - } - if(data->email[0] != '\0') - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\email\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->email); - } - if(data->firstname[0] != '\0') - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\firstname\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->firstname); - } - if(data->lastname[0] != '\0') - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\lastname\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->lastname); - } - if(data->icquin != 0) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\icquin\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->icquin); - } - if(data->skip > 0) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\skip\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->skip); - } - } - else if(data->type == GPI_SEARCH_PROFILE_UNIQUENICK) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\searchunique\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->profileid); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\uniquenick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->uniquenick); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaces\\"); - if(data->numNamespaces > 0) - { - int i; - for(i = 0 ; i < data->numNamespaces ; i++) - { - if(i > 0) - gpiAppendCharToBuffer(connection, &data->outputBuffer, ','); - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->namespaceIDs[i]); - } - } - else - { - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - } - } - else if(data->type == GPI_SEARCH_IS_VALID) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\valid\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\email\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->email); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->partnerID); - } - else if(data->type == GPI_SEARCH_NICKS) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\nicks\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\email\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->email); - - gpiEncodeString(data->password, passwordenc); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\passenc\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, passwordenc); - - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->partnerID); - } - else if(data->type == GPI_SEARCH_PLAYERS) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\pmatch\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->profileid); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\productid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->productID); - } - else if(data->type == GPI_SEARCH_CHECK) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\check\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\nick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->nick); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\email\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->email); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->partnerID); - gpiEncodeString(data->password, passwordenc); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\passenc\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, passwordenc); - } - else if(data->type == GPI_SEARCH_NEWUSER) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\newuser\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\nick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->nick); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\email\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->email); - gpiEncodeString(data->password, passwordenc); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\passenc\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, passwordenc); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\productID\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->productID); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\uniquenick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->uniquenick); - if(data->cdkey[0]) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\cdkey\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->cdkey); - } - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->partnerID); - } - else if(data->type == GPI_SEARCH_OTHERS_BUDDY) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\others\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->profileid); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - } - else if(data->type == GPI_SEARCH_OTHERS_BUDDY_LIST) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\otherslist\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\sesskey\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\profileid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->profileid); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\numopids\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->numOfRevBuddyProfiles); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\opids\\"); - if (data->revBuddyProfileIds) - { - int i; - - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->revBuddyProfileIds[0]); - - for (i = 1; i < data->numOfRevBuddyProfiles; i++) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "|"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, data->revBuddyProfileIds[i]); - } - } - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - } - else if(data->type == GPI_SEARCH_SUGGEST_UNIQUE) - { - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\uniquesearch\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\preferrednick\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, data->uniquenick); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\namespaceid\\"); - gpiAppendIntToBuffer(connection, &data->outputBuffer, iconnection->namespaceID); - } - else - { - assert(0); - } - - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\gamename\\"); - gpiAppendStringToBuffer(connection, &data->outputBuffer, __GSIACGamename); - gpiAppendStringToBuffer(connection, &data->outputBuffer, "\\final\\"); - - // Update the state. - //////////////////// - operation->state = GPI_WAITING; - } - } - // Is it waiting? - ///////////////// - else if(operation->state == GPI_WAITING) - { - // Read from the socket. - //////////////////////// - result = gpiRecvToBuffer(connection, data->sock, &data->inputBuffer, &len, &connClosed, "SM"); - if(result != GP_NO_ERROR) - { - if(result == GP_NETWORK_ERROR) - CallbackError(connection, GP_NETWORK_ERROR, GP_SEARCH_CONNECTION_FAILED, "There was an error reading from the server."); - return result; - } - if (operation->blocking && (current_time() - data->searchStartTime > GPI_SEARCH_TIMEOUT)) - { - data->remove = GPITrue; - CallbackError(connection, GP_NETWORK_ERROR, GP_SEARCH_TIMED_OUT, "The search timed out"); - } - // Is this the end of the response? - /////////////////////////////////// - if(strstr(data->inputBuffer.buffer, "\\final\\") != NULL) - { - // Reset the index. - /////////////////// - index = 0; - - // This operation is finishing up. - ////////////////////////////////// - operation->state = GPI_FINISHING; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, data->inputBuffer.buffer, GPITrue)) - { - data->remove = GPITrue; - return GP_SERVER_ERROR; - } - - // Process it based on type. - //////////////////////////// - if((data->type == GPI_SEARCH_PROFILE) || (data->type == GPI_SEARCH_PROFILE_UNIQUENICK)) - { - GPProfileSearchResponseArg arg; - // Start setting up the arg. - //////////////////////////// - arg.result = GP_NO_ERROR; - arg.numMatches = 0; - arg.matches = NULL; - arg.more = GP_DONE; - - // Parse the message. - ///////////////////// - done = GPIFalse; - do - { - // Read the next key and value. - /////////////////////////////// - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - - // Is the list done? - //////////////////// - if(strcmp(key, "bsrdone") == 0) - { - // Check for more. - ////////////////// - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "more") == 0) - { - // Make sure there are actually more. - ///////////////////////////////////// - if(strcmp(value, "0") != 0) - arg.more = GP_MORE; - } - - // Done. - //////// - done = GPITrue; - } - else if(strcmp(key, "bsr") == 0) - { - // Create a new match. - ////////////////////// - arg.numMatches++; - arg.matches = (GPProfileSearchMatch *)gsirealloc(arg.matches, sizeof(GPProfileSearchMatch) * arg.numMatches); - if(arg.matches == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - match = &arg.matches[arg.numMatches - 1]; - memset(match, 0, sizeof(GPProfileSearchMatch)); - - // Get the profile id. - ////////////////////// - match->profile = atoi(value); - - // PANTS|05.16.00 - // Changed to be order independent, and ignore unrecognized keys. - ///////////////////////////////////////////////////////////////// - - // Read key/value pairs. - //////////////////////// - doneParsingMatch = GPIFalse; - do - { - // Read the next key/value. - /////////////////////////// - oldIndex = index; - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - - // Set the field based on the key. - ////////////////////////////////// -#ifndef GSI_UNICODE - if(strcmp(key, "nick") == 0) - strzcpy(match->nick, value, GP_NICK_LEN); - else if(strcmp(key, "uniquenick") == 0) - strzcpy(match->uniquenick, value, GP_UNIQUENICK_LEN); - else if(strcmp(key, "namespaceid") == 0) - match->namespaceID = atoi(value); - else if(strcmp(key, "firstname") == 0) - strzcpy(match->firstname, value, GP_FIRSTNAME_LEN); - else if(strcmp(key, "lastname") == 0) - strzcpy(match->lastname, value, GP_LASTNAME_LEN); - else if(strcmp(key, "email") == 0) - strzcpy(match->email, value, GP_EMAIL_LEN); - else if((strcmp(key, "bsr") == 0) || (strcmp(key, "bsrdone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#else - if(strcmp(key, "nick") == 0) - UTF8ToUCS2StringLen(value, match->nick, GP_NICK_LEN); - else if(strcmp(key, "uniquenick") == 0) - UTF8ToUCS2StringLen(value, match->uniquenick, GP_UNIQUENICK_LEN); - else if(strcmp(key, "namespaceid") == 0) - match->namespaceID = atoi(value); - else if(strcmp(key, "firstname") == 0) - UTF8ToUCS2StringLen(value, match->firstname, GP_FIRSTNAME_LEN); - else if(strcmp(key, "lastname") == 0) - UTF8ToUCS2StringLen(value, match->lastname, GP_LASTNAME_LEN); - else if(strcmp(key, "email") == 0) - UTF8ToUCS2StringLen(value, match->email, GP_EMAIL_LEN); - else if((strcmp(key, "bsr") == 0) || (strcmp(key, "bsrdone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#endif - } - while(!doneParsingMatch); - } - else - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - } - } while(!done); - - // Save the more state. - /////////////////////// - more = (GPIBool)arg.more; - - // Get the callback. - //////////////////// - callback = operation->callback; - - - // Call the callback. - ///////////////////// - if(callback.callback != NULL) - callback.callback(connection, &arg, callback.param); - - // Start a new operation if they want more matches. - /////////////////////////////////////////////////// - if((more == GP_MORE) && (arg.more == GP_MORE)) - CHECK_RESULT(gpiProfileSearch(connection, data->nick, data->uniquenick, data->email, data->firstname, data->lastname, data->icquin, arg.numMatches + data->skip, (GPEnum)operation->blocking, operation->callback.callback, operation->callback.param)); - - // We're done. - ////////////// - freeclear(arg.matches); - } - else if(data->type == GPI_SEARCH_IS_VALID) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPIsValidEmailResponseArg * arg; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "vr") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - - // Setup the arg. - ///////////////// - arg = (GPIsValidEmailResponseArg *)gsimalloc(sizeof(GPIsValidEmailResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = GP_NO_ERROR; -#ifndef GSI_UNICODE - strzcpy(arg->email, data->email, GP_EMAIL_LEN); -#else - UTF8ToUCS2String(data->email, arg->email); -#endif - if(value[0] == '0') - arg->isValid = GP_INVALID; - else - arg->isValid = GP_VALID; - - // Add the callback. - //////////////////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - } - else if(data->type == GPI_SEARCH_NICKS) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPGetUserNicksResponseArg * arg; - - // Setup the arg. - ///////////////// - arg = (GPGetUserNicksResponseArg *)gsimalloc(sizeof(GPGetUserNicksResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = GP_NO_ERROR; -#ifndef GSI_UNICODE - strcpy(arg->email, data->email); -#else - UTF8ToUCS2String(data->email, arg->email); -#endif - arg->numNicks = 0; - arg->nicks = NULL; - arg->uniquenicks = NULL; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "nr") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - - // Get the nicks. - ///////////////// - done = GPIFalse; - do - { - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "nick") == 0) - { - // Add it. - ////////// -#ifndef GSI_UNICODE - tempPtr = gsirealloc(arg->nicks, sizeof(char *) * (arg->numNicks + 1)); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->nicks = (char **)tempPtr; - tempPtr = gsimalloc(GP_NICK_LEN); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->nicks[arg->numNicks] = (gsi_char*)tempPtr; - strzcpy(arg->nicks[arg->numNicks], value, GP_NICK_LEN); - arg->numNicks++; -#else - tempPtr = gsirealloc(arg->nicks, sizeof(unsigned short *) * (arg->numNicks + 1)); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->nicks = (unsigned short **)tempPtr; - tempPtr = gsimalloc(GP_NICK_LEN * sizeof(unsigned short)); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->nicks[arg->numNicks] = (gsi_char*)tempPtr; - UTF8ToUCS2StringLen(value, arg->nicks[arg->numNicks], GP_NICK_LEN); - arg->numNicks++; -#endif - } - else if(strcmp(key, "uniquenick") == 0) - { - if(arg->numNicks <= 0) - continue; - - // Add it. - ////////// -#ifndef GSI_UNICODE - tempPtr = gsirealloc(arg->uniquenicks, sizeof(char *) * arg->numNicks); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->uniquenicks = (char **)tempPtr; - tempPtr = gsimalloc(GP_UNIQUENICK_LEN); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->uniquenicks[arg->numNicks - 1] = (gsi_char*)tempPtr; - strzcpy(arg->uniquenicks[arg->numNicks - 1], value, GP_UNIQUENICK_LEN); -#else - tempPtr = gsirealloc(arg->uniquenicks, sizeof(unsigned short *) * arg->numNicks); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->uniquenicks = (unsigned short **)tempPtr; - tempPtr = gsimalloc(GP_UNIQUENICK_LEN * sizeof(unsigned short)); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->uniquenicks[arg->numNicks - 1] = (gsi_char*)tempPtr; - UTF8ToUCS2StringLen(value, arg->uniquenicks[arg->numNicks - 1], GP_UNIQUENICK_LEN); -#endif - } - else if(strcmp(key, "ndone") == 0) - { - // Done. - //////// - done = GPITrue; - } - else - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - } - } - while(!done); - - // Do it. - ///////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, GPI_ADD_NICKS)); - } - } - else if(data->type == GPI_SEARCH_PLAYERS) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPFindPlayersResponseArg * arg; - GPFindPlayerMatch * match; - - // Start setting up the arg. - //////////////////////////// - arg = (GPFindPlayersResponseArg *)gsimalloc(sizeof(GPFindPlayersResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->productID = data->productID; - arg->result = GP_NO_ERROR; - arg->numMatches = 0; - arg->matches = NULL; - - // Parse the message. - ///////////////////// - done = GPIFalse; - do - { - // Read the next key and value. - /////////////////////////////// - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - - // Is the list done? - //////////////////// - if(strcmp(key, "psrdone") == 0) - { - // Done. - //////// - done = GPITrue; - } - else if(strcmp(key, "psr") == 0) - { - // Create a new match. - ////////////////////// - arg->numMatches++; - arg->matches = (GPFindPlayerMatch *)gsirealloc(arg->matches, sizeof(GPFindPlayerMatch) * arg->numMatches); - if(arg->matches == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - match = &arg->matches[arg->numMatches - 1]; - memset(match, 0, sizeof(GPFindPlayerMatch)); - match->status = GP_ONLINE; - - // Get the profile id. - ////////////////////// - match->profile = atoi(value); - - // PANTS|05.16.00 - // Changed to be order independent, and ignore unrecognized keys. - ///////////////////////////////////////////////////////////////// - - // Read key/value pairs. - //////////////////////// - doneParsingMatch = GPIFalse; - do - { - // Read the next key/value. - /////////////////////////// - oldIndex = index; - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - -#ifndef GSI_UNICODE - // Set the field based on the key. - ////////////////////////////////// - if(strcmp(key, "status") == 0) - strzcpy(match->statusString, value, GP_STATUS_STRING_LEN); - else if(strcmp(key, "nick") == 0) - strzcpy(match->nick, value, GP_NICK_LEN); - if(strcmp(key, "statuscode") == 0) - match->status = (GPEnum)atoi(value); - else if((strcmp(key, "psr") == 0) || (strcmp(key, "psrdone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#else - // Set the field based on the key. - ////////////////////////////////// - if(strcmp(key, "status") == 0) - UTF8ToUCS2StringLen(value, match->statusString, GP_STATUS_STRING_LEN); - else if(strcmp(key, "nick") == 0) - UTF8ToUCS2StringLen(value, match->nick, GP_NICK_LEN); - if(strcmp(key, "statuscode") == 0) - match->status = (GPEnum)atoi(value); - else if((strcmp(key, "psr") == 0) || (strcmp(key, "psrdone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#endif - } - while(!doneParsingMatch); - } - else - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - } - } while(!done); - - // Do it. - ///////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, GPI_ADD_PMATCH)); - } - } - else if(data->type == GPI_SEARCH_CHECK) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPCheckResponseArg * arg; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "cur") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - - rcode = atoi(value); - if(rcode) - { - iconnection->errorCode = (GPErrorCode)rcode; - pid = 0; - } - else - { - if(!gpiValueForKey(data->inputBuffer.buffer, "\\pid\\", value, sizeof(value))) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - pid = atoi(value); - } - - // Setup the arg. - ///////////////// - arg = (GPCheckResponseArg *)gsimalloc(sizeof(GPCheckResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = (GPResult)rcode; - arg->profile = pid; - - // Add the callback. - //////////////////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - } - else if(data->type == GPI_SEARCH_NEWUSER) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPNewUserResponseArg * arg; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "nur") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - - rcode = atoi(value); - if(rcode) - iconnection->errorCode = (GPErrorCode)rcode; - if(!gpiValueForKey(data->inputBuffer.buffer, "\\pid\\", value, sizeof(value))) - { - if(rcode == 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - pid = 0; - } - else - pid = atoi(value); - - // Setup the arg. - ///////////////// - arg = (GPNewUserResponseArg *)gsimalloc(sizeof(GPNewUserResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = (GPResult)rcode; - arg->profile = pid; - - // Add the callback. - //////////////////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - } - else if(data->type == GPI_SEARCH_OTHERS_BUDDY) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPGetReverseBuddiesResponseArg * arg; - - // Setup the arg. - ///////////////// - arg = (GPGetReverseBuddiesResponseArg *)gsimalloc(sizeof(GPGetReverseBuddiesResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = GP_NO_ERROR; - arg->numProfiles = 0; - arg->profiles = NULL; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "others") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - - // Get the profiles. - ///////////////// - done = GPIFalse; - do - { - // Read the next key and value. - /////////////////////////////// - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - - // Is the list done? - //////////////////// - if(strcmp(key, "odone") == 0) - { - // Done. - //////// - done = GPITrue; - } - else if(strcmp(key, "o") == 0) - { - // Add it. - ////////// - tempPtr = gsirealloc(arg->profiles, sizeof(GPProfileSearchMatch) * (arg->numProfiles + 1)); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->profiles = (GPProfileSearchMatch *)tempPtr; - match = &arg->profiles[arg->numProfiles]; - memset(match, 0, sizeof(GPProfileSearchMatch)); - arg->numProfiles++; - - // Get the profile id. - ////////////////////// - match->profile = atoi(value); - - // Read key/value pairs. - //////////////////////// - doneParsingMatch = GPIFalse; - do - { - // Read the next key/value. - /////////////////////////// - oldIndex = index; - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - -#ifndef GSI_UNICODE - // Set the field based on the key. - ////////////////////////////////// - if(strcmp(key, "nick") == 0) - strzcpy(match->nick, value, GP_NICK_LEN); - else if(strcmp(key, "uniquenick") == 0) - strzcpy(match->uniquenick, value, GP_UNIQUENICK_LEN); - else if(strcmp(key, "first") == 0) - strzcpy(match->firstname, value, GP_FIRSTNAME_LEN); - else if(strcmp(key, "last") == 0) - strzcpy(match->lastname, value, GP_LASTNAME_LEN); - else if(strcmp(key, "email") == 0) - strzcpy(match->email, value, GP_EMAIL_LEN); - else if((strcmp(key, "o") == 0) || (strcmp(key, "odone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#else - // Set the field based on the key. - ////////////////////////////////// - if(strcmp(key, "nick") == 0) - UTF8ToUCS2StringLen(value, match->nick, GP_NICK_LEN); - else if(strcmp(key, "uniquenick") == 0) - UTF8ToUCS2StringLen(value, match->uniquenick, GP_UNIQUENICK_LEN); - else if(strcmp(key, "first") == 0) - UTF8ToUCS2StringLen(value, match->firstname, GP_FIRSTNAME_LEN); - else if(strcmp(key, "last") == 0) - UTF8ToUCS2StringLen(value, match->lastname, GP_LASTNAME_LEN); - else if(strcmp(key, "email") == 0) - UTF8ToUCS2StringLen(value, match->email, GP_EMAIL_LEN); - else if((strcmp(key, "o") == 0) || (strcmp(key, "odone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#endif - } - while(!doneParsingMatch); - } - else - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - } - } - while(!done); - - // Do it. - ///////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, GPI_ADD_REVERSE_BUDDIES)); - } - } - else if (data->type == GPI_SEARCH_OTHERS_BUDDY_LIST) - { - callback = operation->callback; - if(callback.callback != NULL) - { - GPGetReverseBuddiesListResponseArg * arg; - - // Setup the arg. - ///////////////// - arg = (GPGetReverseBuddiesListResponseArg *)gsimalloc(sizeof(GPGetReverseBuddiesListResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = GP_NO_ERROR; - arg->numOfUniqueMatchs = 0; - arg->matches = NULL; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "otherslist") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - - // Get the profiles. - ///////////////// - done = GPIFalse; - do - { - // Read the next key and value. - /////////////////////////////// - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - - // Is the list done? - //////////////////// - if(strcmp(key, "oldone") == 0) - { - // Done. - //////// - done = GPITrue; - } - else if(strcmp(key, "o") == 0) - { - // Add it. - ////////// - tempPtr = gsirealloc(arg->matches, sizeof(GPUniqueMatch) * (arg->numOfUniqueMatchs + 1)); - if(tempPtr == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->matches = (GPUniqueMatch *)tempPtr; - uniqueNickMatch = &arg->matches[arg->numOfUniqueMatchs]; - memset(uniqueNickMatch, 0, sizeof(GPUniqueMatch)); - arg->numOfUniqueMatchs++; - - // Get the profile id. - ////////////////////// - uniqueNickMatch->profile = atoi(value); - - // Read key/value pairs. - //////////////////////// - doneParsingMatch = GPIFalse; - do - { - // Read the next key/value. - /////////////////////////// - oldIndex = index; - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - -#ifndef GSI_UNICODE - // Set the field based on the key. - ////////////////////////////////// - if(strcmp(key, "uniquenick") == 0) - strzcpy(uniqueNickMatch->uniqueNick, value, GP_UNIQUENICK_LEN); - else if((strcmp(key, "o") == 0) || (strcmp(key, "oldone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#else - // Set the field based on the key. - ////////////////////////////////// - if(strcmp(key, "uniquenick") == 0) - UTF8ToUCS2StringLen(value, uniqueNickMatch->uniqueNick, GP_UNIQUENICK_LEN); - else if((strcmp(key, "o") == 0) || (strcmp(key, "oldone") == 0)) - { - doneParsingMatch = GPITrue; - index = oldIndex; - } -#endif - } - while(!doneParsingMatch); - } - else - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - } - } - while(!done); - - // Do it. - ///////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, GPI_ADD_REVERSE_BUDDIES_LIST)); - } - - } - else if(data->type == GPI_SEARCH_SUGGEST_UNIQUE) - { - callback = operation->callback; - if(callback.callback != NULL) - { - int count = 0; - GPSuggestUniqueNickResponseArg * arg; - - // Setup the arg. - ///////////////// - arg = (GPSuggestUniqueNickResponseArg *)gsimalloc(sizeof(GPSuggestUniqueNickResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - arg->result = GP_NO_ERROR; - arg->numSuggestedNicks = 0; - arg->suggestedNicks = NULL; - - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "us") != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - arg->numSuggestedNicks = atoi(value); - - // Allocate memory for the nick array. - ////////////////////////////////////// - arg->suggestedNicks = (gsi_char **)gsimalloc(sizeof(gsi_char *) * arg->numSuggestedNicks); - if(!arg->suggestedNicks) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Get the nicks. - ///////////////// - done = GPIFalse; - do - { - CHECK_RESULT(gpiReadKeyAndValue(connection, data->inputBuffer.buffer, &index, key, value)); - if(strcmp(key, "nick") == 0) - { - // Add it. - ////////// -#ifndef GSI_UNICODE - arg->suggestedNicks[count] = gsimalloc(GP_UNIQUENICK_LEN); - if(arg->suggestedNicks[count] == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - strzcpy(arg->suggestedNicks[count], value, GP_UNIQUENICK_LEN); -#else - arg->suggestedNicks[count] = (unsigned short*)gsimalloc(GP_UNIQUENICK_LEN * sizeof(unsigned short)); - if(arg->suggestedNicks[count] == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - UTF8ToUCS2StringLen(value, arg->suggestedNicks[count], GP_UNIQUENICK_LEN); -#endif - count++; - } - else if(strcmp(key, "usdone") == 0) - { - // Check that the header matches the actual number of nicks. - //////////////////////////////////////////////////////////// - assert(count == arg->numSuggestedNicks); - arg->numSuggestedNicks = count; - - // Done. - //////// - done = GPITrue; - } - else - { - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Error reading from the search server."); - } - } - while(!done); - - // Do it. - ///////// - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, GPI_ADD_SUGGESTED_UNIQUE)); - } - } - else - { - assert(0); - } - - // Flag the operation for removal. - ////////////////////////////////// - data->remove = GPITrue; - - // If we're looping, stop. - ////////////////////////// - loop = GPIFalse; - } - } - //PANTS|05.23.00 - removed sleep - //crt - added it back 6/13/00 - //PANTS|07.10.00 - only sleep if looping - if(loop) - msleep(10); - } while(loop); - - - - return GP_NO_ERROR; -} - -GPResult -gpiProcessSearches( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIOperation ** searchList; - GPIOperation * operation; - GPISearchData * data; - GPResult result; - int num = 0; - int i; - - // Are there any searches? - ////////////////////////// - if(iconnection->numSearches > 0) - { - // Alloc mem for a search list. - /////////////////////////////// - searchList = (GPIOperation **)gsimalloc(sizeof(GPIOperation *) * iconnection->numSearches); - if(searchList == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - // Create the search list. - ////////////////////////// - for(operation = &iconnection->operationList[0] ; operation != NULL ; operation = operation->pnext) - { - // Is this a search? - //////////////////// - if((operation->type == GPI_PROFILE_SEARCH) && (operation->state != GPI_FINISHING)) - { - // Is this search being processed already? - ////////////////////////////////////////// - if(!((GPISearchData *)operation->data)->processing) - { - assert(num < iconnection->numSearches); - searchList[num++] = operation; - ((GPISearchData *)operation->data)->processing = GPITrue; - } - } - } - - // Process the searches. - //////////////////////// - for(i = 0 ; i < num ; i++) - { - result = gpiProcessSearch(connection, searchList[i]); - if(result != GP_NO_ERROR) - searchList[i]->result = result; - } - - // Clear the processing flags, and remove searches that are done. - ///////////////////////////////////////////////////////////////// - for(i = 0 ; i < num ; i++) - { - data = ((GPISearchData *)searchList[i]->data); - data->processing = GPIFalse; - if(data->remove) - gpiRemoveOperation(connection, searchList[i]); - } - - freeclear(searchList); - } - - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiSearch.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiSearch.h deleted file mode 100644 index 1321258826f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiSearch.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -gpiSearch.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPISEARCH_H_ -#define _GPISEARCH_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//TYPES -/////// -#define GPI_SEARCH_PROFILE 1 -#define GPI_SEARCH_IS_VALID 2 -#define GPI_SEARCH_NICKS 3 -#define GPI_SEARCH_PLAYERS 4 -#define GPI_SEARCH_CHECK 5 -#define GPI_SEARCH_NEWUSER 6 -#define GPI_SEARCH_OTHERS_BUDDY 7 -#define GPI_SEARCH_SUGGEST_UNIQUE 8 -#define GPI_SEARCH_OTHERS_BUDDY_LIST 9 -#define GPI_SEARCH_PROFILE_UNIQUENICK 10 - -// A timeout used to abort searches taking too long -#define GPI_SEARCH_TIMEOUT 60000 - -// Profile Search operation data. -///////////////////////////////// -typedef struct -{ - int type; - SOCKET sock; - GPIBuffer inputBuffer; - GPIBuffer outputBuffer; - char nick[GP_NICK_LEN]; - char uniquenick[GP_UNIQUENICK_LEN]; - int namespaceIDs[GP_MAX_NAMESPACEIDS]; - int numNamespaces; - char email[GP_EMAIL_LEN]; - char firstname[GP_FIRSTNAME_LEN]; - char lastname[GP_LASTNAME_LEN]; - char password[GP_PASSWORD_LEN]; - char cdkey[GP_CDKEY_LEN]; - int partnerID; - int icquin; - int skip; - int productID; - GPIBool processing; - GPIBool remove; - gsi_time searchStartTime; - int *revBuddyProfileIds; - int numOfRevBuddyProfiles; -} GPISearchData; - -//FUNCTIONS -/////////// -GPResult -gpiProfileSearch( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char firstname[GP_FIRSTNAME_LEN], - const char lastname[GP_LASTNAME_LEN], - int icquin, - int skip, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult -gpiProfileSearchUniquenick( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const int namespaceIDs[], - int numNamespaces, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult -gpiIsValidEmail( - GPConnection * connection, - const char email[GP_EMAIL_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult -gpiGetUserNicks( - GPConnection * connection, - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult -gpiFindPlayers( - GPConnection * connection, - int productID, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiCheckUser( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiNewUser( - GPConnection * connection, - const char nick[GP_NICK_LEN], - const char uniquenick[GP_UNIQUENICK_LEN], - const char email[GP_EMAIL_LEN], - const char password[GP_PASSWORD_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiOthersBuddy( - GPConnection * connection, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiOthersBuddyList( - GPConnection * connection, - int *profiles, - int numOfProfiles, - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiSuggestUniqueNick( - GPConnection * connection, - const char desirednick[GP_NICK_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult -gpiProcessSearches( - GPConnection * connection -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiTransfer.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiTransfer.c deleted file mode 100644 index e681414978b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiTransfer.c +++ /dev/null @@ -1,2005 +0,0 @@ -/* -gpiTransfer.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4267) //lines: 1363, 1520, 1528, 1529, 1530 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -//INCLUDES -////////// -#include -#ifdef _WIN32 -#include -#endif -#include -#include "gpi.h" - -#define GPI_TRANSFER_VERSION 1 -#define GPI_PEER_TIMEOUT_TIME (1 * 60000) -#define GPI_KEEPALIVE_TIME (4 * 60000) - -//#define GPI_ACKNOWLEDGED_WINDOW (100000 * 1024) -#define GPI_DATA_SIZE (1 * 1024) -//#define GPI_CONFIRM_FILES - -//FUNCTIONS -/////////// -#ifndef NOFILE -static void gpiTransferFree(void * elem) -{ - GPITransfer * transfer = (GPITransfer *)elem; - - if(transfer->message) - freeclear(transfer->message); - - if(transfer->baseDirectory) - gsifree(transfer->baseDirectory); - - if(transfer->files) - { - ArrayFree(transfer->files); - transfer->files = NULL; - } -} - -static int gpiTransferCompare(const void * elem1, const void * elem2) -{ - GPITransfer * transfer1 = (GPITransfer *)elem1; - GPITransfer * transfer2 = (GPITransfer *)elem2; - - return (transfer1->localID - transfer2->localID); -} - -static void gpiFreeFile(void * elem) -{ - GPIFile * file = (GPIFile *)elem; - gsifree(file->path); - gsifree(file->name); - -#ifdef GSI_UNICODE - gsifree(file->path_W); - gsifree(file->name_W); -#endif -} - -static GPResult -gpiFinishTransferMessage( - GPConnection * connection, - GPITransfer * transfer, - const char * message, - int len -) -{ - GPResult result = gpiPeerFinishTransferMessage(connection, transfer->peer, message, len); - - transfer->lastSend = current_time(); - - return result; -} - -GPResult gpiInitTransfers( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - iconnection->transfers = ArrayNew(sizeof(GPITransfer), 0, gpiTransferFree); - if(!iconnection->transfers) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - return GP_NO_ERROR; -} - -void gpiCleanupTransfers( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Free the transfers. - ////////////////////// - if(iconnection->transfers) - { - ArrayFree(iconnection->transfers); - iconnection->transfers = NULL; - } -} - -static GPResult gpiNewTransfer -( - GPConnection * connection, - GPITransfer ** transfer, - GPProfile profile, - GPIBool sender -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPITransfer transferTemp; - - // Fill in the object. - ////////////////////// - memset(&transferTemp, 0, sizeof(GPITransfer)); - transferTemp.files = ArrayNew(sizeof(GPIFile), 0, gpiFreeFile); - if(!transferTemp.files) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - transferTemp.localID = iconnection->nextTransferID++; - transferTemp.sender = sender; - transferTemp.profile = profile; - transferTemp.throttle = -1; - transferTemp.currentFile = -1; - - // Add it. - ////////// - ArrayAppend(iconnection->transfers, &transferTemp); - - // Get it. - ////////// - *transfer = (GPITransfer *)ArrayNth(iconnection->transfers, ArrayLength(iconnection->transfers) - 1); - - return GP_NO_ERROR; -} - -GPResult gpiNewSenderTransfer -( - GPConnection * connection, - GPITransfer ** transfer, - GPProfile profile -) -{ - GPITransfer * pTransfer; - GPIConnection * iconnection = (GPIConnection*)*connection; - unsigned long now; - - CHECK_RESULT(gpiNewTransfer(connection, transfer, profile, GPITrue)); - - now = current_time(); - - pTransfer = *transfer; - pTransfer->state = GPITransferPinging; - pTransfer->transferID.profileid = iconnection->profileid; - pTransfer->transferID.count = pTransfer->localID; - pTransfer->transferID.time = (unsigned int)now; - pTransfer->lastSend = now; - - return GP_NO_ERROR; -} - -static GPResult gpiNewReceiverTransfer -( - GPConnection * connection, - GPITransfer ** transfer, - GPProfile profile, - GPITransferID * transferID -) -{ -#ifdef WIN32 - char buffer[FILENAME_MAX]; -#endif - GPITransfer * pTransfer; - - CHECK_RESULT(gpiNewTransfer(connection, transfer, profile, GPIFalse)); - - pTransfer = *transfer; - pTransfer->state = GPITransferWaiting; - memcpy(&pTransfer->transferID, transferID, sizeof(GPITransferID)); -#ifdef WIN32 - if(GetTempPathA(sizeof(buffer), buffer) != 0) - pTransfer->baseDirectory = goastrdup(buffer); -#endif - - return GP_NO_ERROR; -} - -void gpiFreeTransfer -( - GPConnection * connection, - GPITransfer * transfer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int pos; - - // Find the transfer. - ///////////////////// - pos = ArraySearch(iconnection->transfers, transfer, gpiTransferCompare, 0, 0); - assert(pos != NOT_FOUND); - if(pos == NOT_FOUND) - return; - - // Remove it. - ///////////// - ArrayDeleteAt(iconnection->transfers, pos); -} - -void gpiCancelTransfer -( - GPConnection * connection, - GPITransfer * transfer -) -{ - // Send the cancel message. - /////////////////////////// - if(transfer->peer) - { - // Start the message. - ///////////////////// - if(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_TRANSFER_CANCEL, (GPITransferID_st)&transfer->transferID) == GP_NO_ERROR) - { - // Finish the message. - ////////////////////// - gpiFinishTransferMessage(connection, transfer, NULL, 0); - } - } -} - -void gpiTransferError -( - GPConnection * connection, - const GPITransfer * transfer -) -{ - GPTransferCallbackArg * arg; - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_ERROR; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } -} - -GPIFile * gpiAddFileToTransfer -( - GPITransfer * transfer, - const char * path, - const char * name -) -{ - GPIFile file; - char * str; - - assert(name && name[0]); - - memset(&file, 0, sizeof(GPIFile)); - - // Copy the path. - ///////////////// - if(path) - { - file.path = goastrdup(path); - if(!file.path) - return NULL; - } - - // Copy the name. - ///////////////// - file.name = goastrdup(name); - if(!file.name) - { - gsifree(file.path); - return NULL; - } - - // Change all slashes to backslashes. - ///////////////////////////////////// - while((str = strchr(file.name, '\\')) != NULL) - *str = '/'; - - // Check for a directory. - ///////////////////////// - if(name[strlen(name) - 1] == '/') - file.flags = GPI_FILE_DIRECTORY; - - // No size yet. - /////////////// - file.size = -1; - - // Add it to the list of files. - /////////////////////////////// - ArrayAppend(transfer->files, &file); - -#ifdef GSI_UNICODE - // Copy the unicode versions - file.name_W = UTF8ToUCS2StringAlloc(file.name); - file.path_W = UTF8ToUCS2StringAlloc(file.path); -#endif - - // Return the file. - /////////////////// - return (GPIFile *)ArrayNth(transfer->files, ArrayLength(transfer->files) - 1); -} - -static GPResult gpiSendTransferRequest -( - GPConnection * connection, - GPITransfer * transfer -) -{ - char buffer[32]; - GPIFile * file; - int i; - int num; - - // Get the number of files. - /////////////////////////// - num = ArrayLength(transfer->files); - - // Start the message. - ///////////////////// - CHECK_RESULT(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_SEND_REQUEST, (GPITransferID_st)&transfer->transferID)); - - // Add the rest of the headers. - /////////////////////////////// - sprintf(buffer, "\\version\\%d\\num\\%d", GPI_TRANSFER_VERSION, num); - CHECK_RESULT(gpiSendOrBufferString(connection, transfer->peer, buffer)); - for(i = 0 ; i < num ; i++) - { - file = (GPIFile *)ArrayNth(transfer->files, i); - - sprintf(buffer, "\\name%d\\", i); - CHECK_RESULT(gpiSendOrBufferString(connection, transfer->peer, buffer)); - CHECK_RESULT(gpiSendOrBufferString(connection, transfer->peer, file->name)); - - sprintf(buffer, "\\size%d\\", i); - CHECK_RESULT(gpiSendOrBufferString(connection, transfer->peer, buffer)); - CHECK_RESULT(gpiSendOrBufferInt(connection, transfer->peer, file->size)); - - sprintf(buffer, "\\mtime%d\\", i); - CHECK_RESULT(gpiSendOrBufferString(connection, transfer->peer, buffer)); - CHECK_RESULT(gpiSendOrBufferUInt(connection, transfer->peer, file->modTime)); - } - - // Finish the message. - ////////////////////// - CHECK_RESULT(gpiFinishTransferMessage(connection, transfer, transfer->message, -1)); - - return GP_NO_ERROR; -} - -static GPITransfer * gpiFindTransferByTransferID -( - GPConnection * connection, - GPITransferID * transferID -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int i; - int num; - GPITransfer * transfer; - - num = ArrayLength(iconnection->transfers); - for(i = 0 ; i < num ; i++) - { - transfer = (GPITransfer *)ArrayNth(iconnection->transfers, i); - if(memcmp(&transfer->transferID, transferID, sizeof(GPITransferID)) == 0) - return transfer; - } - - return NULL; -} - -GPITransfer * gpiFindTransferByLocalID -( - GPConnection * connection, - int localID -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int i; - int num; - GPITransfer * transfer; - - num = ArrayLength(iconnection->transfers); - for(i = 0 ; i < num ; i++) - { - transfer = (GPITransfer *)ArrayNth(iconnection->transfers, i); - if(transfer->localID == localID) - return transfer; - } - - return NULL; -} - -int gpiGetTransferLocalIDByIndex -( - GPConnection * connection, - int index -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPITransfer * transfer; - int num; - - num = ArrayLength(iconnection->transfers); - assert(index >= 0); - assert(index < num); - if((index < 0) || (index >= num)) - return -1; - - transfer = (GPITransfer *)ArrayNth(iconnection->transfers, index); - assert(transfer); - if(!transfer) - return -1; - - return transfer->localID; -} - -void gpiSkipFile -( - GPConnection * connection, - GPITransfer * transfer, - int file, - int reason -) -{ - char buffer[32]; - - if(gpiPeerStartTransferMessage(connection, transfer->peer, GP_FILE_SKIP, (GPITransferID_st)&transfer->transferID) != GP_NO_ERROR) - return; - - sprintf(buffer, "\\file\\%d\\reason\\%d", file, reason); - gpiSendOrBufferString(connection, transfer->peer, buffer); - gpiFinishTransferMessage(connection, transfer, NULL, 0); -} - -void gpiSkipCurrentFile -( - GPConnection * connection, - GPITransfer * transfer, - int reason -) -{ - gpiSkipFile(connection, transfer, transfer->currentFile, reason); - - transfer->currentFile++; -} - -static GPIBool gpiHandleSendRequest -( - GPConnection * connection, - GPIPeer * peer, - GPITransferID * transferID, - const char * headers, - const char * buffer, - int bufferLen -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPITransfer * transfer; - GPIFile * file; - GPTransferCallbackArg * arg; - char key[16]; - char intValue[16]; - int version; - int numFiles; - char name[FILENAME_MAX]; - int size; - unsigned int mtime; - int i; - size_t len; - int totalSize = 0; - - // If we don't have a callback, we're not accepting requests. - ///////////////////////////////////////////////////////////// - if(!iconnection->callbacks[GPI_TRANSFER_CALLBACK].callback) - return GPIFalse; - - // Check the version. - ///////////////////// - if(!gpiValueForKey(headers, "\\version\\", intValue, sizeof(intValue))) - return GPIFalse; - version = atoi(intValue); - if(version < 1) - return GPIFalse; - - // Get the number of files. - /////////////////////////// - if(!gpiValueForKey(headers, "\\num\\", intValue, sizeof(intValue))) - return GPIFalse; - numFiles = atoi(intValue); - if(numFiles < 1) - return GPIFalse; - - // Create the transfer object. - ////////////////////////////// - if(gpiNewReceiverTransfer(connection, &transfer, peer->profile, transferID) != GP_NO_ERROR) - return GPIFalse; - - // Set the peer. - //////////////// - transfer->peer = peer; - - // Parse the file list. - /////////////////////// - for(i = 0 ; i < numFiles ; i++) - { - sprintf(key, "\\name%d\\", i); - if(!gpiValueForKey(headers, key, name, sizeof(name))) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - len = strlen(name); - if(strstr(name, "//") || strstr(name, "./") || (name[len - 1] == '.') || (name[0] == '/') || (strcspn(name, ":*?\"<>|\n") != len)) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - - sprintf(key, "\\size%d\\", i); - if(!gpiValueForKey(headers, key, intValue, sizeof(intValue))) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - size = atoi(intValue); - if(size < 0) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - totalSize += size; - - sprintf(key, "\\mtime%d\\", i); - if(!gpiValueForKey(headers, key, intValue, sizeof(intValue))) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - mtime = (unsigned int)strtoul(intValue, NULL, 10); - - file = gpiAddFileToTransfer(transfer, NULL, name); - if(!file) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - file->size = size; - file->modTime = mtime; - } - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(!arg) - { - gpiFreeTransfer(connection, transfer); - return GPIFalse; - } - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_SEND_REQUEST; - arg->num = numFiles; -#ifndef GSI_UNICODE - arg->message = goastrdup(buffer); -#else - arg->message = UTF8ToUCS2StringAlloc(buffer); -#endif - { - GPResult aResult = gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - if (aResult != GP_NO_ERROR) - return GPIFalse; - } - - // Store the total size. - //////////////////////// - transfer->totalSize = totalSize; - - return GPITrue; - - GSI_UNUSED(bufferLen); -} - -static GPIBool gpiHandleSendReply -( - GPConnection * connection, - GPITransfer * transfer, - const char * headers, - const char * buffer, - int bufferLen -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - char intValue[16]; - int version; - int result; - - if(!transfer->sender) - return GPIFalse; - - // Check the version. - //////////////////// - if(!gpiValueForKey(headers, "\\version\\", intValue, sizeof(intValue))) - return GPIFalse; - version = atoi(intValue); - if(version < 1) - return GPIFalse; - - // Get the result. - ////////////////// - if(!gpiValueForKey(headers, "\\result\\", intValue, sizeof(intValue))) - return GPIFalse; - result = atoi(intValue); - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - if(result == GPI_ACCEPTED) - arg->type = GP_TRANSFER_ACCEPTED; - else if(result == GPI_REJECTED) - arg->type = GP_TRANSFER_REJECTED; - else - arg->type = GP_TRANSFER_NOT_ACCEPTING; - -#ifndef GSI_UNICODE - arg->message = goastrdup(buffer); -#else - arg->message = UTF8ToUCS2StringAlloc(buffer); -#endif - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Update transfer state if accepted. - ///////////////////////////////////// - if(result == GPI_ACCEPTED) - { - transfer->state = GPITransferTransferring; - transfer->currentFile = 0; - } - - return GPITrue; - - GSI_UNUSED(bufferLen); -} - -static GPIBool gpiHandleBegin -( - GPConnection * connection, - GPITransfer * transfer, - const char * headers -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - GPIFile * file; - char intValue[16]; - int fileIndex; - int size; - unsigned int mtime; - char buffer[FILENAME_MAX]; - int count; - - if(transfer->sender) - return GPIFalse; - - // Get the file. - //////////////// - if(!gpiValueForKey(headers, "\\file\\", intValue, sizeof(intValue))) - return GPIFalse; - fileIndex = atoi(intValue); - if((fileIndex < 0) || (fileIndex >= ArrayLength(transfer->files))) - return GPIFalse; - if(fileIndex != transfer->currentFile) - return GPIFalse; - file = (GPIFile *)ArrayNth(transfer->files, fileIndex); - - // Is this a directory? - /////////////////////// - if(file->flags & GPI_FILE_DIRECTORY) - return GPIFalse; - - // Get the size. - //////////////// - if(!gpiValueForKey(headers, "\\size\\", intValue, sizeof(intValue))) - return GPIFalse; - size = atoi(intValue); - if(size < 0) - return GPIFalse; - - // Update the total size. - ///////////////////////// - transfer->totalSize -= file->size; - transfer->totalSize += size; - - // Get the mod time. - //////////////////// - if(!gpiValueForKey(headers, "\\mtime\\", intValue, sizeof(intValue))) - return GPIFalse; - mtime = (unsigned int)strtoul(intValue, NULL, 10); - - // Set file stuff. - ////////////////// - MD5Init(&file->md5); - file->modTime = mtime; - file->size = size; - - // Setup the temp path. - /////////////////////// - count = 0; - do - { - sprintf(buffer, "%sgpt_%d_%d_%d.gpt", transfer->baseDirectory, transfer->localID, fileIndex, rand()); - file->file = fopen(buffer, "wb"); - count++; - } - while(!file->file && (count < 5)); - - // Copy off the path. - ///////////////////// - if(file->file) - { - file->path = goastrdup(buffer); - if(!file->path) - return GPIFalse; - -#ifdef GSI_UNICODE - file->path_W = UTF8ToUCS2StringAlloc(file->path); -#endif - } - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = fileIndex; - if(file->file) - { - arg->type = GP_FILE_BEGIN; - } - else - { - arg->type = GP_FILE_FAILED; - arg->num = GP_FILE_WRITE_ERROR; - } - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Did it fail? - /////////////// - if(!file->file) - { - gpiSkipCurrentFile(connection, transfer, GPI_SKIP_WRITE_ERROR); - file->flags |= GPI_FILE_FAILED; - file->reason = GP_FILE_WRITE_ERROR; - } - - return GPITrue; -} - -static GPIBool gpiHandleEnd -( - GPConnection * connection, - GPITransfer * transfer, - const char * headers -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - GPIFile * file; - GPIBool md5Failed = GPITrue; - unsigned char rawMD5[16]; - char localMD5[33]; - char remoteMD5[33]; - char intValue[16]; - int fileIndex; - - if(transfer->currentFile == -1) - return GPIFalse; - - // Check the file index. - //////////////////////// - if(!gpiValueForKey(headers, "\\file\\", intValue, sizeof(intValue))) - return GPIFalse; - fileIndex = atoi(intValue); - if((fileIndex < 0) || (fileIndex >= ArrayLength(transfer->files))) - return GPIFalse; - if(fileIndex != transfer->currentFile) - return GPITrue; - - // Get the current file. - //////////////////////// - file = (GPIFile *)ArrayNth(transfer->files, transfer->currentFile); - - // Sender? - ////////// - if(transfer->sender) - { -#ifdef GPI_CONFIRM_FILES - // We should be waiting for confirmation. - ///////////////////////////////////////// - assert(file->flags & GPI_FILE_CONFIRMING); - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_END; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Done with the file. - ////////////////////// - file->flags &= ~GPI_FILE_CONFIRMING; - file->flags |= GPI_FILE_COMPLETED; - transfer->currentFile++; -#endif - return GPITrue; - } - - // Is this a directory? - /////////////////////// - if(file->flags & GPI_FILE_DIRECTORY) - { - // Directory completed. - /////////////////////// - file->flags |= GPI_FILE_COMPLETED; - } - else - { - // Check the file. - ////////////////// - assert(file->file); - if(!file->file) - return GPIFalse; - - // Get the remote md5. - ////////////////////// - if(!gpiValueForKey(headers, "\\md5\\", remoteMD5, sizeof(remoteMD5))) - return GPIFalse; - - // Get the local md5. - ///////////////////// - MD5Final(rawMD5, &file->md5); - MD5Print(rawMD5, localMD5); - - // Check the md5. - ///////////////// - md5Failed = (memcmp(localMD5, remoteMD5, 32) != 0) ? GPITrue:GPIFalse; - - // Set the state. - ///////////////// - if(md5Failed) - { - file->flags |= GPI_FILE_FAILED; - file->reason = GP_FILE_DATA_ERROR; - } - else - file->flags |= GPI_FILE_COMPLETED; - - // Close the file. - ////////////////// - fclose(file->file); - file->file = NULL; - - // If the md5 failed, remove the file. - ////////////////////////////////////// - if(md5Failed) - remove(file->path); - -#ifdef GPI_CONFIRM_FILES - // Send a confirmation. - /////////////////////// - if(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_END, (GPITransferID_st)&transfer->transferID) != GP_NO_ERROR) - return GPIFalse; - gpiFinishTransferMessage(connection, transfer, NULL, 0); -#endif - } - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - if(file->flags & GPI_FILE_DIRECTORY) - { - arg->type = GP_FILE_DIRECTORY; - } - else if(md5Failed) - { - arg->type = GP_FILE_FAILED; - arg->num = GP_FILE_DATA_ERROR; - } - else - { - arg->type = GP_FILE_END; - } - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Next file. - ///////////// - transfer->currentFile++; - - // Done? - //////// - if(transfer->currentFile == ArrayLength(transfer->files)) - { - // The transfer is complete. - //////////////////////////// - transfer->state = GPITransferComplete; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_DONE; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - } - - return GPITrue; -} - -static GPIBool gpiHandleData -( - GPConnection * connection, - GPITransfer * transfer, - const char * headers, - const char * buffer, - int bufferLen -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - GPIFile * file; - GPIBool writeFailed; - char intValue[16]; - int fileIndex; - - if(transfer->currentFile == -1) - return GPIFalse; - - // Check the file index. - //////////////////////// - if(!gpiValueForKey(headers, "\\file\\", intValue, sizeof(intValue))) - return GPIFalse; - fileIndex = atoi(intValue); - if((fileIndex < 0) || (fileIndex >= ArrayLength(transfer->files))) - return GPIFalse; - if(fileIndex != transfer->currentFile) - return GPITrue; - - // Get the current file. - //////////////////////// - file = (GPIFile *)ArrayNth(transfer->files, transfer->currentFile); - - // Is this a directory? - /////////////////////// - if(file->flags & GPI_FILE_DIRECTORY) - return GPIFalse; - -#ifdef GPI_ACKNOWLEDGED_WINDOW - // Sender? - ////////// - if(transfer->sender) - { - char intValue[16]; - - // Get the progress. - //////////////////// - if(!gpiValueForKey(headers, "\\pro\\", intValue, sizeof(intValue))) - return GPIFalse; - file->acknowledged = atoi(intValue); - - return GPITrue; - } -#endif - - // Check the file. - ////////////////// - assert(file->file); - if(!file->file) - return GPIFalse; - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_RawDump, - "HNDLDATA(PT): %d\n", bufferLen); - - // Write the data. - ////////////////// - writeFailed = (GPIBool)(fwrite(buffer, 1, bufferLen, file->file) != (size_t)bufferLen); - if(writeFailed) - { - // Flag the errors. - /////////////////// - file->flags |= GPI_FILE_FAILED; - file->reason = GP_FILE_WRITE_ERROR; - - // Remove the file. - /////////////////// - fclose(file->file); - file->file = NULL; - remove(file->path); - } - else - { - // Update the MD5. - /////////////////// - MD5Update(&file->md5, (unsigned char *)buffer, bufferLen); - - // Update the progress. - /////////////////////// - file->progress += bufferLen; - transfer->progress += bufferLen; - -#ifdef GPI_ACKNOWLEDGED_WINDOW - // Send an acknowledgment. - ////////////////////////// - if(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_DATA, (GPITransferID_st)&transfer->transferID) != GP_NO_ERROR) - return GPIFalse; - gpiSendOrBufferString(connection, transfer->peer, "\\pro\\"); - gpiSendOrBufferInt(connection, transfer->peer, file->progress); - gpiFinishTransferMessage(connection, transfer, NULL, 0); -#endif - } - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - if(!writeFailed) - { - arg->type = GP_FILE_PROGRESS; - arg->num = file->progress; - } - else - { - arg->type = GP_FILE_FAILED; - arg->num = GP_FILE_WRITE_ERROR; - } - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Did it fail? - /////////////// - if(writeFailed) - { - // Skip the file. - ///////////////// - gpiSkipCurrentFile(connection, transfer, GPI_SKIP_WRITE_ERROR); - } - - return GPITrue; -} - -static GPIBool gpiHandleSkip -( - GPConnection * connection, - GPITransfer * transfer, - const char * headers -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - GPIFile * file; - char intValue[16]; - int fileIndex; - int reason; - - // Get the file. - //////////////// - if(!gpiValueForKey(headers, "\\file\\", intValue, sizeof(intValue))) - return GPIFalse; - fileIndex = atoi(intValue); - if((fileIndex < 0) || (fileIndex >= ArrayLength(transfer->files))) - return GPIFalse; - file = (GPIFile *)ArrayNth(transfer->files, fileIndex); - - // Get the reason. - ////////////////// - if(!gpiValueForKey(headers, "\\reason\\", intValue, sizeof(intValue))) - return GPIFalse; - reason = atoi(intValue); - - // Is it not the current file? - ////////////////////////////// - if(fileIndex != transfer->currentFile) - { - // Check if we already finished this file. - ////////////////////////////////////////// - if(fileIndex < transfer->currentFile) - return GPIFalse; - - // Mark it for skipping later. - ////////////////////////////// - if(reason == GPI_SKIP_USER_SKIP) - { - file->flags |= GPI_FILE_SKIP; - } - else - { - file->flags |= GPI_FILE_FAILED; - if(reason == GPI_SKIP_READ_ERROR) - file->reason = GP_FILE_READ_ERROR; - else - file->reason = GP_FILE_WRITE_ERROR; - } - - return GPITrue; - } - - // Delete the file if its already opened. - ///////////////////////////////////////// - if(!transfer->sender && file->file) - { - fclose(file->file); - file->file = NULL; - remove(file->path); - } - - // Next file. - ///////////// - transfer->currentFile++; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = fileIndex; - if(reason == GPI_SKIP_USER_SKIP) - { - arg->type = GP_FILE_SKIP; - } - else - { - arg->type = GP_FILE_FAILED; - if(reason == GPI_SKIP_READ_ERROR) - arg->num = GP_FILE_READ_ERROR; - else - arg->num = GP_FILE_WRITE_ERROR; - } - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - return GPITrue; -} - -static GPIBool gpiHandleTransferThrottle -( - GPConnection * connection, - GPITransfer * transfer, - const char * headers -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int throttle; - char intValue[16]; - GPTransferCallbackArg * arg; - - // Get the throttle. - //////////////////// - if(!gpiValueForKey(headers, "\\rate\\", intValue, sizeof(intValue))) - return GPIFalse; - throttle = atoi(intValue); - - // Store the throttle. - ////////////////////// - transfer->throttle = throttle; - - // If we're the sender, send this back. - /////////////////////////////////////// - if(transfer->sender) - { - if(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_TRANSFER_THROTTLE, (GPITransferID_st)&transfer->transferID) != GP_NO_ERROR) - return GPIFalse; - gpiSendOrBufferString(connection, transfer->peer, "\\rate\\"); - gpiSendOrBufferInt(connection, transfer->peer, throttle); - gpiFinishTransferMessage(connection, transfer, NULL, 0); - } - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_THROTTLE; - arg->num = throttle; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - return GPITrue; -} - -static GPIBool gpiHandleTransferCancel -( - GPConnection * connection, - GPITransfer * transfer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - -// if(transfer->sender) -// return GPIFalse; - - // Mark the transfer cancelled. - /////////////////////////////// - transfer->state = GPITransferCancelled; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_CANCELLED; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - return GPITrue; -} - -static GPIBool gpiHandleTransferKeepalive -( - GPConnection * connection, - GPITransfer * transfer -) -{ - GSI_UNUSED(connection); - GSI_UNUSED(transfer); - - // Ignore keep-alive. - ///////////////////// - return GPITrue; -} - -static GPResult gpiSendFileEnd -( - GPConnection * connection, - GPITransfer * transfer, - GPIFile * file -) -{ - CHECK_RESULT(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_END, (GPITransferID_st)&transfer->transferID)); - - // Add the file index. - ////////////////////// - gpiSendOrBufferStringLenToPeer(connection, transfer->peer, "\\file\\", 6); - gpiSendOrBufferInt(connection, transfer->peer, transfer->currentFile); - - // Only add the MD5 for files. - ////////////////////////////// - if(!(file->flags & GPI_FILE_DIRECTORY)) - { - unsigned char md5Raw[16]; - char md5[33]; - - // Get the MD5. - /////////////// - MD5Final(md5Raw, &file->md5); - MD5Print(md5Raw, md5); - - // Add it. - ////////// - gpiSendOrBufferString(connection, transfer->peer, "\\md5\\"); - gpiSendOrBufferString(connection, transfer->peer, md5); - } - - gpiFinishTransferMessage(connection, transfer, NULL, 0); - - return GP_NO_ERROR; -} - -static GPResult gpiSendFileBegin -( - GPConnection * connection, - GPITransfer * transfer, - GPIFile * file -) -{ - char buffer[64]; - - // Get the file info. - ///////////////////// - if(!gpiGetTransferFileInfo(file->file, &file->size, &file->modTime)) - Error(connection, GP_PARAMETER_ERROR, "Can't get info on file."); - - CHECK_RESULT(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_BEGIN, (GPITransferID_st)&transfer->transferID)); - sprintf(buffer, "\\file\\%d\\size\\%d\\mtime\\%u", transfer->currentFile, file->size, (unsigned int)file->modTime); - gpiSendOrBufferString(connection, transfer->peer, buffer); - gpiFinishTransferMessage(connection, transfer, NULL, 0); - - return GP_NO_ERROR; -} - -static GPResult gpiSendFileData -( - GPConnection * connection, - GPITransfer * transfer, - unsigned char * data, - size_t len -) -{ - CHECK_RESULT(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_DATA, (GPITransferID_st)&transfer->transferID)); - - // Add the file index. - ////////////////////// - gpiSendOrBufferStringLenToPeer(connection, transfer->peer, "\\file\\", 6); - gpiSendOrBufferInt(connection, transfer->peer, transfer->currentFile); - - gpiFinishTransferMessage(connection, transfer, (char *)data, len); - - return GP_NO_ERROR; -} - -GPResult gpiProcessCurrentFile -( - GPConnection * connection, - GPITransfer * transfer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPIFile * file; - GPTransferCallbackArg * arg; - size_t num; - int i; - int total; - - assert(transfer->currentFile >= 0); - assert(transfer->currentFile < ArrayLength(transfer->files)); - - // Get the current file. - //////////////////////// - file = (GPIFile *)ArrayNth(transfer->files, transfer->currentFile); - - assert(!(file->flags & GPI_FILE_FAILED)); - -#ifdef GPI_CONFIRM_FILES - // If it's being confirmed, just wait. - ////////////////////////////////////// - if(file->flags & GPI_FILE_CONFIRMING) - return GP_NO_ERROR; -#endif - - // Check if its been marked for skipping. - ///////////////////////////////////////// - if(file->flags & GPI_FILE_SKIP) - { - // Skip it. - /////////// - gpiSkipCurrentFile(connection, transfer, GPI_SKIP_USER_SKIP); - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_SKIP; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - } - else - { - // Is this a directory? - /////////////////////// - if(file->flags & GPI_FILE_DIRECTORY) - { - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_DIRECTORY; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Send the end. - //////////////// - gpiSendFileEnd(connection, transfer, file); - file->flags |= GPI_FILE_COMPLETED; - transfer->currentFile++; - } - else - { - static char buffer[GPI_DATA_SIZE]; - - // Open the file if we need to. - /////////////////////////////// - if(!file->file) - { - // Open it. - /////////// - file->file = fopen(file->path, "rb"); - if(file->file) - { - // Send the begin. - ////////////////// - CHECK_RESULT(gpiSendFileBegin(connection, transfer, file)); - - // Init the md5. - //////////////// - MD5Init(&file->md5); - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_BEGIN; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - } - else - { - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_FAILED; - arg->num = GP_FILE_READ_ERROR; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Failed to open. - ////////////////// - gpiSkipCurrentFile(connection, transfer, GPI_SKIP_READ_ERROR); - file->flags |= GPI_FILE_FAILED; - file->reason = GP_FILE_READ_ERROR; - - return GP_NO_ERROR; - } - } - - // TODO: THROTTLING - - // Send until done, and while messages are actually being sent. - /////////////////////////////////////////////////////////////// - total = 0; - for(i = 0 ; (file->progress < file->size) && !transfer->peer->outputBuffer.len /*&& (i < 20)*/ ; i++) - { -#ifdef GPI_ACKNOWLEDGED_WINDOW - // Don't get too far ahead. - /////////////////////////// - if((file->acknowledged + GPI_ACKNOWLEDGED_WINDOW) < file->progress) - break; -#endif - - // Read data. - ///////////// - num = fread(buffer, 1, sizeof(buffer), file->file); - if(num) - { - // Update the md5. - ////////////////// - MD5Update(&file->md5, (unsigned char*)buffer, num); - - // Send the data. - ///////////////// - CHECK_RESULT(gpiSendFileData(connection, transfer, (unsigned char*)buffer, num)); - - // Update progress. - /////////////////// - transfer->progress += num; - file->progress += num; - total += num; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_PROGRESS; - arg->num = file->progress; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - } - - // Did we not get to the end? - ///////////////////////////// - if((num < sizeof(buffer)) && (file->progress != file->size)) - { - // Failed reading. - ////////////////// - gpiSkipCurrentFile(connection, transfer, GPI_SKIP_READ_ERROR); - file->flags |= GPI_FILE_FAILED; - file->reason = GP_FILE_READ_ERROR; - - return GP_NO_ERROR; - } - } - - if(total) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_File, GSIDebugLevel_RawDump, - "SENTTOTL(PT): %d\n", total); - } - - // Did we finish the file? - ////////////////////////// - if(file->progress == file->size) - { - // Close the file. - ////////////////// - fclose(file->file); - file->file = NULL; - - // Send the end. - //////////////// - gpiSendFileEnd(connection, transfer, file); - -#ifdef GPI_CONFIRM_FILES - // Wait for the confirmation. - ///////////////////////////// - file->flags |= GPI_FILE_CONFIRMING; -#else - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->index = transfer->currentFile; - arg->type = GP_FILE_END; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Done with the file. - ////////////////////// - file->flags |= GPI_FILE_COMPLETED; - transfer->currentFile++; -#endif - } - } - } - - return GP_NO_ERROR; -} - -GPResult gpiProcessTransfer -( - GPConnection * connection, - GPITransfer * transfer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int currentFile; - int len; - GPTransferCallbackArg * arg; - unsigned long now; - - // We only process sending transfers. - ///////////////////////////////////// - if(!transfer->sender) - return GP_NO_ERROR; - - // Is the transfer finished? - //////////////////////////// - if(transfer->state >= GPITransferComplete) - return GP_NO_ERROR; - - // Get the time. - //////////////// - now = current_time(); - - // Check for no peer connection established. - //////////////////////////////////////////// - if(!transfer->peer) - { - // If its been too long, the person probably isn't really online. - ///////////////////////////////////////////////////////////////// - if((now - transfer->lastSend) > GPI_PEER_TIMEOUT_TIME) - { - GPTransferCallbackArg * arg; - - // We couldn't connect. - /////////////////////// - transfer->state = GPITransferNoConnection; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_NO_CONNECTION; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - return GP_NO_ERROR; - } - } - else - { - // Check for inactivity. - //////////////////////// - if((now - transfer->lastSend) > GPI_KEEPALIVE_TIME) - { - // Send a keepalive. - //////////////////// - CHECK_RESULT(gpiPeerStartTransferMessage(connection, transfer->peer, GPI_BM_FILE_TRANSFER_KEEPALIVE, (GPITransferID_st)&transfer->transferID)); - gpiFinishTransferMessage(connection, transfer, NULL, 0); - } - } - - // If we're paused, there's nothing else to do. - /////////////////////////////////////////////// - if(transfer->throttle == 0) - return GP_NO_ERROR; - - // Don't send files if we're not transfering yet. - ////////////////////////////////////////////////// - if(transfer->state < GPITransferTransferring) - return GP_NO_ERROR; - - // Don't send files if we have regular messages pending. - //////////////////////////////////////////////////////// - if(ArrayLength(transfer->peer->messages)) - return GP_NO_ERROR; - - // Process the current file. - //////////////////////////// - len = ArrayLength(transfer->files); - while(transfer->currentFile < len) - { - currentFile = transfer->currentFile; - CHECK_RESULT(gpiProcessCurrentFile(connection, transfer)); - if(currentFile == transfer->currentFile) - break; - } - - // Did we finish? - ///////////////// - if(transfer->currentFile == len) - { - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_DONE; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // Mark it as complete. - /////////////////////// - transfer->state = GPITransferComplete; - } - - return GP_NO_ERROR; -} - -GPResult gpiProcessTransfers -( - GPConnection * connection -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - int len; - int i; - GPITransfer * transfer; - - // Go through each transfer. - //////////////////////////// - len = ArrayLength(iconnection->transfers); - for(i = 0 ; i < len ; i++) - { - // Get the transfer. - //////////////////// - transfer = (GPITransfer *)ArrayNth(iconnection->transfers, i); - - // Process it. - ////////////// - gpiProcessTransfer(connection, transfer); - } - - return GP_NO_ERROR; -} - -GPIBool gpiGetTransferFileInfo -( - FILE * file, - int * size, - gsi_time * modTime -) -{ -#ifdef _WIN32 - struct _stat stats; - - if(_fstat(_fileno(file), &stats) != 0) - return GPIFalse; - - *size = (int)stats.st_size; - *modTime = (gsi_time)stats.st_mtime; -#else - if(fseek(file, 0, SEEK_END) != 0) - return GPIFalse; - - *size = (int)ftell(file); - if(*size == -1) - return GPIFalse; - - *modTime = 0; - - fseek(file, 0, SEEK_SET); -#endif - - return GPITrue; -} - -void gpiTransferPeerDestroyed -( - GPConnection * connection, - GPIPeer * peer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPTransferCallbackArg * arg; - GPITransfer * transfer; - int i; - int len; - - // Search for transfers that use this peer. - /////////////////////////////////////////// - len = ArrayLength(iconnection->transfers); - for(i = 0 ; i < len ; i++) - { - transfer = (GPITransfer *)ArrayNth(iconnection->transfers, i); - - if (transfer->peer == peer) - { - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_LOST_CONNECTION; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - - // So long tranfer. - /////////////////// - transfer->state = GPITransferNoConnection; - } - } - -} - -void gpiTransfersHandlePong -( - GPConnection * connection, - GPProfile profile, - GPIPeer * peer -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - GPITransfer * transfer; - int i; - int len; - - // Go through all the transfers. - //////////////////////////////// - len = ArrayLength(iconnection->transfers); - for(i = 0 ; i < len ; i++) - { - // Get this transfer. - ///////////////////// - transfer = (GPITransfer *)ArrayNth(iconnection->transfers, i); - assert(transfer); - - // Is it waiting on a pong from this profile? - ///////////////////////////////////////////// - if((transfer->state == GPITransferPinging) && (transfer->profile == profile)) - { - // Did we not get a connection? - /////////////////////////////// - if(!peer) - { - GPTransferCallbackArg * arg; - - // We couldn't connect. - /////////////////////// - transfer->state = GPITransferNoConnection; - - // Call the callback. - ///////////////////// - arg = (GPTransferCallbackArg *)gsimalloc(sizeof(GPTransferCallbackArg)); - if(arg) - { - memset(arg, 0, sizeof(GPTransferCallbackArg)); - arg->transfer = transfer->localID; - arg->type = GP_TRANSFER_NO_CONNECTION; - gpiAddCallback(connection, iconnection->callbacks[GPI_TRANSFER_CALLBACK], arg, NULL, GPI_ADD_TRANSFER_CALLBACK); - } - } - else - { - // Store the peer we're connected on. - ///////////////////////////////////// - transfer->peer = peer; - - // We're connected, so send our request. - //////////////////////////////////////// - gpiSendTransferRequest(connection, transfer); - - // Waiting for a response. - ////////////////////////// - transfer->state = GPITransferWaiting; - } - } - } -} -#endif - -GPResult gpiSendTransferReply -( - GPConnection * connection, - const GPITransferID * transferID, - GPIPeer * peer, - int result, - const char * msg -) -{ - char buffer[32]; - - if(!msg) - msg = ""; - - // Start the message. - ///////////////////// - CHECK_RESULT(gpiPeerStartTransferMessage(connection, peer, GPI_BM_FILE_SEND_REPLY, transferID)); - - // Add the rest of the headers. - /////////////////////////////// - sprintf(buffer, "\\version\\%d\\result\\%d", GPI_TRANSFER_VERSION, result); - CHECK_RESULT(gpiSendOrBufferString(connection, peer, buffer)); - - // Finish the message. - ////////////////////// - CHECK_RESULT(gpiPeerFinishTransferMessage(connection, peer, msg, -1)); - - return GP_NO_ERROR; -} - -void gpiHandleTransferMessage -( - GPConnection * connection, - GPIPeer * peer, - int type, - const char * headers, - const char * buffer, - int len -) -{ - char value[64]; - GPITransferID transferID; -#ifndef NOFILE - GPITransfer * transfer; - GPIBool success; -#endif - - // Get the transfer ID. - /////////////////////// - if(!gpiValueForKey(headers, "\\xfer\\", value, sizeof(value))) - return; - if(sscanf(value, "%d %u %u", &transferID.profileid, &transferID.count, &transferID.time) != 3) - return; - -#ifdef NOFILE - gpiSendTransferReply(connection, &transferID, peer, GPI_NOT_ACCEPTING, NULL); -#else - - // Send request messages don't yet have a transfer object. - ////////////////////////////////////////////////////////// - if(type == GPI_BM_FILE_SEND_REQUEST) - { - // Check for not accepting connections. - /////////////////////////////////////// - if(!gpiHandleSendRequest(connection, peer, &transferID, headers, buffer, len)) - gpiSendTransferReply(connection, &transferID, peer, GPI_NOT_ACCEPTING, NULL); - - return; - } - - // Find the transfer based on the ID. - ///////////////////////////////////// - transfer = gpiFindTransferByTransferID(connection, &transferID); - if(!transfer || (transfer->peer != peer)) - return; - - // Handle it based on the type. - /////////////////////////////// - switch(type) - { - case GPI_BM_FILE_SEND_REPLY: - success = gpiHandleSendReply(connection, transfer, headers, buffer, len); - break; - case GPI_BM_FILE_BEGIN: - success = gpiHandleBegin(connection, transfer, headers); - break; - case GPI_BM_FILE_END: - success = gpiHandleEnd(connection, transfer, headers); - break; - case GPI_BM_FILE_DATA: - success = gpiHandleData(connection, transfer, headers, buffer, len); - break; - case GPI_BM_FILE_SKIP: - success = gpiHandleSkip(connection, transfer, headers); - break; - case GPI_BM_FILE_TRANSFER_THROTTLE: - success = gpiHandleTransferThrottle(connection, transfer, headers); - break; - case GPI_BM_FILE_TRANSFER_CANCEL: - success = gpiHandleTransferCancel(connection, transfer); - break; - case GPI_BM_FILE_TRANSFER_KEEPALIVE: - success = gpiHandleTransferKeepalive(connection, transfer); - break; - default: - success = GPITrue; - } - - // Check if there was a transfer error. - /////////////////////////////////////// - if(!success) - gpiTransferError(connection, transfer); -#endif - - GSI_UNUSED(type); - GSI_UNUSED(buffer); - GSI_UNUSED(len); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiTransfer.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiTransfer.h deleted file mode 100644 index 630a6e36ec5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiTransfer.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -gpiTransfer.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPITRANSFER_H_ -#define _GPITRANSFER_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -#define GPI_FILE_DIRECTORY (1 << 1) -#define GPI_FILE_SKIP (1 << 2) -#define GPI_FILE_FAILED (1 << 3) -#define GPI_FILE_COMPLETED (1 << 4) -#define GPI_FILE_CONFIRMING (1 << 5) - -#define GPI_ACCEPTED 0 -#define GPI_REJECTED 1 -#define GPI_NOT_ACCEPTING 2 - -#define GPI_SKIP_READ_ERROR 0 -#define GPI_SKIP_WRITE_ERROR 1 -#define GPI_SKIP_USER_SKIP 2 - -//TYPES -/////// -typedef enum -{ - GPITransferPinging, - GPITransferWaiting, - GPITransferTransferring, - GPITransferComplete, - GPITransferCancelled, - GPITransferNoConnection -} GPITransferState; - -typedef struct GPITransferID_s -{ - int profileid; - unsigned int count; - unsigned int time; -} GPITransferID; - -typedef struct -{ - GPITransferState state; - DArray files; - GPITransferID transferID; - int localID; - GPIBool sender; - GPProfile profile; - GPIPeer * peer; - int currentFile; - int throttle; - char * baseDirectory; - unsigned long lastSend; - char * message; - int totalSize; - int progress; - void * userData; -} GPITransfer; - -typedef struct -{ - char * path; - char * name; - -#ifdef GSI_UNICODE - unsigned short* name_W; // must have this since developers are given pointers to internal memory - unsigned short* path_W; -#endif - - int progress; - int size; - int acknowledged; - FILE * file; - int flags; - gsi_time modTime; - MD5_CTX md5; - int reason; -} GPIFile; - -//FUNCTIONS -/////////// -#ifndef NOFILE -GPResult gpiInitTransfers( - GPConnection * connection -); - -void gpiCleanupTransfers( - GPConnection * connection -); - -GPResult gpiProcessTransfers -( - GPConnection * connection -); - -GPResult gpiNewSenderTransfer -( - GPConnection * connection, - GPITransfer ** transfer, - GPProfile profile -); - -void gpiFreeTransfer -( - GPConnection * connection, - GPITransfer * transfer -); - -void gpiCancelTransfer -( - GPConnection * connection, - GPITransfer * transfer -); - -void gpiTransferError -( - GPConnection * connection, - const GPITransfer * transfer -); - -GPITransfer * gpiFindTransferByLocalID -( - GPConnection * connection, - int localID -); - -int gpiGetTransferLocalIDByIndex -( - GPConnection * connection, - int index -); - -GPIFile * gpiAddFileToTransfer -( - GPITransfer * transfer, - const char * path, - const char * name -); - -void gpiSkipFile -( - GPConnection * connection, - GPITransfer * transfer, - int file, - int reason -); - -void gpiSkipCurrentFile -( - GPConnection * connection, - GPITransfer * transfer, - int reason -); - -GPIBool gpiGetTransferFileInfo -( - FILE * file, - int * size, - gsi_time * modTime -); - -void gpiTransferPeerDestroyed -( - GPConnection * connection, - GPIPeer * peer -); - -void gpiTransfersHandlePong -( - GPConnection * connection, - GPProfile profile, - GPIPeer * peer -); -#endif - -GPResult gpiSendTransferReply -( - GPConnection * connection, - const GPITransferID * transferID, - GPIPeer * peer, - int result, - const char * message -); - -void gpiHandleTransferMessage -( - GPConnection * connection, - GPIPeer * peer, - int type, - const char * headers, - const char * buffer, - int len -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUnique.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUnique.c deleted file mode 100644 index 2f1b8437ab4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUnique.c +++ /dev/null @@ -1,234 +0,0 @@ -/* -gpiUnique.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -//INCLUDES -////////// -#include "gpi.h" - -//FUNCTIONS -/////////// -static GPResult -gpiSendRegisterUniqueNick( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const char cdkey[GP_CDKEY_LEN], - int operationid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\registernick\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\uniquenick\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, uniquenick); - if(cdkey) - { - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\cdkey\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, cdkey); - } - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\partnerid\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->partnerID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, operationid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult gpiRegisterUniqueNick( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIOperation * operation = NULL; - GPResult result; - - // Add the operation. - ///////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_REGISTER_UNIQUENICK, NULL, &operation, blocking, callback, param)); - - // Send a request for info. - /////////////////////////// - result = gpiSendRegisterUniqueNick(connection, uniquenick, cdkey, operation->id); - CHECK_RESULT(result); - - // Process it if blocking. - ////////////////////////// - if(blocking) - { - result = gpiProcess(connection, operation->id); - CHECK_RESULT(result); - } - - return GP_NO_ERROR; -} - -GPResult gpiProcessRegisterUniqueNick( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - GPICallback callback; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // This should be \rn\. - /////////////////////// - if(strncmp(input, "\\rn\\", 4) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Call the callback. - ///////////////////// - callback = operation->callback; - if(callback.callback != NULL) - { - GPRegisterUniqueNickResponseArg * arg; - arg = (GPRegisterUniqueNickResponseArg *)gsimalloc(sizeof(GPRegisterUniqueNickResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - arg->result = GP_NO_ERROR; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - - // This operation is complete. - ////////////////////////////// - gpiRemoveOperation(connection, operation); - - return GP_NO_ERROR; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Registration of cdKey now offered separately from uniquenick -static GPResult -gpiSendRegisterCdKey( - GPConnection * connection, - const char cdkey[GP_CDKEY_LEN], - int operationid -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Encrypt the cdkey (xor with random values) - const int useAlternateEncoding = 1; - char cdkeyxor[GP_CDKEY_LEN]; - char cdkeyenc[GP_CDKEYENC_LEN]; - int cdkeylen = (int)strlen(cdkey); - int i=0; - - Util_RandSeed((unsigned long)GP_XOR_SEED); - for (i=0; i < cdkeylen; i++) - { - // XOR each character with the next rand - char aRand = (char)Util_RandInt(0, 0xFF); - cdkeyxor[i] = (char)(cdkey[i] ^ aRand); - } - cdkeyxor[i] = '\0'; - - // Base 64 it (printable chars only) - B64Encode(cdkeyxor, cdkeyenc, (int)cdkeylen, useAlternateEncoding); - - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\registercdkey\\\\sesskey\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->sessKey); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\cdkeyenc\\"); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, cdkeyenc); -// gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\partnerid\\"); -// gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, iconnection->partnerID); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\id\\"); - gpiAppendIntToBuffer(connection, &iconnection->outputBuffer, operationid); - gpiAppendStringToBuffer(connection, &iconnection->outputBuffer, "\\final\\"); - - return GP_NO_ERROR; -} - -GPResult gpiRegisterCdKey( - GPConnection * connection, - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -) -{ - GPIOperation * operation = NULL; - GPResult result; - - // Add the operation. - ///////////////////// - CHECK_RESULT(gpiAddOperation(connection, GPI_REGISTER_CDKEY, NULL, &operation, blocking, callback, param)); - - // Send a request for info. - /////////////////////////// - result = gpiSendRegisterCdKey(connection, cdkey, operation->id); - CHECK_RESULT(result); - - // Process it if blocking. - ////////////////////////// - if(blocking) - { - result = gpiProcess(connection, operation->id); - CHECK_RESULT(result); - } - - return GP_NO_ERROR; -} - -GPResult gpiProcessRegisterCdKey( - GPConnection * connection, - GPIOperation * operation, - const char * input -) -{ - GPICallback callback; - - // Check for an error. - ////////////////////// - if(gpiCheckForError(connection, input, GPITrue)) - return GP_SERVER_ERROR; - - // This should be \rc\. - /////////////////////// - if(strncmp(input, "\\rc\\", 4) != 0) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Unexpected data was received from the server."); - - // Call the callback. - ///////////////////// - callback = operation->callback; - if(callback.callback != NULL) - { - GPRegisterCdKeyResponseArg * arg; - arg = (GPRegisterCdKeyResponseArg *)gsimalloc(sizeof(GPRegisterCdKeyResponseArg)); - if(arg == NULL) - Error(connection, GP_MEMORY_ERROR, "Out of memory."); - - arg->result = GP_NO_ERROR; - - CHECK_RESULT(gpiAddCallback(connection, callback, arg, operation, 0)); - } - - // This operation is complete. - ////////////////////////////// - gpiRemoveOperation(connection, operation); - - return GP_NO_ERROR; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUnique.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUnique.h deleted file mode 100644 index 82dbd0558ff..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUnique.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -gpiUnique.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIUNIQUE_H_ -#define _GPIUNIQUE_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//FUNCTIONS -/////////// -GPResult gpiRegisterUniqueNick( - GPConnection * connection, - const char uniquenick[GP_UNIQUENICK_LEN], - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiProcessRegisterUniqueNick( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -// Seperated registration of unique nick and cdkey -GPResult gpiRegisterCdKey( - GPConnection * connection, - const char cdkey[GP_CDKEY_LEN], - GPEnum blocking, - GPCallback callback, - void * param -); - -GPResult gpiProcessRegisterCdKey( - GPConnection * connection, - GPIOperation * operation, - const char * input -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUtility.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUtility.c deleted file mode 100644 index 80ac4fbdbe3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUtility.c +++ /dev/null @@ -1,413 +0,0 @@ -/* -gpiUtility.c -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 333 -#pragma warning(disable: 4267) //lines: 142 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -//INCLUDES -////////// -#include -#include -#include -#include -#include "gpi.h" - -//DEFINES -///////// -#define OUTPUT_MAX_COL 100 - -// Disable compiler warnings for issues that are unavoidable. -///////////////////////////////////////////////////////////// -#if defined(_MSC_VER) // DevStudio -// Level4, "conditional expression is constant". -// Occurs with use of the MS provided macro FD_SET -#pragma warning ( disable: 4127 ) -#endif // _MSC_VER - -//FUNCTIONS -/////////// -void -strzcpy( - char * dest, - const char * src, - size_t len -) -{ - assert(dest != NULL); - assert(src != NULL); - - strncpy(dest, src, len); - dest[len - 1] = '\0'; -} - -GPIBool -gpiCheckForError( - GPConnection * connection, - const char * input, - GPIBool callErrorCallback -) -{ - char buffer[16]; - GPIConnection * iconnection = (GPIConnection*)*connection; - - if(strncmp(input, "\\error\\", 7) == 0) - { - // Get the err code. - //////////////////// - if(gpiValueForKey(input, "\\err\\", buffer, sizeof(buffer))) - iconnection->errorCode = (GPErrorCode)atoi(buffer); - - // Get the error string. - //////////////////////// - if(!gpiValueForKey(input, "\\errmsg\\", iconnection->errorString, sizeof(iconnection->errorString))) - iconnection->errorString[0] = '\0'; - -#ifdef GSI_UNICODE - // Update the UNICODE version - UTF8ToUCS2String(iconnection->errorString, iconnection->errorString_W); -#endif - // Call the error callback? - /////////////////////////// - if(callErrorCallback) - { - GPIBool fatal = (GPIBool)(strstr(input, "\\fatal\\") != NULL); - gpiCallErrorCallback(connection, GP_SERVER_ERROR, fatal ? GP_FATAL : GP_NON_FATAL); - } - - return GPITrue; - } - - return GPIFalse; -} - -GPIBool -gpiValueForKeyWithIndex( - const char * command, - const char * key, - int * index, - char * value, - int len -) -{ - char delimiter; - const char * start; - int i; - char c; - - // Check for NULL. - ////////////////// - assert(command != NULL); - assert(key != NULL); - assert(value != NULL); - assert(len > 0); - - // Find which char is the delimiter. - //////////////////////////////////// - delimiter = key[0]; - - // Find the key - first navigate to the index - ///////////////////////////////////////////// - command += *index; - start = strstr(command, key); - if(start == NULL) - return GPIFalse; - - // Get to the start of the value. - ///////////////////////////////// - start += strlen(key); - - // Copy in the value. - ///////////////////// - len--; - for(i = 0 ; (i < len) && ((c = start[i]) != '\0') && (c != delimiter) ; i++) - { - value[i] = c; - } - value[i] = '\0'; - - // Copy back current end point for index - //////////////////////////////////////// - *index += ((start - command) + strlen(value)); - - return GPITrue; -} - -GPIBool -gpiValueForKey( - const char * command, - const char * key, - char * value, - int len -) -{ - char delimiter; - const char * start; - int i; - char c; - - // Check for NULL. - ////////////////// - assert(command != NULL); - assert(key != NULL); - assert(value != NULL); - assert(len > 0); - - // Find which char is the delimiter. - //////////////////////////////////// - delimiter = key[0]; - - // Find the key. - //////////////// - start = strstr(command, key); - if(start == NULL) - return GPIFalse; - - // Get to the start of the value. - ///////////////////////////////// - start += strlen(key); - - // Copy in the value. - ///////////////////// - len--; - for(i = 0 ; (i < len) && ((c = start[i]) != '\0') && (c != delimiter) ; i++) - { - value[i] = c; - } - value[i] = '\0'; - - return GPITrue; -} - -char * -gpiValueForKeyAlloc( - const char * command, - const char * key -) -{ - char delimiter; - const char * start; - char c; - char * value; - int len; - - // Check for NULL. - ////////////////// - assert(command != NULL); - assert(key != NULL); - - // Find which char is the delimiter. - //////////////////////////////////// - delimiter = key[0]; - - // Find the key. - //////////////// - start = strstr(command, key); - if(start == NULL) - return NULL; - - // Get to the start of the value. - ///////////////////////////////// - start += strlen(key); - - // Find the key length. - /////////////////////// - for(len = 0 ; ((c = start[len]) != '\0') && (c != delimiter) ; len++) { }; - - // Allocate the value. - ////////////////////// - value = (char *)gsimalloc((unsigned int)len + 1); - if(!value) - return NULL; - - // Copy in the value. - ///////////////////// - memcpy(value, start, (unsigned int)len); - value[len] = '\0'; - - return value; -} - -GPResult -gpiCheckSocketConnect( - GPConnection * connection, - SOCKET sock, - int * state -) -{ - int aWriteFlag = 0; - int aExceptFlag = 0; - int aReturnCode = 0; - - // Check if the connect is completed. - ///////////////////////////////////// - aReturnCode = GSISocketSelect(sock, NULL, &aWriteFlag, &aExceptFlag); - if ( gsiSocketIsError(aReturnCode)) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_HotError, - "Error connecting\n"); - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_NETWORK, "There was an error checking for a completed connection."); - } - - if (aReturnCode > 0) - { - // Check for a failed attempt. - ////////////////////////////// - if(aExceptFlag) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_HotError, - "Connection rejected\n"); - *state = GPI_DISCONNECTED; - return GP_NO_ERROR; - } - - // Check for a successful attempt. - ////////////////////////////////// - if(aWriteFlag) - { - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Network, GSIDebugLevel_Notice, - "Connection accepted\n"); - *state = GPI_CONNECTED; - return GP_NO_ERROR; - } - } - - // Not connected yet. - ///////////////////// - *state = GPI_NOT_CONNECTED; - return GP_NO_ERROR; -} - -GPResult -gpiReadKeyAndValue( - GPConnection * connection, - const char * buffer, - int * index, - char key[512], - char value[512] -) -{ - int c; - int i; - char * start; - - assert(buffer != NULL); - assert(key != NULL); - assert(value != NULL); - - buffer += *index; - start = (char *)buffer; - - if(*buffer++ != '\\') - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Parse Error."); - - for(i = 0 ; (c = *buffer++) != '\\' ; i++) - { - if(c == '\0') - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Parse Error."); - if(i == 511) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Parse Error."); - *key++ = (char)c; - } - *key = '\0'; - - for(i = 0 ; ((c = *buffer++) != '\\') && (c != '\0') ; i++) - { - if(i == 511) - CallbackFatalError(connection, GP_NETWORK_ERROR, GP_PARSE, "Parse Error."); - *value++ = (char)c; - } - *value = '\0'; - - *index += (buffer - start - 1); - - return GP_NO_ERROR; -} - -void -gpiSetError( - GPConnection * connection, - GPErrorCode errorCode, - const char * errorString -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Copy the string. - /////////////////// - strzcpy(iconnection->errorString, errorString, GP_ERROR_STRING_LEN); - -#ifdef GSI_UNICODE - // Update the unicode version - UTF8ToUCS2StringLen(iconnection->errorString, iconnection->errorString_W, GP_ERROR_STRING_LEN); -#endif - - // Set the code. - //////////////// - iconnection->errorCode = errorCode; -} - -void -gpiSetErrorString( - GPConnection * connection, - const char * errorString -) -{ - GPIConnection * iconnection = (GPIConnection*)*connection; - - // Copy the string. - /////////////////// - strzcpy(iconnection->errorString, errorString, GP_ERROR_STRING_LEN); - -#ifdef GSI_UNICODE - // Update the unicode version - UTF8ToUCS2StringLen(iconnection->errorString, iconnection->errorString_W, GP_ERROR_STRING_LEN); -#endif - -} - -void -gpiEncodeString( - const char * unencodedString, - char * encodedString -) -{ - size_t i; - const int useAlternateEncoding = 1; - - // Encrypt the password (xor with random values) - char passwordxor[GP_PASSWORD_LEN]; - size_t passwordlen = strlen(unencodedString); - - Util_RandSeed((unsigned long)GP_XOR_SEED); - for (i=0; i < passwordlen; i++) - { - // XOR each character with the next rand - char aRand = (char)Util_RandInt(0, 0xFF); - passwordxor[i] = (char)(unencodedString[i] ^ aRand); - } - passwordxor[i] = '\0'; - - // Base 64 it (printable chars only) - B64Encode(passwordxor, encodedString, (int)passwordlen, useAlternateEncoding); -} - - -// Re-enable previously disabled compiler warnings -/////////////////////////////////////////////////// -#if defined(_MSC_VER) -#pragma warning ( default: 4127 ) -#endif // _MSC_VER - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUtility.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUtility.h deleted file mode 100644 index 25891109047..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpiUtility.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -gpiUtility.h -GameSpy Presence SDK -Dan "Mr. Pants" Schoenblum - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com - -*********************************************************************** -Please see the GameSpy Presence SDK documentation for more information -**********************************************************************/ - -#ifndef _GPIUTILITY_H_ -#define _GPIUTILITY_H_ - -//INCLUDES -////////// -#include "gpi.h" - -//DEFINES -///////// -// Buffer read size. -//////////////////// -#define GPI_READ_SIZE (16 * 1024) - -//MACROS -//////// -#define freeclear(mem) { gsifree(mem); (mem) = NULL; } - -#define Error(connection, result, string) { gpiSetErrorString(connection, string);\ - return (result);} - -#define CallbackError(connection, result, code, string) { gpiSetError(connection, code, string);\ - gpiCallErrorCallback(connection, result, GP_NON_FATAL);\ - return result;} - -#define CallbackFatalError(connection, result, code, string) { gpiSetError(connection, code, string);\ - gpiCallErrorCallback(connection, result, GP_FATAL);\ - return result;} - -#define CHECK_RESULT(result) { GPResult __result__ = (result);\ - if(__result__ != GP_NO_ERROR){\ - return __result__;}} - -//FUNCTIONS -/////////// -void -strzcpy( - char * dest, - const char * src, - size_t len // length of buffer, including space for '\0' -); - -void -gpiDebug( - GPConnection * connection, - const char * fmt, - ... -); - -GPIBool -gpiValueForKeyWithIndex( - const char * command, - const char * key, - int * index, - char * value, - int len -); - -GPIBool -gpiValueForKey( - const char * command, - const char * key, - char * value, - int len -); - -char * -gpiValueForKeyAlloc( - const char * command, - const char * key -); - -GPResult -gpiCheckSocketConnect( - GPConnection * connection, - SOCKET sock, - int * state -); - -GPResult -gpiReadKeyAndValue( - GPConnection * connection, - const char * buffer, - int * index, - char key[512], - char value[512] -); - -GPIBool -gpiCheckForError( - GPConnection * connection, - const char * input, - GPIBool callErrorCallback -); - -void -gpiSetError( - GPConnection * connection, - GPErrorCode errorCode, - const char * errorString -); - -void -gpiSetErrorString( - GPConnection * connection, - const char * errorString -); - -void -gpiEncodeString( - const char * unencodedString, - char * encodedString -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress.c deleted file mode 100644 index 0c1307e9999..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress.c +++ /dev/null @@ -1,1707 +0,0 @@ -// GameSpy Presence and Messaging SDK Stress Test -// Dan "Mr. Pants" Schoenblum -// Copyright 2000 GameSpy Industries, Inc - -/************* -** INCLUDES ** -*************/ -#include -#include "../gp.h" -#include "../../common/gsAvailable.h" - -/************ -** DEFINES ** -************/ -//#define CONNECTION_MANAGER "localhost" - -#define PROFILES_MAX 10000 - -#define LOG_FILE "gpstress.log" - -#define NEXT_OP_TIME_MIN 2000000 -#define NEXT_OP_TIME_MAX 2000000 - -#define IS_INSTANT_OP(op) (((op) >= FIRST_INSTANT_OP) && ((op) <= LAST_INSTANT_OP)) - -#define CONNECT_TIME_MIN 20000 -#define CONNECT_TIME_MAX 20000 - -#define SHUTDOWN_DISCONNECTS_PER_SEC 50 - -#define DEFAULT_RUN_TIME (2 * 60 * 60 * 1000) -#define DEFAULT_MAX_CONNECTED 100 - -#define SHOW_INFO_TIME 1000 - -#define DEFAULT_CONNECTS_PER_SEC 15 - -#define MAX_OTHERS 20 - -#define PRODUCT_ID_MAX 18 - -#define VALIDATION_MAX_NICKS 512 - -#define MAX_OUTSTANDING_CONNECTIONS 1 - -/********** -** TYPES ** -**********/ -#ifndef __cplusplus -typedef enum -{ - false, - true -} bool; -#endif - -typedef enum -{ - // No active operation. - /////////////////////// - OpNull = -1, - - // These operations all take a ceratin amount of time. - ////////////////////////////////////////////////////// - OpConnect, - OpNewProfile, - OpGetInfo, -#ifdef TEST_SEARCH - OpProfileSearch, - OpFindPlayers, -#endif - - // These are all instant operations. - //////////////////////////////////// -#define FIRST_INSTANT_OP OpSetInfo - OpSetInfo, - OpBuddyRequest, - OpDeleteBuddy, - OpSetStatus1, // Do setstatus 5x as often as other ops - OpSetStatus2, - OpSetStatus3, - OpSetStatus4, - OpSetStatus5, - OpSendBuddyMessage, - OpSetInvitable, -#define LAST_INSTANT_OP OpSetInvitable - - // The number of possible operations. - ///////////////////////////////////// - NumOps -} Op; - -typedef struct -{ - // The index of this profile in the list. - ///////////////////////////////////////// - int index; - - // Loaded profile info. - /////////////////////// - int userID; - char email[GP_EMAIL_LEN]; - char password[GP_PASSWORD_LEN]; - int profileID; - char nick[GP_NICK_LEN]; - bool invalid; - - // GP stuff. - //////////// - GPConnection gp; // The profile's GP object. - bool gpInitialized; // False until gpInitialize is called for this profile. - unsigned long disconnectTime; // Disconnect at this time. - GPProfile others[MAX_OTHERS]; // Remote profiles that this profile knows about. - int numOthers; // The number of others. - unsigned long connectTime; // When the connect attempt was made. - bool connected; // True when gpConnect finished successfully. - - // Op data. - /////////// - Op activeOp; // The active operation, OpNull between operations. - unsigned long nextOpTime; // At this time, pick a new random operation. - int completedOps; // Total number of operations completed. -} Profile; - -typedef struct -{ - GPResult result; - char nicks[VALIDATION_MAX_NICKS][GP_NICK_LEN]; - int numNicks; - Profile * profile; -} ValidationData; - -/************ -** GLOBALS ** -************/ -char profilesFile[MAX_PATH]; // The file from which to load the profiles. -Profile profiles[PROFILES_MAX]; // All of the loaded profiles. -int numProfiles; // The number of loaded profiles. -int numConnections; // The number of profiles that are initialized/connected. -int maxConnections; // The maximum number of connected profiles. -int highestConnections; // The highest number of connections. -int totalConnections; // The total number of connections. -int numConnected; // The number of profiles that are actually logged in. -int highestConnected; // The highest simultaneous connected. -int totalConnected; // The total number connected over the entire run. -int connectsPerSecond; // Number of connection attempts per second. -unsigned long lastConnectTime; // The last time there was a connect. -unsigned long startShutdownTime; // When to start shutting down. -bool shuttingDown; // True if we're in the process of shutting down. -unsigned long runTime; // How long to run for. - -/******************** -** PROFILE LOADING ** -********************/ -// This warning needs to be fixed for this file -// Disabling for now -#pragma warning ( disable: 4702 ) -#pragma warning ( disable: 4127 ) -bool ReadField(FILE * fp, char * field) -{ - char * str = field; - int c; - *str = '\0'; - while(1) - { - // Get a char. - ////////////// - c = fgetc(fp); - - // Check for end of field. - ////////////////////////// - if((c == ',') || (c == '\n') || (c == -1)) - { - // Check for no chars read. - /////////////////////////// - if(field == str) - return false; - - // Cap it off and return. - ///////////////////////// - *str = '\0'; - return true; - } - - *str++ = (char)c; - } - - return false; -} - -bool ReadProfile(FILE * fp, Profile * profile) -{ - char intBuffer[16]; - - // Read the user id. - //////////////////// - if(!ReadField(fp, intBuffer)) - return false; - profile->userID = atoi(intBuffer); - assert(profile->userID); - - // Read the email. - ////////////////// - ReadField(fp, profile->email); - - // Read the password. - ///////////////////// - ReadField(fp, profile->password); - - // Read the profile id. - /////////////////////// - ReadField(fp, intBuffer); - profile->profileID = atoi(intBuffer); - assert(profile->profileID); - - // Read the nick. - ///////////////// - ReadField(fp, profile->nick); - - return true; -} - -bool LoadProfiles(void) -{ -#if 0 - FILE * fp; - - // Open the file. - ///////////////// - fp = fopen(profilesFile, "rt"); - if(!fp) - { - printf("Failed to open the profiles file (%s)!\n", profilesFile); - return false; - } - - // Read the profiles. - ///////////////////// - while(ReadProfile(fp, &profiles[numProfiles])) - { - // One more. - //////////// - numProfiles++; - - // Check for too many. - ////////////////////// - if(numProfiles == PROFILES_MAX) - { - printf("Too many profiles in the profile file!\nIncrease PROFILES_MAX (%d)\n", PROFILES_MAX); - return false; - } - } - - // Close the file. - ////////////////// - fclose(fp); - - printf("Loaded %d profiles from %s\n", numProfiles, profilesFile); -#else - int i; - - for(i = 0 ; i < maxConnections ; i++) - { - strcpy(profiles[i].nick, "gpstress"); - sprintf(profiles[i].email, "gpstress%04d@gamespy.com", i); - strcpy(profiles[i].password, "gpstress"); - } - - numProfiles = i; -#endif - - return true; -} - -/********************* -** RANDOM FUNCTIONS ** -**********************/ -char RandomChar(void) -{ - static const char characters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789!@#$%^&*()_+-=~`<,>.?/:;\"'{[}]|\\"; - int index; - - index = (rand() % (sizeof(characters) - 1)); - - return characters[index]; -} - -char * RandomString(char * buffer) -{ - int i; - int len; - - // Random length. - ///////////////// - len = ((rand() % 10) + 5); - - // Set random chars. - //////////////////// - for(i = 0 ; i < len ; i++) - buffer[i] = RandomChar(); - buffer[i] = '\0'; - - return buffer; -} - -// min & max are inclusive. -/////////////////////////// -int RandomInt(int min, int max) -{ - int range = ((max - min) + 1); - return (min + ((rand() * range) / (RAND_MAX + 1))); -} - -bool RandomBool(void) -{ - return (bool)RandomInt(0, 1); -} - -GPProfile RandomOther(Profile * profile) -{ - int nIndex; - - assert(profile->numOthers > 0); - - nIndex = RandomInt(0, profile->numOthers - 1); - assert(nIndex >= 0); - assert(nIndex < profile->numOthers); - - return profile->others[nIndex]; -} - -void RandomServer(void) -{ -#if 0 - strcpy(GPConnectionManagerHostname, "mrpants"); -#else - static const char * servers[] = - { -#if 1 - "mrpants", - "mrpants1" -#else - "aphexgp1", - "aphexgp2" -#endif - }; - - const char * server = servers[RandomInt(0, (sizeof(servers) / sizeof(*servers)) - 1)]; - strcpy(GPConnectionManagerHostname, server); -#endif -} - -/************ -** GENERAL ** -************/ -void MessageOther(Profile * profile, GPProfile other) -{ -#if 1 - int pid; - - // Filter out certain profiles. - /////////////////////////////// - gpIDFromProfile(&profile->gp, other, &pid); - switch(pid) - { - case 100001: // Mr. Pants@dan@gamespy.com - case 100002: // walla@bryan@gamespy.com - case 100013: // lumberjack@jason@gamespy.com - return; - } - - gpSendBuddyMessage(&profile->gp, other, "STRESS-TEST"); -#endif -} - -void Log(const char * buffer) -{ - FILE * fp; - - static char timeBuffer[64]; - time_t thetime; - struct tm *ltime; - time(&thetime); - ltime = localtime(&thetime); - sprintf(timeBuffer, "%-2.2d/%-2.2d/%-2.2d %-2.2d:%-2.2d:%-2.2d: ", ltime->tm_mon+1, ltime->tm_mday, ltime->tm_year % 100, ltime->tm_hour, ltime->tm_min, ltime->tm_sec); - - fp = fopen(LOG_FILE, "at"); - if(fp) - { - fprintf(fp, "%s%s", timeBuffer, buffer); - fclose(fp); - } - - OutputDebugString(timeBuffer); - OutputDebugString(buffer); - - printf("%s%s", timeBuffer, buffer); -} - -/************************ -** GP GLOBAL CALLBACKS ** -************************/ -void GetInfoCallback(GPConnection * connnection, GPGetInfoResponseArg * arg, Profile * profile); -void AddOther(Profile * profile, GPProfile gpProfile); -void PrintOp(Profile * profile, const char * opString); - -void ErrorCallback(GPConnection * connection, GPErrorArg * arg, Profile * profile) -{ - char * errorCodeString; - char * resultString; - static char buffer[4098]; - - // Ignore errors that we're expecting to generate (due to randomness). - ////////////////////////////////////////////////////////////////////// - switch(arg->errorCode) - { - case GP_ADDBUDDY_ALREADY_BUDDY: - case GP_BM_NOT_BUDDY: - return; - } - - // Get a string for the result. - /////////////////////////////// -#define RESULT(x) case x: resultString = #x; break; - switch(arg->result) - { - RESULT(GP_NO_ERROR) - RESULT(GP_MEMORY_ERROR) - RESULT(GP_PARAMETER_ERROR) - RESULT(GP_NETWORK_ERROR) - RESULT(GP_SERVER_ERROR) - default: - resultString = "Unknown result!\n"; - } - - // Get a string for the error code. - /////////////////////////////////// -#define ERRORCODE(x) case x: errorCodeString = #x; break; - switch(arg->errorCode) - { - ERRORCODE(GP_GENERAL) - ERRORCODE(GP_PARSE) - ERRORCODE(GP_NOT_LOGGED_IN) - ERRORCODE(GP_BAD_SESSKEY) - ERRORCODE(GP_DATABASE) - ERRORCODE(GP_NETWORK) - ERRORCODE(GP_FORCED_DISCONNECT) - ERRORCODE(GP_CONNECTION_CLOSED) - ERRORCODE(GP_LOGIN) - ERRORCODE(GP_LOGIN_TIMEOUT) - ERRORCODE(GP_LOGIN_BAD_NICK) - ERRORCODE(GP_LOGIN_BAD_EMAIL) - ERRORCODE(GP_LOGIN_BAD_PASSWORD) - ERRORCODE(GP_LOGIN_BAD_PROFILE) - ERRORCODE(GP_LOGIN_PROFILE_DELETED) - ERRORCODE(GP_LOGIN_CONNECTION_FAILED) - ERRORCODE(GP_LOGIN_SERVER_AUTH_FAILED) - ERRORCODE(GP_LOGIN_BAD_UNIQUENICK) - ERRORCODE(GP_LOGIN_BAD_PREAUTH) - ERRORCODE(GP_NEWUSER) - ERRORCODE(GP_NEWUSER_BAD_NICK) - ERRORCODE(GP_NEWUSER_BAD_PASSWORD) - ERRORCODE(GP_NEWUSER_UNIQUENICK_INVALID) - ERRORCODE(GP_NEWUSER_UNIQUENICK_INUSE) - ERRORCODE(GP_UPDATEUI) - ERRORCODE(GP_UPDATEUI_BAD_EMAIL) - ERRORCODE(GP_NEWPROFILE) - ERRORCODE(GP_NEWPROFILE_BAD_NICK) - ERRORCODE(GP_NEWPROFILE_BAD_OLD_NICK) - ERRORCODE(GP_UPDATEPRO) - ERRORCODE(GP_UPDATEPRO_BAD_NICK) - ERRORCODE(GP_ADDBUDDY) - ERRORCODE(GP_ADDBUDDY_BAD_FROM) - ERRORCODE(GP_ADDBUDDY_BAD_NEW) - ERRORCODE(GP_ADDBUDDY_ALREADY_BUDDY) - ERRORCODE(GP_AUTHADD) - ERRORCODE(GP_AUTHADD_BAD_FROM) - ERRORCODE(GP_AUTHADD_BAD_SIG) - ERRORCODE(GP_STATUS) - ERRORCODE(GP_BM) - ERRORCODE(GP_BM_NOT_BUDDY) - ERRORCODE(GP_GETPROFILE) - ERRORCODE(GP_GETPROFILE_BAD_PROFILE) - ERRORCODE(GP_DELBUDDY) - ERRORCODE(GP_DELBUDDY_NOT_BUDDY) - ERRORCODE(GP_DELPROFILE) - ERRORCODE(GP_DELPROFILE_LAST_PROFILE) - ERRORCODE(GP_SEARCH) - ERRORCODE(GP_SEARCH_CONNECTION_FAILED) - ERRORCODE(GP_CHECK) - ERRORCODE(GP_CHECK_BAD_EMAIL) - ERRORCODE(GP_CHECK_BAD_NICK) - ERRORCODE(GP_CHECK_BAD_PASSWORD) - ERRORCODE(GP_REVOKE) - ERRORCODE(GP_REVOKE_NOT_BUDDY) - ERRORCODE(GP_REGISTERUNIQUENICK) - ERRORCODE(GP_REGISTERUNIQUENICK_TAKEN) - ERRORCODE(GP_REGISTERUNIQUENICK_RESERVED) - ERRORCODE(GP_REGISTERUNIQUENICK_BAD_NAMESPACE) - default: - errorCodeString = "Unknown error code!\n"; - } - - // Print out the info. - ////////////////////// - if(arg->fatal) - sprintf(buffer, "%04d: FATAL ERROR", profile->index); - else - sprintf(buffer, "%04d: ERROR", profile->index); - sprintf(buffer + strlen(buffer), ", RESULT: %s (%d)", resultString, arg->result); - sprintf(buffer + strlen(buffer), ", ERROR CODE: %s (0x%X)", errorCodeString, arg->errorCode); - sprintf(buffer + strlen(buffer), ", ERROR STRING: %s\n", arg->errorString); - Log(buffer); - - // Disconnect. - ////////////// - profile->disconnectTime = 0; - GSI_UNUSED(connection); -} - -void RecvBuddyStatusCallback(GPConnection * connection, GPRecvBuddyStatusArg * arg, Profile * profile) -{ - PrintOp(profile, "RecvBuddyStatusCallback"); - -#if 1 - // Get info half the time. - ////////////////////////// - if(RandomBool()) - gpGetInfo(&profile->gp, arg->profile, GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - - // Send a message sometimes. - //////////////////////////// - if(RandomInt(0, 9) == 0) - MessageOther(profile, arg->profile); - - // Add the other. - ///////////////// - AddOther(profile, arg->profile); -#endif - GSI_UNUSED(connection); -} - -#if 1 -void RecvBuddyRequestCallback(GPConnection * connection, GPRecvBuddyRequestArg * arg, Profile * profile) -{ - PrintOp(profile, "RecvBuddyRequestCallback"); - - // Get info half the time. - ////////////////////////// - if(RandomBool()) - gpGetInfo(&profile->gp, arg->profile, GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - - // Accept it half the time. - /////////////////////////// - if(RandomBool()) - gpAuthBuddyRequest(&profile->gp, arg->profile); - - // Add the other. - ///////////////// - AddOther(profile, arg->profile); - GSI_UNUSED(connection); -} - -void RecvBuddyMessageCallback(GPConnection * connection, GPRecvBuddyMessageArg * arg, Profile * profile) -{ - PrintOp(profile, "RecvBuddyMessageCallback"); - - // Get info half the time. - ////////////////////////// - if(RandomBool()) - gpGetInfo(&profile->gp, arg->profile, GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - - // Reply sometimes. - /////////////////// - if(RandomInt(0, 9) == 0) - MessageOther(profile, arg->profile); - - // Add the other. - ///////////////// - AddOther(profile, arg->profile); - GSI_UNUSED(connection); -} - -void RecvGameInviteCallback(GPConnection * connection, GPRecvGameInviteArg * arg, Profile * profile) -{ - PrintOp(profile, "RecvGameInviteCallback"); - - // Get info half the time. - ////////////////////////// - if(RandomBool()) - gpGetInfo(&profile->gp, arg->profile, GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - - // Send a message sometimes. - //////////////////////////// - if(RandomInt(0, 9) == 0) - MessageOther(profile, arg->profile); - - // Add the other. - ///////////////// - AddOther(profile, arg->profile); - GSI_UNUSED(connection); -} -#endif - -/******************** -** GP OP CALLBACKS ** -********************/ -void EndOp(Profile * profile); - -const int RemoteAuthProfiles[] = -{ - 58214083, - 58214074, - 58214075, - 58214076, - 58214077, - 58214078, - 58214079, - 58214080, - 58214081, - 58214082 -}; - -void ConnectCallback(GPConnection * connection, GPConnectResponseArg * arg, Profile * profile) -{ - if(arg->result == GP_NO_ERROR) - { - // Finished connecting. - /////////////////////// - profile->connected = true; - numConnected++; - totalConnected++; - highestConnected = max(numConnected, highestConnected); - - if(arg->profile != RemoteAuthProfiles[profile->index % 10]) - { - char buffer[4096]; - gsi_time ms = (current_time() - profile->connectTime); - sprintf(buffer, "%d: XXX Connection ProfileID Error (%d != %d) [%d]: %d.%03ds\n", totalConnected, arg->profile, RemoteAuthProfiles[profile->index % 10], (profile->index % 10), ms / 1000, ms % 1000); - Log(buffer); - } - -#if 1 - // log the connection - { - char buffer[256]; - gsi_time ms = (current_time() - profile->connectTime); - sprintf(buffer, "%sConnected: %d time: %d.%03ds\n", (ms>=1000)?"XX ":"", totalConnected, ms / 1000, ms % 1000); - Log(buffer); - } -#endif - -#if 1 - // always disconnect right away - profile->disconnectTime = 0; -#endif - } - else - { -#if 1 - // log the error - { - char buffer[4096]; - gsi_time ms = (current_time() - profile->connectTime); - sprintf(buffer, "%d: XXX Connection Failed [%d]: %d.%03ds\n", totalConnected, (profile->index % 10), ms / 1000, ms % 1000); - Log(buffer); - } -#endif - // Disconnect this profile. - /////////////////////////// - profile->disconnectTime = 0; - } - - // End the op. - ////////////// - EndOp(profile); - GSI_UNUSED(connection); -} - -void GetInfoCallback(GPConnection * connection, GPGetInfoResponseArg * arg, Profile * profile) -{ - if(arg->result != GP_NO_ERROR) - { - printf("%04d: gpGetInfo failed\n", profile->index); - return; - } - GSI_UNUSED(connection); -} - -void FindPlayersCallback(GPConnection * connection, GPFindPlayersResponseArg * arg, Profile * profile) -{ - int i; - - if(arg->result != GP_NO_ERROR) - { - printf("%04d: gpFindPlayers failed\n", profile->index); - return; - } - - // Get all of their info. - ///////////////////////// - for(i = 0 ; i < arg->numMatches ; i++) - gpGetInfo(&profile->gp, arg->matches[i].profile, GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - - // Invite someone. - ////////////////// - if(arg->numMatches > 0) - { - int index = RandomInt(0, arg->numMatches - 1); - int productID = RandomInt(1, PRODUCT_ID_MAX); - - gpInvitePlayer(&profile->gp, arg->matches[index].profile, productID,NULL); - } - GSI_UNUSED(connection); -} - -void ProfileSearchCallback(GPConnection * connection, GPProfileSearchResponseArg * arg, Profile * profile) -{ - int i; - - if(arg->result != GP_NO_ERROR) - { - printf("%04d: gpProfileSearch failed\n", profile->index); - return; - } - - // Get all of their info. - ///////////////////////// - for(i = 0 ; i < arg->numMatches ; i++) - gpGetInfo(&profile->gp, arg->matches[i].profile, GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - GSI_UNUSED(connection); -} - -/***************** -** OP FUNCTIONS ** -*****************/ -void AddOther(Profile * profile, GPProfile gpProfile) -{ - int i; - - // Check for full. - ////////////////// - if(profile->numOthers == MAX_OTHERS) - return; - - // Check if we already have this one. - ///////////////////////////////////// - for(i = 0 ; i < profile->numOthers ; i++) - if(profile->others[i] == gpProfile) - return; - - // Add it. - ////////// - profile->others[profile->numOthers] = gpProfile; - profile->numOthers++; -} - -unsigned long GetRandomOpTime(void) -{ - // Between NEXT_OP_TIME_MIN and NEXT_OP_TIME_MAX. - ///////////////////////////////////////////////// - return RandomInt(NEXT_OP_TIME_MIN, NEXT_OP_TIME_MAX); -} - -Op GetRandomOp(void) -{ - // Between 1 (skip OpConnect) and (NumOps - 1). - /////////////////////////////////////////////// - Op op = (Op)(((rand() * (NumOps - 1)) / (RAND_MAX + 1)) + 1); - - assert(op > OpConnect); - assert(op < NumOps); - - return op; -} - -void NewOp(Profile * profile) -{ - // Is this the first op? - //////////////////////// - if(profile->completedOps == 0) - { - // The first op is always connect. - ////////////////////////////////// - profile->activeOp = OpConnect; - } - else - { -#if 1 - // Pick a random op. - //////////////////// - profile->activeOp = GetRandomOp(); -#else - // Always do status. - //////////////////// - profile->activeOp = OpSetStatus1; -#endif - } -} - -void EndOp(Profile * profile) -{ - // No active op. - //////////////// - profile->activeOp = OpNull; - - // Set the next op time. - //////////////////////// - profile->nextOpTime = (current_time() + GetRandomOpTime()); - - // One more op completed. - ///////////////////////// - profile->completedOps++; -} - -void PrintOp(Profile * profile, const char * opString) -{ -#if 0 - static char buffer[256]; - sprintf(buffer, "%04d: %s\n", profile->index, opString); - OutputDebugString(buffer); -#endif - GSI_UNUSED(profile); - GSI_UNUSED(opString); -} - -void StartOp(Profile * profile) -{ - int i; - int num; - int intArray[16]; - char string1[16]; - char string2[16]; - - // Handle based on op. - ////////////////////// - switch(profile->activeOp) - { - case OpNull: - assert(0); - printf("%04d: Tried to start null op\n", profile->index); - break; - - case OpConnect: - PrintOp(profile, "OpConnect"); - - // Start the connect. - ///////////////////// -#if 0 - RandomServer(); -#endif -#if 0 - gpConnect(&profile->gp, profile->nick, profile->email, profile->password, (RandomInt(0, 9) == 0)?GP_FIREWALL:GP_NO_FIREWALL, GP_NON_BLOCKING, ConnectCallback, profile); -#else - { - const char * authtokens[] = - { - "GMT/61LHe4Yu+pHI0eDXu8GMdc51iXjsNvcz1GGoWJ9orpnbZIbp3CVBQddeSZOSq58", - "GMTcUM+iiQuzaw8crHxBFPCVV6J9V14KnSNHnHbQIXGwN6XpKv97yqSbOqxrgIWZCeZ", - "GMTxiKFKsnGdOeBaJxmJOQBNSqbm9zOjbu/cTiqpBJp1pqqOAnI1Jh81TPlWmFuvt0h", - "GMTqUg6QEerwnwi87fZQMcfzQ0xA/zNC96VCtx6GavTv7wzDtGpOWxJHUkm20qMxVsg", - "GMTV2uHalvcDgtvBsz62QF1ifbCJJ93QONO9TNGVGlDghs6ocL2qOiQVqNJS7LvTZ39", - "GMTq9Z7Tg/tkEMzqEODuQdNSQPgt5MdAwH26+lQGHliL9n3nH0b0D38fTFWRbkmk4K9", - "GMTwHyinDuomW0XmQswNyVpgdlQvnuGCR1it+kHCnUDmR5CG3svSufrDcjuHdlwfVON", - "GMTBZgPikENuiEON0by04RMR112ShZsDctzVbqljZ3ZufDvyugygztRlKIM9gyLwSdy", - "GMTmHNpmNufV9WuGIGET8E0Xd//56eYWO4mDaD+4KebWQWvc8CqWbqSeII6x9BxQMxQ", - "GMTyI447fNIYVh1vdI6aErka4TzJcYWctTU/Dzi2GK+4J3Vf/VAqQOs43R73I7dyX+u" - }; - const char * partnerchallenges[] = - { - "WI[A)IuA", - "RNd$)q)0", - "LQTi;4#X", - "AOA)(57=", - "ob=0XiWJ", - "mRnTENJ@", - "9%@A+NKA", - "L=0O)Lg2", - "YR6[Zz%B", - "$kWZ%]~@" - }; - int tokenIndex = (profile->index % 10); - gpConnectPreAuthenticated(&profile->gp, authtokens[tokenIndex], partnerchallenges[tokenIndex], GP_FIREWALL, GP_NON_BLOCKING, ConnectCallback, profile); - } -#endif - break; - - case OpNewProfile: - PrintOp(profile, "OpNewProfile"); - - // Pretend this op didn't happen, another will be picked next frame. - //////////////////////////////////////////////////////////////////// - profile->activeOp = OpNull; - break; - - case OpGetInfo: - PrintOp(profile, "OpGetInfo"); - - // Do we know of any other profiles? - //////////////////////////////////// - if(profile->numOthers > 0) - gpGetInfo(&profile->gp, RandomOther(profile), GP_DONT_CHECK_CACHE, GP_NON_BLOCKING, GetInfoCallback, profile); - else - profile->activeOp = OpNull; - break; - -#ifdef TEST_SEARCH - case OpProfileSearch: - PrintOp(profile, "OpProfileSearch"); - - // Do a search. - /////////////// - num = RandomInt(0, 3); - if(num == 0) - gpProfileSearch(&profile->gp, "pants", "dan@gamespy.com", NULL, NULL, 0, GP_NON_BLOCKING, ProfileSearchCallback, profile); - else if(num == 1) - gpProfileSearch(&profile->gp, "crt", NULL, NULL, NULL, 0, GP_NON_BLOCKING, ProfileSearchCallback, profile); - else - gpProfileSearch(&profile->gp, "STRESS-TEST", NULL, NULL, NULL, 0, GP_NON_BLOCKING, ProfileSearchCallback, profile); - break; - - case OpFindPlayers: - PrintOp(profile, "OpFindPlayers"); - - // Find some players. - ///////////////////// - gpFindPlayers(&profile->gp, RandomInt(1, PRODUCT_ID_MAX), GP_NON_BLOCKING, FindPlayersCallback, profile); - break; -#endif - - case OpSetInfo: - PrintOp(profile, "OpSetInfo"); - - // Set some random info. - //////////////////////// - gpSetInfos(&profile->gp, GP_FIRSTNAME, "STRESS-TEST"); - gpSetInfos(&profile->gp, GP_LASTNAME, "STRESS-TEST"); - gpSetInfoi(&profile->gp, GP_ICQUIN, RandomInt(100000, 40000000)); - gpSetInfos(&profile->gp, GP_HOMEPAGE, "STRESS-TEST"); - gpSetInfod(&profile->gp, GP_BIRTHDAY, RandomInt(1, 28), RandomInt(1, 12), RandomInt(1940, 1990)); - break; - - case OpBuddyRequest: - PrintOp(profile, "OpBuddyRequest"); - -#if 1 - // Pretend this op didn't happen, another will be picked next frame. - //////////////////////////////////////////////////////////////////// - profile->activeOp = OpNull; -#else - // Send someone a buddy request. - //////////////////////////////// - if(profile->numOthers > 0) - gpSendBuddyRequest(&profile->gp, RandomOther(profile), "STRESS-TEST"); -#endif - break; - - case OpDeleteBuddy: - PrintOp(profile, "OpDeleteBuddy"); - - // Pretend this op didn't happen, another will be picked next frame. - //////////////////////////////////////////////////////////////////// - profile->activeOp = OpNull; - break; - - case OpSetStatus1: - case OpSetStatus2: - case OpSetStatus3: - case OpSetStatus4: - case OpSetStatus5: - PrintOp(profile, "OpSetStatus"); - - // Set the status to some random stuff. - /////////////////////////////////////// - gpSetStatus(&profile->gp, GP_ONLINE, RandomString(string1), RandomString(string2)); - break; - - case OpSendBuddyMessage: - PrintOp(profile, "OpSendBuddyMessage"); - - // Send someone a message. - ///////////////////////// - if(profile->numOthers > 0) - MessageOther(profile, RandomOther(profile)); - break; - - case OpSetInvitable: - PrintOp(profile, "OpSetInvitable"); - - // Get the num games. - ///////////////////// - num = RandomInt(0, 10); - - // Get the product ids. - /////////////////////// - for(i = 0 ; i < num ; i++) - intArray[i] = RandomInt(1, PRODUCT_ID_MAX); - - // Set the games. - ///////////////// - gpSetInvitableGames(&profile->gp, num, intArray); - break; - - default: - assert(0); - printf("%04d: Tried to start unknown op: %d\n", profile->index, profile->activeOp); - break; - } - - // Was this an instant op? - ////////////////////////// - if(IS_INSTANT_OP(profile->activeOp)) - { - // End it. - ////////// - EndOp(profile); - } -} - -/********************** -** PROFILE FUNCTIONS ** -**********************/ -void ProcessProfile(Profile * profile) -{ - DWORD now = current_time(); - - // Is GP initialized? - ///////////////////// - if(profile->gpInitialized) - { - // Do GP processing. - //////////////////// - gpProcess(&profile->gp); - - // Has a connection attempt been going for 2 minutes? - ///////////////////////////////////////////////////// - if((profile->activeOp == OpConnect) && ((current_time() - profile->connectTime) > (200 * 60 * 1000))) - { - char buffer[256]; - gsi_time ms = (current_time() - profile->connectTime); - sprintf(buffer, "%04d: XXX Excessive Connect Time: %d.%03ds\n", profile->index, ms / 1000, ms % 1000); - Log(buffer); - } - - // Check for disconnect. - //////////////////////// - if((now > profile->disconnectTime) && ((profile->activeOp != OpConnect) || shuttingDown)) - { - // Cleanup GP for this profile. - /////////////////////////////// - if(profile->connected) - { - numConnected--; - gpDisconnect(&profile->gp); - } - gpDestroy(&profile->gp); - - // We're no longer initialized/connected. - ///////////////////////////////////////// - profile->gpInitialized = false; - numConnections--; - } - // Is there no active op? - ///////////////////////// - else if(!shuttingDown && (profile->activeOp == OpNull)) - { - // Is it time for a new op? - /////////////////////////// -#if 1 - if(now > profile->nextOpTime) -#else - if((now > profile->nextOpTime) && (profile->completedOps == 0)) -#endif - { - // Select a new op. - /////////////////// - NewOp(profile); - - // Start the op. - //////////////// - StartOp(profile); - } - } - } -} - -Profile * GetUninitializedProfile(void) -{ - int index; - - // Loop until we get an uninitialized (and valid) profile. - ////////////////////////////////////////////////////////// - do - { - // Get an index between 0 and (numProfiles - 1). - //////////////////////////////////////////////// - index = ((rand() * numProfiles) / (RAND_MAX + 1)); - assert(index >= 0); - assert(index < numProfiles); - } - while(profiles[index].gpInitialized || profiles[index].invalid); - - return &profiles[index]; -} - -void InitializeProfile(Profile * profile) -{ - GPResult result; - - // Init the profile's GP object. - //////////////////////////////// - result = gpInitialize(&profile->gp, 0, 0, GP_PARTNERID_GAMESPY); - if(result != GP_NO_ERROR) - { - printf("%04d: Failed to initialize GP for %s@%s\n", profile->index, profile->nick, profile->email); - return; - } - - // Set the GP global callbacks. - /////////////////////////////// - gpSetCallback(&profile->gp, GP_ERROR, ErrorCallback, profile); - gpSetCallback(&profile->gp, GP_RECV_BUDDY_STATUS, RecvBuddyStatusCallback, profile); -#if 1 - gpSetCallback(&profile->gp, GP_RECV_BUDDY_REQUEST, RecvBuddyRequestCallback, profile); - gpSetCallback(&profile->gp, GP_RECV_BUDDY_MESSAGE, RecvBuddyMessageCallback, profile); - gpSetCallback(&profile->gp, GP_RECV_GAME_INVITE, RecvGameInviteCallback, profile); -#endif - - // We're initialized. - ///////////////////// - profile->gpInitialized = true; - - // Not connected yet. - ///////////////////// - profile->connected = false; - - // Remember when we tried to connect. - ///////////////////////////////////// - profile->connectTime = current_time(); - - // Haven't checked yet. - /////////////////////// - profile->invalid = false; - - // When to disconnect. - ////////////////////// - profile->disconnectTime = current_time(); - profile->disconnectTime += (((rand() * (CONNECT_TIME_MAX - CONNECT_TIME_MIN)) / RAND_MAX) + CONNECT_TIME_MIN); - - // No others yet. - ///////////////// - profile->numOthers = 0; - - // Op stuff. - //////////// - profile->activeOp = OpNull; - profile->nextOpTime = 0; - profile->completedOps = 0; - - // It's a connection, but we're not connected. - ////////////////////////////////////////////// - numConnections++; - totalConnections++; - highestConnections = max(highestConnections, numConnections); -} - -/*************** -** VALIDATION ** -***************/ -void GetUserNicksCallback(GPConnection * connection, GPGetUserNicksResponseArg * arg, ValidationData * validationData) -{ - int i; - - // Copy the result. - /////////////////// - validationData->result = arg->result; - - // Check for error. - /////////////////// - if(arg->result != GP_NO_ERROR) - { - printf("%04d: gpGetUserNicks failed\n", validationData->profile->index); - return; - } - - // Copy the nicks. - ////////////////// - validationData->numNicks = min(arg->numNicks, VALIDATION_MAX_NICKS); - for(i = 0 ; i < arg->numNicks ; i++) - strcpy(validationData->nicks[i], arg->nicks[i]); - GSI_UNUSED(connection); -} - -void NewUserResponse(GPConnection * connection, GPNewUserResponseArg * arg, void * param) -{ - GSI_UNUSED(connection); - GSI_UNUSED(arg); - GSI_UNUSED(param); -} - -bool Validate(void) -{ - int i; - GPConnection gp; - char email[GP_EMAIL_LEN] = ""; - Profile * profile; - ValidationData validationData; - - validationData.profile = NULL; - validationData.result = GP_NO_ERROR; - validationData.numNicks = 0; - // Set this here so ctrl-c can cancel the validation. - ///////////////////////////////////////////////////// - startShutdownTime = ULONG_MAX; - - // Init GP. - /////////// - if(gpInitialize(&gp, 0, 0, GP_PARTNERID_GAMESPY) != GP_NO_ERROR) - { - printf("Failed to initialize GP for validation\n"); - return false; - } -/* - for(i = 41 ; i <= 1000 ; i++) - { - sprintf(email, "gpstress%04d@gamespy.com", i); - gpNewUser(&gp, "gpstress", email, "gpstress", GP_BLOCKING, NewUserResponse, NULL); - printf("%d\n", i); - } -*/ - // Loop through all the profiles. - ///////////////////////////////// - for(i = 0 ; i < numProfiles ; i++) - { - // Check for shutdown. - ////////////////////// - if(current_time() > startShutdownTime) - return false; - - // Cache the profile. - ///////////////////// - profile = &profiles[i]; - - // Is the e-mail address different than the previous one? - ///////////////////////////////////////////////////////// - if(strcmp(email, profile->email) != 0) - { - // Copy the e-mail. - /////////////////// - strcpy(email, profile->email); - - // Put the profile in the validation struct. - //////////////////////////////////////////// - validationData.profile = profile; - - // Show what we're doing. - ///////////////////////// - printf("%04d: Getting nicks for: %s\n", profile->index, email); - - // Get the nicks for this e-mail. - ///////////////////////////////// - gpGetUserNicks(&gp, email, profile->password, GP_BLOCKING, GetUserNicksCallback, &validationData); - } - - // Only do this if the validation succeeded. - //////////////////////////////////////////// - if(validationData.result == GP_NO_ERROR) - { - int n; - bool match = false; - - // Loop through the nicks. - ////////////////////////// - for(n = 0 ; (n < validationData.numNicks) && !match ; n++) - { - // Does this nick match the one being validated? - //////////////////////////////////////////////// - if(strcasecmp(profile->nick, validationData.nicks[n]) == 0) - match = true; - } - - // Set invalid based on match. - ////////////////////////////// - profile->invalid = !match; - } - else - { - // Probably invalid e-mail. - /////////////////////////// - profile->invalid = true; - } - - // Show if we got something invalid. - //////////////////////////////////// - if(profile->invalid) - { - static char buffer[256]; - sprintf(buffer, "%s (%d) : %04d: Invalid profile (%s@%s)\n", profilesFile, (profile->index + 1), profile->index, profile->nick, profile->email); - printf(buffer); - OutputDebugString(buffer); - } - } - - return true; -} - -/******************* -** MAIN FUNCTIONS ** -*******************/ -#ifdef WIN32 -BOOL WINAPI CtrlHandlerRoutine(DWORD dwCtrlType) -{ - // Start shutting down soon. - //////////////////////////// - startShutdownTime = 0; - - GSI_UNUSED(dwCtrlType); - // Handled. - return TRUE; -} -#endif - -bool Initialize(void) -{ - int i; - Profile * profile; - DWORD now; - GSIACResult aResult = GSIACWaiting; - - // Seed the random number generator. - //////////////////////////////////// - srand(time(NULL)); - - // Perform the availability check - GSIStartAvailableCheck("gmtest"); - while(aResult == GSIACWaiting) - aResult = GSIAvailableCheckThink(); - if (aResult != GSIACAvailable) - { - printf("Backend services are not available.\r\n"); - return false; - } - - -#ifdef WIN32 - // Set the ctrl-c handler. - ////////////////////////// - SetConsoleCtrlHandler(CtrlHandlerRoutine, TRUE); -#endif - - // Set our own hostname. - //////////////////////// -#ifdef CONNECTION_MANAGER - if(CONNECTION_MANAGER[0]) - strcpy(GPConnectionManagerHostname, CONNECTION_MANAGER); -#endif - - // Load the profiles. - ///////////////////// - if(!LoadProfiles()) - return false; - - // Cap off the max connected profiles. - ////////////////////////////////////// - if(maxConnections > numProfiles) - maxConnections = numProfiles; - - // Get the current time. - //////////////////////// - now = current_time(); - - // Initalize profile stuff. - /////////////////////////// - for(i = 0 ; i < numProfiles ; i++) - { - // Cache the profile pointer. - /////////////////////////////. - profile = &profiles[i]; - - // Set its index. - ///////////////// - profile->index = i; - - // No op yet. - ///////////// - profile->activeOp = OpNull; - - // Print out a message every 100. - ///////////////////////////////// -#if 0 - if(((i + 1) % 100) == 0) - { - printf("%d/%d profiles initialized\n", i + 1, numProfiles); - msleep(1); - } -#endif - } - - return true; -} - -void Shutdown(void) -{ - int i; - - // Cleanup all the GP objects. - ////////////////////////////// - for(i = 0 ; i < numProfiles ; i++) - { - // Check if GP was intialized. - ////////////////////////////// - if(profiles[i].gpInitialized) - { - // Destroy the GP object. - ///////////////////////// - gpDestroy(&profiles[i].gp); - - // Print out a message every 100. - ///////////////////////////////// - if(((i + 1) % 100) == 0) - { - printf("%d/%d profiles destroyed\n", i + 1, numProfiles); - msleep(1); - } - } - } -} - -void StartShutdown(unsigned long now) -{ - Profile * profile; - int i; - - // Loop through all the profiles. - ///////////////////////////////// - for(i = 0 ; i < numProfiles ; i++) - { - // Cache the profile pointer. - ///////////////////////////// - profile = &profiles[i]; - - // Check if its GP object is initialized. - ///////////////////////////////////////// - if(profile->gpInitialized) - { -#if 0 - // Is it not actually connected yet? - //////////////////////////////////// - if(!profile->connected) - { - char buffer[64]; - - // How long has it been waiting? - //////////////////////////////// - sprintf(buffer, "%04d: Waiting %ds for connection attempt\n", profile->index, (current_time() - profile->connectTime) / 1000); - Log(buffer); - } -#endif - - // Set when to disconnect, - ////////////////////////// - profile->disconnectTime = (now + ((rand() * ((numConnections / SHUTDOWN_DISCONNECTS_PER_SEC) * 1000)) / RAND_MAX)); - } - } - - // We're shutting down, don't add new connections, etc. - /////////////////////////////////////////////////////// - shuttingDown = true; -} - -void Frame(unsigned long now) -{ - int i; - - // Is it time to connect a new profile? - /////////////////////////////////////// - if(!shuttingDown && (numConnections < maxConnections) && ((numConnections - numConnected) < MAX_OUTSTANDING_CONNECTIONS)) - { - Profile * profile; - unsigned long timeDiff; - int numConnects; - - // How long since the last connect? - /////////////////////////////////// - timeDiff = (now - lastConnectTime); - - // How many connects should we do? - ////////////////////////////////// - numConnects = ((timeDiff * connectsPerSecond) / 1000); - numConnects = min(numConnects, (MAX_OUTSTANDING_CONNECTIONS - (numConnections - numConnected))); - - // Do the connects. - /////////////////// - for(i = 0 ; i < numConnects ; i++) - { - // Need to check because it can change in the loop. - /////////////////////////////////////////////////// - if(numConnections < maxConnections) - { - // Pick a random profile. - ///////////////////////// - profile = GetUninitializedProfile(); - - // Init it. - /////////// - InitializeProfile(profile); - - // Remember when we did the connect(s). - /////////////////////////////////////// - lastConnectTime = now; - } - } - } - - // Loop through all the profiles. - ///////////////////////////////// - for(i = 0 ; i < numProfiles ; i++) - { - // Process the profile. - /////////////////////// - ProcessProfile(&profiles[i]); - } -} - -void Run(void) -{ - bool done; - unsigned long now; -#if 0 - unsigned long nextInfoTime = 0; -#endif - // Get the current time. - //////////////////////// - now = current_time(); - - // Set when to shut down. - ///////////////////////// - startShutdownTime = (now + runTime); - - // Make up the last connect time. - ///////////////////////////////// - lastConnectTime = (now - 100); - - // Loop until we're done. - ///////////////////////// - for(done = false ; !done ; ) - { - // Get the current time. - //////////////////////// - now = current_time(); - - // Are we shutting down? - //////////////////////// - if(shuttingDown) - { - // Are we done? - /////////////// - if(numConnections == 0) - { - done = true; - } - } - else if(now > startShutdownTime) - { - // Time to start shutting down. - /////////////////////////////// - StartShutdown(now); - } - -#if 0 - // Is it time to print some info? - ///////////////////////////////// - if(now > nextInfoTime) - { - static char buffer[256]; - - // Set when to next show info. - ////////////////////////////// - nextInfoTime = (now + SHOW_INFO_TIME); - - // Show the connection numbers. - /////////////////////////////// - sprintf(buffer, "INFO: Connections: %d current, %d highest, %d total\n", numConnections, highestConnections, totalConnections); - Log(buffer); - - // Show the connected numbers. - ////////////////////////////// - sprintf(buffer, "INFO: Connected: %d current, %d highest, %d total\n", numConnected, highestConnected, totalConnected); - Log(buffer); - - // Show that we're shutting down, or when we're shutting down. - ////////////////////////////////////////////////////////////// - if(shuttingDown) - sprintf(buffer, "INFO: Shutting down\n"); - else - { - unsigned long totalSeconds = ((startShutdownTime - now) / 1000); - unsigned long hours, minutes, seconds; - seconds = (totalSeconds % 60); - minutes = (totalSeconds / 60 % 60); - hours = (totalSeconds / 60 / 60); - sprintf(buffer, "INFO: Shut down in %d:%02d:%02d\n", hours, minutes, seconds); - } - Log(buffer); - } -#endif - - // Run a frame. - /////////////// - Frame(now); - - // Take a break. - //////////////// - msleep(10); - } -} - -bool ParseArgs(int argc, char ** argv) -{ - int i; -/* - // Check for the file index. - //////////////////////////// - if(argc < 2) - { - printf("Usage: %s \n", argv[0]); - return false; - } - sprintf(profilesFile, "stress%d.txt", atoi(argv[1])); -*/ - // Set defaults. - //////////////// - maxConnections = DEFAULT_MAX_CONNECTED; - runTime = DEFAULT_RUN_TIME; - connectsPerSecond = DEFAULT_CONNECTS_PER_SEC; - - // Check args. - ////////////// - for(i = 1 ; i < argc ; i++) - { - // Check for max connected profiles. - //////////////////////////////////// - if(strcasecmp(argv[i], "-m") == 0) - { - if(++i < argc) - { - maxConnections = atoi(argv[i]); - if(maxConnections <= 0) - maxConnections = DEFAULT_MAX_CONNECTED; - } - } - // Check for how long to run. - ///////////////////////////// - else if(strcasecmp(argv[i], "-t") == 0) - { - if(++i < argc) - { - runTime = (atoi(argv[i]) * 1000); - if(runTime <= 0) - runTime = DEFAULT_RUN_TIME; - } - } - // Check for connections per second. - //////////////////////////////////// - else if(strcasecmp(argv[i], "-s") == 0) - { - if(++i < argc) - { - connectsPerSecond = atoi(argv[i]); - if(connectsPerSecond <= 0) - connectsPerSecond = DEFAULT_CONNECTS_PER_SEC; - } - } - } - - return true; -} - -int main(int argc, char ** argv) -{ - // Parse args. - ////////////// - if(!ParseArgs(argc, argv)) - return 1; - - // Initialize. - ////////////// - if(!Initialize()) - return 1; - -#if 0 - // Validate the loaded profiles. - //////////////////////////////// - if(!Validate()) - return 1; -#endif - - // Do all that stuff. - ///////////////////// - Run(); - - // Cleanup. - /////////// - Shutdown(); - - return 0; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress.dsp deleted file mode 100644 index 4c862c87b96..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress.dsp +++ /dev/null @@ -1,426 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gpstress" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gpstress - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gpstress.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gpstress.mak" CFG="gpstress - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gpstress - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gpstress - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gpstress - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W4 /WX /GX /O2 /I "../../common" /I "../../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gpstress - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gpstress___Win32_Debug" -# PROP BASE Intermediate_Dir "gpstress___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W4 /WX /Gm /GX /ZI /Od /I "../../common" /I "../../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gpstress - Win32 Release" -# Name "gpstress - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gpstress.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Group "PresenceSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\gp.c -# End Source File -# Begin Source File - -SOURCE=..\gp.h -# End Source File -# Begin Source File - -SOURCE=..\gpi.c -# End Source File -# Begin Source File - -SOURCE=..\gpi.h -# End Source File -# Begin Source File - -SOURCE=..\gpiBuddy.c -# End Source File -# Begin Source File - -SOURCE=..\gpiBuddy.h -# End Source File -# Begin Source File - -SOURCE=..\gpiBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiCallback.c -# End Source File -# Begin Source File - -SOURCE=..\gpiCallback.h -# End Source File -# Begin Source File - -SOURCE=..\gpiConnect.c -# End Source File -# Begin Source File - -SOURCE=..\gpiConnect.h -# End Source File -# Begin Source File - -SOURCE=..\gpiInfo.c -# End Source File -# Begin Source File - -SOURCE=..\gpiInfo.h -# End Source File -# Begin Source File - -SOURCE=..\gpiKeys.c -# End Source File -# Begin Source File - -SOURCE=..\gpiKeys.h -# End Source File -# Begin Source File - -SOURCE=..\gpiOperation.c -# End Source File -# Begin Source File - -SOURCE=..\gpiOperation.h -# End Source File -# Begin Source File - -SOURCE=..\gpiPeer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiPeer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiProfile.c -# End Source File -# Begin Source File - -SOURCE=..\gpiProfile.h -# End Source File -# Begin Source File - -SOURCE=..\gpiSearch.c -# End Source File -# Begin Source File - -SOURCE=..\gpiSearch.h -# End Source File -# Begin Source File - -SOURCE=..\gpiTransfer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiTransfer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiUnique.c -# End Source File -# Begin Source File - -SOURCE=..\gpiUnique.h -# End Source File -# Begin Source File - -SOURCE=..\gpiUtility.c -# End Source File -# Begin Source File - -SOURCE=..\gpiUtility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\gt2\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress_vs2005.vcproj deleted file mode 100644 index 08fa328114f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress_vs2005.vcproj +++ /dev/null @@ -1,869 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gpstress/gpstress_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/StdAfx.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/StdAfx.cpp deleted file mode 100644 index e5d5a392108..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// gptest.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/StdAfx.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/StdAfx.h deleted file mode 100644 index 9b70ff8ddcd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/StdAfx.h +++ /dev/null @@ -1,30 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__8A9E3741_2C27_4AC4_AB95_C33A19DEB835__INCLUDED_) -#define AFX_STDAFX_H__8A9E3741_2C27_4AC4_AB95_C33A19DEB835__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include // MFC socket extensions - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#include "../gp.h" -#include "../../common/gsAvailable.h" - -#endif // !defined(AFX_STDAFX_H__8A9E3741_2C27_4AC4_AB95_C33A19DEB835__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.cpp deleted file mode 100644 index 615e5ade675..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// gptest.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "gptest.h" -#include "gptestDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CGptestApp - -BEGIN_MESSAGE_MAP(CGptestApp, CWinApp) - //{{AFX_MSG_MAP(CGptestApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CGptestApp construction - -CGptestApp::CGptestApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CGptestApp object - -CGptestApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CGptestApp initialization - -BOOL CGptestApp::InitInstance() -{ - if (!AfxSocketInit()) - { - AfxMessageBox(IDP_SOCKETS_INIT_FAILED); - return FALSE; - } - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. -/* -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif -*/ - CGptestDlg dlg; - m_pMainWnd = &dlg; - int nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: Place code here to handle when the dialog is - // dismissed with OK - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} - -int CGptestApp::ExitInstance() -{ - // TODO: Add your specialized code here and/or call the base class - - return CWinApp::ExitInstance(); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.dsp deleted file mode 100644 index 049f1ae8d71..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.dsp +++ /dev/null @@ -1,430 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gptest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=gptest - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gptest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gptest.mak" CFG="gptest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gptest - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "gptest - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gptest - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "gptest - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\\" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gptest - Win32 Release" -# Name "gptest - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gptest.cpp -# End Source File -# Begin Source File - -SOURCE=.\gptest.rc -# End Source File -# Begin Source File - -SOURCE=.\gptestDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\gptest.h -# End Source File -# Begin Source File - -SOURCE=.\gptestDlg.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\gptest.ico -# End Source File -# Begin Source File - -SOURCE=.\res\gptest.rc2 -# End Source File -# End Group -# Begin Group "PresenceSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\gp.c -# End Source File -# Begin Source File - -SOURCE=..\gpi.c -# End Source File -# Begin Source File - -SOURCE=..\gpi.h -# End Source File -# Begin Source File - -SOURCE=..\gpiBuddy.c -# End Source File -# Begin Source File - -SOURCE=..\gpiBuddy.h -# End Source File -# Begin Source File - -SOURCE=..\gpiBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiCallback.c -# End Source File -# Begin Source File - -SOURCE=..\gpiCallback.h -# End Source File -# Begin Source File - -SOURCE=..\gpiConnect.c -# End Source File -# Begin Source File - -SOURCE=..\gpiConnect.h -# End Source File -# Begin Source File - -SOURCE=..\gpiInfo.c -# End Source File -# Begin Source File - -SOURCE=..\gpiInfo.h -# End Source File -# Begin Source File - -SOURCE=..\gpiKeys.c -# End Source File -# Begin Source File - -SOURCE=..\gpiKeys.h -# End Source File -# Begin Source File - -SOURCE=..\gpiOperation.c -# End Source File -# Begin Source File - -SOURCE=..\gpiOperation.h -# End Source File -# Begin Source File - -SOURCE=..\gpiPeer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiPeer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiProfile.c -# End Source File -# Begin Source File - -SOURCE=..\gpiProfile.h -# End Source File -# Begin Source File - -SOURCE=..\gpiSearch.c -# End Source File -# Begin Source File - -SOURCE=..\gpiSearch.h -# End Source File -# Begin Source File - -SOURCE=..\gpiTransfer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiTransfer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiUnique.c -# End Source File -# Begin Source File - -SOURCE=..\gpiUnique.h -# End Source File -# Begin Source File - -SOURCE=..\gpiUtility.c -# End Source File -# Begin Source File - -SOURCE=..\gpiUtility.h -# End Source File -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\..\gt2\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.h deleted file mode 100644 index 4be6f8ddcd7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.h +++ /dev/null @@ -1,50 +0,0 @@ -// gptest.h : main header file for the GPTEST application -// - -#if !defined(AFX_GPTEST_H__FFE82BD6_F31E_4222_818F_A8EE211E15E4__INCLUDED_) -#define AFX_GPTEST_H__FFE82BD6_F31E_4222_818F_A8EE211E15E4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CGptestApp: -// See gptest.cpp for the implementation of this class -// - -class CGptestApp : public CWinApp -{ -public: - CGptestApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CGptestApp) - public: - virtual BOOL InitInstance(); - virtual int ExitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CGptestApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_GPTEST_H__FFE82BD6_F31E_4222_818F_A8EE211E15E4__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.rc b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.rc deleted file mode 100644 index b6407021c17..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest.rc +++ /dev/null @@ -1,397 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\gptest.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\gptest.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_GPTEST_DIALOG DIALOGEX 0, 0, 610, 457 -STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "gptest" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - EDITTEXT IDC_EMAIL,61,29,111,12,ES_AUTOHSCROLL - EDITTEXT IDC_NICK,61,43,111,12,ES_AUTOHSCROLL - EDITTEXT IDC_PASSWORD,61,57,111,12,ES_PASSWORD | ES_AUTOHSCROLL - PUSHBUTTON "Connect",IDC_CONNECT,15,101,48,14 - PUSHBUTTON "Disconnect",IDC_DISCONNECT,205,101,55,14 - CONTROL "Blocking",IDC_BLOCKING,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,192,86,41,8 - PUSHBUTTON "Check User",IDC_CHECK,192,29,55,12 - PUSHBUTTON "New User",IDC_NEWUSER,192,43,55,12 - PUSHBUTTON "Update",IDC_UPDATE,192,57,55,12 - PUSHBUTTON "Delete",IDC_DELETEPRO,275,15,31,12 - PUSHBUTTON "New:",IDC_NEWPRO,313,15,30,12 - EDITTEXT IDC_NEWNICK,348,14,50,12,ES_AUTOHSCROLL - CONTROL "R",IDC_REPLACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,401,15,20,10 - EDITTEXT IDC_SNICK,315,41,104,12,ES_AUTOHSCROLL - EDITTEXT IDC_SFIRSTNAME,315,67,104,12,ES_AUTOHSCROLL - EDITTEXT IDC_SLASTNAME,315,80,104,12,ES_AUTOHSCROLL - EDITTEXT IDC_SEMAIL,315,93,104,12,ES_AUTOHSCROLL - EDITTEXT IDC_SICQUIN,315,106,104,12,ES_AUTOHSCROLL - PUSHBUTTON "Search",IDC_SEARCH,275,123,28,14 - PUSHBUTTON "Valid Email?",IDC_VALIDATE,307,123,43,14 - PUSHBUTTON "Nicks",IDC_NICKS,355,123,23,14 - LISTBOX IDC_RESULTS,275,154,145,90,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - EDITTEXT IDC_REASON,321,263,99,12,ES_AUTOHSCROLL - PUSHBUTTON "Send Buddy Request",IDC_SENDREQUEST,276,247,75,13 - EDITTEXT IDC_SEARCH_SERVER,321,277,99,12,ES_AUTOHSCROLL - EDITTEXT IDC_STATUS,325,302,65,12,ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_STATUSSTRING,325,316,65,12,ES_AUTOHSCROLL - EDITTEXT IDC_LOCATIONSTRING,325,332,65,12,ES_AUTOHSCROLL - PUSHBUTTON " Set Status",IDC_SET,395,302,25,40,BS_CENTER | BS_MULTILINE - CONTROL "nick",IDC_RNICK,"Button",BS_AUTORADIOBUTTON | WS_GROUP,275,356,30,10 - CONTROL "name",IDC_RNAME,"Button",BS_AUTORADIOBUTTON,305,356,30,10 - CONTROL "e-mail",IDC_REMAIL,"Button",BS_AUTORADIOBUTTON,335,356,30,10 - PUSHBUTTON "Report",IDC_REPORT,379,356,40,11,WS_GROUP - CONTROL "Auto",IDC_SAUTO,"Button",BS_AUTORADIOBUTTON | WS_GROUP,275,379,30,10 - CONTROL "1",IDC_S1,"Button",BS_AUTORADIOBUTTON,305,379,20,10 - CONTROL "2",IDC_S2,"Button",BS_AUTORADIOBUTTON,325,379,20,10 - CONTROL "3",IDC_S3,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,345,379,20,10 - CONTROL "4",IDC_S4,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,365,379,20,10 - CONTROL "5",IDC_S5,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,385,379,20,10 - CONTROL "6",IDC_S6,"Button",BS_AUTORADIOBUTTON | WS_DISABLED,405,379,17,10 - CONTROL "Local",IDC_S7,"Button",BS_AUTORADIOBUTTON,275,395,33,10 - CONTROL "Other:",IDC_SOTHER,"Button",BS_AUTORADIOBUTTON,307,395,30,10 - EDITTEXT IDC_OTHER_SERVER,339,393,80,12,ES_AUTOHSCROLL | WS_GROUP - EDITTEXT IDC_PATH,300,419,80,12,ES_AUTOHSCROLL - EDITTEXT IDC_NAME,300,435,80,12,ES_AUTOHSCROLL - PUSHBUTTON "Send",IDC_SEND_FILES,386,419,35,25 - LISTBOX IDC_BUDDIES,10,169,63,164,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - EDITTEXT IDC_IFIRSTNAME,179,170,35,12,ES_AUTOHSCROLL - EDITTEXT IDC_ILASTNAME,215,170,45,12,ES_AUTOHSCROLL - EDITTEXT IDC_INICK,200,199,60,12,ES_AUTOHSCROLL | ES_READONLY - EDITTEXT IDC_IEMAIL,200,214,60,12,ES_AUTOHSCROLL | ES_READONLY - EDITTEXT IDC_IICQUIN,200,228,60,12,ES_AUTOHSCROLL | ES_NUMBER - EDITTEXT IDC_IHOMEPAGE,200,244,60,12,ES_AUTOHSCROLL - EDITTEXT IDC_IBIRTHMONTH,190,259,15,12,ES_AUTOHSCROLL - EDITTEXT IDC_IBIRTHDAY,210,259,15,12,ES_AUTOHSCROLL - EDITTEXT IDC_IBIRTHYEAR,230,259,30,12,ES_AUTOHSCROLL - EDITTEXT IDC_ISEX,200,274,60,12,ES_AUTOHSCROLL - EDITTEXT IDC_ICOUNTRYCODE,200,289,60,12,ES_AUTOHSCROLL - EDITTEXT IDC_IZIPCODE,200,304,60,12,ES_AUTOHSCROLL - PUSHBUTTON "Set Info",IDC_SETINFO,204,393,48,13 - CONTROL "homepage",IDC_IPMHOMEPAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,396,50,10 - CONTROL "zipcode",IDC_IPMZIPCODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,385,40,10 - CONTROL "countrycode",IDC_IPMCOUNTRYCODE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,385,52,10 - CONTROL "birthday",IDC_IPMBIRTHDAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,396,40,10 - CONTROL "sex",IDC_IPMSEX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,407,25,10 - CONTROL "e-mail",IDC_IPMEMAIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,143,418,35,10 - EDITTEXT IDC_IADDRESS,200,363,60,12,ES_AUTOHSCROLL | ES_READONLY - EDITTEXT IDC_MESSAGE,48,436,142,12,ES_AUTOHSCROLL | ES_WANTRETURN - PUSHBUTTON "Send",IDC_SEND,194,435,33,13 - PUSHBUTTON "Delete",IDC_DELETE,17,337,46,12 - PUSHBUTTON "Delete All",IDC_DELETEALL,17,354,46,12,WS_GROUP - PUSHBUTTON "Refresh",IDC_REFRESH,17,370,46,12 - CONTROL "cache info",IDC_INFO_CACHE,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,203,411,51,10 - PUSHBUTTON "Invite Player",IDC_INVITE_PLAYER,437,425,48,12 - EDITTEXT IDC_INVITE_PLAYER_ID,537,425,57,12,ES_AUTOHSCROLL | ES_WANTRETURN - EDITTEXT IDC_CODE,451,19,142,12,ES_AUTOHSCROLL | ES_READONLY - EDITTEXT IDC_STRING,451,35,142,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "e-mail:",IDC_STATIC,15,31,21,8 - LTEXT "password:",IDC_STATIC,15,59,33,8 - LTEXT "nick:",IDC_STATIC,15,44,16,8 - GROUPBOX "Login",IDC_STATIC,10,5,256,155 - GROUPBOX "Buddies",IDC_STATIC,7,160,68,266 - GROUPBOX "Status",IDC_STATIC,269,292,155,55 - LTEXT "status:",IDC_STATIC,275,304,21,8 - LTEXT "locationString:",IDC_STATIC,275,334,46,8 - LTEXT "statusString:",IDC_STATIC,275,319,41,8 - LTEXT "birthday:",IDC_STATIC,154,259,30,8 - LTEXT "name:",IDC_STATIC,155,171,20,8 - LTEXT "countrycode:",IDC_STATIC,154,289,43,8 - LTEXT "e-mail:",IDC_STATIC,154,214,23,8 - LTEXT "nick:",IDC_STATIC,154,199,20,8 - LTEXT "homepage:",IDC_STATIC,154,244,35,8 - LTEXT "icquin:",IDC_STATIC,154,228,23,8 - LTEXT "zipcode:",IDC_STATIC,154,304,27,8 - LTEXT "sex:",IDC_STATIC,154,274,14,8 - LTEXT "address:",IDC_STATIC,154,364,27,8 - LTEXT " message:",IDC_STATIC,13,438,33,8 - GROUPBOX "Search",IDC_STATIC,269,32,155,260 - LTEXT "e-mail:",IDC_STATIC,275,93,21,8 - LTEXT "nick:",IDC_STATIC,275,41,16,8 - LTEXT "first name:",IDC_STATIC,275,67,34,8 - LTEXT "last name:",IDC_STATIC,275,80,33,8 - LTEXT "icq uin:",IDC_STATIC,275,106,24,8 - LTEXT "RESULTS:",IDC_STATIC,275,143,40,8 - GROUPBOX "Error",IDC_STATIC,426,5,177,49 - LTEXT "code:",IDC_STATIC,431,21,18,8 - LTEXT "string:",IDC_STATIC,431,36,19,8 - LTEXT "reason:",IDC_STATIC,275,263,24,8 - GROUPBOX "Identify by",IDC_STATIC,269,347,100,23 - CONTROL "/",IDC_STATIC,"Static",SS_SIMPLE | WS_GROUP,204,259,8,8 - CONTROL "/",IDC_STATIC,"Static",SS_SIMPLE | WS_GROUP,224,259,8,8 - GROUPBOX "Profiles",IDC_STATIC,269,5,155,27 - GROUPBOX "Inviting",IDC_STATIC,426,408,177,42 - LTEXT "Product ID:",IDC_STATIC,493,427,37,8 - GROUPBOX "Profiles",IDC_STATIC,375,347,50,23 - GROUPBOX "Server",IDC_STATIC,269,370,155,39 - GROUPBOX "Send Files",IDC_STATIC,269,410,155,40 - LTEXT "Path:",IDC_STATIC,276,421,18,8 - LTEXT "Name:",IDC_STATIC,275,435,22,8 - LTEXT "search server:",IDC_STATIC,274,278,47,8 - CONTROL "Firewall",IDC_FIREWALL,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,192,74,40,8 - PUSHBUTTON "All",IDC_PUBLICMASK_ALL,83,409,25,16 - PUSHBUTTON "None",IDC_PUBLICMASK_NONE,111,409,26,16 - EDITTEXT IDC_ILONGITUDE,200,319,60,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "longitude:",IDC_STATIC,154,319,35,8 - EDITTEXT IDC_ILATITUDE,200,334,60,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "latitude:",IDC_STATIC,154,334,25,8 - EDITTEXT IDC_IPLACE,200,348,60,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "place:",IDC_STATIC,154,348,23,8 - GROUPBOX "publicmask",IDC_STATIC,79,376,105,54 - PUSHBUTTON "Revoke Buddy Auth",IDC_REVOKE,16,388,48,20,BS_MULTILINE - EDITTEXT IDC_SUNIQUENICK,315,54,104,12,ES_AUTOHSCROLL - LTEXT "unique nick:",IDC_STATIC,275,54,40,8 - EDITTEXT IDC_UNIQUENICK,61,72,111,12,ES_AUTOHSCROLL - LTEXT "uniquenick:",IDC_STATIC,15,74,38,8 - EDITTEXT IDC_IUNIQUENICK,200,185,60,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "uniquenick:",IDC_STATIC,154,185,38,8 - PUSHBUTTON "Suggest",IDC_SUGGEST,383,123,31,14 - PUSHBUTTON "ConnectUniquenick",IDC_CONNECTUNIQUE,67,101,72,14 - PUSHBUTTON "ConnectPreAuth",IDC_CONNECTPREAUTH,143,101,58,14 - EDITTEXT IDC_AUTHTOKEN,61,116,198,12,ES_AUTOHSCROLL - EDITTEXT IDC_PARTNERCHALLENGE,61,130,198,12,ES_AUTOHSCROLL - EDITTEXT IDC_NAMESPACE,65,14,31,12,ES_AUTOHSCROLL - LTEXT "namespaceid:",IDC_STATIC,15,16,45,8 - PUSHBUTTON "Initialize",IDC_INITIALIZE,177,14,42,12 - PUSHBUTTON "Destroy",IDC_DESTROY,221,14,42,12 - PUSHBUTTON "UTM",IDC_UTM,229,435,30,13 - EDITTEXT IDC_PARTNERID,131,14,41,12,ES_AUTOHSCROLL - LTEXT "partnerid:",IDC_STATIC,99,16,30,8 - EDITTEXT IDC_PRODUCTID,61,86,111,12,ES_AUTOHSCROLL - LTEXT "productid:",IDC_STATIC,15,88,32,8 - GROUPBOX "Basic Status Info",IDC_STATIC,426,55,177,232,WS_DISABLED - COMBOBOX IDC_STATUS_STATE,461,71,73,66,CBS_DROPDOWN | WS_DISABLED | WS_VSCROLL | WS_TABSTOP - LTEXT "State:",IDC_STATELABEL,434,72,19,8 - LTEXT "Rich Status:",IDC_RSLABEL,433,270,40,8 - EDITTEXT IDC_RICH_STATUS,494,268,101,12,ES_AUTOHSCROLL | WS_DISABLED - EDITTEXT IDC_QPORT,494,126,101,13,ES_AUTOHSCROLL | WS_DISABLED - EDITTEXT IDC_HPORT,494,143,101,13,ES_AUTOHSCROLL | WS_DISABLED - LISTBOX IDC_SFLAGS,520,159,75,54,LBS_SORT | LBS_MULTIPLESEL | LBS_NOINTEGRALHEIGHT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP - LTEXT "Host IP:",IDC_HOSTIPLABEL,433,91,28,13 - LTEXT "Host Private IP:",IDC_HOSTPRIVIPLABEL,433,110,50,11 - LTEXT "Query Port:",IDC_QPORTLABEL,433,128,38,11 - LTEXT "Host Port:",IDC_HPORTLABEL,433,145,38,11 - LTEXT "Session Flags:",IDC_SFLAGESLABEL,433,182,59,10 - LTEXT "Game Type:",IDC_GTLABEL,433,217,39,11 - LTEXT "Game Variant:",IDC_GVLABEL,433,235,49,11 - EDITTEXT IDC_GAME_TYPE,494,216,101,12,ES_AUTOHSCROLL | WS_DISABLED - EDITTEXT IDC_GAME_VARIANT,494,233,101,12,ES_AUTOHSCROLL | WS_DISABLED - EDITTEXT IDC_GAME_MAPNAME,494,249,101,12,ES_AUTOHSCROLL | WS_DISABLED - LTEXT "Game Mapname:",IDC_GMLABEL,433,251,56,11 - PUSHBUTTON "Set Status Info",IDC_SETSTATUSINFO,537,70,59,14,WS_DISABLED - GROUPBOX "Extended Status Info",IDC_EXTSTATUSINFO,426,292,177,113,WS_DISABLED - EDITTEXT IDC_EDIT1,493,303,102,12,ES_AUTOHSCROLL | WS_DISABLED - EDITTEXT IDC_EDIT2,493,318,102,12,ES_AUTOHSCROLL | WS_DISABLED - LTEXT "Key Name:",IDC_STATIC,433,306,39,9 - LTEXT "Key Value:",IDC_STATIC,433,320,35,9 - PUSHBUTTON "Add/Set",IDC_BUTTON2,435,339,42,14,WS_DISABLED - PUSHBUTTON "Delete",IDC_BUTTON3,485,339,37,14,WS_DISABLED - PUSHBUTTON "Get Value for Key",IDC_BUTTON4,531,339,64,14,WS_DISABLED - PUSHBUTTON "Get them!",IDC_BUTTON5,481,385,64,14,WS_DISABLED - LTEXT "Get Buddies Keys and Values (Buddy must be selected)",IDC_STATIC,465,364,98,20 - EDITTEXT IDC_HOST_IP,494,91,101,12,ES_AUTOHSCROLL | WS_DISABLED - EDITTEXT IDC_HOST_PRIVATE_IP,494,109,101,12,ES_AUTOHSCROLL | WS_DISABLED - PUSHBUTTON "Register CDKey",IDC_REGISTER_CDKEY,183,144,77,13 - EDITTEXT IDC_CDKEY,61,144,110,12,ES_AUTOHSCROLL - LTEXT "cdkey:",IDC_STATIC,15,145,33,8 - LTEXT "authtoken:",IDC_STATIC,15,118,37,8 - LTEXT "challenge:",IDC_STATIC,15,132,37,8 - GROUPBOX "Player Info",IDC_STATIC,151,160,114,218 - LISTBOX IDC_BLOCKLIST,82,169,62,164,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - GROUPBOX "Blocked List",IDC_STATIC,79,160,68,214 - PUSHBUTTON "Get Blocked List",IDC_GET_BLOCKEDLIST,84,337,58,13 - PUSHBUTTON "Remove Block",IDC_REMOVE_BLOCK,84,354,58,13 - PUSHBUTTON "Add Block",IDC_ADD_BLOCK,360,247,58,13 - GROUPBOX "Messaging",IDC_STATIC,7,428,258,22 - GROUPBOX "Set Player Info",IDC_STATIC,193,381,70,49 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "FileDescription", "gptest MFC Application" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "gptest" - VALUE "LegalCopyright", "Copyright (C) 1999" - VALUE "OriginalFilename", "gptest.EXE" - VALUE "ProductName", "gptest Application" - VALUE "ProductVersion", "1, 0, 0, 1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_GPTEST_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 603 - TOPMARGIN, 7 - BOTTOMMARGIN, 450 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog Info -// - -IDD_GPTEST_DIALOG DLGINIT -BEGIN - IDC_STATUS_STATE, 0x403, 8, 0 -0x664f, 0x6c66, 0x6e69, 0x0065, - IDC_STATUS_STATE, 0x403, 7, 0 -0x6e4f, 0x696c, 0x656e, "\000" - IDC_STATUS_STATE, 0x403, 8, 0 -0x6c50, 0x7961, 0x6e69, 0x0067, - IDC_STATUS_STATE, 0x403, 8, 0 -0x7453, 0x6761, 0x6e69, 0x0067, - IDC_STATUS_STATE, 0x403, 9, 0 -0x6843, 0x7461, 0x6974, 0x676e, "\000" - IDC_STATUS_STATE, 0x403, 5, 0 -0x7741, 0x7961, "\000" - 0 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\gptest.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptestDlg.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptestDlg.cpp deleted file mode 100644 index a8907693d54..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptestDlg.cpp +++ /dev/null @@ -1,2056 +0,0 @@ -// gptestDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "gptest.h" -#include "gptestDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -CGptestDlg * dlg; - -#define CHECK(result) { if((result) != GP_NO_ERROR) { OutputDebugString(#result " failed\n");}} - -#define PROCESS_TIME 20 - -#define GSI_DEFAULT_NAMESPACE 1 -#define GSI_TEST_PRODUCTID 0 -#define GSI_TEST_GAMENAME "gmtest" - - -void vsDebugOut(va_list args, const char * format, ...) -{ -#ifdef GSI_COMMON_DEBUG - char buffer[256]; - - // If args list is null then build it. - if(args == NULL) - { - va_start(args, format); - _vsnprintf(buffer, sizeof(buffer), format, args); - va_end(args); - } - else - _vsnprintf(buffer, sizeof(buffer), format, args); - - OutputDebugString(buffer); -#endif - GSI_UNUSED(args); - GSI_UNUSED(format); -} - -#ifdef GSI_COMMON_DEBUG - static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - { - GSI_UNUSED(theLevel); - - vsDebugOut(NULL, "[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - vsDebugOut(theParamList, theTokenStr); - } -#endif - - -///////////////////////////////////////////////////////////////////////////// -// CGptestDlg dialog - -CGptestDlg::CGptestDlg(CWnd* pParent /*=NULL*/) - : CDialog(CGptestDlg::IDD, pParent) - , m_StatusState(0) - , m_QueryPort(0) - , m_HostPort(0) - , m_RichStatus(_T("")) - , m_GameType(_T("")) - , m_GameVariant(_T("")) - , m_GameMapname(_T("")) - , m_KeyName(_T("")) - , m_KeyValue(_T("")) - , m_HostIp(_T("")) - , m_HostPrivateIp(_T("")) - , m_cdkey(_T("")) -{ - //{{AFX_DATA_INIT(CGptestDlg) - m_partnerid = 0; - m_email = _T(""); - m_nick = _T(""); - m_password = _T(""); - m_locationString = _T(""); - m_status = 1; - m_statusString = _T(""); - m_iaddress = _T(""); - m_icountrycode = _T(""); - m_iemail = _T(""); - m_ihomepage = _T(""); - m_iicquin = 0; - m_inick = _T(""); - m_isex = _T(""); - m_message = _T("Hi. This is a message!"); - m_sfirstname = _T(""); - m_snick = _T(""); - m_sicquin = 0; - m_slastname = _T(""); - m_semail = _T(""); - m_string = _T(""); - m_code = _T(""); - m_reason = _T("Hello."); - m_rnick = 0; - m_infoCache = TRUE; - m_blocking = FALSE; - m_ilastname = _T(""); - m_ifirstname = _T(""); - m_ibirthday = 0; - m_ibirthmonth = 0; - m_ibirthyear = 0; - m_ipmbirthday = FALSE; - m_ipmcountrycode = FALSE; - m_ipmhomepage = FALSE; - m_ipmsex = FALSE; - m_ipmzipcode = FALSE; - m_newnick = _T(""); - m_replace = FALSE; - m_izipcode = _T(""); - m_invitePlayerID = 1; - m_server = 0; - m_otherServer = _T(""); - m_name = _T(""); - m_path = _T(""); - m_searchServer = _T(""); - m_ipmemail = FALSE; - m_firewall = FALSE; - m_ilatitude = 0.0f; - m_iplace = _T(""); - m_ilongitude = 0.0f; - m_suniquenick = _T(""); - m_iuniquenick = _T(""); - m_uniquenick = _T(""); - m_authtoken = _T(""); - m_partnerchallenge = _T(""); - m_namespace = _T(""); - m_productid = 0; - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); - - -} - -void CGptestDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CGptestDlg) - DDX_Control(pDX, IDC_CONNECTUNIQUE, m_connectunique); - DDX_Control(pDX, IDC_CONNECTPREAUTH, m_connectpreauth); - DDX_Control(pDX, IDC_NEWUSER, m_newuser); - DDX_Control(pDX, IDC_SEARCH, m_search); - DDX_Control(pDX, IDC_RESULTS, m_results); - DDX_Control(pDX, IDC_UPDATE, m_update); - DDX_Control(pDX, IDC_SEND, m_send); - DDX_Control(pDX, IDC_SET, m_set); - DDX_Control(pDX, IDC_BUDDIES, m_buddies); - DDX_Control(pDX, IDC_DISCONNECT, m_disconnect); - DDX_Control(pDX, IDC_CONNECT, m_connect); - DDX_Text(pDX, IDC_PARTNERID, m_partnerid); - DDX_Text(pDX, IDC_EMAIL, m_email); - DDV_MaxChars(pDX, m_email, 50); - DDX_Text(pDX, IDC_NICK, m_nick); - DDV_MaxChars(pDX, m_nick, 30); - DDX_Text(pDX, IDC_PASSWORD, m_password); - DDV_MaxChars(pDX, m_password, 30); - DDX_Text(pDX, IDC_LOCATIONSTRING, m_locationString); - DDV_MaxChars(pDX, m_locationString, 255); - DDX_Text(pDX, IDC_STATUS, m_status); - DDV_MinMaxInt(pDX, m_status, 0, 100); - DDX_Text(pDX, IDC_STATUSSTRING, m_statusString); - DDV_MaxChars(pDX, m_statusString, 255); - DDX_Text(pDX, IDC_IADDRESS, m_iaddress); - DDX_Text(pDX, IDC_ICOUNTRYCODE, m_icountrycode); - DDV_MaxChars(pDX, m_icountrycode, 2); - DDX_Text(pDX, IDC_IEMAIL, m_iemail); - DDX_Text(pDX, IDC_IHOMEPAGE, m_ihomepage); - DDX_Text(pDX, IDC_IICQUIN, m_iicquin); - DDX_Text(pDX, IDC_INICK, m_inick); - DDX_Text(pDX, IDC_ISEX, m_isex); - DDX_Text(pDX, IDC_MESSAGE, m_message); - DDV_MaxChars(pDX, m_message, 1000); - DDX_Text(pDX, IDC_SFIRSTNAME, m_sfirstname); - DDV_MaxChars(pDX, m_sfirstname, 30); - DDX_Text(pDX, IDC_SNICK, m_snick); - DDV_MaxChars(pDX, m_snick, 30); - DDX_Text(pDX, IDC_SICQUIN, m_sicquin); - DDX_Text(pDX, IDC_SLASTNAME, m_slastname); - DDV_MaxChars(pDX, m_slastname, 30); - DDX_Text(pDX, IDC_SEMAIL, m_semail); - DDV_MaxChars(pDX, m_semail, 50); - DDX_Text(pDX, IDC_STRING, m_string); - DDX_Text(pDX, IDC_CODE, m_code); - DDX_Text(pDX, IDC_REASON, m_reason); - DDV_MaxChars(pDX, m_reason, 1024); - DDX_Radio(pDX, IDC_RNICK, m_rnick); - DDX_Check(pDX, IDC_INFO_CACHE, m_infoCache); - DDX_Check(pDX, IDC_BLOCKING, m_blocking); - DDX_Text(pDX, IDC_ILASTNAME, m_ilastname); - DDX_Text(pDX, IDC_IFIRSTNAME, m_ifirstname); - DDX_Text(pDX, IDC_IBIRTHDAY, m_ibirthday); - DDX_Text(pDX, IDC_IBIRTHMONTH, m_ibirthmonth); - DDX_Text(pDX, IDC_IBIRTHYEAR, m_ibirthyear); - DDX_Check(pDX, IDC_IPMBIRTHDAY, m_ipmbirthday); - DDX_Check(pDX, IDC_IPMCOUNTRYCODE, m_ipmcountrycode); - DDX_Check(pDX, IDC_IPMHOMEPAGE, m_ipmhomepage); - DDX_Check(pDX, IDC_IPMSEX, m_ipmsex); - DDX_Check(pDX, IDC_IPMZIPCODE, m_ipmzipcode); - DDX_Text(pDX, IDC_NEWNICK, m_newnick); - DDX_Check(pDX, IDC_REPLACE, m_replace); - DDX_Text(pDX, IDC_IZIPCODE, m_izipcode); - DDX_Text(pDX, IDC_INVITE_PLAYER_ID, m_invitePlayerID); - DDX_Radio(pDX, IDC_SAUTO, m_server); - DDX_Text(pDX, IDC_OTHER_SERVER, m_otherServer); - DDX_Text(pDX, IDC_NAME, m_name); - DDX_Text(pDX, IDC_PATH, m_path); - DDX_Text(pDX, IDC_SEARCH_SERVER, m_searchServer); - DDX_Check(pDX, IDC_IPMEMAIL, m_ipmemail); - DDX_Check(pDX, IDC_FIREWALL, m_firewall); - DDX_Text(pDX, IDC_ILATITUDE, m_ilatitude); - DDX_Text(pDX, IDC_IPLACE, m_iplace); - DDX_Text(pDX, IDC_ILONGITUDE, m_ilongitude); - DDX_Text(pDX, IDC_SUNIQUENICK, m_suniquenick); - DDV_MaxChars(pDX, m_suniquenick, 50); - DDX_Text(pDX, IDC_IUNIQUENICK, m_iuniquenick); - DDX_Text(pDX, IDC_UNIQUENICK, m_uniquenick); - DDV_MaxChars(pDX, m_uniquenick, 50); - DDX_Text(pDX, IDC_AUTHTOKEN, m_authtoken); - DDV_MaxChars(pDX, m_authtoken, 255); - DDX_Text(pDX, IDC_PARTNERCHALLENGE, m_partnerchallenge); - DDV_MaxChars(pDX, m_partnerchallenge, 255); - DDX_Text(pDX, IDC_NAMESPACE, m_namespace); - DDX_Text(pDX, IDC_PRODUCTID, m_productid); - //}}AFX_DATA_MAP - DDX_CBIndex(pDX, IDC_STATUS_STATE, m_StatusState); - DDX_Text(pDX, IDC_QPORT, m_QueryPort); - DDX_Text(pDX, IDC_HPORT, m_HostPort); - DDX_Control(pDX, IDC_SFLAGS, m_SessionFlags); - DDX_Text(pDX, IDC_RICH_STATUS, m_RichStatus); - DDX_Text(pDX, IDC_GAME_TYPE, m_GameType); - DDX_Text(pDX, IDC_GAME_VARIANT, m_GameVariant); - DDX_Text(pDX, IDC_GAME_MAPNAME, m_GameMapname); - DDX_Text(pDX, IDC_EDIT1, m_KeyName); - DDX_Text(pDX, IDC_EDIT2, m_KeyValue); - DDX_Text(pDX, IDC_HOST_IP, m_HostIp); - DDX_Text(pDX, IDC_HOST_PRIVATE_IP, m_HostPrivateIp); - DDX_Text(pDX, IDC_CDKEY, m_cdkey); - DDX_Control(pDX, IDC_BLOCKLIST, m_blocklist); - DDX_Control(pDX, IDC_GET_BLOCKEDLIST, m_getblockedlist); - DDX_Control(pDX, IDC_ADD_BLOCK, m_addblock); - DDX_Control(pDX, IDC_REMOVE_BLOCK, m_removeblock); -} - -BEGIN_MESSAGE_MAP(CGptestDlg, CDialog) - //{{AFX_MSG_MAP(CGptestDlg) - ON_WM_QUERYDRAGICON() - ON_WM_TIMER() - ON_BN_CLICKED(IDC_CONNECT, OnConnect) - ON_BN_CLICKED(IDC_DISCONNECT, OnDisconnect) - ON_WM_DESTROY() - ON_BN_CLICKED(IDC_SET, OnSet) - ON_LBN_SELCHANGE(IDC_BUDDIES, OnSelchangeBuddies) - ON_BN_CLICKED(IDC_SEND, OnSend) - ON_BN_CLICKED(IDC_REFRESH, OnRefresh) - ON_BN_CLICKED(IDC_UPDATE, OnUpdate) - ON_BN_CLICKED(IDC_SEARCH, OnSearch) - ON_LBN_SELCHANGE(IDC_RESULTS, OnSelchangeResults) - ON_BN_CLICKED(IDC_NEWUSER, OnNewuser) - ON_BN_CLICKED(IDC_SENDREQUEST, OnSendrequest) - ON_BN_CLICKED(IDC_INFO_CACHE, OnInfoCache) - ON_BN_CLICKED(IDC_DELETE, OnDelete) - ON_BN_CLICKED(IDC_SETINFO, OnSetinfo) - ON_BN_CLICKED(IDC_DELETEPRO, OnDeletepro) - ON_BN_CLICKED(IDC_NEWPRO, OnNewpro) - ON_BN_CLICKED(IDC_DELETEALL, OnDeleteall) - ON_BN_CLICKED(IDC_VALIDATE, OnValidate) - ON_BN_CLICKED(IDC_NICKS, OnNicks) - ON_BN_CLICKED(IDC_INVITE_PLAYER, OnInvitePlayer) - ON_BN_CLICKED(IDC_REPORT, OnReport) - ON_BN_CLICKED(IDC_CHECK, OnCheck) - ON_BN_CLICKED(IDC_SEND_FILES, OnSendFiles) - ON_EN_CHANGE(IDC_SEARCH_SERVER, OnChangeSearchServer) - ON_BN_CLICKED(IDC_PUBLICMASK_ALL, OnPublicmaskAll) - ON_BN_CLICKED(IDC_PUBLICMASK_NONE, OnPublicmaskNone) - ON_BN_CLICKED(IDC_REVOKE, OnRevoke) - ON_BN_CLICKED(IDC_SUGGEST, OnSuggest) - ON_BN_CLICKED(IDC_CONNECTUNIQUE, OnConnectunique) - ON_BN_CLICKED(IDC_CONNECTPREAUTH, OnConnectpreauth) - ON_BN_CLICKED(IDC_INITIALIZE, OnInitialize) - ON_BN_CLICKED(IDC_DESTROY, OnDestroyGP) - ON_WM_CREATE() - ON_BN_CLICKED(IDC_UTM, OnUTM) - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_SETSTATUSINFO, OnSetstatusinfo) - ON_BN_CLICKED(IDC_BUTTON2, OnAddSetKey) - ON_BN_CLICKED(IDC_BUTTON4, OnGetKeyValue) - ON_BN_CLICKED(IDC_BUTTON5, OnGetBuddyKeys) - ON_BN_CLICKED(IDC_BUTTON3, OnDelKeyVal) - ON_BN_CLICKED(IDC_REGISTER_CDKEY, OnRegisterCdKey) - ON_BN_CLICKED(IDC_GET_BLOCKEDLIST, OnGetBlocked) - ON_LBN_SELCHANGE(IDC_BLOCKLIST, OnSelchangeBlocklist) - ON_BN_CLICKED(IDC_ADD_BLOCK, OnAddBlock) - ON_BN_CLICKED(IDC_REMOVE_BLOCK, OnRemoveBlock) -END_MESSAGE_MAP() - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CGptestDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - -//GP CALLBACKS -////////////// -void ConnectResponse(GPConnection * connection, void * arg_, void * param) -{ - GPConnectResponseArg * arg = (GPConnectResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - dlg->m_StatusState = dlg->m_status = GP_ONLINE; - dlg->m_statusString = "Online"; - dlg->m_locationString = ""; - - dlg->m_uniquenick = arg->uniquenick; - //dlg->m_RichStatus = "Online"; - dlg->UpdateData(FALSE); - - gpSetStatus(connection, (GPEnum)dlg->m_status, dlg->m_statusString, dlg->m_locationString); - //gpSetStatusInfo(connection, (GPEnum)dlg->m_StatusState, 0, 0, 0, 0, 0, dlg->m_RichStatus, dlg->m_RichStatus.GetLength(), "", 0, "", 0, "", 0); - CString text; - text.Format("Connected as profileid %d\r\n", arg->profile); - OutputDebugString((LPCSTR)text); - } - else - { - dlg->MessageBox("Connect failed"); - } - GSI_UNUSED(param); -} - -void CheckResponse(GPConnection * connection, void * arg_, void * param) -{ - GPCheckResponseArg * arg = (GPCheckResponseArg *)arg_; - - CString strMessage; - char buf[16]; - - strMessage.Format("%s@%s (%s)\n", dlg->m_nick, dlg->m_email, dlg->m_password); - - if(arg->result == GP_NO_ERROR) - { - strMessage += "pid = "; - itoa(arg->profile, buf, 10); - strMessage += buf; - } - else - { - GPErrorCode errorCode; - gpGetErrorCode(connection, &errorCode); - if(errorCode == GP_CHECK_BAD_EMAIL) - strMessage += "Invalid e-mail"; - else if(errorCode == GP_CHECK_BAD_PASSWORD) - strMessage += "Invalid password"; - else if(errorCode == GP_CHECK_BAD_NICK) - strMessage += "Invalid nick"; - } - - dlg->MessageBox(strMessage); - GSI_UNUSED(param); -} - -void NewUserResponse(GPConnection * connection, void * arg_, void * param) -{ - GPNewUserResponseArg * arg = (GPNewUserResponseArg *)arg_; - - CString strMessage; - char buf[16]; - - if(arg->result == GP_NO_ERROR) - { - strMessage = "Success\n"; - - strMessage += "pid = "; - itoa(arg->profile, buf, 10); - strMessage += buf; - } - else - { - strMessage += "Error\n"; - - GPErrorCode errorCode; - gpGetErrorCode(connection, &errorCode); - if(errorCode == GP_NEWUSER_BAD_PASSWORD) - strMessage += "Invalid password"; - else if(errorCode == GP_NEWUSER_BAD_NICK) - { - strMessage += "Profile already exists: "; - itoa(arg->profile, buf, 10); - strMessage += buf; - } - else if(errorCode == GP_NEWUSER_UNIQUENICK_INUSE) - strMessage += "Uniquenick in use"; - else if(errorCode == GP_NEWUSER_UNIQUENICK_INVALID) - strMessage += "Uniquenick invalid"; - } - - dlg->MessageBox(strMessage, "New User"); - GSI_UNUSED(param); -} - -void RecvBuddyStatus(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyStatusArg * arg = (GPRecvBuddyStatusArg *)arg_; - GPBuddyStatus status; - - char intValue[16]; - int index; - CString string; - int i; - int count; - bool online; - static int onlinecount; - - //CHECK(gpGetBuddyStatusInfo(connection, arg->index, &status)); - CHECK(gpGetBuddyStatus(connection, arg->index, &status)); - - if(status.status == GP_ONLINE) - { - string = "ON:"; - online = true; - } - sprintf(intValue, "%04d", arg->profile); - string += intValue; - - count = dlg->m_buddies.GetCount(); - for(i = 0 ; i < count ; i++) - if(dlg->m_buddies.GetItemData(i) == (DWORD)arg->profile) - dlg->m_buddies.DeleteString(i); - - CString text; - count = dlg->m_buddies.GetCount(); - for(i = 0 ; i < count ; i++) - { - dlg->m_buddies.GetText(i, text); - if(text.Left(3).Compare("ON:") != 0) - break; - } - index = dlg->m_buddies.InsertString(i, string); - dlg->m_buddies.SetItemData(index, (DWORD)arg->profile); - GSI_UNUSED(param); -} - -void GetInfoResponse(GPConnection * connection, void * arg_, void * param) -{ - GPGetInfoResponseArg * arg = (GPGetInfoResponseArg *)arg_; - - int index; - //GPBuddyStatusInfo statusInfo; - GPBuddyStatus status; - IN_ADDR addr; - char intValue[16]; - addr.s_addr = 0; - if(arg->result == GP_NO_ERROR) - { - // Get this guy's buddy status. - /////////////////////////////// - if(arg->profile) - { - gpGetBuddyIndex(&dlg->m_connection, arg->profile, &index); - if(index != -1) - { - //gpGetBuddyStatusInfo(&dlg->m_connection, index, &statusInfo); - gpGetBuddyStatus(&dlg->m_connection, index, &status); - //addr.S_un.S_addr = statusInfo.buddyIp; - addr.S_un.S_addr = status.ip; - } - } - else - { - index = -1; - } - - // Set the stuff. - ///////////////// - dlg->UpdateData(); - dlg->m_ifirstname = arg->firstname; - dlg->m_ilastname = arg->lastname; - dlg->m_inick = arg->nick; - dlg->m_iuniquenick = arg->uniquenick; - dlg->m_iemail = arg->email; - dlg->m_iicquin = arg->icquin; - dlg->m_ihomepage = arg->homepage; - dlg->m_ibirthday = arg->birthday; - dlg->m_ibirthmonth = arg->birthmonth; - dlg->m_ibirthyear = arg->birthyear; - dlg->m_isex = (arg->sex == GP_MALE)?"Male":((arg->sex == GP_FEMALE)?"Female":"Pat"); - dlg->m_icountrycode = arg->countrycode; - dlg->m_izipcode = arg->zipcode; - dlg->m_ilongitude = arg->longitude; - dlg->m_ilatitude = arg->latitude; - dlg->m_iplace = arg->place; - dlg->m_ipmhomepage = (arg->publicmask & GP_MASK_HOMEPAGE)?TRUE:FALSE; - dlg->m_ipmzipcode = (arg->publicmask & GP_MASK_ZIPCODE)?TRUE:FALSE; - dlg->m_ipmcountrycode = (arg->publicmask & GP_MASK_COUNTRYCODE)?TRUE:FALSE; - dlg->m_ipmbirthday = (arg->publicmask & GP_MASK_BIRTHDAY)?TRUE:FALSE; - dlg->m_ipmsex = (arg->publicmask & GP_MASK_SEX)?TRUE:FALSE; - dlg->m_ipmemail = (arg->publicmask & GP_MASK_EMAIL)?TRUE:FALSE; - if(index != -1) - { - dlg->m_iaddress = inet_ntoa(addr); - dlg->m_iaddress += ":"; - //itoa(statusInfo.buddyPort, intValue, 10); - itoa(status.port, intValue, 10); - dlg->m_iaddress += intValue; - dlg->m_status = status.status; - dlg->m_statusString = status.statusString; - dlg->m_locationString = status.locationString; - - /* - dlg->m_StatusState = statusInfo.statusState; - dlg->m_RichStatus = statusInfo.richStatus; - dlg->m_GameType = statusInfo.gameType; - dlg->m_GameVariant = statusInfo.gameVariant; - dlg->m_GameMapname = statusInfo.gameMapName; - addr.s_addr = statusInfo.hostIp; - dlg->m_HostIp = inet_ntoa(addr); - addr.s_addr = statusInfo.hostPrivateIp; - dlg->m_HostPrivateIp = inet_ntoa(addr); - dlg->m_HostPort = statusInfo.hostPort; - dlg->m_QueryPort = statusInfo.queryPort; - - for (int i = 0; i < dlg->m_SessionFlags.GetCount(); i++) - { - int flag = dlg->m_SessionFlags.GetItemData(i); - if (statusInfo.sessionFlags & flag) - dlg->m_SessionFlags.SetSel(i, TRUE); - else - dlg->m_SessionFlags.SetSel(i, FALSE); - } - */ - } - else - { - dlg->m_iaddress = ""; - dlg->m_StatusState = 0; - //dlg->m_statusString = ""; - //dlg->m_locationString = ""; - - dlg->m_RichStatus = ""; - dlg->m_GameType = ""; - dlg->m_GameVariant = ""; - dlg->m_GameMapname = ""; - dlg->m_HostIp = "0.0.0.0"; - dlg->m_HostPrivateIp = "0.0.0.0"; - dlg->m_HostPort = 0; - dlg->m_QueryPort = 0; - - for (int i=0; i < dlg->m_SessionFlags.GetCount(); i++) - dlg->m_SessionFlags.SetSel(0, FALSE); - - } - dlg->UpdateData(FALSE); - } - else - { - dlg->MessageBox("GetInfo failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void Error(GPConnection * connection, void * arg_, void * param) -{ - GPErrorArg * arg = (GPErrorArg *)arg_; - - if(arg->fatal == GP_FATAL) - { - MessageBox(NULL, arg->errorString, "Fatal Error", MB_OK | MB_ICONERROR | MB_APPLMODAL); - } - else - { - MessageBox(NULL, arg->errorString, "Error", MB_OK | MB_ICONERROR | MB_APPLMODAL); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -char whois[128]; - -void Whois(GPConnection * connection, void * arg_, void * param) -{ - GPGetInfoResponseArg * arg = (GPGetInfoResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - dlg->UpdateData(); - switch(dlg->m_rnick) - { - // Nick. - //////// - case 0: - strcpy(whois, arg->nick); - break; - // Name. - //////// - case 1: - strcpy(whois, arg->firstname); - strcat(whois, " "); - strcat(whois, arg->lastname); - break; - // Email. - ///////// - case 2: - strcpy(whois, arg->email); - break; - } - } - else - { - dlg->MessageBox("Whois failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvBuddyMessage(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyMessageArg * arg = (GPRecvBuddyMessageArg *)arg_; - - dlg->UpdateData(); - gpGetInfo(connection, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, Whois, NULL); - - char msg[4096]; - sprintf(msg, "%s: %s", whois, arg->message); - char * str = gsiSecondsToString((time_t *)&arg->date); - char date[256]; - strcpy(date, str); - date[strlen(str) - 1] = '\0'; - -#if 0 - OutputDebugString(msg); - OutputDebugString("\n"); -#else - if(MessageBox(NULL, msg, date, MB_YESNO | MB_APPLMODAL) == IDYES) - { - gpSendBuddyMessage(connection, arg->profile, "Thanks for the message!"); - } -#endif - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvBuddyUTM(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyUTMArg * arg = (GPRecvBuddyUTMArg *)arg_; - - dlg->UpdateData(); - gpGetInfo(connection, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, Whois, NULL); - - char msg[4096]; - sprintf(msg, "[UTM] %s: %s", whois, arg->message); - char * str = gsiSecondsToString((time_t *)&arg->date); - char date[256]; - strcpy(date, str); - date[strlen(str) - 1] = '\0'; - -#if 0 - OutputDebugString(msg); - OutputDebugString("\n"); -#else - if(MessageBox(NULL, msg, date, MB_YESNO | MB_APPLMODAL) == IDYES) - { - char* message = "Thanks for the message!"; - gpSendBuddyUTM(connection, arg->profile, message, 0); - } -#endif - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvBuddyRevoke(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyRevokeArg * arg = (GPRecvBuddyRevokeArg *)arg_; - - dlg->UpdateData(); - - if (gpIsBuddy(connection, arg->profile)) - { - char * str = gsiSecondsToString((time_t *)&arg->date); - char date[256]; - strcpy(date, str); - date[strlen(str) - 1] = '\0'; - - CString message; - message.Format("User %d has revoked their buddy authorization.", arg->profile); - MessageBox(NULL, (LPCSTR)message, date, MB_OK); - - // Remove them from the UI list - int index = 0; - while (index < dlg->m_buddies.GetCount()) - { - GPProfile profile = (GPProfile)dlg->m_buddies.GetItemData(index); - if (profile == arg->profile) - { - dlg->m_buddies.DeleteString(index); - break; - } - index++; - } - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -GPProfileSearchMatch searchMatches[100]; - -void ProfileSearchResponse(GPConnection * connection, void * arg_, void * param) -{ - GPProfileSearchResponseArg * arg = (GPProfileSearchResponseArg *)arg_; - - // Check the results. - ///////////////////// - if(arg->result == GP_NO_ERROR) - { - // Loop through the matches. - //////////////////////////// - for(int i = 0 ; (i < arg->numMatches) && (i < (sizeof(searchMatches) / sizeof(searchMatches[0]))) ; i++) - { - // Add it to the list. - ////////////////////// - dlg->m_results.InsertString(i, arg->matches[i].nick); - dlg->m_results.SetItemData(i, (DWORD)arg->matches[i].profile); - // Save the match. - ////////////////// - memcpy(&searchMatches[i], &arg->matches[i], sizeof(GPProfileSearchMatch)); - } - - if(arg->more == GP_MORE) - { - if(dlg->MessageBox("More search results?", "Profile Search", MB_YESNO | MB_TASKMODAL) == IDNO) - { - arg->more = GP_DONE; - } - } - } - else - { - dlg->MessageBox("ProfileSearch failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvBuddyRequest(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyRequestArg * arg = (GPRecvBuddyRequestArg *)arg_; - - // Show who the buddy request is from. - // PANTS|05.18.00 - ////////////////////////////////////// - gpGetInfo(connection, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, Whois, NULL); - CString message = "Buddy Request from "; - message += whois; - if(MessageBox(dlg->m_hWnd, arg->reason, message, MB_YESNO) == IDYES) - gpAuthBuddyRequest(connection, arg->profile); - else - gpDenyBuddyRequest(connection, arg->profile); - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvBuddyAuth(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyAuthArg * arg = (GPRecvBuddyAuthArg *)arg_; - dlg->UpdateData(); - - gpGetInfo(connection, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, Whois, NULL); - - CString msg_for_requester = whois; - msg_for_requester += ": Yo man, joo on ma buddy list"; - MessageBox(dlg->m_hWnd, msg_for_requester, "Received Buddy Auth", MB_ICONINFORMATION); - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void NewProfileResponse(GPConnection * connection, void * arg_, void * param) -{ - GPNewProfileResponseArg * arg = (GPNewProfileResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - dlg->MessageBox("New profile created"); - } - else - { - dlg->MessageBox("NewProfile failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void IsValidEmailResponse(GPConnection * connection, void * arg_, void * param) -{ - char buffer[128]; - GPIsValidEmailResponseArg * arg = (GPIsValidEmailResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - if(arg->isValid) - sprintf(buffer, "%s is a valid e-mail address.", arg->email); - else - sprintf(buffer, "%s is NOT a valid e-mail address.", arg->email); - } - else - { - sprintf(buffer, "IsValidEmail failed"); - } - - dlg->MessageBox(buffer); - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void GetUserNicksResponse(GPConnection * connection, void * arg_, void * param) -{ - GPGetUserNicksResponseArg * arg = (GPGetUserNicksResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - int i; - for(i = 0 ; i < arg->numNicks ; i++) - { - dlg->m_results.InsertString(i, arg->nicks[i]); - dlg->m_results.SetItemData(i, 0); - memset(&searchMatches[i], 0, sizeof(GPProfileSearchMatch)); - strcpy(searchMatches[i].nick, arg->nicks[i]); - strcpy(searchMatches[i].uniquenick, arg->uniquenicks[i]); - } - } - else - { - dlg->MessageBox("GetUserNicksResponse failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void SuggestUniqueNickResponse(GPConnection * connection, void * arg_, void * param) -{ - GPSuggestUniqueNickResponseArg * arg = (GPSuggestUniqueNickResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - int i; - for(i = 0 ; i < arg->numSuggestedNicks ; i++) - { - dlg->m_results.InsertString(i, arg->suggestedNicks[i]); - dlg->m_results.SetItemData(i, 0); - // don't get info for this one - searchMatches[i].profile = -1; - } - } - else - { - dlg->MessageBox("GetUserNicksResponse failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void GetReverseBuddiesResponse(GPConnection * connection, void * arg_, void * param) -{ - GPGetReverseBuddiesResponseArg * arg = (GPGetReverseBuddiesResponseArg *)arg_; - - if(arg->result == GP_NO_ERROR) - { - int i; - CString str; - int rcode; - GPProfileSearchMatch * match; - - for(i = 0 ; i < arg->numProfiles ; i++) - { - match = &arg->profiles[i]; - - str.Format("Revoke %s [%s] (%s %s, %s, %d)?", match->nick, match->uniquenick, match->firstname, match->lastname, match->email, match->profile); - rcode = dlg->MessageBox(str, NULL, MB_YESNOCANCEL); - if(rcode == IDYES) - gpRevokeBuddyAuthorization(connection, match->profile); - else if(rcode == IDCANCEL) - break; - } - } - else - { - dlg->MessageBox("GetReverseBuddiesResponse failed"); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvGameInvite(GPConnection * connection, void * arg_, void * param) -{ - GPRecvGameInviteArg * arg = (GPRecvGameInviteArg *)arg_; - - gpGetInfo(connection, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, Whois, NULL); - - char msg[4096]; - sprintf(msg, "%s has invited you to play the game with product ID %d", whois, arg->productID); - - dlg->MessageBox(msg); - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void GetInfoForBuddyKeys(GPConnection * theConnection, void * theArg, void * theParam) -{ - GPGetInfoResponseArg *anArg = (GPGetInfoResponseArg *)theArg; - GPGetInfoResponseArg **anInfoArg = (GPGetInfoResponseArg **)theParam; - - memcpy(*anInfoArg,anArg, sizeof(GPGetInfoResponseArg)); - GSI_UNUSED(theConnection); -} - -void GetBuddyKeysCallback(GPConnection * theConnection, void * theArg, void * theParam) -{ - GPGetBuddyStatusInfoKeysArg *anArg = (GPGetBuddyStatusInfoKeysArg *)theArg; - GPGetInfoResponseArg *anInfoArg = new GPGetInfoResponseArg; - gpGetInfo(theConnection, anArg->profile, GP_CHECK_CACHE, GP_BLOCKING, GetInfoForBuddyKeys, (void *)&anInfoArg); - - CString aUniqueNick = anInfoArg->uniquenick; - CString aBuddyeKeys = ""; - - for (int i = 0; i < anArg->numKeys; i++) - { - if (i == 0) - { - aBuddyeKeys += anArg->keys[i]; - aBuddyeKeys += " = "; - aBuddyeKeys += anArg->values[i]; - } - else - { - aBuddyeKeys += "\n"; - aBuddyeKeys += anArg->keys[i]; - aBuddyeKeys += " = "; - aBuddyeKeys += anArg->values[i]; - } - } - - CString aMessage = "Buddy: " + aUniqueNick; - aMessage += "\n"; - aMessage += aBuddyeKeys; - - dlg->MessageBox(aMessage, "Buddy Keys"); - delete anInfoArg; - GSI_UNUSED(theParam); -} - -void RegisterCdKeyCallback(GPConnection * connection, void * _arg, void * param) -{ - GPRegisterCdKeyResponseArg *arg = (GPRegisterCdKeyResponseArg *)_arg; - - if (arg->result == GP_NO_ERROR) - { - CString msg = "CDKey is now associated with your account"; - dlg->MessageBox(msg); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -LPCSTR TypeToString(GPEnum type) -{ - switch(type) - { - case GP_TRANSFER_SEND_REQUEST: - return "GP_TRANSFER_SEND_REQUEST"; - case GP_TRANSFER_ACCEPTED: - return "GP_TRANSFER_ACCEPTED"; - case GP_TRANSFER_REJECTED: - return "GP_TRANSFER_REJECTED"; - case GP_TRANSFER_NOT_ACCEPTING: - return "GP_TRANSFER_NOT_ACCEPTING"; - case GP_TRANSFER_NO_CONNECTION: - return "GP_TRANSFER_NO_CONNECTION"; - case GP_TRANSFER_DONE: - return "GP_TRANSFER_DONE"; - case GP_TRANSFER_CANCELLED: - return "GP_TRANSFER_CANCELLED"; - case GP_TRANSFER_LOST_CONNECTION: - return "GP_TRANSFER_LOST_CONNECTION"; - case GP_TRANSFER_ERROR: - return "GP_TRANSFER_ERROR"; - case GP_TRANSFER_THROTTLE: - return "GP_TRANSFER_THROTTLE"; - case GP_FILE_BEGIN: - return "GP_FILE_BEGIN"; - case GP_FILE_PROGRESS: - return "GP_FILE_PROGRESS"; - case GP_FILE_END: - return "GP_FILE_END"; - case GP_FILE_DIRECTORY: - return "GP_FILE_DIRECTORY"; - case GP_FILE_SKIP: - return "GP_FILE_SKIP"; - case GP_FILE_FAILED: - return "GP_FILE_FAILED"; - } - - return "!!!!!!!BAD TYPE!!!!!!!"; -} - -void TransferCallback(GPConnection * connection, void * arg_, void * param) -{ - GPTransferCallbackArg * arg = (GPTransferCallbackArg *)arg_; - static DWORD transferStart; - char * name; - char * path; - GPEnum side; - - CString str; - str.Format("%s - %d - %d - %s\n", TypeToString(arg->type), arg->index, arg->num, arg->message); - OutputDebugString(str); - - switch(arg->type) - { - case GP_TRANSFER_SEND_REQUEST: - transferStart = SDL_GetTicks(); - CHECK(gpAcceptTransfer(connection, arg->transfer, "I'd like your file")); - break; - - case GP_FILE_END: - gpGetTransferSide(connection, arg->transfer, &side); - if(side == GP_TRANSFER_RECEIVER) - { - gpGetFileName(connection, arg->transfer, arg->index, &name); - gpGetFilePath(connection, arg->transfer, arg->index, &path); - rename(path, "file.ext"); - } - break; - - case GP_TRANSFER_REJECTED: - case GP_TRANSFER_NOT_ACCEPTING: - case GP_TRANSFER_NO_CONNECTION: - case GP_TRANSFER_DONE: - case GP_TRANSFER_CANCELLED: - case GP_TRANSFER_LOST_CONNECTION: - case GP_TRANSFER_ERROR: - gpFreeTransfer(connection, arg->transfer); - break; - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -// Utility func for converting an error code to a string. -///////////////////////////////////////////////////////// -#define CtoS(code) case code: string += " (" #code ")"; return; -void CGptestDlg::CodeToString(CString & string) -{ - GPErrorCode code; - gpGetErrorCode(&m_connection, &code); - - switch(code) - { - CtoS(GP_GENERAL) - CtoS(GP_PARSE) - CtoS(GP_NOT_LOGGED_IN) - CtoS(GP_BAD_SESSKEY) - CtoS(GP_DATABASE) - CtoS(GP_NETWORK) - CtoS(GP_FORCED_DISCONNECT) - CtoS(GP_CONNECTION_CLOSED) - CtoS(GP_LOGIN) - CtoS(GP_LOGIN_TIMEOUT) - CtoS(GP_LOGIN_BAD_NICK) - CtoS(GP_LOGIN_BAD_EMAIL) - CtoS(GP_LOGIN_BAD_PASSWORD) - CtoS(GP_LOGIN_BAD_PROFILE) - CtoS(GP_LOGIN_PROFILE_DELETED) - CtoS(GP_LOGIN_CONNECTION_FAILED) - CtoS(GP_LOGIN_SERVER_AUTH_FAILED) - CtoS(GP_LOGIN_BAD_UNIQUENICK) - CtoS(GP_LOGIN_BAD_PREAUTH) - CtoS(GP_NEWUSER) - CtoS(GP_NEWUSER_BAD_NICK) - CtoS(GP_NEWUSER_BAD_PASSWORD) - CtoS(GP_NEWUSER_UNIQUENICK_INVALID) - CtoS(GP_NEWUSER_UNIQUENICK_INUSE) - CtoS(GP_UPDATEUI) - CtoS(GP_UPDATEUI_BAD_EMAIL) - CtoS(GP_NEWPROFILE) - CtoS(GP_NEWPROFILE_BAD_NICK) - CtoS(GP_NEWPROFILE_BAD_OLD_NICK) - CtoS(GP_UPDATEPRO) - CtoS(GP_UPDATEPRO_BAD_NICK) - CtoS(GP_ADDBUDDY) - CtoS(GP_ADDBUDDY_BAD_FROM) - CtoS(GP_ADDBUDDY_BAD_NEW) - CtoS(GP_ADDBUDDY_ALREADY_BUDDY) - CtoS(GP_AUTHADD) - CtoS(GP_AUTHADD_BAD_FROM) - CtoS(GP_AUTHADD_BAD_SIG) - CtoS(GP_STATUS) - CtoS(GP_BM) - CtoS(GP_BM_NOT_BUDDY) - CtoS(GP_GETPROFILE) - CtoS(GP_GETPROFILE_BAD_PROFILE) - CtoS(GP_DELBUDDY) - CtoS(GP_DELBUDDY_NOT_BUDDY) - CtoS(GP_DELPROFILE) - CtoS(GP_DELPROFILE_LAST_PROFILE) - CtoS(GP_SEARCH) - CtoS(GP_SEARCH_CONNECTION_FAILED) - CtoS(GP_CHECK) - CtoS(GP_CHECK_BAD_EMAIL) - CtoS(GP_CHECK_BAD_NICK) - CtoS(GP_CHECK_BAD_PASSWORD) - CtoS(GP_REGISTERUNIQUENICK) - CtoS(GP_REGISTERUNIQUENICK_TAKEN) - CtoS(GP_REGISTERUNIQUENICK_RESERVED) - CtoS(GP_REGISTERUNIQUENICK_BAD_NAMESPACE) - CtoS(GP_REGISTERCDKEY_BAD_KEY) - CtoS(GP_REGISTERCDKEY_ALREADY_SET) - CtoS(GP_REGISTERCDKEY_ALREADY_TAKEN) - } - - string += " (XXXUNKOWNXXX)"; - return; -} - -///////////////////////////////////////////////////////////////////////////// -// CGptestDlg message handlers - -CString GPServerDefault; -CString GPSearchServerDefault; - -BOOL CGptestDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - dlg = this; - m_connection = NULL; - - GPServerDefault = GPConnectionManagerHostname; - GPSearchServerDefault = GPSearchManagerHostname; - - UpdateData(); - - CString str = "Closed"; - m_SessionFlags.InsertString(0, str); - m_SessionFlags.SetItemData(0, GP_SESS_IS_CLOSED); - - str = "Open"; - m_SessionFlags.InsertString(1, str); - m_SessionFlags.SetItemData(1, GP_SESS_IS_OPEN); - - str = "Has Password"; - m_SessionFlags.InsertString(2, str); - m_SessionFlags.SetItemData(2, GP_SESS_HAS_PASSWORD); - - str = "Behind NAT"; - m_SessionFlags.InsertString(3, str); - m_SessionFlags.SetItemData(3, GP_SESS_IS_BEHIND_NAT); - - str = "Ranked"; - m_SessionFlags.InsertString(4, str); - m_SessionFlags.SetItemData(4, GP_SESS_IS_RANKED); - - SetTimer(1, PROCESS_TIME, NULL); - SetTimer(2, 500, NULL); - - m_namespace.Format("%d", GSI_DEFAULT_NAMESPACE); - m_productid = GSI_TEST_PRODUCTID; - - UpdateData(FALSE); - FILE * file; - file = fopen("login.txt", "rt"); - if(file) - { - char buffer[256]; - if(fgets(buffer, sizeof(buffer), file)) - { - m_email = buffer; - m_email.Remove('\n'); - } - if(fgets(buffer, sizeof(buffer), file)) - { - m_nick = buffer; - m_nick.Remove('\n'); - } - if(fgets(buffer, sizeof(buffer), file)) - { - m_password = buffer; - m_password.Remove('\n'); - } - if(fgets(buffer, sizeof(buffer), file)) - { - m_uniquenick = buffer; - m_uniquenick.Remove('\n'); - } - fclose(file); - } - - UpdateData(FALSE); - - return TRUE; // return TRUE unless you set the focus to a control -} - -void CGptestDlg::OnDestroy() -{ - if(m_connection) - OnDestroyGP(); - - UpdateData(); - FILE * file; - file = fopen("login.txt", "wt"); - if(file) - { - fprintf(file, "%s\n%s\n%s\n%s", m_email, m_nick, m_password, m_uniquenick); - fclose(file); - } - - CDialog::OnDestroy(); -} - -void CGptestDlg::OnInitialize() -{ - if(m_connection) - { - MessageBox("GP is already initialized"); - return; - } - - -#ifdef GSI_COMMON_DEBUG - // Define GSI_COMMON_DEBUG if you want to view the SDK debug output - // Set the SDK debug log file, or set your own handler using gsSetDebugCallback - gsSetDebugCallback(DebugCallback); - - // Set some debug levels - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Debug); -#endif - - // check that the game's backend is available - GSIACResult result; - GSIStartAvailableCheck(GSI_TEST_GAMENAME); - while((result = GSIAvailableCheckThink()) == GSIACWaiting) - msleep(5); - if(result != GSIACAvailable) - { - MessageBox("The backend is not available\n"); - return; - } - - UpdateData(); - - if(m_namespace.IsEmpty() || !isdigit(m_namespace.GetAt(0))) - { - MessageBox("Enter a namespace of 0 or greater"); - return; - } - - CHECK(gpInitialize(&m_connection, m_productid, atoi(m_namespace), m_partnerid)); - CHECK(gpSetCallback(&m_connection, GP_RECV_BUDDY_STATUS, RecvBuddyStatus, NULL)); - CHECK(gpSetCallback(&m_connection, GP_RECV_BUDDY_AUTH, RecvBuddyAuth, NULL)); - CHECK(gpSetCallback(&m_connection, GP_ERROR, Error, NULL)); - CHECK(gpSetCallback(&m_connection, GP_RECV_BUDDY_MESSAGE, RecvBuddyMessage, NULL)); - CHECK(gpSetCallback(&m_connection, GP_RECV_BUDDY_REQUEST, RecvBuddyRequest, NULL)); - CHECK(gpSetCallback(&m_connection, GP_RECV_GAME_INVITE, RecvGameInvite, NULL)); - CHECK(gpSetCallback(&m_connection, GP_TRANSFER_CALLBACK, TransferCallback, NULL)); - CHECK(gpSetCallback(&m_connection, GP_RECV_BUDDY_UTM, RecvBuddyUTM, NULL)); - CHECK(gpSetCallback(&m_connection, GP_RECV_BUDDY_REVOKE, RecvBuddyRevoke, NULL)); -} - -void CGptestDlg::OnDestroyGP() -{ - if(!m_connection) - return; - - gpDestroy(&m_connection); - m_connection = NULL; -} - -void CGptestDlg::SetHost() -{ - if(m_server == 0) - strcpy(GPConnectionManagerHostname, GPServerDefault); - else if(m_server == 1) - strcpy(GPConnectionManagerHostname, "aphexgp1"); - else if(m_server == 2) - strcpy(GPConnectionManagerHostname, "aphexgp2"); -#if 0 - else if(m_server == 3) - strcpy(GPConnectionManagerHostname, "aphexapp3"); - else if(m_server == 4) - strcpy(GPConnectionManagerHostname, "aphexapp4"); - else if(m_server == 5) - strcpy(GPConnectionManagerHostname, "chat3"); - else if(m_server == 6) - strcpy(GPConnectionManagerHostname, "chat4"); -#endif - else if(m_server == 7) - strcpy(GPConnectionManagerHostname, "localhost"); - else if(m_server == 8) - strcpy(GPConnectionManagerHostname, m_otherServer); -} - -void CGptestDlg::OnConnect() -{ - if(!m_connection) - return; - - UpdateData(); - - // Set which server to use. - /////////////////////////// - SetHost(); - CHECK(gpConnect(&m_connection, m_nick, m_email, m_password, (GPEnum)m_firewall, (GPEnum)m_blocking, ConnectResponse, NULL)); -} - -void CGptestDlg::OnConnectunique() -{ - if(!m_connection) - return; - - UpdateData(); - - // Set which server to use. - /////////////////////////// - SetHost(); - - CHECK(gpConnectUniqueNick(&m_connection, m_uniquenick, m_password, (GPEnum)m_firewall, (GPEnum)m_blocking, ConnectResponse, NULL)); -} - -void CGptestDlg::OnConnectpreauth() -{ - if(!m_connection) - return; - - UpdateData(); - - // Set which server to use. - /////////////////////////// - SetHost(); - - CHECK(gpConnectPreAuthenticated(&m_connection, m_authtoken, m_partnerchallenge, (GPEnum)m_firewall, (GPEnum)m_blocking, ConnectResponse, NULL)); -} - -void CGptestDlg::OnDisconnect() -{ - if(!m_connection) - return; - - gpDisconnect(&m_connection); - - m_buddies.ResetContent(); -} - -void CGptestDlg::OnCheck() -{ - if(!m_connection) - return; - - UpdateData(); - CHECK(gpCheckUser(&m_connection, m_nick, m_email, m_password, (GPEnum)m_blocking, CheckResponse, NULL)); -} - -void CGptestDlg::OnNewuser() -{ - if(!m_connection) - return; - - UpdateData(); - SetHost(); -CHECK(gpNewUser(&m_connection, m_nick, m_uniquenick, m_email, m_password, NULL, (GPEnum)m_blocking, NewUserResponse, NULL)); -// CHECK(gpConnectNewUser(&m_connection, m_nick, m_uniquenick, m_email, m_password, NULL, (GPEnum)m_firewall, (GPEnum)m_blocking, ConnectResponse, NULL)); -} - -void CGptestDlg::OnUpdate() -{ - if(!m_connection) - return; - - // Update some info. - //////////////////// - UpdateData(); - CHECK(gpSetInfos(&m_connection, GP_EMAIL, m_email)); - CHECK(gpSetInfos(&m_connection, GP_NICK, m_nick)); - CHECK(gpSetInfos(&m_connection, GP_PASSWORD, m_password)); - CHECK(gpSetInfos(&m_connection, GP_UNIQUENICK, m_uniquenick)); -} - - -void CGptestDlg::OnTimer(UINT nIDEvent) -{ - if(!m_connection) - return; - - if (m_InTimer == 1) - return; - m_InTimer = 1; - - if(nIDEvent == 1) - { - CHECK(gpProcess(&m_connection)); - } - - if(nIDEvent == 2) - { - char buffer[256]; - GPErrorCode code; - - UpdateData(); - gpGetErrorCode(&m_connection, &code); - sprintf(buffer, "0x%04X", code); - m_code = buffer; - CodeToString(m_code); - gpGetErrorString(&m_connection, buffer); - m_string = buffer; - UpdateData(FALSE); - } - - CDialog::OnTimer(nIDEvent); - - m_InTimer = 0; -} - -void CGptestDlg::OnSelchangeBuddies() -{ - if(!m_connection) - return; - - // Get the profile for this item. - ///////////////////////////////// - int index = m_buddies.GetCurSel(); - UpdateData(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Get the info on this buddy. - ////////////////////////////// - if(profile != -1) - CHECK(gpGetInfo(&m_connection, profile, GP_CHECK_CACHE, (GPEnum)m_blocking, GetInfoResponse, NULL)); - } -} - -void CGptestDlg::OnSet() -{ - if(!m_connection) - return; - - UpdateData(); - - CHECK(gpSetStatus(&m_connection, (GPEnum)m_status, m_statusString, m_locationString)); -} - -void CGptestDlg::OnSend() -{ - if(!m_connection) - return; - - int index = m_buddies.GetCurSel(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Send a message to this guy. - ////////////////////////////// - UpdateData(); - CHECK(gpSendBuddyMessage(&m_connection, profile, m_message)); - } -} - -void CGptestDlg::OnRefresh() -{ - if(!m_connection) - return; - - // Get the profile for this item. - ///////////////////////////////// - int index = m_buddies.GetCurSel(); - UpdateData(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Get the info on this buddy. - ////////////////////////////// - CHECK(gpGetInfo(&m_connection, profile, GP_DONT_CHECK_CACHE, (GPEnum)m_blocking, GetInfoResponse, NULL)); - } -} - -void CGptestDlg::OnSearch() -{ - if(!m_connection) - return; - - // Search. - ////////// - UpdateData(); - dlg->m_results.ResetContent(); - CHECK(gpProfileSearch(&m_connection, m_snick, m_suniquenick, m_semail, m_sfirstname, m_slastname, m_sicquin, (GPEnum)m_blocking, ProfileSearchResponse, NULL)); -} - -void CGptestDlg::OnValidate() -{ - if(!m_connection) - return; - - UpdateData(); - CHECK(gpIsValidEmail(&m_connection, m_semail, (GPEnum)m_blocking, IsValidEmailResponse, NULL)); -} - -void CGptestDlg::OnNicks() -{ - if(!m_connection) - return; - - UpdateData(); - if(m_semail.IsEmpty()) - { - MessageBox("Type in an email for which to find nicks"); - return; - } - dlg->m_results.ResetContent(); - CHECK(gpGetUserNicks(&m_connection, m_semail, m_password, (GPEnum)m_blocking, GetUserNicksResponse, NULL)); -} - -void CGptestDlg::OnSuggest() -{ - if(!m_connection) - return; - - UpdateData(); - if(m_suniquenick.IsEmpty()) - { - MessageBox("Type in a desired unique nick"); - return; - } - dlg->m_results.ResetContent(); - CHECK(gpSuggestUniqueNick(&m_connection, m_suniquenick, (GPEnum)m_blocking, SuggestUniqueNickResponse, NULL)); -} - -void CGptestDlg::OnSelchangeResults() -{ - if(!m_connection) - return; - - int index = m_results.GetCurSel(); - if(index != LB_ERR) - { - // Get the profile. - int profile = m_results.GetItemData(index); - if(profile == -1) - return; - - // Put in what we now. - ////////////////////// - GPGetInfoResponseArg arg; - memset(&arg, 0, sizeof(arg)); - arg.profile = searchMatches[index].profile; - strcpy(arg.nick, searchMatches[index].nick); - strcpy(arg.uniquenick, searchMatches[index].uniquenick); - strcpy(arg.firstname, searchMatches[index].firstname); - strcpy(arg.lastname, searchMatches[index].lastname); - strcpy(arg.email, searchMatches[index].email); - GetInfoResponse(&m_connection, &arg, NULL); - - // Do a full get info if connected. - /////////////////////////////////// - GPEnum connected; - GPResult result = gpIsConnected(&m_connection, &connected); - if((result == GP_NO_ERROR) && connected && profile) - { - CHECK(gpGetInfo(&m_connection, profile, GP_CHECK_CACHE, (GPEnum)m_blocking, GetInfoResponse, NULL)); - } - } -} - -void CGptestDlg::OnSendrequest() -{ - if(!m_connection) - return; - - int index = m_results.GetCurSel(); - if(index != LB_ERR) - { - UpdateData(); - GPProfile profile = (GPProfile)m_results.GetItemData(index); - CHECK(gpSendBuddyRequest(&m_connection, profile, m_reason)); - } -} - -void CGptestDlg::OnInfoCache() -{ - if(!m_connection) - return; - - UpdateData(); - if(m_infoCache) - { - CHECK(gpEnable(&m_connection, GP_INFO_CACHING)); - } - else - { - CHECK(gpDisable(&m_connection, GP_INFO_CACHING)); - } -} - -void CGptestDlg::OnDelete() -{ - if(!m_connection) - return; - - // Get the profile for this item. - ///////////////////////////////// - int index = m_buddies.GetCurSel(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Delete this buddy. - ///////////////////// - CHECK(gpDeleteBuddy(&m_connection, profile)); - - m_buddies.DeleteString(index); - } -} - -void CGptestDlg::OnSetinfo() -{ - if(!m_connection) - return; - - int mask; - UpdateData(); - gpSetInfos(&m_connection, GP_FIRSTNAME, m_ifirstname); - gpSetInfos(&m_connection, GP_LASTNAME, m_ilastname); - gpSetInfoi(&m_connection, GP_ICQUIN, m_iicquin); - gpSetInfos(&m_connection, GP_HOMEPAGE, m_ihomepage); - gpSetInfos(&m_connection, GP_ZIPCODE, m_izipcode); - if(!m_icountrycode.IsEmpty()) - gpSetInfos(&m_connection, GP_COUNTRYCODE, m_icountrycode); - gpSetInfod(&m_connection, GP_BIRTHDAY, m_ibirthday, m_ibirthmonth, m_ibirthyear); - gpSetInfos(&m_connection, GP_SEX, m_isex); - mask = 0; - if(m_ipmhomepage) - mask |= GP_MASK_HOMEPAGE; - if(m_ipmzipcode) - mask |= GP_MASK_ZIPCODE; - if(m_ipmcountrycode) - mask |= GP_MASK_COUNTRYCODE; - if(m_ipmbirthday) - mask |= GP_MASK_BIRTHDAY; - if(m_ipmsex) - mask |= GP_MASK_SEX; - if(m_ipmemail) - mask |= GP_MASK_EMAIL; - gpSetInfoMask(&m_connection, (GPEnum)mask); -} - -static void DeleteResponseCallback(GPConnection *connection, void * _arg, void *param) -{ - GPDeleteProfileResponseArg *anArg = (GPDeleteProfileResponseArg *)_arg; - - if (anArg->result == GP_NO_ERROR) - { - AfxMessageBox("Profile delete success!", MB_ICONINFORMATION|MB_OK); - } - else - { - AfxMessageBox("Profile delete failed.", MB_ICONERROR|MB_OK); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void CGptestDlg::OnDeletepro() -{ - if(!m_connection) - return; - - CHECK(gpDeleteProfile(&m_connection, DeleteResponseCallback, NULL)); - -} - -void CGptestDlg::OnNewpro() -{ - if(!m_connection) - return; - - UpdateData(); - CHECK(gpNewProfile(&m_connection, m_newnick, m_replace?GP_REPLACE:GP_DONT_REPLACE, (GPEnum)m_blocking, NewProfileResponse, NULL)); -} - -void CGptestDlg::OnDeleteall() -{ - if(!m_connection) - return; - - int num; - GPBuddyStatus status; - - while(1) - { - gpGetNumBuddies(&m_connection, &num); - if(num == 0) - return; - gpGetBuddyStatus(&m_connection, 0, &status); - gpDeleteBuddy(&m_connection, status.profile); - } -} - -void CGptestDlg::OnInvitePlayer() -{ - if(!m_connection) - return; - - UpdateData(); - - // Get the profile for this item. - ///////////////////////////////// - int index = m_buddies.GetCurSel(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Invite this player. - ////////////////////// - CHECK(gpInvitePlayer(&m_connection, profile, m_invitePlayerID, NULL)); - } -} - -void report(const char * text) -{ - OutputDebugString(text); - OutputDebugString("\n"); -} - -void CGptestDlg::OnReport() -{ -#ifdef _DEBUG - gpProfilesReport(&m_connection, report); -#endif -} - -void SendFilesCallback(GPConnection * connection, int index, const char ** path, const char ** name, void * param) -{ - if(index == 0) - { - *path = dlg->m_path; - *name = dlg->m_name; - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void CGptestDlg::OnSendFiles() -{ - if(!m_connection) - return; - - int index = m_buddies.GetCurSel(); - if(index != LB_ERR) - { - GPTransfer transfer; - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Send a file. - /////////////// - UpdateData(); - CHECK(gpSendFiles(&m_connection, &transfer, profile, "Want this file?", SendFilesCallback, NULL)); - } -} - -void CGptestDlg::OnChangeSearchServer() -{ - if(!m_connection) - return; - - UpdateData(); - - if(!m_searchServer) - strcpy(GPSearchManagerHostname, GPSearchServerDefault); - else - strcpy(GPSearchManagerHostname, m_searchServer); -} - -void CGptestDlg::OnPublicmaskAll() -{ - if(!m_connection) - return; - - UpdateData(); - - m_ipmhomepage = TRUE; - m_ipmzipcode = TRUE; - m_ipmcountrycode = TRUE; - m_ipmbirthday = TRUE; - m_ipmsex = TRUE; - m_ipmemail = TRUE; - - UpdateData(FALSE); -} - -void CGptestDlg::OnPublicmaskNone() -{ - if(!m_connection) - return; - - UpdateData(); - - m_ipmhomepage = FALSE; - m_ipmzipcode = FALSE; - m_ipmcountrycode = FALSE; - m_ipmbirthday = FALSE; - m_ipmsex = FALSE; - m_ipmemail = FALSE; - - UpdateData(FALSE); -} - -void CGptestDlg::OnRevoke() -{ - if(!m_connection) - return; - - CHECK(gpGetReverseBuddies(&m_connection, (GPEnum)m_blocking, GetReverseBuddiesResponse, NULL)); -} - -void CGptestDlg::OnUTM() -{ - if(!m_connection) - return; - - int index = m_buddies.GetCurSel(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - - // Send a message to this guy. - ////////////////////////////// - UpdateData(); - CHECK(gpSendBuddyUTM(&m_connection, profile, (LPCSTR)m_message, 0)); - } -} - -void CGptestDlg::OnSetstatusinfo() -{ - if (!m_connection) - return; - - UpdateData(); - - /* - GPEnum aStatusState = (GPEnum)m_StatusState; - unsigned int aHostIp = inet_addr(m_HostIp); - unsigned int aHostPrivateIp = inet_addr(m_HostPrivateIp); - unsigned short aHostPort = m_HostPort; - unsigned short aQueryPort = m_QueryPort; - int *aSessionFlagsSelected = new int[m_SessionFlags.GetSelCount()]; - unsigned int sessFlags = 0; - m_SessionFlags.GetSelItems(m_SessionFlags.GetSelCount(), aSessionFlagsSelected); - - for (int i = 0; i < m_SessionFlags.GetSelCount(); i++) - { - int itemData = m_SessionFlags.GetItemData(aSessionFlagsSelected[i]); - sessFlags+= itemData; - } - - gpSetStatusInfo(&m_connection, aStatusState, aHostIp, aHostPrivateIp, aQueryPort, aHostPort, sessFlags, (LPCSTR)m_RichStatus, - m_RichStatus.GetLength(), (LPCSTR)m_GameType, m_GameType.GetLength(), (LPCSTR)m_GameVariant, m_GameVariant.GetLength(), - (LPCSTR)m_GameMapname, m_GameMapname.GetLength()); - delete[] aSessionFlagsSelected; - */ -} - -void CGptestDlg::OnAddSetKey() -{ - if (!m_connection) - return; - - UpdateData(); - /* - char *keyValue = NULL; - gpGetStatusInfoKeyVal(&m_connection, (LPCSTR)m_KeyName, &keyValue); - if (keyValue) - gpSetStatusInfoKey(&m_connection, (LPCSTR)m_KeyName, (LPCSTR)m_KeyValue); - else - gpAddStatusInfoKey(&m_connection, (LPCSTR)m_KeyName, (LPCSTR)m_KeyValue); - */ -} - -void CGptestDlg::OnGetKeyValue() -{ - if (!m_connection) - return; - - UpdateData(); - /* - char *keyValue = NULL; - gpGetStatusInfoKeyVal(&m_connection, (LPCSTR)m_KeyName, &keyValue); - if (keyValue) - m_KeyValue = keyValue; - */ -} - -void CGptestDlg::OnGetBuddyKeys() -{ - if(!m_connection) - return; - - /* - int index = m_buddies.GetCurSel(); - if(index != LB_ERR) - { - GPProfile profile = (GPProfile)m_buddies.GetItemData(index); - - // Send a message to this guy. - ////////////////////////////// - UpdateData(); - int bIndex; - gpGetBuddyIndex(&m_connection, profile, &bIndex); - - CHECK(gpGetBuddyStatusInfoKeys(&m_connection, bIndex, GetBuddyKeysCallback, NULL)); - } - */ -} - -void CGptestDlg::OnDelKeyVal() -{ - if (!m_connection) - return; - - UpdateData(); - /* - char *keyValue = NULL; - gpGetStatusInfoKeyVal(&m_connection, (LPCSTR)m_KeyName, &keyValue); - if (keyValue) - gpDelStatusInfoKeyA(&m_connection, (LPCSTR)m_KeyName); - */ -} - -void CGptestDlg::OnRegisterCdKey() -{ - if (!m_connection) - return; - - UpdateData(); - - // make sure the length isn't too much - if (m_cdkey.GetLength() > GP_CDKEY_LEN) - return; - - // Register CDkey - CHECK(gpRegisterCdKey(&m_connection, (LPCSTR)m_cdkey, GP_BLOCKING, RegisterCdKeyCallback, NULL)); -} - -void CGptestDlg::OnGetBlocked() -{ - if(!m_connection) - return; - - m_blocklist.ResetContent(); - UpdateData(); - - // Grab block list - GPProfile profile; - int numBlocked; - CHECK(gpGetNumBlocked(&m_connection, &numBlocked)); - - int i=0; - for (i=0; i 1000 -#pragma once -#endif // _MSC_VER > 1000 - -///////////////////////////////////////////////////////////////////////////// -// CGptestDlg dialog - -class CGptestDlg : public CDialog -{ -// Construction -public: - CGptestDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CGptestDlg) - enum { IDD = IDD_GPTEST_DIALOG }; - CButton m_connectunique; - CButton m_connectpreauth; - CButton m_newuser; - CButton m_search; - CListBox m_results; - CButton m_update; - CButton m_send; - CButton m_set; - CListBox m_buddies; - CButton m_disconnect; - CButton m_connect; - int m_partnerid; - CString m_email; - CString m_nick; - CString m_password; - GPConnection m_connection; - CString m_locationString; - int m_status; - CString m_statusString; - CString m_iaddress; - CString m_icountrycode; - CString m_iemail; - CString m_ihomepage; - int m_iicquin; - CString m_inick; - CString m_isex; - CString m_message; - CString m_sfirstname; - CString m_snick; - int m_sicquin; - CString m_slastname; - CString m_semail; - CString m_string; - CString m_code; - CString m_reason; - int m_rnick; - BOOL m_infoCache; - BOOL m_blocking; - CString m_ilastname; - CString m_ifirstname; - int m_ibirthday; - int m_ibirthmonth; - int m_ibirthyear; - BOOL m_ipmbirthday; - BOOL m_ipmcountrycode; - BOOL m_ipmhomepage; - BOOL m_ipmsex; - BOOL m_ipmzipcode; - CString m_newnick; - BOOL m_replace; - CString m_izipcode; - UINT m_invitePlayerID; - int m_server; - CString m_otherServer; - CString m_name; - CString m_path; - CString m_searchServer; - BOOL m_ipmemail; - BOOL m_firewall; - float m_ilatitude; - CString m_iplace; - float m_ilongitude; - CString m_suniquenick; - CString m_iuniquenick; - CString m_uniquenick; - CString m_authtoken; - CString m_partnerchallenge; - CString m_namespace; - int m_productid; - CListBox m_blocklist; - CButton m_getblockedlist; - CButton m_addblock; - CButton m_removeblock; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CGptestDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - HICON m_hIcon; - mutable long m_InTimer; - - - - void CodeToString(CString & string); - void SetHost(); - - // Generated message map functions - //{{AFX_MSG(CGptestDlg) - virtual BOOL OnInitDialog(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg void OnConnect(); - afx_msg void OnDisconnect(); - afx_msg void OnDestroy(); - afx_msg void OnSet(); - afx_msg void OnSelchangeBuddies(); - afx_msg void OnSend(); - afx_msg void OnRefresh(); - afx_msg void OnUpdate(); - afx_msg void OnSearch(); - afx_msg void OnSelchangeResults(); - afx_msg void OnNewuser(); - afx_msg void OnSendrequest(); - afx_msg void OnInfoCache(); - afx_msg void OnDelete(); - afx_msg void OnTest(); - afx_msg void OnSetinfo(); - afx_msg void OnDeletepro(); - afx_msg void OnNewpro(); - afx_msg void OnDeleteall(); - afx_msg void OnValidate(); - afx_msg void OnNicks(); - afx_msg void OnInvitePlayer(); - afx_msg void OnReport(); - afx_msg void OnCheck(); - afx_msg void OnSendFiles(); - afx_msg void OnChangeSearchServer(); - afx_msg void OnPublicmaskAll(); - afx_msg void OnPublicmaskNone(); - afx_msg void OnReverseBuddies(); - afx_msg void OnRevoke(); - afx_msg void OnSuggest(); - afx_msg void OnConnectunique(); - afx_msg void OnConnectpreauth(); - afx_msg void OnInitialize(); - afx_msg void OnDestroyGP(); - afx_msg void OnUTM(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -public: - int m_StatusState; - - short m_QueryPort; - short m_HostPort; - afx_msg void OnSetstatusinfo(); - CListBox m_SessionFlags; - CString m_RichStatus; - CString m_GameType; - CString m_GameVariant; - CString m_GameMapname; - afx_msg void OnAddSetKey(); - CString m_KeyName; - CString m_KeyValue; - afx_msg void OnGetKeyValue(); - afx_msg void OnGetBuddyKeys(); - CString m_HostIp; - CString m_HostPrivateIp; - afx_msg void OnDelKeyVal(); - CString m_cdkey; - afx_msg void OnRegisterCdKey(); - afx_msg void OnGetBlocked(); - afx_msg void OnAddBlock(); - afx_msg void OnRemoveBlock(); - afx_msg void OnSelchangeBlocklist(); -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_GPTESTDLG_H__AA6A1E3F_9C28_4A6C_902F_328A8707E479__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest_vs2005.vcproj deleted file mode 100644 index 177b0c4be57..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest_vs2005.vcproj +++ /dev/null @@ -1,1265 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/gptest_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/res/gptest.ico b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/res/gptest.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/res/gptest.ico and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/res/gptest.rc2 b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/res/gptest.rc2 deleted file mode 100644 index c80d29ab45d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/res/gptest.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// GPTEST.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/resource.h b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/resource.h deleted file mode 100644 index 966af587aab..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptest/resource.h +++ /dev/null @@ -1,159 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by gptest.rc -// -#define IDD_GPTEST_DIALOG 102 -#define IDP_SOCKETS_INIT_FAILED 103 -#define IDR_MAINFRAME 128 -#define IDC_EMAIL 1000 -#define IDC_NICK 1001 -#define IDC_PASSWORD 1002 -#define IDC_CONNECT 1003 -#define IDC_DISCONNECT 1004 -#define IDC_BUDDIES 1005 -#define IDC_STATUS 1006 -#define IDC_STATUSSTRING 1007 -#define IDC_LOCATIONSTRING 1008 -#define IDC_SET 1009 -#define IDC_UPDATE 1010 -#define IDC_IFIRSTNAME 1011 -#define IDC_INICK 1012 -#define IDC_IEMAIL 1013 -#define IDC_IICQUIN 1014 -#define IDC_IHOMEPAGE 1015 -#define IDC_IBIRTHMONTH 1016 -#define IDC_ISEX 1017 -#define IDC_ICOUNTRYCODE 1018 -#define IDC_IZIPCODE 1019 -#define IDC_CHECK 1020 -#define IDC_IADDRESS 1021 -#define IDC_ISTATUS 1022 -#define IDC_ILONGITUDE 1022 -#define IDC_MESSAGE 1023 -#define IDC_SEND 1024 -#define IDC_REFRESH 1025 -#define IDC_SEMAIL 1026 -#define IDC_SNICK 1027 -#define IDC_SFIRSTNAME 1028 -#define IDC_SLASTNAME 1029 -#define IDC_SICQUIN 1030 -#define IDC_SEARCH 1031 -#define IDC_RESULTS 1032 -#define IDC_MPROFILE 1033 -#define IDC_AUTHTOKEN 1033 -#define IDC_NEWUSER 1034 -#define IDC_MNAME 1035 -#define IDC_PARTNERCHALLENGE 1035 -#define IDC_SENDREQUEST 1036 -#define IDC_MEMAIL 1037 -#define IDC_INITIALIZE 1037 -#define IDC_REASON 1038 -#define IDC_CLEAR 1039 -#define IDC_DESTROY 1039 -#define IDC_CODE 1040 -#define IDC_STRING 1041 -#define IDC_DELETE 1042 -#define IDC_RNICK 1043 -#define IDC_RNAME 1044 -#define IDC_REMAIL 1045 -#define IDC_INFO_CACHE 1046 -#define IDC_ISTATUSSTRING 1047 -#define IDC_SET_INVITABLE 1047 -#define IDC_BLOCKING 1048 -#define IDC_ILOCATION 1049 -#define IDC_FIND_PLAYERS 1049 -#define IDC_SETINFO 1050 -#define IDC_ILASTNAME 1051 -#define IDC_IBIRTHDAY 1052 -#define IDC_IBIRTHYEAR 1053 -#define IDC_IPMHOMEPAGE 1054 -#define IDC_IPMZIPCODE 1055 -#define IDC_IPMCOUNTRYCODE 1056 -#define IDC_IPMBIRTHDAY 1057 -#define IDC_IPMSEX 1058 -#define IDC_DELETEPRO 1059 -#define IDC_NEWNICK 1060 -#define IDC_NEWPRO 1061 -#define IDC_REPLACE 1062 -#define IDC_SEARCH_SERVER 1063 -#define IDC_VALIDATE 1064 -#define IDC_DELETEALL 1065 -#define IDC_NICKS 1066 -#define IDC_INVITE_PLAYER 1067 -#define IDC_IPMEMAIL 1068 -#define IDC_FIREWALL 1069 -#define IDC_ILATITUDE 1070 -#define IDC_INVITE_PLAYER_ID 1073 -#define IDC_REPORT 1074 -#define IDC_SAUTO 1075 -#define IDC_S1 1076 -#define IDC_S2 1077 -#define IDC_S3 1078 -#define IDC_S4 1079 -#define IDC_SOTHER 1080 -#define IDC_OTHER_SERVER 1081 -#define IDC_S5 1082 -#define IDC_S6 1083 -#define IDC_SEND_FILES 1084 -#define IDC_PATH 1085 -#define IDC_NAME 1086 -#define IDC_S7 1087 -#define IDC_IPLACE 1088 -#define IDC_PUBLICMASK_ALL 1089 -#define IDC_PUBLICMASK_NONE 1090 -#define IDC_REVOKE 1091 -#define IDC_SUNIQUENICK 1092 -#define IDC_UNIQUENICK 1093 -#define IDC_NAMESPACE 1094 -#define IDC_IUNIQUENICK 1095 -#define IDC_SUGGEST 1096 -#define IDC_CONNECTUNIQUE 1097 -#define IDC_CONNECTPREAUTH 1098 -#define IDC_UTM 1099 -#define IDC_PARTNERID 1100 -#define IDC_PRODUCTID 1101 -#define IDC_REGISTER_CDKEY 1102 -#define IDC_STATUS_STATE 1103 -#define IDC_RICH_STATUS 1104 -#define IDC_CDKEY 1105 -#define IDC_BLOCKLIST 1106 -#define IDC_QPORT 1107 -#define IDC_GAME_TYPE 1108 -#define IDC_HPORT 1109 -#define IDC_SFLAGS 1110 -#define IDC_STATELABEL 1111 -#define IDC_GAME_VARIANT 1112 -#define IDC_HOSTIPLABEL 1113 -#define IDC_HOSTPRIVIPLABEL 1114 -#define IDC_QPORTLABEL 1115 -#define IDC_GAME_MAPNAME 1116 -#define IDC_HPORTLABEL 1117 -#define IDC_SFLAGESLABEL 1118 -#define IDC_GTLABEL 1119 -#define IDC_GVLABEL 1120 -#define IDC_GMLABEL 1121 -#define IDC_RSLABEL 1122 -#define IDC_HOST_IP 1123 -#define IDC_HOST_PRIVATE_IP 1124 -#define IDC_GET_BLOCKEDLIST 1125 -#define IDC_SETSTATUSINFO 1126 -#define IDC_EXTSTATUSINFO 1127 -#define IDC_EDIT1 1128 -#define IDC_EDIT2 1129 -#define IDC_BUTTON2 1130 -#define IDC_BUTTON3 1131 -#define IDC_BUTTON4 1132 -#define IDC_BUTTON5 1133 -#define IDC_REMOVE_BLOCK 1134 -#define IDC_ADD_BLOCK 1135 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 132 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1136 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gplinux/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gplinux/Makefile deleted file mode 100644 index 50a91293f07..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gplinux/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# GameSpy Presence & Messaging SDK Makefile -# Copyright 2004 GameSpy Industries - -PROJECT=gpsdk - -CC=gcc -BASE_CFLAGS=-D_LINUX -D_NO_NOPORT_H_ - -#use these cflags to optimize it -CFLAGS=$(BASE_CFLAGS) -march=i486 -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -falign-loops=2 \ - -falign-jumps=2 -falign-functions=2 -lpthread -#use these when debugging -#CFLAGS=$(BASE_CFLAGS) -g - -PROG_OBJS = \ - ../../../md5c.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsUdpEngine.o\ - ../../../common/linux/LinuxCommon.o\ - ../../gp.o\ - ../../gpi.o\ - ../../gpiBuddy.o\ - ../../gpiBuffer.o\ - ../../gpiCallback.o\ - ../../gpiConnect.o\ - ../../gpiInfo.o\ - ../../gpiKeys.o\ - ../../gpiOperation.o\ - ../../gpiPeer.o\ - ../../gpiProfile.o\ - ../../gpiSearch.o\ - ../../gpiUnique.o\ - ../../gpiUtility.o\ - ../../gpiTransfer.o\ - ../gptestc.o\ - ../../../gt2/gt2Auth.o\ - ../../../gt2/gt2Buffer.o\ - ../../../gt2/gt2Callback.o\ - ../../../gt2/gt2Connection.o\ - ../../../gt2/gt2Encode.o\ - ../../../gt2/gt2Filter.o\ - ../../../gt2/gt2Main.o\ - ../../../gt2/gt2Message.o\ - ../../../gt2/gt2Socket.o\ - ../../../gt2/gt2Utility.o - -############################################################################# -# SETUP AND BUILD -############################################################################# - -$(PROJECT): $(PROG_OBJS) - $(CC) $(CFLAGS) -o $@ $(PROG_OBJS) - -############################################################################# -# MISC -############################################################################# - -clean: - rm -f $(PROG_OBJS) - -depend: - gcc -MM $(PROG_OBJS:.o=.c) - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpmacosx/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpmacosx/Makefile deleted file mode 100644 index 2699eeae28c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpmacosx/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# GameSpy Presence & Messaging SDK Makefile - Mac OSX -# Copyright 2006 GameSpy Industries - -PROJECT=gptestc - -PROG_OBJS = \ - ../../../md5c.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsDebug.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsUdpEngine.o\ - ../../../common/macosx/MacOSXCommon.o\ - ../../gp.o\ - ../../gpi.o\ - ../../gpiBuddy.o\ - ../../gpiBuffer.o\ - ../../gpiCallback.o\ - ../../gpiConnect.o\ - ../../gpiInfo.o\ - ../../gpiKeys.o\ - ../../gpiOperation.o\ - ../../gpiPeer.o\ - ../../gpiProfile.o\ - ../../gpiSearch.o\ - ../../gpiUnique.o\ - ../../gpiUtility.o\ - ../../gpiTransfer.o\ - ../gptestc.o\ - ../../../gt2/gt2Auth.o\ - ../../../gt2/gt2Buffer.o\ - ../../../gt2/gt2Callback.o\ - ../../../gt2/gt2Connection.o\ - ../../../gt2/gt2Encode.o\ - ../../../gt2/gt2Filter.o\ - ../../../gt2/gt2Main.o\ - ../../../gt2/gt2Message.o\ - ../../../gt2/gt2Socket.o\ - ../../../gt2/gt2Utility.o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/macosx/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/Nitro.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/Nitro.lcf deleted file mode 100644 index 998f6b00259..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/Nitro.lcf +++ /dev/null @@ -1,493 +0,0 @@ -#--------------------------------------------------------------------------- -# Project: NitroSDK - tools - makelcf -# File: ARM9-TS.lcf.template -# -# Copyright 2003-2006 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ARM9-TS.lcf.template,v $ -# Revision 1.34 04/06/2006 09:02:36 kitase_hirotake -# support for .itcm.bss and .dtcm.bss -# -# Revision 1.33 03/30/2006 23:59:22 AM yasu -# changed creation year -# -# Revision 1.32 03/29/2006 13:14:22 AM yasu -# support for overlays in CWVER 2.x -# -# Revision 1.31 11/24/2005 01:16:47 yada -# change start address of mainEX arena from 0x2400000 to 0x23e0000 -# -# Revision 1.30 09/02/2005 04:14:22 AM yasu -# Old symbols were redefined so they can be used even under SDK2.2 -# -# Revision 1.29 08/31/2005 09:34:57 AM yasu -# Corrected a problem where code would not function normally when using section names such as section_BSS -# -# Revision 1.28 08/26/2005 11:22:16 AM yasu -# overlay support for ITCM/DTCM -# -# Revision 1.27 06/20/2005 12:29:20 AM yasu -# Changed Surffix to Suffix -# -# Revision 1.26 06/14/2005 09:03:42 yada -# fix around minus value of SDK_STACKSIZE -# -# Revision 1.25 04/13/2005 12:51:00 terui -# Change SDK_AUTOLOAD.DTCM.START 0x027c0000 -> 0x027e0000 -# -# Revision 1.24 03/30/2005 00:02:14 yosizaki -# fix copyright header. -# -# Revision 1.23 03/25/2005 12:54:59 AM yasu -# Include .version section -# -# Revision 1.22 10/03/2004 02:00:56 AM yasu -# Output component file list for compstatic tool -# -# Revision 1.21 09/27/2004 05:28:21 AM yasu -# Support .sinit -# -# Revision 1.20 09/09/2004 11:49:20 AM yasu -# Support compstatic in default -# -# Revision 1.19 09/06/2004 06:40:00 AM yasu -# Add labels for digest -# -# Revision 1.18 08/20/2004 06:19:59 AM yasu -# DTCM moves to 0x027c0000 at default -# -# Revision 1.17 08/02/2004 10:38:53 AM yasu -# Add autoload-done callback address in overlaydefs -# -# Revision 1.16 07/26/2004 02:22:32 AM yasu -# Change DTCM address to 0x023c0000 -# -# Revision 1.15 07/26/2004 00:08:27 AM yasu -# Fix label of exception table -# -# Revision 1.14 07/24/2004 05:42:25 AM yasu -# Set default values for SDK_AUTOGEN_xTCM_START -# -# Revision 1.13 07/23/2004 11:32:14 AM yasu -# Define labels for __exception_table_start__ and _end__ -# -# Revision 1.12 07/12/2004 12:21:08 AM yasu -# Check size of ITCM/DTCM -# -# Revision 1.11 07/10/2004 04:10:26 AM yasu -# Support command 'Library' -# -# Revision 1.10 07/02/2004 08:13:02 AM yasu -# Support OBJECT( ) -# -# Revision 1.9 07/01/2004 12:54:38 yasu -# support ITCM/DTCM/WRAM autoload -# -# Revision 1.8 07/01/2004 10:41:46 yasu -# support autoload -# -# Revision 1.7 06/02/2004 07:35:37 yasu -# Set libsyscall.a in FORCE_ACTIVE -# Put NitroMain at the top of ROM image -# -# Revision 1.6 06/02/2004 04:56:28 yasu -# Change to fit to new ROM map of TS -# -# Revision 1.5 2004/06/01 06:12:00 miya -# add padding at top of ROM image. -# -# Revision 1.4 04/26/2004 12:16:48 yasu -# add KEEP_SECTIONS -# -# Revision 1.3 04/20/2004 07:41:32 yasu -# Set STATICINIT instead of .ctor temporarily -# -# Revision 1.2 04/14/2004 07:16:42 yasu -# add ALIGN(32) for convenience to handle cache line -# -# Revision 1.1 04/06/2004 01:59:54 yasu -# newly added -# -# $NoKeywords: $ -#--------------------------------------------------------------------------- -MEMORY -{ - main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin - ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin - DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - - main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin - main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin - dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 - arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 - arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0 - arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0 - arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0 - binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files - check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check - check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check -} - -FORCE_ACTIVE -{ - SVC_SoftReset -} - -KEEP_SECTION -{ - .sinit -} - -SECTIONS -{ - ############################ STATIC ################################# - .main: - { - ALIGNALL(4); . = ALIGN(32); # Fit to cache line - - # - # TEXT BLOCK: READ ONLY - # - SDK_STATIC_START =.; - SDK_STATIC_TEXT_START =.; - #:::::::::: text/rodata - libsyscall.a (.text) - crt0.o (.text) - crt0.o (.rodata) - * (.version) - OBJECT(NitroMain,*) - GROUP(ROOT) (.text) - . = ALIGN(4); - * (.exception) - . = ALIGN(4); - SDK_STATIC_ETABLE_START =.; - EXCEPTION - SDK_STATIC_ETABLE_END =.; - . = ALIGN(4); - GROUP(ROOT) (.init) - . = ALIGN(4); - GROUP(ROOT) (.rodata) - . = ALIGN(4); - - SDK_STATIC_SINIT_START =.; - #:::::::::: ctor - GROUP(ROOT) (.ctor) - GROUP(ROOT) (.sinit) - WRITEW 0; - #:::::::::: ctor - SDK_STATIC_SINIT_END =.; - - #:::::::::: text/rodata - . = ALIGN(32); - SDK_STATIC_TEXT_END =.; - - # - # DATA BLOCK: READ WRITE - # - SDK_STATIC_DATA_START =.; - #:::::::::: data - GROUP(ROOT) (.sdata) - . = ALIGN(4); - GROUP(ROOT) (.data) - . = ALIGN(4); - SDK_OVERLAY_DIGEST =.; - # NO DIGEST - SDK_OVERLAY_DIGEST_END =.; - #:::::::::: data - . = ALIGN(32); - SDK_STATIC_DATA_END =.; - SDK_STATIC_END =.; - - SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; - SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; - SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; - __sinit__ = SDK_STATIC_SINIT_START; # for static initializer - __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table - __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table - } > main - - .main.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_STATIC_BSS_START =.; - #:::::::::: bss - GROUP(ROOT) (.sbss) - . = ALIGN(4); - GROUP(ROOT) (.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_STATIC_BSS_END = .; - SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; - - } >> main - - - ############################ AUTOLOADS ############################## - SDK_AUTOLOAD.ITCM.START = 0x01ff8000; - SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.SIZE = 0; - SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; - SDK_AUTOLOAD.DTCM.START = 0x027e0000; - SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.SIZE = 0; - SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; - SDK_AUTOLOAD_START = SDK_STATIC_END; - SDK_AUTOLOAD_SIZE = 0; - SDK_AUTOLOAD_NUMBER = 2; - - .ITCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_ITCM_ID =0; - SDK_AUTOLOAD.ITCM.ID =0; - SDK_AUTOLOAD.ITCM.START =.; - SDK_AUTOLOAD.ITCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - * (.itcm) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.ITCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.ITCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.DATA_END =.; - SDK_AUTOLOAD.ITCM.END =.; - - SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START; - SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START; - SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE; - - } > ITCM - - .ITCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.ITCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - * (.itcm.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.BSS_END = .; - - SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START; - - } >> ITCM - - .DTCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_DTCM_ID =1; - SDK_AUTOLOAD.DTCM.ID =1; - SDK_AUTOLOAD.DTCM.START =.; - SDK_AUTOLOAD.DTCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.DTCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.DTCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm) - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.DATA_END =.; - SDK_AUTOLOAD.DTCM.END =.; - - SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START; - SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START; - SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE; - - } > DTCM - - .DTCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.DTCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm.bss) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.BSS_END = .; - - SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START; - - } >> DTCM - - - SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; - SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; - SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; - SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; - SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; - SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; - SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; - SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; - - ############################ AUTOLOAD_INFO ########################## - .binary.AUTOLOAD_INFO: - { - WRITEW ADDR(.ITCM); - WRITEW SDK_AUTOLOAD.ITCM.SIZE; - WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE; - WRITEW ADDR(.DTCM); - WRITEW SDK_AUTOLOAD.DTCM.SIZE; - WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE; - } > binary.AUTOLOAD_INFO - - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - - ############################ STATIC_FOOTER ########################## - .binary.STATIC_FOOTER: - { - WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE - WRITEW _start_ModuleParams - ADDR(.main); - WRITEW 0; # NO DIGEST - } > binary.STATIC_FOOTER - - ############################ OVERLAYS ############################### - SDK_OVERLAY_NUMBER = 0; - - - ############################ MAIN EX ################################## - # MAIN EX Area - .dummy.MAIN_EX: - { - . = ALIGN(32); - } > dummy.MAIN_EX - - ############################ ARENA ################################## - .arena.MAIN: - { - . = ALIGN(32); - SDK_SECTION_ARENA_START =.; - } > arena.MAIN - - .arena.MAIN_EX: - { - . = ALIGN(32); - SDK_SECTION_ARENA_EX_START =.; - } > arena.MAIN_EX - - .arena.ITCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_ITCM_START =.; - } > arena.ITCM - - .arena.DTCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_DTCM_START =.; - } > arena.DTCM - - ############################ OVERLAYDEFS ############################ - .main_defs: - { - ### main module information - WRITEW ADDR(.main); # load address - WRITEW _start; # entry address - WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module - WRITEW _start_AutoloadDoneCallback; # callback autoload done - - ### overlay filename - - } > main_defs - - - ############################ OVERLAYTABLE ########################### - .main_table: - { - - } > main_table - - - ############################ OTHERS ################################# - SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; - SDK_IRQ_STACKSIZE = 4096; # allocated in DTCM - SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM - - # Module filelist - .binary.MODULE_FILES: - { - WRITES ("main.sbin"); - WRITES ("main_defs.sbin"); - WRITES ("main_table.sbin"); - } > binary.MODULE_FILES - - # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM - .check.ITCM: - { - . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; - } > check.ITCM - - SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; - .check.DTCM: - { - . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; - . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; - } > check.DTCM - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/ROM-TS.rsf b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/ROM-TS.rsf deleted file mode 100644 index cec9e1dbf9a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/ROM-TS.rsf +++ /dev/null @@ -1,116 +0,0 @@ -#---------------------------------------------------------------------------- -# Project: NitroSDK - include -# File: ROM-TS.lsf -# -# Copyright 2003-2005 Nintendo. All rights reserved. -# -# These coded insructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ROM-TS.rsf,v $ -# Revision 1.6 2005/04/05 23:52:58 yosizaki -# fix copyright date. -# -# Revision 1.5 2005/04/05 12:16:10 yosizaki -# support RomSpeedType parameter. -# -# Revision 1.4 2004/09/21 02:18:49 yasu -# Add default banner -# -# Revision 1.3 2004/09/09 11:39:09 yasu -# Unified ROM-TS and ROM-TS-C, also ROM-TEG and ROM-TEG-C -# -# Revision 1.2 2004/05/26 12:03:38 yasu -# add :r option to get basename for supporting IDE with makerom -# -# Revision 1.1 2004/04/06 01:59:59 yasu -# newly added -# -# $NoKeywords: $ -#---------------------------------------------------------------------------- -# -# Nitro ROM SPEC FILE -# - -Arm9 -{ - Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" - OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" - OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" - Elf "$(MAKEROM_ARM9:r).nef" -} - -Arm7 -{ - Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" - OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" - OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" - Elf "$(MAKEROM_ARM7:r).nef" -} - -Property -{ - ### - ### Settings for FinalROM - ### - #### BEGIN - # - # TITLE NAME: Your product name within 12bytes - # - #TitleName "YourAppName" - - # - # MAKER CODE: Your company ID# in 2 ascii words - # issued by NINTENDO - # - #MakerCode "00" - - # - # REMASTER VERSION: Mastering version - # - #RomVersion 0 - - # - # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] - # - RomSpeedType $(MAKEROM_ROMSPEED) - - # - # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] - # - #RomSize 128M - #RomSize 256M - - # - # ROM PADDING: TRUE if finalrom - # - #RomFootPadding TRUE - - # - # ROM HEADER TEMPLATE: Provided to every product by NINTENDO - # - #RomHeaderTemplate ./etc/rom_header.template.sbin - - # - # BANNER FILE: generated from Banner Spec File - # - #BannerFile ./etc/myGameBanner.bnr - BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr - - ### - ### - ### - #### END -} - -RomSpec -{ - Offset 0x00000000 - Segment ALL - HostRoot $(MAKEROM_ROMROOT) - Root / - File $(MAKEROM_ROMFILES) -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/gpnitrocw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/gpnitrocw.mcp deleted file mode 100644 index 878b88e6aec..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpnitrocw/gpnitrocw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2/Makefile deleted file mode 100644 index e20765f7978..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -#GameSpy.net PS2 Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CLFAGS = - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -SDK_LIBS = - -#Name of the SDK sample -TARGET = gptestc - -#All the object files needed for this SDK -OBJS = ../../../ps2common/ps2common.o \ - ../../../nonport.o \ - ../../../md5c.o \ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../stringutil.o\ - ../../../available.o\ - ../../gp.o \ - ../../gpi.o \ - ../../gpiBuddy.o \ - ../../gpiBuffer.o \ - ../../gpiCallback.o \ - ../../gpiConnect.o \ - ../../gpiInfo.o \ - ../../gpiOperation.o \ - ../../gpiPeer.o \ - ../../gpiProfile.o \ - ../../gpiSearch.o \ - ../../gpiUnique.o \ - ../../gpiUtility.o \ - ../../gpiTransfer.o \ - crt0.o\ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../ps2common/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2cw/gpps2cw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2cw/gpps2cw.mcp deleted file mode 100644 index 424def05726..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2cw/gpps2cw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.dsp deleted file mode 100644 index c403eb2b5a6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.dsp +++ /dev/null @@ -1,444 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gpps2prodg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gpps2prodg - Win32 PS2 EE Release Insock -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gpps2prodg.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gpps2prodg.mak" CFG="gpps2prodg - Win32 PS2 EE Release Insock" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gpps2prodg - Win32 PS2 EE Debug EENet" (based on "Win32 (x86) Console Application") -!MESSAGE "gpps2prodg - Win32 PS2 EE Debug SNSystems" (based on "Win32 (x86) Console Application") -!MESSAGE "gpps2prodg - Win32 PS2 EE Debug Insock" (based on "Win32 (x86) Console Application") -!MESSAGE "gpps2prodg - Win32 PS2 EE Release EENet" (based on "Win32 (x86) Console Application") -!MESSAGE "gpps2prodg - Win32 PS2 EE Release SNSystems" (based on "Win32 (x86) Console Application") -!MESSAGE "gpps2prodg - Win32 PS2 EE Release Insock" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/GP/gptestc/gpps2prodg", PSEDAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gpps2prodg - Win32 PS2 EE Debug EENet" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Debug EENet" -# PROP BASE Intermediate_Dir "PS2 EE Debug EENet" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_EENet" -# PROP Intermediate_Dir "Debug_EENet" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Debug/" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "EENET" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"PS2_EE_Debug\gpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libcdvd.a eenetctl.a ent_smap.a ent_eth.a ent_ppp.a libeenet.a libscf.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_EENet\gpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gpps2prodg - Win32 PS2 EE Debug SNSystems" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Debug SNSystems" -# PROP BASE Intermediate_Dir "PS2 EE Debug SNSystems" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_SNSystems" -# PROP Intermediate_Dir "Debug_SNSystems" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Debug/" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_SYSTEMS" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"PS2_EE_Debug\gpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 sneetcp.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_SNSystems\gpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gpps2prodg - Win32 PS2 EE Debug Insock" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gpps2prodg___Win32_PS2_EE_Debug_Insock" -# PROP BASE Intermediate_Dir "gpps2prodg___Win32_PS2_EE_Debug_Insock" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_Insock" -# PROP Intermediate_Dir "Debug_Insock" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "EENET" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "_DEBUG" /D "INSOCK" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libcdvd.a eenetctl.a ent_smap.a ent_eth.a ent_ppp.a libeenet.a libscf.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_EENet\gpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_Insock\gpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gpps2prodg - Win32 PS2 EE Release EENet" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Release EENet" -# PROP BASE Intermediate_Dir "PS2 EE Release EENet" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_EENet" -# PROP Intermediate_Dir "Release_EENet" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Release/" /FD /c -# ADD CPP /nologo /W4 /WX /O2 /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "EENET" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"PS2_EE_Release\gpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libcdvd.a eenetctl.a ent_smap.a ent_eth.a ent_ppp.a libeenet.a libscf.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_EENet\gpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gpps2prodg - Win32 PS2 EE Release SNSystems" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Release SNSystems" -# PROP BASE Intermediate_Dir "PS2 EE Release SNSystems" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_SNSystems" -# PROP Intermediate_Dir "Release_SNSystems" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Release/" /FD /c -# ADD CPP /nologo /W4 /WX /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "SN_SYSTEMS" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"PS2_EE_Release\gpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 sneetcp.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_SNSystems\gpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gpps2prodg - Win32 PS2 EE Release Insock" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gpps2prodg___Win32_PS2_EE_Release_Insock" -# PROP BASE Intermediate_Dir "gpps2prodg___Win32_PS2_EE_Release_Insock" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_Insock" -# PROP Intermediate_Dir "Release_Insock" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "_DEBUG" /D "INSOCK" /FD /debug /c -# ADD CPP /nologo /W4 /WX /O2 /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "INSOCK" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /debug /machine:IX86 /out:"Release_Insock\gpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /debug /machine:IX86 /out:"Release_Insock\gpps2prodg.elf" /D:SN_TARGET_PS2 - -!ENDIF - -# Begin Target - -# Name "gpps2prodg - Win32 PS2 EE Debug EENet" -# Name "gpps2prodg - Win32 PS2 EE Debug SNSystems" -# Name "gpps2prodg - Win32 PS2 EE Debug Insock" -# Name "gpps2prodg - Win32 PS2 EE Release EENet" -# Name "gpps2prodg - Win32 PS2 EE Release SNSystems" -# Name "gpps2prodg - Win32 PS2 EE Release Insock" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\gptestc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\ps2\ps2common.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\common\ps2\prodg\PS2_in_VC.h -# End Source File -# End Group -# Begin Group "PresenceSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\gp.c -# End Source File -# Begin Source File - -SOURCE=..\..\gp.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpi.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpi.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiBuddy.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiBuddy.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiCallback.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiConnect.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiConnect.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiInfo.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiOperation.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiOperation.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiPeer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiPeer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiProfile.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiProfile.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiSearch.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiSearch.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiTransfer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiTransfer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiUnique.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiUnique.h -# End Source File -# Begin Source File - -SOURCE=..\..\gpiUtility.c -# End Source File -# Begin Source File - -SOURCE=..\..\gpiUtility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\md5c.c -# End Source File -# End Group -# Begin Source File - -SOURCE=c:\usr\local\sce\ee\lib\app.cmd -# End Source File -# Begin Source File - -SOURCE=c:\usr\local\sce\ee\lib\crt0.s -# End Source File -# Begin Source File - -SOURCE=..\..\..\ps2common\prodg\ps2.lk -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.dsw deleted file mode 100644 index e3a739b4729..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.dsw +++ /dev/null @@ -1,37 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gpps2prodg"=.\gpps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/GP/gptestc/gpps2prodg", PSEDAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/gamespy/goa/gp/gptestc/gpps2prodg", PSEDAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.sln deleted file mode 100644 index be950b8e60f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.sln +++ /dev/null @@ -1,49 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpps2prodg", "gpps2prodg.vcproj", "{93A0A53A-16D0-4ACE-9103-262B0DF81F3B}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfsapp1:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gpps2prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS2 EE Debug|Win32 = PS2 EE Debug|Win32 - PS2 EE Release|Win32 = PS2 EE Release|Win32 - PS2 EENET Debug|Win32 = PS2 EENET Debug|Win32 - PS2 EENET Release|Win32 = PS2 EENET Release|Win32 - PS2 INET Debug|Win32 = PS2 INET Debug|Win32 - PS2 INET Release|Win32 = PS2 INET Release|Win32 - PS2 SN Systems Debug|Win32 = PS2 SN Systems Debug|Win32 - PS2 SN Systems Release|Win32 = PS2 SN Systems Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EE Debug|Win32.ActiveCfg = PS2 EE Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EE Debug|Win32.Build.0 = PS2 EE Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EE Release|Win32.ActiveCfg = PS2 EE Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EE Release|Win32.Build.0 = PS2 EE Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EENET Debug|Win32.ActiveCfg = PS2 EE Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EENET Debug|Win32.Build.0 = PS2 EE Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EENET Release|Win32.ActiveCfg = PS2 EE Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 EENET Release|Win32.Build.0 = PS2 EE Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 INET Debug|Win32.ActiveCfg = PS2 INET Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 INET Debug|Win32.Build.0 = PS2 INET Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 INET Release|Win32.ActiveCfg = PS2 INET Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 INET Release|Win32.Build.0 = PS2 INET Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 SN Systems Debug|Win32.ActiveCfg = PS2 SN Systems Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 SN Systems Debug|Win32.Build.0 = PS2 SN Systems Debug|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 SN Systems Release|Win32.ActiveCfg = PS2 SN Systems Release|Win32 - {93A0A53A-16D0-4ACE-9103-262B0DF81F3B}.PS2 SN Systems Release|Win32.Build.0 = PS2 SN Systems Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.vcproj deleted file mode 100644 index ca119f9cd62..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps2prodg/gpps2prodg.vcproj +++ /dev/null @@ -1,849 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3/Makefile deleted file mode 100644 index e03f78d97ba..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -#GameSpy.net PS3 Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CFLAGS = -DGSI_COMMON_DEBUG - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -SDK_LIBS = - -#Name of the SDK sample -TARGET = gptestc - -#All the object files needed for this SDK -OBJS = ../../../common/ps3/ps3common.o \ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o \ - ../../../common/gsPlatformThread.o \ - ../../../common/gsPlatformUtil.o \ - ../../../common/gsMemory.o \ - ../../../common/gsDebug.o \ - ../../../common/gsStringUtil.o \ - ../../../common/gsAvailable.o \ - ../../../hashtable.o \ - ../../../darray.o \ - ../../../md5c.o \ - ../../gp.o \ - ../../gpi.o \ - ../../gpiBuddy.o \ - ../../gpiBuffer.o \ - ../../gpiCallback.o \ - ../../gpiConnect.o \ - ../../gpiInfo.o \ - ../../gpiOperation.o \ - ../../gpiPeer.o \ - ../../gpiProfile.o \ - ../../gpiSearch.o \ - ../../gpiUnique.o \ - ../../gpiUtility.o \ - ../../gpiTransfer.o \ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/ps3/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3prodg/gpps3prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3prodg/gpps3prodg.sln deleted file mode 100644 index c20b74a54f8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3prodg/gpps3prodg.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpps3prodg", "gpps3prodg.vcproj", "{A089D0F3-E861-4309-89A4-A47A61401A3D}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gpps3prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS3 Debug|Win32 = PS3 Debug|Win32 - PS3 Release|Win32 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.ActiveCfg = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.Build.0 = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.ActiveCfg = PS3 Release|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.Build.0 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3prodg/gpps3prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3prodg/gpps3prodg.vcproj deleted file mode 100644 index eb775604ad4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpps3prodg/gpps3prodg.vcproj +++ /dev/null @@ -1,583 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppsp/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppsp/Makefile deleted file mode 100644 index 4f4897f9f16..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppsp/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -#GameSpy.net PSP Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CFLAGS = -DUNIQUEID -DGSI_MEM_MANAGED -DGSI_COMMON_DEBUG - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -#SDK_LIBS = - -#Name of the SDK sample -TARGET = gptestc - -#All the object files needed for this SDK -OBJS = ../../../common/psp/pspcommon.o\ - ../../../common/psp/gsUtilPSP.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsDebug.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../md5c.o\ - ../../gp.o\ - ../../gpi.o\ - ../../gpiBuddy.o\ - ../../gpiBuffer.o\ - ../../gpiCallback.o\ - ../../gpiConnect.o\ - ../../gpiInfo.o\ - ../../gpiOperation.o\ - ../../gpiPeer.o\ - ../../gpiProfile.o\ - ../../gpiSearch.o\ - ../../gpiTransfer.o\ - ../../gpiUnique.o\ - ../../gpiUtility.o\ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/psp/Makefile.common - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppspprodg/gppspprodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppspprodg/gppspprodg.sln deleted file mode 100644 index 926591a4158..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppspprodg/gppspprodg.sln +++ /dev/null @@ -1,34 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gppspprodg", "gppspprodg.vcproj", "{E95E1EE9-B275-43C2-A90F-11B505A22EA0}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gppspprodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PSP Debug Opt|Win32 = PSP Debug Opt|Win32 - PSP Debug|Win32 = PSP Debug|Win32 - PSP Release|Win32 = PSP Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E95E1EE9-B275-43C2-A90F-11B505A22EA0}.PSP Debug Opt|Win32.ActiveCfg = PSP Debug Opt|Win32 - {E95E1EE9-B275-43C2-A90F-11B505A22EA0}.PSP Debug Opt|Win32.Build.0 = PSP Debug Opt|Win32 - {E95E1EE9-B275-43C2-A90F-11B505A22EA0}.PSP Debug|Win32.ActiveCfg = PSP Debug|Win32 - {E95E1EE9-B275-43C2-A90F-11B505A22EA0}.PSP Debug|Win32.Build.0 = PSP Debug|Win32 - {E95E1EE9-B275-43C2-A90F-11B505A22EA0}.PSP Release|Win32.ActiveCfg = PSP Release|Win32 - {E95E1EE9-B275-43C2-A90F-11B505A22EA0}.PSP Release|Win32.Build.0 = PSP Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppspprodg/gppspprodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppspprodg/gppspprodg.vcproj deleted file mode 100644 index f502b86176e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gppspprodg/gppspprodg.vcproj +++ /dev/null @@ -1,630 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gprevolutioncw/gprevolutioncw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gprevolutioncw/gprevolutioncw.mcp deleted file mode 100644 index 33c708a4956..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gprevolutioncw/gprevolutioncw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc.c b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc.c deleted file mode 100644 index c3e48db23f0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc.c +++ /dev/null @@ -1,654 +0,0 @@ -#include "../gp.h" -#include "../../common/gsAvailable.h" - -#if defined(_WIN32) && !defined(UNDER_CE) - #include -#endif - -#ifdef UNDER_CE - void RetailOutputA(CHAR *tszErr, ...); - #define printf RetailOutputA -#elif defined(_NITRO) - #include "../../common/nitro/screen.h" - #define printf Printf - #define vprintf VPrintf -#endif - -#if defined(_WIN32) -// disable the warning about our while(1) statement -#pragma warning(disable:4127) -#endif - -#ifdef __MWERKS__ // CodeWarrior will warn if function is not prototyped -int test_main(int argc, char **argv); -#endif - -#define GPTC_PRODUCTID 0 -#define GPTC_GAMENAME _T("gmtest") -#define GPTC_NICK1 _T("gptestc1") -#define GPTC_NICK2 _T("gptestc2") -#define GPTC_NICK3 _T("gptestc3") -#define GPTC_EMAIL1 _T("gptestc@gptestc.com") -#define GPTC_EMAIL2 _T("gptestc2@gptestc.com") -#define GPTC_EMAIL3 _T("gptestc3@gptestc.com") -#define GPTC_PASSWORD _T("gptestc") -#define GPTC_PID1 2957553 -#define GPTC_PID2 3052160 -#define GPTC_PID3 118305038 -#define GPTC_FIREWALL_OPTION GP_FIREWALL - -#define CHECK_GP_RESULT(func, errString) if(func != GP_NO_ERROR) { printf("%s\n", errString); /*return 1;*/ } - -GPConnection * pconn; -GPProfile other; -GPProfile otherBlock; -int otherIndex = -1; -int appState = -1; -gsi_bool receivedLastMessage = gsi_false; -gsi_bool gotStoodUp = gsi_false; -gsi_bool blockTesting = gsi_false; -int noComLineArgs; -int namespaceIds[GP_MAX_NAMESPACEIDS] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - - -#ifdef GSI_COMMON_DEBUG - static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - { - GSI_UNUSED(theLevel); - - printf("[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - - vprintf(theTokenStr, theParamList); - } -#endif - -static void Error(GPConnection * pconnection, GPErrorArg * arg, void * param) -{ - gsi_char * errorCodeString; - gsi_char * resultString; - -#define RESULT(x) case x: resultString = _T(#x); break; - switch(arg->result) - { - RESULT(GP_NO_ERROR) - RESULT(GP_MEMORY_ERROR) - RESULT(GP_PARAMETER_ERROR) - RESULT(GP_NETWORK_ERROR) - RESULT(GP_SERVER_ERROR) - default: - resultString = _T("Unknown result!\n"); - } - -#define ERRORCODE(x) case x: errorCodeString = _T(#x); break; - switch(arg->errorCode) - { - ERRORCODE(GP_GENERAL) - ERRORCODE(GP_PARSE) - ERRORCODE(GP_NOT_LOGGED_IN) - ERRORCODE(GP_BAD_SESSKEY) - ERRORCODE(GP_DATABASE) - ERRORCODE(GP_NETWORK) - ERRORCODE(GP_FORCED_DISCONNECT) - ERRORCODE(GP_CONNECTION_CLOSED) - ERRORCODE(GP_LOGIN) - ERRORCODE(GP_LOGIN_TIMEOUT) - ERRORCODE(GP_LOGIN_BAD_NICK) - ERRORCODE(GP_LOGIN_BAD_EMAIL) - ERRORCODE(GP_LOGIN_BAD_PASSWORD) - ERRORCODE(GP_LOGIN_BAD_PROFILE) - ERRORCODE(GP_LOGIN_PROFILE_DELETED) - ERRORCODE(GP_LOGIN_CONNECTION_FAILED) - ERRORCODE(GP_LOGIN_SERVER_AUTH_FAILED) - ERRORCODE(GP_NEWUSER) - ERRORCODE(GP_NEWUSER_BAD_NICK) - ERRORCODE(GP_NEWUSER_BAD_PASSWORD) - ERRORCODE(GP_UPDATEUI) - ERRORCODE(GP_UPDATEUI_BAD_EMAIL) - ERRORCODE(GP_NEWPROFILE) - ERRORCODE(GP_NEWPROFILE_BAD_NICK) - ERRORCODE(GP_NEWPROFILE_BAD_OLD_NICK) - ERRORCODE(GP_UPDATEPRO) - ERRORCODE(GP_UPDATEPRO_BAD_NICK) - ERRORCODE(GP_ADDBUDDY) - ERRORCODE(GP_ADDBUDDY_BAD_FROM) - ERRORCODE(GP_ADDBUDDY_BAD_NEW) - ERRORCODE(GP_ADDBUDDY_ALREADY_BUDDY) - ERRORCODE(GP_AUTHADD) - ERRORCODE(GP_AUTHADD_BAD_FROM) - ERRORCODE(GP_AUTHADD_BAD_SIG) - ERRORCODE(GP_STATUS) - ERRORCODE(GP_BM) - ERRORCODE(GP_BM_NOT_BUDDY) - ERRORCODE(GP_GETPROFILE) - ERRORCODE(GP_GETPROFILE_BAD_PROFILE) - ERRORCODE(GP_DELBUDDY) - ERRORCODE(GP_DELBUDDY_NOT_BUDDY) - ERRORCODE(GP_DELPROFILE) - ERRORCODE(GP_DELPROFILE_LAST_PROFILE) - ERRORCODE(GP_SEARCH) - ERRORCODE(GP_SEARCH_CONNECTION_FAILED) - default: - errorCodeString = _T("Unknown error code!\n"); - } - - if(arg->fatal) - { - printf( "-----------\n"); - printf( "FATAL ERROR\n"); - printf( "-----------\n"); - } - else - { - printf( "-----\n"); - printf( "ERROR\n"); - printf( "-----\n"); - } - _tprintf( _T("RESULT: %s (%d)\n"), resultString, arg->result); - _tprintf( _T("ERROR CODE: %s (0x%X)\n"), errorCodeString, arg->errorCode); - _tprintf( _T("ERROR STRING: %s\n"), arg->errorString); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -gsi_char whois[GP_NICK_LEN]; -static void Whois(GPConnection * pconnection, GPGetInfoResponseArg * arg, void * param) -{ - if(arg->result == GP_NO_ERROR) - { - _tcscpy(whois, arg->nick); - /*if (_tcscmp(arg->email, "")) { - _tcscat(whois, _T("@")); - _tcscat(whois, arg->email); - }*/ - } - else - printf( "WHOIS FAILED\n"); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void ConnectResponse(GPConnection * pconnection, GPConnectResponseArg * arg, void * param) -{ - if(arg->result == GP_NO_ERROR) - printf("Connected\n"); - else - printf( "CONNECT FAILED\n"); - - gpSetStatus(pconnection, (GPEnum)GP_ONLINE, _T("Not Ready"), _T("gptestc")); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void ProfileSearchResponse(GPConnection * pconnection, GPProfileSearchResponseArg * arg, void * param) -{ - GPResult result; - int i; - if(arg->result == GP_NO_ERROR) - { - if(arg->numMatches > 0) - { - for(i = 0 ; i < arg->numMatches ; i++) - { - result = gpGetInfo(pconn, arg->matches[i].profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, NULL); - if(result != GP_NO_ERROR) - printf(" gpGetInfo failed\n"); - else - _tprintf(_T(" Found: %s\n"), whois); - } - } - else - printf( " NO MATCHES\n"); - } - else - printf( " SEARCH FAILED\n"); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -int msgCount = 0; -static void RecvBuddyMessage(GPConnection * pconnection, void * theArg, void * param) -{ - GPRecvBuddyMessageArg *arg; - GPResult result; - - arg = (GPRecvBuddyMessageArg *)theArg; - - result = gpGetInfo(pconn, arg->profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, NULL); - if(result != GP_NO_ERROR) - printf(" gpGetInfo failed\n"); - else - _tprintf(_T(" Received buddy message: %s: %s\n"), whois, arg->message); - - if (!(_tcscmp(arg->message, "5_Hello!"))) { - receivedLastMessage = gsi_true; - } - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - - -static void GetInfoResponse(GPConnection * pconnection, GPGetInfoResponseArg * arg, void * param) -{ - //_tprintf(_T(" First Name: %s Last Name: %s (%s@%s)\n"), arg->firstname, arg->lastname, arg->nick, arg->email); - _tprintf(_T(" First Name: %s Last Name: %s (%s)\n"), arg->firstname, arg->lastname, arg->nick); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -void RecvBuddyStatus(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyStatusArg * arg = (GPRecvBuddyStatusArg *)arg_; - GPBuddyStatus status; - static char* statusToString[6] = - { - "GP_OFFLINE", - "GP_ONLINE", - "GP_PLAYING", - "GP_STAGING", - "GP_CHATTING", - "GP_AWAY" - }; - - printf(" Buddy index: %d\n", arg->index); - - if (arg->profile == other) - { - if (appState < 0) - appState = 0; - otherIndex = arg->index; - gpGetBuddyStatus(connection, arg->index, &status); - if (status.status == 1 && _tcscmp(status.statusString, "Ready") && _tcscmp(status.statusString, "BlockTime")) { - if (appState < 1) { - appState = 1; - //printf("Buddy is online!\n"); - CHECK_GP_RESULT(gpSetStatus(pconn, (GPEnum) GP_ONLINE, _T("Ready"), _T("gptestc")), "gpSetStatus failed"); - //printf("Now wait until buddy is ready to message...\n"); - } - } - else if (status.status == 1 && !(_tcscmp(status.statusString, "Ready"))) { - if (appState < 2) { - appState = 2; - //printf("Buddy is ready to message!\n"); - CHECK_GP_RESULT(gpSetStatus(pconn, (GPEnum) GP_ONLINE, _T("Ready"), _T("gptestc")), "gpSetStatus failed"); - } - } - else if (status.status == 1 && !(_tcscmp(status.statusString, "BlockTime"))) { - if (appState < 3) - appState = 3; - //printf("Buddy is ready to block test!\n"); - } - } - printf(" "); - gpGetInfo(connection, arg->profile, GP_DONT_CHECK_CACHE, GP_BLOCKING, (GPCallback)GetInfoResponse, NULL); - - gpGetBuddyStatus(connection, arg->index, &status); - - printf(" Status: %s, Status String: %s, Location String: %s, IP: %d, Port: %d\n", statusToString[status.status], status.statusString, status.locationString, status.ip, status.port); - - GSI_UNUSED(param); -} - -void RecvBuddyRequest(GPConnection * connection, void * arg_, void * param) -{ - GPRecvBuddyRequestArg * arg = (GPRecvBuddyRequestArg *)arg_; - - gsi_char buddy1[50]; - gsi_char buddy2[50]; - - gpGetInfo(connection, arg->profile, GP_CHECK_CACHE, GP_BLOCKING, (GPCallback)Whois, NULL); - printf("\nBuddy Request from %s\n", whois); -#ifdef GSI_UNICODE - _stprintf(buddy1, sizeof(buddy1), _T("%s"), GPTC_NICK1); - _stprintf(buddy2, sizeof(buddy2), _T("%s"), GPTC_NICK2); -#else - _stprintf(buddy1, _T("%s"), GPTC_NICK1); - _stprintf(buddy2, _T("%s"), GPTC_NICK2); -#endif - - if (!_tcscmp(whois, buddy1) || !_tcscmp(whois, buddy2)) - { - printf("Authorizing buddy request\n"); - gpAuthBuddyRequest(connection, arg->profile); - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - if (blockTesting) { - appState = 4; - if (!noComLineArgs) { - gpSendBuddyRequest(pconn, other, _T("testing")); - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - } - } - } - else - { - printf("Denying buddy request\n"); - gpDenyBuddyRequest(connection, arg->profile); - } - GSI_UNUSED(connection); - GSI_UNUSED(param); -} - -void RecvBuddyRevoke(GPConnection * connection, void * arg_, void * param) -{ - printf("Buddy Revoke received...\n"); - - if (appState == 2) { - appState = 3; - } - - GSI_UNUSED(connection); - GSI_UNUSED(param); - GSI_UNUSED(arg_); -} - -static void printBlockedList() -{ - int i=0; - int numBlocked; - int pid; - - gpGetNumBlocked(pconn, &numBlocked); - printf("Get blocked list: num = %d\n", numBlocked); - - for (i=0; i 10000) - { - if (appState == -1) // buddy is not actually on our buddy list - { - if (noComLineArgs) - printf(" %s is not on our buddy list! Sending him a buddy request and waiting for a response...\n", GPTC_NICK2); - else - printf("%s is not on our buddy list! Sending him a buddy request and waiting for a response...\n", GPTC_NICK1); - - gpSendBuddyRequest(pconn, other, _T("testing")); - - totalTime = 0; - while (totalTime < 10000 && appState != 2) { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - totalTime += 50; - } - totalTime = 12001; - if (appState != 2) - { - if (noComLineArgs) - printf("\n%s never showed up =(\n", GPTC_NICK2); - else - printf("\n%s never showed up =(\n", GPTC_NICK1); - gotStoodUp = gsi_true; - break; - } - } - else // buddy is on our buddy list but did not come online and set status to "Ready" - { - if (noComLineArgs) - printf("\n%s never showed up =(\n", GPTC_NICK2); - else - printf("\n%s never showed up =(\n", GPTC_NICK1); - gotStoodUp = gsi_true; - break; - } - } - } - - if (!gotStoodUp) - { - printf("\nSending messages to buddy (and receiving messages from him)\n"); - totalTime = 0; - messagesSent = 0; - while(messagesSent < 5) - { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - totalTime += 50; - if (totalTime % 1000 == 0) - { -#ifdef GSI_UNICODE - _stprintf(messageToSend, sizeof(messageToSend), _T("%d_Hello!"), (int)(totalTime/1000)); -#else - _stprintf(messageToSend, _T("%d_Hello!"), (int)(totalTime/1000)); -#endif - CHECK_GP_RESULT(gpSendBuddyMessage(pconn, other, messageToSend), "gpSendBuddyMessage failed"); - messagesSent++; - } - } - - while(!receivedLastMessage) - { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - } - - CHECK_GP_RESULT(gpSetStatus(pconn, (GPEnum) GP_ONLINE, _T("BlockTime"), _T("gptestc")), "gpSetStatus failed"); - - while(appState != 3) - { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - } - } - else - appState = 3; - - blockTesting = gsi_true; - if (noComLineArgs) { - // block buddy - if (gotStoodUp) { - CHECK_GP_RESULT(gpProfileFromID(pconn, &other, GPTC_PID3), "gpProfileFromID failed"); - printf("\nBlocking %s\n", GPTC_NICK3); - } - else - printf("\nBlocking %s\n", GPTC_NICK2); - - CHECK_GP_RESULT(gpAddToBlockedList(pconn, other), "gpAddToBlockedList failed"); - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - printBlockedList(); - - if (!gotStoodUp) { - printf("Checking if %s is on our buddy list...\n", GPTC_NICK2); - if (gpIsBuddy(pconn, other)) - printf("Yup.\n"); - else - printf("Nope.\n"); - - printf("Wait while %s tries to message us...\n", GPTC_NICK2); - totalTime = 0; - while (totalTime < 5000) { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - totalTime += 50; - } - } - if (!gotStoodUp) - printf("\nUnblocking %s\n", GPTC_NICK2); - else - printf("\nUnblocking %s\n", GPTC_NICK3); - CHECK_GP_RESULT(gpRemoveFromBlockedList(pconn, other), "gpRemoveFromBlockedList"); - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - printBlockedList(); - - CHECK_GP_RESULT(gpSetStatus(pconn, (GPEnum) GP_ONLINE, _T("DoneBlockTesting"), _T("gptestc")), "gpSetStatus failed"); - - if (!gotStoodUp) { - printf("Sending a buddy request to %s\n", GPTC_NICK2); - gpSendBuddyRequest(pconn, other, _T("testing")); - - printf("Waiting to get buddy requested back...\n"); - while (appState != 4) { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - } - } - } - else { - if (!gotStoodUp) { - printf("Waiting for %s to block us...\n", GPTC_NICK1); - while (gpIsBuddy(pconn, other)) { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - } - printf("We have been blocked. Trying to send buddy message to %s\n", GPTC_NICK1); - CHECK_GP_RESULT(gpSendBuddyMessage(pconn, other, _T("Why did you block me?")), "gpSendBuddyMessage failed"); - - printf("Waiting to get unblocked and buddy requested...\n"); - while (appState != 4) { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(50); - } - CHECK_GP_RESULT(gpSetStatus(pconn, (GPEnum) GP_ONLINE, _T("DoneBlockTesting"), _T("gptestc")), "gpSetStatus failed"); - } - } - - printf("\nDONE - Press any key to exit.\n\n"); - -#if defined(_WIN32) && !defined(UNDER_CE) - while (1) - { - CHECK_GP_RESULT(gpProcess(pconn), "gpProcess failed"); - msleep(10); - if (_kbhit()) { - break; - } - } -#endif - -//#if defined(_WIN32) && !defined(UNDER_CE) - //DISCONNECT - //////////// - gpDisconnect(pconn); - printf("Disconnected\n"); - - //DESTROY - ///////// - gpDestroy(pconn); - printf("Destroyed\n"); - return 0; -//#endif -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc.dsp deleted file mode 100644 index edb08f06444..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc.dsp +++ /dev/null @@ -1,480 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gptestc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gptestc - Win32 Unicode Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gptestc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gptestc.mak" CFG="gptestc - Win32 Unicode Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gptestc - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gptestc - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "gptestc - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "gptestc - Win32 Unicode Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gptestc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "gptestc___Win32_Release" -# PROP BASE Intermediate_Dir "gptestc___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W4 /WX /GX /O2 /I "..\..\\" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /D "GSI_MEM_MANAGED" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gptestc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gptestc___Win32_Debug" -# PROP BASE Intermediate_Dir "gptestc___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W4 /WX /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /D "GSI_MEM_MANAGED" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "gptestc - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Unicode Debug" -# PROP BASE Intermediate_Dir "Unicode Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Unicode Debug" -# PROP Intermediate_Dir "Unicode Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W4 /WX /Gm /GX /ZI /Od /I "..\..\\" /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /D "GSI_MEM_MANAGED" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "gptestc - Win32 Unicode Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Unicode Release" -# PROP BASE Intermediate_Dir "Unicode Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Unicode Release" -# PROP Intermediate_Dir "Unicode Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W4 /WX /GX /O2 /I "..\..\\" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /D "GSI_MEM_MANAGED" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ENDIF - -# Begin Target - -# Name "gptestc - Win32 Release" -# Name "gptestc - Win32 Debug" -# Name "gptestc - Win32 Unicode Debug" -# Name "gptestc - Win32 Unicode Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gptestc.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\win32\Win32Common.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\..\gt2\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.h -# End Source File -# End Group -# Begin Group "PresenceSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\gp.c -# End Source File -# Begin Source File - -SOURCE=..\gp.h -# End Source File -# Begin Source File - -SOURCE=..\gpi.c -# End Source File -# Begin Source File - -SOURCE=..\gpi.h -# End Source File -# Begin Source File - -SOURCE=..\gpiBuddy.c -# End Source File -# Begin Source File - -SOURCE=..\gpiBuddy.h -# End Source File -# Begin Source File - -SOURCE=..\gpiBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiCallback.c -# End Source File -# Begin Source File - -SOURCE=..\gpiCallback.h -# End Source File -# Begin Source File - -SOURCE=..\gpiConnect.c -# End Source File -# Begin Source File - -SOURCE=..\gpiConnect.h -# End Source File -# Begin Source File - -SOURCE=..\gpiInfo.c -# End Source File -# Begin Source File - -SOURCE=..\gpiInfo.h -# End Source File -# Begin Source File - -SOURCE=..\gpiKeys.c -# End Source File -# Begin Source File - -SOURCE=..\gpiKeys.h -# End Source File -# Begin Source File - -SOURCE=..\gpiOperation.c -# End Source File -# Begin Source File - -SOURCE=..\gpiOperation.h -# End Source File -# Begin Source File - -SOURCE=..\gpiPeer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiPeer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiProfile.c -# End Source File -# Begin Source File - -SOURCE=..\gpiProfile.h -# End Source File -# Begin Source File - -SOURCE=..\gpiSearch.c -# End Source File -# Begin Source File - -SOURCE=..\gpiSearch.h -# End Source File -# Begin Source File - -SOURCE=..\gpiTransfer.c -# End Source File -# Begin Source File - -SOURCE=..\gpiTransfer.h -# End Source File -# Begin Source File - -SOURCE=..\gpiUnique.c -# End Source File -# Begin Source File - -SOURCE=..\gpiUnique.h -# End Source File -# Begin Source File - -SOURCE=..\gpiUtility.c -# End Source File -# Begin Source File - -SOURCE=..\gpiUtility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc_vs2005.vcproj deleted file mode 100644 index 6ead76726bd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc_vs2005.vcproj +++ /dev/null @@ -1,1320 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gptestc_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpx360/gpx360.sln b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpx360/gpx360.sln deleted file mode 100644 index 8ef6f2e16cd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpx360/gpx360.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpx360", "gpx360.vcproj", "{51CF330D-9E84-42F4-B704-11A9FF0364CB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Xbox 360 = Debug|Xbox 360 - Profile_FastCap|Xbox 360 = Profile_FastCap|Xbox 360 - Profile|Xbox 360 = Profile|Xbox 360 - Release_LTCG|Xbox 360 = Release_LTCG|Xbox 360 - Release|Xbox 360 = Release|Xbox 360 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Profile_FastCap|Xbox 360.ActiveCfg = Profile_FastCap|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Profile_FastCap|Xbox 360.Build.0 = Profile_FastCap|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Profile|Xbox 360.ActiveCfg = Profile|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Profile|Xbox 360.Build.0 = Profile|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Release_LTCG|Xbox 360.ActiveCfg = Release_LTCG|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Release_LTCG|Xbox 360.Build.0 = Release_LTCG|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 - {51CF330D-9E84-42F4-B704-11A9FF0364CB}.Release|Xbox 360.Build.0 = Release|Xbox 360 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpx360/gpx360.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpx360/gpx360.vcproj deleted file mode 100644 index 1e35145b2cc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/GP/gptestc/gpx360/gpx360.vcproj +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/common/changelog.txt deleted file mode 100644 index 5b92b94b971..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/changelog.txt +++ /dev/null @@ -1,321 +0,0 @@ -Changelog for: GameSpy Common Code --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -12-12-2007 2.06.00 RMV RELEASE Released to Developer Site -12-12-2007 2.05.14 SN FIX Fixed getlocalhost for revolution -12-10-2007 2.05.13 SN FIX Added limits.h for PS2 -11-27-2007 2.05.12 SAH FIX Removed tm struct and added SB_NO_ICMP define for revolution - SAH CLEANUP Moved extern "c" block below includes to prevent linker errors -11-21-2007 2.05.11 SAH FIX Added include for Nitro/Revolution -11-16-2007 2.05.10 SAH FIX Fixed mem leak in gsCore from not freeing the dynamic array - SAH CLEANUP Changed async DNS code to set the handle pointer to null after freeing -11-09-2007 2.05.09 SAH CLEANUP Added wchar_t typecasts to goawstrdup to remove warnings -11-05-2007 2.05.08 SAH FIX Removed GP_NP_BUDDY_SYNC define, NP modules load now regardless -10-31-2007 2.05.07 SAH FIX Fixed to be included regardless of GSI_UNICODE define -10-19-2007 2.05.06 SAH OTHER Added goawstrdup function for wchar strdup operations -10-09-2007 2.05.05 SAH FIX Fixed compiler errors with gsiInt64ToString functions -10-08-2007 2.05.04 BED RELEASE Limited release -10-04-2007 2.05.04 DES FEATURE The task list can now grow dynamically -09-26-2007 2.05.03 SAH FIX Removed overrided PS3 time() function -09-18-2007 2.05.02 SAH OTHER Added two PS3 modules to ps3common for GP-NP support -08-16-2007 2.05.01 SAH FIX Removed unnecessary len > 0 assert in gsXmlWriteBase64BinaryElement -08-14-2007 2.05.01 SN FEATURE Added 64 bit integer function gsiStringToInt64 - SN FEATURE Added 64 bit versions of gsXml read and write functions -08-06-2007 2.05.00 RMV RELEASE Released to Developer Site -07-19-2007 2.04.07 SAH FIX Added explicit typecasting to UdpEngine to get rid of compiler warnings -07-16-2007 2.04.06 RMV FIX Defined SB_NO_ICMP_SUPPORT for Mac and Linux. -06-07-2007 2.04.05 SN RELEASE Releasing to developer site -06-01-2007 2.04.05 DES FIX Fixed warning under Win32 due to using a pointer to malloc functions -05-18-2007 2.04.04 SAH FIX Fixed memory leak from unfreed string in gsiXxteaAlg - 2.04.04 SAH FIX Fixed trashed memory bug in gsiXxteaAlg from null char overwrite -05-16-2007 2.04.03 DES FIX Wrapped gsPlatform.h in extern "C" if C++ - DES CLEANUP Cleaned up #undefs of common string funcs - DES CLEANUP Removed CE support from common code -04-17-2007 2.04.02 SAH OTHER Added gsiFloatSwap and Unswap byte reversal functions -03-15-2007 2.04.01 SN FIX Fixed some compiler warnings and errors for other platforms. -03-05-2007 2.04.00 SAH RELEASE Released to Developer Site -03-02-2007 2.03.10 SN FIX Fixed gsi common debug printing for Revolution - SN FIX Switched printf for nitro to properly print common debug logs - SN FIX Fixed warnings for code warrior -03-02-2007 2.03.09 SAH FIX Fixed MACOSX endian-ness to default to GSI_LITTLE_ENDIAN -03-02-2007 2.03.08 SN FIX Fixed declaration warning in gsXml.c -02-22-2007 2.03.07 SN FIX Fixed prototypes for extern aligned mem functions -01-30-2007 2.03.06 DES FIX Fixed compile error in gsXml.c -01-24-2007 2.03.05 SN FIX Fixed some Visual Studio 2005 warnings -01-23-2007 2.03.04 SAH FIX Added generalized UNICODE support for gsXML - 2.03.04 BED FIX Added UTF8ToUCS2StringLength for gsXML changes -01-17-2007 2.03.03 DES RELEASE Limited Release -01-16-2007 2.03.03 DES FEATURE Added X360 support -01-04-2007 2.03.02 BED FIX Added 2 new functions used in large int to ensure proper endian-ness for encryption - 2.03.02 BED FIX Fixed EncryptBuffer function to fix PS3 byte-order bug -12-20-2006 2.03.01 SN FIX Added code to free allocated memory for memory manager -12-15-2006 2.03.00 MJW RELEASE Released to Developer Site -12-13-2006 2.02.23 SN FIX Fixed issue where PSP uses the wrong FD_SETSIZE -12-11-2006 2.02.22 SN FIX Fixed VS 2005 warnings of deprecated CRT function itoa using a define -12-05-2006 2.02.21 SN FIX Made changes to the memory manager getting rid of unnamed union warnings -11-29-2006 2.02.20 SN FIX Small changes made to remove implicit cast warnings -11-10-2006 2.02.19 JR RELEASE Limited Release -11-08-2006 2.02.19 DES FIX Fixed so Core code will work managed C++ -11-06-2006 2.02.18 BED FEATURE Encryption clean up and speed up - Implemented RSA signatures. - Replaced Montgomery Multiplication with faster algorithm. - Fixed some bugs with 16bit compatability. -11-02-2006 2.02.17 SAH FIX Added CloseHandle to free Win32 thread resources -11-01-2006 2.02.16 BED FIX Added const keyword to various encrytion and large integer functions -10-31-2006 2.02.15 SN FIX Added a line to have system determine DST for all platforms supporting localtime and mktime -10-23-2006 2.02.14 DES RELEASE Limited release -10-11-2006 2.02.14 SAH OTHER Added gsThreadMacOSX.c and Mac OSX Asynchronous DNS Threading Support (uses pthreads) -10-11-2006 2.02.13 DES FIX Soap works with Unicode -10-05-2006 2.02.12 SAH FIX Added MacOSXCommon.c, updated gsDebug and Makefile.common to get rid of Mac compiler warnings -09-28-2006 2.02.11 SAH FIX Fixed ps3common.c to work with PS3 095.00x SDK. Must now explicitly load modules prior to initializing - the network since these libraries were made into stub libraries. -09-21-2006 2.02.10 SAH FIX Fixed a memory leak in Linux threads from not detaching a thread before exiting. -09-15-2006 2.02.09 DES FEATURE Added GS_ASSERT_NO_MESSAGEBOX define -09-13-2006 2.02.08 SN FIX Added recommended fix for broadcast IP -09-13-2006 2.02.07 SN FIX Updated Revolution CW Projects - Fixed some impclicit type casts - Miscalaneous Fixes for Revolution -09-05-2006 2.02.06 SN FIX Updated Revolution support - Added a revolutionCommon.c file for testing sample applications -08-24-2006 2.02.05 SAH FIX Removed GSI_NO_THREADS define around func prototypes -08-23-2006 2.02.04 SAH FIX Added #ifdef around the gsi time functions to get rid of warnings on unsupported plats -08-17-2006 2.02.03 SAH FIX Cleaned up the gsi threaded/nonthreaded DNS lookup calls in gsPlatformUtil.c - SAH OTHER GSI_NO_ASYNC_DNS can now be defined to turn off threaded lookups -08-04-2006 2.02.02 SN FIX Fixed XML date and time read function to use time_t -08-04-2006 2.02.02 SN FIX Fixed the resolve host name thread function for Nintendo Wii -08-04-2006 2.02.01 SAH OTHER Added gsi time utility functions as wrappers for gmtime, ctime, mktime - SAH FIX Added gsXmlReadChildAsDateTimeElement function to fix SAKE readTimeDate - SAH OTHER Removed function definitions/prototypes for NITRO ctime/gtime, now uses gsi versions -08-03-2006 2.02.00 SN OTHER Completed port for the Nintendo Revolution platform -08-02-2006 2.01.02 SAH RELEASE Releasing to developer site -08-01-2006 2.01.02 SAH FIX Removed PS2-asychronous DNS lookup calls - unsupported in current version - SAH FIX Changed Increment/Decrement functions for Linux - unsupported currently, throws assert -07-24-2006 2.01.01 SAH FIX Removed #ifdef _PS3 for socket calls in gsPlatformSocket.c and gsAvailable.c - SAH FIX Added typecasts to PS3 socket calls in gsPlatformSocket.h - SAH FIX Fixed a variable in gsThreadWin32.c used for gsiExitThread - SAH FIX Added GSI_UNUSED call for unused variable in gsPlatformUtil.c - SAH FIX Added typecast to get rid of NITRO warnings -07-21-2006 2.01.00 SN FEATURE Added initial support for the Nintendo Revolution -07-17-2006 2.00.50 SAH FIX Added gsiExitThread() to explicitly cleanup threads and free resources -07-07-2006 2.00.49 SAH FIX Changed debug statements to make note of asynch vs. synch DNS lookups -06-30-2006 2.00.48 SAH FIX Added _NITRO && _LINUX common debug call. added #ifndef _NITRO for file logging -06-26-2006 2.00.47 SAH FIX Changed timeout value for PS2 Insock socket calls to 3ms. -06-20-2006 2.00.46 SAH FEATURE Added gsLinuxThreads.c (Linux pthreads support) for ghttp asynch DNS - SAH FEATURE Added Linux implementation of gsiResolveHostnameThread -06-09-2006 2.00.45 SAH OTHER threaded asynch DNS code - explicitly set freed vars to NULL -06-02-2006 2.00.44 SAH FIX Added (void *) typecasts to function call in gsMemory.c - SAH FIX Added __cdecl to "main" function in Win32common.c -05-31-2006 2.00.43 SAH RELEASE Releasing to developer site - SAH FIX Added LinuxCommon.c for linux projects -05-30-2006 2.00.42 SAH FIX #include "time.h" for PS3 time support in gsPlatform.h - SAH FIX Added newlines to end of files, couple GSI_UNUSED calls - SAH FIX Added PS3 Threads stub in gsPlatformThreads -05-25-2006 2.00.41 SAH FIX added GSI_UNUSED call to gsAssert to get rid of Nitro warning -05-24-2006 2.00.40 SAH FIX moved GSI_UNUSED call below #endif in win32common.c -05-23-2006 2.00.39 SAH FIX Got rid of month/week arrays in gsXML.c - they are declared in nitroThread -05-22-2006 2.00.38 SAH FIX added GSI_UNUSED call to win32common.c - to get rid of warning -05-19-2006 2.00.37 SAH FIX added #define GS_STATIC_CALLBACK __cdecl if (_WIN32) -05-18-2006 2.00.36 DES RELEASE Limited developer release -05-17-2006 2.00.36 DES FIX Updates to fix DS compiler errors - DES FEATURE Added gmtime and ctime for DS - DES FEATURE Added gsiInterlockedIncrement/Decrement for the DS - DES FIX Changed call to strftime to sprintf -05-17-2006 2.00.35 SAH FIX Got rid of comma in MEMTAG enum causing codewarrior error -05-17-2006 2.00.34 DES FIX gsXmlReadChildAsBase64Binary now correctly handles empty data -05-15-2006 2.00.33 DES FEATURE Added Xml support for reading Base64 binary - DES FEATURE Added B64DecodeLen for getting the unencoded length of a Base64 string -04-28-2006 2.00.32 SAH FIX Got rid of unnecessary #include ../gsoap/stdsoap2.h in gsSoap.c -04-25-2006 2.00.31 SAH RELEASE Releasing to developer site -04-24-2006 2.00.31 SAH FIX Added/fixed some typecasts, manually defined gmtime in gsPlatform.h - DS doesn't support time -04-24-2006 2.00.30 SAH FIX Added prototype definition for _gsi_memalign (codewarrior warning) -04-20-2006 2.00.29 SAH FIX commented out unused variables, changed psp path to /usr/local/devkit -04-20-2006 2.00.28 SAH FIX Added newline to end of gsSHA1.h to get rid of error - SAH FIX Added #include to gsXML.c - SAH FIX Added _PS3 wrapper typecast to socket calls - SAH FIX Changed gsi_64 variables to long long - PS3 now uses 32 bit - SAH FIX added _tstrncpy defines for UNICODE && WIN32 - SAH FIX made a returned local variable static in gsUtilPS3 - SAH FIX Added a (char *) typecast ot gsSocketPS3 -04-18-2006 2.00.27 SAH FIX Added newline to end of gsXML.h to get rid of error -04-13-2006 2.00.26 SAH FIX Added #ifdef UNICODE, #include to platform.h -04-13-2006 2.00.26 SAH FIX Added #ifdef UNICODE headers around functions that call wcslen -04-05-2006 2.00.25 DDW OTHER Replace __asm int 3 with DebugBreak() call in gsAssert for x64 support -03-20-2006 2.00.24 DES FIX Fixed cross-platform string function undefines -03-15-2006 2.00.23 SN FIX Removed old __WINSOCK_2__ in preference to GSI_WINSOCK2 -03-02-2006 2.00.22 DES FEATURE Added encoding of Base64 as a stream - DES FEATURE Added writing Base64Binary and DateTime to XML streams -02-23-2006 2.00.21 DES FEATURE Added reading and writing functionality to the Xml code. -01-27-2006 2.00.20 SN RELEASE Releasing to developer site -01-11-2006 2.00.20 SN FIX Fixed function to return value for insock -01-09-2006 2.00.19 SN FIX Separated code for WIN32 and WIN32 Console in the assert function - Added platform checks around types and function pointers for memory code -10-08-2005 2.00.18 DES FIX Don't assert when freeing NULL, just ignore it. - DES CLEANUP Cleaned up assert code. -12-06-2005 2.00.17 SN FEATURE Temporarily added an Xbox assert function -11-15-2005 2.00.16 DES FIX Updated cross-platform compatibility. -11-14-2005 2.00.15 DES FEATURE Added GSI_DOMAIN_NAME to define "gamespy.com". -11-14-2005 2.00.14 MJ FEATURE Replaced memory management code. - Added stubbed files for cross platform rendering, input, and fileio -11-14-2005 2.00.13 DES CLEANUP Cleanup for Nitro and OSX. -11-11-2005 2.00.12 DES FIX Changes to crypt code for OSX compiler. - DES FIX added GSI_UNUSED for OSX. - BED FIX Fixed length check in gsLargeInt.c -10-12-2005 2.00.11 SN FIX Modified the INSOCK shutdown alias to use internal function -10-12-2005 2.00.10 BED RELEASE Releasing to developer site. -10-12-2005 2.00.09 DES FEATURE Updated to use SOC_ instead of SO_ prefixes for DS. -09-21-2005 2.00.08 DES FEATURE Updated DS support - DES FEATURE Added GS_WIRELESS_DEVICE for PSP and Nitro -08-12-2005 2.00.07 DES FIX Made changes to gsLargeInt.c for DS compatibility. -08-11-2005 2.00.06 BED FEATURE Added gsiCoreTaskThink so tasks could be pumped invidiually. -07-28-2005 2.00.05 SN RELEASE Releasing to developer site -07-28-2005 2.00.05 SN FIX Added an Extern C that was missing -07-27-2005 2.00.05 SN OTHER Removed include file until Xbox threading is implemented. -07-27-2005 2.00.04 SN FIX Fixed backwards IP address problem for Insock -06-23-2005 2.00.03 BED FEATURE Added PSP support. -06-03-2005 2.00.02 SN RELEASE Releasing to developer site. -05-26-2005 2.00.02 BED RELEASE Releasing to developer site. -05-26-2005 2.00.02 BED FIX Added missing extern "C" brace to end of gsMemory.h -05-26-2005 2.00.01 BED RELEASE Releasing to developer site. -05-26-2005 2.00.01 BED FIX Added old header stubs for new common code compatability with old sdks -05-26-2005 2.00.00 BED RELEASE Releasing to developer site. -05-16-2005 2.00.00 BED OTHER Moved common code into /common folder. - BED OTHER Split nonport.c and nonport.h into multiple files. -04-28-2005 1.11.02 SN RELEASE Releasing to developer site. -04-27-2005 1.11.02 DES RELEASE Limited release to Nintendo DS developers. -04-25-2005 1.11.02 DES FIX Nitro updates - DES FEATURE Addition categories and types added to gsiDebug -04-08-2005 1.11.01 SN FIX Fixed SN Systems bug where a socket was shown to be readable even when an error was recorded for it. -04-08-2005 1.11.00 DES FEATURE Changes for XBox support. -04-04-2005 1.10.72 SN RELEASE Releasing to developer site. -04-04-2005 1.10.72 DES CLEANUP Removed unused GS_BIG_ENDIAN define. - DES FEATURE Added gsi_is_false() and gsi_is_true() defines. - DES CLEANUP Removed unused PATHCHAR define. - DES CLEANUP Removed old _NITRO code from SetSockBlocking. -03-31-2005 1.10.71 BED FIX Removed some CodeWarrior strict compile warnings. -03-31-2005 1.10.70 SN FIX Fixed build problem by moving defines that had dependancies -03-14-2005 1.10.69 DES FEATURE Nintendo DS support -02-18-2005 1.10.68 BED FIX Added timeout for gsoap recv so it could recover from a hosed server - BED FIX Explicit __cdecl for hashtable and darray are used on Win32 only - BED FIX Switched gsimemory to track peak memory usage rather than total num allocs. -01-27-2005 1.10.67 DES FIX Added GSI_NO_THREADS for platforms without thread support - DES FIX Fixed custom SN sendto and moved it to nonport -01-04-2005 1.10.66 DDW FIX Added malloc cast in XXTEA encryption code -12-21-2004 1.10.65 SN FIX Added code to register the hostname resolution thread with SN_SYSTEMS -12-07-2004 1.10.64 BED FIX Added explicit __cdecl in darray.c and gsidebug.c -11-18-2004 1.10.63 SN RELEASE Releasing to developer site. -11-18-2004 1.10.63 SN FIX Fixed conversion warnings for XXTEA algorithm -11-17-2004 1.10.62 SN FIX Modified the XXTEA headers and renamed global key size -11-16-2004 1.10.62 BED FEATURE Added Thread/Semaphore common functions - BED FEATURE Added AD sdk to common debugger code. - BED FEATURE Common debug functions and memory manager are now thread safe - BED FEATURE Added core task processor (see core.h) - BED FEATURE Added common gsoap task (see soap.h) -11-16-2004 1.10.61 SN FEATURE Added URL-safe Base64 encoding and XXTEA encrypt and decrypt -09-21-2004 1.10.60 SN FIX Added the directories for MacOS X and Win32 common to goacommon.bat -09-16-2004 1.10.59 SN RELEASE Releasing to developer site. -09-16-2004 1.10.59 SN FIX Modified header define of NOFILE to avoid conflict with MacOS X -09-03-2004 1.10.58 BED CLEANUP Removed misc compiler warnings. -08-27-2004 1.10.57 BED FEATURE Added memory diagnostic functions to memory manager. -08-27-2004 1.10.56 DES CLEANUP Changed UNDER_UNIX to _UNIX, and define it if _LINUX or _MACOSX are defined. - DES OTHER Generate an error if _WIN32, _PS2, or _UNIX are not defined. - DES CLEANUP General Unicode cleanup - DES CLEANUP Fixed minor warnings under OSX - BED FIX Fixed typo in SN Systems version of GOAGetLastError. -08-25-2004 1.10.55 BED FEATURE Added common debug utilities to nonport. (See gsiDebug.h) - BED FEATURE Added memory pool manager to nonport. (See top of nonport.h) -08-24-2004 1.10.54 DES CLEANUP Removed references to MacOS. -08-20-2004 1.10.53 SN FIX Changed the way errors are obtained from the SN Systems network stack. -08-05-2004 1.10.52 SN RELEASE Releasing to developer site. -08-04-2004 1.10.51 SN FIX Fixed a function prototype causing compiler warnings for codewarrior -08-02-2004 1.10.50 SN FEATURE Added support for developers to use winsock 2 -07-13-2004 1.10.49 DES FEATURE Added GSIStartResolvingHostname() for doing async hostname lookups. -07-12-2004 1.10.48 SN FIX Cleared warnings when warnings are treated as errors for gamspy common code. -07-09-2004 1.10.47 SN FIX Updated portions of code to eliminate warnings for PS2 -07-08-2004 1.10.46 SN FIX Commented an include line -07-01-2004 1.10.46 SN FIX Includeded for ps2 -06-29-2004 1.10.45 BED RELEASE Releasing to developer site. -06-28-2004 1.10.45 DES FEATURE Added gsimemalign to the list of memory functions. -06-24-2004 1.10.44 BED FEATURE Util_Rand functions no longer static. - BED FEATURE Added B64 encode and decode from matrix source. -06-22-2004 1.10.43 BED RELEASE Releasing with updated PS2Common code -06-18-2004 1.10.42 BED RELEASE Releasing to developer site. -06-01-2004 1.10.42 BED FEATURE Phase 1 of PS2 Insock integration. (needs further testing) - BED FIX Found case where unsigned long was used on Ps2 instead of gsi_time. -04-27-2004 1.10.41 DES FEATURE Added current_time_hires(), returns time in microseconds. -03-10-2004 1.10.40 BED FEATURE Added some more types to nonport.h - FIX Undefine socket types to workaround SNSys bug. (They plan to patch in march 04) -12-03-2003 1.10.39 BED FEATURE Added "GameSpy Help.chm" to goapackage.bat -11-10-2003 1.10.38 DES RELEASE Releasing to developer site. -11-10-2003 1.10.38 BED FIX Remove misc compiler warnings. -11-07-2003 1.10.37 DES FIX Added linux support for the common integers datatypes. - FIX Added a newline to the bottom of available.h. - FEATURE The available check now uses .available.gamespy.com. -10-29-2003 1.10.36 DES FEATURE Added available.h,.c for doing backend services availability checks. -10-09-2003 1.10.35 BED FEATURE Added gsi_time type for PS2 compatibility -10-08-2003 1.10.34 JED FEATURE Added common integer datatypes -08-25-2003 1.10.33 JED CLEANUP Added some sanity checks in hashtable.c -07-24-2003 1.10.32 DES RELEASE Releasing to developer site. -07-23-2003 1.10.32 DES FIX Moved EENet includes in nonport.h to fix CW PS2 warnings. - DES FEATURE Added memory tracking. Use GSI_MEM_TRACK to enable. -07-22-2203 1.10.31 BED CLEANUP General cleanup to remove CodeWarrior compiler warnings. -07-16-2003 1.10.30 DES CLEANUP Removed support for Cisco NFT for the PS2. - FIX Changed some __mips64 checks to _PS2 checks in nonport.c - BED FIX Changed nonport.c to not use #pragma comment when _PS2 if defined -07-10-2003 1.10.29 BED CLEANUP Added GSI_UNUSED to nonport.h to silence unused variable warnings. -05-09-2003 1.10.28 DES CLEANUP Removed Dreamcast support. - CLEANUP Changed nonport.h to use EENet if no network stack is defined for the PS2. - FIX Metrowerks for Win32 is no longer falsely identified as MacOS. -05-07-2003 1.10.27 DES RELEASE Releasing to developer site. - FIX Rewrote EENet GetMAC to be 2.7.x compatibile. -04-28-2003 1.10.26 DES RELEASE Releasing to developer site. - FIX Changed malloc/free in new EENet getlocalhost to gsimalloc/gsifree. -04-28-2003 1.10.25 DES RELEASE Releasing to developer site. -04-17-2003 1.10.25 DES FIX Rewrote EENet getlocalhost again, to be compatible with the 2.7.0.1 release. -04-15-2003 1.10.24 DES FIX Rewrote the EENet implementation of getlocalhost to build its own HOSTENT. -04-15-2003 1.10.23 JED CLEANUP Corrected DevStudio Level4 warnings for use of FD_SET -04-08-2003 1.10.22 JED FIX converted md5 function parameter type declarations from K&R C to ANSI C -03-27-2003 1.10.21 DES FIX IsPrivateIP no longer flips the source IP's byte order. -03-26-2003 1.10.20 DES RELEASE Releasing to developer site. -03-25-2003 1.10.20 DES FIX The EENet version of getlocalhost() wasn't checking all possible local IPs. -03-24-2003 1.10.19 DES FEATURE Added IsPrivateIP() for checking if an IP is a private network IP. - DES FIX GetTicks() no longer causes a compiler warning. -03-10-2003 1.10.18 DES RELEASE Releasing to developer site. -02-25-2003 1.10.18 DES CLEANUP Added headers to nonport.h for 2.6.1 EENet compatibility. - EENET_260 can be defined for 2.6.0 compatibility. -02-05-2003 1.10.17 DES RELEASE Releasing to developer site. -02-05-2003 1.10.17 DES FEATURE Added CanReceiveOnSocket and CanSendOnSocket as wrappers for select. - Needed because the SN stack for the PS2 has non-standard behavior. -01-23-2003 1.10.16 DES FEATURE Added the ability to just get the gsi*() memory function defines - by defining GSI_MEM_ONLY before including nonport.h. -01-07-2003 1.10.15 DES RELEASE Releasing to developer site. -01-07-2003 1.10.15 DES CLEANUP Removed a comment and a printf that were no longer needed. -01-02-2003 1.10.14 DES CLEANUP Removed the typedef for PSOCKADDR - It doesn't appear to be used anywhere, and was causing compile problems. -12-20-2002 1.10.13 DES FEATURE Implemented new code from SN Systems to get the MAC for the unique ID. -12-19-2002 1.10.12 DES RELEASE Releasing to developer site. -12-19-2002 1.10.12 DES CLEANUP Removed assert.h include from darray.h and hashtable.h. -12-18-2002 1.10.11 DES CLEANUP Put in a stub function fr getting the unique ID when using the SN stack. -12-16-2002 1.10.10 DES FEATURE Defined NOFILE when _PS2 is defined to exclude all file writing code. - FEATURE Defined SOMAXCONN to 5 when not defined. This is used as the backlog - parameter in calls to listen(). 5 is the max for SN Systems. - FEATURE gethostbyaddr() is not supported by SN Systems, defined it to NULL. - CLEANUP Changed GOAGetLastError() to clear the error for SN Systems. - Also removed GOAClearSocketError(), which was only needed for SN Systems. -12-13-2002 1.10.09 DES FEATURE Added EENet specific code for getting the MAC address for the Unique ID. -12-11-2002 1.10.08 DES FEATURE Additional eenet support. - FEATURE Added getlocalhost() for getting the local machine's hostent struct. - FEATURE Added SetSendBufferSize(), GetSendBufferSize(), and GetReceiveBufferSize(). -12-05-2002 1.10.07 DES CLEANUP General cleanup - FEATURE Initial PS2 eenet stack support -11-22-2002 1.10.06 DES RELEASE Releasing to developer site. -11-22-2002 1.10.06 DES FIX Fixed bug with checking the current time on the PS2. -11-20-2002 1.10.05 DES FEATURE Switched to using the MAC address for the Unique ID on the PS2. - CLEANUP Cleaned up to compile without warnings on the PS2. -11-18-2002 1.10.04 JED FIX nonport.c now using ansi registry funcs for WIN32/unicode -11-14-2002 1.10.03 DES FEATURE Added assert.h include to nonport.h. -11-13-2002 1.10.02 DDW FEATURE Changed GOAGetUniqueID to use redefinable function pointer. - Made Cisco the default stack for PS2. -11-13-2002 1.10.01 DES FIX Removed Reference to unsupported non-blocking CISCO stack -09-25-2002 1.10.00 DDW OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAssert.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAssert.c deleted file mode 100644 index c4c56861c63..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAssert.c +++ /dev/null @@ -1,182 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCommon.h" -#include "gsDebug.h" - - - -// This is the platform specific default assert condition handler -extern void _gsDebugAssert (const char * string); - -static gsDebugAssertCallback gsDebugAssertHandler = _gsDebugAssert; - -// Call this function to override the default assert handler -// New function should render message / log message based on string passed -void gsDebugAssertCallbackSet(gsDebugAssertCallback theCallback) -{ - if (theCallback) - gsDebugAssertHandler = theCallback; - else - gsDebugAssertHandler = _gsDebugAssert; -} - - -// This is the default assert condition handler -void gsDebugAssert (const char *szError,const char *szText, const char *szFile, int line) -{ - char String[256]; - // format into buffer - sprintf(&String[0], szError,szText,szFile,line); - - // call plat specific handler - (*gsDebugAssertHandler)(String); - -} - - -// **************************************************** -// Todo: move to platform specific modules -#ifdef _XBOX - // ErrorMessage: Displays message and goes into an infinite loop - // continues rendering - void _gsDebugAssert (const char *string) - { - //DebugBreak(); - OutputDebugString( string); - exit(0); - } - -#elif defined _WIN32 - #include - #pragma warning(disable: 4127) // disable warnings from "conditional expression is constant" - - // ErrorMessage: Displays message and goes into an infinite loop - // continues rendering - void _gsDebugAssert (const char *string) - { - - //DebugBreak(); - - - #ifdef _CONSOLE //,_MBCS - - printf("%s",string); - while(1) - { - }; - - #else - { - OutputDebugStringA( string); - - #ifndef GS_ASSERT_NO_MESSAGEBOX - { - int rcode = MessageBoxA(NULL,string,"Assert Failed",MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); - - if(rcode == IDABORT) - { - exit(0); - } - if(rcode == IDRETRY) - { - DebugBreak(); - return; - } - } - #else - DebugBreak(); - #endif - } - #endif - } - -#elif defined _PSP - // ToDo: - // ErrorMessage: Displays message and goes into an infinite loop - // continues rendering - void _gsDebugAssert (const char *string) - { - printf(string); - - while(1) - { - }; - - } - - -#elif defined _PS2 - - // already included in gsPlatform.h - /* - #include - #include - */ - - // ErrorMessage: Displays message and goes into an infinite loop - // continues rendering - void _gsDebugAssert (const char *string) - { - - scePrintf(string); - while(1);; - } - - - -#elif defined _MACOSX - void _gsDebugAssert (const char *string) - { - printf(string); - - while(1) - { - }; - - } - - -#elif defined _LINUX - void _gsDebugAssert (const char *string) - { - printf(string); - - while(1) - { - }; - - } - - -#elif defined _NITRO - void _gsDebugAssert (const char *string) - { -#if SDK_FINALROM != 1 - OS_TPanic("%s",string); -#else - GSI_UNUSED(string); -#endif - } - -#elif defined(_REVOLUTION) - void _gsDebugAssert(const char *string) - { - OSHalt(string); - - } -#else - // ErrorMessage: Displays message and goes into an infinite loop - // continues rendering - void _gsDebugAssert (const char *string) - { - - printf(string); - while(1);; - - } - -#endif - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAssert.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAssert.h deleted file mode 100644 index ee5f5b0eedf..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAssert.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef __GSIASSERT_H__ -#define __GSIASSERT_H__ - -#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) -extern "C" { -#endif -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Assert for GameSpy SDKs -// -// Usage: -// 1) #define _DEBUG to enable assert. This should be set by compiler configuration. -// -// Todo: -// Allow user to specify IP to send debug output to (remote log for PS2) - - -// GS_ASSERT Use this to trap any programming bugs, such as range checks, invalid parameters -// use at start of each function to check all parameters -// also check all assumptions, ex// assume module is init. -// - -// GS_FAIL() Use instead of GS_ASSERT(0) when reaching an illegal area of code -// ex// the default: in a case statement that should be completely handled. - - -/* - ***The reason for using a GameSpy assert or custom assert*** - - although assert is handled very gracefully on the windows platform, most consoles do very little of real use during assert. - Furthermore, the program counter is lost, along with the callstack sometimes. - By having a custom critical error function, an asm "break" can be set in it, or a debugger break point. a call stack is - immediately available. The error can be drawn onto the screen. And the choice to ignore can also be given, in order - to continue stepping through code and further debug. - -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -extern void gsDebugAssert (const char *format,const char *szError,const char *szFile, int line); -#ifndef _DEBUG - // On non-debug builds, release builds, ignore all of this. - // be carefull never to have function calls within one of these macros, as they will - // be ignored. - // ex// BAD: GS_ASSERT( i== FN()) // FN() will never be called, i will never be set in release builds - - #define GS_ASSERT(x) {}; // ex// GS_ASSERT( result == GS_OK ) - #define GS_ASSERT_STR(x, t) {}; // ex// GS_ASSERT_STR( result == GS_OK ,"GSFunction failed") - #define GS_ASSERT_ALIGN_16(x) {}; - #define GS_FAIL() - #define GS_FAIL_STR(x) - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#else - - #define GS_ASSERT(x) { if(!(x)) { gsDebugAssert("ASSERT on '" #x "' [%s] in %s line:%d\n", "", __FILE__,__LINE__); } }; - #define GS_ASSERT_STR(x,t) { if(!(x)) { gsDebugAssert("ASSERT on '" #x "' [%s] in %s line:%d\n", t, __FILE__,__LINE__); } }; - #define GS_ASSERT_ALIGN_16(x) { if(((U32)(x))%16) { gsDebugAssert("ASSERT on '" #x "' [%s] in %s line:%d\n","16 byte misalign", __FILE__,__LINE__); } }; - #define GS_FAIL() { gsDebugAssert("FAIL [%s] ln %s line:%d\n", "", __FILE__,__LINE__); }; - #define GS_FAIL_STR(t) { gsDebugAssert("FAIL [%s] ln %s line:%d\n", t, __FILE__,__LINE__); }; - - - -#endif // GSI_COMMON_DEBUG - - -// This is the default assert condition handler -typedef void (*gsDebugAssertCallback) (const char *string); - -// Call this function to override the default assert handler -// New function should render message / log message based on string passed -// calling this with NULL is restores the default setting. -void gsDebugAssertCallbackSet(gsDebugAssertCallback theCallback); - - -// This is like an assert, but test at compile, not run time. -// ex use STATIC_CHECK(DIM(array) == enumArrayCount) -#define GS_STATIC_CHECK(expr, msg) { CompileTimeError<((expr) != 0)> ERROR_##msg; (void)ERROR_##msg; } - - -#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) -} -#endif - -#endif // __GSIDEBUG_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAvailable.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAvailable.c deleted file mode 100644 index 00d5a526de8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAvailable.c +++ /dev/null @@ -1,215 +0,0 @@ -#include "gsCommon.h" -#include "gsAvailable.h" - -#define PACKET_TYPE 0x09 -#define MASTER_PORT 27900 -#define MAX_RETRIES 1 -#define TIMEOUT_TIME 2000 - -// this is the global var that the SDKs check -// to see if they should communicate with the backend -GSIACResult __GSIACResult = GSIACWaiting; - -// this makes the gamename available to all of the SDKs -char __GSIACGamename[64] = {0}; - -// this allows devs to do their own hostname resolution -char GSIACHostname[64] = {0}; - -// used to keep state during the check -static struct -{ - SOCKET sock; - SOCKADDR_IN address; - char packet[64]; - int packetLen; - gsi_time sendTime; - int retryCount; -} AC; - -static int get_sockaddrin(const char * hostname, int port, SOCKADDR_IN * saddr) -{ - GS_ASSERT(hostname) - GS_ASSERT(saddr) - - saddr->sin_family = AF_INET; - saddr->sin_port = htons((unsigned short)port); - saddr->sin_addr.s_addr = inet_addr(hostname); - - if(saddr->sin_addr.s_addr == INADDR_NONE) - { - HOSTENT * host = gethostbyname(hostname); - if(!host) - return 0; - saddr->sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; - } - - return 1; -} - -static void SendPacket(void) -{ - sendto(AC.sock, AC.packet, AC.packetLen, 0, (SOCKADDR *)&AC.address, sizeof(AC.address)); - AC.sendTime = current_time(); -} - -void GSIStartAvailableCheckA(const char * gamename) -{ - char hostname[64]; - int override; - int rcode; - int len; - - GS_ASSERT(gamename) - - // store the gamename - strcpy(__GSIACGamename, gamename); - - // clear the sock - AC.sock = INVALID_SOCKET; - - // startup sockets - SocketStartUp(); - - // setup the hostname - override = GSIACHostname[0]; - if(!override) - sprintf(hostname, "%s.available." GSI_DOMAIN_NAME, gamename); - - // get the master address - rcode = get_sockaddrin(override?GSIACHostname:hostname, MASTER_PORT, &AC.address); - if(!rcode) - return; - - // create the socket - AC.sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(AC.sock == INVALID_SOCKET) - return; - - // setup our packet - AC.packet[0] = PACKET_TYPE; - len = (int)strlen(gamename); - memcpy(AC.packet + 5, gamename, (size_t)len + 1); - AC.packetLen = (len + 6); - - // send it - SendPacket(); - - // no retries yet - AC.retryCount = 0; -} -#ifdef GSI_UNICODE -void GSIStartAvailableCheckW(const unsigned short * gamename) -{ - char gamename_A[32]; - GS_ASSERT(gamename) - - UCS2ToAsciiString(gamename, gamename_A); - - GSIStartAvailableCheckA(gamename_A); -} -#endif - -static int HandlePacket(char * packet, int len, SOCKADDR_IN * address, int * disabledservices) -{ - int bitfield; - - // check the length - if(len < 7) - return 1; - - // check the IP - if(memcmp(&address->sin_addr, &AC.address.sin_addr, sizeof(IN_ADDR)) != 0) - return 1; - - // check the port - if(address->sin_port != AC.address.sin_port) - return 1; - - // check the header - if(memcmp(packet, "\xFE\xFD\x09", 3) != 0) - return 1; - - // read out the bitfield - // read byte-by-byte to avoid alignment issues - bitfield = (int)((packet[3] << 24) & 0xFF000000); - bitfield |= ((packet[4] << 16) & 0x00FF0000); - bitfield |= ((packet[5] << 8) & 0x0000FF00); - bitfield |= (packet[6] & 0x000000FF); - - // set it - *disabledservices = bitfield; - - return 0; -} - -GSIACResult GSIAvailableCheckThink(void) -{ - char packet[64]; - SOCKADDR_IN address; - int len = sizeof(address); - int rcode; - int disabledservices; - - // if we don't have a sock, possibly because of an initialization error, default to available - if(AC.sock == INVALID_SOCKET) - { - __GSIACResult = GSIACAvailable; - return __GSIACResult; - } - - // did we get a response? - if(CanReceiveOnSocket(AC.sock)) - { - // read it from the socket - rcode = (int)recvfrom(AC.sock, packet, (int)sizeof(packet), 0, (SOCKADDR *)&address, &len); - - // verify the packet - rcode = HandlePacket(packet, rcode, &address, &disabledservices); - if(rcode == 0) - { - // we got a valid response, clean up - closesocket(AC.sock); - - // set the result based on the bit flags - if(disabledservices & 1) - __GSIACResult = GSIACUnavailable; - else if(disabledservices & 2) - __GSIACResult = GSIACTemporarilyUnavailable; - else - __GSIACResult = GSIACAvailable; - - // return it - return __GSIACResult; - } - } - - // check for a timeout - if(current_time() > (AC.sendTime + TIMEOUT_TIME)) - { - // check for too many retries - if(AC.retryCount == MAX_RETRIES) - { - // default to available - closesocket(AC.sock); - __GSIACResult = GSIACAvailable; - return __GSIACResult; - } - - // send a retry - SendPacket(); - AC.retryCount++; - } - - return GSIACWaiting; -} - -void GSICancelAvailableCheck(void) -{ - if(AC.sock != INVALID_SOCKET) - { - closesocket(AC.sock); - AC.sock = INVALID_SOCKET; - __GSIACResult = GSIACWaiting; - } -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAvailable.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAvailable.h deleted file mode 100644 index 73bddfb9329..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsAvailable.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _AVAILABLE_H_ -#define _AVAILABLE_H_ - -#include "gsStringUtil.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef GSI_UNICODE -#define GSIStartAvailableCheck GSIStartAvailableCheckA -#else -#define GSIStartAvailableCheck GSIStartAvailableCheckW -#endif - -// the available check contacts a backend server at ".available.gamespy.com" -// an app can resolve the hostname itself and store the IP here before starting the check -extern char GSIACHostname[64]; - -// these are possible return types for GSIAvailableCheckThink -typedef enum -{ - GSIACWaiting, // still waiting for a response from the backend - GSIACAvailable, // the game's backend services are available - GSIACUnavailable, // the game's backend services are unavailable - GSIACTemporarilyUnavailable // the game's backend services are temporarily unavailable -} GSIACResult; - -// start an available check for a particular game -// return 0 if no error starting up, non-zero if there's an error -void GSIStartAvailableCheck(const gsi_char * gamename); - -// let the available check think -// continue to call this while it returns GSIACWaiting -// if it returns GSIACAvailable, use the GameSpy SDKs as normal -// if it returns GSIACUnavailable or GSIACTemporarilyUnavailable, do NOT -// continue to use the GameSpy SDKs. the backend services are not available -// for the game. in this case, you can show the user a -// message based on the particular result. -GSIACResult GSIAvailableCheckThink(void); - -// this should only be used if the availability check needs to be aborted -// for example, if the player leaves the game's multiplayer area before the check completes -void GSICancelAvailableCheck(void); - -// internal use only -extern GSIACResult __GSIACResult; -extern char __GSIACGamename[64]; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCommon.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCommon.h deleted file mode 100644 index 40e840b2cfe..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCommon.h +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSCOMMON_H__ -#define __GSCOMMON_H__ - -// Common is more like "all" - -// Build settings (set by developer project) -//#define GS_MEM_MANAGED // use GameSpy memory manager for SDK allocations -//#define GS_COMMON_DEBUG // use GameSpy debug utilities for SDK debug output -//#define GS_WINSOCK2 // use winsock2 -//#define GS_UNICODE // Use widechar (UCS2) SDK interface. -//#define GS_NO_FILE // disable file storage (on by default for PS2/DS) -//#define GS_NO_THREAD // no multi-thread support -//#define GS_PEER // MUST be defined if you are using Peer SDK - - -#ifdef GS_PEER - #define UNIQUEID // enable unique id support -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsPlatform.h" -#include "gsPlatformSocket.h" -#include "gsPlatformThread.h" -#include "gsPlatformUtil.h" - -// platform independent -#include "gsMemory.h" -#include "gsDebug.h" -#include "gsAssert.h" -#include "gsStringUtil.h" - -//#include "md5.h" -//#include "darray.h" -//#include "hashtable.h" - - -#define GSI_MIN(a,b) (((a) < (b)?(a):(b))) -#define GSI_MAX(a,b) (((a) > (b)?(a):(b))) -#define GSI_LIMIT(x, minx, maxx) (((x) < (minx)? (minx) : ((x) > (maxx)? (maxx) : (x)))) -#define GSI_WRAP(x, minx, maxx) (((x) < (minx)? (maxx-1 ) : ((x) >= (maxx)? (minx) : (x)))) -#define GSI_DIM( x ) ( sizeof( x ) / sizeof((x)[ 0 ])) - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __GSCOMMON_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCore.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCore.c deleted file mode 100644 index d23f8f19605..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCore.c +++ /dev/null @@ -1,446 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Core task/callback manager -#include "gsPlatform.h" -#include "gsPlatformThread.h" - -#include "gsCommon.h" -#include "gsCore.h" -#include "gsAssert.h" -#include "../ghttp/ghttp.h" - - - - -// This defines how long the core will wait if there is a thread synchronization -// problem when initializing or shutting down the core. -#define GSI_CORE_INIT_YIELD_MS 100 -#define GSI_CORE_SHUTDOWN_YIELD_MS 50 - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static GSCoreMgr* gsiGetStaticCore() -{ - static GSCoreMgr gStaticCore; - return &gStaticCore; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// This is registered with the ANSI atexit() function -// - don't do anything that might fail -// - don't do anything that won't complete instantly -// - don't do anything that requires other objects/resources to exist -static void gsiCoreAtExitShutdown(void) -{ - // delete queue critical section - GSCoreMgr * aCore = gsiGetStaticCore(); - gsiDeleteCriticalSection(&aCore->mQueueCrit); - GSI_UNUSED(aCore); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Increment core ref count, initialize the core if necessary -// - WARNING: This code is a bit tricky do to multithread issues -void gsCoreInitialize() -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - - // Is someone else shutting down the core? - while(gsi_is_true(aCore->mIsShuttingDown)) - msleep(GSI_CORE_INIT_YIELD_MS); // yield to other thread - - // If we're the first reference, initialize the core - if (gsiInterlockedIncrement(&aCore->mRefCount) == 1) - { - // Are we the first ever? - if (gsi_is_false(aCore->mIsStaticInitComplete)) - { - // perform one-time initialization of core critical section - gsiInitializeCriticalSection(&aCore->mQueueCrit); - - // register function to destroy critical section at program termination - #ifndef _MANAGED - atexit(gsiCoreAtExitShutdown); - #endif - - // one time init completed - aCore->mIsStaticInitComplete = gsi_true; - } - - // take the critical section to begin initialization - // this is necessary in case another thread began shutdown before we incremented ref count - gsiEnterCriticalSection(&aCore->mQueueCrit); - gsiLeaveCriticalSection(&aCore->mQueueCrit); - - // wait here if another thread is concurrently shutting down the core - // we may need to wait a few times if the shutdown does not complete immediately - while(gsi_is_true(aCore->mIsShuttingDown)) - msleep(GSI_CORE_INIT_YIELD_MS); - - // Setup the task array - #ifdef GSICORE_DYNAMIC_TASK_LIST - aCore->mTaskArray = ArrayNew(sizeof(GSTask*), 10, NULL); - GS_ASSERT(aCore->mTaskArray); - #else - memset(aCore->mTaskArray, 0, sizeof(aCore->mTaskArray)); - #endif - - // Init http sdk (ghttp is ref counted) - ghttpStartup(); - - // release other threads that may have blocked during init - // - this must be the last thing done at end of init - aCore->mIsInitialized = gsi_true; - } - else - { - // Core is already initialized -OR- another thread will initialize the core - - // make sure critical section has been initialized - while(gsi_is_false(aCore->mIsStaticInitComplete)) - msleep(GSI_CORE_INIT_YIELD_MS); - - // take the critical section - // this is necessary in case another thread began shutdown before we incremented ref count - gsiEnterCriticalSection(&aCore->mQueueCrit); - gsiLeaveCriticalSection(&aCore->mQueueCrit); - - // wait for other thread to initial core - while(gsi_is_false(aCore->mIsInitialized)) - msleep(GSI_CORE_INIT_YIELD_MS); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void gsiCoreTaskDispatchCallback(GSTask *theTask, GSTaskResult theResult) -{ - if (theTask->mIsCallbackPending) - { - theTask->mIsCallbackPending = 0; - if (theTask->mCallbackFunc) - (theTask->mCallbackFunc)(theTask->mTaskData, theResult); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Return values: -// GSTaskResult_InProgress - Keep calling gsCoreTaskThink -// GSTaskResult_Finished - Task memory freed; task object is now invalid -GSTaskResult gsCoreTaskThink(GSTask* theTask) -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - GSTaskResult aResult = GSTaskResult_None; - - if (theTask == NULL) - return GSTaskResult_Finished; - - // If the task is running let it think (it may be cancelled and still running) - if (theTask->mIsRunning && theTask->mThinkFunc) - aResult = (theTask->mThinkFunc)(theTask->mTaskData); - - // Check for time out - if ((!theTask->mIsCanceled) && (aResult == GSTaskResult_InProgress)) - { - if ((theTask->mTimeout != 0) && (current_time() - theTask->mStartTime > theTask->mTimeout)) - { - // Cancel the task... - gsiCoreCancelTask(theTask); - - // ...but trigger callback immediately with "Timed Out" - gsiCoreTaskDispatchCallback(theTask, GSTaskResult_TimedOut); - } - //else - // continue processing it - } - else if (aResult != GSTaskResult_InProgress) - { - // Note: This section may be triggered multiple times if the cleanup - // function fails. (possibly due to lack of memory) - int i=0; - gsi_bool removeTask = gsi_true; - - // Call the callback if we haven't already - if (theTask->mIsRunning) - { - gsiCoreTaskDispatchCallback(theTask, aResult); - theTask->mIsRunning = 0; - } - - // Call Cleanup hook and remove task - if (theTask->mCleanupFunc) - removeTask = (theTask->mCleanupFunc)(theTask->mTaskData); - - // Remove the task - if (gsi_is_true(removeTask)) - { - gsiEnterCriticalSection(&aCore->mQueueCrit); - #ifdef GSICORE_DYNAMIC_TASK_LIST - { - int len = ArrayLength(aCore->mTaskArray); - for (i=0; i < len; i++) - { - if(*(GSTask**)ArrayNth(aCore->mTaskArray, i) == theTask) - { - ArrayRemoveAt(aCore->mTaskArray, i); - gsifree(theTask); - break; - } - } - } - #else - for (i=0; i < GSICORE_MAXTASKS; i++) - { - if (aCore->mTaskArray[i] == theTask) - { - aCore->mTaskArray[i] = NULL; - gsifree(theTask); - break; - } - } - #endif - gsiLeaveCriticalSection(&aCore->mQueueCrit); - return GSTaskResult_Finished; - } - } - - // Note: This function should always return InProgress until - // the task has been removed from the TaskArray. - // The developer may have already received a completed callback - // while this continue to return InProgress meaning "still needs to be pumped" - return GSTaskResult_InProgress; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Optional maximum processing time -// - Pass in 0 to process each task once -void gsCoreThink(gsi_time theMS) -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - int i=0; - gsi_time aStartTime = 0; - gsi_i32 allTasksAreDead = 1; - - if (gsi_is_false(aCore->mIsInitialized)) - return; - - // enter queue critical section - gsiEnterCriticalSection(&aCore->mQueueCrit); - - // start timing - aStartTime = current_time(); - - // process all tasks in the queue, dispatch callbacks - // cancelled tasks continue processing until the cancel is acknowledge by the task - #ifdef GSICORE_DYNAMIC_TASK_LIST - { - int len = ArrayLength(aCore->mTaskArray); - if(len > 0) - allTasksAreDead = 0; - for(i=(len-1); i>=0; i--) - { - GSTask* task = *(GSTask**)ArrayNth(aCore->mTaskArray, i); - if(gsi_is_true(task->mAutoThink)) - gsCoreTaskThink(task); - if (theMS != 0 && (current_time()-aStartTime > theMS)) - break; - } - } - #else - for (i=0; imTaskArray[i] != NULL) - { - allTasksAreDead = 0; - - if (aCore->mTaskArray[i]->mAutoThink == gsi_true) - gsCoreTaskThink(aCore->mTaskArray[i]); - } - // Enough time to process another? (if not, break) - if (theMS != 0 && (current_time()-aStartTime > theMS)) - break; - } - #endif - - // shutting down? - if (aCore->mIsShuttingDown && allTasksAreDead) - { - ghttpCleanup(); - -#ifdef GSICORE_DYNAMIC_TASK_LIST - if(aCore->mTaskArray) - { - ArrayFree(aCore->mTaskArray); - aCore->mTaskArray = NULL; - } -#endif - - aCore->mIsShuttingDown = 0; - } - - // leave queue critical section - gsiLeaveCriticalSection(&aCore->mQueueCrit); - - GSI_UNUSED(theMS); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsCoreShutdown() -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - int i=0; - - // If not initialized, just bail - if (gsi_is_false(aCore->mIsInitialized)) - return; - - // Take the critical section to prevent anyone from re-initializing while - // we decide if we need to shutdown - gsiEnterCriticalSection(&aCore->mQueueCrit); - - // If there are other references, just return - if (gsiInterlockedDecrement(&aCore->mRefCount)>0) - { - gsiLeaveCriticalSection(&aCore->mQueueCrit); - return; - } - else - { - // we released the final reference, begin shutdown - // no other thread will begin using the core until - // mIsShuttingDown has been set back to false - aCore->mIsShuttingDown = gsi_true; - - // Cancel all tasks - #ifdef GSICORE_DYNAMIC_TASK_LIST - { - int len = ArrayLength(aCore->mTaskArray); - for(i=0; imTaskArray, i)); - } - } - #else - for (i=0; imTaskArray[i] != NULL) - { - gsiCoreCancelTask(aCore->mTaskArray[i]); - } - } - #endif - gsiLeaveCriticalSection(&aCore->mQueueCrit); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -GSCoreValue gsCoreIsShutdown() -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - - if (gsi_is_true(aCore->mIsShuttingDown)) - return GSCore_SHUTDOWN_PENDING; - if (aCore->mRefCount == 0) - return GSCore_SHUTDOWN_COMPLETE; - - // The core isn't shutting down, and ref count > 0, - // therefore the core is in use - return GSCore_IN_USE; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Adds a GSCoreTask to the execution array -// - Tasks may come from multiple threads -void gsiCoreExecuteTask(GSTask* theTask, gsi_time theTimeoutMs) -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - - // Bail, if the task has already started - GS_ASSERT(!theTask->mIsRunning); - - // Mark it as started and running - theTask->mIsCallbackPending = 1; - theTask->mIsStarted = 1; - theTask->mIsRunning = 1; - theTask->mTimeout = theTimeoutMs; - theTask->mStartTime = current_time(); - - // Execute the task - if (theTask->mExecuteFunc) - (theTask->mExecuteFunc)(theTask->mTaskData); - - gsiEnterCriticalSection(&aCore->mQueueCrit); - // add it to the process list - #ifdef GSICORE_DYNAMIC_TASK_LIST - ArrayAppend(aCore->mTaskArray, &theTask); - #else - { - int anInsertPos = -1; - int i=0; - for (i=0; imTaskArray[i] == NULL) - { - anInsertPos = i; - break; - } - } - GS_ASSERT(anInsertPos != -1); // make sure it got in - aCore->mTaskArray[anInsertPos] = theTask; - } - #endif - gsiLeaveCriticalSection(&aCore->mQueueCrit); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// cancelling a task is an *async request* -// A task that doesn't support cancelling, such as a blocking socket operation, -// may complete normally even though it was cancelled. -void gsiCoreCancelTask(GSTask* theTask) -{ - GSCoreMgr* aCore = gsiGetStaticCore(); - - // Enter critical secction here so the developer - // may cancel a task from any thread. (e.g. The task thread has blocked) - gsiEnterCriticalSection(&aCore->mQueueCrit); - if (theTask->mIsRunning && !theTask->mIsCanceled) - { - theTask->mIsCanceled = 1; - if (theTask->mCancelFunc) - (theTask->mCancelFunc)(theTask->mTaskData); - } - gsiLeaveCriticalSection(&aCore->mQueueCrit); - GSI_UNUSED(aCore); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -GSTask* gsiCoreCreateTask() -{ - GSTask* aTask = (GSTask*)gsimalloc(sizeof(GSTask)); - if (aTask == NULL) - return NULL; - - memset(aTask, 0, sizeof(GSTask)); - aTask->mAutoThink = gsi_true; - return aTask; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCore.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCore.h deleted file mode 100644 index 5d092b4e1d0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCore.h +++ /dev/null @@ -1,128 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __CORE_H__ -#define __CORE_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Core task/callback manager -#include "gsCommon.h" -#include "../darray.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define GSICORE_DYNAMIC_TASK_LIST -#define GSICORE_MAXTASKS 40 - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef enum -{ - GSCore_IN_USE, - GSCore_SHUTDOWN_PENDING, - GSCore_SHUTDOWN_COMPLETE -} GSCoreValue; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef enum -{ - GSTaskResult_None, - GSTaskResult_InProgress, - GSTaskResult_Canceled, - GSTaskResult_TimedOut, - GSTaskResult_Finished -} GSTaskResult; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// delegates (optional, may be NULL) -typedef void(*GSTaskExecuteFunc) (void* theTaskData); -typedef void(*GSTaskCallbackFunc)(void* theTaskData, GSTaskResult theResult); -typedef void(*GSTaskCancelFunc) (void* theTaskData); -typedef gsi_bool(*GSTaskCleanupFunc) (void* theTaskData); // post run cleanup -typedef GSTaskResult(*GSTaskThinkFunc)(void* theTaskData); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// "Private" struct for dispatching tasks. Once tasks have been put in the queue -// they should only be modified from the think thread. -// - When creating a task, you should set only the task data and delegates -typedef struct -{ - int mId; - gsi_time mTimeout; - gsi_time mStartTime; - gsi_bool mAutoThink; - - // These are not exclusive states (use bit flags?) - gsi_i32 mIsStarted; - gsi_i32 mIsRunning; - gsi_i32 mIsCanceled; - gsi_i32 mIsCallbackPending; // does the task require a callback? - - // delegates - void* mTaskData; - GSTaskExecuteFunc mExecuteFunc; - GSTaskCallbackFunc mCallbackFunc; - GSTaskCancelFunc mCancelFunc; - GSTaskCleanupFunc mCleanupFunc; - GSTaskThinkFunc mThinkFunc; -} GSTask; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct -{ - gsi_u32 mRefCount; - - gsi_bool volatile mIsStaticInitComplete; // once per application init - gsi_bool volatile mIsInitialized; // gsi_true when ready to use - gsi_bool volatile mIsShuttingDown; // gsi_true when shutting down - - GSICriticalSection mQueueCrit; - #ifdef GSICORE_DYNAMIC_TASK_LIST - DArray mTaskArray; - #else - GSTask* mTaskArray[GSICORE_MAXTASKS]; - #endif - -} GSCoreMgr; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsCoreInitialize (void); -void gsCoreThink (gsi_time theMS); -void gsCoreShutdown (void); -GSCoreValue gsCoreIsShutdown(void); - -GSTaskResult gsCoreTaskThink(GSTask* theTask); -void gsiCoreExecuteTask (GSTask* theTask, gsi_time theTimeoutMs); -void gsiCoreCancelTask (GSTask* theTask); - -GSTask* gsiCoreCreateTask(void); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __CORE_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCrypt.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCrypt.c deleted file mode 100644 index 0ac8de8c593..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsCrypt.c +++ /dev/null @@ -1,509 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCrypt.h" -#include "gsLargeInt.h" -#include "gsSHA1.h" - -// **Please refer to gsCrypt.h for public interface functions** - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -#ifdef GS_CRYPT_RSA_ES_OAEP - static gsi_i32 gsCryptRSAOAEPEncryptBuffer(const gsCryptRSAKey *publicKey, const unsigned char *plainText, gsi_u32 len, unsigned char buffer[GS_CRYPT_RSA_BYTE_SIZE]); - static gsi_i32 gsCryptRSAOAEPDecryptBuffer(const gsCryptRSAKey *privateKey, const unsigned char cipherText[GS_CRYPT_RSA_BYTE_SIZE], unsigned char *plainText, gsi_u32 *lenout); - - static void gsiCryptRSAGenerateSeed(unsigned char *buffer, gsi_u32 len); - static gsi_bool gsiCryptRSAMaskData(unsigned char *data, gsi_u32 len, const unsigned char *maskSeed, gsi_u32 maskLen); -#else - static gsi_i32 gsCryptRSAPKCS1EncryptBuffer(const gsCryptRSAKey *publicKey, const unsigned char *plainText, gsi_u32 len, unsigned char buffer[GS_CRYPT_RSA_BYTE_SIZE]); - static gsi_i32 gsCryptRSAPKCS1DecryptBuffer(const gsCryptRSAKey *privateKey, const unsigned char ciperText[GS_CRYPT_RSA_BYTE_SIZE], unsigned char *plainTextOut, gsi_u32 *lenOut); - - static void gsiCryptRSAGeneratePad(unsigned char *buffer, gsi_u32 len); -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -#ifdef GS_CRYPT_RSA_ES_OAEP - // generate a random seed for OAEP - void gsiCryptRSAGenerateSeed(unsigned char *buffer, gsi_u32 len) - { - unsigned int i=0; - - Util_RandSeed(current_time()); - for (i=0; i < len; i++) - { - //buffer[i] = 0x0c; - buffer[i] = (unsigned char)(Util_RandInt(0x00, 0xFF)+1); - GS_ASSERT(buffer[i] != 0x00); - } - } - - // PKCS#1 v2.1, B.2.1 MGF1, mask generation function - // modification: generates mask and applies in place - gsi_bool gsiCryptRSAMaskData(unsigned char *data, gsi_u32 dataLen, const unsigned char* seed, gsi_u32 seedLen) - { - int i=0; - int k=0; - - // The datablock may be used as the seed - unsigned char hashValue[GS_CRYPT_HASHSIZE]; // in integer form, NOT HEXSTRING - - // seed should never be larger than the data block size (but it may be less) - if (seedLen > GS_CRYPT_RSA_DATABLOCKSIZE) - return gsi_false; - - for (i=0; (gsi_u32)i= dataLen) - return gsi_true; - - data[i+k] ^= (gsi_u8)hashValue[k]; - } - } - return gsi_true; - } -#else - // generate a random pad for PKCS1 - // [0x01 - 0xFF] - void gsiCryptRSAGeneratePad(unsigned char *buffer, gsi_u32 len) - { - unsigned int i=0; - - Util_RandSeed(current_time()); - for (i=0; i < len; i++) - { - #if defined(GS_CRYPT_NO_RANDOM) - #pragma message("GS_CRYPT_NO_RANDOM defined, SSL is NOT SECURE!!!!\r\n") - buffer[i] = 0x0c; - #else - buffer[i] = (unsigned char)(Util_RandInt(0x00, 0xFF)+1); - #endif - GS_ASSERT(buffer[i] != 0x00); - } - } -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// RSA Packet = encrypt(lhash, pad, 0x01, plainText) -// lhash is constant, since labels are not supported -// pad is variable length, depending on plainText length -gsi_i32 gsCryptRSAEncryptBuffer(const gsCryptRSAKey *publicKey, const unsigned char *plainText, gsi_u32 len, unsigned char buffer[GS_CRYPT_RSA_BYTE_SIZE]) -{ - #ifdef GS_CRYPT_RSA_ES_OAEP - return gsCryptRSAOAEPEncryptBuffer(publicKey, plainText, len, buffer); - #else - return gsCryptRSAPKCS1EncryptBuffer(publicKey, plainText, len, buffer); - #endif -} - -#ifdef GS_CRYPT_RSA_ES_OAEP - gsi_i32 gsCryptRSAOAEPEncryptBuffer(const gsCryptRSAKey *publicKey, const unsigned char *plainText, gsi_u32 len, unsigned char buffer[GS_CRYPT_RSA_BYTE_SIZE]) - { - gsLargeInt_t lintRSAPacket; - gsCryptRSAOAEPPacket* packet = (gsCryptRSAOAEPPacket*)lintRSAPacket.mData; - - #if (GS_CRYPT_HASHSIZE==GS_CRYPT_MD5_HASHSIZE) - const gsi_u8 lhash[GS_CRYPT_HASHSIZE] = {0xd4,0x1d,0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04,0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,0x7e}; // hash of "" - #else - const gsi_u8 lhash[GS_CRYPT_HASHSIZE] = {0xda,0x39,0xa3,0xee,0x5e,0x6b,0x4b,0x0d,0x32,0x55,0xbf,0xef,0x95,0x60,0x18,0x90,0xaf,0xd8,0x07,0x09}; // hash of "" - #endif - const unsigned int maxPlainTextLen = GS_CRYPT_RSA_BYTE_SIZE-2*GS_CRYPT_HASHSIZE-2; - const unsigned int padSize = maxPlainTextLen-len; - - // The steps below are taken from PKCS#1, section 7.1.1 "Encryption Operation" - // 1. check length - if (len > maxPlainTextLen) - return -1; - - // 2. EME-OAEP encoding (pad & pad format) - // a. precalculated above (const lhash) - - // b. create pad - // c. concatenate hash+pad+0x01+plainText - memcpy(packet->maskedData, lhash, GS_CRYPT_HASHSIZE); - memset(&packet->maskedData[GS_CRYPT_HASHSIZE], 0, padSize); // pad with zero bytes - packet->maskedData[GS_CRYPT_HASHSIZE+padSize] = 0x01; // RSA encoding format ID (EME-OAEP) - memcpy(&packet->maskedData[GS_CRYPT_HASHSIZE+padSize+1], plainText, len); - - // d. generate random seed (seed isn't masked until h.) - gsiCryptRSAGenerateSeed(packet->maskedSeed, GS_CRYPT_HASHSIZE); - - // e. use (still unmasked) seed to generate a mask for the datablock - // f. apply it with xor - gsiCryptRSAMaskData(packet->maskedData, GS_CRYPT_RSA_DATABLOCKSIZE, packet->maskedSeed, GS_CRYPT_HASHSIZE); - - // g. use the masked datablock to generate a mask for the seed - // h. apply it with xor - gsiCryptRSAMaskData(packet->maskedSeed, GS_CRYPT_HASHSIZE, packet->maskedData, GS_CRYPT_RSA_DATABLOCKSIZE); - - // i. set first byte to 0x00 - packet->headerByte = 0x00; - - // 3. Encryptitize - /* - lintRSAPacket.mLength = GS_CRYPT_RSA_BYTE_SIZE/sizeof(gsi_u32); - gsLargeIntReverseBytes(&lintRSAPacket); - gsLargeIntPowerMod(&lintRSAPacket, &publicKey->exponent, &publicKey->modulus, &lintRSAPacket); - gsLargeIntReverseBytes(&lintRSAPacket); - - // 4. return cipher text - memcpy(buffer, lintRSAPacket.mData, GS_CRYPT_RSA_BYTE_SIZE); - */ - GS_ASSERT(0); // Section above needs revision due to byte order issues - - return 0; - } -#else - gsi_i32 gsCryptRSAPKCS1EncryptBuffer(const gsCryptRSAKey *publicKey, const unsigned char *plainText, gsi_u32 len, unsigned char buffer[GS_CRYPT_RSA_BYTE_SIZE]) - { - gsi_u8 buf[GS_CRYPT_RSA_BYTE_SIZE]; - gsCryptRSAPKCS1Packet* packet = (gsCryptRSAPKCS1Packet*)buf; - gsLargeInt_t lintRSAPacket; - - if (len > (GS_CRYPT_RSA_BYTE_SIZE-11)) // 2 byte header, 8 byte pad minimum, 1 byte separator - return -1; - - // form the packet - packet->headerByte[0] = 0x00; - packet->headerByte[1] = 0x02; - - gsiCryptRSAGeneratePad(packet->data, GS_CRYPT_RSA_BYTE_SIZE-len-3); - packet->data[GS_CRYPT_RSA_BYTE_SIZE-len-3] = 0x00; // separator - memcpy(&packet->data[GS_CRYPT_RSA_BYTE_SIZE-len-3+1], plainText, len); - - if (gsi_is_false(gsLargeIntSetFromMemoryStream(&lintRSAPacket, (const gsi_u8*)buf, GS_CRYPT_RSA_BYTE_SIZE)) || - gsi_is_false(gsLargeIntPowerMod(&lintRSAPacket, &publicKey->exponent, &publicKey->modulus, &lintRSAPacket)) || - gsi_is_false(gsLargeIntWriteToMemoryStream(&lintRSAPacket, buffer)) ) - { - return -1; - } - - return 0; - } -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_i32 gsCryptRSADecryptBuffer(const gsCryptRSAKey *privateKey, const unsigned char cipherText[GS_CRYPT_RSA_BYTE_SIZE], unsigned char *plainText, gsi_u32 *lenout) -{ - #ifdef GS_CRYPT_RSA_ES_OAEP - return gsCryptRSAOAEPDecryptBuffer(privateKey, cipherText, plainText, lenout); - #else - return gsCryptRSAPKCS1DecryptBuffer(privateKey, cipherText, plainText, lenout); - #endif -} - -// Since decryption requires the privatekey, it is usually done by the server. -// Decryption is also much slower than encryption. -// This is included here as a testing utility but should probably not be used in a game client. -#ifndef GS_CRYPT_RSA_ES_OAEP - static gsi_i32 gsCryptRSAPKCS1DecryptBuffer(const gsCryptRSAKey *privateKey, const unsigned char cipherText[GS_CRYPT_RSA_BYTE_SIZE], unsigned char *plainText, gsi_u32 *lenout) - { - int i=0; - char* temp; - gsLargeInt_t lintRSAPacket; - lintRSAPacket.mLength = GS_CRYPT_RSA_BYTE_SIZE/GS_LARGEINT_DIGIT_SIZE_BYTES; - memcpy(lintRSAPacket.mData, cipherText, GS_CRYPT_RSA_BYTE_SIZE); - - if (gsi_is_false(gsLargeIntReverseBytes(&lintRSAPacket)) || // reverse from bytebuffer to lint format - gsi_is_false(gsLargeIntPowerMod(&lintRSAPacket, &privateKey->exponent, &privateKey->modulus, &lintRSAPacket)) || - gsi_is_false(gsLargeIntReverseBytes(&lintRSAPacket)) // reverse back into a bytebuffer - ) - { - return -1; - } - - // check post exponentiation length - if (lintRSAPacket.mLength < (GS_CRYPT_RSA_BYTE_SIZE/GS_LARGEINT_DIGIT_SIZE_BYTES)) - return -1; - - // Check the packet for legality - // 1. first byte must be 0x00 - // 2. send byte must be 0x02 - // 3. pad must be at least 8 bytes and end with 0x00 - // 4. payload must be at least 1 byte - temp = (char*)lintRSAPacket.mData; - if (temp[0] != 0x00) - return -1; - if (temp[1] != 0x02) - return -2; - - // find the start of the data (first 0x00 byte after the 1st) - temp = (char*)lintRSAPacket.mData; - for (i=2; iexponent, &privateKey->modulus, &lintRSAPacket); - gsLargeIntReverseBytes(&lintRSAPacket); // reverse back into a bytebuffer - - // check post exponentiation length - if (lintRSAPacket.mLength < (GS_CRYPT_RSA_BYTE_SIZE/4)) - return -1; - - // Check the packet for legality - // 1. "un-mask" the maskedSeed, using the maskedData - gsiCryptRSAMaskData(packet->maskedSeed, GS_CRYPT_HASHSIZE, packet->maskedData, GS_CRYPT_RSA_DATABLOCKSIZE); - // 2. "un-mask" the maskedData, using the previously unmasked maskedSeed - gsiCryptRSAMaskData(packet->maskedData, GS_CRYPT_RSA_DATABLOCKSIZE, packet->maskedSeed, GS_CRYPT_HASHSIZE); - // 3. datablock = [lhash][0x00...][0x01][M] - if (0 != memcmp(packet->maskedData, lhash, GS_CRYPT_HASHSIZE)) - return -2; // label has doesn't match (mismatched hash algorithms?) - i = 33; - while(imaskedData[i] == 0x00) - i++; // may be zero bytes pad - if (i==GS_CRYPT_RSA_BYTE_SIZE || packet->maskedData[i] != 0x01) - return -3; // must be a 0x01 following the pad - i++; - if (i == GS_CRYPT_RSA_BYTE_SIZE) - return -4; // founnd the separator, but no message! - - memcpy(plainText, &packet->maskedData[i], (size_t)(GS_CRYPT_RSA_DATABLOCKSIZE-i)); - *lenout = (gsi_u32)(GS_CRYPT_RSA_DATABLOCKSIZE-i); // final length = blocksize - pad - return 0; - } -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_i32 gsCryptRSASignData(const gsCryptRSAKey *privateKey, const unsigned char *plainText, gsi_u32 plainTextLen, unsigned char *signedDataOut, gsi_u32 *lenOut) -{ - const unsigned char * hash = NULL; - - GSI_UNUSED(privateKey); - GSI_UNUSED(plainText); - GSI_UNUSED(plainTextLen); - GSI_UNUSED(signedDataOut); - GSI_UNUSED(lenOut); - - // 1) hash data - // hash = MD5(plainText); - //GS_ASSERT(0); // not implemented yet - - - // 2) Sign - return gsCryptRSASignHash(privateKey, hash, GS_CRYPT_MD5_HASHSIZE, signedDataOut, lenOut); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// The more usual use of RSA signatures -// Constructs a PKCS1 signature form of type { [0x00][0x01][0xFF..FF][0x00][hash oid][hash] } = RSA key length -gsi_i32 gsCryptRSASignHash(const gsCryptRSAKey *privateKey, const unsigned char *hash, gsi_u32 hashLen, unsigned char *signedDataOut, gsi_u32 *lenOut) -{ - // Encode to PKCS1 signature form - gsi_u32 aKeyByteLength = privateKey->modulus.mLength * GS_LARGEINT_DIGIT_SIZE_BYTES; // key length in bytes - gsi_u32 aReservedLength = 3; - gsi_u32 anOidLen; - - gsLargeInt_t dataToSign; - char * writeBuf = (char*)dataToSign.mData; - - // Microsoft PKCS #1 headers for various hash algorithms. - gsi_u8 md5Header[18] = {0x30,0x20,0x30,0x0C,0x06,0x08,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x05,0x05,0x00,0x04,0x10}; - gsi_u8 sha1Header[15] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}; - - if (hashLen == GS_CRYPT_MD5_HASHSIZE) - anOidLen = sizeof(md5Header); - else if (hashLen == GS_CRYPT_SHA1_HASHSIZE) - anOidLen = sizeof(sha1Header); - else - return -1; // hash algorithm could not be identified from hashLen - - // Make sure the key is large enough to sign this hash - GS_ASSERT(hashLen + anOidLen + aReservedLength <= aKeyByteLength); - if (hashLen + anOidLen + aReservedLength > aKeyByteLength) - return -2; // key is too small or hash is too large - - // fill in header bytes - writeBuf[0] = 0x00; - writeBuf[1] = 0x01; - - // pad with 0xFF - memset(&writeBuf[2], 0xFF, aKeyByteLength - hashLen - anOidLen - aReservedLength); - - // set a 0x00 at the end of the 0xFF pad - writeBuf[aKeyByteLength - hashLen - anOidLen - 1] = 0x00; - - // copy in the oid - if (hashLen == GS_CRYPT_MD5_HASHSIZE) - memcpy(&writeBuf[aKeyByteLength-hashLen-anOidLen], md5Header, sizeof(md5Header)); - else if (hashLen == GS_CRYPT_SHA1_HASHSIZE) - memcpy(&writeBuf[aKeyByteLength-hashLen-anOidLen], sha1Header, sizeof(sha1Header)); - else - return -1; // should probably assert here - - // copy in the hash - memcpy(&writeBuf[aKeyByteLength-hashLen], hash, hashLen); - - // fix byte order for large int - dataToSign.mLength = privateKey->modulus.mLength; - gsLargeIntReverseBytes(&dataToSign); - - // sign (a.k.a. encrypt) - gsLargeIntPowerMod(&dataToSign, &privateKey->exponent, &privateKey->modulus, &dataToSign); - - // length of output data is always the length of the private key's modulus - GS_ASSERT(dataToSign.mLength == privateKey->modulus.mLength); - gsLargeIntReverseBytes(&dataToSign); // switch back to rawbuffer byte order - memcpy(signedDataOut, dataToSign.mData, aKeyByteLength); - *lenOut = aKeyByteLength; - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// "data" is the text that was signed, encrypted or plaintext -// "sig" is the signature value attached to the msg (BIG-endian) -// Signature format: -// [ 0x00 0x01 0xFF ... 0x00 HashHeader Hash(Data) ] -gsi_i32 gsCryptRSAVerifySignedHash(const gsCryptRSAKey *publicKey, const unsigned char *hash, gsi_u32 hashLen, const unsigned char *sig, gsi_u32 sigLen) -{ - gsLargeInt_t lintRSASignature; - gsi_u8* packet = (gsi_u8*)lintRSASignature.mData; - int i=0; - - // Microsoft PKCS #1 headers for various hash algorithms. - gsi_u8 md5Header[18] = {0x30,0x20,0x30,0x0C,0x06,0x08,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x05,0x05,0x00,0x04,0x10}; - gsi_u8 sha1Header[15] = {0x30,0x21,0x30,0x09,0x06,0x05,0x2B,0x0E,0x03,0x02,0x1A,0x05,0x00,0x04,0x14}; - - // check parameters for common errors - if (hash==NULL || sig==NULL) - return -1; - if (sigLen != publicKey->modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES) - return -1; - if (hashLen != GS_CRYPT_MD5_HASHSIZE && hashLen != GS_CRYPT_SHA1_HASHSIZE) - return -1; // invalid hashsize - - // "decrypt" the signature - lintRSASignature.mLength = (l_word)(sigLen / GS_LARGEINT_DIGIT_SIZE_BYTES); - memcpy(lintRSASignature.mData, sig, sigLen); - gsLargeIntReverseBytes(&lintRSASignature); - gsLargeIntPowerMod(&lintRSASignature, &publicKey->exponent, &publicKey->modulus, &lintRSASignature); - gsLargeIntReverseBytes(&lintRSASignature); - - // Check format, first by 0x00, second byte 0x01 - if (packet[0] != 0x00 || packet[1] != 0x01) - return -2; - - // Loop through the 0xFF's - for (i=2; i -//#include - - -// THIS FILE ONLY INCLUDED WHEN USING GAMESPY DEBUG FUNCTIONS -// (don't put this above the header includes or VC will whine -#ifdef GSI_COMMON_DEBUG - -#if defined(_NITRO) -#include "../../common/nitro/screen.h" -#define printf Printf -#define vprintf VPrintf -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Static debug data -static struct GSIDebugInstance gGSIDebugInstance; // simple singleton "class" - -// Line prefixes, e.g. "[ cat][type][ lev] text" -char* gGSIDebugCatStrings[GSIDebugCat_Count] = -{ - " APP", " GP ", "PEER", " QR2", " SB", " V2", " AD", " NN", "HTTP", "CDKY", " CMN" -}; -char* gGSIDebugTypeStrings[GSIDebugType_Count] = -{ - " NET", "FILE", " MEM", "STAT", "MISC" -}; -char* gGSIDebugLevelStrings[GSIDebugLevel_Count] = -{ - "*ERR", "****", "----", " ", " ", " ", " ->" -}; -char* gGSIDebugLevelDescriptionStrings[8] = -{ - "None", "", "", "", "", "", "", "" -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// utility to convert bit flag back to base (e.g. 1<<2 returns 2) -static gsi_u32 gsiDebugLog2(gsi_u32 theInt) -{ - gsi_u32 total = 0; - while (theInt > 1) - { - theInt = theInt >> 1; - total++; - } - return total; -} - - -// default supplied debug function, will receive debug text -// this is platform specific -static void gsiDebugCallback(GSIDebugCategory category, GSIDebugType type, - GSIDebugLevel level, const char * format, va_list params) -{ - #if defined(_PSP) - // Output line prefix - vprintf(format, params); - //gsDebugTTyPrint(string); - #elif defined(_PS2) - // Output line prefix - vprintf(format, params); - - #elif defined(_PS3) - // Output line prefix - vprintf(format, params); - - #elif defined(_WIN32) - static char string[256]; - vsprintf(string, format, params); - OutputDebugStringA(string); - - #elif defined(_LINUX) || defined(_MACOSX) - //static char string[256]; - //vsprintf(string, format, params); - vprintf(format, params); - #elif defined(_NITRO) - VPrintf(format, params); - #elif defined(_REVOLUTION) - static char string[256]; - vsprintf(string, format, params); - OSReport(string); - #else - va_list argptr; - static char string[256]; - va_start(argptr, format); - vsprintf(string, format, argptr); - va_end(argptr); - gsDebugTTyPrint(string); - #endif - - GSI_UNUSED(category); - GSI_UNUSED(type); - GSI_UNUSED(level); -} - - - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// process debug output -void gsDebugVaList(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char* theTokenStr, - va_list theParamList) -{ - // Retrieve the current debug level - GSIDebugLevel aCurLevel; - - // Verify Parameters - assert(theCat <= GSIDebugCat_Count); - assert(theType <= GSIDebugType_Count); - assert(theLevel <= (1< 0) - { - gsi_i32 aBytesToRead = min(aBytesLeft, 16); - - HexEncode16(aReadPos, aHexStr, (unsigned int)aBytesToRead); - gsDebugFormat(theCat, theType, theLevel, " %s\r\n", aHexStr); - - aReadPos += aBytesToRead; - aBytesLeft -= aBytesToRead; - }; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsSetDebugLevel(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel) -{ - // Verify Parameters - assert(theCat <= GSIDebugCat_Count); - assert(theType <= GSIDebugType_Count); - - // Set for all categories? - if (theCat == GSIDebugCat_Count) - { - int i=0; - for (; i - -#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Input levels (text is reported at one of these levels) -typedef gsi_u8 GSIDebugLevel; -#define GSIDebugLevel_HotError (GSIDebugLevel)(1<<0) // 1 Unexpected Error -#define GSIDebugLevel_WarmError (GSIDebugLevel)(1<<1) // 2 Expected Error -#define GSIDebugLevel_Warning (GSIDebugLevel)(1<<2) // 4 Warnings and Errors -#define GSIDebugLevel_Notice (GSIDebugLevel)(1<<3) // 8 Usefull debug info -#define GSIDebugLevel_Comment (GSIDebugLevel)(1<<4) // 16 Debug spam -#define GSIDebugLevel_RawDump (GSIDebugLevel)(1<<5) // 32 e.g. MemoryBuffer -#define GSIDebugLevel_StackTrace (GSIDebugLevel)(1<<6) // 64 Important function entries -// add new ones here (update string table in gsiDebug.c!) -#define GSIDebugLevel_Count 7 // 7 reporting levels - -// Output levels (a mask for the levels you want to receive) -// (update string table in gsiDebug.c!) -#define GSIDebugLevel_None (GSIDebugLevel)(0) // No output -#define GSIDebugLevel_Normal (GSIDebugLevel)(0x07) // Warnings and above -#define GSIDebugLevel_Debug (GSIDebugLevel)(0x0F) // Notice and above -#define GSIDebugLevel_Verbose (GSIDebugLevel)(0x1F) // Comment and above -#define GSIDebugLevel_Hardcore (GSIDebugLevel)(0xFF) // Recv all - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Output types -typedef enum -{ - GSIDebugType_Network, // Network activity - GSIDebugType_File, // File output - GSIDebugType_Memory, // Memory allocations - GSIDebugType_State, // State update - GSIDebugType_Misc, // None of the above - // add new ones here (update string table in gsiDebug.c!) - - GSIDebugType_Count, - GSIDebugType_All = GSIDebugType_Count -} GSIDebugType; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Debug categories (SDKs) -typedef enum -{ - GSIDebugCat_App, - GSIDebugCat_GP, - GSIDebugCat_Peer, - GSIDebugCat_QR2, - GSIDebugCat_SB, - GSIDebugCat_Voice, - GSIDebugCat_AD, - GSIDebugCat_NatNeg, - GSIDebugCat_HTTP, - GSIDebugCat_CDKey, - // Add new ones here (update string table in gsiDebug.c!) - - - GSIDebugCat_Common, // Common should be last to prevent display weirdness - // resulting from initialization order - GSIDebugCat_Count, - GSIDebugCat_All = GSIDebugCat_Count -} GSIDebugCategory; - -extern char* gGSIDebugCatStrings[GSIDebugCat_Count]; -extern char* gGSIDebugTypeStrings[GSIDebugType_Count]; -extern char* gGSIDebugLevelStrings[GSIDebugLevel_Count]; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Only include static data and functions if GSI_COMMON_DEBUG is defined -#ifndef GSI_COMMON_DEBUG - // not using GSI debug! Define functions to - // (put these here so VisualAssist will resolve the definitions below) - #if !defined(_WIN32) && !defined(__MWERKS__) - // WIN32 doesn't like "..." in a macro - #define gsDebugFormat(c,t,l,f,...) - #define gsDebugVaList(c,t,l,f,v) - #define gsDebugBinary(c,t,l,b,n) - #define gsSetDebugLevel(c,t,l) - #define gsSetDebugFile(f) - #define gsOpenDebugFile(f) - #define gsGetDebugFile - #define gsSetDebugCallback(c) - #elif defined(_NITRO) - #define gsDebugFormat(...) - #define gsDebugVaList(c,t,l,f,v) - #define gsDebugBinary(c,t,l,b,n) - #define gsSetDebugLevel(c,t,l) - #define gsSetDebugFile(f) - #define gsOpenDebugFile(f) - #define gsGetDebugFile - #define gsSetDebugCallback(c) - #else - #define gsDebugFormat - #define gsDebugVaList - #define gsDebugBinary - #define gsSetDebugLevel - #define gsSetDebugFile - #define gsOpenDebugFile - #define gsGetDebugFile - #define gsSetDebugCallback - #endif -#else - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// User supplied debug function, will receive debug text -typedef void (*GSIDebugCallback)(GSIDebugCategory,GSIDebugType,GSIDebugLevel, - const char*, va_list); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Global debug instance -typedef struct GSIDebugInstance -{ -#if !defined(_NITRO) - FILE* mGSIDebugFile; -#endif - GSIDebugCallback mDebugCallback; - gsi_i32 mInitialized; - -#if !defined(GSI_NO_THREADS) - GSICriticalSection mDebugCrit; -#endif - - GSIDebugLevel mGSIDebugLevel[GSIDebugCat_Count][GSIDebugType_Count]; -} GSIDebugInstance; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Logging functions -void gsDebugFormat(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char* theTokenStr, ...); - -void gsDebugVaList(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char* theTokenStr, - va_list theParams); - -void gsDebugBinary(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char* theBuffer, gsi_i32 theLength); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Output functions -void gsSetDebugLevel(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel); - -#if !defined(_NITRO) - -// Set the output file (NULL for no file) -void gsSetDebugFile(FILE* theFile); - -// Open and set the debug file -FILE* gsOpenDebugFile(const char* theFileName); - -// Retrieve the debug file -FILE* gsGetDebugFile(); - -#endif - -// Set a callback to be triggered with debug output -void gsSetDebugCallback(GSIDebugCallback theCallback); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // GSI_COMMON_DEBUG - -#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) -} -#endif - -#endif // __GSIDEBUG_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsLargeInt.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsLargeInt.c deleted file mode 100644 index 9b778eae96c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsLargeInt.c +++ /dev/null @@ -1,1904 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsLargeInt.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Many parameters are gsi_u32* instead of gsLargeInt_t*. -// This was done to allow easy conversion of databuffer to gsLargeInt_t -// Raw buffer destinations must have enough space to store the result -static gsi_bool gsiLargeIntPrint(FILE* logFile, const l_word *data, l_word length); -static gsi_bool gsiLargeIntResize(gsLargeInt_t *lint, l_word length); -static gsi_bool gsiLargeIntStripLeadingZeroes(gsLargeInt_t* lint); -static gsi_bool gsiLargeIntSizePower2(const gsLargeInt_t *src1, const gsLargeInt_t *src2, l_word *lenout); -static gsi_i32 gsiLargeIntCompare(const l_word *data1, l_word len1, const l_word *data2, l_word len2); - -static gsi_bool gsiLargeIntKMult(const l_word *data1, const l_word *data2, l_word length, l_word *dest, l_word *lenout, l_word maxlen); -static gsi_bool gsiLargeIntMult (const l_word *data1, l_word length1, const l_word *data2, l_word length2, l_word *dest, l_word *lenout, l_word maxlen); -static gsi_bool gsiLargeIntDiv (const l_word *src1, l_word length1, const gsLargeInt_t *divisor, gsLargeInt_t *dest, gsLargeInt_t *remainder); - -// Dest may be data1 or data2 to support in-place arithmetic -static gsi_bool gsiLargeIntAdd (const l_word *data1, l_word length1, const l_word *data2, l_word length2, l_word *dest, l_word *lenout, l_word maxlen); -static gsi_bool gsiLargeIntSub (const l_word *amount, l_word length1, const l_word *from, l_word length2, l_word *dest, l_word *lenout); - -// Special division, removes divisor directly from src1, leaving remainder -static gsi_bool gsiLargeIntSubDivide(l_word *src1, l_word length, const l_word *divisor, l_word dlen, gsi_u32 highbit, l_word *quotient); - -// Montgomery utilities -//gsi_bool gsiLargeIntSquareM(const gsLargeInt_t *src, const gsLargeInt_t *mod, gsi_u32 modPrime, gsi_u32 R, gsLargeInt_t *dest); -//gsi_bool gsiLargeIntMultM(gsLargeInt_t *src1, gsLargeInt_t *src2, const gsLargeInt_t *mod, gsi_u32 modPrime, gsLargeInt_t *dest); -gsi_bool gsiLargeIntMultM(gsLargeInt_t *src1, gsLargeInt_t *src2, const gsLargeInt_t *mod, gsi_u32 modPrime, gsLargeInt_t *dest); -gsi_bool gsiLargeIntInverseMod(const gsLargeInt_t *mod, l_word *modPrimeOut); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - // execution timing/profiling -#define GS_LINT_TIMING -#ifdef GS_LINT_TIMING - -typedef enum -{ - GSLintTimerMult, // "regular" multiplication - GSLintTimerMultM, // montgomery - GSLintTimerKMult, // karatsuba - GSLintTimerAdd, - GSLintTimerSub, // subtract - GSLintTimerDiv, - GSLintTimerSubDivide, // atomic divide - GSLintTimerSquareMod, - GSLintTimerPowerMod, // modular exponentiation - - GSLintTimerCount -} GSLintTimerID; - -typedef struct GSLintTimer -{ - gsi_time started; - gsi_time total; - gsi_u32 entries; - gsi_u32 running; // already entered? -} GSLintTimer; -static struct GSLintTimer gTimers[GSLintTimerCount]; - -static void gsiLargeIntTimerEnter(GSLintTimerID id) -{ - if (gTimers[id].running==0) - { - gTimers[id].entries++; - gTimers[id].started = current_time_hires(); - gTimers[id].running = 1; - } -} -static void gsiLargeIntTimerExit(GSLintTimerID id) -{ - if (gTimers[id].running==1) - { - gTimers[id].total += current_time_hires()-gTimers[id].started; - gTimers[id].running = 0; - } -} - -#define GSLINT_ENTERTIMER(id) gsiLargeIntTimerEnter(id) -#define GSLINT_EXITTIMER(id) gsiLargeIntTimerExit(id) - -#else -#define GSLINT_ENTERTIMER(id) -#define GSLINT_EXITTIMER(id) -#endif - - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsLargeIntSetValue(gsLargeInt_t *lint, l_word value) -{ - lint->mLength = 1; - lint->mData[0] = value; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Resize by: -// Padding a GSLINT with leading zeroes. -// or stripping lead zeroes. -// This function will not strip digits other than zero. -gsi_bool gsiLargeIntResize(gsLargeInt_t *lint, l_word length) -{ - if (length > GS_LARGEINT_MAX_DIGITS) - return gsi_false; - - // strip leading zeroes until length is reached - if (lint->mLength >= length) - { - while(lint->mLength > length && lint->mData[lint->mLength-1]==0) - lint->mLength--; // check each digit to make sure it's zero - if (lint->mLength == length) - return gsi_true; - else - return gsi_false; - } - - // otherwise, add zeroes until length is reached - else - { - memset(&lint->mData[lint->mLength], 0, (length-lint->mLength)*sizeof(l_word)); - lint->mLength = length; - return gsi_true; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Makes two GSLINT the same size, the size being a power of 2 -// NOTE: Testing next multiple of two, not power of 2 -gsi_bool gsiLargeIntSizePower2(const gsLargeInt_t *src1, const gsLargeInt_t *src2, l_word *lenout) -{ - unsigned int i = 0; - - int len1 = (int)src1->mLength; - int len2 = (int)src2->mLength; - - // strip leading zeroes - while(len1>0 && src1->mData[len1-1] == 0) - len1--; - while(len2>0 && src2->mData[len2-1] == 0) - len2--; - - // set to longer length - *lenout = (l_word)max(len1, len2); - - // search for power of two >= length - // (this length is in digits, not bits) - i=1; - while(i < *lenout) - i = i<<1; - *lenout = (l_word)i; - - if (*lenout > GS_LARGEINT_MAX_DIGITS) - return gsi_false; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Compare two integers -// -1 = data1 < data2 -// 0 = data1 = data2 -// 1 = data1 > data2 -static gsi_i32 gsiLargeIntCompare(const l_word *data1, l_word len1, const l_word *data2, l_word len2) -{ - // skip leading whitespace, if any - while(data1[len1-1] == 0 && len1>0) - len1--; - while(data2[len2-1] == 0 && len2>0) - len2--; - if (len1len2) - return 1; - else - { - // same size, compare digits - while(len1 > 0) - { - if (data1[len1-1] < data2[len1-1]) - return -1; - else if (data1[len1-1] > data2[len1-1]) - return 1; - len1--; - } - } - return 0; // equal! -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiLargeIntStripLeadingZeroes(gsLargeInt_t* lint) -{ - while(lint->mLength >0 && lint->mData[lint->mLength-1]==0) - lint->mLength--; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Addition may cause overflow -gsi_bool gsLargeIntAdd(const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest) -{ - gsi_bool result = gsiLargeIntAdd(src1->mData, src1->mLength, src2->mData, src2->mLength, dest->mData, &dest->mLength, GS_LARGEINT_MAX_DIGITS); - if (gsi_is_false(result)) - memset(dest, 0, sizeof(gsLargeInt_t)); // overflow - return result; -} - -// len: In value = maxsize -// Out value = actual size -static gsi_bool gsiLargeIntAdd(const l_word *data1, l_word length1, const l_word *data2, l_word length2, l_word *dest, l_word *lenout, l_word maxlen) -{ - gsi_u32 i=0; - l_dword carry = 0; // to hold overflow - - gsi_u32 shorterLen = 0; - gsi_u32 longerLen = 0; - //const gsi_u32 *shorterSrc = NULL; - const l_word *longerSrc = NULL; - - GSLINT_ENTERTIMER(GSLintTimerAdd); - - if (maxlen < length1 || maxlen < length2) - return gsi_false; // dest not large enough, OVERFLOW - - if (length1 < length2) - { - shorterLen = length1; - //shorterSrc = data1; - longerLen = length2; - longerSrc = data2; - } - else - { - shorterLen = length2; - //shorterSrc = data2; - longerLen = length1; - longerSrc = data1; - } - - // Add digits until the shorterSrc's length is reached - while(i < shorterLen) - { - carry += (l_dword)data1[i] + data2[i]; - dest[i] = (l_word)carry; - carry = carry >> GS_LARGEINT_DIGIT_SIZE_BITS; //32; - i++; - } - - // Continue adding until carry is zero - while((carry > 0) && (i < longerLen)) - { - carry += (l_dword)longerSrc[i]; - dest[i] = (l_word)carry; - carry = carry >> GS_LARGEINT_DIGIT_SIZE_BITS; //32; - i++; - } - - // Is there still a carry? - // do not perform length check here, so that we can support oversized buffers - if (carry > 0) // && i < GS_LARGEINT_INT_SIZE) - { - if (maxlen <= i) - return gsi_false; // OVERFLOW, no room for extra digit - dest[i++] = (l_word)carry; - carry = 0; - } - - // Copy the rest of the bytes straight over (careful of memory overlap) - // this can't happen if there was a carry (see above carry>0 check) - if (i < longerLen) - { - // check overlap - if (&dest[i] != &longerSrc[i]) - memcpy(&dest[i], &longerSrc[i], (longerLen-i)*sizeof(l_word)); - i = longerLen; - } - *lenout = (l_word)i; - - GSLINT_EXITTIMER(GSLintTimerAdd); - - if (carry) - return gsi_false; // overflow - else - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Subtraction may cause underflow -// subtracts src1 FROM src2 -// strips leading zeroes (gsiLargeIntSub doesn't strip for compatability with karatsuba fixed size numbers) -gsi_bool gsLargeIntSub(const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest) -{ - gsi_bool result = gsiLargeIntSub(src1->mData, src1->mLength, src2->mData, src2->mLength, dest->mData, &dest->mLength); - if (gsi_is_true(result)) - gsiLargeIntStripLeadingZeroes(dest); - return result; -} - -gsi_bool gsiLargeIntSub(const l_word *src1, l_word length1, const l_word *src2, l_word length2, l_word *dest, l_word *lenout) -{ - l_dword borrow = 0; // to hold overflow - gsi_u32 shorterLen = min(length1, length2); - gsi_u32 i=0; - - GSLINT_ENTERTIMER(GSLintTimerSub); - - //printf("--From: "); - //gsiLargeIntPrint(src2, length2); - //printf("--Subtracting: "); - //gsiLargeIntPrint(src1, length1); - - // Subtract digits - while(i < shorterLen) - { - borrow = (l_dword)src2[i] - src1[i] - borrow; - dest[i] = (l_word)borrow; - borrow = borrow>>63; // shift to last bit. This will be 1 if negative, 0 if positive - i++; - } - while(i < length2) - { - borrow = (l_dword)src2[i]-borrow; - dest[i] = (l_word)borrow; - borrow = borrow>>63; - i++; - } - - // check for underflow - if (borrow != 0) - { - GSLINT_EXITTIMER(GSLintTimerSub); - return gsi_false; - } - while(length1 > i) // make sure remaining digits are only leading zeroes - { - if (src1[i] != 0) - { - GSLINT_EXITTIMER(GSLintTimerSub); - return gsi_false; - } - i++; - } - - // Don't reduce length from subtraction, instead keep leading zeroes - // (do this for ease of use with Karatsuba which requires Power2 length) - *lenout = length2; - - GSLINT_EXITTIMER(GSLintTimerSub); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Multiply using normal method (use KMult when working with LargeInt*LargeInt) -gsi_bool gsLargeIntMult(const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest) -{ - gsi_bool result = gsiLargeIntMult(src1->mData, src1->mLength, src2->mData, src2->mLength, dest->mData, &dest->mLength, GS_LARGEINT_MAX_DIGITS); - if (gsi_is_false(result)) - memset(dest, 0, sizeof(gsLargeInt_t)); // overflow - return result; -} - -static gsi_bool gsiLargeIntMult(const l_word *data1, l_word length1, const l_word *data2, l_word length2, l_word *dest, l_word *lenout, l_word maxlen) -{ - unsigned int i=0; - unsigned int k=0; - - gsLargeInt_t temp; - memset(&temp, 0, sizeof(temp)); - *lenout = 0; - - GSLINT_ENTERTIMER(GSLintTimerMult); - - for(i=0; i= maxlen) - { - GSLINT_EXITTIMER(GSLintTimerMult); - return gsi_false; // overflow - } - while(carry) - { - carry += temp.mData[digit]; - temp.mData[digit] = (l_word)carry; - carry = carry >> GS_LARGEINT_DIGIT_SIZE_BITS; - digit++; - if ((digit > maxlen) || - (digit == maxlen && carry>0)) - { - GSLINT_EXITTIMER(GSLintTimerMult); - return gsi_false; // overflow - } - } - if (digit > (gsi_i32)temp.mLength) - temp.mLength = (l_word)digit; - } - } - } - // copy into destination (calculate length at this time) - while(temp.mLength>0 && temp.mData[temp.mLength-1] == 0) - temp.mLength--; // strip leading zeroes - *lenout = temp.mLength; - memcpy(dest, temp.mData, (*lenout)*sizeof(l_word)); - - GSLINT_EXITTIMER(GSLintTimerMult); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// divide src1 by divisor -gsi_bool gsLargeIntDiv(const gsLargeInt_t *src1, const gsLargeInt_t *divisor, gsLargeInt_t *dest, gsLargeInt_t *remainder) -{ - // call the free-buffer version - return gsiLargeIntDiv(src1->mData, src1->mLength, divisor, dest, remainder); -} - -// length1 can be, at most, 2*GS_LARGEINT_INT_SIZE -static gsi_bool gsiLargeIntDiv(const l_word *src, l_word len, const gsLargeInt_t *div, gsLargeInt_t *dest, gsLargeInt_t *remainder) -{ - gsi_i32 result = 0; // temp, to store compare result - gsi_i32 divisorHighBit = GS_LARGEINT_DIGIT_SIZE_BITS-1; // pre-calculate this - - // Bytes used from src1 - int readIndex = 0; - int readLength = 0; - - // setup scratch copies - gsLargeInt_t quotient; - - l_word scopy[GS_LARGEINT_MAX_DIGITS*2]; // we support double length source for division, when dest is null - l_word scopyLen = len; - - const l_word* divisorData = div->mData; - l_word divisorLen = div->mLength; - - gsi_bool endLoop = gsi_false; - - GSLINT_ENTERTIMER(GSLintTimerDiv); - - memset(scopy, 0, sizeof(scopy)); - - // we only support oversized sources for calculating a remainder - // e.g. dest must be null - if (scopyLen > GS_LARGEINT_MAX_DIGITS && dest != NULL) - return gsi_false; - - // strip leading zeroes (from our scratch copies) - while(scopyLen>0 && src[scopyLen-1]==0) - scopyLen--; - while(divisorLen>0 && divisorData[divisorLen-1]==0) - divisorLen--; - - memcpy(scopy, src, scopyLen*sizeof(l_word)); - memset("ient, 0, sizeof(quotient)); - - // check the unusual cases - if (scopyLen==0 || divisorLen==0) - { - if (dest) - { - dest->mData[0] = 0; - dest->mLength = 0; - } - if (remainder) - { - remainder->mData[0] = 0; - remainder->mLength = 0; - } - - GSLINT_EXITTIMER(GSLintTimerDiv); - - if (divisorLen == 0) - return gsi_false; // division by zero - else - return gsi_true; // zero divided, this is legal - } - if (gsiLargeIntCompare(scopy, scopyLen, divisorData, divisorLen)==-1) - { - // divisor is larger than source - if (dest) - { - dest->mLength = 0; - dest->mData[0] = 0; - } - remainder->mLength = scopyLen; - memcpy(remainder->mData, scopy, scopyLen*sizeof(l_word)); - GSLINT_EXITTIMER(GSLintTimerDiv); - return gsi_true; - } - - // calculate the divisor high bit - while((divisorData[divisorLen-1]&(1<<(gsi_u32)divisorHighBit))==0 && divisorHighBit>=0) - divisorHighBit--; - if (divisorHighBit == -1) - { - GSLINT_EXITTIMER(GSLintTimerDiv); - return gsi_false; // divide by zero - } - divisorHighBit += (divisorLen-1)*GS_LARGEINT_DIGIT_SIZE_BITS; - - // position "sliding" window for first interation - // 41529 / [71389]2564 - // WARNING: digits are indexed [2][1][0], first byte to read is index[2] - readIndex = (int)(scopyLen - divisorLen); - readLength = (int)divisorLen; - - //if (readIndex < 0) - // _asm {int 3}; // overflow readIndex - - do - { - result = gsiLargeIntCompare(&scopy[readIndex], (l_word)readLength, divisorData, divisorLen); - if (result == -1) - { - // scopy window is smaller, we'll need an extra digit - if (readIndex > 0) - { - readIndex--; - readLength++; - } - else - { - // no more digits! - endLoop = gsi_true; - } - } - else if (result == 0) - { - // not likely! set digits to zero and slide window - memset(&scopy[readIndex], 0, readLength*sizeof(l_word)); - quotient.mData[readIndex] += 1; - if (quotient.mLength < (l_word)(readIndex+readLength)) - quotient.mLength = (l_word)(readIndex+readLength); - readIndex -= readLength; - readLength = 1; - - if (readIndex < 0) - endLoop = gsi_true;; // no more digits - } - else - { - // subtract directly onto our temp copy, so we don't have to worry about carry values - l_word quotientTemp = 0; - //if (readLength > 0xffff) - // _asm {int 3} - if (gsi_is_false(gsiLargeIntSubDivide(&scopy[readIndex], (l_word)readLength, divisorData, divisorLen, (gsi_u32)divisorHighBit, "ientTemp))) - { - // overflow - GSLINT_EXITTIMER(GSLintTimerDiv); - return gsi_false; - } - quotient.mData[readIndex] = (l_word)(quotient.mData[readIndex] + quotientTemp); - if (quotient.mLength < (l_word)(readIndex+readLength)) - quotient.mLength = (l_word)(readIndex+readLength); - // remove new leading zeroes - while(scopy[readIndex+readLength-1] == 0 && readLength>1) - readLength--; - while(scopy[readIndex+readLength-1] == 0 && readIndex>1) - readIndex--; - } - } - while(gsi_is_false(endLoop)); - - // no more digits, leftover is remainder - if (readIndex >= 0) - { - memcpy(remainder->mData, &scopy[readIndex], readLength*sizeof(l_word)); - remainder->mLength = (l_word)readLength; - } - else - { - remainder->mData[0] = 0; - remainder->mLength = 0; - } - - // save off quotient, if desired - if (dest) - { - memcpy(dest->mData, quotient.mData, quotient.mLength*sizeof(l_word)); - dest->mLength = quotient.mLength; - } - GSLINT_EXITTIMER(GSLintTimerDiv); - return gsi_true; -} - - -// atomic divide. -// Subtract divisor directly from src. -// Leave remainder in src. -static gsi_bool gsiLargeIntSubDivide(l_word *src, l_word length, const l_word *divisor, l_word dlen, - gsi_u32 highbit, l_word *quotient) -{ - l_dword aboveBits = 0; - gsLargeInt_t temp; // stores temporary product before subtraction - gsLargeInt_t quotientCopy; // copy of quotient, length padded for multiplication - - GSLINT_ENTERTIMER(GSLintTimerSubDivide); - // assert(src > divisor) - // assert(src < (MAX_DIGIT_VALUE * divisor)) - //if(dlen==1 && *divisor==0) - // _asm {int 3} // division by zero - - // Q: how many times to subtract? - // A: we estimate by taking the bits in src above the highest bit in divisor - if (length > dlen) - aboveBits = (src[length-2]&divisor[dlen-1]) | ((l_dword)src[length-1]<>GS_LARGEINT_DIGIT_SIZE_BITS); - - // We only support quotients up to MAX_INT - if (quotientCopy.mData[1] != 0) - { - quotientCopy.mData[0] = (l_word)(-1); - quotientCopy.mData[1] = 0; - } - quotientCopy.mLength = 1; - - // multiply this value by divisor, and that's how much to subtract - if (gsi_is_false(gsiLargeIntMult(divisor, dlen, quotientCopy.mData, quotientCopy.mLength, temp.mData, &temp.mLength, GS_LARGEINT_MAX_DIGITS))) - { - GSLINT_EXITTIMER(GSLintTimerSubDivide); - return gsi_false; // overflow - } - - // while subtraction amount is larger than src, reduce it - while(gsiLargeIntCompare(temp.mData, temp.mLength, src, length)==1) - { - // divide by two - quotientCopy.mData[0] = (l_word)(quotientCopy.mData[0]>>1); - //if (quotientCopy.mData[0] == 0) - // _asm {int 3} - if (gsi_is_false(gsiLargeIntMult(divisor, dlen, quotientCopy.mData, quotientCopy.mLength, temp.mData, &temp.mLength, GS_LARGEINT_MAX_DIGITS))) - { - GSLINT_EXITTIMER(GSLintTimerSubDivide); - return gsi_false; // overflow - } - } - //if (gsiLargeIntCompare(temp.mData, temp.mLength, src, length)==1) - // _asm {int 3} // temp > src, subtraction will cause underflow! - - // subtract it - gsiLargeIntSub(temp.mData, temp.mLength, src, length, src, &length); - - *quotient = quotientCopy.mData[0]; - //if (quotientCopy.mData[1] != 0) - // _asm {int 3} - GSLINT_EXITTIMER(GSLintTimerSubDivide); - - GSI_UNUSED(highbit); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Multiply using Karatsuba -// Karatsuba requires that the sizes be equal and a power of two -gsi_bool gsLargeIntKMult(const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest) -{ - l_word len = 0; - gsi_bool result = gsi_false; - - gsLargeInt_t temp; // to prevent issues if (src1 == src2 == dest) - - // quick check for multiplication by 0 - if (src1->mLength == 0 || src2->mLength == 0) - { - dest->mLength = 0; - return gsi_true; - } - - // when length is small it's faster to use "normal" multiplication - if (max(src1->mLength,src2->mLength) < GS_LARGEINT_KARATSUBA_CUTOFF) - return gsLargeIntMult(src1, src2, dest); - - // Check for size/length restrictions - result = gsiLargeIntSizePower2(src1, src2, &len); - if (gsi_is_false(result) || len>(GS_LARGEINT_MAX_DIGITS/2)) - { - // try regular multiplication - return gsLargeIntMult(src1, src2, dest); - } - - // (don't time above section since it defers to Mult) - GSLINT_ENTERTIMER(GSLintTimerKMult); - - // clear the temporary dest - memset(&temp, 0, sizeof(gsLargeInt_t)); - temp.mLength = 0; - - // resize if necessary - if (src1->mLength != len || src2->mLength != len) - { - // size is not correct, make a copy then multiply - gsLargeInt_t src1Copy; - gsLargeInt_t src2Copy; - memcpy(&src1Copy, src1, sizeof(gsLargeInt_t)); - memcpy(&src2Copy, src2, sizeof(gsLargeInt_t)); - gsiLargeIntResize(&src1Copy, len); - gsiLargeIntResize(&src2Copy, len); - - result = gsiLargeIntKMult(src1Copy.mData, src2Copy.mData, len, temp.mData, &temp.mLength, GS_LARGEINT_MAX_DIGITS); - } - else - { - // size is correct, perform multiplication - result = gsiLargeIntKMult(src1->mData, src2->mData, len, temp.mData, &temp.mLength, GS_LARGEINT_MAX_DIGITS); - } - if (gsi_is_true(result)) - { - // strip leading zeroes and copy into dest - gsiLargeIntStripLeadingZeroes(&temp); - memcpy(dest, &temp, sizeof(gsLargeInt_t)); - } - GSLINT_EXITTIMER(GSLintTimerKMult); - return result; -} - - -// Utility for Karasuba -static gsi_bool gsiLargeIntKMult(const l_word *data1, const l_word *data2, l_word length, - l_word *dest, l_word *lenout, l_word maxlen) -{ - // No timer here, this function is only called from GSLINTKMult - //GSLINT_ENTERTIMER(GSLintTimerKMult); - - // "normal" multiplication is faster when length is small - if (length <= GS_LARGEINT_KARATSUBA_CUTOFF) - return gsiLargeIntMult(data1, length, data2, length, dest, lenout, maxlen); - else - { - gsLargeInt_t temp1, temp2, temp3; - l_word halfLen = (l_word)(length>>1); - - temp1.mLength = 0; - temp2.mLength = 0; - temp3.mLength = 0; - - //printf("Karasuba splitting at %d (1/2 = %d)\r\n", length, halfLen); - - // Karatsuba: k = 12*34 - // a = (1*3) - // b = (1+2)*(3+4)-a-c - // c = (2*4) - // k = a*B^N+b*B^(N/2)+c = a*100+b*10+c - - // Enter the recursive portion - // TH = top half - // BH = bottom half - - // Note that since (a*B^N + c) cannot overlap, we can immediately store both in dest - - // Compute a. (TH of data1 * TH of data2) - // Stores in TH of dest, so later *B^N isn't necessary - // For the example, this puts 1*3 into the high half 03xx - gsiLargeIntKMult(&data1[halfLen], &data2[halfLen], halfLen, &dest[length], lenout, (l_word)(maxlen-length)); - //printf("Calculated A (%d) = ", *lenout); - //gsiLargeIntPrint(&dest[length], *lenout); - - // Compute c. (BH of data1 * BH of data2) - // For the example, this puts 2*4 into the low half xx08 - gsiLargeIntKMult(data1, data2, halfLen, dest, lenout, maxlen); - //printf("Calculated C (%d) = ", *lenout); - //gsiLargeIntPrint(dest, *lenout); - - // Compute b1. (TH of data1 + BH of data1) - gsiLargeIntAdd(&data1[halfLen], halfLen, data1, halfLen, temp1.mData, &temp1.mLength, GS_LARGEINT_MAX_DIGITS); - //printf("Calculated B1 (%d) = ", temp1.mLength); - //gsiLargeIntPrint(temp1.mData, temp1.mLength); - - // Compute b2. (TH of data2 + BH of data2) - gsiLargeIntAdd(&data2[halfLen], halfLen, data2, halfLen, temp2.mData, &temp2.mLength, GS_LARGEINT_MAX_DIGITS); - //printf("Calculated B2 (%d) = ", temp2.mLength); - //gsiLargeIntPrint(temp2.mData, temp2.mLength); - - // Compute b3. (b1*b2) (*B^N) - // For the example, (1+2)(3+4)*B^N = 21*B^N = 0210 - memset(&temp3, 0, sizeof(gsLargeInt_t)); - - // May require resizing, but don't go above halfLen - if (temp1.mLength > halfLen || temp2.mLength > halfLen) - gsiLargeIntMult(temp1.mData, temp1.mLength, temp2.mData, temp2.mLength, &temp3.mData[halfLen], &temp3.mLength, (l_word)(GS_LARGEINT_MAX_DIGITS-halfLen)); - else - { - gsi_bool result = gsiLargeIntSizePower2(&temp1, &temp2, lenout); - if (gsi_is_false(result)) - return gsi_false; // could not resize - gsiLargeIntResize(&temp1, *lenout); // pad to new size - gsiLargeIntResize(&temp2, *lenout); // pad to new size - gsiLargeIntKMult(temp1.mData, temp2.mData, *lenout, &temp3.mData[halfLen], &temp3.mLength, (l_word)(GS_LARGEINT_MAX_DIGITS-halfLen)); - } - temp3.mLength = (l_word)(temp3.mLength + halfLen); // fix length for temp3 - //if (temp3.mLength > GS_LARGEINT_INT_SIZE) - // _asm {int 3} // this should be at most temp1.mLength+temp2.mLength - memset(temp3.mData, 0, halfLen*sizeof(l_word)); - //printf("Calculated B3 (%d) = ", temp3.mLength); - //gsiLargeIntPrint(&temp3.mData[halfLen], temp3.mLength-halfLen); - - // Compute final b. (b3-a-c) (*B^N) - // Note: The subtraction is in terms of (*B^N) - // For the example, 021x - 03x - 08x = 0100 - gsiLargeIntSub(&dest[length], length, &temp3.mData[halfLen], (l_word)(temp3.mLength-halfLen), &temp3.mData[halfLen], &temp3.mLength); - temp3.mLength = (l_word)(temp3.mLength + halfLen); - gsiLargeIntSub( dest , length, &temp3.mData[halfLen], (l_word)(temp3.mLength-halfLen), &temp3.mData[halfLen], &temp3.mLength); - temp3.mLength = (l_word)(temp3.mLength + halfLen); - //printf("Calculated B (%d) = ", temp3.mLength); - //gsiLargeIntPrint(temp3.mData, temp3.mLength); - - // Add em up - // Dest already contains A+C, so Add B - // For the example, 0308 + 0100 = 0408 (the correct answer) - gsiLargeIntAdd(dest, (l_word)(length*2), temp3.mData, temp3.mLength, dest, lenout, maxlen); - } - // strip leading zeroes from dest - while(*lenout > 0 && dest[*lenout-1] == 0) - *lenout = (l_word)(*lenout-1); - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsLargeIntSquareMod(const gsLargeInt_t *lint, const gsLargeInt_t *mod, gsLargeInt_t *dest) -{ - int i = 0; - int k = 0; - int len = (int)lint->mLength; // signed version - l_dword carry = 0; - int oldShiftBit = 0; - int newShiftBit = 0; - gsi_bool result = gsi_false; - unsigned int mask = (unsigned int)1<<(GS_LARGEINT_DIGIT_SIZE_BITS-1); - - l_word squareSums[GS_LARGEINT_MAX_DIGITS*2]; // temp dest for square sums - l_word otherSums[GS_LARGEINT_MAX_DIGITS*2]; // temp dest for other sums - l_word squareLen = 0; - l_word otherLen = 0; - - GSLINT_ENTERTIMER(GSLintTimerSquareMod); - - memset(&squareSums, 0, sizeof(squareSums)); - memset(&otherSums, 0, sizeof(otherSums)); - - // Go through each digit, multiplying with each other digit - // (only do this once per pair, since AB == BA) - // Ex: ABC * ABC, we want AB,AC,BC only - for (i=1; i < len; i++) - { - for(k=0; k < i; k++) - { - carry += (l_dword)lint->mData[i]*lint->mData[k] + otherSums[i+k]; - otherSums[i+k] = (l_word)carry; - carry = carry >> GS_LARGEINT_DIGIT_SIZE_BITS; - } - if(carry) - { - otherSums[i+k] = (l_word)carry; - carry = carry >> GS_LARGEINT_DIGIT_SIZE_BITS; - } - } - - // Multiply by 2 (because each internal pair appears twice) - for (i=0; i < (2*len); i++) - { - newShiftBit = (otherSums[i] & mask)==mask?1:0; // calc next carry 1 or 0 - otherSums[i] = (l_word)((otherSums[i] << 1) + oldShiftBit); // do the shift - oldShiftBit = newShiftBit; - } - // don't worry about left-overy carry because this can't overflow - // maxlen N-digit*N-digit = 2n-digit - - // Go through each digit, multiplying with itself - for (i=0; i mData[i] * lint->mData[i]; - squareSums[i*2] = (l_word)carry; - squareSums[i*2+1] = (l_word)(carry >> GS_LARGEINT_DIGIT_SIZE_BITS); - } - squareLen = (l_word)(2*len); - otherLen = (l_word)(2*len); - - // Add the two together - result = gsiLargeIntAdd(otherSums, otherLen, squareSums, squareLen, squareSums, &squareLen, GS_LARGEINT_MAX_DIGITS*2); - result = gsiLargeIntDiv(squareSums, squareLen, mod, NULL, dest); - - GSLINT_EXITTIMER(GSLintTimerSquareMod); - return result; -} - -//#define NEWEXP -#ifdef NEWEXP - -//#define printf - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Montgomery exponentiation (see HAC 14.94) -// -// SPECIAL NOTE: -// A small public exponent will reduce the load on client encryption. -// (below 65535 is a security risk, so don't go too small) -gsi_bool gsLargeIntPowerMod(const gsLargeInt_t *b, const gsLargeInt_t *p, const gsLargeInt_t *m, gsLargeInt_t *dest) -{ - gsLargeInt_t base; - gsLargeInt_t power; - gsLargeInt_t mod; - gsLargeInt_t one; - - gsi_u32 expHighBit; // highest bit set in exponent; - - int i = 0; // temp / counter - int k = 0; // binary size of our subdigits - int pow2k = 0; // 2^k - int kmask = 0; // 2^k-1 - int kdigits = 0; // number of k-sized digits in p - //int leadingZeroBits = 0; // to make p evenly divisible by k - - l_word modPrime; - gsLargeInt_t R; // "R" as used in the montgomery exponentiation algorithm. - //gsLargeInt_t Rmod; // R mod n - //gsLargeInt_t R2mod; // R^2 mod n - - gsLargeInt_t * lut = NULL; - - GSLINT_ENTERTIMER(GSLintTimerPowerMod); - - memcpy(&base, b, sizeof(base)); - memcpy(&power, p, sizeof(power)); - memcpy(&mod, m, sizeof(mod)); - memset(&R, 0, sizeof(R)); - - gsLargeIntSetValue(&one, 1); - - // Catch the unusual cases - if (mod.mLength == 0) - { - // mod 0 = undefined - dest->mLength = 0; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - else if (mod.mLength==1 && mod.mData[0]==1) - { - // mod 1 = 0 - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_true; - } - else if (power.mLength == 0) - { - // x^0 = 1 - dest->mLength = 1; - dest->mData[0] = 1; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_true; - } - else if ((mod.mData[0]&1) == 0) - { - // Montgomery only works with odd modulus! - // (rsa modulus is prime1*prime2, which must be odd) - dest->mLength = 0; - dest->mData[0] = 0; - //_asm {int 3} - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - // If base is larger than mod, we can (must) reduce it - if (gsiLargeIntCompare(base.mData, base.mLength, mod.mData, mod.mLength)!=-1) - { - gsLargeIntDiv(&base, &mod, NULL, &base); - } - if (base.mLength == 0) - { - // 0^e = 0 - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_true; - } - - // find the highest bit set in power - expHighBit=GS_LARGEINT_DIGIT_SIZE_BITS; - while(((1<<(expHighBit-1))&power.mData[power.mLength-1]) == 0) - expHighBit--; - expHighBit += ((power.mLength-1) * GS_LARGEINT_DIGIT_SIZE_BITS); // add in 32 bits for each extra byte - - // The previous algorithm used 1-bit digits - // This algorithm uses k-bit digits - // Determine the optimal size for k - k=8; // this will support up to 4096 bit encryption (and probably higher) - while ( (k > 1) && - (gsi_u32)((k - 1) * (k << ((k - 1) << 1)) / ((1 << k) - k - 1)) >= expHighBit - 1 - ) - { - --k; - } - pow2k = 1 << k; - kmask = pow2k-1; - kdigits = (expHighBit+(k-1)) / k; // ceiling(expHighBit/k) - - // calculate "R" (if mod=5678, R=10000 e.g. One digit higher) - memset(&R, 0, sizeof(R)); - R.mLength = (l_word)(mod.mLength+1); - if (R.mLength > GS_LARGEINT_MAX_DIGITS) - return gsi_false; // you need to increase the large int capacity - R.mData[R.mLength-1] = 1; // set first bit one byte higher than mod - - // find the multiplicative inverse of mod - gsiLargeIntInverseMod(&mod, &modPrime); - -/* - // calculate Rmod (R%mod) - if (gsi_is_false(gsLargeIntDiv(&R, &mod, NULL, &Rmod))) - { - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - - // calculate R2mod (R^2%mod = (Rmod*Rmod)%mod) - if (gsi_is_false(gsLargeIntSquareMod(&Rmod, &mod, &R2mod))) - { - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } -*/ - // Allocate space for a table of values that will come up repeatedly - // xwiggle is (br mod n) - // These are the odd powers of xwiggle, x^3, x^5 and so on - // We generate these by repeated multiplications by xwiggle - //if (k >= 3) - { - // no no no[0] = xwiggle^3 (montgomery multiply [2]*[1]) - // no no no[1] = xwiggle^5 (montgomery multiply [2]*[3]) - // no no no[2] = xwiggle^7 (montgomery multiply [2]*[5]) - - // allocate space - // ~1k for typical small RSA public exponents (e.g. 65537) - // ~16k for 1024-bit RSA exponent - // ~32k for 2048-bit RSA exponent - // ~64k for 4096-bit RSA exponent - int i=0; - int valuesNeeded = pow2k;//((pow2k/2)-1); - int spaceneeded = sizeof(gsLargeInt_t) * valuesNeeded; - - lut = (gsLargeInt_t*)gsimalloc(spaceneeded); - if (lut == NULL) - return gsi_false; // out of memory - memset(lut, 0x00, spaceneeded); - - // set first values - // [0] = 1 - // [1] = br mod n (normal multiplication) - // [i] = mont([1] * [i-1]) - gsLargeIntSetValue(&lut[0], 1); - if (gsi_is_false(gsLargeIntMult(&base, &R, &lut[1])) || - gsi_is_false(gsLargeIntDiv(&lut[1], &mod, NULL, &lut[1])) ) - { - gsifree(lut); - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - - // fill in the values - for (i=2; i < valuesNeeded; i++) - { - if (gsi_is_false(gsiLargeIntMultM(&lut[1], &lut[i-1], &mod, modPrime, &lut[i])) ) - { - gsifree(lut); - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - } - } - - // set starting point - if (gsi_is_false(gsLargeIntMult(&base, &R, dest)) || // Normal multiply - gsi_is_false(gsLargeIntDiv(dest, &mod, NULL, dest)) ) // A mod operation - { - gsifree(lut); - return gsi_false; - } - - // loop through the k-sized digits - for (i=0; i < kdigits; i++) - { - int bitReadIndex = expHighBit - (i*k); // index of the bit we're reading - int l_index; // = ((bitReadIndex-1)/GS_LARGEINT_DIGIT_SIZE_BITS); // -1 to use zero based indexes - int l_firstbit; - l_dword twodigits; - l_dword mask; - l_word digitval; - - l_index = ((bitReadIndex-1)/GS_LARGEINT_DIGIT_SIZE_BITS); // -1 to use zero based indexes - - // for first digit, use leading zeroes when necessary - if ((bitReadIndex % k) != 0) - bitReadIndex += k - (bitReadIndex % k); // round up to next k - if (i != 0) - { - if (bitReadIndex - (l_index*GS_LARGEINT_DIGIT_SIZE_BITS)> GS_LARGEINT_DIGIT_SIZE_BITS) - l_index++; - } - - if (i==0) - { - // first digit - l_firstbit = l_index * GS_LARGEINT_DIGIT_SIZE_BITS; // first bit of this digit - twodigits = p->mData[l_index]; - } - else if (l_index > 0) - { - // middle digits - l_firstbit = (l_index-1) * GS_LARGEINT_DIGIT_SIZE_BITS; // first bit of this digit - twodigits = (l_dword)((l_dword)p->mData[l_index] << GS_LARGEINT_DIGIT_SIZE_BITS) | p->mData[l_index-1]; - } - else if (l_index == 0 && p->mLength > 1) - { - // final digit, when there are proceeding digits - l_firstbit = 0; - twodigits = (l_dword)(p->mData[l_index+1] << GS_LARGEINT_DIGIT_SIZE_BITS) | p->mData[l_index]; - } - else - { - // final digit, no proceeding digits - l_firstbit = l_index * GS_LARGEINT_DIGIT_SIZE_BITS; // first bit of this digit - twodigits = p->mData[l_index]; - } - mask = (l_dword)kmask << (bitReadIndex-l_firstbit-k); - digitval = (l_word)((twodigits & mask) >> (bitReadIndex-l_firstbit-k)); - - // use digitval to determine how many squaring and multiplication operations we need to perform - { - static int twotab[] = - {0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, - 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, - 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, - 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, - 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; - - - static USHORT oddtab[] = - {0, 1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 11, 3, 13, 7, 15, 1, 17, 9, 19, 5, 21, 11, 23, 3, 25, 13, 27, 7, 29, 15, 31, 1, - 33, 17, 35, 9, 37, 19, 39, 5, 41, 21, 43, 11, 45, 23, 47, 3, 49, 25, 51, 13, 53, 27, 55, 7, 57, 29, 59, 15, - 61, 31, 63, 1, 65, 33, 67, 17, 69, 35, 71, 9, 73, 37, 75, 19, 77, 39, 79, 5, 81, 41, 83, 21, 85, 43, 87, 11, - 89, 45, 91, 23, 93, 47, 95, 3, 97, 49, 99, 25, 101, 51, 103, 13, 105, 53, 107, 27, 109, 55, 111, 7, 113, - 57, 115, 29, 117, 59, 119, 15, 121, 61, 123, 31, 125, 63, 127, 1, 129, 65, 131, 33, 133, 67, 135, 17, - 137, 69, 139, 35, 141, 71, 143, 9, 145, 73, 147, 37, 149, 75, 151, 19, 153, 77, 155, 39, 157, 79, 159, - 5, 161, 81, 163, 41, 165, 83, 167, 21, 169, 85, 171, 43, 173, 87, 175, 11, 177, 89, 179, 45, 181, 91, - 183, 23, 185, 93, 187, 47, 189, 95, 191, 3, 193, 97, 195, 49, 197, 99, 199, 25, 201, 101, 203, 51, 205, - 103, 207, 13, 209, 105, 211, 53, 213, 107, 215, 27, 217, 109, 219, 55, 221, 111, 223, 7, 225, 113, - 227, 57, 229, 115, 231, 29, 233, 117, 235, 59, 237, 119, 239, 15, 241, 121, 243, 61, 245, 123, 247, 31, - 249, 125, 251, 63, 253, 127, 255}; - - - //printf("[gsint] Digit %d = %d\r\n", i, digitval); - if (i==0) - { - int counter = 0; - - memcpy(dest, &lut[oddtab[digitval]], sizeof(gsLargeInt_t)); - //printf("[gsint] Set start to %d\r\n", dest->mData[0]); - - for (counter = twotab[digitval]; counter> 0; counter--) - { - if (gsi_is_false(gsiLargeIntMultM(dest,dest, &mod, modPrime, dest))) - { - gsifree(lut); - return gsi_false; - } - //printf("[gsint] First digit, squared to %d\r\n", dest->mData[0]); - } - } - else if (digitval != 0) - { - int counter = 0; - int lutindex = oddtab[digitval]; // we only precalculate the odd powers - //int lutindex = (oddtab[digitval]+1)/2; // we only precalculate the odd powers - - for (counter = (int)(k-twotab[digitval]); counter> 0; counter--) - { - if (gsi_is_false(gsiLargeIntMultM(dest,dest, &mod, modPrime, dest))) - { - gsifree(lut); - return gsi_false; - } - //printf("[gsint] Squared to %d\r\n", dest->mData[0]); - } - - if (gsi_is_false(gsiLargeIntMultM(dest, &lut[lutindex], &mod, modPrime, dest))) - { - gsifree(lut); - return gsi_false; - } - //printf("[gsint] Mult by [%d](%d) to %d\r\n", lutindex, lut[lutindex].mData[0], dest->mData[0]); - for (counter = twotab[digitval]; counter> 0; counter--) - { - if (gsi_is_false(gsiLargeIntMultM(dest,dest, &mod, modPrime, dest))) - { - gsifree(lut); - return gsi_false; - } - //printf("[gsint] Squared to %d\r\n", dest->mData[0]); - } - } - else - { - int counter = 0; - for (counter = k; counter > 0; counter--) - { - if (gsi_is_false(gsiLargeIntMultM(dest,dest, &mod, modPrime, dest))) - { - gsifree(lut); - return gsi_false; - } - //printf("[gsint] Squared to %d\r\n", dest->mData[0]); - } - } - } - } - - // normalize (MultM by 1) - if (gsi_is_false(gsiLargeIntMultM(dest, &one, &mod, modPrime, dest))) - return gsi_false; - - gsifree(lut); - return gsi_true; -} - -#else - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Montgomery exponentiation (see HAC 14.94) -// -// SPECIAL NOTE: -// A small public exponent will reduce the load on client encryption. -// (below 65535 is a security risk, so don't go too small) -gsi_bool gsLargeIntPowerMod(const gsLargeInt_t *b, const gsLargeInt_t *p, const gsLargeInt_t *m, gsLargeInt_t *dest) -{ - int i=0; // temp/counter - int digitNum=0; // temp/counter - int digitBit=0; - - l_word modPrime; - - gsi_u32 expHighBit; // highest bit set in exponent; - - gsLargeInt_t R; // "R" as used in the montgomery exponentiation algorithm. - gsLargeInt_t Rmod; // R%mod - gsLargeInt_t R2mod; // R^2%mod - gsLargeInt_t temp; - gsLargeInt_t xwiggle; // montgomery mult of (x,R2mod) - - gsLargeInt_t base; - gsLargeInt_t power; - gsLargeInt_t mod; - - GSLINT_ENTERTIMER(GSLintTimerPowerMod); - - memset(&R, 0, sizeof(R)); - memset(&Rmod, 0, sizeof(Rmod)); - memset(&R2mod, 0, sizeof(R2mod)); - memset(&temp, 0, sizeof(temp)); - memset(&xwiggle, 0, sizeof(xwiggle)); - - memcpy(&base, b, sizeof(base)); - memcpy(&power, p, sizeof(power)); - memcpy(&mod, m, sizeof(mod)); - - gsiLargeIntStripLeadingZeroes(&base); - gsiLargeIntStripLeadingZeroes(&power); - gsiLargeIntStripLeadingZeroes(&mod); - - // Catch the unusual cases - if (mod.mLength == 0) - { - // mod 0 = undefined - dest->mLength = 0; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - else if (mod.mLength==1 && mod.mData[0]==1) - { - // mod 1 = 0 - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_true; - } - else if (power.mLength == 0) - { - // x^0 = 1 - dest->mLength = 1; - dest->mData[0] = 1; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_true; - } - else if ((mod.mData[0]&1) == 0) - { - // Montgomery only works with odd modulus! - // (rsa modulus is prime1*prime2, which must be odd) - dest->mLength = 0; - dest->mData[0] = 0; - //_asm {int 3} - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - // If base is larger than mod, we can (must) reduce it - if (gsiLargeIntCompare(base.mData, base.mLength, mod.mData, mod.mLength)!=-1) - { - gsLargeIntDiv(&base, &mod, NULL, &base); - } - if (base.mLength == 0) - { - // 0^e = 0 - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_true; - } - - // find the highest bit set in power - expHighBit=GS_LARGEINT_DIGIT_SIZE_BITS; - while(((1<<(expHighBit-1))&power.mData[power.mLength-1]) == 0) - expHighBit--; - expHighBit += ((power.mLength-1) * GS_LARGEINT_DIGIT_SIZE_BITS); // add in 32 bits for each extra byte - - // On to the tricky tricky! - // 1) We can't compute B^P and later apply the mod; B^P is just too big - // So we have to make modular reductions along the way - // 2) Since modular reduction is essentially a division, we would like - // to use a mod 2^E so that division is just a bit strip. - // ex. (1383 mod 16) = binary(0000010101100111 mod 00010000) = 00000111 = dec 7 - - // Precalculate some values that will come up repeatedly - - // calculate "R" (if mod=5678, R=10000 e.g. One digit higher) - memset(&R, 0, sizeof(R)); - R.mLength = (l_word)(mod.mLength+1); - if (R.mLength > GS_LARGEINT_MAX_DIGITS) - return gsi_false; // you need to increase the large int capacity - R.mData[R.mLength-1] = 1; // set first bit one byte higher than mod - - // find the multiplicative inverse of mod - gsiLargeIntInverseMod(&mod, &modPrime); - - // calculate Rmod (R%mod) - if (gsi_is_false(gsLargeIntDiv(&R, &mod, NULL, &Rmod))) - { - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - - // calculate R2mod (R^2%mod = (Rmod*Rmod)%mod) - if (gsi_is_false(gsLargeIntSquareMod(&Rmod, &mod, &R2mod))) - { - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - - // calculate xwiggle - if (gsi_is_false(gsiLargeIntMultM(&base, &R2mod, &mod, modPrime, &xwiggle))) - { - GSLINT_EXITTIMER(GSLintTimerPowerMod); - return gsi_false; - } - - // loop through the BITS of power - // if the bit is 1, perform a multiplication by xwiggle? (11/2/2006) - // TODO: THIS DOESN'T WORK IF THE HIGHBIT IS EVER ABOVE GS_LARGEINT_DIGIT_SIZE_BITS - memcpy(dest, &Rmod, sizeof(gsLargeInt_t)); // start dest at Rmod - for (i=(int)(expHighBit-1); i>=0; i--) - { - // mont square the current total - gsiLargeIntMultM(dest, dest, &mod, modPrime, dest); - digitNum = (gsi_i32)(i/GS_LARGEINT_DIGIT_SIZE_BITS); // which digit to extract a bit from? - digitBit = (gsi_i32)(i % GS_LARGEINT_DIGIT_SIZE_BITS); // which bit to extract from that digit? - //if ((power.mData[k] & (1<mLength; - - memset(temp, 0, sizeof(temp)); - - if (gsi_is_false(gsiLargeIntMult(x->mData, x->mLength, y->mData, y->mLength, temp, &tempLen, GS_LARGEINT_MAX_DIGITS*2))) - return gsi_false; - - lasttnptr = &temp[m->mLength-1]; - lastnptr = &m->mData[m->mLength-1]; - - if (tempLen < m->mLength*2) - { - memset(&temp[tempLen], 0, (m->mLength*2 - tempLen) * GS_LARGEINT_DIGIT_SIZE_BYTES); - //memset(&temp[tempLen], 0, sizeof(temp) - tempLen * GS_LARGEINT_DIGIT_SIZE_BYTES); // safer to clear out the whole thing? - tempLen = (l_word)(m->mLength*2); - } - - for (tptr = &temp[0]; tptr <= lasttnptr; tptr++) - { - carry = 0; - mi = (l_word)((l_dword)modPrime * (l_dword)*tptr); - tiptr = tptr; - for (nptr = &m->mData[0]; nptr <= lastnptr; nptr++, tiptr++) - { - carry = (l_dword)mi * (l_dword)*nptr + - (l_dword)*tiptr + (l_dword)(l_word)(carry >> GS_LARGEINT_DIGIT_SIZE_BITS); - *tiptr = (l_word)(carry); - } - - // apply the carry value - for (; ((carry >> GS_LARGEINT_DIGIT_SIZE_BITS) > 0) && tiptr <= &temp[tempLen-1]; tiptr++) - { - *tiptr = (l_word)(carry = (l_dword)*tiptr + (l_dword)(l_word)(carry >> GS_LARGEINT_DIGIT_SIZE_BITS)); - } - - // If we still have a carry, increase the length of temp - if (((carry >> GS_LARGEINT_DIGIT_SIZE_BITS) > 0)) - { - *tiptr = (l_word)(carry >> GS_LARGEINT_DIGIT_SIZE_BITS); - tempLen++; - } - } - - // **WARNING** - // Bytes from the plain text message may appear within the temporary buffer. - // These bytes should be cleared to prevent bugs where that data may be exposed. (buffer overrun?) - if (gsiLargeIntCompare(&temp[logB_r], tempLen - logB_r, m->mData, m->mLength) != -1) - { - if (gsi_is_false(gsiLargeIntSub(m->mData, m->mLength, &temp[logB_r], tempLen - logB_r, dest->mData, &dest->mLength))) - { - memset(temp, 0, sizeof(temp)); - memset(dest, 0, sizeof(gsLargeInt_t)); - return gsi_false; - } - } - else - { - memset(dest, 0, sizeof(gsLargeInt_t)); - dest->mLength = m->mLength; - memcpy(dest->mData, &temp[logB_r], (tempLen - logB_r)*GS_LARGEINT_DIGIT_SIZE_BYTES); - memset(temp, 0, sizeof(temp)); - } - - return gsi_true; -} - -#else - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Montgomery multiplication -// Computes (src1*src2*r^-1)%mod -// Note: -// This implementation is based on HAC14.36 which has a lot of room for improvement -// FLINT algorithm runs approx 30 times faster. -gsi_bool gsiLargeIntMultM(gsLargeInt_t *x, gsLargeInt_t *y, const gsLargeInt_t *m, gsi_u32 modPrime, gsLargeInt_t *dest) -{ - int i=0; - l_dword xiy0; - l_word u = 0; - - gsLargeInt_t A; - gsLargeInt_t xiy; - gsLargeInt_t temp; - - GSLINT_ENTERTIMER(GSLintTimerMultM); - - gsiLargeIntStripLeadingZeroes(x); - gsiLargeIntStripLeadingZeroes(y); - - // Check inputs - i=(int)(m->mLength); - while(i>0 && m->mData[i-1]==0) - i--; - if (i==0) - { - // modulus is zero, answer undefined - dest->mData[0] = 0; - dest->mLength = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_false; - } - if (x->mLength==0) - { - // x == 0 - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_true; - } - if (y->mLength==0) - { - // y == 0 - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_true; - } - - // We pad with zeroes so that we don't have to check for overruns in the loop below - // (note: resize will not remove non-zero digits from x or y) - gsiLargeIntResize(x, m->mLength); - gsiLargeIntResize(y, m->mLength); - - // Continue with the Multiplication - memset(&A, 0, sizeof(A)); - memset(&temp, 0, sizeof(temp)); - memset(&xiy, 0, sizeof(xiy)); - - for (i=0; (gsi_u32)i < m->mLength; i++) - { - xiy0 = (l_dword)x->mData[i]*y->mData[0]; // y[0], NOT y[i] !! - u = (l_word)((xiy0+A.mData[0])*modPrime); // strip bits over the first digit - - // A = (A+x[i]*y + u[i]*m)/b - // compute x[i]*y - memset(temp.mData, 0, y->mLength*sizeof(l_word)); // clear out a portion of temp - temp.mData[0] = x->mData[i]; - temp.mLength = y->mLength; // xi padded with zeroes - if (gsi_is_false(gsiLargeIntMult(temp.mData, temp.mLength, y->mData, y->mLength, xiy.mData, &xiy.mLength, GS_LARGEINT_MAX_DIGITS))) - { - // overflow - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_false; - } - // compute u[i]*m - memset(temp.mData, 0, m->mLength*sizeof(l_word)); // clear out a portion of temp - temp.mData[0] = u; - temp.mLength = m->mLength; - //if (gsi_is_false(gsiLargeIntMult(temp.mData, temp.mLength, m->mData, m->mLength, temp.mData, &temp.mLength))) - if (gsi_is_false(gsLargeIntKMult(&temp, m, &temp))) - { - // overflow - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_false; - } - // Add both to A - if (gsi_is_false(gsiLargeIntAdd(xiy.mData, xiy.mLength, A.mData, A.mLength, A.mData, &A.mLength, GS_LARGEINT_MAX_DIGITS))) - { - // overflow - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_false; - } - if (gsi_is_false(gsiLargeIntAdd(temp.mData, temp.mLength, A.mData, A.mLength, A.mData, &A.mLength, GS_LARGEINT_MAX_DIGITS))) - { - // overflow - dest->mLength = 0; - dest->mData[0] = 0; - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_false; - } - // Divide by b (e.g. Remove first digit from A) - if (A.mLength > 1) - { - memmove(&A.mData[0], &A.mData[1], (A.mLength-1)*sizeof(l_word)); - A.mData[A.mLength-1] = 0; - A.mLength--; - } - else - { - A.mLength = 0; - A.mData[0] = 0; - } - } - - //if (A >= m then subtract another m) - if (gsiLargeIntCompare(A.mData, A.mLength, m->mData, m->mLength)!=-1) - gsiLargeIntSub(m->mData, m->mLength, A.mData, A.mLength, dest->mData, &dest->mLength); - else - memcpy(dest, &A, sizeof(A)); - GSLINT_EXITTIMER(GSLintTimerMultM); - return gsi_true; -} - -#endif -/* -// Computes (src*src*r^-1)%mod -static gsi_bool gsiLargeIntSquareM(const gsLargeInt_t *src, const gsLargeInt_t *mod, gsi_u32 modPrime, gsi_u32 R, gsLargeInt_t *dest) -{ - GSI_UNUSED(src); - GSI_UNUSED(mod); - GSI_UNUSED(modPrime); - GSI_UNUSED(R); - GSI_UNUSED(dest); - assert(0); - return gsi_true; -}*/ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Calculate multiplicative inverse of mod, (-mod^-1 mod 2^R) -// ala. Dusse and Kaliski, extended Euclidean algorithm -gsi_bool gsiLargeIntInverseMod(const gsLargeInt_t *mod, l_word *dest) -{ - l_dword x=2; - l_dword y=1; - l_dword check = 0; - - gsi_u32 i; - for (i = 2; i <= GS_LARGEINT_DIGIT_SIZE_BITS; i++) - { - check = (l_dword)mod->mData[0] * (l_dword)y; - if (x < (check & ((x<<1)-1))) - y += x; - x = x << 1; - } - *dest = (l_word)(x-y); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsLargeIntPrint(FILE* logFile, const gsLargeInt_t *lint) -{ - return gsiLargeIntPrint(logFile, lint->mData, lint->mLength); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsiLargeIntPrint(FILE* logFile, const l_word *data, l_word length) -{ -// this is only specific to NITRO since for other platforms the fprintf will -// resolve to a STDOUT -#if !defined(_NITRO) - while(length >0) - { - fprintf(logFile, "%08X", data[length-1]); - length--; - } - fprintf(logFile, "\r\n"); - return gsi_true; -#else - GSI_UNUSED(logFile); - GSI_UNUSED(data); - GSI_UNUSED(length); - return gsi_false; -#endif -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// stream of bytes, big endian. (first byte = most significant digit) -gsi_bool gsLargeIntSetFromHexString(gsLargeInt_t *lint, const char* hexstream) -{ - l_word* writePos = lint->mData; - gsi_u32 temp; - int len = 0; - int byteIndex = 0; - - GS_ASSERT(hexstream != NULL); - - len = (int)strlen(hexstream); - if (len == 0) - { - lint->mLength = 0; - lint->mData[0] = 0; - return gsi_true; - } - if ((len/2) > (GS_LARGEINT_MAX_DIGITS*GS_LARGEINT_DIGIT_SIZE_BYTES)) - return gsi_false; - - // 2 characters per byte, 4 bytes per integer - lint->mLength = (l_word)((len+(2*GS_LARGEINT_DIGIT_SIZE_BYTES-1))/(2*GS_LARGEINT_DIGIT_SIZE_BYTES)); - lint->mData[lint->mLength-1] = 0; // set last byte to zero for left over characters - - while(len > 0) - { - if(len >= 2) - sscanf((char*)(hexstream+len-2), "%02x", &temp); // sscanf requires a 4 byte dest - else - sscanf((char*)(hexstream+len-1), "%01x", &temp); // sscanf requires a 4 byte dest - if(byteIndex == 0) - *writePos = 0; - *writePos |= (temp << (byteIndex * 8)); - if(++byteIndex == GS_LARGEINT_DIGIT_SIZE_BYTES) - { - writePos++; - byteIndex = 0; - } - len-=min(2,len); - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Reverse bytes in a LINT, which are LittleEndian -// ex: Packing an RSA message of which the first bytes are 0x00 0x02 -// The first bytes of the packet must become the MSD of the LINT -gsi_bool gsLargeIntReverseBytes(gsLargeInt_t *lint) -{ -#if defined(GSI_LITTLE_ENDIAN) - char *left = (char*)&lint->mData[0]; - char *right = ((char*)&lint->mData[lint->mLength])-1; - char temp; -#else - l_word *left = lint->mData; - l_word *right = lint->mData + (lint->mLength - 1); - l_word temp; -#endif - - - if (lint->mLength == 0) - return gsi_true; - - while(left < right) - { - temp = *left; - (*left++) = (*right); - (*right--) = temp; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// hashing is made complicated by differing byte orders -void gsLargeIntAddToMD5(const gsLargeInt_t * _lint, MD5_CTX * md5) -{ - int byteLength = 0; - gsi_u8 * dataStart = NULL; - - // Create a non-const copy so we can reverse bytes to add to the MD5 hash - gsLargeInt_t lint; - memcpy(&lint, _lint, sizeof(lint)); - - // first, calculate the byte length - byteLength = (int)gsLargeIntGetByteLength(&lint); - if (byteLength == 0) - return; // no data - - dataStart = (gsi_u8*)lint.mData; - if ((byteLength % GS_LARGEINT_DIGIT_SIZE_BYTES) != 0) - dataStart += GS_LARGEINT_DIGIT_SIZE_BYTES - (byteLength % GS_LARGEINT_DIGIT_SIZE_BYTES); - - // reverse to big-endian (MS) then hash - gsLargeIntReverseBytes(&lint); - MD5Update(md5, dataStart, (unsigned int)byteLength); - gsLargeIntReverseBytes(&lint); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Length in bytes so leading zeroes can be dropped from hex strings -gsi_u32 gsLargeIntGetByteLength(const gsLargeInt_t *lint) -{ - int intSize = (int)lint->mLength; - int byteSize = 0; - int i=0; - l_word mask = 0xFF; - - // skip leading zeroes - while(intSize > 0 && lint->mData[intSize-1] == 0) - intSize --; - if (intSize == 0) - return 0; // no data - - byteSize = intSize * (gsi_i32)sizeof(l_word); - - // subtract bytes for each leading 0x00 byte - mask = 0xFF; - for (i=1; i < GS_LARGEINT_DIGIT_SIZE_BYTES; i++) - { - if (lint->mData[intSize-1] <= mask) - { - byteSize -= sizeof(l_word)-i; - break; - } - mask = (l_word)((mask << 8) | 0xFF); - } - - return (gsi_u32)byteSize; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Creates a large int from a byte buffer -// Essentially, constructs the array of digits in appropriate byte order -gsi_bool gsLargeIntSetFromMemoryStream(gsLargeInt_t *lint, const gsi_u8* data, gsi_u32 len) -{ - lint->mData[0] = 0; - memcpy(((char*)lint->mData)+(4-len%4)%4, data, len); - - // Set length to ceiling of len/digit_size - lint->mLength = (unsigned int)((len+(GS_LARGEINT_DIGIT_SIZE_BYTES-1))/GS_LARGEINT_DIGIT_SIZE_BYTES); - - return gsLargeIntReverseBytes(lint); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsLargeIntWriteToMemoryStream(const gsLargeInt_t *lint, gsi_u8* data) -{ - gsLargeInt_t copy; - memcpy(©, lint, sizeof(gsLargeInt_t)); - - gsLargeIntReverseBytes(©); - - memcpy(data, copy.mData, copy.mLength * GS_LARGEINT_DIGIT_SIZE_BYTES); - return gsi_true; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsLargeInt.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsLargeInt.h deleted file mode 100644 index 2ca665c75aa..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsLargeInt.h +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Large Integer Library -#ifndef __GSLARGEINT_H__ -#define __GSLARGEINT_H__ - -#include "gsCommon.h" -#include "gsXML.h" -#include "../md5.h" - - -#if defined(__cplusplus) -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// for simplicity, set the binary size to a value > gsCrypt.h binary size -#ifndef GS_LARGEINT_BINARY_SIZE -#define GS_LARGEINT_BINARY_SIZE (2048) // *BIT* size (divide by 8 for byte size) -#endif - - // !!!!!!WARNING!!!!!! Encryption is fastest when digit type is the default system type, (ex: gsi_u32 on 32bit processor) -#define GS_LARGEINT_DIGIT_TYPE gsi_u32 -#define GS_LARGEINT_DIGIT_LONG_TYPE gsi_u64 - -#define GS_LARGEINT_DIGIT_SIZE_BYTES (sizeof(GS_LARGEINT_DIGIT_TYPE)) -#define GS_LARGEINT_DIGIT_SIZE_BITS (GS_LARGEINT_DIGIT_SIZE_BYTES*8) - -// short forms for legibility -#define l_word GS_LARGEINT_DIGIT_TYPE -#define l_dword GS_LARGEINT_DIGIT_LONG_TYPE - -//#define GS_LARGEINT_BYTE_SIZE 32 // binary size of system data type -//#define GS_LARGEINT_INT_SIZE (GS_LARGEINT_BINARY_SIZE/GS_LARGEINT_BYTE_SIZE) // size in values -#define GS_LARGEINT_MAX_DIGITS (GS_LARGEINT_BINARY_SIZE / GS_LARGEINT_DIGIT_SIZE_BITS) - -#define GS_LARGEINT_KARATSUBA_CUTOFF 32 - -typedef struct gsLargeInt_s -{ - GS_LARGEINT_DIGIT_TYPE mLength; - GS_LARGEINT_DIGIT_TYPE mData[GS_LARGEINT_MAX_DIGITS]; -} gsLargeInt_t; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Commonly used functions -void gsLargeIntAddToMD5(const gsLargeInt_t * lint, MD5_CTX * md5); -gsi_bool gsLargeIntSetFromHexString(gsLargeInt_t *lint, const char* hexstring); -gsi_bool gsLargeIntPrint (FILE* logFile, const gsLargeInt_t *lint); -gsi_u32 gsLargeIntGetByteLength(const gsLargeInt_t *lint); - - // Modular exponentiation (and helpers) - // -- uses Montgomery exponentiation, reduction, multiplication -gsi_bool gsLargeIntPowerMod(const gsLargeInt_t *base, const gsLargeInt_t *power, const gsLargeInt_t *mod, gsLargeInt_t *dest); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsLargeIntSquareMod(const gsLargeInt_t *lint, const gsLargeInt_t *mod, gsLargeInt_t *dest); -gsi_bool gsLargeIntAdd (const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest); -gsi_bool gsLargeIntSub (const gsLargeInt_t *src1, const gsLargeInt_t *fromsrc2, gsLargeInt_t *dest); -gsi_bool gsLargeIntMult (const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest); -gsi_bool gsLargeIntDiv (const gsLargeInt_t *src1, const gsLargeInt_t *divisor, gsLargeInt_t *dest, gsLargeInt_t *remainder); - - //Karatsuba requires that the sizes be equal and a power of two -gsi_bool gsLargeIntKMult(const gsLargeInt_t *src1, const gsLargeInt_t *src2, gsLargeInt_t *dest); - - //This is useful when packing a BigEndian message directly into a LittleEndian lint buffer. -gsi_bool gsLargeIntReverseBytes(gsLargeInt_t *lint); -gsi_bool gsLargeIntSetValue(gsLargeInt_t *lint, l_word value); - - //These are necessary to preserve byte order when copying from array-of-int to char* -gsi_bool gsLargeIntSetFromMemoryStream(gsLargeInt_t *lint, const gsi_u8* data, gsi_u32 len); -gsi_bool gsLargeIntWriteToMemoryStream(const gsLargeInt_t *lint, gsi_u8* data); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} -#endif - -#endif // __GSLARGEINT_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsMemory.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsMemory.c deleted file mode 100644 index 8b615607b0b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsMemory.c +++ /dev/null @@ -1,1774 +0,0 @@ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsPlatform.h" -#include "gsPlatformUtil.h" -#include "gsMemory.h" -#include "gsAssert.h" -#include "gsDebug.h" - -#ifdef _PSP - #include -#endif - -// toDo: move some of this to platform.h -#ifdef _PS3 - #if(0) - typedef gsi_u64 gsi_uint; - #define PTR_ALIGNMENT 32 - #define GSI_64BIT (1) - #define GS_BIG_ENDIAN - #else - // changed as of SDK 0.8 Sony moved back to using 32 bit pointers - typedef gsi_u32 gsi_uint; - #define PTR_ALIGNMENT 16 - #define GSI_64BIT (0) - #define GS_BIG_ENDIAN - #endif -#else - typedef gsi_u32 gsi_uint; - #define PTR_ALIGNMENT 16 - #define GSI_64BIT (0) -#endif - - - -// To Do: -// Small block optimization using fixed size mempool. -// add multi-threaded support - -#define MEM_PROFILE (1) // if on additional memprofiling code will be enabled for such things as high water mark calcs -#if defined(MEM_PROFILE) - #define IF_MEM_PROFILE_ISON(a) a -#else - #define IF_MEM_PROFILE_ISON(a) -#endif - -// Disable compiler warnings for issues that are unavoidable. -///////////////////////////////////////////////////////////// -#if defined(_MSC_VER) // DevStudio - // Level4, "conditional expression is constant". - // Occurs with use of the MS provided macro FD_SET - #pragma warning ( disable: 4127 ) -#include -#endif // _MSC_VER - -#ifdef _WIN32 - #define MEM_MANAGER_CALL _cdecl -#else - #define MEM_MANAGER_CALL -#endif - -//#if !defined(_WIN32) -// #define MEM_MANAGER_DIRECT -//#endif - -typedef struct -{ - void* (MEM_MANAGER_CALL *malloc )(size_t size); - void (MEM_MANAGER_CALL *free )(void* ptr); - void* (MEM_MANAGER_CALL *realloc )(void* ptr, size_t size); - void* (MEM_MANAGER_CALL *memalign)(size_t boundary, size_t size); -}MemManagerCallbacks; - -static void* MEM_MANAGER_CALL _gsi_malloc(size_t size) -{ - return malloc(size); -} - -static void MEM_MANAGER_CALL _gsi_free(void* ptr) -{ - free(ptr); -} - -static void* MEM_MANAGER_CALL _gsi_realloc(void* ptr, size_t size) -{ - return realloc(ptr, size); -} - -#if defined(_PS2) || defined(_PSP) || defined(_PS3) - static void* _gsi_memalign(size_t boundary, size_t size) - { - return memalign(boundary, size); - } -#elif defined (_WIN32) - #if (_MSC_VER < 1300) - //extern added for vc6 compatability. - extern void* __cdecl _aligned_malloc(size_t size, int boundary); - #endif - static void* __cdecl _gsi_memalign(size_t boundary, size_t size) - { - return _aligned_malloc(size, (int)boundary); - } -#else - // no built in system memalign - static void* _gsi_memalign(size_t boundary, size_t size) - { - void *ptr = calloc((size)/(boundary), (boundary)); - // check alignment - GS_ASSERT((((gsi_u32)ptr)% boundary)==0); - return ptr; - } -#endif - -static MemManagerCallbacks memmanagercallbacks = -{ -#ifdef MEM_MANAGER_DIRECT - &malloc, - &free, - &realloc, - #if defined(_PS2) || defined(_PSP) || defined(_PS3) - &memalign, // a version already exists on this platform - #else - &_gsi_memalign, //wrote our own - #endif -#else - &_gsi_malloc, - &_gsi_free, - &_gsi_realloc, - &_gsi_memalign -#endif -}; - - -void gsiMemoryCallbacksSet(gsMallocCB p_malloc, gsFreeCB p_free, gsReallocCB p_realloc, gsMemalignCB p_memalign) -{ - - memmanagercallbacks.malloc = p_malloc; - memmanagercallbacks.free = p_free; - memmanagercallbacks.realloc = p_realloc; - memmanagercallbacks.memalign = p_memalign; -} - - - - - - -// These functions shunt to virtual function pointer -void* gsimalloc (size_t size) -{ - return (*memmanagercallbacks.malloc)(size); -} -void* gsirealloc (void* ptr, size_t size) -{ - return (*memmanagercallbacks.realloc)(ptr,size); -} -void gsifree (void* ptr) -{ - if(ptr == NULL) - return; - (*memmanagercallbacks.free)(ptr); -} -void* gsimemalign (size_t boundary, size_t size) -{ - return (*memmanagercallbacks.memalign)(boundary,size); -} - - - -#ifdef GSI_MEM_MANAGED - - - - -/***************************************************************************/ -/* - - Random Access Memory Pool - -*/ -/***************************************************************************/ - - -// Context Stack -#define MEM_CONTEXT_STACK_MAX 10 // max stack depth -static gsMemMgrContext MemTypeStack [MEM_CONTEXT_STACK_MAX] = {gsMemMgrContext_Default}; -static gsi_u32 MemTypeStackIndex = 0; -extern gsMemMgrContext gsMemMgrContextCurrent; - -// Memtype Tag stack -#define MEM_TAG_STACK_MAX 10 // max stack depth -static gsi_u8 MemTagStack [MEM_TAG_STACK_MAX] = {0}; -static gsi_u32 MemTagStackIndex = 0; - - -// ToDo: -// - Add 64 bit pointer support - - - -// Default pointer alignment. Must be 16, 32, 64, 128, or 256 bytes. -// i.e. malloc (x) = memalign(default alignment,x); - - - -#define MEM_IS_POWER_OF_2(x) (((x) & ((x)-1)) == 0) -#define MEMALIGN_POWEROF2(x,a) (((gsi_uint)(x)+(a-1)) &~ ( ((gsi_uint)(a)) -1)) - -#if(1) // enable assert, otherwise this runs faster - #define MP_ASSERT(x) GS_ASSERT(x) -#else - #define MP_ASSERT(x) -#endif - - -#define MEM_TYPES_MAX 127 - - -typedef struct -{ - gsi_u32 MemTotal; - gsi_u32 MemAvail; - gsi_u32 MemUsed; - gsi_u32 MemUsed_At_HighWater; - gsi_u32 MemWasted; // overhead memory + memory lost due to fragmentation. - - gsi_u32 ChunksCount; // number of ChunkHeaders in linked list. - gsi_u32 ChunksFreeCount; // number of free ChunkHeaders in linked list. - gsi_u32 ChunksFreeLargestAvail; - // these are the same as handles - gsi_u32 ChunksUsedCount; // number of ChunkHeaders which are in use. - gsi_u32 ChunksUsedCount_At_HighWater; // the most handles used at any one time - - // memtype specifics - gsi_u32 MemType_ChunksCount [MEM_TYPES_MAX]; - gsi_u32 MemType_MemUsed [MEM_TYPES_MAX]; - gsi_u32 MemType_MemUsed_At_HighWater [MEM_TYPES_MAX]; - - -} MEM_STATS; - -void MEM_STATSAddAll (MEM_STATS *_this, const MEM_STATS *ms); -void MEM_STATSClear (MEM_STATS *_this); -// except HW -void MEM_STATSClearAll (MEM_STATS *_this); - - -// RA_MEM_CHUNK -typedef struct tMEM_CHUNK -{ - - // private - union - { - gsi_uint MemUsed; // size used by application. ex// malloc(size) - #ifdef GS_BIG_ENDIAN - struct - { - #if (GSI_64BIT) - char pad[7],MemType; - #else - char pad[3],MemType; - #endif - }MEM_TypeStruct; - #else - struct - { - #if (GSI_64BIT) - char MemType,pad[7]; - #else - char MemType,pad[3]; - #endif - } MEM_TypeStruct; - #endif - } MEM_UsageStat; - - // public: - // double linked list of all chunks - struct tMEM_CHUNK *prev; - struct tMEM_CHUNK *next; // next chunk - // single linked list of free chunks - struct tMEM_CHUNK *NextFree; // next free chunk -} MEM_CHUNK; - - - -/***************************************/ -// flag as in use, set size, memtype -void MEM_CHUNKAlloc (MEM_CHUNK *_this, gsi_u8 _MemType, size_t _UsedSize) -{ - _UsedSize = MEMALIGN_POWEROF2(_UsedSize,4); //The lower 2 bits are zero, so we don't store them. - GS_ASSERT_STR(_UsedSize < 0x3FFFFFC, "Alloc Memory size is too big."); - _this->MEM_UsageStat.MemUsed = _UsedSize<<6; - _this->MEM_UsageStat.MEM_TypeStruct.MemType = _MemType; -} -void MEM_CHUNKFree (MEM_CHUNK *_this) -{ - _this->MEM_UsageStat.MemUsed = 0; -} - -/***************************************/ -// returns true if not in use -gsi_bool MEM_CHUNKIsFree (MEM_CHUNK *_this) -{ - return (_this->MEM_UsageStat.MemUsed == 0); -} - -/***************************************/ -gsi_u32 MEM_CHUNKTotalSizeGet(MEM_CHUNK *_this) -// Total size chunk is using up, including header. -{ - if (!_this->next) - { - return PTR_ALIGNMENT + sizeof(MEM_CHUNK)/*Nub*/; - } - return (gsi_uint) _this->next - (gsi_uint) _this; -} - -/***************************************/ -gsi_u32 MEM_CHUNKChunkSizeGet(MEM_CHUNK *_this) -// size of chunk, without header. "Available memory" -{ - if (!_this->next) - return PTR_ALIGNMENT;/*Nub*/; - return (gsi_uint) _this->next - (gsi_uint) _this - sizeof(MEM_CHUNK); -} - -gsi_u32 MEM_CHUNKMemUsedGet (MEM_CHUNK *_this) -{ - return (_this->MEM_UsageStat.MemUsed & ~0xFF)>>6; -} - -void MEM_CHUNKMemUsedSet (MEM_CHUNK *_this, gsi_u32 size) -{ - _this->MEM_UsageStat.MemUsed = (MEMALIGN_POWEROF2(size,4)<<6) + _this->MEM_UsageStat.MEM_TypeStruct.MemType; -} - -gsi_u32 MEM_CHUNKMemAvailGet(MEM_CHUNK *_this) -{ - return MEM_CHUNKChunkSizeGet(_this) - MEM_CHUNKMemUsedGet(_this); -} - -char MEM_CHUNKMemTypeGet (MEM_CHUNK *_this) -{ - return _this->MEM_UsageStat.MEM_TypeStruct.MemType; -} - -void MEM_CHUNKMemTypeSet (MEM_CHUNK *_this, char _MemType) -{ - GS_ASSERT(_MemType < MEM_TYPES_MAX); - _this->MEM_UsageStat.MEM_TypeStruct.MemType = _MemType; -} - -void* MEM_CHUNKMemPtrGet (MEM_CHUNK *_this) -{ - return (void*)((gsi_uint) _this + sizeof(MEM_CHUNK)); -} - -/*inline */MEM_CHUNK *Ptr_To_MEM_CHUNK(void *ptr) -{ - return ((MEM_CHUNK *)ptr)-1; -} - -/***************************************/ -/***************************************/ -typedef struct MEM_CHUNK_POOL -{ - // public: - char Name[20]; // name of this pool. Used for debug purposes - // private: - MEM_CHUNK *HeaderStart; - MEM_CHUNK *HeaderEnd; - MEM_CHUNK *pFirstFree; - gsi_u32 HeapSize; - #if MEM_PROFILE - gsi_u32 HWMemUsed; - gsi_u32 MemUsed; - #endif -} MEM_CHUNK_POOL; - -// private -MEM_CHUNK *MEM_CHUNK_POOLFindPreviousFreeChunk (MEM_CHUNK_POOL *_this, MEM_CHUNK *header); -MEM_CHUNK *MEM_CHUNK_POOLFindNextFreeChunk (MEM_CHUNK_POOL *_this, MEM_CHUNK *header); -void MEM_CHUNK_POOLSplitChunk (MEM_CHUNK_POOL *_this, MEM_CHUNK *header,gsi_bool ReAlloc); -void MEM_CHUNK_POOLFreeChunk (MEM_CHUNK_POOL *_this, MEM_CHUNK *header); -MEM_CHUNK *MEM_CHUNK_POOLAllocChunk (MEM_CHUNK_POOL *_this, size_t Size,int Alignment , gsi_bool Backwards );//int Alignment = PTR_ALIGNMENT, gsi_bool Backwards = gsi_false); - -// move a chunk within the limits of prev + prev_size and next - this_size -void MEM_CHUNK_POOLChunkMove (MEM_CHUNK_POOL *_this, MEM_CHUNK *oldpos, MEM_CHUNK *newpos); - -// public -/***************************************/ -void MEM_CHUNK_POOLCreate (MEM_CHUNK_POOL *_this, const char *szName, char *ptr, gsi_u32 _size); -void MEM_CHUNK_POOLDestroy (MEM_CHUNK_POOL *_this) ; -gsi_bool MEM_CHUNK_POOLIsValid (MEM_CHUNK_POOL *_this) -{ - return _this->HeapSize > 0; -} - - -/***************************************/ -void *MEM_CHUNK_POOLmalloc (MEM_CHUNK_POOL *_this, size_t Size, gsi_i32 Alignment );//= PTR_ALIGNMENT); -// allocated backwards from top of heap -void *MEM_CHUNK_POOLmalloc_backwards (MEM_CHUNK_POOL *_this, size_t Size, gsi_i32 Alignment );//= PTR_ALIGNMENT); -void *MEM_CHUNK_POOLrealloc (MEM_CHUNK_POOL *_this, void *oldmem, size_t newSize); -void MEM_CHUNK_POOLfree (MEM_CHUNK_POOL *_this, void *mem); - -/***************************************/ -void MEM_CHUNK_POOLCheckValidity (MEM_CHUNK_POOL *_this ); -void MEM_CHUNK_POOLMemStatsGet (MEM_CHUNK_POOL *_this, MEM_STATS *stats); -gsi_u32 MEM_CHUNK_POOLWalkForType (MEM_CHUNK_POOL *_this, int _MemType, gsi_bool _LogUse); - -// returns true if this is a valid heap ptr -gsi_bool MEM_CHUNK_POOLIsHeapPtr (MEM_CHUNK_POOL *_this, void * mem); - -/***************************************/ -// add to table, filling in memtype . -void MEM_CHUNK_POOLFillMemoryTable (MEM_CHUNK_POOL *_this, char *Table, const int TableSize, gsi_u32 _HeapStart, gsi_u32 _HeapSize); - -/***************************************/ -// returns true if mem handle is in range of heap -gsi_bool MEM_CHUNK_POOLItemIsInPoolMemory (MEM_CHUNK_POOL *_this, void *ptr) -{ - GS_ASSERT(MEM_CHUNK_POOLIsValid(_this)); - return (((gsi_uint)ptr >= (gsi_uint)MEM_CHUNKMemPtrGet(_this->HeaderStart)) &&((gsi_uint)ptr <= (gsi_uint)MEM_CHUNKMemPtrGet(_this->HeaderEnd))); -} - - - - - - - - - - -void MEM_STATSAddAll(MEM_STATS *_this, const MEM_STATS *ms) -{ - int i; - _this->MemTotal += ms->MemTotal ; - _this->MemAvail += ms->MemAvail ; - _this->MemUsed += ms->MemUsed ; - _this->MemUsed_At_HighWater += ms->MemUsed_At_HighWater ; - _this->MemWasted += ms->MemWasted ; - _this->ChunksCount += ms->ChunksCount ; - _this->ChunksFreeCount += ms->ChunksFreeCount ; - _this->ChunksFreeLargestAvail += ms->ChunksFreeLargestAvail ; - _this->ChunksUsedCount += ms->ChunksUsedCount ; - _this->ChunksUsedCount_At_HighWater += ms->ChunksUsedCount_At_HighWater; - for (i =0; iMemType_ChunksCount[i] +=ms->MemType_ChunksCount[i]; - _this->MemType_MemUsed[i] +=ms->MemType_MemUsed[i] ; - } - -} - -void MEM_STATSClear(MEM_STATS *_this ) -// except HW -{ - _this->MemTotal = 0; - _this->MemAvail = 0; - _this->MemUsed = 0; - _this->MemWasted = 0; - _this->ChunksCount = 0; - _this->ChunksFreeCount = 0; - _this->ChunksFreeLargestAvail = 0; - _this->ChunksUsedCount = 0; - - memset(_this->MemType_ChunksCount, 0,4 * MEM_TYPES_MAX); - memset(_this->MemType_MemUsed, 0,4 * MEM_TYPES_MAX); - -} - -void MEM_STATSClearAll(MEM_STATS *_this ) -{ - int i; - MEM_STATSClear(_this); - _this->MemUsed_At_HighWater = 0; - for (i=0;i< MEM_TYPES_MAX;i++ ) - _this->MemType_MemUsed_At_HighWater[i] = 0; - _this->ChunksUsedCount_At_HighWater = 0; -} - - - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLChunkMove (MEM_CHUNK_POOL *_this, MEM_CHUNK *oldpos, MEM_CHUNK *newpos) -//-------------------------------------------------------------------------- -{ - MEM_CHUNK *firstfree; - //todo!!! - MEM_CHUNK temp = *oldpos; - - // can not be end/start chunk - MP_ASSERT(oldpos->prev) - MP_ASSERT(oldpos->next) - - // check if within movement limits - MP_ASSERT((gsi_uint) newpos <= (gsi_uint)oldpos->next - MEM_CHUNKMemUsedGet(oldpos) - sizeof(MEM_CHUNK)) - MP_ASSERT((gsi_uint) newpos >= (gsi_uint)oldpos->prev + MEM_CHUNKMemUsedGet(oldpos->prev) + sizeof(MEM_CHUNK)) - - // check if alignment is valid - MP_ASSERT((((gsi_uint) newpos) % sizeof(MEM_CHUNK)) == 0) - - *newpos = temp; - - // link into chunk list - newpos->prev->next = newpos; - newpos->next->prev = newpos; - - // Fix links in free chunk list - if (MEM_CHUNKIsFree(newpos)) - { - - if (_this->pFirstFree == oldpos) - _this->pFirstFree = newpos; - else - { - firstfree = MEM_CHUNK_POOLFindPreviousFreeChunk(_this,newpos->prev); - if (firstfree != newpos) - firstfree->NextFree = newpos; - else - { - // first in list. - _this->pFirstFree = newpos; - } - - MP_ASSERT((newpos->NextFree==NULL) || ((gsi_uint)newpos->NextFree > (gsi_uint)newpos)) - } - } - - -} - -void MEM_CHUNK_POOLDestroy(MEM_CHUNK_POOL *_this) -{ - memset(_this, 0, sizeof (MEM_CHUNK_POOL)); -} -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLCreate(MEM_CHUNK_POOL *_this, const char * szNameIn, char *ptr, gsi_u32 size) -//-------------------------------------------------------------------------- -{ - int len; - MEM_CHUNK *HeaderMid; - MP_ASSERT(((gsi_uint)ptr & 15 )==0) // ensure 16 byte alignment - - //Copy limited length name - len = strlen(szNameIn)+1; - if (len > 20) len = 20; - memcpy(_this->Name,szNameIn, len); - _this->Name[19]='\0'; // in case str is too long. - - // create two nubs, at start, and end, with a chunk in between - MP_ASSERT(size > 48 + 3 * sizeof(MEM_CHUNK)) - - _this->HeaderStart = (MEM_CHUNK *) (ptr); - HeaderMid = (MEM_CHUNK *) (ptr + 2 * sizeof(MEM_CHUNK)); - _this->HeaderEnd = (MEM_CHUNK *) (ptr + size - 2 * sizeof(MEM_CHUNK)); - - // Bogus nub which is never freed. - _this->HeaderStart->prev = NULL; - _this->HeaderStart->next = HeaderMid; - _this->HeaderStart->NextFree = HeaderMid; - MEM_CHUNKAlloc (_this->HeaderStart,0,sizeof(MEM_CHUNK)); // don't mark as free - - // Here is our real heap, after before and after overhead - HeaderMid->prev = _this->HeaderStart; - HeaderMid->next = _this->HeaderEnd; - HeaderMid->NextFree = 0; - MEM_CHUNKFree(HeaderMid); - - // Bogus nub which is never freed. - _this->HeaderEnd->prev = HeaderMid; - _this->HeaderEnd->next = NULL; - _this->HeaderEnd->NextFree = NULL; - MEM_CHUNKAlloc (_this->HeaderEnd,0,sizeof(MEM_CHUNK)); // don't mark as free - - _this->HeapSize = size; - _this->pFirstFree = HeaderMid; - -} - - -//-------------------------------------------------------------------------- -MEM_CHUNK *MEM_CHUNK_POOLFindPreviousFreeChunk(MEM_CHUNK_POOL *_this, MEM_CHUNK *header) -// find previous free chunk -// return NULL if start header is not free, and there is nothing free before it. -// return header if start header is first free chunk -{ - while ((header) && (!MEM_CHUNKIsFree(header))) - { - //GS_ASSERT(header->prev == NULL || (header->prev >= _this->HeaderStart && header->prev <= _this->HeaderEnd)); - header = header->prev; - } - - GSI_UNUSED(_this); - return header; -} - -//-------------------------------------------------------------------------- -MEM_CHUNK *MEM_CHUNK_POOLFindNextFreeChunk(MEM_CHUNK_POOL *_this, MEM_CHUNK *header_in) -// find previous free chunk -// return NULL if no next free chunk. -{ - MEM_CHUNK *header = header_in; - while ((header) && (!MEM_CHUNKIsFree(header))) - { - header = header->next; - } - if (header == header_in) - return NULL; - - GSI_UNUSED(_this); - return header; -} - - - - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLSplitChunk(MEM_CHUNK_POOL *_this, MEM_CHUNK *header, gsi_bool ReAlloc) -// split a used chunk into two if the UsedSize is smaller then the ChunkSize -//-------------------------------------------------------------------------- -{ - MEM_CHUNK *next; - MEM_CHUNK *PrevFree; - MEM_CHUNK *NewHeader; - - // calc new position at end of used mem - NewHeader = (MEM_CHUNK *) ((gsi_u8*)header + MEM_CHUNKMemUsedGet(header) + sizeof(MEM_CHUNK)); - NewHeader = (MEM_CHUNK *)MEMALIGN_POWEROF2(NewHeader,sizeof(MEM_CHUNK)); - - //assert we have enough room for this new chunk - MP_ASSERT ((gsi_uint)NewHeader + 2 * sizeof(MEM_CHUNK) <= (gsi_uint)header->next) - - // update some stats - #if (MEM_PROFILE) - if(ReAlloc) - { - //09-OCT-07 BED: Since we're splitting the chunk, it seems more accurate - // to use the full size of the chunk, not just the used portion - _this->MemUsed -= MEM_CHUNKChunkSizeGet(header); - //_this->MemUsed -= MEM_CHUNKMemUsedGet(header); - GS_ASSERT(_this->MemUsed >= 0); - } - #endif - - // Can this new chunk fit in the current one? - // create a new chunk header, at the end of used space, plus enough to align us to 16 bytes - - // Splice into linked list - NewHeader->prev = header; - NewHeader->next = header->next; - MEM_CHUNKFree(NewHeader); - - if (NewHeader->next) - { - NewHeader->next->prev = NewHeader; - } - - header->next = NewHeader; - - // Splice into free chunks linked list - - // this need to merge can happen on a realloc before a free chunk - if (MEM_CHUNKIsFree(NewHeader->next)) - { - MP_ASSERT(ReAlloc) - - // merge and splice - next = NewHeader->next->next; - next->prev = NewHeader; - - NewHeader->NextFree = NewHeader->next->NextFree; - NewHeader->next = next; - } - else - { - if (ReAlloc) - { - // on a realloc, this next value is useless - NewHeader->NextFree = MEM_CHUNK_POOLFindNextFreeChunk(_this,NewHeader->next); - } - else - NewHeader->NextFree = header->NextFree; - } - - if (_this->pFirstFree == header) - { - // this is first free chunk - _this->pFirstFree = NewHeader; - } - else - { - // link previous free chunk to this one. - PrevFree = MEM_CHUNK_POOLFindPreviousFreeChunk(_this,header); - if (PrevFree) - PrevFree->NextFree = NewHeader; - else - // this is first free chunk - _this->pFirstFree = NewHeader; - } - - #if (MEM_PROFILE) - if(ReAlloc) - { - _this->MemUsed += MEM_CHUNKMemUsedGet(header); - // update highwater mark - if(_this->MemUsed > _this->HWMemUsed) - _this->HWMemUsed = _this->MemUsed; - - GS_ASSERT(_this->MemUsed <= _this->HeapSize); - } - #endif - -#ifdef _DEBUG_ - header->NextFree = NULL; -#endif - -} - - -//-------------------------------------------------------------------------- -gsi_bool MEM_CHUNK_POOLIsHeapPtr(MEM_CHUNK_POOL *_this, void * mem) -// returns true if this is a valid heap ptr -{ - MEM_CHUNK *headertofind = Ptr_To_MEM_CHUNK(mem); - MEM_CHUNK *header = _this->HeaderStart; - - while (header) - { - header = header->next; - if (headertofind == header) - return gsi_true; - } - - return gsi_false; - -} - - - - - - - -//-------------------------------------------------------------------------- -MEM_CHUNK *MEM_CHUNK_POOLAllocChunk(MEM_CHUNK_POOL *_this,size_t Size, gsi_i32 Alignment, gsi_bool Backwards) -// size = requested size from app. - -// Find first chunk that will fit, -// allocate from it, splitting it -// merge split with next free chunk, if next chunk is free -//-------------------------------------------------------------------------- -{ - gsi_u32 Ptr ; - gsi_u32 AlignedPtr ; - int delta ; - MEM_CHUNK *PrevFree ; - int total_size ; - int MemRemain ; - MEM_CHUNK *alignedheader; - - - MEM_CHUNK *header; - gsi_u32 SizeNeeded = Size + sizeof(MEM_CHUNK); - SizeNeeded = MEMALIGN_POWEROF2(SizeNeeded,sizeof(MEM_CHUNK)); // must be aligned to this at least!!! - - MP_ASSERT(Size) - MP_ASSERT(MEM_IS_POWER_OF_2(Alignment)) // must be power of two!!! - MP_ASSERT(Alignment >= PTR_ALIGNMENT) - - -// Backwards = gsi_false; - - if(Backwards) - header = MEM_CHUNK_POOLFindPreviousFreeChunk(_this,_this->HeaderEnd); - else - header = _this->pFirstFree; - - - // should all be free chunks linked from here in. - while (header) - { - // is this chunk available - MP_ASSERT (MEM_CHUNKIsFree(header)) - - // Calc memory left in this chunk after we alloc - total_size = MEM_CHUNKTotalSizeGet(header); - MemRemain = total_size - SizeNeeded; - - // can we fit? - if (MemRemain >= 0 ) - { - // are we aligned properly? - Ptr = (gsi_uint)MEM_CHUNKMemPtrGet(header); - AlignedPtr = MEMALIGN_POWEROF2(Ptr,Alignment); - delta = AlignedPtr - Ptr; - if (delta) - { - // we need to move free chunk over by ptr. - if (MemRemain < delta) - { - // not enough space in this chunk - header = header->NextFree; - continue; - } - - // move the chunk over so that the pointer is aligned. - alignedheader = Ptr_To_MEM_CHUNK((void*)(gsi_uint)AlignedPtr); - MEM_CHUNK_POOLChunkMove (_this,header,alignedheader); - header = alignedheader; - MemRemain -= delta; - - } - - - // at this point we've taken this chunk, and need to split off the unused part - // in theory, there should be no other free chunk ahead of us. - - MEM_CHUNKAlloc(header,MemTagStack[MemTagStackIndex],Size); - - // split as needed - if (MemRemain > sizeof(MEM_CHUNK)*2) - { - - // split chunk, this will handle free chunk pointer list - MEM_CHUNK_POOLSplitChunk(_this,header, gsi_false); - } - else - { - // remove from free list - if (_this->pFirstFree == header) - { - // this is first free chunk - _this->pFirstFree = header->NextFree; - - } - else - { - // link previous free chunk to this one. - PrevFree = MEM_CHUNK_POOLFindPreviousFreeChunk(_this,header); - if (PrevFree) - PrevFree->NextFree = header->NextFree; - else - _this->pFirstFree = header->NextFree; - - } - } - { - #if (MEM_PROFILE) - _this->MemUsed += MEM_CHUNKMemUsedGet(header); - // update highwater mark - if(_this->MemUsed > _this->HWMemUsed) - _this->HWMemUsed = _this->MemUsed; - - GS_ASSERT(_this->MemUsed <= _this->HeapSize); - #endif - } - return header; - - } - if (Backwards) - header = MEM_CHUNK_POOLFindPreviousFreeChunk(_this,header); - else - header = header->NextFree; - } - // not crashing here. - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Misc, GSIDebugLevel_Notice," Could not allocate %i bytes\n", Size); - GS_ASSERT_STR(0,"Out of memory");//(_this->Name); - - - return NULL; - -} - - - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLFreeChunk(MEM_CHUNK_POOL *_this,MEM_CHUNK *header) -// set chunk as free -// merge if possible with prev and next -// adding chunk to free chunks list. -//-------------------------------------------------------------------------- -{ - - MEM_CHUNK *prev = header; - MEM_CHUNK *next = header; - MEM_CHUNK *PrevFree; - - #if (MEM_PROFILE) - _this->MemUsed -= MEM_CHUNKMemUsedGet(header); - GS_ASSERT(_this->MemUsed >= 0); - #endif - - while (next->next && (MEM_CHUNKIsFree(next->next))) - { - next = next->next; - } - - while (prev->prev && (MEM_CHUNKIsFree(prev->prev))) - { - prev = prev->prev; - } - - if (prev != next) - { - // merge - // prev becomes the new chunk. - prev->next = next->next; - - if (next->next) - next->next->prev = prev; - - } - - // since this is now a free chunk, we must add it to the free chunk list - - // find previous free - PrevFree = MEM_CHUNK_POOLFindPreviousFreeChunk(_this,prev); - if (PrevFree == NULL) - { - // this is first free chunk - _this->pFirstFree = prev; - - } - else - { - // link previous free chunk to this one. - PrevFree->NextFree = prev; - } - - // find and set next free chunk - if(next->next) - prev->NextFree = MEM_CHUNK_POOLFindNextFreeChunk(_this,next->next); - else - prev->NextFree = NULL; - - MEM_CHUNKFree(prev); - - -#if(0) - //ToDo: steal unused memory from previous used chunk - gsi_u32 destptr = (gsi_u32)prev->prev + prev->prev->MemAvailGet() + sizeof(MEM_CHUNK); - destptr = MEMALIGN_POWEROF2(destptr,sizeof(MEM_CHUNK)); - - // we can move back to this ptr. Is it worth it? - if (destptr < (gsi_u32)prev ) - ChunkMove(prev,(MEM_CHUNK *)destptr); -#endif -} - - - - -//-------------------------------------------------------------------------- -void *MEM_CHUNK_POOLmalloc(MEM_CHUNK_POOL *_this,size_t Size, gsi_i32 Alignment) -//-------------------------------------------------------------------------- -{ - void *mem; - - // return ptr to the first block big enough - MEM_CHUNK *header = MEM_CHUNK_POOLAllocChunk( _this,Size, Alignment, gsi_false); - - if (header) - { - // alloc new chunk - mem = MEM_CHUNKMemPtrGet(header); - return mem; - } - - return NULL; -} - - -//-------------------------------------------------------------------------- -void *MEM_CHUNK_POOLmalloc_backwards(MEM_CHUNK_POOL *_this,size_t Size, gsi_i32 Alignment) -//-------------------------------------------------------------------------- -{ - void *mem; - - // return ptr to the first block big enough - MEM_CHUNK *header = MEM_CHUNK_POOLAllocChunk( _this,Size, Alignment, gsi_true); - - if (header) - { - // alloc new chunk - mem = MEM_CHUNKMemPtrGet(header); - return mem; - } - - return NULL; -} - - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLfree(MEM_CHUNK_POOL *_this,void *mem) -// return 0 if memory freed in this call -// else return mem value passed in -//-------------------------------------------------------------------------- -{ - MEM_CHUNK *header = Ptr_To_MEM_CHUNK(mem); - MEM_CHUNK_POOLFreeChunk(_this,header); -} - - -//-------------------------------------------------------------------------- -void *MEM_CHUNK_POOLrealloc(MEM_CHUNK_POOL *_this,void *oldmem, size_t newSize) -//-------------------------------------------------------------------------- -{ - MEM_CHUNK *oldheader; - MEM_CHUNK *NewHeader; - gsi_u32 OldSize; - char MemType; - - MP_ASSERT(newSize) - - if (!oldmem) - { - return MEM_CHUNK_POOLmalloc( _this, newSize,PTR_ALIGNMENT); - } - - - oldheader = Ptr_To_MEM_CHUNK(oldmem); - OldSize = MEM_CHUNKMemUsedGet(oldheader); - - if (newSize == OldSize) - return oldmem; - - if (newSize < OldSize ) - { - - if ((newSize + 2 * sizeof(MEM_CHUNK))> OldSize ) - { - // not enough room to create another chunk, can't shrink - return oldmem; - } - - // shrink it - MEM_CHUNKMemUsedSet(oldheader,newSize); - MEM_CHUNK_POOLSplitChunk(_this,oldheader, gsi_true); - return MEM_CHUNKMemPtrGet(oldheader); - } - else - { - // get a new chunk - MemType = MEM_CHUNKMemTypeGet(oldheader); - MEM_CHUNK_POOLFreeChunk(_this,oldheader); - NewHeader = MEM_CHUNK_POOLAllocChunk( _this,newSize,PTR_ALIGNMENT,gsi_false); - MEM_CHUNKMemTypeSet(NewHeader,MemType); - - memmove(MEM_CHUNKMemPtrGet(NewHeader),oldmem,OldSize); - - return MEM_CHUNKMemPtrGet(NewHeader); - } - -} - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLMEM_CHUNK_POOL(MEM_CHUNK_POOL *_this) -//-------------------------------------------------------------------------- -{ - _this->Name[0] = 0; - _this->HeaderEnd = NULL; - _this->HeaderStart = NULL; - _this->HeapSize = 0; - _this->pFirstFree = NULL; -} - - - - - -//-------------------------------------------------------------------------- -gsi_u32 MEM_CHUNK_POOLWalkForType(MEM_CHUNK_POOL *_this,int type, gsi_bool _LogUse) -//-------------------------------------------------------------------------- -{ - MEM_CHUNK *header; - gsi_u32 Total = 0; - header = _this->HeaderStart; - - while (header) - { - MP_ASSERT((header->next == NULL) || ((gsi_uint)header < (gsi_uint)header->next )) // infinite loop or out of place - MP_ASSERT((header->prev == NULL) || ((gsi_uint)header->prev < (gsi_uint)header )) // infinite loop or out of place - MP_ASSERT((header->prev == NULL) || (header->prev->next == header)) // previous linked correctly to us - MP_ASSERT((header->next == NULL) || (header->next->prev == header)) // next linked correctly to us - MP_ASSERT( MEM_CHUNKMemUsedGet(header) <= MEM_CHUNKChunkSizeGet(header) ) // using too much mem - - if (!MEM_CHUNKIsFree(header) && (MEM_CHUNKMemTypeGet(header) == type)) - { - //Don't log a message for the HeaderStart and HeaderEnd blocks. - if ((header != _this->HeaderStart) && (header != _this->HeaderEnd)) - { - // Used Chunk - Total += MEM_CHUNKTotalSizeGet(header); - if (_LogUse) - { - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Misc, GSIDebugLevel_Notice,"MemFound ptr:0x%8x size:%8u %s\n", MEM_CHUNKMemPtrGet(header), - MEM_CHUNKMemUsedGet(header),MemMgrBufferGetName((gsMemMgrContext) type)); - } - } - - } - - // make sure we hit the correct end - MP_ASSERT (header->next || (header == _this->HeaderEnd)) - header = header->next; - - } - return Total; -} - - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLMemStatsGet(MEM_CHUNK_POOL *_this,MEM_STATS *pS) -{ - int ChunksFreeLostCount ; - int i,type; - MEM_CHUNK *header ; - MEM_CHUNK *NextFree; - MEM_STATSClear(pS); - - // check free chunk linked list - header = _this->HeaderStart; - NextFree = _this->pFirstFree; - - - - /*** Test validity of all chunks chain ***/ - while (header) - { - MP_ASSERT((header->next == NULL) || ((gsi_uint)header < (gsi_uint)header->next )) // infinite loop or out of place - MP_ASSERT((header->prev == NULL) || ((gsi_uint)header->prev < (gsi_uint)header )) // infinite loop or out of place - MP_ASSERT((header->prev == NULL) || (header->prev->next == header)) // previous linked correctly to us - MP_ASSERT((header->next == NULL) || (header->next->prev == header)) // next linked correctly to us - MP_ASSERT( MEM_CHUNKMemUsedGet(header) <= MEM_CHUNKChunkSizeGet(header) ) // using too much mem - - pS->MemTotal += MEM_CHUNKTotalSizeGet(header); - if (!MEM_CHUNKIsFree(header)) - { - // Used Chunk - pS->ChunksUsedCount++; - if (pS->ChunksUsedCount_At_HighWater < pS->ChunksUsedCount) - pS->ChunksUsedCount_At_HighWater = pS->ChunksUsedCount; - - // calc overhead and waste - pS->MemWasted += MEM_CHUNKTotalSizeGet(header) - MEM_CHUNKMemUsedGet(header); - pS->MemUsed += MEM_CHUNKTotalSizeGet(header); - - type = MEM_CHUNKMemTypeGet(header); - pS->MemType_MemUsed[type] += MEM_CHUNKTotalSizeGet(header); - pS->MemType_ChunksCount[type]++; - - } - else - { - // free chunk - MP_ASSERT((header->NextFree == NULL) || ((gsi_uint)header < (gsi_uint)header->NextFree )) // infinite loop or out of place - - // make sure we aren't fragmented, as this ruins some algorithm assumptions - MP_ASSERT((header->next == NULL) || (!MEM_CHUNKIsFree(header->next))) // infinite loop or out of place - MP_ASSERT((header->prev == NULL) || (!MEM_CHUNKIsFree(header->prev))) // infinite loop or out of place - - // previous free chunk linked correctly to us, we aren't a lost chunk - MP_ASSERT(header == NextFree) - NextFree = header->NextFree; - - // calc overhead and waste (in this case, the same value...sizeof(MEM_CHUNK) header) - pS->MemWasted += MEM_CHUNKTotalSizeGet(header) - MEM_CHUNKChunkSizeGet(header); - pS->MemUsed += MEM_CHUNKTotalSizeGet(header) - MEM_CHUNKChunkSizeGet(header); - - pS->ChunksFreeCount++; - if (pS->ChunksFreeLargestAvail < MEM_CHUNKChunkSizeGet(header)) - pS->ChunksFreeLargestAvail = MEM_CHUNKChunkSizeGet(header); - } - - pS->ChunksCount++; - - // make sure we hit the correct end - MP_ASSERT (header->next || (header == _this->HeaderEnd)) - header = header->next; - - } - - // Check free chunks - header = _this->HeaderStart; - - - /*** Test validity of free chunks chain ***/ - // Walk heap looking for first free chunk, - while(header && (!MEM_CHUNKIsFree(header))) - header = header->next; - - // make sure the first free one is linked correctly - MP_ASSERT(_this->pFirstFree == header) - - ChunksFreeLostCount = pS->ChunksFreeCount; - while (header) - { - // add up sizes - ChunksFreeLostCount --; - pS->MemAvail +=MEM_CHUNKChunkSizeGet(header); - header = header->NextFree; - - } - - - // Update stats - if (pS->MemUsed_At_HighWater < pS->MemUsed) - pS->MemUsed_At_HighWater = pS->MemUsed; - - for ( i=0;i< MEM_TYPES_MAX;i++ ) - { - if (pS->MemType_MemUsed_At_HighWater[i] < pS->MemType_MemUsed[i] ) - pS->MemType_MemUsed_At_HighWater[i] = pS->MemType_MemUsed[i]; - } - - MP_ASSERT(ChunksFreeLostCount == 0) // lost free blocks -} - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLCheckValidity(MEM_CHUNK_POOL *_this) -{ - MEM_STATS stats; - MEM_CHUNK_POOLMemStatsGet(_this,&stats); - -} - - -//-------------------------------------------------------------------------- -void MEM_CHUNK_POOLFillMemoryTable(MEM_CHUNK_POOL *_this,char *Table, const int TableSize, gsi_u32 _HeapStart, gsi_u32 _HeapSize) -//-------------------------------------------------------------------------- -{ - int s,e,j; - gsi_u32 start_address; - gsi_u32 end_address ; - MEM_CHUNK *pChunk = _this->HeaderStart; - MP_ASSERT(_this->HeapSize) - - - while (pChunk) - { - if (!MEM_CHUNKIsFree(pChunk)) - { - start_address = (gsi_uint)pChunk; - end_address = ((gsi_uint)pChunk->next)-1; - - // translate address into table positions - s= ((start_address - _HeapStart) * (TableSize>>4)) / (_HeapSize>>4); - MP_ASSERT(s < TableSize) - MP_ASSERT(s >= 0) - - e= (( end_address - _HeapStart) * (TableSize>>4)) / (_HeapSize>>4); - MP_ASSERT(e < TableSize) - MP_ASSERT(e >= 0) - - for ( j= s; j<= e; j++) - { - // if(Table[j] != -2) - // Table[j] = -1; - // else - Table[j] = MEM_CHUNKMemTypeGet(pChunk); - } - - } - pChunk = pChunk->next; - } - - -} - - - -static MEM_CHUNK_POOL gChunkPool [gsMemMgrContext_Count] ; - - - -// Use this to determine which pool and subsequent allocations will be taken from. -gsMemMgrContext gsMemMgrContextCurrent = gsMemMgrContext_Default; - -//static GSICriticalSection gMemCrit; - -//-------------------------------------------------------------------------- -gsMemMgrContext gsMemMgrContextFind (void *ptr) -// find pool corresponding to mem ptr. -{ - int i; - // find which pool owns this pointer!!!!, this is kind of a hack.... but here goes. - for (i=0; i< gsMemMgrContext_Count;i++) - { - if ( - MEM_CHUNK_POOLIsValid(&gChunkPool[i]) && - MEM_CHUNK_POOLItemIsInPoolMemory(&gChunkPool[i],ptr) - ) - { - return (gsMemMgrContext) i; - } - - } - return gsMemMgrContext_Invalid; -} - -void *gs_malloc(size_t size) -{ - GS_ASSERT(size) - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[gsMemMgrContextCurrent]),"malloc: context is invalid mempool"); - - return MEM_CHUNK_POOLmalloc(&gChunkPool[gsMemMgrContextCurrent], size,PTR_ALIGNMENT); -} - -void *gs_calloc(size_t size,size_t size2) -{ - GS_ASSERT(size) - GS_ASSERT(size2) - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[gsMemMgrContextCurrent]),"calloc: context is invalid mempool"); - - return MEM_CHUNK_POOLmalloc(&gChunkPool[gsMemMgrContextCurrent], size*size2,PTR_ALIGNMENT); -} - -void *gs_realloc(void* ptr,size_t size) -{ - GS_ASSERT(size) - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[gsMemMgrContextCurrent]),"realloc: context is invalid mempool"); - - return MEM_CHUNK_POOLrealloc(&gChunkPool[gsMemMgrContextCurrent],ptr, size); -} - -void *gs_memalign(size_t boundary,size_t size) -{ - GS_ASSERT(size) - GS_ASSERT(boundary) - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[gsMemMgrContextCurrent]),"memalign: context is invalid mempool"); - - return MEM_CHUNK_POOLmalloc(&gChunkPool[gsMemMgrContextCurrent], size,boundary); -} - -void gs_free(void *ptr) -{ - gsMemMgrContext context; - - context = gsMemMgrContextFind(ptr); - GS_ASSERT_STR(context != gsMemMgrContext_Invalid,"Attempt to free invalid ptr") - - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context]),"free: ptr context is invalid mempool"); - MEM_CHUNK_POOLfree(&gChunkPool[context],ptr); -} - -//-------------------------------------------------------------------------- -const char *MemMgrBufferGetName(gsMemMgrContext context) -{ - GS_ASSERT_STR(context != gsMemMgrContext_Invalid, "Invalid Context"); - GS_ASSERT_STR(context < gsMemMgrContext_Count, "Context out of range"); - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context ]),"Invalid mempool"); - - return gChunkPool[context].Name; -} - - -void gsMemMgrContextSet(gsMemMgrContext context) -{ - GS_ASSERT_STR(context != gsMemMgrContext_Invalid, "Invalid Context"); - GS_ASSERT_STR(context < gsMemMgrContext_Count, "Context out of range"); - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context]),"Setting context to invalid mempool"); - - gsMemMgrContextCurrent = context; -} - - - -//-------------------------------------------------------------------------- -// call this to enable GameSpy's provided memory manager -// Create a mem pool for the given context. If that context is in use, it will return the next available -// if none are available it will return gsMemMgrContext_Invalid -// ex use: gQR2MemContext = gsMemMgrCreate (0,0,16 * 1024); -// will find the first avaiable spot, create a mem pool of 16k, and return the context handle. -// then later in your API -// enter an API function -// gsMemMgrContextPush(gQR2MemContext); -// do some allocs -// gQR2MemContextPop() -// return from function. -gsMemMgrContext gsMemMgrCreate (gsMemMgrContext context, const char *PoolName,void* thePoolBuffer, size_t thePoolSize) -{ - char *ptr = (char *)thePoolBuffer; - - GS_ASSERT_STR(thePoolSize,"Cannnot create a pool of size 0") - GS_ASSERT_STR(thePoolSize,"thePoolBuffer ptr is inivalid"); - GS_ASSERT_STR(((((gsi_uint)thePoolSize) &15) ==0) ,"PoolSize must be aligned to 16 bytes"); - GS_ASSERT_STR(((((gsi_uint)thePoolBuffer)&15) ==0) ,"thePoolBuffer must be aligned to 16 bytes"); - - - while (MEM_CHUNK_POOLIsValid(&gChunkPool[context])) - { - context = (gsMemMgrContext)(context + 1); - } - if (context == gsMemMgrContext_Count) - { - // Warn!!!! - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "Out of memory context handles!\n"); - GS_ASSERT(0); - return gsMemMgrContext_Invalid; // ran out of context slots - } - - MEM_CHUNK_POOLCreate(&gChunkPool[context],PoolName,ptr,thePoolSize); - // Set call backs. - gsiMemoryCallbacksSet(gs_malloc, gs_free, gs_realloc, gs_memalign); - return context; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsMemMgrDestroy(gsMemMgrContext context) -{ - GS_ASSERT(gChunkPool[context].HeapSize != 0); - MEM_CHUNK_POOLDestroy(&gChunkPool[context]); - - // if this is the last one, -#if(0) - { - // Set call backs. - gsiMemoryCallbacksSet(malloc,free,realloc,memalign); - - // Reset memmgr - gsiDeleteCriticalSection(&gMemCrit); - - // #ifdef _GSI_MULTI_THREADED_ - // gsiLeaveCriticalSection(&gMemCrit); - // gsiEnterCriticalSection(&gMemCrit); - // #endif - } -#endif -} - - -//-------------------------------------------------------------------------- -void gsMemMgrTagPush (gsi_u8 tag) -{ - GS_ASSERT(MemTagStackIndex < MEM_TAG_STACK_MAX-1) - MemTagStackIndex++; - MemTagStack[MemTagStackIndex] = tag; -} -//-------------------------------------------------------------------------- -void gsMemMgrTagPop () -{ - GS_ASSERT(MemTagStackIndex > 0) - MemTagStackIndex--; -} -//-------------------------------------------------------------------------- -gsi_u8 gsMemMgrTagGet (void *ptr) -{ - GS_ASSERT(ptr); - return MEM_CHUNKMemTypeGet( Ptr_To_MEM_CHUNK(ptr)); -} -//-------------------------------------------------------------------------- -gsi_u32 gsMemMgrMemUsedByTagGet(gsi_u8 tag) -{ - int i; - gsi_u32 used = 0; - for ( i=0;i< gsMemMgrContext_Count;i++) - { - used+= MEM_CHUNK_POOLWalkForType(&gChunkPool[i] ,tag, gsi_false); - } - return used; - -} - -//-------------------------------------------------------------------------- -void gsMemMgrContextPush(gsMemMgrContext NewType) -{ -// PARANOID_MemProfilerCheck(); - GS_ASSERT(MemTypeStackIndex < MEM_CONTEXT_STACK_MAX) - GS_ASSERT(NewType < gsMemMgrContext_Count) - -// gsDebugFormat(GSIDebugCat_App, GSIDebugType_State, GSIDebugLevel_Comment,"MemProfilerStart: %s\n",MemProfiler.MemPool[NewType].Name); - MemTypeStack[MemTypeStackIndex++] = gsMemMgrContextCurrent; - gsMemMgrContextCurrent = NewType; -} - -//-------------------------------------------------------------------------- -gsMemMgrContext gsMemMgrContextPop() -{ -// PARANOID_MemProfilerCheck(); - GS_ASSERT(MemTypeStackIndex > 0) -// gsDebugFormat(GSIDebugCat_App, GSIDebugType_State, GSIDebugLevel_Comment,"MemProfilerEnd: %s\n",MemProfiler.MemPool[OldType].Name); - gsMemMgrContextCurrent = MemTypeStack[--MemTypeStackIndex]; - return gsMemMgrContextCurrent; -} - - -//-------------------------------------------------------------------------- -// return total available memory for the given memory pool -gsi_u32 gsMemMgrMemAvailGet (gsMemMgrContext context) -{ - MEM_STATS stats; - MEM_STATSClearAll(&stats); - GS_ASSERT_STR(context < gsMemMgrContext_Count, "gsMemMgrMemAvailGet: context out of range"); - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context]), "gsMemMgrMemAvailGet: context is invalid mempool"); - MEM_CHUNK_POOLMemStatsGet (&gChunkPool[context], &stats); - return stats.MemAvail; -} - -//-------------------------------------------------------------------------- -// return total used memory for the given memory pool -gsi_u32 gsMemMgrMemUsedGet (gsMemMgrContext context) -{ - MEM_STATS stats; - MEM_STATSClearAll(&stats); - GS_ASSERT_STR(context < gsMemMgrContext_Count, "gsMemMgrMemUsedGet: context out of range"); - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context]), "gsMemMgrMemUsedGet: context is invalid mempool"); - MEM_CHUNK_POOLMemStatsGet (&gChunkPool[context], &stats); - return stats.MemUsed; -} - - -//-------------------------------------------------------------------------- -// return largest allocatable chunk the given memory pool. This -// will be the same or probably smaller then the value returned by gsMemMgrMemAvailGet -// depending on degree of memory fragmentation. -gsi_u32 gsMemMgrMemLargestAvailGet (gsMemMgrContext context) -{ - MEM_STATS stats; - MEM_STATSClearAll(&stats); - GS_ASSERT_STR(context < gsMemMgrContext_Count, "gsMemMgrMemLargestAvailGet: context out of range"); - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context]), "gsMemMgrMemLargestAvailGet: context is invalid mempool"); - MEM_CHUNK_POOLMemStatsGet (&gChunkPool[context], &stats); - return stats.ChunksFreeLargestAvail; -} - -//-------------------------------------------------------------------------- -gsi_u32 gsMemMgrMemHighwaterMarkGet (gsMemMgrContext context) -{ - GS_ASSERT_STR(context < gsMemMgrContext_Count, "gsMemMgrMemLargestAvailGet: context out of range"); - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[context]), "gsMemMgrMemLargestAvailGet: context is invalid mempool"); - - #if(MEM_PROFILE) - return gChunkPool[context].HWMemUsed; - #else - // Display info - App type b/c it was requested by the app - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "gsMemMgrMemHighwaterMarkGet called without MEM_PROFILE enabled."); - return 0; - #endif -} - -//-------------------------------------------------------------------------- -void gsMemMgrValidateMemoryPool() -{ - GS_ASSERT_STR(MEM_CHUNK_POOLIsValid(&gChunkPool[gsMemMgrContextCurrent]),"memalign: context is invalid mempool"); - MEM_CHUNK_POOLCheckValidity(&gChunkPool[gsMemMgrContextCurrent]); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Show allocated, free, total memory, num blocks -void gsMemMgrDumpStats() -{ -#if(0) - int numUsed = 0; - int numFree = 0; - - struct GSIMemoryBlock* aTempPtr = NULL; - - gsiEnterCriticalSection(&gMemCrit); - - // Display the number of free blocks - // TODO: dump size statistics - aTempPtr = gMemoryMgr->mFirstFreeBlock; - while(aTempPtr != NULL) - { - numFree++; - aTempPtr = aTempPtr->mNext; - } - - // Display the number of used blocks - // TODO: dump size statistics - aTempPtr = gMemoryMgr->mFirstUsedBlock; - while(aTempPtr != NULL) - { - numUsed++; - aTempPtr = aTempPtr->mNext; - } - - // Display info - App type b/c it was requested by the app - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "BytesUsed: %d, BlocksUsed: %d, BlocksFree: %d\r\n", - gMemoryMgr->mMemUsed, numUsed, numFree); - - gsiLeaveCriticalSection(&gMemCrit); -#endif -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsMemMgrDumpAllocations() -{ -#if(0) - struct GSIMemoryBlock* aBlockPtr = NULL; - gsi_time aStartTime = 0; - gsi_i32 aNumAllocations = 0; - gsi_i32 aNumBytesAllocated = 0; - - gsiEnterCriticalSection(&gMemCrit); - - aStartTime = current_time(); - aBlockPtr = (GSIMemoryBlock*)gMemoryMgr->mPoolStart; - - // Announce start - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "Dumping allocations from pool - [0x%08x] %d bytes.\r\n", - gMemoryMgr->mPoolStart, gMemoryMgr->mPoolSize); - - // Dump information about each allocated block - // - Do this in linear order, not list order - while(aBlockPtr != NULL) - { - // If it's in use, verify contents and dump info - if (gsiMemBlockIsFlagged(aBlockPtr, BlockFlag_Used)) - { - int anObjectSize = gsiMemBlockGetObjectSize(aBlockPtr); - aNumAllocations++; - aNumBytesAllocated += anObjectSize; - - if (aBlockPtr == gMemoryMgr->mPoolStart) - { - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "\t[0x%08x] Size: %d (memmgr instance)\r\n", (gsi_u32)aBlockPtr, anObjectSize); - } - else - { - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "\t[0x%08x] Size: %d\r\n", (gsi_u32)(gsiMemBlockGetObjectPtr(aBlockPtr)), anObjectSize); - } - } - else - { - // Verify that the block has the correct memory fill - } - // Get linear next (not list next!) - aBlockPtr = gsiMemBlockGetLinearNext(aBlockPtr); - } - - // Announce finish - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "\t--%d allocations, %d bytes allocated.\r\n", aNumAllocations, aNumBytesAllocated); - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "\t--%d peak memory usage\r\n", gMemoryMgr->mPeakMemoryUsage); - - gsDebugFormat(GSIDebugCat_App, GSIDebugType_Memory, GSIDebugLevel_Comment, - "Memory dump complete. (%d ms)\r\n", current_time() - aStartTime); - - gsiLeaveCriticalSection(&gMemCrit); - - GSI_UNUSED(aStartTime); // may be unused if common debug is not defined -#endif -} - - - -#if (1) // test stuff - -#define PTR_TABLE_SIZE 2048 -static int PtrTableCount = 0; -static void *PtrTable[2048]; - -int Random(int x) -{ - return Util_RandInt(0,x); -} -//-------------------------------------------------------------------------- -void gsMemMgrSelfText() -//-------------------------------------------------------------------------- -{ - - - static MEM_CHUNK_POOL gChunkPool; - int size = 32 * 1024 * 1024; - int c= 0; - int i,j,k; - - char *ptr = (char *) ( ((gsi_uint)malloc(size-PTR_ALIGNMENT)+(PTR_ALIGNMENT-1))&~ (PTR_ALIGNMENT-1) ) ; - MEM_CHUNK_POOLCreate(&gChunkPool,"",ptr,size); - - while(1) - { - - i= Random(4); - if ((i==0) &&(PtrTableCount < 1024)) - { - // malloc - j = Random(1024)+1; - k = 32<< (Random(4)); - - if (c&1) - PtrTable[PtrTableCount] = MEM_CHUNK_POOLmalloc(&gChunkPool, j,k); - else - PtrTable[PtrTableCount] = MEM_CHUNK_POOLmalloc_backwards(&gChunkPool, j,k); - - if(PtrTable[PtrTableCount]) - { - PtrTableCount++; - } - else - { - GS_ASSERT(0); - } - - } - else - if ((i==1) &&(PtrTableCount)) - { - // free - j = Random(PtrTableCount); - MP_ASSERT(j < PtrTableCount) - - - MEM_CHUNK_POOLfree(&gChunkPool,PtrTable[j]); - - // swap with last. - PtrTableCount--; - PtrTable[j] = PtrTable[PtrTableCount]; - - } - else - if ((i==2) &&(PtrTableCount)) - { - j = Random(PtrTableCount); - MP_ASSERT(j < PtrTableCount) - - // realloc - k = Random(1024) +1; - #if(1) - PtrTable[j] = MEM_CHUNK_POOLrealloc(&gChunkPool,PtrTable[j], k); - #else - // skip - PtrTable[j] = PtrTable[j]; - #endif - - if(PtrTable[j]) - { - } - else - { - GS_ASSERT(0); - } - - } - else - continue; // skip count - - c++; - MEM_CHUNK_POOLCheckValidity(&gChunkPool); - } - -} - - -#endif - - - - - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // GSI_MEM_MANAGED - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsMemory.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsMemory.h deleted file mode 100644 index c68e0eda214..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsMemory.h +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSIMEMORY_H__ -#define __GSIMEMORY_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCommon.h" - -// GameSpy allocation wrappers. Used for quickly adding pre-post allocation functionality such as -// - routing to a specific mempool -// - collecting mem usage stats -// (x) is a enumerated type for the specific module -#if(1) - #define GSI_PRE_ALLOC(x) - #define GSI_POST_ALLOC() -#elif(0) - // - collecting mem usage stats - #define GSI_PRE_ALLOC(x) gsMemMgrTagPush (x); - #define GSI_POST_ALLOC() gsMemMgrTagPop (); -#elif(0) - // - routing to a specific mempool - #define GSI_PRE_ALLOC(x) gsMemMgrContextPush (x); - #define GSI_POST_ALLOC() gsMemMgrContextPop (); -#endif - -#if defined (__cplusplus) -extern "C" -{ -#endif - - -typedef enum -{ - MEMTAG_DEFAULT, - MEMTAG_SERVER_BROWSER, - MEMTAG_PEER, - MEMTAG_GP, - MEMTAG_QR2, - MEMTAG_NN, - MEMTAG_GT2, - MEMTAG_COUNT -} MEMTAG_SDK; - -//-------------------------------------------------------------------------- -// GameSpy specific memory functions. By default these will route to system malloc -// calls. Use gsiMemoryCallbacksSet or gsiMemoryCallbacksGameSpySet to change this. -void* gsimalloc (size_t size); -void* gsirealloc (void* ptr, size_t size); -void gsifree (void* ptr); -void* gsimemalign (size_t boundary, size_t size); // TODO - -//-------------------------------------------------------------------------- -// Customer supplied memory manager customization interface -// call this to replace the Gamespy specific memory functions with your own. -#ifdef WIN32 -typedef void *(__cdecl *gsMallocCB) (size_t size); -typedef void (__cdecl *gsFreeCB) (void* ptr); -typedef void *(__cdecl *gsReallocCB) (void* ptr, size_t size); -typedef void *(__cdecl *gsMemalignCB)(size_t boundary, size_t size); -#else -typedef void *(*gsMallocCB) (size_t size); -typedef void (*gsFreeCB) (void* ptr); -typedef void *(*gsReallocCB) (void* ptr, size_t size); -typedef void *(*gsMemalignCB)(size_t boundary, size_t size); -#endif -// call this to override above gsi.... calls with your own. -void gsiMemoryCallbacksSet(gsMallocCB p_malloc, gsFreeCB p_free, gsReallocCB p_realloc, gsMemalignCB p_memalign); - -//-------------------------------------------------------------------------- -// GameSpy Built in Memory Manager -// call this to override above gsi.... calls with GameSpy's built in memory manager -// *** You must have GSI_MEM_MANAGED defined, otherwise, you will have a link error ***/ - -// This is a list of memory pools used. API specific values determined at run time. -// the gsi mem manager uses the concept of multiple memory pools or contexts. -// use pop and push commands to pop and push the current context off of the stack - -typedef enum -{ - gsMemMgrContext_Invalid= -1, - gsMemMgrContext_Default= 0, - gsMemMgrContext_Count = 16 // max number of mempools -}gsMemMgrContext; - - -// call this to enable GameSpy's provided memory manager -// Create a mempool for the given context. If that context is in use, it will return the next available -// if none are avaible it will return gsMemMgrContext_Invalid -// exx use: gQR2MemContext = gsMemMgrCreate (0,0,16 * 1024); -// will find the first avaiable spot, create a mempool of 16k, and return the context handle. -// then later in your API -// enter an API function -// gsMemMgrContextPush(gQR2MemContext); -// do some allocs -// gQR2MemContextPop() -// return from function. -// PoolName is purely for debugging and stats feedback purposes only. -// If you want your api to use the current, or the default pool, then don't bother creating one -// just always set the context to 0, and make sure int your app init, the default (0) pool is created. -/* - Recommended usage: - Call gsMemMgrCreate once at app start with a static buffer. Make all calls to this. - Alternatively, call it once per API to sue a seperate pool per API. -*/ -gsMemMgrContext gsMemMgrCreate (gsMemMgrContext context, const char *PoolName,void* thePoolBuffer, size_t thePoolSize); - -// Use this to determine which pool and subsequent allocations will be taken from. -//exx use -/* - fn() - { - gsMemMgrContextPush(thisAPIContext); - - make allocations. - - //restore settings - gsMemMgrContextPop(thisAPIContext); - - } -*/ -// note, this is not neccessary for "free". -void gsMemMgrContextPush (gsMemMgrContext context); -gsMemMgrContext gsMemMgrContextPop (); - - -// clear contents, original mempool ptr must still be freed by app. -void gsMemMgrDestroy(gsMemMgrContext context); - -// -------------Diagnostics------------------------ -// These functions all run on the current mempool context. -void gsMemMgrDumpStats(); -void gsMemMgrDumpAllocations(); -void gsMemMgrValidateMemoryPool(); // walk heap and check integrity - -// -------------Tool use ------------------------ -// find which mempool context this ptr is part of, if any. -// returns gsMemMgrContext_Invalid otherwise. -gsMemMgrContext gsMemMgrContextFind (void *ptr); -const char *MemMgrBufferGetName(gsMemMgrContext context); - - -// -------------Memory Use Profiling ------------------------ -// this tag is added to each concurrent alloc. Use this to reference allocations. -// For example, you can find out the mem used by all ptr with a given tag -// in order to find out how much mem a module or set of allocs use. -void gsMemMgrTagPush (gsi_u8 tag); -void gsMemMgrTagPop (); -gsi_u8 gsMemMgrTagGet (void *ptr); -gsi_u32 gsMemMgrMemUsedByTagGet(gsi_u8 tag); - -// return total available memory for the given memory pool context -gsi_u32 gsMemMgrMemAvailGet (gsMemMgrContext context); -// return total used memory for the given memory pool context -gsi_u32 gsMemMgrMemUsedGet (gsMemMgrContext context); -// return largest allocatable chunk within the given memory pool context. This -// will be the same or probably smaller then the value returned by gsMemMgrMemAvailGet -// depending on degree of memory fragmentation. -gsi_u32 gsMemMgrMemLargestAvailGet (gsMemMgrContext context); - -// The Highwater mark for memory used is the highest memory usage ever gets to for this -// given heap. It is the most important stat, as your mempool must be at least this big. -// Exactly how big your pool needs to be depends on fragmentation. So it may need to be slightly -// bigger then this amount. -gsi_u32 gsMemMgrMemHighwaterMarkGet (gsMemMgrContext context); - - -// -------------Self Test, not for production use ------------------------ -void gsMemMgrSelfText(); - -#if defined (__cplusplus) -} -#endif - -#endif // __GSIMEMORY_H__ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatform.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatform.c deleted file mode 100644 index ee4888f8d52..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatform.c +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsPlatform.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Include standard network lib -#if defined(_WIN32) && !defined(_XBOX) - #if defined(GSI_WINSOCK2) - #pragma comment(lib, "ws2_32") - #else - #pragma comment(lib, "wsock32") - #endif - #pragma comment(lib, "advapi32") -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Floating point specific byte reversal functions -// stores the result in a 4-byte character array -unsigned char * gsiFloatSwap(unsigned char buf[4], float f) -{ - unsigned char *dst = (unsigned char *)buf; - unsigned char *src = (unsigned char *)&f; - - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; - - return buf; -} - -// unswap using char pointers -float gsiFloatUnswap(unsigned char buf[4]) -{ - float f; - unsigned char *src = (unsigned char *)buf; - unsigned char *dst = (unsigned char *)&f; - - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; - - return f; -} - -gsi_u16 gsiByteOrderSwap16(gsi_u16 _in) -{ - gsi_u16 t; - const char *in = (char *)&_in; - char *out = (char *)&t; - out[0] = in[1]; - out[1] = in[0]; - return t; -} - -gsi_u32 gsiByteOrderSwap32(gsi_u32 _in) -{ - gsi_u32 t; - const char *in = (char *)&_in; - char *out = (char *)&t; - out[0] = in[3]; - out[1] = in[2]; - out[2] = in[1]; - out[3] = in[0]; - return t; -} - -gsi_u64 gsiByteOrderSwap64(gsi_u64 _in) -{ - gsi_u64 t; - const char *in = (char *)&_in; - char *out = (char *)&t; - out[0] = in[7]; - out[1] = in[6]; - out[2] = in[5]; - out[3] = in[4]; - out[4] = in[3]; - out[5] = in[2]; - out[6] = in[1]; - out[7] = in[0]; - return t; -} - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatform.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatform.h deleted file mode 100644 index a4daf16ebb4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatform.h +++ /dev/null @@ -1,487 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSPLATFORM_H__ -#define __GSPLATFORM_H__ - -// GameSpy platform definition and headers - -// Windows: _WIN32 -// Xbox: _WIN32 + _XBOX -// Xbox360: _WIN32 + _XBOX + _X360 -// MacOSX: _MACOSX + _UNIX -// Linux: _LINUX + _UNIX -// Nintendo DS: _NITRO -// PSP: _PSP -// PS3: _PS3 - -// PlayStation2: _PS2 -// w/ EENET: EENET (set by developer project) -// w/ INSOCK: INSOCK (set by developer project) -// w/ SNSYSTEMS: SN_SYSTEMS (set by developer project) -// Codewarrior: __MWERKS__ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Set the platform define -#ifdef __mips64 - #ifndef _PS2 - #define _PS2 - #endif - - // Make sure a network stack was defined - #if !defined(SN_SYSTEMS) && !defined(EENET) && !defined(INSOCK) - #error "PlayStation2 network stack was not defined!" - #endif -#endif - -#if defined(_LINUX) || defined(_MACOSX) - #define _UNIX -#endif - -#if defined(_XBOX) || defined (_X360) -#if _XBOX_VER >= 200 - #define _X360 -#endif -#endif - -// WIN32, set by OS headers -// _XBOX, set by OS headers -// __MWERKS__, set by compiler -// _NITRO, set by OS headers - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Include common OS headers -#include -#include -#include -#include - - -// XBOX/X360 -#if defined(_XBOX) - #include - -// WIN32 -#elif defined(_WIN32) - #define WIN32_LEAN_AND_MEAN - #include - #include - #include - - #if defined(GSI_WINSOCK2) - #include - #else - #include - #endif - - #if (_MSC_VER > 1300) - #define itoa(v, s, r) _itoa(v, s, r) - #endif -// PS2 -#elif defined(_PS2) - // EENet headers must be included before common PS2 headers - #ifdef EENET - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #endif // EENET - - // Common PS2 headers - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #ifdef SN_SYSTEMS - // undefine socket defines from sys/types.h - // This is to workaround sony now automatically including sys/types.h - // and SNSystems having not produce a patch yet (they'll likely do the same since - // the SNSystems fd_set is a slightly different size than the sys/types.h. - #undef FD_CLR - #undef FD_ZERO - #undef FD_SET - #undef FD_ISSET - #undef FD_SETSIZE - #undef fd_set - #include "snskdefs.h" - #include "sntypes.h" - #include "snsocket.h" - #include "sneeutil.h" - #include "sntcutil.h" - #endif // SN_SYSTEMS - - #ifdef INSOCK - #include "libinsck.h" - #include "libnet.h" - #include "sys/errno.h" - //#include "libmrpc.h" - #endif // INSOCK - -// LINUX and MACOSX -#elif defined(_UNIX) - #include - #include - #include - #include - #include - #include - #include - #include - - // MACOSX Warning!! netdb.h has it's own NOFILE define. - // GameSpy uses NOFILE to determine if an HD is available - #ifndef NOFILE - // Since GameSpy NOFILE is not defined, include netdb.h then undef NOFILE - #include - #undef NOFILE - #else - // Otherwise leave NOFILE defined - #include - #endif - - #include - #include - #include - #include - //#include - #include - - // ICMP ping support is unsupported on Linux/MacOSX due to needing super-user access for raw sockets - #define SB_NO_ICMP_SUPPORT - -// Nintendo DS -#elif defined(_NITRO) - #include - #define NINET_NWBASE_MD5_H_ // resolves md5 conflicts - #include - #include // mwerks - #include - - // Raw sockets are undefined on Nitro - #define SB_NO_ICMP_SUPPORT - -// Sony PSP -#elif defined(_PSP) - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include -// PS3 -#elif defined(_PS3) -#include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -// #include - #include - #include - -// Nintendo Wii -#elif defined(_REVOLUTION) - #include - #include - #include - #include - - // Raw sockets are undefined on Revolution - #define SB_NO_ICMP_SUPPORT - -// Unsupported platform or no platform defined! -#else - #error "The GameSpy SDKs do not support this operating system" - -#endif //(platform switch) - - - -//---------- __cdecl fix for __fastcall conventions ---------- -#if defined(_WIN32) - #define GS_STATIC_CALLBACK __cdecl -#else - #define GS_STATIC_CALLBACK -#endif - - -//---------- Handle Endianess ---------------------- -#if defined(_PS3) || defined(_REVOLUTION) || defined(_X360) //defined(_MACOSX) - #define GSI_BIG_ENDIAN -#endif -#ifndef GSI_BIG_ENDIAN - #define GSI_LITTLE_ENDIAN -#endif - - - -#include - -#if defined(_MACOSX) - #undef _T -#endif - -#include - -#if defined(GS_NO_FILE) || defined(_PS2) || defined(_PS3) || defined(_NITRO) || defined(_PSP) || defined(_XBOX) - #define NOFILE -#endif - -#if defined(_PSP) || defined(_NITRO) - #define GS_WIRELESS_DEVICE -#endif - -#if !defined(GSI_DOMAIN_NAME) - #define GSI_DOMAIN_NAME "gamespy.com" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Define GameSpy types - -// common base type defines, please refer to ranges below when porting -typedef char gsi_i8; -typedef unsigned char gsi_u8; -typedef short gsi_i16; -typedef unsigned short gsi_u16; -typedef int gsi_i32; -typedef unsigned int gsi_u32; -typedef unsigned int gsi_time; // must be 32 bits - -// decprecated -typedef gsi_i32 goa_int32; // 2003.Oct.04.JED - typename deprecated -typedef gsi_u32 goa_uint32; // these types will be removed once all SDK's are updated - -typedef int gsi_bool; -#define gsi_false ((gsi_bool)0) -#define gsi_true ((gsi_bool)1) -#define gsi_is_false(x) ((x) == gsi_false) -#define gsi_is_true(x) ((x) != gsi_false) - -// Max integer size -#if defined(_INTEGRAL_MAX_BITS) && !defined(GSI_MAX_INTEGRAL_BITS) - #define GSI_MAX_INTEGRAL_BITS _INTEGRAL_MAX_BITS -#else - #define GSI_MAX_INTEGRAL_BITS 32 -#endif - -// Platform dependent types -#ifdef _PS2 - typedef signed long gsi_i64; - typedef unsigned long gsi_u64; -#elif defined(_WIN32) - #if (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)) - typedef __int64 gsi_i64; - typedef unsigned __int64 gsi_u64; - #endif -#elif defined(_NITRO) - typedef s64 gsi_i64; - typedef u64 gsi_u64; -#elif defined (_PSP) - typedef long long gsi_i64; - typedef unsigned long long gsi_u64; -#elif defined (_PS3) - typedef int64_t gsi_i64; - typedef uint64_t gsi_u64; -#elif defined (_REVOLUTION) - typedef signed long long gsi_i64; - typedef unsigned long long gsi_u64; -#else /* _UNIX */ - typedef long long gsi_i64; - typedef unsigned long long gsi_u64; -#endif // 64 bit types - -#ifndef GSI_UNICODE - #define gsi_char char -#else - #define gsi_char unsigned short -#endif // goa_char - - -// expected ranges for integer types -#define GSI_MIN_I8 CHAR_MIN -#define GSI_MAX_I8 CHAR_MAX -#define GSI_MAX_U8 UCHAR_MAX - -#define GSI_MIN_I16 SHRT_MIN -#define GSI_MAX_I16 SHRT_MAX -#define GSI_MAX_U16 USHRT_MAX - -#define GSI_MIN_I32 INT_MIN -#define GSI_MAX_I32 INT_MAX -#define GSI_MAX_U32 UINT_MAX - -#if (GSI_MAX_INTEGRAL_BITS >= 64) -#define GSI_MIN_I64 (-9223372036854775807 - 1) -#define GSI_MAX_I64 9223372036854775807 -#define GSI_MAX_U64 0xffffffffffffffffui64 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Common platform string functions -#undef _vftprintf -#undef _ftprintf -#undef _stprintf -#undef _tprintf -#undef _tcscpy -#undef _tcsncpy -#undef _tcscat -#undef _tcslen -#undef _tcschr -#undef _tcscmp -#undef _tfopen -#undef _T -#undef _tsnprintf - -#ifdef GSI_UNICODE - #define _vftprintf vfwprintf - #define _ftprintf fwprintf - #define _stprintf swprintf - #define _tprintf wprintf - #define _tcscpy wcscpy - #define _tcsncpy(d, s, l) wcsncpy((wchar_t *)d, (wchar_t *)s, l) - #define _tcscat wcscat - #define _tcslen wcslen - #define _tcschr wcschr - #define _tcscmp(s1, s2) wcscmp((wchar_t *)s1, (wchar_t *)s2) - #define _tfopen _wfopen - #define _T(a) L##a - - #if defined(_WIN32) || defined(_PS2) - #define _tsnprintf _snwprintf - #else - #define _tsnprintf swprintf - #endif -#else - #define _vftprintf vfprintf - #define _ftprintf fprintf - #define _stprintf sprintf - #define _tprintf printf - #define _tcscpy strcpy - #define _tcsncpy strncpy - #define _tcscat strcat - #define _tcslen strlen -#if defined (_MSC_VER) -#if (_MSC_VER < 1400) - #define _tcschr strchr -#endif -#else - #define _tcschr strchr -#endif - #define _tcscmp strcmp - #define _tfopen fopen -#ifndef _T - #define _T(a) a -#endif - - #if defined(_WIN32) - #define _tsnprintf _snprintf - #else - #define _tsnprintf snprintf - #endif -#endif // GSI_UNICODE - -#if defined(_WIN32) - #define snprintf _snprintf -#endif // _WIN32 - -#if defined(_WIN32) - #define strcasecmp _stricmp - #define strncasecmp _strnicmp -#endif - -#if !defined(_WIN32) - char *_strlwr(char *string); - char *_strupr(char *string); -#endif - -char * goastrdup(const char *src); -unsigned short * goawstrdup(const unsigned short *src); - - -// ------ Cross Plat Alignment macros ------------ -/* ex use -PRE_ALIGN(16) struct VECTOR -{ - float x,y,z,_unused; -} POST_ALIGN(16); - -// another example when defining a variable: -PRE_ALIGN(16); -static char _mempool[MEMPOOL_SIZE] POST_ALIGN(16); - -*/ -#if defined _WIN32 - #define PRE_ALIGN(x) __declspec(align(x)) // ignore Win32 directive - #define POST_ALIGN(x) // ignore -#elif defined (_PS2) || defined (_PSP) || defined (_PS3) - #define PRE_ALIGN(x) // ignored this on psp/ps2 - #define POST_ALIGN(x) __attribute__((aligned (x))) // -#elif defined (_REVOLUTION) - #define PRE_ALIGN(x) // not needed - #define POST_ALIGN(x) __attribute__((aligned(32))) -#else - // #warning "Platform not supported" - #define PRE_ALIGN(x) // ignore - #define POST_ALIGN(x) // ignore -#endif - -#define DIM( x ) ( sizeof( x ) / sizeof((x)[ 0 ])) - -unsigned char * gsiFloatSwap(unsigned char buf[4], float); -float gsiFloatUnswap(unsigned char buf[4]); -extern gsi_u16 gsiByteOrderSwap16(gsi_u16); -extern gsi_u32 gsiByteOrderSwap32(gsi_u32); -extern gsi_u64 gsiByteOrderSwap64(gsi_u64); - - -#ifdef __cplusplus -} -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __GSPLATFORM_H__ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformSocket.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformSocket.c deleted file mode 100644 index f407cf8c6a5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformSocket.c +++ /dev/null @@ -1,684 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsPlatformSocket.h" -#include "gsPlatformUtil.h" -#include "gsMemory.h" - -// mj-ToDo: remove these and include the files int the linker instead. -// removing reference to other platforms. -// remove all plat specific code from here, move it to the platspecific files. - -// Include platform separated functions -#if defined(_X360) - #include "x360/gsSocketX360.c" -#elif defined(_XBOX) - #include "xbox/gsSocketXBox.c" -#elif defined(_WIN32) - #include "win32/gsSocketWin32.c" -#elif defined(_LINUX) - //#include "linux/gsSocketLinux.c" -#elif defined(_MACOSX) - //#include "macosx/gsSocketMacOSX.c" -#elif defined(_NITRO) - #include "nitro/gsSocketNitro.c" -#elif defined(_PS2) - #include "ps2/gsSocketPs2.c" -#elif defined(_PS3) - #include "ps3/gsSocketPs3.c" - #include -#elif defined(_PSP) - #include "psp/gsSocketPSP.c" -#elif defined(_REVOLUTION) - #include "revolution/gsSocketRevolution.c" -#else - #error "Missing or unsupported platform" -#endif - - -// Disable compiler warnings for issues that are unavoidable. -///////////////////////////////////////////////////////////// -#if defined(_MSC_VER) // DevStudio - // Level4, "conditional expression is constant". - // Occurs with use of the MS provided macro FD_SET - #pragma warning ( disable: 4127 ) -#endif // _MSC_VER - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int SetSockBlocking(SOCKET sock, int isblocking) -{ - int rcode = -1; - -#if defined(_REVOLUTION) - int val; - - val = SOFcntl(sock, SO_F_GETFL, 0); - - if(isblocking) - val &= ~SO_O_NONBLOCK; - else - val |= SO_O_NONBLOCK; - - rcode = SOFcntl(sock, SO_F_SETFL, val); -#elif defined(_NITRO) - int val; - - val = SOC_Fcntl(sock, SOC_F_GETFL, 0); - - if(isblocking) - val &= ~SOC_O_NONBLOCK; - else - val |= SOC_O_NONBLOCK; - - rcode = SOC_Fcntl(sock, SOC_F_SETFL, val); -#else - #if defined(_PS2) || defined(_PS3) - // EENet requires int - // SNSystems requires int - // Insock requires int - // PS3 requires int - gsi_i32 argp; - #else - unsigned long argp; - #endif - - if(isblocking) - argp = 0; - else - argp = 1; - - #ifdef _PS2 - #ifdef SN_SYSTEMS - rcode = setsockopt(sock, SOL_SOCKET, (isblocking) ? SO_BIO : SO_NBIO, &argp, sizeof(argp)); - #endif - - #ifdef EENET - rcode = setsockopt(sock, SOL_SOCKET, SO_NBIO, &argp, sizeof(argp)); - #endif - - #ifdef INSOCK - if (isblocking) - argp = -1; - else - argp = 5; //added longer timeout to 5ms - sceInsockSetRecvTimeout(sock, argp); - sceInsockSetSendTimeout(sock, argp); - sceInsockSetShutdownTimeout(sock, argp); - GSI_UNUSED(sock); - rcode = 0; - #endif - #elif defined(_PSP) - rcode = setsockopt(sock, SCE_NET_INET_SOL_SOCKET, SCE_NET_INET_SO_NBIO, &argp, sizeof(argp)); - #elif defined(_PS3) - rcode = setsockopt(sock, SOL_SOCKET, SO_NBIO, &argp, sizeof(argp)); - #else - rcode = ioctlsocket(sock, FIONBIO, &argp); - #endif -#endif - - if(rcode == 0) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "SetSockBlocking: Set socket %d to %s\r\n", (unsigned int)sock, isblocking ? "blocking":"non-blocking"); - return 1; - } - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "SetSockBlocking failed: tried to set socket %d to %s\r\n", (unsigned int)sock, isblocking ? "blocking":"non-blocking"); - return 0; -} - -int SetSockBroadcast(SOCKET sock) -{ -#if !defined(INSOCK) && !defined(_NITRO) && !defined(_REVOLUTION) - int optval = 1; - if(setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) != 0) - return 0; -#else - GSI_UNUSED(sock); -#endif - - return 1; -} - -int DisableNagle(SOCKET sock) -{ -#if defined(_WIN32) || defined(_UNIX) - int rcode; - int noDelay = 1; - - rcode = setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&noDelay, sizeof(int)); - return gsiSocketIsError(rcode); -#else - GSI_UNUSED(sock); - - // not supported - return 0; -#endif // moved this to here to silence VC warning -} - - -#ifndef INSOCK - int SetReceiveBufferSize(SOCKET sock, int size) - { - int rcode; - rcode = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (const char *)&size, sizeof(int)); - return gsiSocketIsNotError(rcode); - } - - int SetSendBufferSize(SOCKET sock, int size) - { - int rcode; - rcode = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (const char *)&size, sizeof(int)); - return gsiSocketIsNotError(rcode); - } - - int GetReceiveBufferSize(SOCKET sock) - { - int rcode; - int size; - int len; - - len = sizeof(size); - - rcode = getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&size, &len); - - if(gsiSocketIsError(rcode)) - return -1; - - return size; - } - - int GetSendBufferSize(SOCKET sock) - { - int rcode; - int size; - int len; - - len = sizeof(size); - - rcode = getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&size, &len); - - if(gsiSocketIsError(rcode)) - return -1; - - return size; - } - - // Formerly known as ghiSocketSelect -#ifdef SN_SYSTEMS - #undef FD_SET - #define FD_SET(s,p) ((p)->array[((s) - 1) >> SN_FD_SHR] |= \ - (unsigned int)(1 << (((s) - 1) & SN_FD_BITS)) ) - -#endif -#endif - -#if !defined(_NITRO) && !defined(INSOCK) && !defined(_REVOLUTION) - int GSISocketSelect(SOCKET theSocket, int* theReadFlag, int* theWriteFlag, int* theExceptFlag) - { - fd_set aReadSet; - fd_set aWriteSet; - fd_set aExceptSet; - fd_set * aReadFds = NULL; - fd_set * aWriteFds = NULL; - fd_set * aExceptFds = NULL; - int aResult; -// 04-13-2005, Saad Nader -// Added case for SN Systems that would -// handle errors after performing selects. -#ifdef SN_SYSTEMS - int aOut, aOutLen = sizeof(aOut); -#endif - - struct timeval aTimeout = { 0, 0 }; - - assert(theSocket != INVALID_SOCKET); - - // Setup the parameters. - //////////////////////// - if(theReadFlag != NULL) - { - FD_ZERO(&aReadSet); - FD_SET(theSocket,&aReadSet); - aReadFds = &aReadSet; - } - if(theWriteFlag != NULL) - { - FD_ZERO(&aWriteSet); - FD_SET(theSocket, &aWriteSet); - aWriteFds = &aWriteSet; - } - if(theExceptFlag != NULL) - { - FD_ZERO(&aExceptSet); - FD_SET(theSocket, &aExceptSet); - aExceptFds = &aExceptSet; - } -#ifdef _PS3 - // to do, port what is below in the else -//int socketselect(int nfds, fd_set *readfds, fd_set *writefds,fd_set *exceptfds, struct timeval *timeout); - aResult = socketselect(FD_SETSIZE, aReadFds, aWriteFds, aExceptFds, &aTimeout); -#else - // Perform the select - aResult = select(FD_SETSIZE, aReadFds, aWriteFds, aExceptFds, &aTimeout); -#endif - if(gsiSocketIsError(aResult)) - return -1; - -// 04-13-2005, Saad Nader -// Added case for SN Systems that would -// handle errors after performing selects. -#ifdef SN_SYSTEMS - getsockopt(theSocket, SOL_SOCKET, SO_ERROR, (char *)&aOut, &aOutLen); - if (aOut != 0) - { - return 0; - } -#endif - // Check results. - ///////////////// - if(theReadFlag != NULL) - { - if((aResult > 0) && FD_ISSET(theSocket, aReadFds)) - *theReadFlag = 1; - else - *theReadFlag = 0; - } - if(theWriteFlag != NULL) - { - if((aResult > 0) && FD_ISSET(theSocket, aWriteFds)) - *theWriteFlag = 1; - else - *theWriteFlag = 0; - } - if(theExceptFlag != NULL) - { - if((aResult > 0) && FD_ISSET(theSocket, aExceptFds)) - *theExceptFlag = 1; - else - *theExceptFlag = 0; - } - return aResult; // 0 or 1 at this point - } -#endif // !nitro && !revolution && !insock - - -// Return 1 for immediate recv, otherwise 0 -int CanReceiveOnSocket(SOCKET sock) -{ - int aReadFlag = 0; - if (1 == GSISocketSelect(sock, &aReadFlag, NULL, NULL)) - return aReadFlag; - - // SDKs expect 0 on SOCKET_ERROR - return 0; -} - -// Return 1 for immediate send, otherwise 0 -int CanSendOnSocket(SOCKET sock) -{ - int aWriteFlag = 0; - if (1 == GSISocketSelect(sock, NULL, &aWriteFlag, NULL)) - return aWriteFlag; - - // SDKs expect 0 on SOCKET_ERROR - return 0; -} - - -#if defined(_PS3) || defined (_PSP) - -#else - -HOSTENT * getlocalhost(void) -{ -#ifdef EENET - #define MAX_IPS 5 - - static HOSTENT localhost; - static char * aliases = NULL; - static char * ipPtrs[MAX_IPS + 1]; - static unsigned int ips[MAX_IPS]; - - struct sceEENetIfname * interfaces; - struct sceEENetIfname * interface; - int num; - int i; - int count; - int len; - u_short flags; - IN_ADDR address; - - // initialize the host - localhost.h_name = "localhost"; - localhost.h_aliases = &aliases; - localhost.h_addrtype = AF_INET; - localhost.h_length = 0; - localhost.h_addr_list = ipPtrs; - - // get the local interfaces - sceEENetGetIfnames(NULL, &num); - interfaces = (struct sceEENetIfname *)gsimalloc(num * sizeof(struct sceEENetIfname)); - if(!interfaces) - return NULL; - sceEENetGetIfnames(interfaces, &num); - - // loop through the interfaces - count = 0; - for(i = 0 ; i < num ; i++) - { - // the next interface - interface = &interfaces[i]; - //printf("eenet%d: %s\n", i, interface->ifn_name); - - // get the flags - len = sizeof(flags); - if(sceEENetGetIfinfo(interface->ifn_name, sceEENET_IFINFO_IFFLAGS, &flags, &len) != 0) - continue; - //printf("eenet%d flags: 0x%X\n", i, flags); - - // check for up, running, and non-loopback - if(!(flags & (IFF_UP|IFF_RUNNING)) || (flags & IFF_LOOPBACK)) - continue; - //printf("eenet%d: up and running, non-loopback\n", i); - - // get the address - len = sizeof(address); - if(sceEENetGetIfinfo(interface->ifn_name, sceEENET_IFINFO_ADDR, &address, &len) != 0) - continue; - //printf("eenet%d: %s\n", i, inet_ntoa(address)); - - // add this address - ips[count] = address.s_addr; - ipPtrs[count] = (char *)&ips[count]; - count++; - } - - // free the interfaces - gsifree(interfaces); - - // check that we got at least one IP - if(!count) - return NULL; - - // finish filling in the host struct - localhost.h_length = (gsi_u16)sizeof(ips[0]); - ipPtrs[count] = NULL; - - return &localhost; - - //////////////////// - // INSOCK -#elif defined(INSOCK) - // Global storage - #define MAX_IPS sceLIBNET_MAX_INTERFACE - static HOSTENT localhost; - static char * aliases = NULL; - static char * ipPtrs[MAX_IPS + 1]; - static unsigned int ips[MAX_IPS]; - - // Temp storage - int aInterfaceIdArray[MAX_IPS]; - int aNumInterfaces = 0; - int aInterfaceNum = 0; - int aCount = 0; - - // Get the list of interfaces - aNumInterfaces = sceInetGetInterfaceList(&gGSIInsockClientData, - &gGSIInsockSocketBuffer, aInterfaceIdArray, MAX_IPS); - if (aNumInterfaces < 1) - return NULL; - - // initialize the HOSTENT - localhost.h_name = "localhost"; - localhost.h_aliases = &aliases; - localhost.h_addrtype = AF_INET; - localhost.h_addr_list = ipPtrs; - - // Look up each address and copy into the HOSTENT structure - aCount = 0; // count of valid interfaces - for (aInterfaceNum = 0; aInterfaceNum < aNumInterfaces; aInterfaceNum++) - { - sceInetAddress_t anAddr; - int result = sceInetInterfaceControl(&gGSIInsockClientData, &gGSIInsockSocketBuffer, - aInterfaceIdArray[aInterfaceNum], sceInetCC_GetAddress, - &anAddr, sizeof(anAddr)); - if (result == 0) - { - // Add this interface to the array - memcpy(&ips[aCount], anAddr.data, sizeof(ips[aCount])); - ips[aCount] = htonl(ips[aCount]); - ipPtrs[aCount] = (char*)&ips[aCount]; - aCount++; - } - } - - // Set the final hostent data, then return - localhost.h_length = (gsi_u16)sizeof(ips[0]); - ipPtrs[aCount] = NULL; - return &localhost; - -#elif defined(_NITRO) - #define MAX_IPS 5 - - static HOSTENT localhost; - static char * aliases = NULL; - static char * ipPtrs[MAX_IPS + 1]; - static unsigned int ips[MAX_IPS]; - - int count = 0; - - localhost.h_name = "localhost"; - localhost.h_aliases = &aliases; - localhost.h_addrtype = AF_INET; - localhost.h_length = 0; - localhost.h_addr_list = (u8 **)ipPtrs; - - ips[count] = 0; - IP_GetAddr(NULL, (u8*)&ips[count]); - if(ips[count] == 0) - return NULL; - ipPtrs[count] = (char *)&ips[count]; - count++; - - localhost.h_length = (gsi_u16)sizeof(ips[0]); - ipPtrs[count] = NULL; - - return &localhost; - -#elif defined(_REVOLUTION) - #define MAX_IPS 5 - static HOSTENT aLocalHost; - static char * aliases = NULL; - int aNumOfIps, i; - int aSizeNumOfIps; - static IPAddrEntry aAddrs[MAX_IPS]; - int aAddrsSize, aAddrsSizeInitial; - static u8 * ipPtrs[MAX_IPS + 1]; - static unsigned int ips[MAX_IPS]; - int ret; - aSizeNumOfIps = sizeof(aNumOfIps); - ret = SOGetInterfaceOpt(NULL, SO_SOL_CONFIG, SO_CONFIG_IP_ADDR_NUMBER, &aNumOfIps, &aSizeNumOfIps); - if (ret != 0) - return NULL; - - aAddrsSize = (int)(MAX_IPS * sizeof(IPAddrEntry)); - aAddrsSizeInitial = aAddrsSize; - ret = SOGetInterfaceOpt(NULL, SO_SOL_CONFIG, SO_CONFIG_IP_ADDR_TABLE, &aAddrs, &aAddrsSize); - if (ret != 0) - return NULL; - - if (aAddrsSize != aAddrsSizeInitial) - { - aNumOfIps = aAddrsSize / (int)sizeof(IPAddrEntry); - } - - aLocalHost.h_name = "localhost"; - aLocalHost.h_aliases = &aliases; - aLocalHost.h_addrtype = AF_INET; - aLocalHost.h_length = SO_IP4_ALEN; - - for (i = 0; i < MAX_IPS; i++) - { - if (i < aNumOfIps) - { - memcpy(&ips[i], &aAddrs[i].addr, sizeof(aAddrs[i].addr)); - ipPtrs[i] = (u8 *)&ips[i]; - } - else - ipPtrs[i] = NULL; - } - aLocalHost.h_addr_list = ipPtrs; - - return &aLocalHost; - -#elif defined(_X360) - XNADDR addr; - DWORD rcode; - static HOSTENT localhost; - static char * ipPtrs[2]; - static IN_ADDR ip; - - while((rcode = XNetGetTitleXnAddr(&addr)) == XNET_GET_XNADDR_PENDING) - msleep(1); - - if((rcode == XNET_GET_XNADDR_NONE) || (rcode == XNET_GET_XNADDR_TROUBLESHOOT)) - return NULL; - - localhost.h_name = "localhost"; - localhost.h_aliases = NULL; - localhost.h_addrtype = AF_INET; - localhost.h_length = (gsi_u16)sizeof(IN_ADDR); - localhost.h_addr_list = (gsi_i8 **)ipPtrs; - - ip = addr.ina; - ipPtrs[0] = (char *)&ip; - ipPtrs[1] = NULL; - - return &localhost; - -#elif defined(_XBOX) - return NULL; - - -#else - char hostname[256] = ""; - - // get the local host's name - gethostname(hostname, sizeof(hostname)); - - // return the host for that name - return gethostbyname(hostname); -#endif -} -#endif - -int IsPrivateIP(IN_ADDR * addr) -{ - int b1; - int b2; - unsigned int ip; - - // get the first 2 bytes - ip = ntohl(addr->s_addr); - b1 = (int)((ip >> 24) & 0xFF); - b2 = (int)((ip >> 16) & 0xFF); - - // 10.X.X.X - if(b1 == 10) - return 1; - - // 172.16-31.X.X - if((b1 == 172) && ((b2 >= 16) && (b2 <= 31))) - return 1; - - // 192.168.X.X - if((b1 == 192) && (b2 == 168)) - return 1; - - return 0; -} - -gsi_u32 gsiGetBroadcastIP(void) -{ -#if defined(_NITRO) - gsi_u32 ip; - IP_GetBroadcastAddr(NULL, (u8*)&ip); - return ip; - -#elif defined(_REVOLUTION) - /* - int length; - gsi_u32 ip; - - length = (gsi_u32)sizeof(ip); - - // IP_GetBroadcastAddr replaced by SOGetInterfaceOpt - // IP_GetBroadcastAddr(NULL, (u8*)&ip); - SOGetInterfaceOpt(NULL, SO_SOL_IP, SO_INADDR_BROADCAST, (u8*)&ip, &length); - */ - IPAddrEntry* addrtbl; - int addrnum; - int ret; - int length; - gsi_u32 ip; - length = (int)sizeof( addrnum ); - - ret = SOGetInterfaceOpt(NULL, - SO_SOL_CONFIG, - SO_CONFIG_IP_ADDR_NUMBER, - (u8*)&addrnum, &length); - - if( ret >= 0 ) - return 0xFFFFFFFF; - - - length = (int)(sizeof( IPAddrEntry ) * addrnum); - - addrtbl = (IPAddrEntry*)gsimalloc( (u32)length ); - - if( addrtbl == NULL ) - return 0xFFFFFFFF; - - ret = SOGetInterfaceOpt(NULL, - SO_SOL_CONFIG, - SO_CONFIG_IP_ADDR_TABLE, - (u8*)addrtbl, - &length); - - if( ret < 0 ) - { - gsifree( addrtbl ); - return 0xFFFFFFFF; - } - - ip = (u32)(addrtbl->bcastAddr[3] - | (addrtbl->bcastAddr[2] << 8) - | (addrtbl->bcastAddr[1] << 16) - | (addrtbl->bcastAddr[0] << 24)); - - gsifree( addrtbl ); - - - return ip; - - return ip; - -#else - return 0xFFFFFFFF; -#endif -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// Re-enable previously disabled compiler warnings -/////////////////////////////////////////////////// -#if defined(_MSC_VER) -#pragma warning ( default: 4127 ) -#endif // _MSC_VER - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformSocket.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformSocket.h deleted file mode 100644 index ab7f2e0792c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformSocket.h +++ /dev/null @@ -1,654 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSSOCKET_H__ -#define __GSSOCKET_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsPlatform.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - - - -// GSI Cross Platform Socket Wrapper - -// this should all inline and optimize out... I hope -// if they somehow get really complex, we need to move the implementation into the .c file. -#if defined _PS3 || defined _PSP - #define gsiSocketIsError(theReturnValue) ((theReturnValue) < 0) - #define gsiSocketIsNotError(theReturnValue) ((theReturnValue) >= 0) -#else - #define gsiSocketIsError(theReturnValue) ((theReturnValue) == -1) - #define gsiSocketIsNotError(theReturnValue) ((theReturnValue) != -1) -#endif - - -#if (0) -// to do for Saad and Martin, move towards this and phase out the #define jungle. -// we will trade a little speed for a lot of portability, and stability -// also out debug libs will assert all params comming in. -typedef enum -{ - GS_SOCKERR_NONE = 0, - GS_SOCKERR_EWOULDBLOCK, - GS_SOCKERR_EINPROGRESS, - GS_SOCKERR_EALREADY, - GS_SOCKERR_ENOTSOCK, - GS_SOCKERR_EDESTADDRREQ, - GS_SOCKERR_EMSGSIZE, - GS_SOCKERR_EPROTOTYPE, - GS_SOCKERR_ENOPROTOOPT , - GS_SOCKERR_EPROTONOSUPPORT , - GS_SOCKERR_ESOCKTNOSUPPORT, - GS_SOCKERR_EOPNOTSUPP , - GS_SOCKERR_EPFNOSUPPORT, - GS_SOCKERR_EAFNOSUPPORT, - GS_SOCKERR_EADDRINUSE , - GS_SOCKERR_EADDRNOTAVAIL , - GS_SOCKERR_ENETDOWN , - GS_SOCKERR_ENETUNREACH , - GS_SOCKERR_ENETRESET, - GS_SOCKERR_ECONNABORTED, - GS_SOCKERR_ECONNRESET , - GS_SOCKERR_ENOBUFS , - GS_SOCKERR_EISCONN , - GS_SOCKERR_ENOTCONN, - GS_SOCKERR_ESHUTDOWN, - GS_SOCKERR_ETOOMANYREFS , - GS_SOCKERR_ETIMEDOUT, - GS_SOCKERR_ECONNREFUSED, - GS_SOCKERR_ELOOP, - GS_SOCKERR_ENAMETOOLONG, - GS_SOCKERR_EHOSTDOWN , - GS_SOCKERR_EHOSTUNREACH , - GS_SOCKERR_ENOTEMPTY , - GS_SOCKERR_EPROCLIM , - GS_SOCKERR_EUSERS , - GS_SOCKERR_EDQUOT , - GS_SOCKERR_ESTALE , - GS_SOCKERR_EREMOTE , - GS_SOCKERR_EINVAL , - GS_SOCKERR_COUNT , -} GS_SOCKET_ERROR; - -#define gsiSocketIsError(theReturnValue) ((theReturnValue) != GS_SOCKERR_NONE) -#define gsiSocketIsNotError(theReturnValue) ((theReturnValue) == GS_SOCKERR_NONE) - -typedef int GSI_SOCKET; - -// mj - may need to pragma pack this, otherwise, it will pad after u_short -typedef struct -{ - // this is the same as the "default" winsocks - u_short sa_family; /* address family */ - char sa_data[14]; /* up to 14 bytes of direct address */ -} GS_SOCKADDR; - -GSI_SOCKET gsiSocketAccept (GSI_SOCKET sock, GS_SOCKADDR* addr, int* len); -GS_SOCKET_ERROR gsiSocketSocket (int pf, int type, int protocol); -GS_SOCKET_ERROR gsiSocketClosesocket(GSI_SOCKET sock); -GS_SOCKET_ERROR gsiSocketShutdown (GSI_SOCKET sock, int how); -GS_SOCKET_ERROR gsiSocketBind (GSI_SOCKET sock, const GS_SOCKADDR* addr, int len); -GS_SOCKET_ERROR gsiSocketConnect (GSI_SOCKET sock, const GS_SOCKADDR* addr, int len); -GS_SOCKET_ERROR gsiSocketListen (GSI_SOCKET sock, int backlog); -GS_SOCKET_ERROR gsiSocketRecv (GSI_SOCKET sock, char* buf, int len, int flags); -GS_SOCKET_ERROR gsiSocketRecvfrom (GSI_SOCKET sock, char* buf, int len, int flags, GS_SOCKADDR* addr, int* fromlen); -GS_SOCKET_ERROR gsiSocketSend (GSI_SOCKET sock, const char* buf, int len, int flags); -GS_SOCKET_ERROR gsiSocketSendto (GSI_SOCKET sock, const char* buf, int len, int flags, const GS_SOCKADDR* addr, int tolen); -GS_SOCKET_ERROR gsiSocketGetsockopt (GSI_SOCKET sock, int level, int optname, char* optval, int* optlen); -GS_SOCKET_ERROR gsiSocketSetsockopt (GSI_SOCKET sock, int level, int optname, const char* optval, int optlen); -GS_SOCKET_ERROR gsiSocketGetsockname(GSI_SOCKET sock, GS_SOCKADDR* addr, int* len); -GS_SOCKET_ERROR GOAGetLastError (GSI_SOCKET sock); - -gsiSocketGethostbyaddr(a,l,t) SOC_GetHostByAddr(a,l,t) -gsiSocketGethostbyname(n) SOC_GetHostByName(n) - - -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Types - - -#ifndef INADDR_NONE - #define INADDR_NONE 0xffffffff -#endif - -#ifndef INVALID_SOCKET - #define INVALID_SOCKET (-1) -#endif - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Platform socket types -#if defined(_PSP) - #define AF_INET SCE_NET_INET_AF_INET - #define SOCK_STREAM SCE_NET_INET_SOCK_STREAM - #define SOCK_DGRAM SCE_NET_INET_SOCK_DGRAM - #define SOCK_RAW SCE_NET_INET_SOCK_RAW - #define INADDR_ANY SCE_NET_INET_INADDR_ANY - #define SOL_SOCKET SCE_NET_INET_SOL_SOCKET - #define SO_SNDBUF SCE_NET_INET_SO_SNDBUF - #define SO_RCVBUF SCE_NET_INET_SO_RCVBUF - #define SO_NBIO SCE_NET_INET_SO_NBIO - #define SO_BROADCAST SCE_NET_INET_SO_BROADCAST - #define SO_KEEPALIVE SCE_NET_INET_SO_KEEPALIVE - #define SO_REUSEADDR SCE_NET_INET_SO_REUSEADDR - - #define IPPROTO_TCP SCE_NET_INET_IPPROTO_TCP // protocol defined by SOCK_STREAM - #define IPPROTO_UDP SCE_NET_INET_IPPROTO_UDP // protocol defined by SOCK_DGRAM - #define IPPROTO_ICMP SCE_NET_INET_IPPROTO_ICMP // protocol for ICMP pings - - // structures - #define in_addr SceNetInetInAddr - #define sockaddr_in SceNetInetSockaddrIn - #define sockaddr SceNetInetSockaddr - - // Remove FD types set in sys/types.h - // Replace with types in pspnet/sys/select.h - #if defined(_SYS_TYPES_H) && defined(FD_SET) - #undef fd_set - #undef FD_SET - #undef FD_CLR - #undef FD_ZERO - #undef timeval - #undef FD_SETSIZE - #endif - #define fd_set SceNetInetFdSet - #define timeval SceNetInetTimeval - #define FD_SET SceNetInetFD_SET - #define FD_CLR SceNetInetFD_CLR - #define FD_ZERO SceNetInetFD_ZERO - #define FD_SETSIZE SCE_NET_INET_FD_SETSIZE - - // functions - #define htonl sceNetHtonl - #define ntohl sceNetNtohl - #define htons sceNetHtons - #define ntohs sceNetNtohs - #define socket sceNetInetSocket - #define shutdown sceNetInetShutdown - #define closesocket sceNetInetClose - - #define setsockopt sceNetInetSetsockopt - #define getsockopt(s, l, on, ov, ol) sceNetInetGetsockopt(s, l, on, ov, (SceNetInetSocklen_t *)ol) - - #define bind sceNetInetBind - #define select sceNetInetSelect - - #define connect sceNetInetConnect - #define listen sceNetInetListen - #define accept(s,a,l) sceNetInetAccept(s, a, (SceNetInetSocklen_t *)l) - - #define send sceNetInetSend - #define recv sceNetInetRecv - #define sendto sceNetInetSendto - #define recvfrom(s, b, l, f, fr, fl) sceNetInetRecvfrom(s, b, l, f, fr, (SceNetInetSocklen_t *)fl) - - - #define inet_addr sceNetInetInetAddr - // This is not the correct function for gethostname, it should get the string name of the local host - // not the sockaddr_in struct - #define gethostname // sceNetInetGetsockname - #define getsockname(s,n,l) sceNetInetGetsockname(s, n, (SceNetInetSocklen_t *)l) - - #define GOAGetLastError(s) sceNetInetGetErrno() - - // hostent support - struct hostent - { - char* h_name; - char** h_aliases; - gsi_u16 h_addrtype; // AF_INET - gsi_u16 h_length; - char** h_addr_list; - }; - - #define gethostbyname gsSocketGetHostByName - #define inet_ntoa gsSocketInetNtoa - - #define GSI_RESOLVER_TIMEOUT (5*1000*1000) // 5 seconds - #define GSI_RESOLVER_RETRY (2) - - struct hostent* gsSocketGetHostByName(const char* name); // gsSocketPSP.c - const char* gsSocketInetNtoa(struct in_addr in); - - -#endif // _PSP - -// XBOX doesn't have host lookup -#if defined(_XBOX) - #if defined(_X360) - // hostent support - struct hostent - { - char* h_name; - char** h_aliases; - gsi_u16 h_addrtype; // AF_INET - gsi_u16 h_length; - char** h_addr_list; - }; - - typedef struct hostent HOSTENT; - struct hostent * gethostbyname(const char* name); - #else - typedef int HOSTENT; - #endif - - char * inet_ntoa(IN_ADDR in_addr); -#endif - -#if defined(SN_SYSTEMS) - #define IPPROTO_TCP PF_INET - #define IPPROTO_UDP PF_INET - #define FD_SETSIZE SN_MAX_SOCKETS -#endif - -// SOCKET ERROR CODES -#if defined(_REVOLUTION) //not sure if Wii uses this or _REV - #define WSAEWOULDBLOCK SO_EWOULDBLOCK - #define WSAEINPROGRESS SO_EINPROGRESS - #define WSAEALREADY SO_EALREADY - #define WSAENOTSOCK SO_ENOTSOCK - #define WSAEDESTADDRREQ SO_EDESTADDRREQ - #define WSAEMSGSIZE SO_EMSGSIZE - #define WSAEPROTOTYPE SO_EPROTOTYPE - #define WSAENOPROTOOPT SO_ENOPROTOOPT - #define WSAEPROTONOSUPPORT SO_EPROTONOSUPPORT - #define WSAEOPNOTSUPP SO_EOPNOTSUPP - #define WSAEAFNOSUPPORT SO_EAFNOSUPPORT - #define WSAEADDRINUSE SO_EADDRINUSE - #define WSAEADDRNOTAVAIL SO_EADDRNOTAVAIL - #define WSAENETDOWN SO_ENETDOWN - #define WSAENETUNREACH SO_ENETUNREACH - #define WSAENETRESET SO_ENETRESET - #define WSAECONNABORTED SO_ECONNABORTED - #define WSAECONNRESET SO_ECONNRESET - #define WSAENOBUFS SO_ENOBUFS - #define WSAEISCONN SO_EISCONN - #define WSAENOTCONN SO_ENOTCONN - #define WSAETIMEDOUT SO_ETIMEDOUT - #define WSAECONNREFUSED SO_ECONNREFUSED - #define WSAELOOP SO_ELOOP - #define WSAENAMETOOLONG SO_ENAMETOOLONG - #define WSAEHOSTUNREACH SO_EHOSTUNREACH - #define WSAENOTEMPTY SO_ENOTEMPTY - #define WSAEDQUOT SO_EDQUOT - #define WSAESTALE SO_ESTALE - #define WSAEINVAL SO_EINVAL -#elif defined(_NITRO) - #define WSAEWOULDBLOCK SOC_EWOULDBLOCK - #define WSAEINPROGRESS SOC_EINPROGRESS - #define WSAEALREADY SOC_EALREADY - #define WSAENOTSOCK SOC_ENOTSOCK - #define WSAEDESTADDRREQ SOC_EDESTADDRREQ - #define WSAEMSGSIZE SOC_EMSGSIZE - #define WSAEPROTOTYPE SOC_EPROTOTYPE - #define WSAENOPROTOOPT SOC_ENOPROTOOPT - #define WSAEPROTONOSUPPORT SOC_EPROTONOSUPPORT - #define WSAEOPNOTSUPP SOC_EOPNOTSUPP - #define WSAEAFNOSUPPORT SOC_EAFNOSUPPORT - #define WSAEADDRINUSE SOC_EADDRINUSE - #define WSAEADDRNOTAVAIL SOC_EADDRNOTAVAIL - #define WSAENETDOWN SOC_ENETDOWN - #define WSAENETUNREACH SOC_ENETUNREACH - #define WSAENETRESET SOC_ENETRESET - #define WSAECONNABORTED SOC_ECONNABORTED - #define WSAECONNRESET SOC_ECONNRESET - #define WSAENOBUFS SOC_ENOBUFS - #define WSAEISCONN SOC_EISCONN - #define WSAENOTCONN SOC_ENOTCONN - #define WSAETIMEDOUT SOC_ETIMEDOUT - #define WSAECONNREFUSED SOC_ECONNREFUSED - #define WSAELOOP SOC_ELOOP - #define WSAENAMETOOLONG SOC_ENAMETOOLONG - #define WSAEHOSTUNREACH SOC_EHOSTUNREACH - #define WSAENOTEMPTY SOC_ENOTEMPTY - #define WSAEDQUOT SOC_EDQUOT - #define WSAESTALE SOC_ESTALE - #define WSAEINVAL SOC_EINVAL -#elif defined(_PS3) - #define WSAEWOULDBLOCK SYS_NET_EWOULDBLOCK - #define WSAEINPROGRESS SYS_NET_EINPROGRESS //SYS_NET_ERROR_EINPROGRESS - #define WSAEALREADY SYS_NET_EALREADY - #define WSAENOTSOCK SYS_NET_ENOTSOCK - #define WSAEDESTADDRREQ SYS_NET_EDESTADDRREQ - #define WSAEMSGSIZE SYS_NET_EMSGSIZE - #define WSAEPROTOTYPE SYS_NET_EPROTOTYPE - #define WSAENOPROTOOPT SYS_NET_ENOPROTOOPT - #define WSAEPROTONOSUPPORT SYS_NET_EPROTONOSUPPORT - #define WSAESOCKTNOSUPPORT SYS_NET_ESOCKTNOSUPPORT - #define WSAEOPNOTSUPP SYS_NET_EOPNOTSUPP - #define WSAEPFNOSUPPORT SYS_NET_EPFNOSUPPORT - #define WSAEAFNOSUPPORT SYS_NET_EAFNOSUPPORT - #define WSAEADDRINUSE SYS_NET_EADDRINUSE - #define WSAEADDRNOTAVAIL SYS_NET_EADDRNOTAVAIL - #define WSAENETDOWN SYS_NET_ENETDOWN - #define WSAENETUNREACH SYS_NET_ENETUNREACH - #define WSAENETRESET SYS_NET_ENETRESET - #define WSAECONNABORTED SYS_NET_ECONNABORTED - #define WSAECONNRESET SYS_NET_ECONNRESET // SYS_NET_ERROR_ECONNRESET - #define WSAENOBUFS SYS_NET_ENOBUFS // SYS_NET_ERROR_ENOBUFS - #define WSAEISCONN SYS_NET_EISCONN - #define WSAENOTCONN SYS_NET_ENOTCONN - #define WSAESHUTDOWN SYS_NET_ESHUTDOWN - #define WSAETOOMANYREFS SYS_NET_ETOOMANYREFS - #define WSAETIMEDOUT SYS_NET_ERROR_ETIMEDOUT - #define WSAECONNREFUSED SYS_NET_ECONNREFUSED - #define WSAELOOP SYS_NET_ELOOP - #define WSAENAMETOOLONG SYS_NET_ENAMETOOLONG - #define WSAEHOSTDOWN SYS_NET_EHOSTDOWN - #define WSAEHOSTUNREACH SYS_NET_EHOSTUNREACH - #define WSAENOTEMPTY SYS_NET_ENOTEMPTY - #define WSAEPROCLIM SYS_NET_EPROCLIM - #define WSAEUSERS SYS_NET_EUSERS - #define WSAEDQUOT SYS_NET_EDQUOT - #define WSAESTALE SYS_NET_ESTALE - #define WSAEREMOTE SYS_NET_EREMOTE - #define WSAEINVAL SYS_NET_EINVAL -#elif !defined(_WIN32) - #define WSAEWOULDBLOCK EWOULDBLOCK - #define WSAEINPROGRESS EINPROGRESS - #define WSAEALREADY EALREADY - #define WSAENOTSOCK ENOTSOCK - #define WSAEDESTADDRREQ EDESTADDRREQ - #define WSAEMSGSIZE EMSGSIZE - #define WSAEPROTOTYPE EPROTOTYPE - #define WSAENOPROTOOPT ENOPROTOOPT - #define WSAEPROTONOSUPPORT EPROTONOSUPPORT - #define WSAESOCKTNOSUPPORT ESOCKTNOSUPPORT - #define WSAEOPNOTSUPP EOPNOTSUPP - #define WSAEPFNOSUPPORT EPFNOSUPPORT - #define WSAEAFNOSUPPORT EAFNOSUPPORT - #define WSAEADDRINUSE EADDRINUSE - #define WSAEADDRNOTAVAIL EADDRNOTAVAIL - #define WSAENETDOWN ENETDOWN - #define WSAENETUNREACH ENETUNREACH - #define WSAENETRESET ENETRESET - #define WSAECONNABORTED ECONNABORTED - #define WSAECONNRESET ECONNRESET - #define WSAENOBUFS ENOBUFS - #define WSAEISCONN EISCONN - #define WSAENOTCONN ENOTCONN - #define WSAESHUTDOWN ESHUTDOWN - #define WSAETOOMANYREFS ETOOMANYREFS - #define WSAETIMEDOUT ETIMEDOUT - #define WSAECONNREFUSED ECONNREFUSED - #define WSAELOOP ELOOP - #define WSAENAMETOOLONG ENAMETOOLONG - #define WSAEHOSTDOWN EHOSTDOWN - #define WSAEHOSTUNREACH EHOSTUNREACH - #define WSAENOTEMPTY ENOTEMPTY - #define WSAEPROCLIM EPROCLIM - #define WSAEUSERS EUSERS - #define WSAEDQUOT EDQUOT - #define WSAESTALE ESTALE - #define WSAEREMOTE EREMOTE - #define WSAEINVAL EINVAL -#endif - -// make caps types interchangeable on all platforms -#if !defined(_WIN32) && !defined(_NITRO) && !defined(_REVOLUTION) // necessary for Wii?? - typedef int SOCKET; - typedef struct sockaddr SOCKADDR; - typedef struct sockaddr_in SOCKADDR_IN; - typedef struct in_addr IN_ADDR; - typedef struct hostent HOSTENT; - typedef struct timeval TIMEVAL; -#endif - -#ifdef EENET - #define GOAGetLastError(s) sceEENetErrno - #define closesocket sceEENetClose -#endif - -#ifdef INSOCK - //#define NETBUFSIZE (sceLIBNET_BUFFERSIZE) - #define NETBUFSIZE (32768) // buffer size for our samples - -// used in place of shutdown function to avoid blocking shutdown call -int gsiShutdown(SOCKET s, int how); - - #define GOAGetLastError(s) sceInsockErrno // not implemented - #define closesocket(s) gsiShutdown(s,SCE_INSOCK_SHUT_RDWR) - #undef shutdown - #define shutdown(s,h) gsiShutdown(s,h) -#endif - -#ifdef _UNIX - #define GOAGetLastError(s) errno - #define closesocket close //on unix -#endif - -#if !defined(_WIN32) - #define ioctlsocket ioctl -#endif - -#if defined(_WIN32) - #define GOAGetLastError(s) WSAGetLastError() -#endif - -#if defined(_REVOLUTION) - #define AF_INET SO_PF_INET - #define SOCK_DGRAM SO_SOCK_DGRAM - #define SOCK_STREAM SO_SOCK_STREAM - #define IPPROTO_UDP SO_IPPROTO_UDP - #define IPPROTO_TCP SO_IPPROTO_TCP - #define INADDR_ANY SO_INADDR_ANY - #define SOL_SOCKET SO_SOL_SOCKET - #define SO_SNDBUF SO_SO_SNDBUF - #define SO_RCVBUF SO_SO_RCVBUF - #define SO_REUSEADDR SO_SO_REUSEADDR - - typedef int SOCKET; - typedef struct SOSockAddr SOCKADDR; - #define sockaddr SOSockAddr - typedef struct SOSockAddrIn SOCKADDR_IN; - #define sockaddr_in SOSockAddrIn - #define sin_family family - #define sin_port port - #define sin_addr addr - typedef struct SOInAddr IN_ADDR; - #define in_addr SOInAddr - #define s_addr addr - typedef struct SOHostEnt HOSTENT; - #define hostent SOHostEnt - #define h_name name - #define h_aliases aliases - #define h_addrtype addrType - #define h_length length - #define h_addr_list addrList - #define h_addr addrList[0] - - int socket(int pf, int type, int protocol); - int closesocket(SOCKET sock); - int shutdown(SOCKET sock, int how); - int bind(SOCKET sock, const SOCKADDR* addr, int len); - - int connect(SOCKET sock, const SOCKADDR* addr, int len); - int listen(SOCKET sock, int backlog); - SOCKET accept(SOCKET sock, SOCKADDR* addr, int* len); - - int recv(SOCKET sock, char* buf, int len, int flags); - int recvfrom(SOCKET sock, char* buf, int len, int flags, SOCKADDR* addr, int* fromlen); - int send(SOCKET sock, const char* buf, int len, int flags); - int sendto(SOCKET sock, const char* buf, int len, int flags, const SOCKADDR* addr, int tolen); - - int getsockopt(SOCKET sock, int level, int optname, char* optval, int* optlen); - int setsockopt(SOCKET sock, int level, int optname, const char* optval, int optlen); - - #define gethostbyaddr(a,l,t) SOGetHostByAddr(a,l,t) - #define gethostbyname(n) SOGetHostByName(n) - - // thread safe DNS lookups - #define getaddrinfo(n,s,h,r) SOGetAddrInfo(n,s,h,r) - #define freeaddrinfo(a) SOFreeAddrInfo(a) - - - int getsockname(SOCKET sock, SOCKADDR* addr, int* len); - - #define htonl(l) SOHtoNl((u32)l) - #define ntohl(l) SONtoHl((u32)l) - #define htons(s) SOHtoNs((u16)s) - #define ntohs(s) SONtoHs((u16)s) - - #define inet_ntoa(n) SOInetNtoA(n) - unsigned long inet_addr(const char * name); - - int GOAGetLastError(SOCKET sock); -#endif - -#if defined(_NITRO) - #define AF_INET SOC_PF_INET - #define SOCK_DGRAM SOC_SOCK_DGRAM - #define SOCK_STREAM SOC_SOCK_STREAM - #define IPPROTO_UDP 0 - #define IPPROTO_TCP 0 - #define INADDR_ANY SOC_INADDR_ANY - #define SOL_SOCKET SOC_SOL_SOCKET - #define SO_SNDBUF SOC_SO_SNDBUF - #define SO_RCVBUF SOC_SO_RCVBUF - #define SO_REUSEADDR SOC_SO_REUSEADDR - - typedef int SOCKET; - typedef struct SOSockAddr SOCKADDR; - #define sockaddr SOSockAddr - typedef struct SOSockAddrIn SOCKADDR_IN; - #define sockaddr_in SOSockAddrIn - #define sin_family family - #define sin_port port - #define sin_addr addr - typedef struct SOInAddr IN_ADDR; - #define in_addr SOInAddr - #define s_addr addr - typedef struct SOHostEnt HOSTENT; - #define hostent SOHostEnt - #define h_name name - #define h_aliases aliases - #define h_addrtype addrType - #define h_length length - #define h_addr_list addrList - #define h_addr addrList[0] - - int socket(int pf, int type, int protocol); - int closesocket(SOCKET sock); - int shutdown(SOCKET sock, int how); - int bind(SOCKET sock, const SOCKADDR* addr, int len); - - int connect(SOCKET sock, const SOCKADDR* addr, int len); - int listen(SOCKET sock, int backlog); - SOCKET accept(SOCKET sock, SOCKADDR* addr, int* len); - - int recv(SOCKET sock, char* buf, int len, int flags); - int recvfrom(SOCKET sock, char* buf, int len, int flags, SOCKADDR* addr, int* fromlen); - int send(SOCKET sock, const char* buf, int len, int flags); - int sendto(SOCKET sock, const char* buf, int len, int flags, const SOCKADDR* addr, int tolen); - - int getsockopt(SOCKET sock, int level, int optname, char* optval, int* optlen); - int setsockopt(SOCKET sock, int level, int optname, const char* optval, int optlen); - - #define gethostbyaddr(a,l,t) SOC_GetHostByAddr(a,l,t) - #define gethostbyname(n) SOC_GetHostByName(n) - - int getsockname(SOCKET sock, SOCKADDR* addr, int* len); - - #define htonl(l) SOC_HtoNl(l) - #define ntohl(l) SOC_NtoHl(l) - #define htons(s) SOC_HtoNs(s) - #define ntohs(s) SOC_NtoHs(s) - - #define inet_ntoa(n) SOC_InetNtoA(n) - unsigned long inet_addr(const char * name); - - int GOAGetLastError(SOCKET sock); -#endif - -#if defined(_PS3) - #define accept(s,a,al) accept(s,a,(socklen_t*)(al)) - #define bind(s,a,al) bind(s,a,(socklen_t)(al)) - #define connect(s,a,al) connect(s,a,(socklen_t)(al)) - #define getpeername(s,a,al) getpeername(s,a,(socklen_t*)(al)) - #define getsockname(s,a,al) getsockname(s,a,(socklen_t*)(al)) - #define getsockopt(s,l,o,v,vl) getsockopt(s,l,o,v,(socklen_t*)(vl)) - #define recvfrom(s,b,l,f,a,al) recvfrom(s,b,l,f,a,(socklen_t*)(al)) - #define sendto(s,b,l,f,a,al) sendto(s,b,l,f,a,(socklen_t)(al)) - #define setsockopt(s,l,o,v,vl) setsockopt(s,l,o,v,(socklen_t)(vl)) - #define closesocket socketclose - #define GOAGetLastError(s) sys_net_errno - #define EWOULDBLOCK sceNET_EWOULDBLOCK -#endif - -#if defined(_MACOSX) - #define accept(s,a,al) accept(s,a,(socklen_t*)(al)) - #define bind(s,a,al) bind(s,a,(socklen_t)(al)) - #define connect(s,a,al) connect(s,a,(socklen_t)(al)) - #define getpeername(s,a,al) getpeername(s,a,(socklen_t*)(al)) - #define getsockname(s,a,al) getsockname(s,a,(socklen_t*)(al)) - #define getsockopt(s,l,o,v,vl) getsockopt(s,l,o,v,(socklen_t*)(vl)) - #define recvfrom(s,b,l,f,a,al) recvfrom(s,b,l,f,a,(socklen_t*)(al)) - #define sendto(s,b,l,f,a,al) sendto(s,b,l,f,a,(socklen_t)(al)) - #define setsockopt(s,l,o,v,vl) setsockopt(s,l,o,v,(socklen_t)(vl)) -#endif - -#if defined(SN_SYSTEMS) - int GOAGetLastError(SOCKET s); - - #if !defined(__MWERKS__) - #define send(s,b,l,f) (int)send(s,b,(unsigned long)l,f) - #define recv(s,b,l,f) (int)recv(s,b,(unsigned long)l,f) - #define sendto(s,b,l,f,a,al) (int)sendto(s,b,(unsigned long)l,f,a,al) - #define recvfrom(s,b,l,f,a,al) (int)recvfrom(s,b,(unsigned long)l,f,a,al) - #endif -#endif - -// SN Systems doesn't support gethostbyaddr -#if defined(SN_SYSTEMS) - #define gethostbyaddr(a,b,c) NULL -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Functions -int SetSockBlocking(SOCKET sock, int isblocking); -int SetSockBroadcast(SOCKET sock); -int DisableNagle(SOCKET sock); -int SetReceiveBufferSize(SOCKET sock, int size); -int SetSendBufferSize(SOCKET sock, int size); -int GetReceiveBufferSize(SOCKET sock); -int GetSendBufferSize(SOCKET sock); -int CanReceiveOnSocket(SOCKET sock); -int CanSendOnSocket(SOCKET sock); -int GSISocketSelect(SOCKET theSocket, int* theReadFlag, int* theWriteFlag, int* theExceptFlag); -void SocketStartUp(); -void SocketShutDown(); - -HOSTENT * getlocalhost(void); - -int IsPrivateIP(IN_ADDR * addr); -gsi_u32 gsiGetBroadcastIP(void); - - -#if defined(_PSP) - #define gethostbyaddr(a,b,c) NULL -#endif - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -} -#endif - -#endif // __GSSOCKET_H__ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformThread.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformThread.c deleted file mode 100644 index fd32935039a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformThread.c +++ /dev/null @@ -1,52 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(GSI_NO_THREADS) -#include "gsCommon.h" - - -// Include platform separated functions -#if defined(_X360) - #include "x360/gsThreadX360.c" -#elif defined(_XBOX) - //#include "xbox/gsThreadXBox.c" -#elif defined(_WIN32) - #include "win32/gsThreadWin32.c" -#elif defined(_MACOSX) - #include "macosx/gsThreadMacOSX.c" -#elif defined (_LINUX) - #include "linux/gsThreadLinux.c" -#elif defined(_NITRO) - #include "nitro/gsThreadNitro.c" -#elif defined(_PS2) - #include "ps2/gsThreadPs2.c" -#elif defined(_PS3) -// #include "ps3/gsThreadPS3.c" -#elif defined(_PSP) -// #include "psp/gsThreadPSP.c" -#elif defined(_REVOLUTION) - #include "revolution/gsThreadRevoulution.c" -#else - #error "Missing or unsupported platform" -#endif - - -#if defined(__cplusplus) -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} -#endif - -#endif // GSI_NO_THREADS diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformThread.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformThread.h deleted file mode 100644 index 85421ea86e1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformThread.h +++ /dev/null @@ -1,197 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSPLATFORMTHREAD_H__ -#define __GSPLATFORMTHREAD_H__ - - -#include "gsPlatform.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Thread types -#if defined(_WIN32) - typedef CRITICAL_SECTION GSICriticalSection; - typedef HANDLE GSISemaphoreID; - typedef HANDLE GSIThreadID; - typedef DWORD (WINAPI *GSThreadFunc)(void *arg); - -#elif defined(_PS2) - typedef int GSIThreadID; - typedef int GSISemaphoreID; - typedef struct - { - // A critical section is a re-entrant semaphore - GSISemaphoreID mSemaphore; - GSIThreadID mOwnerThread; - gsi_u32 mEntryCount; // track re-entry - gsi_u32 mPad; // make 16bytes - } GSICriticalSection; - typedef void (*GSThreadFunc)(void *arg); - -#elif defined(_NITRO) - typedef OSMutex GSICriticalSection; - typedef struct - { - OSMutex mLock; - gsi_i32 mValue; - gsi_i32 mMax; - } GSISemaphoreID; - typedef struct - { - OSThread mThread; - void * mStack; - } GSIThreadID; - typedef void (*GSThreadFunc)(void *arg); - -#elif defined(_REVOLUTION) - typedef OSMutex GSICriticalSection; - typedef OSSemaphore GSISemaphoreID; - typedef struct - { - OSThread mThread; - void * mStack; - } GSIThreadID; - typedef void *(*GSThreadFunc)(void *arg); - -#elif defined(_PSP) - // Todo: Test PSP thread code, then remove this define - #define GSI_NO_THREADS - typedef int GSIThreadID; - typedef int GSISemaphoreID; - typedef struct - { - // A critical section is a re-entrant semaphore - GSISemaphoreID mSemaphore; - GSIThreadID mOwnerThread; - gsi_u32 mEntryCount; // track re-entry - gsi_u32 mPad; // make 16bytes - } GSICriticalSection; - typedef void (*GSThreadFunc)(void *arg); - -#elif defined(_PS3) - // Todo: Test PS3 ppu thread code, then remove this define - #define GSI_NO_THREADS - typedef int GSIThreadID; - typedef int GSISemaphoreID; - typedef struct - { - // A critical section is a re-entrant semaphore - GSISemaphoreID mSemaphore; - GSIThreadID mOwnerThread; - gsi_u32 mEntryCount; // track re-entry - gsi_u32 mPad; // make 16bytes - } GSICriticalSection; - typedef void (*GSThreadFunc)(void *arg); - -#elif defined(_UNIX) //_LINUX || _MACOSX - typedef pthread_mutex_t GSICriticalSection; - typedef struct - { - pthread_mutex_t mLock; - gsi_i32 mValue; - gsi_i32 mMax; - } GSISemaphoreID; - typedef struct - { - pthread_t thread; - pthread_attr_t attr; - } GSIThreadID; - typedef void (*GSThreadFunc)(void *arg); - -#else - #define GSI_NO_THREADS -#endif - -#if defined(WIN32) - #define GSI_INFINITE INFINITE -#else - #define GSI_INFINITE (gsi_u32)(-1) -#endif - - -#if !defined(GSI_NO_THREADS) - // The increment/read operations must not be preempted - #if defined(_WIN32) - #define gsiInterlockedIncrement(a) InterlockedIncrement((long*)a) - #define gsiInterlockedDecrement(a) InterlockedDecrement((long*)a) - #elif defined(_PS2) - gsi_u32 gsiInterlockedIncrement(gsi_u32* num); - gsi_u32 gsiInterlockedDecrement(gsi_u32* num); - #elif defined(_PS3) - // TODO - threading in PS3 uses pthreads, just like Linux - #elif defined(_NITRO) - gsi_u32 gsiInterlockedIncrement(gsi_u32* num); - gsi_u32 gsiInterlockedDecrement(gsi_u32* num); - #elif defined(_REVOLUTION) - gsi_u32 gsiInterlockedIncrement(gsi_u32* num); - gsi_u32 gsiInterlockedDecrement(gsi_u32* num); - #elif defined(_UNIX) - gsi_u32 gsiInterlockedIncrement(gsi_u32* num); - gsi_u32 gsiInterlockedDecrement(gsi_u32* num); - #endif - -#else - // Don't worry about concurrancy when GSI_NO_THREADS is defined - #define gsiInterlockedIncrement(a) (++(*a)) - #define gsiInterlockedDecrement(a) (--(*a)) -#endif - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(GSI_NO_THREADS) - int gsiStartThread(GSThreadFunc aThreadFunc, gsi_u32 theStackSize, void *arg, GSIThreadID* theThreadIdOut); - void gsiCancelThread(GSIThreadID theThreadID); - void gsiExitThread(GSIThreadID theThreadID); - void gsiCleanupThread(GSIThreadID theThreadID); - - // Thread Synchronization - Startup/Shutdown - gsi_u32 gsiHasThreadShutdown(GSIThreadID theThreadID); - - // Thread Synchronization - Critical Section - void gsiInitializeCriticalSection(GSICriticalSection *theCrit); - void gsiEnterCriticalSection(GSICriticalSection *theCrit); - void gsiLeaveCriticalSection(GSICriticalSection *theCrit); - void gsiDeleteCriticalSection(GSICriticalSection *theCrit); - - // Thread Synchronization - Semaphore - GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName); - gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs); - void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount); - void gsiCloseSemaphore(GSISemaphoreID theSemaphore); - -#else - // NO THREADS - stub everything to unused - #define gsiStartThread(a, b, c, d) (-1) // must return something - #define gsiCancelThread(a) - #define gsiExitThread(a) - #define gsiCleanupThread(a) - - #define gsiHasThreadShutdown(a) (1) // must return something - - #define gsiInitializeCriticalSection(a) - #define gsiEnterCriticalSection(a) - #define gsiLeaveCriticalSection(a) - #define gsiDeleteCriticalSection(a) - - #define gsiCreateSemaphore(a,b,c) (-1) - #define gsiWaitForSemaphore(a,b) (0) - #define gsiReleaseSemaphore(a,b) - #define gsiCloseSemaphore(a) - -#endif // GSI_NO_THREADS - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -} -#endif - -#endif // __GSPLATFORMTHREAD_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformUtil.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformUtil.c deleted file mode 100644 index b1beecf21eb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformUtil.c +++ /dev/null @@ -1,1903 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCommon.h" -#include "gsPlatformUtil.h" - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 1368, 1372 -#pragma warning(disable: 4267) //lines: 1861 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -// Include platform separated functions -#if defined(_X360) - //#include "x360/gsUtilX360.c" -#elif defined(_XBOX) - //#include "xbox/gsUtilXBox.c" -#elif defined(_WIN32) - #include "win32/gsUtilWin32.c" -#elif defined(_LINUX) - #include "linux/gsUtilLinux.c" -#elif defined(_MACOSX) - #include "macosx/gsUtilMacOSX.c" -#elif defined(_NITRO) - #include "nitro/gsUtilNitro.c" -#elif defined(_PS2) - #include "ps2/gsUtilPs2.c" -#elif defined(_PS3) - #include "ps3/gsUtilPs3.c" -#elif defined(_PSP) - #include "psp/gsUtilPSP.c" -#elif defined(_REVOLUTION) - #include "revolution/gsUtilRevolution.c" -#else - #error "Missing or unsupported platform" -#endif - -#if defined(__cplusplus) -extern "C" { -#endif - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// ********** ASYNC DNS ********** // - -//struct is used in both threaded and non-threaded versions -typedef struct GSIResolveHostnameInfo -{ - char * hostname; - unsigned int ip; - -#if defined(_WIN32) /*|| defined(_PS2)*/ || defined(_UNIX) || defined (_REVOLUTION) - int finishedResolving; - GSIThreadID threadID; -#endif - -/*#if defined(_PSP) - int finishedResolving; - GSIThreadID threadID; -#endif*/ -} GSIResolveHostnameInfo; - -//////////////////////////////////////////////////////////////////////////////// -// for asynch DNS, must have: -// * platform that supports threaded lookup AND -// * threading enabled -// * and async lookup enabled -//////////////////////////////////////////////////////////////////////////////// -#if (defined(_WIN32) || /*defined(_PS2) ||*/ defined(_UNIX) || defined (_REVOLUTION)) && !defined(GSI_NO_THREADS) && !defined(GSI_NO_ASYNC_DNS) - -//////////////////////////////////////////////////////////////////////////////// -#if defined(_WIN32) /*|| defined(_PS2)*/ - #if defined(_WIN32) - DWORD WINAPI gsiResolveHostnameThread(void * arg) - /*#elif defined(_PS2) - static void gsiResolveHostnameThread(void * arg)*/ - #endif - { - HOSTENT * hostent; - GSIResolveHostnameHandle handle = (GSIResolveHostnameHandle)arg; - - SocketStartUp(); - - #ifdef SN_SYSTEMS - sockAPIregthr(); - #endif - - // do the gethostbyname - hostent = gethostbyname(handle->hostname); - if(hostent) - { - // got the ip - handle->ip = *(unsigned int *)hostent->h_addr_list[0]; - } - else - { - // didn't resolve - handle->ip = GSI_ERROR_RESOLVING_HOSTNAME; - } - - SocketShutDown(); - - // finished resolving - handle->finishedResolving = 1; - - #ifdef SN_SYSTEMS - sockAPIderegthr(); - #endif - - // explicitly exit the thread to free resources - gsiExitThread(handle->threadID); - - #if defined(_WIN32) - return 0; - #endif -} -#endif //defined _WIN32 -//////////////////////////////////////////////////////////////////////////////// - - -#ifdef _REVOLUTION -/////////////////////////////////////////////////////////////////////////////// -static void *gsiResolveHostnameThread(void * arg) -{ - static GSICriticalSection aHostnameCrit; - static int aInitialized = 0; - //SOAddrInfo *aHostAddr; - HOSTENT *aHostAddr; - //int retval; - GSIResolveHostnameHandle handle = (GSIResolveHostnameHandle)arg; - - if (!aInitialized) - { - gsiInitializeCriticalSection(&aHostnameCrit); - aInitialized = 1; - } - gsiEnterCriticalSection(&aHostnameCrit); - - //retval = getaddrinfo(handle->hostname, NULL, NULL, &aHostAddr); - aHostAddr = gethostbyname(handle->hostname); - if (aHostAddr != 0) - { - char * ip; - // first convert to character string for debug output - ip = inet_ntoa(*(in_addr *)aHostAddr->addrList[0]); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, - "Resolved host '%s' to ip '%s'\n", handle->hostname, ip); - - handle->ip = inet_addr(ip); - //freeaddrinfo(aHostAddr); - } - else - { - // couldnt reach host - debug output is printed later - handle->ip = GSI_ERROR_RESOLVING_HOSTNAME; - } - - - // finished resolving - handle->finishedResolving = 1; - - gsiLeaveCriticalSection(&aHostnameCrit); -} -#endif // _REVOLUTION -//////////////////////////////////////////////////////////////////////////////// - -// -// Linux/MacOSX implementation of multithreaded DNS lookup -// Uses getaddrinfo instead of gethostbyname - since the latter -// has static declarations and is thus un-safe for pthreads -// -// NOTE: The compiler option "-lpthread" must used for this -#if defined(_UNIX) -//////////////////////////////////////////////////////////////////////////////// -static void gsiResolveHostnameThread(void * arg) -{ - GSIResolveHostnameHandle handle = (GSIResolveHostnameHandle)arg; - struct addrinfo hints, *result = NULL; - int error; - char *ip; - - SocketStartUp(); - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - // DNS lookup (works with pthreads) - error = getaddrinfo(handle->hostname, "http", &hints, &result); - - if (!error) - { - // first convert to character string for debug output - ip = inet_ntoa((*(struct sockaddr_in*)result->ai_addr).sin_addr); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, - "Resolved host '%s' to ip '%s'\n", handle->hostname, ip); - - // now convert to unsigned int and store it - handle->ip = inet_addr(ip); - - // free the memory used - freeaddrinfo(result); - } - else - { - // couldnt reach host - debug output is printed later - handle->ip = GSI_ERROR_RESOLVING_HOSTNAME; - } - - SocketShutDown(); - - // finished resolving - handle->finishedResolving = 1; - - // explicitly exit the thread to free resources - gsiExitThread(handle->threadID); -} -#endif //_UNIX -//////////////////////////////////////////////////////////////////////////////// - - -int gsiStartResolvingHostname(const char * hostname, GSIResolveHostnameHandle * handle) -{ - GSIResolveHostnameInfo * info; - - //PS2 Threading unsupported in current build - this should never be reached -#if defined(_PS2) - GS_ASSERT_STR(gsi_false, "PS2 Threading unsupported in current version of the SDK\n"); -#endif - - // allocate a handle - info = (GSIResolveHostnameInfo *)gsimalloc(sizeof(GSIResolveHostnameInfo)); - if(!info) - return -1; - - // make a copy of the hostname so the thread has access to it - info->hostname = goastrdup(hostname); - if(!info->hostname) - { - gsifree(info); - return -1; - } - - // not resolved yet - info->finishedResolving = 0; - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_State, GSIDebugLevel_Comment, - "(Asynchrounous) DNS lookup starting\n"); - - // start the thread - if(gsiStartThread(gsiResolveHostnameThread, (0x1000), info, &info->threadID) == -1) - { - gsifree(info->hostname); - info->hostname = NULL; - gsifree(info); - info = NULL; - return -1; - } - - // set the handle to the info - *handle = info; - - return 0; -} - -void gsiCancelResolvingHostname(GSIResolveHostnameHandle handle) -{ - // cancel the thread - gsiCancelThread(handle->threadID); - - if (handle->hostname) - { - gsifree(handle->hostname); - handle->hostname = NULL; - } - gsifree(handle); - handle = NULL; -} - -unsigned int gsiGetResolvedIP(GSIResolveHostnameHandle handle) -{ - unsigned int ip; - - // check if we haven't finished - if(!handle->finishedResolving) - return GSI_STILL_RESOLVING_HOSTNAME; - - // save the ip - ip = handle->ip; - - // free resources - gsiCleanupThread(handle->threadID); - gsifree(handle->hostname); - gsifree(handle); - handle = NULL; - - return ip; -} - - -#else // if * not a supported platform OR * no threads allowed OR * no async lookup allowed - /////////////////////////////////////////////////////////////////////////////////// - // if !(_WIN32 ||_PS2 || _LINUX || _MACOSX || _REVOLUTION) || GSI_NO_THREADS || GSI_NO_ASYNC_DNS - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// ********** NON-ASYNC DNS ********** // -// -// These are the non-threaded version of the above functions. -// The following platforms have synchronous DNS lookups: -// _NITRO || _XBOX || _X360 || _PS3 || _PS2 || _PSP -/////////////////////////////////////////////////////////////////////////////// - -int gsiStartResolvingHostname(const char * hostname, GSIResolveHostnameHandle * handle) -{ - GSIResolveHostnameInfo * info; - HOSTENT * hostent; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, - "(NON-Asynchrounous) DNS lookup starting\n"); - - // do the lookup now - hostent = gethostbyname(hostname); - if(hostent == NULL) - return -1; - - // allocate info to store the result - info = (GSIResolveHostnameHandle)gsimalloc(sizeof(GSIResolveHostnameInfo)); - if(!info) - return -1; - - // we already have the ip - info->ip = *(unsigned int *)hostent->h_addr_list[0]; - - // set the handle to the info - *handle = info; - - return 0; -} - -void gsiCancelResolvingHostname(GSIResolveHostnameHandle handle) -{ - gsifree(handle); - handle = NULL; -} - -unsigned int gsiGetResolvedIP(GSIResolveHostnameHandle handle) -{ - // we always do the resolve in the initial call for systems without - // an async version, so we'll always have the IP at this point - unsigned int ip = handle->ip; - gsifree(handle); - handle = NULL; - return ip; -} - -/////////////////////////////////////////////////////////////////////////////// -#endif // synch DNS lookup - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -char * goastrdup(const char *src) -{ - char *res; - if(src == NULL) //PANTS|02.11.00|check for NULL before strlen - return NULL; - res = (char *)gsimalloc(strlen(src) + 1); - if(res != NULL) //PANTS|02.02.00|check for NULL before strcpy - strcpy(res, src); - return res; -} - -unsigned short * goawstrdup(const unsigned short *src) -{ - unsigned short *res; - if(src == NULL) - return NULL; - res = (unsigned short *)gsimalloc((wcslen((wchar_t*)src) + 1) * sizeof(unsigned short)); - if(res != NULL) - wcscpy((wchar_t*)res, (const wchar_t*)src); - return res; -} - -#if !defined(_WIN32) - -char *_strlwr(char *string) -{ - char *hold = string; - while (*string) - { - *string = (char)tolower(*string); - string++; - } - - return hold; -} - -char *_strupr(char *string) -{ - char *hold = string; - while (*string) - { - *string = (char)toupper(*string); - string++; - } - - return hold; -} -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void SocketStartUp() -{ -#if defined(_WIN32) - WSADATA data; - - #if defined(_X360) - XNetStartupParams xnsp; - memset(&xnsp,0,sizeof(xnsp)); - xnsp.cfgSizeOfStruct=sizeof(xnsp); - xnsp.cfgFlags=XNET_STARTUP_BYPASS_SECURITY; - if(0 != XNetStartup(&xnsp)) - { - OutputDebugString("XNetStartup failed\n"); - } - #endif - - // added support for winsock2 - #if (!defined(_XBOX) || defined(_X360)) && (defined(GSI_WINSOCK2) || defined(_X360)) - WSAStartup(MAKEWORD(2,2), &data); - #else - WSAStartup(MAKEWORD(1,1), &data); - #endif - // end added -#endif -} - -void SocketShutDown() -{ -#if defined(_WIN32) - WSACleanup(); - #if defined(_X360) - XNetCleanup(); - #endif -#endif -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef _PS2 -extern int sceCdReadClock(); - -#if !defined(__MWERKS__) && !defined(_PS2) -typedef unsigned char u_char; -#endif - -typedef struct { - u_char stat; /* status */ - u_char second; /* second */ - u_char minute; /* minute */ - u_char hour; /* hour */ - - u_char pad; /* pad */ - u_char day; /* day */ - u_char month; /* month */ - u_char year; /* year */ -} sceCdCLOCK; - -static unsigned long GetTicks() -{ - unsigned long ticks; - asm volatile (" mfc0 %0, $9 " : "=r" (ticks)); - return ticks; -} - -#define DEC(x) (10*(x/16)+(x%16)) -#define _BASE_YEAR 70L -#define _MAX_YEAR 138L -#define _LEAP_YEAR_ADJUST 17L -int _days[] = {-1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364}; - -static time_t _gmtotime_t ( - int yr, /* 0 based */ - int mo, /* 1 based */ - int dy, /* 1 based */ - int hr, - int mn, - int sc - ) -{ - int tmpdays; - long tmptim; - struct tm tb; - - if ( ((long)(yr -= 1900) < _BASE_YEAR) || ((long)yr > _MAX_YEAR) ) - return (time_t)(-1); - - tmpdays = dy + _days[mo - 1]; - if ( !(yr & 3) && (mo > 2) ) - tmpdays++; - - tmptim = (long)yr - _BASE_YEAR; - - tmptim = ( ( ( ( tmptim ) * 365L - + ((long)(yr - 1) >> 2) - (long)_LEAP_YEAR_ADJUST - + (long)tmpdays ) - * 24L + (long)hr ) - * 60L + (long)mn ) - * 60L + (long)sc; - - tb.tm_yday = tmpdays; - tb.tm_year = yr; - tb.tm_mon = mo - 1; - tb.tm_hour = hr; - - return (tmptim >= 0) ? (time_t)tmptim : (time_t)(-1); -} - -time_t time(time_t *timer) -{ - time_t tim; - sceCdCLOCK clocktime; /* defined in libcdvd.h */ - - sceCdReadClock(&clocktime); /* libcdvd.a */ - - tim = _gmtotime_t ( DEC(clocktime.year)+2000, - DEC(clocktime.month), - DEC(clocktime.day), - DEC(clocktime.hour), - DEC(clocktime.minute), - DEC(clocktime.second)); - - if(timer) - *timer = tim; - - return tim; -} - -#endif /* _PS2 */ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_time current_time() //returns current time in milliseconds -{ -#if defined(_WIN32) - return (SDL_GetTicks()); - -#elif defined(_PS2) - unsigned int ticks; - static unsigned int msec = 0; - static unsigned int lastticks = 0; - sceCdCLOCK lasttimecalled; /* defined in libcdvd.h */ - - if(!msec) - { - sceCdReadClock(&lasttimecalled); /* libcdvd.a */ - msec = (unsigned int)(DEC(lasttimecalled.day) * 86400000) + - (unsigned int)(DEC(lasttimecalled.hour) * 3600000) + - (unsigned int)(DEC(lasttimecalled.minute) * 60000) + - (unsigned int)(DEC(lasttimecalled.second) * 1000); - } - - ticks = (unsigned int)GetTicks(); - if(lastticks > ticks) - msec += (unsigned int)(((unsigned int)(-1) - lastticks) + ticks) / 300000; - else - msec += (unsigned int)(ticks-lastticks) / 300000; - lastticks = ticks; - - return msec; - -#elif defined(_UNIX) - struct timeval time; - - gettimeofday(&time, NULL); - return (time.tv_sec * 1000 + time.tv_usec / 1000); - -#elif defined(_NITRO) - assert(OS_IsTickAvailable() == TRUE); - return (gsi_time)OS_TicksToMilliSeconds(OS_GetTick()); - -#elif defined(_PSP) - struct SceRtcTick ticks; - int result = 0; - - result = sceRtcGetCurrentTick(&ticks); - if (result < 0) - { - ScePspDateTime time; - result = sceRtcGetCurrentClock(&time, 0); - if (result < 0) - return 0; // um...error handling? //Nope, should return zero since time cannot be zero - result = sceRtcGetTick(&time, &ticks); - if (result < 0) - return 0; //Nope, should return zero since time cannot be zero - } - - return (gsi_time)(ticks.tick / 1000); - -#elif defined(_PS3) - return (gsi_time)(sys_time_get_system_time()/1000); - -#elif defined(_REVOLUTION) - OSTick aTickNow= OSGetTick(); - gsi_time aMilliseconds = (gsi_time)OSTicksToMilliseconds(aTickNow); - return aMilliseconds; -#else - // unrecognized platform! contact devsupport - assert(0); -#endif - -} - -gsi_time current_time_hires() // returns current time in microseconds -{ -#ifdef _WIN32 -#if (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)) - static LARGE_INTEGER counterFrequency; - static BOOL haveCounterFrequency = FALSE; - static BOOL haveCounter = FALSE; - LARGE_INTEGER count; - - if(!haveCounterFrequency) - { - haveCounter = QueryPerformanceFrequency(&counterFrequency); - haveCounterFrequency = TRUE; - } - - if(haveCounter) - { - if(QueryPerformanceCounter(&count)) - { - return (gsi_time)(count.QuadPart * 1000000 / counterFrequency.QuadPart); - } - } -#endif - - return (current_time() / 1000); -#endif - -#ifdef _PS2 - unsigned int ticks; - static unsigned int msec = 0; - static unsigned int lastticks = 0; - sceCdCLOCK lasttimecalled; /* defined in libcdvd.h */ - - if(!msec) - { - sceCdReadClock(&lasttimecalled); /* libcdvd.a */ - msec = (unsigned int)(DEC(lasttimecalled.day) * 86400000) + - (unsigned int)(DEC(lasttimecalled.hour) * 3600000) + - (unsigned int)(DEC(lasttimecalled.minute) * 60000) + - (unsigned int)(DEC(lasttimecalled.second) * 1000); - msec *= 1000; - } - - ticks = (unsigned int)GetTicks(); - if(lastticks > ticks) - msec += ((sizeof(unsigned int) - lastticks) + ticks) / 300; - else - msec += (unsigned int)(ticks-lastticks) / 300; - lastticks = ticks; - - return msec; -#endif - -#ifdef _PSP - struct SceRtcTick ticks; - int result = 0; - - result = sceRtcGetCurrentTick(&ticks); - if (result < 0) - { - ScePspDateTime time; - result = sceRtcGetCurrentClock(&time, 0); - if (result < 0) - return 0; // um...error handling? //Nope, should return zero since time cannot be zero - result = sceRtcGetTick(&time, &ticks); - if (result < 0) - return 0; //Nope, should return zero since time cannot be zero - } - - return (gsi_time)(ticks.tick); -#endif - -#ifdef _UNIX - struct timeval time; - - gettimeofday(&time, NULL); - return (time.tv_sec * 1000000 + time.tv_usec); -#endif - -#ifdef _NITRO - assert(OS_IsTickAvailable() == TRUE); - return (gsi_time)OS_TicksToMicroSeconds(OS_GetTick()); -#endif - -#ifdef _PS3 - return (gsi_time)sys_time_get_system_time(); -#endif -} - - -void msleep(gsi_time msec) -{ -#if defined(_WIN32) - Sleep(msec); - -#elif defined(_PS2) - #ifdef SN_SYSTEMS - sn_delay((int)msec); - #endif - #ifdef EENET - if(msec >= 1000) - { - sleep(msec / 1000); - msec -= (msec / 1000); - } - if(msec) - usleep(msec * 1000); - #endif - #ifdef INSOCK - DelayThread(msec * 1000); - #endif - -#elif defined(_PSP) - sceKernelDelayThread(msec * 1000); - -#elif defined(_UNIX) - usleep(msec * 1000); - -#elif defined(_NITRO) - OS_Sleep(msec); - -#elif defined(_PS3) - sys_timer_usleep(msec* 1000); -#elif defined (_REVOLUTION) - OSSleepMilliseconds(msec); -#else - assert(0); // missing platform handler, contact devsupport -#endif -} - -////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// Cross-platform GSI wrapper time conversion functions -// -// NOTE: some portions of this copied from standard C library -#if defined(_NITRO) || defined(_REVOLUTION) - -// if an error occurs when calling mktime, return -1 -#define MKTIME_ERROR (time_t)(-1) - -// define common conversions for mktime -#define DAY_SEC (24L * 60L * 60L) /* secs in a day */ -#define YEAR_SEC (365L * DAY_SEC) /* secs in a year */ -#define FOUR_YEAR_SEC (1461L * DAY_SEC) /* secs in a 4 year interval */ -#define DEC_SEC 315532800L /* secs in 1970-1979 */ -#define BASE_DOW 4 /* 01-01-70 was a Thursday */ -#define BASE_YEAR 70L /* 1970 is the base year */ -#define LEAP_YEAR_ADJUST 17L /* Leap years 1900 - 1970 */ -#define MAX_YEAR 138L /* 2038 is the max year */ - -// ChkAdd evaluates to TRUE if dest = src1 + src2 has overflowed -#define ChkAdd(dest, src1, src2) ( ((src1 >= 0L) && (src2 >= 0L) \ - && (dest < 0L)) || ((src1 < 0L) && (src2 < 0L) && (dest >= 0L)) ) - -// ChkMul evaluates to TRUE if dest = src1 * src2 has overflowed -#define ChkMul(dest, src1, src2) ( src1 ? (dest/src1 != src2) : 0 ) - -int _lpdays[] = { -1, 30, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; -int _days[] = { -1, 30, 58, 89, 119, 150, 180, 211, 242, 272, 303, 333, 364 }; - -const char _dnames[] = { "SunMonTueWedThuFriSat" }; -/* Month names must be Three character abbreviations strung together */ -const char _mnames[] = { "JanFebMarAprMayJunJulAugSepOctNovDec" }; - -static struct tm tb = { 0 }; /* time block used in SecondsToDate */ - -static char buf[26]; /* buffer used to store string in SecondsToString */ - - -static char * store_dt(char *, int); -static char * store_dt(char *p, int val) -{ - *p++ = (char)(_T('0') + val / 10); - *p++ = (char)(_T('0') + val % 10); - return(p); -} -#endif //_NITRO || _REVOLUTION - -////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// GSI equivalent of Standard C-lib "gmtime function" -struct tm * gsiSecondsToDate(const time_t *timp) -{ -#if !defined(_NITRO) && !defined(_REVOLUTION) - - // for all platforms that support the standard C 'gmtime' use that - return gmtime(timp); - -#else - time_t caltim = *timp; /* calendar time to convert */ - int islpyr = 0; /* is-current-year-a-leap-year flag */ - int tmptim; - int *mdays; /* pointer to days or lpdays */ - struct tm *ptb = &tb; - - - if ( caltim < 0L ) - return(NULL); - - /* - * Determine years since 1970. First, identify the four-year interval - * since this makes handling leap-years easy (note that 2000 IS a - * leap year and 2100 is out-of-range). - */ - tmptim = (int)(caltim / FOUR_YEAR_SEC); - caltim -= ((long)tmptim * FOUR_YEAR_SEC); - - /* - * Determine which year of the interval - */ - tmptim = (tmptim * 4) + 70; /* 1970, 1974, 1978,...,etc. */ - - if ( caltim >= YEAR_SEC ) - { - tmptim++; /* 1971, 1975, 1979,...,etc. */ - caltim -= YEAR_SEC; - - if ( caltim >= YEAR_SEC ) - { - tmptim++; /* 1972, 1976, 1980,...,etc. */ - caltim -= YEAR_SEC; - - /* - * Note, it takes 366 days-worth of seconds to get past a leap - * year. - */ - if ( caltim >= (YEAR_SEC + DAY_SEC) ) - { - tmptim++; /* 1973, 1977, 1981,...,etc. */ - caltim -= (YEAR_SEC + DAY_SEC); - } - else - { - /* - * In a leap year after all, set the flag. - */ - islpyr++; - } - } - } - - /* - * tmptim now holds the value for tm_year. caltim now holds the - * number of elapsed seconds since the beginning of that year. - */ - ptb->tm_year = tmptim; - - /* - * Determine days since January 1 (0 - 365). This is the tm_yday value. - * Leave caltim with number of elapsed seconds in that day. - */ - ptb->tm_yday = (int)(caltim / DAY_SEC); - caltim -= (long)(ptb->tm_yday) * DAY_SEC; - - /* - * Determine months since January (0 - 11) and day of month (1 - 31) - */ - if ( islpyr ) - mdays = _lpdays; - else - mdays = _days; - - - for ( tmptim = 1 ; mdays[tmptim] < ptb->tm_yday ; tmptim++ ) ; - - ptb->tm_mon = --tmptim; - - ptb->tm_mday = ptb->tm_yday - mdays[tmptim]; - - /* - * Determine days since Sunday (0 - 6) - */ - ptb->tm_wday = ((int)(*timp / DAY_SEC) + BASE_DOW) % 7; - - /* - * Determine hours since midnight (0 - 23), minutes after the hour - * (0 - 59), and seconds after the minute (0 - 59). - */ - ptb->tm_hour = (int)(caltim / 3600); - caltim -= (long)ptb->tm_hour * 3600L; - - ptb->tm_min = (int)(caltim / 60); - ptb->tm_sec = (int)(caltim - (ptb->tm_min) * 60); - - ptb->tm_isdst = 0; - return( (struct tm *)ptb ); -#endif -} - -////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// GSI equivalent of Standard C-lib "mktime function" -time_t gsiDateToSeconds(struct tm *tb) -{ -#if !defined(_NITRO) && !defined(_REVOLUTION) - - // for all platforms that support the standard C 'mktime' use that - return mktime(tb); - -#else - time_t tmptm1, tmptm2, tmptm3; - struct tm *tbtemp; - /* - * First, make sure tm_year is reasonably close to being in range. - */ - if ( ((tmptm1 = tb->tm_year) < BASE_YEAR - 1) || (tmptm1 > MAX_YEAR + 1) ) - return MKTIME_ERROR; - - - /* - * Adjust month value so it is in the range 0 - 11. This is because - * we don't know how many days are in months 12, 13, 14, etc. - */ - - if ( (tb->tm_mon < 0) || (tb->tm_mon > 11) ) { - - /* - * no danger of overflow because the range check above. - */ - tmptm1 += (tb->tm_mon / 12); - - if ( (tb->tm_mon %= 12) < 0 ) { - tb->tm_mon += 12; - tmptm1--; - } - - /* - * Make sure year count is still in range. - */ - if ( (tmptm1 < BASE_YEAR - 1) || (tmptm1 > MAX_YEAR + 1) ) - return MKTIME_ERROR; - } - - /***** HERE: tmptm1 holds number of elapsed years *****/ - - /* - * Calculate days elapsed minus one, in the given year, to the given - * month. Check for leap year and adjust if necessary. - */ - tmptm2 = _days[tb->tm_mon]; - if ( !(tmptm1 & 3) && (tb->tm_mon > 1) ) - tmptm2++; - - /* - * Calculate elapsed days since base date (midnight, 1/1/70, UTC) - * - * - * 365 days for each elapsed year since 1970, plus one more day for - * each elapsed leap year. no danger of overflow because of the range - * check (above) on tmptm1. - */ - tmptm3 = (tmptm1 - BASE_YEAR) * 365L + ((tmptm1 - 1L) >> 2) - - LEAP_YEAR_ADJUST; - - /* - * elapsed days to current month (still no possible overflow) - */ - tmptm3 += tmptm2; - - /* - * elapsed days to current date. overflow is now possible. - */ - tmptm1 = tmptm3 + (tmptm2 = (long)(tb->tm_mday)); - if ( ChkAdd(tmptm1, tmptm3, tmptm2) ) - return MKTIME_ERROR; - - /***** HERE: tmptm1 holds number of elapsed days *****/ - - /* - * Calculate elapsed hours since base date - */ - tmptm2 = tmptm1 * 24L; - if ( ChkMul(tmptm2, tmptm1, 24L) ) - return MKTIME_ERROR; - - tmptm1 = tmptm2 + (tmptm3 = (long)tb->tm_hour); - if ( ChkAdd(tmptm1, tmptm2, tmptm3) ) - return MKTIME_ERROR; - - /***** HERE: tmptm1 holds number of elapsed hours *****/ - - /* - * Calculate elapsed minutes since base date - */ - - tmptm2 = tmptm1 * 60L; - if ( ChkMul(tmptm2, tmptm1, 60L) ) - return MKTIME_ERROR; - - tmptm1 = tmptm2 + (tmptm3 = (long)tb->tm_min); - if ( ChkAdd(tmptm1, tmptm2, tmptm3) ) - return MKTIME_ERROR; - - /***** HERE: tmptm1 holds number of elapsed minutes *****/ - - /* - * Calculate elapsed seconds since base date - */ - - tmptm2 = tmptm1 * 60L; - if ( ChkMul(tmptm2, tmptm1, 60L) ) - return MKTIME_ERROR; - - tmptm1 = tmptm2 + (tmptm3 = (long)tb->tm_sec); - if ( ChkAdd(tmptm1, tmptm2, tmptm3) ) - return MKTIME_ERROR; - - /***** HERE: tmptm1 holds number of elapsed seconds *****/ - - if ( (tbtemp = gsiSecondsToDate(&tmptm1)) == NULL ) - return MKTIME_ERROR; - - - /***** HERE: tmptm1 holds number of elapsed seconds, adjusted *****/ - /***** for local time if requested *****/ - - *tb = *tbtemp; - return (time_t)tmptm1; -#endif -} - -////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////// -// GSI equivalent of Standard C-lib "ctime function" -char * gsiSecondsToString(const time_t *timp) -{ -#if !defined(_NITRO) && !defined(_REVOLUTION) - - // for all platforms that support the standard C 'ctime' use that - return ctime(timp); - -#else - char *p = buf; - int day, mon; - int i; - struct tm *ptm; - - ptm = gsiSecondsToDate(timp); /* parse seconds into date structure */ - - p = buf; /* use static buffer */ - - /* copy day and month names into the buffer */ - - day = ptm->tm_wday * 3; /* index to correct day string */ - mon = ptm->tm_mon * 3; /* index to correct month string */ - - for (i=0; i < 3; i++,p++) { - *p = *(_dnames + day + i); - *(p+4) = *(_mnames + mon + i); - } - - *p = _T(' '); /* blank between day and month */ - - p += 4; - - *p++ = _T(' '); - p = store_dt(p, ptm->tm_mday); /* day of the month (1-31) */ - *p++ = _T(' '); - p = store_dt(p, ptm->tm_hour); /* hours (0-23) */ - *p++ = _T(':'); - p = store_dt(p, ptm->tm_min); /* minutes (0-59) */ - *p++ = _T(':'); - p = store_dt(p, ptm->tm_sec); /* seconds (0-59) */ - *p++ = _T(' '); - p = store_dt(p, 19 + (ptm->tm_year/100)); /* year (after 1900) */ - p = store_dt(p, ptm->tm_year%100); - *p++ = _T('\n'); - *p = _T('\0'); - - return ((char *) buf); -#endif -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Cross platform random number generator -#define RANa 16807 // multiplier -#define LONGRAND_MAX 2147483647L // 2**31 - 1 - -static long randomnum = 1; - -static long nextlongrand(long seed) -{ - unsigned - - long lo, hi; - lo = RANa *(unsigned long)(seed & 0xFFFF); - hi = RANa *((unsigned long)seed >> 16); - lo += (hi & 0x7FFF) << 16; - - if (lo > LONGRAND_MAX) - { - lo &= LONGRAND_MAX; - ++lo; - } - lo += hi >> 15; - - if (lo > LONGRAND_MAX) - { - lo &= LONGRAND_MAX; - ++lo; - } - - return(long)lo; -} - -// return next random long -static long longrand(void) -{ - randomnum = nextlongrand(randomnum); - return randomnum; -} - -// to seed it -void Util_RandSeed(unsigned long seed) -{ - // nonzero seed - randomnum = seed ? (long)(seed & LONGRAND_MAX) : 1; -} - -int Util_RandInt(int low, int high) -{ - unsigned int range = (unsigned int)high-low; - int num; - - if (range == 0) - return (low); // Prevent divide by zero - - num = (int)(longrand() % range); - - return(num + low); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/***************************** -UNICODE ENCODING -******************************/ - -static void QuartToTrip(char *quart, char *trip, int inlen) -{ - if (inlen >= 2) - trip[0] = (char)(quart[0] << 2 | quart[1] >> 4); - if (inlen >= 3) - trip[1] = (char)((quart[1] & 0x0F) << 4 | quart[2] >> 2); - if (inlen >= 4) - trip[2] = (char)((quart[2] & 0x3) << 6 | quart[3]); -} - -static void TripToQuart(const char *trip, char *quart, int inlen) -{ - unsigned char triptemp[3]; - int i; - for (i = 0; i < inlen ; i++) - { - triptemp[i] = (unsigned char)trip[i]; - } - while (i < 3) //fill the rest with 0 - { - triptemp[i] = 0; - i++; - } - quart[0] = (char)(triptemp[0] >> 2); - quart[1] = (char)(((triptemp[0] & 3) << 4) | (triptemp[1] >> 4)); - quart[2] = (char)((triptemp[1] & 0x0F) << 2 | (triptemp[2] >> 6)); - quart[3] = (char)(triptemp[2] & 0x3F); - -} - -const char defaultEncoding[] = {'+','/','='}; -const char alternateEncoding[] = {'[',']','_'}; -const char urlSafeEncodeing[] = {'-','_','='}; - -void B64Decode(const char *input, char *output, int inlen, int * outlen, int encodingType) -{ - const char *encoding = NULL; - const char *holdin = input; - int readpos = 0; - int writepos = 0; - char block[4]; - - //int outlen = -1; - //int inlen = (int)strlen(input); - - // 10-31-2004 : Added by Saad Nader - // now supports URL safe encoding - //////////////////////////////////////////////// - switch(encodingType) - { - case 1: - encoding = alternateEncoding; - break; - case 2: - encoding = urlSafeEncodeing; - break; - default: encoding = defaultEncoding; - } - - GS_ASSERT(inlen >= 0); - if (inlen <= 0) - { - if (outlen) - *outlen = 0; - output[0] = '\0'; - return; - } - - // Break at end of string or padding character - while (readpos < inlen && input[readpos] != encoding[2]) - { - // 'A'-'Z' maps to 0-25 - // 'a'-'z' maps to 26-51 - // '0'-'9' maps to 52-61 - // 62 maps to encoding[0] - // 63 maps to encoding[1] - if (input[readpos] >= '0' && input[readpos] <= '9') - block[readpos%4] = (char)(input[readpos] - 48 + 52); - else if (input[readpos] >= 'a' && input[readpos] <= 'z') - block[readpos%4] = (char)(input[readpos] - 71); - else if (input[readpos] >= 'A' && input[readpos] <= 'Z') - block[readpos%4] = (char)(input[readpos] - 65); - else if (input[readpos] == encoding[0]) - block[readpos%4] = 62; - else if (input[readpos] == encoding[1]) - block[readpos%4] = 63; - - // padding or '\0' characters also mark end of input - else if (input[readpos] == encoding[2]) - break; - else if (input[readpos] == '\0') - break; - else - { - // (assert(0)); //bad input data - if (outlen) - *outlen = 0; - output[0] = '\0'; - return; //invaid data - } - - // every 4 bytes, convert QuartToTrip into destination - if (readpos%4==3) // zero based, so (3%4) means four bytes, 0-1-2-3 - { - QuartToTrip(block, &output[writepos], 4); - writepos += 3; - } - readpos++; - } - - // Convert any leftover characters in block - if ((readpos != 0) && (readpos%4 != 0)) - { - // fill block with pad (required for QuartToTrip) - memset(&block[readpos%4], encoding[2], (unsigned int)4-(readpos%4)); - QuartToTrip(block, &output[writepos], readpos%4); - - // output bytes depend on the number of non-pad input bytes - if (readpos%4 == 3) - writepos += 2; - else - writepos += 1; - } - - if (outlen) - *outlen = writepos; - - GSI_UNUSED(holdin); -} - - - -void B64Encode(const char *input, char *output, int inlen, int encodingType) -{ - const char *encoding; - char *holdout = output; - char *lastchar; - int todo = inlen; - - // 10-31-2004 : Added by Saad Nader - // now supports URL safe encoding - //////////////////////////////////////////////// - switch(encodingType) - { - case 1: - encoding = alternateEncoding; - break; - case 2: - encoding = urlSafeEncodeing; - break; - default: encoding = defaultEncoding; - } - -//assume interval of 3 - while (todo > 0) - { - TripToQuart(input, output, min(todo, 3)); - output += 4; - input += 3; - todo -= 3; - } - lastchar = output; - if (inlen % 3 == 1) - lastchar -= 2; - else if (inlen % 3 == 2) - lastchar -= 1; - *output = 0; //null terminate! - while (output > holdout) - { - output--; - if (output >= lastchar) //pad the end - *output = encoding[2]; - else if (*output <= 25) - *output = (char)(*output + 65); - else if (*output <= 51) - *output = (char)(*output + 71); - else if (*output <= 61) - *output = (char)(*output + 48 - 52); - else if (*output == 62) - *output = encoding[0]; - else if (*output == 63) - *output = encoding[1]; - } -} - -int B64DecodeLen(const char *input, int encodingType) -{ - const char *encoding; - const char *holdin = input; - - switch(encodingType) - { - case 1: - encoding = alternateEncoding; - break; - case 2: - encoding = urlSafeEncodeing; - break; - default: encoding = defaultEncoding; - } - - while (*input) - { - if (*input == encoding[2]) - return (input - holdin) / 4 * 3 + (input - holdin - 1) % 4; - input++; - } - - return (input - holdin) / 4 * 3; -} - -void B64InitEncodeStream(B64StreamData *data, const char *input, int len, int encodingType) -{ - data->input = input; - data->len = len; - data->encodingType = encodingType; -} - -gsi_bool B64EncodeStream(B64StreamData *data, char output[4]) -{ - const char *encoding; - char *c; - int i; - - if(data->len <= 0) - return gsi_false; - - // 10-31-2004 : Added by Saad Nader - // now supports URL safe encoding - //////////////////////////////////////////////// - switch(data->encodingType) - { - case 1: - encoding = alternateEncoding; - break; - case 2: - encoding = urlSafeEncodeing; - break; - default: encoding = defaultEncoding; - } - - TripToQuart(data->input, output, min(data->len, 3)); - data->input += 3; - data->len -= 3; - - for(i = 0 ; i < 4 ; i++) - { - c = &output[i]; - if (*c <= 25) - *c = (char)(*c + 65); - else if (*c <= 51) - *c = (char)(*c + 71); - else if (*c <= 61) - *c = (char)(*c + 48 - 52); - else if (*c == 62) - *c = encoding[0]; - else if (*c == 63) - *c = encoding[1]; - } - - if(data->len < 0) - { - output[3] = encoding[2]; - if(data->len == -2) - output[2] = encoding[2]; - } - - return gsi_true; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiPadRight(char *cArray, char padChar, int cLength); -char * gsiXxteaAlg(const char *sIn, int nIn, char key[XXTEA_KEY_SIZE], int bEnc, int *nOut); - -void gsiPadRight(char *cArray, char padChar, int cLength) -{ - int diff; - int length = (int)strlen(cArray); - - diff = cLength - length; - memset(&cArray[length], padChar, (size_t)diff); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// The heart of the XXTEA encryption/decryption algorithm. -// -// sIn: Input stream. -// nIn: Input length (bytes). -// key: Key (only first 128 bits are significant). -// bEnc: Encrypt (else decrypt)? -char * gsiXxteaAlg(const char *sIn, int nIn, char key[XXTEA_KEY_SIZE], int bEnc, int *nOut) -{ - int i, p, n1; - unsigned int *k, *v, z, y; - char *oStr = NULL, *pStr = NULL; - char *sIn2 = NULL; - ///////////////////////////////// - // ERROR CHECK! - if (!sIn || !key[0] || nIn == 0) - return NULL; - - // Convert stream length to a round number of 32-bit words - // Convert byte count to 32-bit word count - if (nIn % 4 == 0) // Fix for null terminated strings divisible by 4 - nIn = (nIn/4)+1; - else - nIn = (nIn + 3)/4; - - if ( nIn <= 1 ) // XXTEA requires at least 64 bits - nIn = 2; - - // Load and zero-pad first 16 characters (128 bits) of key - gsiPadRight( key , '\0', XXTEA_KEY_SIZE); - k = (unsigned int *)key; - - // Load and zero-pad entire input stream as 32-bit words - sIn2 = (char *)gsimalloc((size_t)(4 * nIn)); - strcpy(sIn2, sIn); - gsiPadRight( sIn2, '\0', 4*nIn); - v = (unsigned int *)sIn2; - - // Prepare to encrypt or decrypt - n1 = nIn - 1; - z = v[ n1 ]; - y = v[ 0 ]; - i = ( int )( 6 + 52/nIn ); - - if (bEnc == 1) // Encrypt - { - unsigned int sum = 0; - while ( i-- != 0 ) - { - int e; - sum += 0x9E3779B9; - e = ( int )( sum >> 2 ); - for ( p = -1; ++p < nIn; ) - { - y = v[( p < n1 ) ? p + 1 : 0 ]; - z = ( v[ p ] += - ( (( z >> 5 ) ^ ( y << 2 )) - + (( y >> 3 ) ^ ( z << 4 ))) - ^ ( ( sum ^ y ) - + ( k[( p ^ e ) & 3 ] ^ z ))); - } - } - } - else if (bEnc == 0) // Decrypt - { - unsigned int sum = ( unsigned int ) i * 0x9E3779B9; - while ( sum != 0 ) - { - int e = ( int )( sum >> 2 ); - for ( p = nIn; p-- != 0; ) - { - z = v[( p != 0 ) ? p - 1 : n1 ]; - y = ( v[ p ] -= - ( (( z >> 5 ) ^ ( y << 2 )) - + (( y >> 3 ) ^ ( z << 4 ))) - ^ ( ( sum ^ y ) - + ( k[( p ^ e ) & 3 ] ^ z ))); - } - sum -= 0x9E3779B9; - } - } - else return NULL; - // Convert result from 32-bit words to a byte stream - - - oStr = (char *)gsimalloc((size_t)(4 * nIn + 1)); - pStr = oStr; - *nOut = 4 *nIn; - for ( i = -1; ++i < nIn; ) - { - unsigned int q = v[ i ]; - - *pStr++ = (char)(q & 0xFF); - *pStr++ = (char)(( q >> 8 ) & 0xFF); - *pStr++ = (char)(( q >> 16 ) & 0xFF); - *pStr++ = (char)(( q >> 24 ) & 0xFF); - } - *pStr = '\0'; - gsifree(sIn2); - - return oStr; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// XXTEA Encrpyt -// params -// iStr : the input string to be encrypted -// iLength : the length of the input string -// key : the key used to encrypt -char * gsXxteaEncrypt(const char * iStr, int iLength, char key[XXTEA_KEY_SIZE], int *oLength) -{ - return gsiXxteaAlg( iStr, iLength, key, 1, oLength ); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// XXTEA Decrypt -// params -// iStr : the input string to be decrypted -// iLength : the length of the input string -// key : the key used to decrypt -char * gsXxteaDecrypt(const char * iStr, int iLength, char key[XXTEA_KEY_SIZE], int *oLength) -{ - return gsiXxteaAlg( iStr, iLength, key, 0, oLength); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(_DEBUG) - -void gsiCheckStack(void) -{ -#if defined(_NITRO) -#if 1 - OS_CheckStack(OS_GetCurrentThread()); -#elif 1 - static gsi_bool checkFailed = gsi_false; - if(!checkFailed) - { - OSStackStatus status = OS_GetStackStatus(OS_GetCurrentThread()); - if(status != 0) - { - const char * reason; - if(status == OS_STACK_OVERFLOW) - reason = "OVERFLOW"; - else if(status == OS_STACK_ABOUT_TO_OVERFLOW) - reason = "ABOUT TO OVERFLOW"; - else if(status == OS_STACK_UNDERFLOW) - reason = "UNDERFLOW"; - else - reason = "UNKOWN REASON"; - - OS_TPrintf("STACK CHECK FAILED!: %s\n", reason); - - checkFailed = gsi_true; - } - } -#endif -#endif // nitro -} -#endif // _DEBUG - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef SN_SYSTEMS -int GOAGetLastError(SOCKET s) -{ - int val = 0; - int soval = sizeof(val); - if (0 != getsockopt(s,SOL_SOCKET,SO_ERROR,&val,&soval)) - return 0; // getsockopt failed - else - return val; -} -#endif - -#ifdef _NITRO -static const char * GOAGetUniqueID_Internal(void) -{ - static char keyval[17]; - u8 MAC[MAC_ALEN]; - - // check if we already have the Unique ID - if(keyval[0]) - return keyval; - - // get the MAC - IP_GetMacAddr(NULL, MAC); - - // format it - sprintf(keyval, "%02X%02X%02X%02X%02X%02X0000", - MAC[0] & 0xFF, - MAC[1] & 0xFF, - MAC[2] & 0xFF, - MAC[3] & 0xFF, - MAC[4] & 0xFF, - MAC[5] & 0xFF); - - return keyval; -} -#endif - - -#ifdef _PS2 -#ifdef UNIQUEID - -#if defined(EENET) - -#include -// Removed due to updated sony libraries, Saad Nader -//#include -#include - -static const char * GetMAC(void) -{ - static struct sceEENetEtherAddr linkAddress; - struct sceEENetIfname * interfaces; - struct sceEENetIfname * interface; - int num; - int type; - int len; - int i; - const unsigned char * MAC = NULL; - - // get the local interfaces - sceEENetGetIfnames(NULL, &num); - interfaces = (struct sceEENetIfname *)gsimalloc(num * sizeof(struct sceEENetIfname)); - if(!interfaces) - return NULL; - sceEENetGetIfnames(interfaces, &num); - - // loop through the interfaces - for(i = 0 ; i < num ; i++) - { - // the next interface - interface = &interfaces[i]; - //printf("eenet%d: %s\n", i, interface->ifn_name); - - // get the type - len = sizeof(type); - if(sceEENetGetIfinfo(interface->ifn_name, sceEENET_IFINFO_IFTYPE, &type, &len) != 0) - continue; - //printf("eenet%d type: %d\n", i, type); - - // check for ethernet - if(type != sceEENET_IFTYPE_ETHER) - continue; - //printf("eenet%d: ethernet\n", i); - - // get the address - len = sizeof(linkAddress); - if(sceEENetGetIfinfo(interface->ifn_name, sceEENET_IFINFO_MACADDR, &linkAddress, &len) != 0) - continue; - MAC = linkAddress.ether_addr_octet; - //printf("eenet%d: MAC: %02X-%02X-%02X-%02X-%02X-%02X\n", i, MAC[0], MAC[1], MAC[2], MAC[3], MAC[4], MAC[5]); - - break; - } - - // free the interfaces - gsifree(interfaces); - - return MAC; -} - -#elif defined(SN_SYSTEMS) - - static const char * GetMAC(void) - { - static char MAC[6]; - int len = sizeof(MAC); - int rcode; - - // get the MAC - rcode = sndev_get_status(0, SN_DEV_STAT_MAC, MAC, &len); - if((rcode != 0) || (len != 6)) - return NULL; - - return MAC; - } - -#elif defined(INSOCK) - - static const char * GetMAC(void) - { - // Get the MAC address using the interface control - static char MAC[16]; - extern sceSifMClientData gGSIInsockClientData; - extern u_int gGSIInsockSocketBuffer[NETBUFSIZE] __attribute__((aligned(64))); - - int result = sceInetInterfaceControl(&gGSIInsockClientData, &gGSIInsockSocketBuffer, - 1, sceInetCC_GetHWaddr, MAC, sizeof(MAC)); - if (result == sceINETE_OK) - return MAC; - - // error - return NULL; - } - -#endif - -static const char * GOAGetUniqueID_Internal(void) -{ - static char keyval[17]; - const char * MAC; - - // check if we already have the Unique ID - if(keyval[0]) - return keyval; - - // get the MAC - MAC = GetMAC(); - if(!MAC) - { - // error getting the MAC - static char errorMAC[6] = { 1, 2, 3, 4, 5, 6 }; - MAC = errorMAC; - } - - // format it - sprintf(keyval, "%02X%02X%02X%02X%02X%02X0000", - MAC[0] & 0xFF, - MAC[1] & 0xFF, - MAC[2] & 0xFF, - MAC[3] & 0xFF, - MAC[4] & 0xFF, - MAC[5] & 0xFF); - - return keyval; -} - -#endif // UNIQUEID -#endif // _PS2 - - -#if ((defined(_WIN32) && !defined(_XBOX)) || defined(_UNIX)) - -static void GenerateID(char *keyval) -{ - int i; - const char crypttab[63] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; -#ifdef _WIN32 - LARGE_INTEGER l1; - UINT seed; - if (QueryPerformanceCounter(&l1)) - seed = (l1.LowPart ^ l1.HighPart); - else - seed = 0; - Util_RandSeed(seed ^ SDL_GetTicks() ^ (unsigned long)time(NULL) ^ clock()); -#else - Util_RandSeed(time(NULL) ^ clock()); -#endif - for (i = 0; i < 19; i++) - if (i == 4 || i == 9 || i == 14) - keyval[i] = '-'; - else - keyval[i] = crypttab[Util_RandInt(0, 62)]; - keyval[19] = 0; -} - -#ifndef PATH_MAX -#define PATH_MAX MAX_PATH -#endif - -#ifdef _WIN32 -#define REG_KEY "Software\\GameSpy\\GameSpy 3D\\Registration" -#endif - -const char * GOAGetUniqueID_Internal(void) -{ - static char keyval[PATH_MAX] = ""; - unsigned int ret; - -#ifdef _WIN32 - int docreate; - HKEY thekey; - DWORD thetype = REG_SZ; - DWORD len = MAX_PATH; - DWORD disp; - - if (RegOpenKeyExA(HKEY_CURRENT_USER, REG_KEY, 0, KEY_ALL_ACCESS, &thekey) != ERROR_SUCCESS) - docreate = 1; - else - docreate = 0; - ret = RegQueryValueExA(thekey, (LPCSTR)"Crypt", 0, &thetype, (LPBYTE)keyval, &len); -#else - FILE *f; - f = fopen("id.bin","r"); - if (!f) - ret = 0; - else - { - ret = fread(keyval,1,19,f); - keyval[ret] = 0; - fclose(f); - } -#endif - - if (ret != 0 || strlen(keyval) != 19)//need to generate a new key - { - GenerateID(keyval); -#ifdef _WIN32 - if (docreate) - { - ret = RegCreateKeyExA(HKEY_CURRENT_USER, REG_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &thekey, &disp); - } - RegSetValueExA(thekey, (LPCSTR)"Crypt", 0, REG_SZ, (const LPBYTE)keyval, strlen(keyval)+1); -#else - f = fopen("id.bin","w"); - if (f) - { - fwrite(keyval,1,19,f); - fclose(f); - } else - keyval[0] = 0; //don't generate one each time!! -#endif - } - -#ifdef _WIN32 - RegCloseKey(thekey); -#endif - - // Strip out the -'s. - ///////////////////// - memmove(keyval + 4, keyval + 5, 4); - memmove(keyval + 8, keyval + 10, 4); - memmove(keyval + 12, keyval + 15, 4); - keyval[16] = '\0'; - - return keyval; -} - -#endif - -#ifdef _PSP -// Included here so that the implementation can appear in gsPlatformPSP.c -const char * GOAGetUniqueID_Internal(void); -#endif - - -#if (!defined(_PS2) && !defined(_PS3) && !defined(_XBOX) && !defined(_PSP)) || defined(UNIQUEID) -GetUniqueIDFunction GOAGetUniqueID = GOAGetUniqueID_Internal; -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformUtil.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformUtil.h deleted file mode 100644 index 1e56173487d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsPlatformUtil.h +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSUTILITY_H__ -#define __GSUTILITY_H__ - - -#include "gsPlatform.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Async DNS lookup - -// async way to resolve a hostname to an IP -typedef struct GSIResolveHostnameInfo * GSIResolveHostnameHandle; -#define GSI_STILL_RESOLVING_HOSTNAME 0 -#define GSI_ERROR_RESOLVING_HOSTNAME 0xFFFFFFFF - -// start resolving a hostname -// returns 0 on success, -1 on error -int gsiStartResolvingHostname(const char * hostname, GSIResolveHostnameHandle * handle); -// cancel a resolve in progress -void gsiCancelResolvingHostname(GSIResolveHostnameHandle handle); -// returns GSI_STILL_RESOLVING if still resolving the hostname -// returns GSI_ERROR_RESOLVING if it was unable to resolve the hostname -// on success, returns the IP of the host in network byte order -unsigned int gsiGetResolvedIP(GSIResolveHostnameHandle handle); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Get rid of compiler warnings when parameters are never used -// (Mainly used in sample apps and callback for platform switches) -#if (defined(__MWERKS__) && !defined(_NITRO)) || defined(WIN32) - #define GSI_UNUSED(x) x -#elif defined(_PS2) || defined(_NITRO) || defined(_PS3) || defined(_MACOSX) - #define GSI_UNUSED(x) {void* y=&x;y=NULL;} -#elif defined(_PSP) -#define GSI_UNUSED(x) (void)x; - -#else - #define GSI_UNUSED(x) -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Cross platform random number generator -void Util_RandSeed(unsigned long seed); // to seed it -int Util_RandInt(int low, int high); // retrieve a random int - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Base 64 encoding (printable characters) -void B64Encode(const char *input, char *output, int inlen, int encodingType); -void B64Decode(const char *input, char *output, int inlen, int * outlen, int encodingType); - -// returns the length of the binary data represented by the base64 input string -int B64DecodeLen(const char *input, int encodingType); - -typedef struct -{ - const char *input; - int len; - int encodingType; -} B64StreamData; - -void B64InitEncodeStream(B64StreamData *data, const char *input, int len, int encodingType); - -// returns gsi_false if the stream has ended -gsi_bool B64EncodeStream(B64StreamData *data, char output[4]); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define XXTEA_KEY_SIZE 17 -gsi_i8 * gsXxteaEncrypt(const gsi_i8 * iStr, gsi_i32 iLength, gsi_i8 key[XXTEA_KEY_SIZE], gsi_i32 *oLength); -gsi_i8 * gsXxteaDecrypt(const gsi_i8 * iStr, gsi_i32 iLength, gsi_i8 key[XXTEA_KEY_SIZE], gsi_i32 *oLength); - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#if defined(_DEBUG) - void gsiCheckStack(void); -#else - #define gsiCheckStack() -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// time functions - -gsi_time current_time(); // milliseconds -gsi_time current_time_hires(); // microseconds -void msleep(gsi_time msec); // milliseconds - -// GSI equivalent of common C-lib time functions -struct tm * gsiSecondsToDate(const time_t *timp); //gmtime -time_t gsiDateToSeconds(struct tm *tb); //mktime -char * gsiSecondsToString(const time_t *timp); //ctime - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Misc utilities - - -#if defined(_NITRO) - time_t time(time_t *timer); - - #define gmtime(t) gsiSecondsToDate(t) - #define ctime(t) gsiSecondsToString(t) - #define mktime(t) gsiDateToSeconds(t) -#elif defined(_REVOLUTION) - time_t gsiTimeInSec(time_t *timer); - struct tm *gsiGetGmTime(time_t *theTime); - char *gsiCTime(time_t *theTime); - #define time(t) gsiTimeInSec(t) - #define gmtime(t) gsiGetGmTime(t) - #define ctime(t) gsiCTime(t) -#else - #include -#endif - - - #ifndef SOMAXCONN - #define SOMAXCONN 5 -#endif - -typedef const char * (* GetUniqueIDFunction)(); - -extern GetUniqueIDFunction GOAGetUniqueID; - -// Prototypes so the compiler won't warn -#ifdef _PS2 -extern int wprintf(const wchar_t*,...); -#endif - - -// 64-bit Integer reads and writes -gsi_i64 gsiStringToInt64(const char *theNumberStr); -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber); -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -} -#endif - -#endif //__GSUTILITY_H__ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsRC4.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsRC4.c deleted file mode 100644 index 3d8dbb18014..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsRC4.c +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCommon.h" -#include "gsRC4.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void swap_byte (unsigned char *a, unsigned char *b) -{ - unsigned char swapByte; - - swapByte = *a; - *a = *b; - *b = swapByte; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void RC4Init(RC4Context *context, const unsigned char *key, int len) -{ - int i=0; - unsigned char stateIndex = 0; - unsigned char keyIndex = 0; - - // must supply a key - assert(key != NULL && len != 0); - if (key == NULL || len == 0) - return; - - context->x = 0; - context->y = 0; - - for (i=0; i<256; i++) - context->state[i] = (unsigned char)i; - - for (i=0; i<256; i++) - { - stateIndex = (unsigned char)(stateIndex + context->state[i] + key[keyIndex]); - swap_byte(&context->state[i], &context->state[stateIndex]); - keyIndex = (unsigned char)((keyIndex+1)%len); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void RC4Encrypt(RC4Context *context, const unsigned char *src, unsigned char *dest, int len) -{ - int i = 0; - for (i=0; ix = (unsigned char)(context->x + 1); // ok to wrap around from overflow - context->y = (unsigned char)(context->y + context->state[context->x]); // ditto - swap_byte(&context->state[context->x], &context->state[context->y]); - dest[i] = (unsigned char)(src[i] ^ context->state[(unsigned char)(context->state[context->x]+context->state[context->y])]); - } -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsRC4.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsRC4.h deleted file mode 100644 index e5c6bc53afb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsRC4.h +++ /dev/null @@ -1,34 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSRC4_H__ -#define __GSRC4_H__ - - -#include "gsCommon.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct RC4Context -{ - unsigned char x; - unsigned char y; - unsigned char state[256]; -} RC4Context; - -void RC4Init(RC4Context *context, const unsigned char *key, int len); -void RC4Encrypt(RC4Context *context, const unsigned char *src, unsigned char *dest, int len); - -// Note: RC4Encrypt with src==dest is OK - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} -#endif -#endif // __GSRC4_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSHA1.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSHA1.c deleted file mode 100644 index c4e61061f5f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSHA1.c +++ /dev/null @@ -1,390 +0,0 @@ -/* - * sha1.c - * - * Description: - * This file implements the Secure Hashing Algorithm 1 as - * defined in FIPS PUB 180-1 published April 17, 1995. - * - * The SHA-1, produces a 160-bit message digest for a given - * data stream. It should take about 2**n steps to find a - * message with the same digest as a given message and - * 2**(n/2) to find any two messages with the same digest, - * when n is the digest size in bits. Therefore, this - * algorithm can serve as a means of providing a - * "fingerprint" for a message. - * - * Portability Issues: - * SHA-1 is defined in terms of 32-bit "words". This code - * uses (included via "sha1.h" to define 32 and 8 - * bit unsigned integer types. If your C compiler does not - * support 32 bit unsigned integers, this code is not - * appropriate. - * - * Caveats: - * SHA-1 is designed to work with messages less than 2^64 bits - * long. Although SHA-1 allows a message digest to be generated - * for messages of any number of bits less than 2^64, this - * implementation only works with messages with a length that is - * a multiple of the size of an 8-bit character. - * - */ - -//#include "sha1.h" -#include "gsSHA1.h" - -/* - * Define the SHA1 circular left shift macro - */ -#define SHA1CircularShift(bits,word) \ - (((word) << (bits)) | ((word) >> (32-(bits)))) - -/* Local Function Prototyptes */ -void SHA1PadMessage(SHA1Context *); -void SHA1ProcessMessageBlock(SHA1Context *); - -/* - * SHA1Reset - * - * Description: - * This function will initialize the SHA1Context in preparation - * for computing a new SHA1 message digest. - * - * Parameters: - * context: [in/out] - * The context to reset. - * - * Returns: - * sha Error Code. - * - */ -int SHA1Reset(SHA1Context *context) -{ - if (!context) - { - return shaNull; - } - - context->Length_Low = 0; - context->Length_High = 0; - context->Message_Block_Index = 0; - - context->Intermediate_Hash[0] = 0x67452301; - context->Intermediate_Hash[1] = 0xEFCDAB89; - context->Intermediate_Hash[2] = 0x98BADCFE; - context->Intermediate_Hash[3] = 0x10325476; - context->Intermediate_Hash[4] = 0xC3D2E1F0; - - context->Computed = 0; - context->Corrupted = 0; - - return shaSuccess; -} - -/* - * SHA1Result - * - * Description: - * This function will return the 160-bit message digest into the - * Message_Digest array provided by the caller. - * NOTE: The first octet of hash is stored in the 0th element, - * the last octet of hash in the 19th element. - * - * Parameters: - * context: [in/out] - * The context to use to calculate the SHA-1 hash. - * Message_Digest: [out] - * Where the digest is returned. - * - * Returns: - * sha Error Code. - * - */ -int SHA1Result( SHA1Context *context, - uint8_t Message_Digest[SHA1HashSize]) -{ - int i; - - if (!context || !Message_Digest) - { - return shaNull; - } - - if (context->Corrupted) - { - return context->Corrupted; - } - - if (!context->Computed) - { - SHA1PadMessage(context); - for(i=0; i<64; ++i) - { - /* message may be sensitive, clear it out */ - context->Message_Block[i] = 0; - } - context->Length_Low = 0; /* and clear length */ - context->Length_High = 0; - context->Computed = 1; - - } - - for(i = 0; i < SHA1HashSize; ++i) - { - Message_Digest[i] = (uint8_t)(context->Intermediate_Hash[i>>2] - >> 8 * ( 3 - ( i & 0x03 ) )); - } - - return shaSuccess; -} - -/* - * SHA1Input - * - * Description: - * This function accepts an array of octets as the next portion - * of the message. - * - * Parameters: - * context: [in/out] - * The SHA context to update - * message_array: [in] - * An array of characters representing the next portion of - * the message. - * length: [in] - * The length of the message in message_array - * - * Returns: - * sha Error Code. - * - */ -int SHA1Input( SHA1Context *context, - const uint8_t *message_array, - unsigned length) -{ - if (!length) - { - return shaSuccess; - } - - if (!context || !message_array) - { - return shaNull; - } - - if (context->Computed) - { - context->Corrupted = shaStateError; - - return shaStateError; - } - - if (context->Corrupted) - { - return context->Corrupted; - } - while(length-- && !context->Corrupted) - { - context->Message_Block[context->Message_Block_Index++] = - (uint8_t)(*message_array & 0xFF); - - context->Length_Low += 8; - if (context->Length_Low == 0) - { - context->Length_High++; - if (context->Length_High == 0) - { - /* Message is too long */ - context->Corrupted = 1; - } - } - - if (context->Message_Block_Index == 64) - { - SHA1ProcessMessageBlock(context); - } - - message_array++; - } - - return shaSuccess; -} - -/* - * SHA1ProcessMessageBlock - * - * Description: - * This function will process the next 512 bits of the message - * stored in the Message_Block array. - * - * Parameters: - * None. - * - * Returns: - * Nothing. - * - * Comments: - - * Many of the variable names in this code, especially the - * single character names, were used because those were the - * names used in the publication. - * - * - */ -void SHA1ProcessMessageBlock(SHA1Context *context) -{ - const uint32_t K[] = { /* Constants defined in SHA-1 */ - 0x5A827999, - 0x6ED9EBA1, - 0x8F1BBCDC, - 0xCA62C1D6 - }; - int t; /* Loop counter */ - uint32_t temp; /* Temporary word value */ - uint32_t W[80]; /* Word sequence */ - uint32_t A, B, C, D, E; /* Word buffers */ - - /* - * Initialize the first 16 words in the array W - */ - for(t = 0; t < 16; t++) - { - W[t] = (uint32_t)(context->Message_Block[t * 4] << 24); - W[t] |= (uint32_t)(context->Message_Block[t * 4 + 1] << 16); - W[t] |= (uint32_t)(context->Message_Block[t * 4 + 2] << 8); - W[t] |= (uint32_t)(context->Message_Block[t * 4 + 3]); - } - - for(t = 16; t < 80; t++) - { - W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); - } - - A = context->Intermediate_Hash[0]; - B = context->Intermediate_Hash[1]; - C = context->Intermediate_Hash[2]; - D = context->Intermediate_Hash[3]; - E = context->Intermediate_Hash[4]; - - for(t = 0; t < 20; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | ((~B) & D)) + E + W[t] + K[0]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - - B = A; - A = temp; - } - - for(t = 20; t < 40; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 40; t < 60; t++) - { - temp = SHA1CircularShift(5,A) + - ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - for(t = 60; t < 80; t++) - { - temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; - E = D; - D = C; - C = SHA1CircularShift(30,B); - B = A; - A = temp; - } - - context->Intermediate_Hash[0] += A; - context->Intermediate_Hash[1] += B; - context->Intermediate_Hash[2] += C; - context->Intermediate_Hash[3] += D; - context->Intermediate_Hash[4] += E; - - context->Message_Block_Index = 0; -} - -/* - * SHA1PadMessage - * - - * Description: - * According to the standard, the message must be padded to an even - * 512 bits. The first padding bit must be a '1'. The last 64 - * bits represent the length of the original message. All bits in - * between should be 0. This function will pad the message - * according to those rules by filling the Message_Block array - * accordingly. It will also call the ProcessMessageBlock function - * provided appropriately. When it returns, it can be assumed that - * the message digest has been computed. - * - * Parameters: - * context: [in/out] - * The context to pad - * ProcessMessageBlock: [in] - * The appropriate SHA*ProcessMessageBlock function - * Returns: - * Nothing. - * - */ - -void SHA1PadMessage(SHA1Context *context) -{ - /* - * Check to see if the current message block is too small to hold - * the initial padding bits and length. If so, we will pad the - * block, process it, and then continue padding into a second - * block. - */ - if (context->Message_Block_Index > 55) - { - context->Message_Block[context->Message_Block_Index++] = 0x80; - while(context->Message_Block_Index < 64) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - - SHA1ProcessMessageBlock(context); - - while(context->Message_Block_Index < 56) - { - context->Message_Block[context->Message_Block_Index++] = 0; - } - } - else - { - context->Message_Block[context->Message_Block_Index++] = 0x80; - while(context->Message_Block_Index < 56) - { - - context->Message_Block[context->Message_Block_Index++] = 0; - } - } - - /* - * Store the message length as the last 8 octets - */ - context->Message_Block[56] = (uint8_t)(context->Length_High >> 24); - context->Message_Block[57] = (uint8_t)(context->Length_High >> 16); - context->Message_Block[58] = (uint8_t)(context->Length_High >> 8); - context->Message_Block[59] = (uint8_t)(context->Length_High); - context->Message_Block[60] = (uint8_t)(context->Length_Low >> 24); - context->Message_Block[61] = (uint8_t)(context->Length_Low >> 16); - context->Message_Block[62] = (uint8_t)(context->Length_Low >> 8); - context->Message_Block[63] = (uint8_t)(context->Length_Low); - - SHA1ProcessMessageBlock(context); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSHA1.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSHA1.h deleted file mode 100644 index 03471bc6a8d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSHA1.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * sha1.h - * - * Description: - * This is the header file for code which implements the Secure - * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published - * April 17, 1995. - * - * Many of the variable names in this code, especially the - * single character names, were used because those were the names - * used in the publication. - * - * Please read the file sha1.c for more information. - * - */ - -#ifndef _SHA1_H_ -#define _SHA1_H_ - -//#include -#include "gsCommon.h" -/* - * If you do not have the ISO standard stdint.h header file, then you - * must typdef the following: - * name meaning - * uint32_t unsigned 32 bit integer - * uint8_t unsigned 8 bit integer (i.e., unsigned char) - * int_least16_t integer of >= 16 bits - * - */ -#ifndef _PS3 - // these common types are defined in sony libs - typedef gsi_u32 uint32_t; - typedef gsi_u8 uint8_t; -#endif - -typedef gsi_i16 int_least16_t; - -#ifndef _SHA_enum_ -#define _SHA_enum_ -enum -{ - shaSuccess = 0, - shaNull, /* Null pointer parameter */ - shaInputTooLong, /* input data too long */ - shaStateError /* called Input after Result */ -}; -#endif -#define SHA1HashSize 20 - -/* - * This structure will hold context information for the SHA-1 - * hashing operation - */ -typedef struct SHA1Context -{ - uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */ - - uint32_t Length_Low; /* Message length in bits */ - uint32_t Length_High; /* Message length in bits */ - - /* Index into message block array */ - int_least16_t Message_Block_Index; - uint8_t Message_Block[64]; /* 512-bit message blocks */ - - int Computed; /* Is the digest computed? */ - int Corrupted; /* Is the message digest corrupted? */ -} SHA1Context; - -/* - * Function Prototypes - */ - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -int SHA1Reset( SHA1Context *); -int SHA1Input( SHA1Context *, - const uint8_t *, - unsigned int); -int SHA1Result( SHA1Context *, - uint8_t Message_Digest[SHA1HashSize]); - - -#if defined(__cplusplus) -} -#endif // extern "C" - - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSSL.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSSL.c deleted file mode 100644 index 36098b2ca8e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSSL.c +++ /dev/null @@ -1,37 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsSSL.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Don't define the export cipher suites if you can avoid it, they present a security risk -const struct gsSSLCipherSuiteDesc gsSSLCipherSuites[GS_SSL_NUM_CIPHER_SUITES] = -{ - // Since common version of IIS supports these, - // we are safe to require the best - - // Algorithm ID (fixed const), KeyLen, CipherLen, IV Len - { TLS_RSA_WITH_RC4_128_MD5, 16, 16, 00 }, - //{ TLS_RSA_WITH_3DES_EDE_CBC_SHA, 16, 20, 00 }, - - // Use of single DES is questionable - // { TLS_RSA_WITH_DES_CBC_SHA, 00, 00, 00 }, - - // Support for export ciphers poses a security risk - // A hacker can edit the packet stream to use a weak export cipher, - // then crack the session and modify the message MACs - // { TLS_RSA_EXPORT1024_WITH_RC4_56_SHA, 00, 00, 00 }, - // { TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA, 00, 00, 00 }, - // { TLS_RSA_EXPORT_WITH_RC4_40_MD5, 00, 00, 00 }, - // { TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5, 00, 00, 00 }, - - // Plain diffie-helmann not supported - // { TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA, 00, 00, 00 }, - // { TLS_DHE_DSS_WITH_DES_CBC_SHA, 00, 00, 00 }, - // { TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA, 00, 00, 00 } -}; - - -const unsigned char gsSslRsaOid[9] = -{ 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01 }; diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSSL.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSSL.h deleted file mode 100644 index 8bd2e3a0998..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSSL.h +++ /dev/null @@ -1,186 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSSSL_H__ -#define __GSSSL_H__ - -#include "../darray.h" -#include "../md5.h" -#include "gsCrypt.h" -#include "gsSHA1.h" -#include "gsRC4.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - - // SSL common types and defines. Used by HTTP SSL encryption engine - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// SSL v3.0 -#define GS_SSL_VERSION_MAJOR (0x03) -#define GS_SSL_VERSION_MINOR (0x00) - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - // SSL content types -#define GS_SSL_CONTENT_CHANGECIPHERSPEC (0x14) // 20 -#define GS_SSL_CONTENT_ALERT (0x15) // 21 Not sure if this is the correct value -#define GS_SSL_CONTENT_HANDSHAKE (0x16) // 22 -#define GS_SSL_CONTENT_APPLICATIONDATA (0x17) // 23 - - // SSL handshake message types -//#define GS_SSL_HANDSHAKE_HELLOREQUEST (0) -#define GS_SSL_HANDSHAKE_CLIENTHELLO (1) -#define GS_SSL_HANDSHAKE_SERVERHELLO (2) -#define GS_SSL_HANDSHAKE_CERTIFICATE (11) -//#define GS_SSL_HANDSHAKE_SERVERKEYEXCHANGE (12) -//#define GS_SSL_HANDSHAKE_CERTIFICATEREQUEST (13) -#define GS_SSL_HANDSHAKE_SERVERHELLODONE (14) -//#define GS_SSL_HANDSHAKE_CERTIFICATEVERIFY (15) -#define GS_SSL_HANDSHAKE_CLIENTKEYEXCHANGE (16) -#define GS_SSL_HANDSHAKE_FINISHED (20) - -// the largest payload for a single SSL packet, RFC const -// ----> RFC includes MAC and any padding, actual user data must be less -#define GS_SSL_MAX_CONTENTLENGTH ((0x4000) - (0xFF)) - -#ifndef HAVE_CIPHER_SUITES - /* these are the ones used by IE */ - #define TLS_RSA_WITH_RC4_128_MD5 0x04 - #define TLS_RSA_WITH_RCA_128_SHA 0x05 - #define TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x0a - #define TLS_RSA_WITH_DES_CBC_SHA 0x09 - #define TLS_RSA_EXPORT1024_WITH_RC4_56_SHA 0x64 - #define TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA 0x62 - #define TLS_RSA_EXPORT_WITH_RC4_40_MD5 0x03 - #define TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 0x06 - #define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA 0x13 - #define TLS_DHE_DSS_WITH_DES_CBC_SHA 0x12 - #define TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA 0x63 -#endif - - // These depend on the SSL cipher suite ranges -#define GS_SSL_MAX_MAC_SECRET_SIZE (20) -#define GS_SSL_MAX_SYMMETRIC_KEY_SIZE (16) -#define GS_SSL_MAX_IV_SIZE (16) -#define GS_SSL_NUM_CIPHER_SUITES (1) // cipher suite list defined in gsSSL.c -#define GS_SSL_MASTERSECRET_LEN (48) -#define GS_SSL_PAD_ONE "666666666666666666666666666666666666666666666666" // 48 bytes -#define GS_SSL_PAD_TWO "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" // 48 bytes -#define GS_SSL_MD5_PAD_LEN (48) -#define GS_SSL_SHA1_PAD_LEN (40) // use only 40 of the 48 bytes -#define GS_SSL_CLIENT_FINISH_VALUE "CLNT" -#define GS_SSL_SERVER_FINISH_VALUE "SRVR" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// SSL instance/session info -typedef struct gsSSL -{ - int sessionLen; - unsigned char sessionData[255]; // up to 256 bytes - unsigned short cipherSuite; - - //DArray certificateArray; - gsCryptRSAKey serverpub; - unsigned char sendSeqNBO[8]; // incrementing sequence number (for messages sent) - unsigned char receiveSeqNBO[8]; // ditto (for messages received) - - // Key buffers - // Actual data may be smaller than array size - unsigned char clientWriteMACSecret[GS_CRYPT_SHA1_HASHSIZE]; - unsigned char clientReadMACSecret [GS_CRYPT_SHA1_HASHSIZE]; - unsigned char clientWriteKey [GS_SSL_MAX_SYMMETRIC_KEY_SIZE]; - unsigned char clientReadKey [GS_SSL_MAX_SYMMETRIC_KEY_SIZE]; - unsigned char clientWriteIV [GS_SSL_MAX_IV_SIZE]; - unsigned char clientReadIV [GS_SSL_MAX_IV_SIZE]; - - // Actual lengths of the above data blocks - int clientWriteMACLen; - int clientReadMACLen; - int clientWriteKeyLen; - int clientReadKeyLen; - int clientWriteIVLen; - int clientReadIVLen; - - RC4Context sendRC4; // initialized ONCE per key exchange - RC4Context recvRC4; // initialized ONCE per key exchange - - // these are unused once the handshake is complete - // todo: dynamically allocate or remove to free space - MD5_CTX finishHashMD5; - SHA1Context finishHashSHA1; - unsigned char serverRandom[32]; // server random for key generation, sent plain text - unsigned char clientRandom[32]; // client random for key generation, sent plain text - unsigned char premastersecret[GS_SSL_MASTERSECRET_LEN]; // client random for key generation, sent encrypted with serverpub - unsigned char mastersecret[GS_SSL_MASTERSECRET_LEN]; - -} gsSSL; - - -// SSL messages (like the ClientHello) are wrapped in a "record" struct -typedef struct gsSSLRecordHeaderMsg -{ - unsigned char contentType; // = GS_SSL_CONTENT_HANDSHAKE; - unsigned char versionMajor; // = GS_SSL_VERSION_MAJOR; - unsigned char versionMinor; // = GS_SSL_VERSION_MINOR; - unsigned char lengthNBO[2]; // length of msg, limited to 2^14 - - // WARNING: lengthNBO can NOT be an unsigned short - // This would create alignment issues from the previous 3 parameters - -} gsSSLRecordHeaderMsg; - -typedef struct gsSSLClientHelloMsg -{ - gsSSLRecordHeaderMsg header; // include the header for easier packing - unsigned char handshakeType; // 0x01 - unsigned char lengthNBO[3]; // 3 byte length, NBO integer! 61 = 0x00 00 3d - unsigned char versionMajor; // = GS_SSL_VERSION_MAJOR; - unsigned char versionMinor; // = GS_SSL_VERSION_MINOR; - unsigned char time[4]; // 4 byte random (spec says set to current unix-time) - unsigned char random[28]; // 28 byte random, total of 32 random bytes - unsigned char sessionIdLen; // how many of the bytes that follow are session info? (def:0) - - // ALIGNMENT: 44 bytes prior to this, alignment should be OK - unsigned short cipherSuitesLength; // 2* number of cipher suites - unsigned short cipherSuites[GS_SSL_NUM_CIPHER_SUITES]; - unsigned char compressionMethodLen; // no standard methods, set to 1 - unsigned char compressionMethodList; // set to 0 -} gsSSLClientHelloMsg; - -typedef struct gsSSLClientKeyExchangeMsg -{ - gsSSLRecordHeaderMsg header; // included here for easier packing - unsigned char handshakeType; // 0x10 - unsigned char lengthNBO[3]; - // The next lengthNBO bytes are the client contribution to the key -} gsSSLClientKeyExchangeMsg; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Information about each cipher suite -typedef struct gsSSLCipherSuiteDesc -{ - int mSuiteID; - int mKeyLen; - int mMACLen; - int mIVLen; -} gsSSLCipherSuiteDesc; - -extern const gsSSLCipherSuiteDesc gsSSLCipherSuites[GS_SSL_NUM_CIPHER_SUITES]; -extern const unsigned char gsSslRsaOid[9]; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} // extern "C" -#endif - -#endif // __GSSSL_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSoap.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSoap.c deleted file mode 100644 index d28f97b1557..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSoap.c +++ /dev/null @@ -1,280 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// gSOAP Glue -#include "gsCore.h" -#include "gsSoap.h" -#include "gsPlatformThread.h" -#include "gsXML.h" -#include "../ghttp/ghttpASCII.h" - - -// GAMESPY DEVELOPERS -> Use gsiExecuteSoap - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Soap task delegates -static void gsiSoapTaskExecute(void* theTask); -static void gsiSoapTaskCallback(void* theTask, GSTaskResult theResult); -static void gsiSoapTaskCancel(void* theTask); -static gsi_bool gsiSoapTaskCleanup(void* theTask); -static GSTaskResult gsiSoapTaskThink(void* theTask); - -// Http triggered callbacks (don't take action now, wait for task callbacks) -static GHTTPBool gsiSoapTaskHttpCompletedCallback(GHTTPRequest request, GHTTPResult result, - char * buffer, GHTTPByteCount bufferLen, - void * param); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Execute a soap function (this should be the only call made from other SDKs) -GSSoapTask* gsiExecuteSoap(const char* theURL, const char* theService, - GSXmlStreamWriter theRequestSoap, GSSoapCallbackFunc theCallbackFunc, - void* theUserData) -{ - GSSoapTask* aSoapTask = NULL; - GSTask* aCoreTask = NULL; - - aSoapTask = (GSSoapTask*)gsimalloc(sizeof(GSSoapTask)); - if (aSoapTask == NULL) - return NULL; // out of memory - - aSoapTask->mCallbackFunc = theCallbackFunc; - aSoapTask->mCustomFunc = NULL; - aSoapTask->mURL = theURL; - aSoapTask->mService = theService; - aSoapTask->mRequestSoap = theRequestSoap; - aSoapTask->mPostData = NULL; - aSoapTask->mResponseSoap = NULL; - aSoapTask->mResponseBuffer = NULL; - aSoapTask->mUserData = theUserData; - aSoapTask->mRequestResult= (GHTTPResult)0; - aSoapTask->mCompleted = gsi_false; - - aCoreTask = gsiCoreCreateTask(); - if (aCoreTask == NULL) - { - gsifree(aSoapTask); - return NULL; // out of memory - } - - aCoreTask->mCallbackFunc = gsiSoapTaskCallback; - aCoreTask->mExecuteFunc = gsiSoapTaskExecute; - aCoreTask->mThinkFunc = gsiSoapTaskThink; - aCoreTask->mCleanupFunc = gsiSoapTaskCleanup; - aCoreTask->mCancelFunc = gsiSoapTaskCancel; - aCoreTask->mTaskData = (void*)aSoapTask; - - aSoapTask->mCoreTask = aCoreTask; - - gsiCoreExecuteTask(aCoreTask, 0); - - return aSoapTask; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Execute a soap function with a GSSoapCustomFunc that can access the soap -// structure prior to execution. This allows the client to set DIME -// attachments. (The GSSoapCustomFunc parameter could be added to -// gsiExecuteSoap itself as long as existing client code is updated) -GSSoapTask* gsiExecuteSoapCustom(const char* theURL, const char* theService, - GSXmlStreamWriter theRequestSoap, GSSoapCallbackFunc theCallbackFunc, - GSSoapCustomFunc theCustomFunc, void* theUserData) -{ - GSSoapTask* aSoapTask = NULL; - GSTask* aCoreTask = NULL; - - aSoapTask = (GSSoapTask*)gsimalloc(sizeof(GSSoapTask)); - aSoapTask->mCallbackFunc = theCallbackFunc; - aSoapTask->mCustomFunc = theCustomFunc; - aSoapTask->mURL = theURL; - aSoapTask->mService = theService; - aSoapTask->mRequestSoap = theRequestSoap; - aSoapTask->mPostData = NULL; - aSoapTask->mResponseSoap = NULL; - aSoapTask->mResponseBuffer = NULL; - aSoapTask->mUserData = theUserData; - aSoapTask->mRequestResult= (GHTTPResult)0; - aSoapTask->mCompleted = gsi_false; - - aCoreTask = gsiCoreCreateTask(); - aCoreTask->mCallbackFunc = gsiSoapTaskCallback; - aCoreTask->mExecuteFunc = gsiSoapTaskExecute; - aCoreTask->mThinkFunc = gsiSoapTaskThink; - aCoreTask->mCleanupFunc = gsiSoapTaskCleanup; - aCoreTask->mCancelFunc = gsiSoapTaskCancel; - aCoreTask->mTaskData = (void*)aSoapTask; - - aSoapTask->mCoreTask = aCoreTask; - - gsiCoreExecuteTask(aCoreTask, 0); - - return aSoapTask; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Cancels a soap task. -// - Because of network race conditions, the task may complete before it -// can be cancelled. If this happens, the task callback will be triggered -// with status GHTTPRequestCancelled and the result data will be discarded. -void gsiCancelSoap(GSSoapTask * theTask) -{ - GS_ASSERT(theTask != NULL); - - // Still in progress? cancel it! - if (gsi_is_false(theTask->mCompleted)) - gsiCoreCancelTask(theTask->mCoreTask); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - ////////// HTTP CALLBACKS ////////// - -static GHTTPBool gsiSoapTaskHttpCompletedCallback(GHTTPRequest request, GHTTPResult result, - char * buffer, GHTTPByteCount bufferLen, - void * param) -{ - gsi_bool parseResult = gsi_false; - - GSSoapTask* aSoapTask = (GSSoapTask*)param; - aSoapTask->mRequestResult = result; - aSoapTask->mCompleted = gsi_true; - aSoapTask->mResponseBuffer = buffer; - - if (result == GHTTPSuccess) - { - aSoapTask->mResponseSoap = gsXmlCreateStreamReader(); - if (aSoapTask->mResponseSoap == NULL) - { - // OOM! - aSoapTask->mRequestResult = GHTTPOutOfMemory; - } - else - { - parseResult = gsXmlParseBuffer(aSoapTask->mResponseSoap, buffer, (int)bufferLen); - if (gsi_is_false(parseResult)) - { - // Todo: handle multiple error conditions - aSoapTask->mRequestResult = GHTTPBadResponse; - } - } - } - - GSI_UNUSED(request); - - return GHTTPFalse; // don't let http free the buffer -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - ////////// SOAP EXECUTE TASK ////////// - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Checks to see if the soap task has completed -// - return GSTaskResult_InProgress for "keep checking" -// - return anything else for "finished - trigger callback and delete" -static GSTaskResult gsiSoapTaskThink(void* theTask) -{ - // is the request still processing? - GSSoapTask* aSoapTask = (GSSoapTask*)theTask; - if (gsi_is_true(aSoapTask->mCompleted)) - return GSTaskResult_Finished; - else - { - ghttpRequestThink(aSoapTask->mRequestId); - return GSTaskResult_InProgress; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Spawns the soap thread and begins execution -static void gsiSoapTaskExecute(void* theTask) -{ - GSSoapTask* aSoapTask = (GSSoapTask*)theTask; - //int threadID = 0; - - // make sure we aren't reusing a task without first resetting it - GS_ASSERT(gsi_is_false(aSoapTask->mCompleted)); - - aSoapTask->mPostData = ghttpNewPost(); - if (aSoapTask->mPostData == NULL) - { - // OOM: abort task - aSoapTask->mCompleted = gsi_true; - aSoapTask->mRequestResult = GHTTPOutOfMemory; - return; - } - - ghttpPostSetAutoFree(aSoapTask->mPostData, GHTTPFalse); - ghttpPostAddXml(aSoapTask->mPostData, aSoapTask->mRequestSoap); - - // Allow client to further configure soap object if desired - if (aSoapTask->mCustomFunc != NULL) - (aSoapTask->mCustomFunc)(aSoapTask->mPostData, aSoapTask->mUserData); - - - aSoapTask->mRequestId = ghttpGetExA(aSoapTask->mURL, aSoapTask->mService, - NULL, 0, aSoapTask->mPostData, GHTTPFalse, GHTTPFalse, NULL, - gsiSoapTaskHttpCompletedCallback, (void*)aSoapTask); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Called when the soap task needs to be cancelled -static void gsiSoapTaskCancel(void* theTask) -{ - GSSoapTask * soapTask = (GSSoapTask*)theTask; - if (gsi_is_false(soapTask->mCompleted)) - { - if (soapTask->mRequestId >= 0) - ghttpCancelRequest(soapTask->mRequestId); - soapTask->mRequestResult = GHTTPRequestCancelled; - soapTask->mCompleted = gsi_true; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Called when the soap task completes or is cancelled/timed out -static void gsiSoapTaskCallback(void* theTask, GSTaskResult theResult) -{ - // Call the developer callback - GSSoapTask* aSoapTask = (GSSoapTask*)theTask; - - (aSoapTask->mCallbackFunc)(aSoapTask->mRequestResult, aSoapTask->mRequestSoap, - aSoapTask->mResponseSoap, aSoapTask->mUserData); - - GSI_UNUSED(theResult); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// After the soap call has completed, launch a separate cleanup event (see comments) -static gsi_bool gsiSoapTaskCleanup(void *theTask) -{ - GSSoapTask* aSoapTask = (GSSoapTask*)theTask; - - if (aSoapTask->mResponseSoap != NULL) - gsXmlFreeReader(aSoapTask->mResponseSoap); - if (aSoapTask->mResponseBuffer != NULL) - gsifree(aSoapTask->mResponseBuffer); - if (aSoapTask->mPostData != NULL) - ghttpFreePost(aSoapTask->mPostData); // this also frees the request soap xml - gsifree(aSoapTask); - - return gsi_true; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSoap.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSoap.h deleted file mode 100644 index b7e9bde4a29..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsSoap.h +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __SOAP_H__ -#define __SOAP_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCommon.h" -#include "gsCore.h" - -#include "../ghttp/ghttp.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef void(*GSSoapCallbackFunc)(GHTTPResult theHTTPResult, GSXmlStreamWriter theRequest, GSXmlStreamReader theResponse, void *theUserData); -typedef void(*GSSoapCustomFunc)(GHTTPPost theSoap, void* theUserData); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct -{ - GSSoapCallbackFunc mCallbackFunc; - GSSoapCustomFunc mCustomFunc; - const char *mURL; - const char *mService; - - GSXmlStreamWriter mRequestSoap; - GSXmlStreamReader mResponseSoap; - - char * mResponseBuffer; // so we can free it later - GHTTPPost mPostData; // so we can free it later - - void * mUserData; - GSTask * mCoreTask; - - GHTTPRequest mRequestId; - GHTTPResult mRequestResult; - gsi_bool mCompleted; -} GSSoapTask; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Execute a soap call (Uses GameSpy core object) -GSSoapTask* gsiExecuteSoap(const char *theURL, const char *theService, - GSXmlStreamWriter theSoapData, GSSoapCallbackFunc theCallbackFunc, - void *theUserData); - -// Alternate version with GSSoapCustomFunc parameter allows client access -// to soap object to set DIME attachments -GSSoapTask* gsiExecuteSoapCustom(const char* theURL, const char* theService, - GSXmlStreamWriter theSoapData, GSSoapCallbackFunc theCallbackFunc, - GSSoapCustomFunc theCustomFunc, void* theUserData); - - -void gsiCancelSoap(GSSoapTask * theTask); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} // extern "C" -#endif - -#endif // __SOAP_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsStringUtil.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsStringUtil.c deleted file mode 100644 index 166cb6f1c19..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsStringUtil.c +++ /dev/null @@ -1,683 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Conversion Utility for ASCII, UTF8 and USC2 (Unicode) character sets -// -// See RFC2279 for reference -// -// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsCommon.h" -#include "gsStringUtil.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Reads UCS2 character from UTF8String -// -// [in] theUTF8String : UTF8String, doesn't need to be null terminated -// [out] theUCS2Char : The 2 byte UCS2 equivalent -// [in] theMaxLength : Maximum number of *bytes* to read (not UTF8 characters) -// -// return value : The number of bytes read from theUTF8String -// 0 = error when parsing -// -// Remarks: -// If theUTF8String is invalid, theUnicodeChar will be set to '?' -// Function is designed for convenient parsing of UTF8 data streams -// -// Security Concern: -// Because data is routed through an ASCII stream prior to this function being -// called, embedded NULLs are stripped and hence, this function does not check for them -// For example, the UTF-8 byte :1000 0000, would convert to a UCS2 NULL character -// If this appeared in the middle of a stream, it could cause undesired operation -int _ReadUCS2CharFromUTF8String(const UTF8String theUTF8String, UCS2Char* theUnicodeChar, int theMaxLength) -{ -#ifndef _PS2 - assert(theUnicodeChar != NULL); -#endif - - if (theMaxLength == 0) - { - // assert? - *theUnicodeChar = (UCS2Char)REPLACE_INVALID_CHAR; - return 0; // not enough data - } - - // Check for normal ascii range (includes NULL terminator) - if (UTF8_IS_SINGLE_BYTE(theUTF8String[0])) - { - // ASCII, just copy the value - *theUnicodeChar = (UCS2Char)theUTF8String[0]; - return 1; - } - - // Check for 2 byte UTF8 - else if (UTF8_IS_TWO_BYTE(theUTF8String[0])) - { - if (theMaxLength < 2) - { - *theUnicodeChar = (UCS2Char)REPLACE_INVALID_CHAR; - return 0; // not enough data - } - - // Make sure the second byte is valid - if (UTF8_IS_FOLLOW_BYTE(theUTF8String[1])) - { - // Construct 11 bit unicode character - // 5 value bits from first UTF8Byte (:000ABCDE) - // plus 6 value bits from the second UTF8Byte (:00FGHIJK) - // Store as (:0000 0ABC DEFG HIJK) - *theUnicodeChar = (unsigned short)(((theUTF8String[0] & UTF8_TWO_BYTE_MASK) << 6) + - ((theUTF8String[1] & UTF8_FOLLOW_BYTE_MASK))); - return 2; - } - } - - // Check for 3 byte UTF8 - else if (UTF8_IS_THREE_BYTE(theUTF8String[0])) - { - if (theMaxLength < 3) - { - *theUnicodeChar = (UCS2Char)REPLACE_INVALID_CHAR; - return 0; // not enough data - } - - // Make sure the second and third bytes are valid - if (UTF8_IS_FOLLOW_BYTE(theUTF8String[1]) && - UTF8_IS_FOLLOW_BYTE(theUTF8String[2])) - { - // Construct 16 bit unicode character - // 4 value bits from first UTF8Byte (:0000ABCD) - // plus 6 value bits from the second UTF8Byte (:00EFGHIJ) - // plus 6 value bits from the third UTF8Byte (:00KLMNOP) - // Store as (:ABCD EFGH IJKL MNOP) - *theUnicodeChar = (unsigned short)(((theUTF8String[0] & UTF8_THREE_BYTE_MASK) << 12) + - ((theUTF8String[1] & UTF8_FOLLOW_BYTE_MASK) << 6) + - ((theUTF8String[2] & UTF8_FOLLOW_BYTE_MASK))); - return 3; - } - } - - // Invalid character, replace with '?' and return false - *theUnicodeChar = (UCS2Char)REPLACE_INVALID_CHAR; - - // The second byte on could have been the start of a new valid UTF8 character - // so we can only safely discard one invalid character - return 1; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Converts UCS2 (Unicode) character into UTF8String -// -// [in] theUCS2Char : The 2 byte character to convert -// [out] theUTF8String : The 1-3 byte UTF8 equivalent -// -// return value : The length of theUTF8String in bytes -// -// Remarks: -// theUTF8String may be up to 3 bytes, caller is responsible for allocating memory -// theUTF8String is NOT NULL terminated, -int _UCS2CharToUTF8String(UCS2Char theUCS2Char, UTF8String theUTF8String) -{ -#ifndef _PS2 - assert(theUTF8String != NULL); -#endif - - // Screen out simple ascii (includes NULL terminator) - if (theUCS2Char <= 0x7F) - { - // 0-7 bit unicode, copy stright over - theUTF8String[0] = (char)(UTF8ByteType)theUCS2Char; - return 1; - } - else if (theUCS2Char <= 0x07FF) - { - // 8-11 bits unicode, store as two byte UTF8 - // :00000ABC DEFGHIJK - // :110ABCDE 10FGHIJK - theUTF8String[0] = (char)(UTF8ByteType)(UTF8_TWO_BYTE_TAG | (theUCS2Char >> 6)); // Store the upper 5/11 bits as 0x110xxxxx - theUTF8String[1] = (char)(UTF8ByteType)(UTF8_FOLLOW_BYTE_TAG | (theUCS2Char & UTF8_FOLLOW_BYTE_MASK)); // Store the lower 6 bits as 0x10xxxxxx - return 2; - } - else - { - // 12-16 bits unicode, store as three byte UTF8 - // :ABCDEFGH IJKLMNOP - // :1110ABCD 10EFGHIJ 10KLMNOP - theUTF8String[0] = (char)(UTF8ByteType)(UTF8_THREE_BYTE_TAG | (theUCS2Char >> 12)); // Store the upper 4/16 bits as 0x1110xxxx - theUTF8String[1] = (char)(UTF8ByteType)(UTF8_FOLLOW_BYTE_TAG | ((theUCS2Char >> 6) & UTF8_FOLLOW_BYTE_MASK)); // Store the 5th-10th bits as 0x10xxxxxx - theUTF8String[2] = (char)(UTF8ByteType)(UTF8_FOLLOW_BYTE_TAG | ((theUCS2Char) & UTF8_FOLLOW_BYTE_MASK)); // Store the last 6 bits as 0x10xxxxxx - return 3; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert an ASCII string to UTF8 -// -// Since an ASCII string IS a valid UTF8 string, just copy and return -// -// [in] theAsciiString, NULL terminated c-string -// [out] theUTF8String, NULL terminated UTF8String -// -// returns the length of theUTF8String -int AsciiToUTF8String(const char* theAsciiString, UTF8String theUTF8String) -{ - // Allow for NULL here since SDKs allow for NULL string arrays - if (theAsciiString == NULL) - { - *theUTF8String = 0x00; - return 1; - } - else - { - // Copy the string, keeping track of length - unsigned int aLength = 0; - while (*theAsciiString != '\0') - { - *(theUTF8String++) = *(theAsciiString++); - aLength++; - } - - // Append the null - *theUTF8String = '\0'; - aLength++; - - return (int)aLength; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UTF8String to it's ASCII equivalent -// -// [in] theUTF8String, NULL terminated UTF8String -// [out] theAsciiString, NULL terminated c-string -// -// returns the length of theAsciiString -// -// Remarks: -// Unvalid ASCII characters are replaced with '?' -// Memory allocated for theAsciiString may need to be as large as the UTF8String -// UTF8String will be NULL terminated -int UTF8ToAsciiString(const UTF8String theUTF8String, char* theAsciiString) -{ - // Strip non-ascii characters and replace with REPLACE_INVALID_CHAR - const unsigned char* anInStream = (const unsigned char*)theUTF8String; - unsigned int aNumBytesWritten = 0; - - // Allow for NULL here since SDKs allow for NULL string arrays - if (theUTF8String == NULL) - { - *theAsciiString = 0x00; - return 1; - } - - // Keep extracting characters until we get a '\0' - while (*anInStream != '\0') - { - if (UTF8_IS_SINGLE_BYTE(*anInStream)) - theAsciiString[aNumBytesWritten++] = (char)*anInStream; - else - theAsciiString[aNumBytesWritten++] = REPLACE_INVALID_CHAR; - - // move to next character - anInStream++; - } - - // Append the '\0' - theAsciiString[aNumBytesWritten++] = '\0'; - return (int)aNumBytesWritten; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UCS2 (Unicode) string to it's UTF8 equivalent -// -// [in] theUCS2String, double NULL terminated UTF8String -// [out] theUTF8String, NULL terminated c-string -// -// returns the length of theUTF8String -// -// Remarks: -// Memory allocated for theUTF8String may need to be up to 1.5* the size of theUCS2String -// This means that for each UCS2 character, 3 UTF8 characters may be generated -int UCS2ToUTF8String(const UCS2String theUCS2String, UTF8String theUTF8String) -{ - unsigned int aTotalBytesWritten = 0; - unsigned int aUTF8CharLength = 0; - const UCS2Char* anInStream = theUCS2String; - unsigned char* anOutStream = (unsigned char*)theUTF8String; - - // Allow for NULL here since SDKs allow for NULL string parameters - if (theUCS2String == NULL) - { - *anOutStream = 0x00; - return 1; - } - - // Loop until we reach a NULL terminator - while(*anInStream != 0) - { - aUTF8CharLength = (unsigned int)_UCS2CharToUTF8String(*anInStream, (UTF8String)anOutStream); - - // Move out stream to next character position - anOutStream += aUTF8CharLength; - - // Move to next UCS2 character - anInStream++; - - // Record number of bytes written - aTotalBytesWritten += aUTF8CharLength; - } - - // Copy over the null terminator - *anOutStream = '\0'; - aTotalBytesWritten++; - - return (int)aTotalBytesWritten; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UTF8 string to it's UCS2 (Unicode) equivalent -// -// [in] theUTF8String, NULL terminated UTF8String -// [out] theUCS2String, NULL terminated c-string -// -// returns the length of theUCS2String -// -// Remarks: -// Unvalid UTF8 characters are replaced with '?' -// Memory allocated for theAsciiString may need to be as large as the UTF8String -// UTF8String will be NULL terminated -int UTF8ToUCS2String(const UTF8String theUTF8String, UCS2String theUCS2String) -{ - return UTF8ToUCS2StringLen(theUTF8String, theUCS2String, (gsi_i32)strlen(theUTF8String)); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Calculate the size needed to convert a UTF8String to a UCS2String -// -// [in] theUTF8String, NULL terminated UTF8String -// -// returns the length (in UCS2 characters) of theUCS2String that would be created -// -// Remarks: -// Unvalid UTF8 characters are treated as 1 byte -int _UTF8ToUCS2ConversionLengthOnly(const UTF8String theUTF8String) -{ - int length = 0; - const UTF8String theReadPos = theUTF8String; - - assert(theUTF8String != NULL); - if (theUTF8String == NULL) - return 0; - - while (*theReadPos != '\0') - { - // Check for valid two byte string - if (UTF8_IS_TWO_BYTE(theReadPos[0]) && UTF8_IS_FOLLOW_BYTE(theReadPos[1])) - theReadPos += 2; - - // Check for valid three byte string - else if (UTF8_IS_THREE_BYTE(theReadPos[0]) && - UTF8_IS_FOLLOW_BYTE(theReadPos[1]) && - UTF8_IS_FOLLOW_BYTE(theReadPos[2])) - { - theReadPos += 3; - } - // Anything else means one UTF8 character read from the buffer - else - theReadPos++; - - // Increment the length of the UCS2 string - length++; - } - - // don't count the null as a character, this conforms - // with ANSI strlen functions - return length; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Calculate the size needed to convert a UCS2String to a UTF8String -// -// [in] theUCS2String, NULL terminated UCS2String -// -// returns the length of theUTF8String that would be created -// -// Remarks: -// Unvalid UTF8 characters are treated as 1 byte -int _UCS2ToUTF8ConversionLengthOnly(const UCS2String theUCS2String) -{ - int length = 0; - const UCS2String theReadPos = theUCS2String; - assert(theUCS2String != NULL); - while (*theReadPos != 0x0000) - { - // Values <= 0x7F are single byte ascii - if (*theReadPos <= 0x7F) - length++; - // Values > 0x7F and <= 0x07FF are two bytes in UTF8 - else if (*theReadPos <= 0x07FF) - length += 2; - // Anything else is 3 bytes of UTF8 - else - length += 3; - - // Set read pos to right spot (1 more UCS2 Character = 2 bytes) - theReadPos++; - } - - // don't count the null as a character, this conforms - // with ANSI strlen functions - return length; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UTF8String to a UCS2String, allocate space for the UCS2String -// -// [in] theUTF8String, NULL terminated UTF8String -// -// returns the newly allocated UCS2String -// -// Remarks: -// The callee is responsible for freeing the allocated memory block -UCS2String UTF8ToUCS2StringAlloc(const UTF8String theUTF8String) -{ - // Allow for NULL here since SDKs allow for NULL string parameters - if (theUTF8String == NULL) - return NULL; - else - { - // Find the length of the UCS2 string and allocate a block - int newLength = _UTF8ToUCS2ConversionLengthOnly(theUTF8String); - UCS2String aUCS2String = (UCS2String)gsimalloc(sizeof(UCS2Char)*(newLength + 1)); - - // Do the conversion - UTF8ToUCS2String(theUTF8String, aUCS2String); - - // Return the allocated string - return aUCS2String; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UCS2String to a UTF8String, allocate space for the UTF8String -// -// [in] UCS2String, NULL terminated UCS2String -// -// returns the newly allocated UTF8String -// -// Remarks: -// The callee is responsible for freeing the allocated memory block -UTF8String UCS2ToUTF8StringAlloc(const UCS2String theUCS2String) -{ - // Allow for NULL here since SDKs allow for NULL string parameters - if (theUCS2String == NULL) - return NULL; - else - { - // Find the length of the UCS2 string and allocate a block - int newLength = _UCS2ToUTF8ConversionLengthOnly(theUCS2String); - UTF8String aUTF8String = (UTF8String)gsimalloc(sizeof(char)*(newLength + 1)); - - // Do the conversion - UCS2ToUTF8String(theUCS2String, aUTF8String); - - // Return the allocated string - return aUTF8String; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UTF8StringArray to a UCS2StringArray, allocate space for the UCS2Strings -// -// [in] UTF8StringArray, array of NULL terminated UTF8Strings -// [in] theNumStrings, how many strings are in the array -// -// returns the newly allocated UCS2StringArray -// -// Remarks: -// The callee is responsible for freeing the allocated memory block(s) -UCS2String* UTF8ToUCS2StringArrayAlloc(const UTF8String* theUTF8StringArray, int theNumStrings) -{ - // Allow for NULL here since SDKs allow for NULL string arrays - if(theUTF8StringArray == NULL || theNumStrings == 0) - return NULL; - else - { - UCS2String* aUCS2StringArray = (UCS2String*)gsimalloc(sizeof(UCS2String)*theNumStrings); - int stringNum = 0; - while(stringNum < theNumStrings) - { - aUCS2StringArray[stringNum] = UTF8ToUCS2StringAlloc(theUTF8StringArray[stringNum]); - stringNum++; - } - - return aUCS2StringArray; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UCS2StringArray to a UTF8StringArray, allocate space for the UTF8Strings -// -// [in] UCS2StringArray, array of NULL terminated UCS2Strings -// [in] theNumStrings, how many strings are in the array -// -// returns the newly allocated UTF8StringArray -// -// Remarks: -// The callee is responsible for freeing the allocated memory block -UTF8String* UCS2ToUTF8StringArrayAlloc(const UCS2String* theUCS2StringArray, int theNumStrings) -{ - // Allow for NULL here since SDKs allow for NULL string arrays - if (theUCS2StringArray == NULL || theNumStrings == 0) - return NULL; - else - { - UTF8String* aUTF8StringArray = (UTF8String*)gsimalloc(sizeof(UTF8String)*theNumStrings); - int stringNum = 0; - while(stringNum < theNumStrings) - { - aUTF8StringArray[stringNum] = UCS2ToUTF8StringAlloc(theUCS2StringArray[stringNum]); - stringNum++; - } - - return aUTF8StringArray; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UCS2String to an AsciiString -// -// [in] UCS2StringArray, NULL terminated UCS2String -// [in/out] theAsciiString, ascii representation -// -// returns the length of the Ascii string -// -// Remarks: -// callee is responsible for allocating memory for theAsciiString -// Invalid ASCII characters are truncated -// The ASCII buffer must be at least 1/2 the size of the UCS2String -int UCS2ToAsciiString(const UCS2String theUCS2String, char* theAsciiString) -{ - int length = 0; - const UCS2String aReadPos = theUCS2String; - char* aWritePos = theAsciiString; - - assert(theAsciiString != NULL); - - // Allow for NULL here since SDKs allow for NULL string arrays - if (theUCS2String == NULL) - { - *theAsciiString = '\0'; - return 1; - } - - // Convert each character until a '\0' is reached - while(*aReadPos != '\0') - { - (*aWritePos++) = (char)(0x00FF & (*aReadPos++)); - length++; - } - - // append the NULL - *aWritePos = '\0'; - length++; - - return length; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert an ASCII string to a UCS2String -// -// [in] theAsciiString, NULL terminated ASCII string -// [in/out] theUCS2String, UCS2String to be filled with the converted ASCII -// -// returns the length of the unicode string -// -// Remarks: -// The callee is responsible for allocating memory for theUCS2String -// the size returned should always be 2x the size passed in -int AsciiToUCS2String(const char* theAsciiString, UCS2String theUCS2String) -{ - int length = 0; - const char* aReadPos = theAsciiString; - UCS2String aWritePos = theUCS2String; - - assert(theUCS2String != NULL); - - // Allow for NULL here since SDKs allow for NULL string arrays - if (theAsciiString == NULL) - { - *theUCS2String = 0x0000; - return 1; - } - - // Convert each character until a '\0' is reached - while(*aReadPos != '\0') - { - (*aWritePos++) = (unsigned short)(0x00FF & (*aReadPos++)); // copy and strip extra byte - length++; - } - - // append a NULL terminator to the UCS2String - *aWritePos = '\0'; - length++; - - return length; -} - -/* -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UCS2String to a UTF8String with a maximum length -// -// [in] theUCS2String, NULL terminated UCS2String -// [in/out] theUTF8String, The UTF8 equivilent of theUCS2String -// [in] theMaxLength, maximum number of UTF8 characters to write -// -// returns the length of the UTF8String -// -// Remarks: -// The length of theUTF8String will not exceed theMaxLength supplied. -int UCS2ToUTF8StringLength(const UCS2String theUCS2String, UTF8String theUTF8String, int theMaxLength) -{ - return 0; -} -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Convert a UTF8String to a UCS2String with a maximum length -// -// [in] theUTF8String, NULL terminated UTF8String -// [in/out] theUCS2String, The UCS2 equivilent of theUTF8String -// [in] theMaxLength, maximum number of UTF8 characters to write -// -// returns the length of the UCS2String -// -// Remarks: -// The length of theUCS2String will not exceed theMaxLength supplied. -int UTF8ToUCS2StringLen(const UTF8String theUTF8String, UCS2String theUCS2String, int theMaxLength) -{ - int aNumCharsWritten = 0; - int aNumBytesRead = 0; - int aTotalBytesRead = 0; - const unsigned char* anInStream = (const unsigned char*)theUTF8String; - UCS2Char* anOutStream= theUCS2String; - - // Allow for NULL here since SDKs allow for NULL string arrays - if (theUTF8String == NULL) - { - *anOutStream = 0x0000; - return 1; - } - - // Loop until we find the NULL terminator - while (*anInStream != '\0' && theMaxLength > aTotalBytesRead) - { - // Convert one character - aNumBytesRead = _ReadUCS2CharFromUTF8String((UTF8String)anInStream, anOutStream, theMaxLength-aTotalBytesRead); - if (aNumBytesRead == 0) - { - // Error, read past end of buffer - theUCS2String[0] = 0x0000; - return 0; - } - aTotalBytesRead += aNumBytesRead; - - // Move InStream position to new data - anInStream += aNumBytesRead; - - // Keep track of characters written - aNumCharsWritten++; - - // Move OutStream to next write position - anOutStream++; - } - - // NULL terminate the UCS2String - *anOutStream = 0x0000; - aNumCharsWritten++; - - return aNumCharsWritten; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -} //extern "C" -#endif - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsStringUtil.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsStringUtil.h deleted file mode 100644 index eb74f521834..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsStringUtil.h +++ /dev/null @@ -1,83 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __STRINGUTIL_H__ -#define __STRINGUTIL_H__ - - -// String utilities used by the SDKs - -#ifdef __cplusplus -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef _PS2 -#define ALIGNED __attribute__ ((aligned(16))) -#else -#define ALIGNED -#endif - -#define UCS2Char unsigned short -#define UCS2String unsigned short* // null terminated -#define UTF8ByteType unsigned char // For type casting -#define UTF8String char* // may not be NULL terminated when treated as a single character - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define UTF8_FOLLOW_BYTE_TAG 0x80 //:1000 0000 // Identifies 2nd or 3rd byte of UTF8String -#define UTF8_TWO_BYTE_TAG 0xC0 //:1100 0000 // Identifies start of Two-byte UTF8String -#define UTF8_THREE_BYTE_TAG 0xE0 //:1110 0000 // Identifies start of Three-byte UTF8String -#define UTF8_FOUR_BYTE_TAG 0xF0 //:1111 0000 // Unsupported tag, need USC4 to store this - -#define UTF8_FOLLOW_BYTE_MASK 0x3F //:0011 1111 // The value bits in a follow byte -#define UTF8_TWO_BYTE_MASK 0x1F //:0001 1111 // The value bits in a two byte tag -#define UTF8_THREE_BYTE_MASK 0x0F //:0000 1111 // The value bits in a three byte tag - -#define UTF8_IS_THREE_BYTE(a) (((UTF8ByteType)a & UTF8_FOUR_BYTE_TAG)==UTF8_THREE_BYTE_TAG) -#define UTF8_IS_TWO_BYTE(a) (((UTF8ByteType)a & UTF8_THREE_BYTE_TAG)==UTF8_TWO_BYTE_TAG) -#define UTF8_IS_FOLLOW_BYTE(a) (((UTF8ByteType)a & UTF8_TWO_BYTE_TAG)==UTF8_FOLLOW_BYTE_TAG) -#define UTF8_IS_SINGLE_BYTE(a) ((UTF8ByteType)a <= 0x7F) // 0-127 - -#define REPLACE_INVALID_CHAR '?' // Replace invalid UTF8 chars with this - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Prototypes -// '_' denotes internal use functions -int _ReadUCS2CharFromUTF8String (const UTF8String theUTF8String, UCS2Char* theUnicodeChar, int theMaxLength); -int _UCS2CharToUTF8String (UCS2Char theUCS2Char, UTF8String theUTF8String); -int _UCS2ToUTF8ConversionLengthOnly (const UCS2String theUCS2String); -int _UTF8ToUCS2ConversionLengthOnly (const UTF8String theUTF8String); - -// Convert string types -int AsciiToUTF8String(const char* theAsciiString, UTF8String theUTF8String ); -int UTF8ToAsciiString(const UTF8String theUTF8String, char* theAsciiString); -int UCS2ToUTF8String (const UCS2String theUCS2String, UTF8String theUTF8String ); -int UTF8ToUCS2String (const UTF8String theUTF8String, UCS2String theUCS2String ); -int UCS2ToAsciiString(const UCS2String theUCS2String, char* theAsciiString); -int AsciiToUCS2String(const char* theAsciiString, UCS2String theUCS2String ); - -// Convert with maximum buffer length -// similar to strncpy -//int UCS2ToUTF8StringLength(const UCS2String theUCS2String, UTF8String theUTF8String, int theMaxLength); -int UTF8ToUCS2StringLen(const UTF8String theUTF8String, UCS2String theUCS2String, int theMaxLength); - -// Convert a string, allocate space for the new string -UTF8String UCS2ToUTF8StringAlloc(const UCS2String theUCS2String); -UCS2String UTF8ToUCS2StringAlloc(const UTF8String theUTF8String); - -// Convert an array of strings, allocate space for the new strings -UTF8String* UCS2ToUTF8StringArrayAlloc(const UCS2String* theUCS2StringArray, int theNumStrings); -UCS2String* UTF8ToUCS2StringArrayAlloc(const UTF8String* theUTF8StringArray, int theNumStrings); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // __STRINGUTIL_H__ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsUdpEngine.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsUdpEngine.c deleted file mode 100644 index 30c7771b21b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsUdpEngine.c +++ /dev/null @@ -1,1171 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Communication Engine -#include "gsUdpEngine.h" - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Internal Structures - -// Internal representation of a connection -// Also includes a ip and port for mapping to a connection -typedef struct -{ - unsigned int mAddr; - unsigned short mPort; - GT2Connection mConnection; -} GSUdpRemotePeer; - -// Message handler used filter traffic to a specific SDK or part of application -typedef struct -{ - unsigned char mInitialMsg[GS_UDP_MSG_HEADER_LEN]; - unsigned char mHeader[GS_UDP_MSG_HEADER_LEN]; - DArray mPendingConnections; - gsUdpConnClosedCallback mClosed; - gsUdpConnReceivedDataCallback mReceived; - gsUdpConnConnectedCallback mConnected; - gsUdpConnPingCallback mPingReply; - gsUdpErrorCallback mNetworkError; - void *mUserData; -} GSUdpMsgHandler; - -// The internal representation of UDP Communication Engine -typedef struct -{ - GT2Socket mSocket; - DArray mRemotePeers; - DArray mMsgHandlers; - gsi_bool mInitialized; - // Application callbacks for connection that gets - // un-handled messages - gsUdpConnConnectedCallback mAppConnected; - gsUdpConnClosedCallback mAppClosed; - gsUdpConnPingCallback mAppPingReply; - gsUdpConnReceivedDataCallback mAppRecvData; - gsUdpAppConnectAttemptCallback mAppConnAttempt; - // Error callback ? - gsUdpErrorCallback mAppNetworkError; - // Unknown Message - gsUdpUnknownMsgCallback mAppUnknownMessage; - void *mAppUserData; - - // This was any easier way to keep track of pending connections - // It does not rely on an address since it only keeps track of pending - // connections an app makes. - int mAppPendingConnections; - unsigned int mLocalAddr; - unsigned short mLocalPort; -}GSUdpEngineObject; - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Acts as the function to return the singleton -// This function is not exposed. It will only be -// used internally to do any modifications to the -// GSUdpEngineObject -GSUdpEngineObject * gsUdpEngineGetEngine() -{ - static GSUdpEngineObject aUdpObject; - return &aUdpObject; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Message Handler DArray functions -void gsUdpMsgHandlerFree(void *theMsgHandler) -{ - GSUdpMsgHandler *aHandler= (GSUdpMsgHandler *)theMsgHandler; - ArrayFree(aHandler->mPendingConnections); -} - -// Used to find a message handler based on the initial message. -int gsUdpMsgHandlerCompare(const void *theFirstHandler, const void *theSecondHandler) -{ - GSUdpMsgHandler *msgHandler1 = (GSUdpMsgHandler *)theFirstHandler, - *msgHandler2 = (GSUdpMsgHandler *)theSecondHandler; - int initCmp; - initCmp = memcmp(msgHandler1->mInitialMsg, msgHandler2->mInitialMsg, GS_UDP_MSG_HEADER_LEN); - return initCmp; - -} - -// Used to find a message handler based on the header. -int gsUdpMsgHandlerCompare2(const void *theFirstHandler, const void *theSecondHandler) -{ - GSUdpMsgHandler *msgHandler1 = (GSUdpMsgHandler *)theFirstHandler, - *msgHandler2 = (GSUdpMsgHandler *)theSecondHandler; - int headerCmp; - headerCmp = memcmp(msgHandler1->mHeader, msgHandler2->mHeader, GS_UDP_MSG_HEADER_LEN); - return headerCmp; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Remote Peer DArray compare functions - -// Finds a remote peer based on IP and Port -int gsUdpRemotePeerCompare(const void *theFirstPeer, const void *theSecondPeer) -{ - GSUdpRemotePeer *aPeer1 = (GSUdpRemotePeer *)theFirstPeer, - *aPeer2 = (GSUdpRemotePeer *)theSecondPeer; - if (aPeer1->mAddr != aPeer2->mAddr) - return 1; - if (aPeer1->mPort != aPeer2->mPort) - return 1; - - return 0; -} - -// Finds a remote peer based on a GT2Connection -int gsUdpRemotePeerCompare2(const void *theFirstPeer, const void *theSecondPeer) -{ - GSUdpRemotePeer *aPeer1 = (GSUdpRemotePeer *)theFirstPeer, - *aPeer2 = (GSUdpRemotePeer *)theSecondPeer; - if (aPeer1->mConnection != aPeer2->mConnection) - return 1; - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Lets the Message Handler and App know about network errors -void gsUdpSocketError(GT2Socket theSocket) -{ - int i, len; - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Socket error, passing to app and message handlers\n"); - if (aUdp->mAppNetworkError) - aUdp->mAppNetworkError(GS_UDP_NETWORK_ERROR, aUdp->mAppUserData); - len = ArrayLength(aUdp->mMsgHandlers); - for (i = 0; i < len; i++) - { - GSUdpMsgHandler *aMsgHandler = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, i); - if (aMsgHandler->mNetworkError) - aMsgHandler->mNetworkError(GS_UDP_NETWORK_ERROR, aMsgHandler->mUserData); - } - GSI_UNUSED(theSocket); -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Lets the App and Message Handlers know a peer left -void gsUdpClosedRoutingCB(GT2Connection theConnection, GT2CloseReason reason) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GSUdpRemotePeer aRemotePeer; - int index, len; - GSUdpCloseReason aReason; - char anAddr[GS_IP_ADDR_AND_PORT]; - - if (reason == GT2CommunicationError || reason == GT2SocketError) - aReason = GS_UDP_CLOSED_BY_COMM_ERROR; - else if (reason == GT2NotEnoughMemory) - aReason = GS_UDP_CLOSED_BY_LOW_MEM; - else - aReason = (GSUdpCloseReason)reason; - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connection closed to %s\n", gt2AddressToString(gt2GetRemoteIP(theConnection), - gt2GetRemotePort(theConnection), anAddr)); - len = ArrayLength(aUdp->mMsgHandlers); - for (index = 0; index < len; index++) - { - GSUdpMsgHandler *aHandler = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, index); - if (aHandler->mClosed) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connection closed: passed to message handler\n"); - aHandler->mClosed(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), aReason, aHandler->mUserData); - } - } - - if (aUdp->mAppClosed) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connection closed: passed to app\n"); - aUdp->mAppClosed(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), aReason, aUdp->mAppUserData); - } - - aRemotePeer.mConnection = theConnection; - index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare2, 0, 0); - if (index != NOT_FOUND) - { - ArrayDeleteAt(aUdp->mRemotePeers, index); - } - GSI_UNUSED(anAddr); -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// When a peer has accepted a GT2Connection the UDP layer needs to let -// higher level app or message handler know that it accepted the request to -// to message a peer. -void gsUdpConnectedRoutingCB(GT2Connection theConnection, GT2Result theResult, GT2Byte *theMessage, - int theMessageLen) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - int aIndex, len; - GSUdpErrorCode aCode; - char anAddr[GS_IP_ADDR_AND_PORT]; - - switch(theResult) - { - case GT2NegotiationError: - aCode = GS_UDP_REMOTE_ERROR; - break; - case GT2Rejected: - aCode = GS_UDP_REJECTED; - break; - case GT2TimedOut: - aCode = GS_UDP_TIMED_OUT; - break; - case GT2Success: - aCode = GS_UDP_NO_ERROR; - break; - default: - aCode = GS_UDP_UNKNOWN_ERROR; - break; - } - if (theResult == GT2Rejected) - { - int aRemotePeerIdx; - GSUdpRemotePeer aRemotePeer; - aRemotePeer.mAddr = gt2GetRemoteIP(theConnection); - aRemotePeer.mPort = gt2GetRemotePort(theConnection); - aRemotePeerIdx = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (aRemotePeerIdx != NOT_FOUND) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connect rejected by %s\n", gt2AddressToString(gt2GetRemoteIP(theConnection), - gt2GetRemotePort(theConnection), anAddr)); - - ArrayDeleteAt(aUdp->mRemotePeers, aRemotePeerIdx); - } - } - - len = ArrayLength(aUdp->mMsgHandlers); - for (aIndex = 0; aIndex < len; aIndex++) - { - int aRemotePeerIdx; - GSUdpRemotePeer aRemotePeer; - GSUdpMsgHandler *aTempHandler = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, aIndex); - - aRemotePeer.mAddr = gt2GetRemoteIP(theConnection); - aRemotePeer.mPort = gt2GetRemotePort(theConnection); - aRemotePeerIdx = ArraySearch(aTempHandler->mPendingConnections, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (aRemotePeerIdx != NOT_FOUND) - { - if (aTempHandler->mConnected) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Passing connect result to message handler\n"); - aTempHandler->mConnected(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), - aCode, theResult == GT2Rejected ? gsi_true : gsi_false, aTempHandler->mUserData); - } - ArrayDeleteAt(aTempHandler->mPendingConnections, aRemotePeerIdx); - return; - } - } - - if (aUdp->mAppPendingConnections > 0) - { - if (aUdp->mAppConnected) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Passing connect result to app\n"); - aUdp->mAppConnected(gt2GetRemoteIP(theConnection),gt2GetRemotePort(theConnection), - aCode, theResult == GT2Rejected ? gsi_true : gsi_false, aUdp->mAppUserData); - } - aUdp->mAppPendingConnections--; - } - GSI_UNUSED(theMessage); - GSI_UNUSED(theMessageLen); - GSI_UNUSED(anAddr); -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Pings are passed on to higher level app or message handlers -void gsUdpPingRoutingCB(GT2Connection theConnection, int theLatency) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - int index, len; - char anAddr[GS_IP_ADDR_AND_PORT]; - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Received ping from %s\n", gt2AddressToString(gt2GetRemoteIP(theConnection), - gt2GetRemotePort(theConnection), anAddr)); - len = ArrayLength(aUdp->mMsgHandlers); - for (index = 0; index < len; index++) - { - GSUdpMsgHandler *aHandler = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, index); - if (aHandler->mPingReply) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Passed to message handler\n"); - aHandler->mPingReply(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), (unsigned int)theLatency, aHandler->mUserData); - return; - } - } - - if (aUdp->mAppPingReply) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Passed to app\n"); - aUdp->mAppPingReply(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), (unsigned int)theLatency, aUdp->mAppUserData); - } - GSI_UNUSED(anAddr); -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Any data received prompts the UDP layer to first find a higher level -// message handler to handle the data. If there was no message handler -// found, the data is passed to the higher level app. -void gsUdpReceivedRoutingCB(GT2Connection theConnection, GT2Byte *theMessage, int theMessageLen, - GT2Bool reliable) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GSUdpMsgHandler aHandler; - int index; - char anAddr[GS_IP_ADDR_AND_PORT]; - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Received data from %s\n", gt2AddressToString(gt2GetRemoteIP(theConnection), - gt2GetRemotePort(theConnection), anAddr)); - //If there is a handler, pass it to the handler - //The header should not be stripped off - if (theMessageLen >= GS_UDP_MSG_HEADER_LEN) - { - memcpy(aHandler.mHeader, theMessage, GS_UDP_MSG_HEADER_LEN); - - index = ArraySearch(aUdp->mMsgHandlers, &aHandler, gsUdpMsgHandlerCompare2, 0, 0); - if (index != NOT_FOUND) - { - GSUdpMsgHandler *aHandlerFound = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, index); - if (aHandlerFound->mReceived) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Passed to message handler\n"); - aHandlerFound->mReceived(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), - theMessage + GS_UDP_MSG_HEADER_LEN, (unsigned int)(theMessageLen - GS_UDP_MSG_HEADER_LEN), reliable, aHandlerFound->mUserData); - return; - } - } - } - - if (aUdp->mAppRecvData) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Passed to app\n"); - aUdp->mAppRecvData(gt2GetRemoteIP(theConnection), gt2GetRemotePort(theConnection), theMessage, (unsigned int)theMessageLen, reliable, - aUdp->mAppUserData); - } - GSI_UNUSED(anAddr); -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Messages that are not recognized are passed only to the higher level app -// since message handlers always request to talk to peers -GT2Bool gsUdpUnrecognizedMsgCB(GT2Socket theSocket, unsigned int theIp, unsigned short thePort, GT2Byte * theMessage, - int theMsgLen) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - char anAddr[GS_IP_ADDR_AND_PORT]; - if (aUdp->mAppUnknownMessage) - { - gsi_bool aRet; - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Unknown message from %s, passing to app\n", gt2AddressToString(theIp, thePort, anAddr)); - aRet = aUdp->mAppUnknownMessage(theIp, thePort, (unsigned char *)theMessage, (unsigned int)theMsgLen, aUdp->mAppUserData); - return aRet ? GT2True : GT2False; - } - - GSI_UNUSED(theSocket); - GSI_UNUSED(anAddr); - return GT2False; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Requests for communication from a peer is handled by first checking if the -// initial message has a message handler registered for it. Otherwise -// the message is passed onto the app. -void gsUdpConnAttemptCB(GT2Socket socket, GT2Connection connection, unsigned int ip, - unsigned short port, int latency, GT2Byte * message, int len) -{ - // Get the message handler for the connection - int index; - GSUdpMsgHandler aHandler; - GSUdpRemotePeer aRemotePeer; - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - char anAddr[GS_IP_ADDR_AND_PORT]; - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connection attempt from %s\n", gt2AddressToString(ip, port, anAddr)); - //If there is a handler, automatically accept a connection if the initial message is - //the same as the handler's registered initial message - if (len >= GS_UDP_MSG_HEADER_LEN) - { - memcpy(aHandler.mInitialMsg, message, GS_UDP_MSG_HEADER_LEN); - - aRemotePeer.mAddr = ip; - aRemotePeer.mPort = port; - aRemotePeer.mConnection = connection; - - ArrayAppend(aUdp->mRemotePeers, &aRemotePeer); - index = ArraySearch(aUdp->mMsgHandlers, &aHandler, gsUdpMsgHandlerCompare, 0, 0); - if (index != NOT_FOUND) - { - GT2ConnectionCallbacks aCallbacks; - - aCallbacks.closed = gsUdpClosedRoutingCB; - aCallbacks.connected = gsUdpConnectedRoutingCB; - aCallbacks.ping = gsUdpPingRoutingCB; - aCallbacks.received = gsUdpReceivedRoutingCB; - - - // Automatically accept connections for Message Handlers - gt2Accept(aRemotePeer.mConnection, &aCallbacks); - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connection attempt auto-accepted for message handler\n"); - return; - } - } - // all other messages go to the app - if (aUdp->mAppConnAttempt) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "[Udp Engine] Connection attempt from %s, asking app to accept/reject\n", gt2AddressToString(ip, port, anAddr)); - aUdp->mAppConnAttempt(ip, port, latency, (unsigned char *)message, (unsigned int)len, aUdp->mAppUserData); - } - else - { - // Reject any un-handled connections or unknown connections - gt2Reject(connection, NULL, 0); - ArrayRemoveAt(aUdp->mRemotePeers, ArrayLength(aUdp->mRemotePeers) -1); - } - GSI_UNUSED(socket); - GSI_UNUSED(anAddr); -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Public functions - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Used to check if the UDP layer needs to be initialized -gsi_bool gsUdpEngineIsInitialized() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - return aUdp->mInitialized; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Initializes the UDP layer -// A specific port can be used if needed. -// An app must register their callbacks here. -// An App must also call this before starting SDKs since they might start -// the UDP layer without the app having a chance to register its callbacks. -// Any message handler can get the port the UDP layer is using if it did not -// initialize the UDP Layer. -// Use of the UDP Layer requires it to be initialized as is the case with most -// functions below. -GSUdpErrorCode gsUdpEngineInitialize(unsigned short thePort, int theIncomingBufSize, - int theOutgoingBufSize, gsUdpErrorCallback theAppNetworkError, - gsUdpConnConnectedCallback theAppConnected, - gsUdpConnClosedCallback theAppClosed, - gsUdpConnPingCallback theAppPing, - gsUdpConnReceivedDataCallback theAppReceive, - gsUdpUnknownMsgCallback theAppUnownMsg, - gsUdpAppConnectAttemptCallback theAppConnectAttempt, - void *theAppUserData) -{ - int incomingBufferSize, - outgoingBufferSize; - char anAddr[GS_IP_ADDR_AND_PORT]; - GT2Result aGt2Result; - // Grab the single instance of the UDP Communication Engine - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - // Setup our gt2 buffer sizes for reliable messages - - incomingBufferSize = theIncomingBufSize != 0 ? theIncomingBufSize : GS_UDP_DEFAULT_IN_BUFFSIZE; - outgoingBufferSize = theOutgoingBufSize != 0 ? theOutgoingBufSize : GS_UDP_DEFAULT_OUT_BUFFSIZE; - - // Setup our internal socket that will be shared among more than one application - aUdp->mAppNetworkError = theAppNetworkError; - aUdp->mAppUnknownMessage = theAppUnownMsg; - aUdp->mAppConnected = theAppConnected; - aUdp->mAppClosed = theAppClosed; - aUdp->mAppPingReply = theAppPing; - aUdp->mAppRecvData = theAppReceive; - aUdp->mAppConnAttempt = theAppConnectAttempt; - - // Any port can be used - gt2AddressToString(0, thePort, anAddr); - aGt2Result = gt2CreateSocket(&aUdp->mSocket, anAddr, outgoingBufferSize, incomingBufferSize, - gsUdpSocketError); - if (aGt2Result != GT2Success) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_WarmError, - "[Udp Engine] error creating gt2 socket, error code: %d\n", aGt2Result); - return GS_UDP_NETWORK_ERROR; - } - // We'll need to keep track of connections with an array of GPconnection to address mapping - aUdp->mRemotePeers = ArrayNew(sizeof(GSUdpRemotePeer), 1, NULL); - if (aUdp->mRemotePeers == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "[Udp Engine] No more memory!!!\n"); - return GS_UDP_NO_MEMORY; - } - - aUdp->mMsgHandlers = ArrayNew(sizeof(GSUdpMsgHandler), 1, gsUdpMsgHandlerFree); - if (aUdp->mMsgHandlers == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "[Udp Engine] No more memory!!!\n"); - return GS_UDP_NO_MEMORY; - } - - // Used by the manager to receive messages from backend services or other clients - // that may not be using gt2 - gt2SetUnrecognizedMessageCallback(aUdp->mSocket, gsUdpUnrecognizedMsgCB); - - // Automatically start listening for all SDKS and the game if game uses UDP Engine - gt2Listen(aUdp->mSocket, gsUdpConnAttemptCB); - aUdp->mLocalAddr = gt2GetLocalIP(aUdp->mSocket); - aUdp->mLocalPort = gt2GetLocalPort(aUdp->mSocket); - aUdp->mAppPendingConnections = 0; - aUdp->mInitialized = gsi_true; - if (theAppUserData) - { - aUdp->mAppUserData = theAppUserData; - } - else - aUdp->mAppUserData = NULL; - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Used obtain the peer's state -// theIp and thePort cannot be 0 (Zero) -GSUdpErrorCode gsUdpEngineGetPeerState(unsigned int theIp, unsigned short thePort, GSUdpPeerState *thePeerState) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GSUdpRemotePeer aPeer, *aPeerFound; - int index; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theIp); - GS_ASSERT(thePort); - GS_ASSERT(thePeerState != NULL); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_State, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - *thePeerState = GS_UDP_PEER_CLOSED; - return GS_UDP_NOT_INITIALIZED; - } - - aPeer.mAddr = theIp; - aPeer.mPort = thePort; - index = ArraySearch(aUdp->mRemotePeers, &aPeer, gsUdpRemotePeerCompare, 0, 0); - if (index == NOT_FOUND) - { - *thePeerState = GS_UDP_PEER_CLOSED; - return GS_UDP_NO_ERROR; - } - - aPeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index); - - *thePeerState = (GSUdpPeerState)gt2GetConnectionState(aPeerFound->mConnection); - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// theIp and thePort cannot be 0 (Zero) -// Starts a request to open a communication channel with another peer based on -// IP and port. -GSUdpErrorCode gsUdpEngineStartTalkingToPeer(unsigned int theIp, unsigned short thePort, - char theInitMsg[GS_UDP_MSG_HEADER_LEN], int timeOut) -{ - char anAddr[GS_IP_ADDR_AND_PORT]; - GSUdpRemotePeer aRemotePeer; - GSUdpMsgHandler aHandler; - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GT2ConnectionCallbacks aCallbacks; - int index; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theIp); - GS_ASSERT(thePort); - - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - - if (theIp == 0 || thePort == 0) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Invalid parameter(s), check ip, port"); - return GS_UDP_PARAMETER_ERROR; - } - - aRemotePeer.mAddr = theIp; // In Network Byte Order for GT2 - aRemotePeer.mPort = thePort; // In Host Byte Order for GT2 - - index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (index != NOT_FOUND) - { - GSUdpRemotePeer *aPeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index); - GT2ConnectionState aState = gt2GetConnectionState(aPeerFound->mConnection); - if (aState == GT2Connected) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine is already talking to remote address\n"); - return GS_UDP_ADDRESS_ALREADY_IN_USE; - } - else if (aState == GT2Connecting) - { - memcpy(aHandler.mInitialMsg, theInitMsg, GS_UDP_MSG_HEADER_LEN); - - index = ArraySearch(aUdp->mMsgHandlers, &aHandler, gsUdpMsgHandlerCompare, 0, 0); - if (index != NOT_FOUND) - { - GSUdpMsgHandler *aHandlerFound = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, index); - ArrayAppend(aHandlerFound->mPendingConnections, aPeerFound); - } - } - } - else - { - gt2AddressToString(theIp, thePort, anAddr); - aCallbacks.closed = gsUdpClosedRoutingCB; - aCallbacks.connected = gsUdpConnectedRoutingCB; - aCallbacks.ping = gsUdpPingRoutingCB; - aCallbacks.received = gsUdpReceivedRoutingCB; - - // start the connect without blocking since we want the engine to be as asynchronous as possible - gt2Connect(aUdp->mSocket, &aRemotePeer.mConnection, anAddr, (unsigned char *)theInitMsg, GS_UDP_MSG_HEADER_LEN, timeOut, &aCallbacks, GT2False); - - ArrayAppend(aUdp->mRemotePeers, &aRemotePeer); - - memcpy(aHandler.mInitialMsg, theInitMsg, GS_UDP_MSG_HEADER_LEN); - - index = ArraySearch(aUdp->mMsgHandlers, &aHandler, gsUdpMsgHandlerCompare, 0, 0); - if (index != NOT_FOUND) - { - GSUdpRemotePeer *aRemotePeerPtr = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, ArrayLength(aUdp->mRemotePeers) - 1); - GSUdpMsgHandler *aHandlerFound = (GSUdpMsgHandler *)ArrayNth(aUdp->mMsgHandlers, index); - ArrayAppend(aHandlerFound->mPendingConnections, &aRemotePeerPtr); - } - else - { - aUdp->mAppPendingConnections++; - } - } - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// theIp and thePort cannot be 0 (Zero) -// Accepts a Peer's request for communication -// Should only be used by App -GSUdpErrorCode gsUdpEngineAcceptPeer(unsigned int theIp, unsigned short thePort) -{ - GSUdpRemotePeer aRemotePeer; - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - int index; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theIp); - GS_ASSERT(thePort); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - - if (theIp == 0 || thePort == 0) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Invalid parameter(s), check ip, port\n"); - return GS_UDP_PARAMETER_ERROR; - } - - aRemotePeer.mAddr = theIp; - aRemotePeer.mPort = thePort; - index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (index != NOT_FOUND) - { - GT2ConnectionCallbacks aCallbacks; - - GSUdpRemotePeer *aPeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index); - - aCallbacks.closed = gsUdpClosedRoutingCB; - aCallbacks.connected = gsUdpConnectedRoutingCB; - aCallbacks.ping = gsUdpPingRoutingCB; - aCallbacks.received = gsUdpReceivedRoutingCB; - - gt2Accept(aPeerFound->mConnection, &aCallbacks); - } - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// theIp and thePort cannot be 0 (Zero) -// Rejects a Peer's request for communication -// Should only be used by App -GSUdpErrorCode gsUdpEngineRejectPeer(unsigned int theIp, unsigned short thePort) -{ - GSUdpRemotePeer aRemotePeer; - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - int index; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theIp); - GS_ASSERT(thePort); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - - if (theIp == 0 || thePort == 0) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Invalid parameter(s), check ip, port\n"); - return GS_UDP_PARAMETER_ERROR; - } - - // Find the connection to reject in our array of peers - aRemotePeer.mAddr = theIp; - aRemotePeer.mPort = thePort; - index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (index != NOT_FOUND) - { - GSUdpRemotePeer *aPeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index); - gt2Reject(aPeerFound->mConnection, NULL, 0); - ArrayDeleteAt(aUdp->mRemotePeers, index); - } - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Sends a message to a peer using IP and Port -// An empty header constitutes the app sending this message. -// theIp and thePort cannot be 0 (Zero) -// -// WARNING: Messages should not be greater than the outgoing buffer size minus the header -// and the 7 byte header for reliable messages (used for internal gt2 operations). Most -// UDP fragmentation occurs if messages are bigger than 1500 bytes. Also, some routers are -// known to drop those packets that are larger than 1500 bytes. The recommended outgoing -// buffer size is the default (1460). So take that, and subtract 16 for message handler header -// and reliable message header (if sending data reliably). -// freeSpace = 1460 - 16 - 7 -GSUdpErrorCode gsUdpEngineSendMessage(unsigned int theIp, unsigned short thePort, - char theHeader[GS_UDP_MSG_HEADER_LEN], unsigned char *theMsg, - unsigned int theMsgLen, gsi_bool theReliable) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - int aTotalMessageLen, index; - GSUdpRemotePeer aRemotePeer, *aRemotePeerFound; - GT2Byte *fullMessage; - GT2Result aResult; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theIp); - GS_ASSERT(thePort); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - - // Messages being sent with an empty header are treated as app messages - if (!theHeader[0]) - aTotalMessageLen = (int)theMsgLen; - else - aTotalMessageLen = (int)(GS_UDP_MSG_HEADER_LEN + theMsgLen); - - aRemotePeer.mAddr = theIp; - aRemotePeer.mPort = thePort; - - index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (index == NOT_FOUND) - { - char anAddr[GS_IP_ADDR_AND_PORT]; - gt2AddressToString(theIp, thePort, anAddr); - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_WarmError, - "[Udp Engine] address not found for sending message\n", anAddr); - return GS_UDP_ADDRESS_ERROR; - } - else - { - aRemotePeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index); - } - - if (aTotalMessageLen > gt2GetOutgoingBufferSize(aRemotePeerFound->mConnection) && theReliable) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_WarmError, - "[Udp Engine] Message Size too large, dropping message\n"); - return GS_UDP_MSG_TOO_BIG; - } - - fullMessage = (GT2Byte *)gsimalloc((unsigned long)aTotalMessageLen); - memcpy(fullMessage, theHeader, GS_UDP_MSG_HEADER_LEN); - memcpy(fullMessage + GS_UDP_MSG_HEADER_LEN, theMsg, theMsgLen); - // Send the message - // reliable messages will be kept in the outgoing buffers till they are sent - aResult = gt2Send(aRemotePeerFound->mConnection, fullMessage, aTotalMessageLen, theReliable); - gsifree(fullMessage); - - if (aResult != GT2Success) - return GS_UDP_SEND_FAILED; - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// One the UDP Layer is initialized, this function -// should be called every 10-100 ms -// Message handlers already call this which means -// that the app may not have to call this function -GSUdpErrorCode gsUdpEngineThink() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - gt2Think(aUdp->mSocket); - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Shutdown should only happen if following is met: -// Apps can call this function after they have shutdown message handlers (SDKs), -// and verified there are no message handlers remaining. Calling the function -// gsUdpEngineNoMoreMsgHandlers will do this. -// Message handlers cannot call this function without checking if there no more -// message handlers remaining and if there is no app (gsUdpEngineNoApp). -GSUdpErrorCode gsUdpEngineShutdown() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - gt2CloseSocket(aUdp->mSocket); - ArrayFree(aUdp->mMsgHandlers); - ArrayFree(aUdp->mRemotePeers); - aUdp->mInitialized = gsi_false; - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Obtains the lower level socket that can be used to perform other operations -// or pass to other SDKs. -SOCKET gsUdpEngineGetSocket() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_HotError, - "[Udp Engine] Engine not initialized\n"); - return INVALID_SOCKET; - } - - return gt2GetSocketSOCKET(aUdp->mSocket); -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Gets the local IP the UDP layer is bound to. -unsigned int gsUdpEngineGetLocalAddr() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_HotError, - "[Udp Engine] Engine not initialized\n"); - return (unsigned int)-1; - } - return aUdp->mLocalAddr; - -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Gets the local port the UDP layer is bound to. -unsigned short gsUdpEngineGetLocalPort() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_HotError, - "[Udp Engine] Engine not initialized\n"); - return 0; - } - return aUdp->mLocalPort; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Message handlers are added using this function -// The initial message and header of a message handler cannot be empty -// However, they can be the same. -// User data can be useful for keeping track of Message Handler -GSUdpErrorCode gsUdpEngineAddMsgHandler(char theInitMsg[GS_UDP_MSG_HEADER_LEN], char theHeader[GS_UDP_MSG_HEADER_LEN], - gsUdpErrorCallback theMsgHandlerError, - gsUdpConnConnectedCallback theMsgHandlerConnected, - gsUdpConnClosedCallback theMsgHandlerClosed, - gsUdpConnPingCallback theMsgHandlerPing, - gsUdpConnReceivedDataCallback theMsgHandlerRecv, - void *theUserData) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GSUdpMsgHandler aMsgHandler; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theInitMsg || theInitMsg[0]); - GS_ASSERT(theHeader || theHeader[0]); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - - // setup a message handler that the UDP engine will use to pass connection attempts to - - //check for valid input - if (!theInitMsg[0]) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Invalid init message\n"); - return GS_UDP_PARAMETER_ERROR; - } - - if (!theHeader[0]) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Invalid header\n"); - return GS_UDP_PARAMETER_ERROR; - } - - // This check is not necessary. Some SDKs may not use all callbacks - /*if (!theMsgHandlerError || !theMsgHandlerConnected || !theMsgHandlerClosed - || !theMsgHandlerPing || !theMsgHandlerRecv) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Invalid callback(s)"); - return GS_UDP_PARAMETER_ERROR; - } - */ - aMsgHandler.mClosed = theMsgHandlerClosed; - aMsgHandler.mConnected = theMsgHandlerConnected; - aMsgHandler.mPingReply = theMsgHandlerPing; - aMsgHandler.mReceived = theMsgHandlerRecv; - - aMsgHandler.mNetworkError = theMsgHandlerError; - - memcpy(aMsgHandler.mInitialMsg, theInitMsg, GS_UDP_MSG_HEADER_LEN); - memcpy(aMsgHandler.mHeader, theHeader, GS_UDP_MSG_HEADER_LEN); - - aMsgHandler.mPendingConnections = ArrayNew(sizeof(GSUdpRemotePeer *), 1, NULL); - if (aMsgHandler.mPendingConnections == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "[Udp Engine] No more memory!!!\n"); - return GS_UDP_NO_MEMORY; - } - aMsgHandler.mUserData = theUserData; - ArrayAppend(aUdp->mMsgHandlers, &aMsgHandler); - - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// When a message handler is done or shutting down, the message handler should remove -// itself from the UDP Layer -// The header cannot be empty -GSUdpErrorCode gsUdpEngineRemoveMsgHandler(char theHeader[GS_UDP_MSG_HEADER_LEN]) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GSUdpMsgHandler aHandler; - int index; - - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theHeader); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return GS_UDP_NETWORK_ERROR; - } - - if (!theHeader || !theHeader[0]) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] invalid or empty header\n"); - return GS_UDP_PARAMETER_ERROR; - } - - memcpy(aHandler.mHeader, theHeader, GS_UDP_MSG_HEADER_LEN); - - index = ArraySearch(aUdp->mMsgHandlers, &aHandler, gsUdpMsgHandlerCompare2, 0, 0); - if (index != NOT_FOUND) - { - ArrayDeleteAt(aUdp->mMsgHandlers, index); - } - return GS_UDP_NO_ERROR; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// Checks to see if there any remaining message handlers. -// returns gsi_false if there are none. -gsi_bool gsUdpEngineNoMoreMsgHandlers() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return gsi_true; - } - - return ArrayLength(aUdp->mMsgHandlers) == 0 ? gsi_true : gsi_false; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// returns gsi_false if there is no app using the UDP Layer -gsi_bool gsUdpEngineNoApp() -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - - GS_ASSERT(aUdp->mInitialized); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return gsi_true; - } - - if (aUdp->mAppClosed || aUdp->mAppConnAttempt || aUdp->mAppConnected || aUdp->mAppNetworkError - || aUdp->mAppPingReply || aUdp->mAppRecvData || aUdp->mAppUnknownMessage) - { - return gsi_false; - } - - return gsi_true; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Layer must be initialized -// theIp and thePort cannot be 0 (Zero) -// Based on an IP and port, the function will return the amount of free space -// of a peer's buffer. -int gsUdpEngineGetPeerOutBufferFreeSpace(unsigned int theIp, unsigned short thePort) -{ - GSUdpEngineObject *aUdp = gsUdpEngineGetEngine(); - GSUdpRemotePeer aRemotePeer, *aRemotePeerFound; - int index; - GS_ASSERT(aUdp->mInitialized); - GS_ASSERT(theIp); - GS_ASSERT(thePort); - if (!aUdp->mInitialized) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Debug, - "[Udp Engine] Engine not initialized\n"); - return 0; - } - - aRemotePeer.mAddr = theIp; - aRemotePeer.mPort = thePort; - index = ArraySearch(aUdp->mRemotePeers, &aRemotePeer, gsUdpRemotePeerCompare, 0, 0); - if (index != NOT_FOUND) - { - aRemotePeerFound = (GSUdpRemotePeer *)ArrayNth(aUdp->mRemotePeers, index); - return gt2GetOutgoingBufferFreeSpace(aRemotePeerFound->mConnection); - } - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Creates a string address given an IP and port -// IP and port can be 0. -void gsUdpEngineAddrToString(unsigned int theIp, unsigned short thePort, char addrstring[GS_IP_ADDR_AND_PORT]) -{ - gt2AddressToString(theIp, thePort, addrstring); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsUdpEngine.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsUdpEngine.h deleted file mode 100644 index 07c2b09e795..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsUdpEngine.h +++ /dev/null @@ -1,180 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -#ifndef __GS_UDP_ENGINE_H__ -#define __GS_UDP_ENGINE_H__ - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// UDP Communication Engine -// -#include "gsCommon.h" -#include "../gt2/gt2.h" -#include "../darray.h" - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Constants - -// The UDP Engine should try the MSS (Maximum Segment Size = IP Packet size - IP Header) -// as a default size to keep the packets from being fragmented. Currently 1460 is the -// MSS for windows. Consoles may have a different size. -#define GS_UDP_DEFAULT_OUT_BUFFSIZE 1460 -#define GS_UDP_DEFAULT_IN_BUFFSIZE 1500 - -// a default size for address strings -#define GS_IP_ADDR_AND_PORT 22 - -// A fixed header len. unless we require a bigger size, it will stay this size. -// These need to be used for calculating the free space available on -// the outgoing buffers for an IP and Port which represent the peer. -#define GS_UDP_MSG_HEADER_LEN 16 -#define GS_UDP_RELIABLE_MSG_HEADER 7 - -// The following error codes will be given back to the higher level app -// or message handler. -typedef enum _GSUdpErrorCode -{ - GS_UDP_NO_ERROR, - GS_UDP_NO_MEMORY, - GS_UDP_REJECTED, - GS_UDP_NETWORK_ERROR, - GS_UDP_ADDRESS_ERROR, - GS_UDP_ADDRESS_ALREADY_IN_USE, - GS_UDP_TIMED_OUT, - GS_UDP_REMOTE_ERROR, - GS_UDP_SEND_FAILED, - GS_UDP_INVALID_MESSAGE, - GS_UDP_PARAMETER_ERROR, - GS_UDP_NOT_INITIALIZED, - GS_UDP_MSG_TOO_BIG, - GS_UDP_UNKNOWN_ERROR, - // Add new errors before here - GS_UDP_NUM_ERROR_CODES -} GSUdpErrorCode; - -// Used so that an app or message handler does -// not need to request to start talking to a peer twice -// Also lets higher level app or message handlers know about -// if a communication channel to a peer has been broken. -typedef enum _GSUdpPeerState -{ - GS_UDP_PEER_CONNECTING, - GS_UDP_PEER_CONNECTED, - GS_UDP_PEER_CLOSING, - GS_UDP_PEER_CLOSED, - // Add new connection state before here - GS_UDP_PEER_STATE_NUM -} GSUdpPeerState; - -// When a communication channel to a peer is closed -// the closed callback will let us know why it was closed -typedef enum _GSUdpCloseReason -{ - GS_UDP_CLOSED_LOCALLY, - GS_UDP_CLOSED_REMOTELY, - // errors: - GS_UDP_CLOSED_BY_COMM_ERROR, // An invalid message was received (it was either unexpected or wrongly formatted). - GS_UDP_CLOSED_BY_LOW_MEM, - // Add new reasons before here - GS_UDP_CLOSED_NUM -} GSUdpCloseReason; - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Callbacks - -// Errors to give higher layers feedback -typedef void (*gsUdpErrorCallback)(GSUdpErrorCode theCode, void *theUserData); - - -// app Request attempt callback used to tell registered listeners about connection attempts -typedef void (*gsUdpAppConnectAttemptCallback)(unsigned int theIp, unsigned short thePort, - int theLatency, unsigned char *theInitMsg, - unsigned int theInitMsgLen, void *theUserData); - - -// peer communication channel callback types -typedef void (*gsUdpConnClosedCallback)(unsigned int ip, unsigned short port, GSUdpCloseReason reason, - void *theUserData); -typedef void (*gsUdpConnReceivedDataCallback)(unsigned int ip, unsigned short port, - unsigned char *message, unsigned int messageLength, - gsi_bool reliable, void *theUserData); -typedef void (*gsUdpConnConnectedCallback)(unsigned int ip, unsigned short port, - GSUdpErrorCode error, gsi_bool rejected, - void *theUserData); -typedef void (*gsUdpConnPingCallback)(unsigned int ip, unsigned short port, unsigned int latency, - void *theUserData); - - -// Messages that cannot be interpreted are passed on to the higher level app -typedef gsi_bool (*gsUdpUnknownMsgCallback)(unsigned int ip, unsigned short port, - unsigned char *message, unsigned int messageLength, - void *theUserData); - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Public Functionality -// Initialization and test functions -gsi_bool gsUdpEngineIsInitialized(); -GSUdpErrorCode gsUdpEngineInitialize(unsigned short thePort, int theIncomingBufSize, - int theOutgoingBufSize, gsUdpErrorCallback theAppNetworkError, - gsUdpConnConnectedCallback theAppConnected, - gsUdpConnClosedCallback theAppClosed, - gsUdpConnPingCallback theAppPing, - gsUdpConnReceivedDataCallback theAppReceive, - gsUdpUnknownMsgCallback theAppUnownMsg, - gsUdpAppConnectAttemptCallback theAppConnectAttempt, - void *theAppUserData); -// update and shutdown -GSUdpErrorCode gsUdpEngineThink(); -GSUdpErrorCode gsUdpEngineShutdown(); - -// Connectivity functions -GSUdpErrorCode gsUdpEngineGetPeerState(unsigned int theIp, unsigned short thePort, - GSUdpPeerState *thePeerState); -GSUdpErrorCode gsUdpEngineStartTalkingToPeer(unsigned int theIp, unsigned short thePort, - char theInitMsg[GS_UDP_MSG_HEADER_LEN], int timeOut); -GSUdpErrorCode gsUdpEngineAcceptPeer(unsigned int theIp, unsigned short thePort); -GSUdpErrorCode gsUdpEngineRejectPeer(unsigned int theIp, unsigned short thePort); - -// Sending functionality -// WARNING: Messages should not be greater than the outgoing buffer size minus the header -// and the 7 byte header for reliable messages (used for internal gt2 operations). Most -// UDP fragmentation occurs if messages are bigger than 1500 bytes. Also, some routers are -// known to drop those packets that are larger than 1500 bytes because of set MTU sizes. -// The recommended outgoing buffer size is the default (1460). So take that, and subtract -// 16 for message handler header and reliable message header (if sending data reliably). -// freeSpace = 1460 - 16 - 7 -GSUdpErrorCode gsUdpEngineSendMessage(unsigned int theIp, unsigned short thePort, - char theHeader[GS_UDP_MSG_HEADER_LEN], unsigned char *theMsg, - unsigned int theMsgLen, gsi_bool theReliable); - -// This function should be called for those parts of the code that want specific handling of messages -// Any call to send should include the header registered here. -GSUdpErrorCode gsUdpEngineAddMsgHandler(char theInitMsg[GS_UDP_MSG_HEADER_LEN], - char theHeader[GS_UDP_MSG_HEADER_LEN], - gsUdpErrorCallback theMsgHandlerError, - gsUdpConnConnectedCallback theMsgHandlerConnected, - gsUdpConnClosedCallback theMsgHandlerClosed, - gsUdpConnPingCallback theMsgHandlerPing, - gsUdpConnReceivedDataCallback theMsgHandlerRecv, - void *theUserData); -GSUdpErrorCode gsUdpEngineRemoveMsgHandler(char theHeader[GS_UDP_MSG_HEADER_LEN]); -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Public Utility functionality -SOCKET gsUdpEngineGetSocket(); -void gsUdpEngineAddrToString(unsigned int theIp, unsigned short thePort, - char addrstring[GS_IP_ADDR_AND_PORT]); -unsigned int gsUdpEngineGetLocalAddr(); -unsigned short gsUdpEngineGetLocalPort(); - -// lets the app or message handler know if it is able to shutdown the udp layer -gsi_bool gsUdpEngineNoMoreMsgHandlers(); -gsi_bool gsUdpEngineNoApp(); - -// check the remaining free space on the outgoing buffer for the peer based -// IP and port -int gsUdpEngineGetPeerOutBufferFreeSpace(unsigned int theIp, unsigned short thePort); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsXML.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsXML.c deleted file mode 100644 index 13a26f6cb2d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsXML.c +++ /dev/null @@ -1,2043 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "gsPlatform.h" -#include "gsMemory.h" -#include "gsXML.h" -#include "gsStringUtil.h" -#include "../darray.h" - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4267) //lines: 155, 156, 161, 162 -#pragma warning(disable: 4244) //lines: 128, 720, 752 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define GS_XML_INITIAL_ELEMENT_ARRAY_COUNT 32 -#define GS_XML_INITIAL_ATTRIBUTE_ARRAY_COUNT 16 - -#define GS_XML_WHITESPACE "\x20\x09\x0D\x0A" - -#define GS_XML_CHECK(a) { if (gsi_is_false(a)) return gsi_false; } - -#define GS_XML_BASE64_ENCODING_TYPE 0 - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define GS_XML_SOAP_BUFFER_INITIAL_SIZE (1 * 1024) -#define GS_XML_SOAP_BUFFER_INCREMENT_SIZE (1 * 1024) -#define GS_XML_SOAP_INITIAL_NAMESPACE_COUNT 6 - -#define GS_XML_SOAP_HEADER "" -#define GS_XML_SOAP_FOOTER "" -#define GS_XML_SOAP_NAMESPACE_PREFIX "xmlns:" - -#define GS_XML_SOAP_DEFAULT_NAMESPACE_COUNT 4 -const char * GS_XML_SOAP_DEFAULT_NAMESPACES[GS_XML_SOAP_DEFAULT_NAMESPACE_COUNT] = -{ - "SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"", - "SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"", - "xsi=\"http://www.w3.org/2001/XMLSchema-instance\"", - "xsd=\"http://www.w3.org/2001/XMLSchema\"" -}; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Warning: Do not store pointers to other GSXml* objects within a GSXml object -// Pointers to elements may be invalidate if the DArray's grow -// Instead, store the array index and require that indexes never change -typedef struct GSIXmlString -{ - const gsi_u8 * mData; - int mLen; -} GSIXmlString; - -typedef struct GSIXmlAttribute -{ - GSIXmlString mName; - GSIXmlString mValue; - - int mIndex; - int mParentIndex; -} GSIXmlAttribute; - -typedef struct GSIXmlElement -{ - GSIXmlString mName; - GSIXmlString mValue; // most do not have a value - - int mIndex; - int mParentIndex; -} GSIXmlElement; - -typedef struct GSIXmlStreamReader -{ - DArray mElementArray; - DArray mAttributeArray; - - int mElemReadIndex; // current index - int mValueReadIndex; // current child parsing index -} GSIXmlStreamReader; - -typedef struct GSIXmlStreamWriter -{ - char * mBuffer; - int mLen; - int mCapacity; - gsi_bool mClosed; // footer has been written, append not allowed -} GSIXmlStreamWriter; - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilSkipWhiteSpace(GSIXmlStreamReader * stream, const char * buffer, int len, int * pos); -static gsi_bool gsiXmlUtilParseName (GSIXmlStreamReader * stream, const char * buffer, int len, int * pos, GSIXmlString * strOut); -static gsi_bool gsiXmlUtilParseString (GSIXmlStreamReader * stream, char * buffer, int len, int * pos, GSIXmlString * strOut); -static gsi_bool gsiXmlUtilParseValue (GSIXmlStreamReader * stream, char * buffer, int len, int * pos, GSIXmlString * strOut); -static gsi_bool gsiXmlUtilParseElement (GSIXmlStreamReader * stream, char * buffer, int len, int * pos, int parentIndex); -static gsi_bool gsiXmlUtilTagMatches(const char * matchtag, GSIXmlString * xmlstr); - -// Note: Writes decoded form back into buffer -static gsi_bool gsiXmlUtilDecodeString(char * buffer, int * len); - -static void gsiXmlUtilElementFree(void * elem); -static void gsiXmlUtilAttributeFree(void * elem); - -static gsi_bool gsiXmlUtilWriteChar(GSIXmlStreamWriter * stream, char ch); -static gsi_bool gsiXmlUtilWriteString(GSIXmlStreamWriter * stream, const char * str); -static gsi_bool gsiXmlUtilWriteXmlSafeString(GSIXmlStreamWriter * stream, const char * str); -static gsi_bool gsiXmlUtilGrowBuffer(GSIXmlStreamWriter * stream); -#ifdef GSI_UNICODE -static gsi_bool gsiXmlUtilWriteAsciiString(GSIXmlStreamWriter * stream, const gsi_char * str); -#endif -static gsi_bool gsiXmlUtilWriteUnicodeString(GSIXmlStreamWriter * stream, const unsigned short * str); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static int gsUnicodeStringLen(const unsigned short * str) -{ - const unsigned short * end = str; - while(*end++) - {} - return (end - str - 1); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -GSXmlStreamWriter gsXmlCreateStreamWriter(const char ** namespaces, int count) -{ - GSIXmlStreamWriter * newStream = NULL; - int initialCapacity = GS_XML_SOAP_BUFFER_INCREMENT_SIZE; - int namespaceLen = 0; - int i=0; - - GS_ASSERT((namespaces == NULL && count == 0) || (namespaces != NULL && count != 0)); - - newStream = (GSIXmlStreamWriter*)gsimalloc(sizeof(GSIXmlStreamWriter)); - if (newStream == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "Out of memory in gsXmlCreateStreamWriter, needed %d bytes", sizeof(GSIXmlStreamWriter)); - return NULL; // OOM - } - - // do this to prevent an immediately reallocation due to long namespace string - for (i=0; i < GS_XML_SOAP_DEFAULT_NAMESPACE_COUNT; i++) - { - GS_ASSERT(GS_XML_SOAP_DEFAULT_NAMESPACES[i] != NULL); - namespaceLen += strlen(GS_XML_SOAP_NAMESPACE_PREFIX)+1; // +1 for space - namespaceLen += strlen(GS_XML_SOAP_DEFAULT_NAMESPACES[i]); - } - for (i=0; i < count; i++) - { - GS_ASSERT(namespaces[i] != NULL); - namespaceLen += strlen(GS_XML_SOAP_NAMESPACE_PREFIX)+1; // +1 for space - namespaceLen += strlen(namespaces[i]); - } - while (initialCapacity < namespaceLen) - initialCapacity += GS_XML_SOAP_BUFFER_INCREMENT_SIZE; - - // allocate write buffer - newStream->mBuffer = (char*)gsimalloc((size_t)initialCapacity); - if (newStream->mBuffer == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "Out of memory in gsXmlCreateStreamWriter, needed %d bytes", initialCapacity); - return NULL; // OOM - } - newStream->mCapacity = initialCapacity; - newStream->mLen = 0; - newStream->mBuffer[0] = '\0'; - newStream->mClosed = gsi_false; - - // write the XML header - if (gsi_is_false(gsiXmlUtilWriteString(newStream, GS_XML_SOAP_HEADER))) - { - gsifree(newStream->mBuffer); - gsifree(newStream); - return NULL; // OOM - } - for (i=0; i < GS_XML_SOAP_DEFAULT_NAMESPACE_COUNT; i++) - { - if (gsi_is_false(gsiXmlUtilWriteChar(newStream, ' ')) || - gsi_is_false(gsiXmlUtilWriteString(newStream, GS_XML_SOAP_NAMESPACE_PREFIX)) || - gsi_is_false(gsiXmlUtilWriteString(newStream, GS_XML_SOAP_DEFAULT_NAMESPACES[i]))) - { - gsifree(newStream->mBuffer); - gsifree(newStream); - return NULL; // OOM - } - } - for (i=0; i < count; i++) - { - if (gsi_is_false(gsiXmlUtilWriteChar(newStream, ' ')) || - gsi_is_false(gsiXmlUtilWriteString(newStream, GS_XML_SOAP_NAMESPACE_PREFIX)) || - gsi_is_false(gsiXmlUtilWriteString(newStream, namespaces[i])) ) - { - gsifree(newStream->mBuffer); - gsifree(newStream); - return NULL; // OOM - } - } - if (gsi_is_false(gsiXmlUtilWriteChar(newStream, '>')) || - gsi_is_false(gsiXmlUtilWriteString(newStream, GS_XML_SOAP_BODY_TAG)) ) - { - gsifree(newStream->mBuffer); - gsifree(newStream); - return NULL; // OOM - } - - return (GSXmlStreamWriter)newStream; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -GSXmlStreamReader gsXmlCreateStreamReader() -{ - GSIXmlStreamReader * newStream = NULL; - - newStream = (GSIXmlStreamReader*)gsimalloc(sizeof(GSIXmlStreamReader)); - if (newStream == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "Out of memory in gsXmlCreateStream, needed %d bytes", sizeof(GSIXmlStreamReader)); - return NULL; // OOM - } - - newStream->mElementArray = ArrayNew(sizeof(GSIXmlElement), GS_XML_INITIAL_ELEMENT_ARRAY_COUNT, gsiXmlUtilElementFree); - if (newStream->mElementArray == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "Out of memory in gsXmlCreateStream with mElementArray=ArrayNew()"); - gsifree(newStream); - return NULL; // OOM - } - - newStream->mAttributeArray = ArrayNew(sizeof(GSIXmlAttribute), GS_XML_INITIAL_ATTRIBUTE_ARRAY_COUNT, gsiXmlUtilAttributeFree); - if (newStream->mAttributeArray == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Memory, GSIDebugLevel_HotError, - "Out of memory in gsXmlCreateStream with mElementArray=ArrayNew()"); - ArrayFree(newStream->mElementArray); - gsifree(newStream); - return NULL; // OOM - } - - gsXmlMoveToStart(newStream); - return (GSXmlStreamReader)newStream; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlParseBuffer(GSXmlStreamReader stream, char * data, int len) -{ - GSIXmlStreamReader * reader; - int readPos = 0; - - GS_ASSERT(data != NULL); - GS_ASSERT(len > 0); - - reader = (GSIXmlStreamReader*)stream; - - gsXmlResetReader(stream); - - // Parse the root elements (automatically includes sub-elements) - while(readPos < len) - { - if (gsi_is_false(gsiXmlUtilParseElement(reader, data, len, &readPos, -1))) - return gsi_false; - } - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsXmlFreeWriter(GSXmlStreamWriter stream) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - gsifree(writer->mBuffer); - gsifree(writer); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsXmlFreeReader(GSXmlStreamReader stream) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - ArrayFree(reader->mAttributeArray); - ArrayFree(reader->mElementArray); - gsifree(reader); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsXmlResetReader(GSXmlStreamReader stream) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - ArrayClear(reader->mAttributeArray); - ArrayClear(reader->mElementArray); - gsXmlMoveToStart(stream); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlCloseWriter(GSXmlStreamWriter stream) -{ - GSIXmlStreamWriter* writer = (GSIXmlStreamWriter*)stream; - GS_ASSERT(stream != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - if (gsi_is_false(gsiXmlUtilWriteString(writer, GS_XML_SOAP_FOOTER))) - return gsi_false; - - writer->mClosed = gsi_true; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void gsiXmlUtilElementFree(void * elem) -{ - GSI_UNUSED(elem); - //GSXmlElement * dataPtr = (GSXmlElement*)elem; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void gsiXmlUtilAttributeFree(void * elem) -{ - GSI_UNUSED(elem); - //GSXmlAttribute * dataPtr = (GSXmlAttribute*)elem; - //gsifree(dataPtr); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -const char * gsXmlWriterGetData (GSXmlStreamWriter stream) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - GS_ASSERT(stream != NULL) - return writer->mBuffer; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int gsXmlWriterGetDataLength(GSXmlStreamWriter stream) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - GS_ASSERT(stream != NULL); - return writer->mLen; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilSkipWhiteSpace(GSIXmlStreamReader * stream, const char * buffer, int len, int * pos) -{ - GS_ASSERT(buffer != NULL); - GS_ASSERT(len > 0); - //GS_ASSERT(*pos < len); - - // check if the next character is in the whitespace set - while(*pos < len) - { - if (NULL == strchr(GS_XML_WHITESPACE, buffer[*pos])) - return gsi_true; - (*pos)++; // move to next character - } - - GSI_UNUSED(stream); - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilParseElement(GSIXmlStreamReader * stream, char * buffer, - int len, int * pos, int parentIndex) -{ - GSIXmlElement newElem; - int startPos = 0; - gsi_bool storeElement = gsi_true; - - GS_ASSERT(stream != NULL); - GS_ASSERT(buffer != NULL); - GS_ASSERT(len > 0); - GS_ASSERT(*pos < len); - - gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos); - if (*pos >= len) - return gsi_true; // legal EOF - - memset(&newElem, 0, sizeof(newElem)); - - // elements must begin with '<' - if (buffer[*pos] != '<') - return gsi_false; - (*pos)++; - if (*pos >= len) - return gsi_false; - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - // '<' can be followed with '!', '?', '%', '/' special characters - if (buffer[*pos] == '!' || buffer[*pos] == '?' || - buffer[*pos] == '%' || buffer[*pos] == '/') - { - storeElement = gsi_false; - (*pos)++; - startPos = (*pos)-2; - } - else - startPos = (*pos)-1; // store the position of '<' - - // should be a name (type) next - GS_XML_CHECK(gsiXmlUtilParseName(stream, buffer, len, pos, &newElem.mName)); - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - if (storeElement) - { - GS_ASSERT(newElem.mName.mData != NULL); - newElem.mIndex = ArrayLength(stream->mElementArray); - newElem.mParentIndex = parentIndex; - ArrayAppend(stream->mElementArray, &newElem); - } - - // read attributes (if any) - while (*pos < len && isalnum(buffer[*pos])) - { - // attribute format is name="", e.g. nickname="player1" - GSIXmlAttribute newAttr; - memset(&newAttr, 0, sizeof(newAttr)); - GS_XML_CHECK(gsiXmlUtilParseName(stream, buffer, len, pos, &newAttr.mName)); - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - if (buffer[*pos] != '=') - return gsi_false; - (*pos)++; // skip the '=' - GS_XML_CHECK(gsiXmlUtilParseString(stream, buffer, len, pos, &newAttr.mValue)); - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - // Store it in the array - if (storeElement) - { - GS_ASSERT(newElem.mName.mData != NULL); - GS_ASSERT(newElem.mIndex != -1); - GS_ASSERT(newAttr.mName.mData != NULL); - GS_ASSERT(newAttr.mValue.mData != NULL); - - newAttr.mIndex = ArrayLength(stream->mAttributeArray); - newAttr.mParentIndex = newElem.mIndex; - ArrayAppend(stream->mAttributeArray, &newAttr); - } - } - - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - // Check for immediate termination (no value or children) - // non-element tags end with the same character they start with - // element tags ending with '/>' also have no children - if ( (!isalnum(buffer[startPos+1]) && buffer[*pos] == buffer[startPos+1]) - || buffer[*pos] == '/') - { - (*pos)++; - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - if (buffer[*pos] != '>') - return gsi_false; // only legal character here is closing brace - (*pos)++; - return gsi_true; // legal termination - } - - // make sure we've found the end of the start tag - if (buffer[*pos] != '>') - return gsi_false; - (*pos)++; - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - // check for element value - if (buffer[*pos] != '<') - { - GS_XML_CHECK(gsiXmlUtilParseValue(stream, buffer, len, pos, &newElem.mValue)); - // update the array with the value information - if (storeElement) - ArrayReplaceAt(stream->mElementArray, &newElem, newElem.mIndex); - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - } - - // read child elements and close tag - while (*pos < len) - { - int childStartPos = *pos; - if (buffer[*pos] != '<') - return gsi_false; - (*pos)++; - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - if (buffer[*pos] == '/') - { - // this MUST be a close of the current element - // close tags are in the form: - (*pos)++; - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - if ((*pos)+newElem.mName.mLen >= len) - return gsi_false; // EOF before tag close - if (0 != strncmp((const char*)newElem.mName.mData, &buffer[*pos], (size_t)newElem.mName.mLen)) - return gsi_false; // close tag mismatch - (*pos) += newElem.mName.mLen; - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - if (buffer[*pos] != '>') - return gsi_false; - (*pos)++; - return gsi_true; - } - else - { - if (newElem.mValue.mData != NULL) - return gsi_false; // elements with value cannot have children - - // move read position to start of child element, then parse - *pos = childStartPos; - GS_XML_CHECK(gsiXmlUtilParseElement(stream, buffer, len, pos, newElem.mIndex)); - gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos); - } - } - return gsi_false; // EOF before tag close -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Parse element name -// Must begin with a letter and contains only alphanumeric | '_' | '-' characters -// Element names may consist of two "names", : -static gsi_bool gsiXmlUtilParseName(GSIXmlStreamReader * stream, const char * buffer, - int len, int * pos, GSIXmlString * strOut) -{ - gsi_bool haveNamespace = gsi_false; - GS_ASSERT(buffer != NULL); - GS_ASSERT(len > 0); - - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - // EOF? - if (*pos >= len) - return gsi_false; - - // first character must be alphanumeric but not a digit - if (!isalnum(buffer[*pos]) || isdigit(buffer[*pos])) - return gsi_false; - - strOut->mData = (gsi_u8*)&buffer[*pos]; - strOut->mLen = 1; - (*pos)++; - - while(*pos < len && NULL==strchr(GS_XML_WHITESPACE, buffer[*pos])) - { - // only alpha numeric and '_' characters are allowed, plus one namespace separator ':' - if (buffer[*pos] == ':') - { - if (gsi_is_true(haveNamespace)) - return gsi_false; // already have a namespace! - haveNamespace = gsi_true; - } - else if ((buffer[*pos] != '_') && (buffer[*pos] != '-') && (!isalnum(buffer[*pos]))) - return gsi_true; // treat all others as a new token example '=' - - strOut->mLen++; - (*pos)++; - } - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilParseString(GSIXmlStreamReader * stream, char * buffer, - int len, int * pos, GSIXmlString * strOut) -{ - char startCh = '\0'; - char * strStart = NULL; - //gsi_bool hasMarkup = gsi_false; - - - GS_ASSERT(stream != NULL); - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - // strings may start with either ' or " - startCh = buffer[*pos]; - if (startCh != '\"' && startCh != '\'') - return gsi_false; - - (*pos)++; - strStart = &buffer[*pos]; // remember this for easier processing below - strOut->mLen = 0; - - if (*pos >= len) - return gsi_false; // EOF when looking for string terminator - if (buffer[*pos] == startCh) - { - // empty string ? - strOut->mData = (const gsi_u8*)strStart; - (*pos)++; // skip the terminating character - return gsi_true; - } - - while(buffer[*pos] != startCh) - { - if (*pos >= len) - return gsi_false; // EOF when looking for string terminator - - //if (buffer[*pos] == '&') - //hasMarkup = gsi_true; - - (*pos)++; - strOut->mLen++; - } - (*pos)++; // skip the terminating character - - // decode the string if necessary - if (gsi_is_false(gsiXmlUtilDecodeString(strStart, &strOut->mLen))) - return gsi_false; - - // set the data into strOut - strOut->mData = (const gsi_u8*)strStart; - return gsi_true; - -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Remove '&' markup from the buffer, converts in place -static gsi_bool gsiXmlUtilDecodeString(char * buffer, int * len) -{ - int readPos = 0; - - while(readPos < *len) - { - int charsToRemove = 0; - - // we only want '&' - if (buffer[readPos] != '&') - { - readPos++; - continue; - } - - // check single character switches - if (strncmp(&buffer[readPos], "&", 5)==0) - { - buffer[readPos++] = '&'; - charsToRemove = 5-1; - } - else if (strncmp(&buffer[readPos], """, 6)==0) - { - buffer[readPos++] = '\"'; - charsToRemove = 6-1; - } - else if (strncmp(&buffer[readPos], "'", 6)==0) - { - buffer[readPos++] = '\''; - charsToRemove = 6-1; - } - else if (strncmp(&buffer[readPos], "<", 4)==0) - { - buffer[readPos++] = '<'; - charsToRemove = 4-1; - } - else if (strncmp(&buffer[readPos], ">", 4)==0) - { - buffer[readPos++] = '>'; - charsToRemove = 4-1; - } - else if (strncmp(&buffer[readPos], "&#x", 3)==0) - { - // hex digit - unsigned int digitValue = 0; - //unsigned int digitLength = 0; // 0x00000065 = 1 byte - char ch = ' '; - gsi_bool haveWritten = gsi_false; - int i=0; - unsigned int mask = 0xFF000000; - - char * digitEnd = strchr(&buffer[readPos+3], ';'); - if (digitEnd == NULL) - return gsi_false; // missing ';' - if (digitEnd - &buffer[readPos+3] > 8) - return gsi_false; // too many digits before end - - // scan digits into memory, do this as a block so that ť = 01 65 - sscanf(&buffer[readPos+3], "%08x", &digitValue); - - // write the digit back as a character array - for (i=0; i < 4; i++) - { - ch = (char)((digitValue & mask) >> ((3-i)*8)); // make 0x00006500 into 0x65 - if (haveWritten || ch != 0x00) - { - buffer[readPos++] = ch; - haveWritten = gsi_true; - } - mask = mask >> 8; - } - - // remove everything between the current read position and the semicolon - charsToRemove = digitEnd - &buffer[readPos] + 1; // remove the semicolon - } - else if (strncmp(&buffer[readPos], "&#", 2)==0) - { - // dec digit - like a hex digit, only use atoi instead of sscanf - unsigned int digitValue = 0; - //unsigned int digitLength = 0; // 0x00000065 = 1 byte - char ch = ' '; - gsi_bool haveWritten = gsi_false; - int i=0; - unsigned int mask = 0xFF000000; - - char * digitEnd = strchr(&buffer[readPos+2], ';'); - if (digitEnd == NULL) - return gsi_false; // missing ';' - - // scan digits into memory, do this as a block so that ť = 0165h = 01 65 - digitValue = (unsigned int)atoi(&buffer[readPos+2]); - - // write the digit back as a character array - for (i=0; i < 4; i++) - { - ch = (char)((digitValue & mask) >> ((3-i)*8)); // make 0x00006500 into 0x65 - if (haveWritten || ch != 0x00) - { - buffer[readPos++] = ch; - haveWritten = gsi_true; - } - mask = mask >> 8; - } - - // remove everything between the current read position and the semicolon - charsToRemove = digitEnd - &buffer[readPos] + 1; // remove the semicolon - - } - else - return gsi_false; // unhandle '&' type - - // remove characters by compressing buffer and adding whitespace at the end - // "&&" becomes "&& " after one iteration - memmove(&buffer[readPos], &buffer[readPos+charsToRemove], (size_t)(*len-(readPos+charsToRemove))); - memset(&buffer[*len-charsToRemove], ' ', (size_t)charsToRemove); - (*len) -= charsToRemove; - } - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Parse an entity value. -// Todo: resolving escaped strings? -static gsi_bool gsiXmlUtilParseValue(GSIXmlStreamReader * stream, char * buffer, - int len, int * pos, GSIXmlString * strOut) -{ - char * strStart = NULL; - - GS_ASSERT(stream != NULL); - GS_XML_CHECK(gsiXmlUtilSkipWhiteSpace(stream, buffer, len, pos)); - - if (buffer[*pos] != '<') - { - strStart = &buffer[*pos]; // store this so we can find it later - strOut->mData = (const gsi_u8*)strStart; - } - - while(*pos < len) - { - if (buffer[*pos] == '<') - { - // decode the string if necessary - if (gsi_is_false(gsiXmlUtilDecodeString(strStart, &strOut->mLen))) - return gsi_false; - return gsi_true; // extracted and decoded - } - (*pos)++; - strOut->mLen++; - } - return gsi_false; // EOF before tag end -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteOpenTag(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - if ( gsi_is_false(gsiXmlUtilWriteChar(writer, '<')) || - gsi_is_false(gsiXmlUtilWriteString(writer, namespaceName)) || - gsi_is_false(gsiXmlUtilWriteChar(writer, ':')) || - gsi_is_false(gsiXmlUtilWriteString(writer, tag)) || - gsi_is_false(gsiXmlUtilWriteChar(writer, '>')) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteCloseTag(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - if ( gsi_is_false(gsiXmlUtilWriteChar(writer, '<')) || - gsi_is_false(gsiXmlUtilWriteChar(writer, '/')) || - gsi_is_false(gsiXmlUtilWriteString(writer, namespaceName)) || - gsi_is_false(gsiXmlUtilWriteChar(writer, ':')) || - gsi_is_false(gsiXmlUtilWriteString(writer, tag)) || - gsi_is_false(gsiXmlUtilWriteChar(writer, '>')) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteStringElement(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag, const char * value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - int i=0; - int len = 0; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(value != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - // Check legal ASCII characters - // 0x9, 0xA, 0xD - // [0x20-0xFF] - len = (int)strlen(value); - for (i=0; i < len; i++) - { - // only check values less than 0x20 - if ((unsigned char)value[i] < 0x20) - { - if ((unsigned char)value[i] != 0x09 - && ((unsigned char)value[i] != 0x0A) - && ((unsigned char)value[i] != 0x0D) - ) - { - // contains illegal (and unencodable) characters. - return gsi_false; - } - } - } - - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteXmlSafeString(writer, value)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Converts unicode to ascii strings for writing to XML writer -gsi_bool gsXmlWriteAsciiStringElement(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag, const gsi_char * value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - int i=0; - int len = 0; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(value != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - // Check legal ASCII characters - // 0x9, 0xA, 0xD - // [0x20-0xFF] - len = (int)_tcslen(value); - for (i=0; i < len; i++) - { - // only check values less than 0x20 - if ((unsigned char)value[i] < 0x20) - { - if ((unsigned char)value[i] != 0x09 - && ((unsigned char)value[i] != 0x0A) - && ((unsigned char)value[i] != 0x0D) - ) - { - // contains illegal (and unencodable) characters. - return gsi_false; - } - } - } - -#ifdef GSI_UNICODE - //if unicode, write as Ascii string, otherwise it is already in Ascii format - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteAsciiString(writer, value)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } -#else - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteXmlSafeString(writer, value)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } -#endif - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteUnicodeStringElement(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag, const unsigned short * value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - int i = 0; - int len = 0; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(value != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - // Check legal UNICODE characters - // 0x9, 0xA, 0xD - // [0x20-0xD7FF] - // [xE000-xFFFD] - // [x10000-x10FFFF] (UTF-16, not supported) - len = gsUnicodeStringLen(value); - for (i=0; i < len; i++) - { - // check values less than 0x20 - if (value[i] < 0x0020) - { - if ((value[i] != 0x0009) && (value[i] != 0x0A) && (value[i] != 0x0D)) - return gsi_false; // contains illegal (and unencodable) characters. - } - else if (value[i] > 0xD7FF && value[i] < 0xE000) - return gsi_false; // contains illegal (and unencodable) characters. - else if (value[i] > 0xFFFD) - return gsi_false; // contains illegal (and unencodable) characters. - } - - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteUnicodeString(writer, value)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteIntElement(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag, gsi_u32 value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - char buf[32]; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - sprintf(buf, "%d", value); - - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteString(writer, buf)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteInt64Element(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag, gsi_i64 value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - char buf[33]; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - gsiInt64ToString(buf, value); - - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteString(writer, buf)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteFloatElement(GSXmlStreamWriter stream, const char * namespaceName, - const char * tag, float value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - char buf[32]; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - sprintf(buf, "%f", value); - - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteString(writer, buf)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// first character of HEX binary is HIGH byte -gsi_bool gsXmlWriteHexBinaryElement(GSXmlStreamWriter stream, const char * namespaceName, const char * tag, const gsi_u8 * data, int len) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - int pos = 0; - int temp = 0; - - char hex[3]; - hex[2] = '\0'; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(data != NULL); - GS_ASSERT(len > 0); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - if (gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag))) - return gsi_false; - - while (pos < len) - { - temp = data[pos]; // sprintf requires an int parameter for %02x operation - sprintf(hex, "%02x", temp); - pos++; - if (gsi_is_false(gsiXmlUtilWriteChar(writer, hex[0]))) - return gsi_false; - if (gsi_is_false(gsiXmlUtilWriteChar(writer, hex[1]))) - return gsi_false; - } - - if (gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag))) - return gsi_false; - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteBase64BinaryElement(GSXmlStreamWriter stream, const char * namespaceName, const char * tag, const gsi_u8 * data, int len) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - B64StreamData streamData; - char b64[5]; - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(data != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - if (gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag))) - return gsi_false; - - B64InitEncodeStream(&streamData, (const char*)data, len, GS_XML_BASE64_ENCODING_TYPE); - while(B64EncodeStream(&streamData, b64)) - { - b64[4] = '\0'; - if (gsi_is_false(gsiXmlUtilWriteString(writer, b64))) - return gsi_false; - } - - if (gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag))) - return gsi_false; - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlWriteDateTimeElement(GSXmlStreamWriter stream, const char * namespaceName, const char * tag, time_t value) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - char timeString[21]; - struct tm *timePtr; - - // convert the time to a string - timePtr = gsiSecondsToDate(&value); - - sprintf(timeString, "%d-%02d-%02dT%02d:%02d:%02dZ", - timePtr->tm_year + 1900, timePtr->tm_mon + 1, timePtr->tm_mday, - timePtr->tm_hour, timePtr->tm_min, timePtr->tm_sec); - - GS_ASSERT(stream != NULL); - GS_ASSERT(namespaceName != NULL); - GS_ASSERT(tag != NULL); - GS_ASSERT(gsi_is_false(writer->mClosed)); - - if ( gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag)) || - gsi_is_false(gsiXmlUtilWriteString(writer, timeString)) || - gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag)) - ) - { - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Must reverse byte order and strip leading zeroes -gsi_bool gsXmlWriteLargeIntElement(GSXmlStreamWriter stream, const char * namespaceName, const char * tag, const struct gsLargeInt_s * lint) -{ - GSIXmlStreamWriter * writer = (GSIXmlStreamWriter*)stream; - int readPos = (int)(lint->mLength - 1); - const l_word *readBuf = (const l_word*)lint->mData; - unsigned int temp; - int i; - char hex[3]; - gsi_bool first = gsi_true; - - if (gsi_is_false(gsXmlWriteOpenTag(stream, namespaceName, tag))) - return gsi_false; - - // skip leading zeroes - while(readPos >= 0 && readBuf[readPos] == 0) - readPos--; - - // dump words - for (; readPos >= 0; readPos--) - { - if(gsi_is_true(first)) - { - for(i = 0 ; i < GS_LARGEINT_DIGIT_SIZE_BYTES ; i++) - { - temp = ((lint->mData[readPos] >> (8 * (GS_LARGEINT_DIGIT_SIZE_BYTES - i - 1))) & 0xFF); - if(temp != 0) - break; - } - first = gsi_false; - } - else - { - i = 0; - } - - // loop through each byte from most to least significant - for (; i < GS_LARGEINT_DIGIT_SIZE_BYTES; i++) - { - temp = ((lint->mData[readPos] >> (8 * (GS_LARGEINT_DIGIT_SIZE_BYTES - i - 1))) & 0xFF); - sprintf(hex, "%02x", temp); - if (gsi_is_false(gsiXmlUtilWriteChar(writer, hex[0]))) - return gsi_false; - if (gsi_is_false(gsiXmlUtilWriteChar(writer, hex[1]))) - return gsi_false; - } - } - - if (gsi_is_false(gsXmlWriteCloseTag(stream, namespaceName, tag))) - return gsi_false; - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilWriteChar(GSIXmlStreamWriter * stream, char ch) -{ - GS_ASSERT(gsi_is_false(stream->mClosed)); - - if (stream->mLen >= stream->mCapacity) - { - if (gsi_is_false(gsiXmlUtilGrowBuffer(stream))) - return gsi_false; // OOM - } - stream->mBuffer[stream->mLen] = ch; - stream->mLen++; - - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilWriteString(GSIXmlStreamWriter * stream, const char * str) -{ - int strLen = 0; - - GS_ASSERT(str != NULL); - GS_ASSERT(gsi_is_false(stream->mClosed)); - - // get URL encoded length - strLen = (int)strlen(str); - if (strLen == 0) - return gsi_true; - - // grow the buffer if necessary - while ((stream->mCapacity - stream->mLen) <= strLen) - { - if (gsi_is_false(gsiXmlUtilGrowBuffer(stream))) - return gsi_false; // OOM - } - - strcpy(&stream->mBuffer[stream->mLen], str); - stream->mLen += strLen; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef GSI_UNICODE -static gsi_bool gsiXmlUtilWriteAsciiString(GSIXmlStreamWriter * stream, const gsi_char * str) -{ - int strLen = 0; - - GS_ASSERT(str != NULL); - GS_ASSERT(gsi_is_false(stream->mClosed)); - - // get URL encoded length - strLen = (int)_tcslen(str); - if (strLen == 0) - return gsi_true; - - // grow the buffer if necessary - while ((stream->mCapacity - stream->mLen) <= strLen) - { - if (gsi_is_false(gsiXmlUtilGrowBuffer(stream))) - return gsi_false; // OOM - } - - UCS2ToAsciiString(str, &stream->mBuffer[stream->mLen]); - stream->mLen += strLen; - return gsi_true; -} -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilWriteUnicodeString(GSIXmlStreamWriter * stream, const unsigned short * str) -{ - int strLen = 0; - int pos = 0; - int utf8Len = 0; - char utf8String[4] = { '\0' }; - //gsi_bool result = gsi_false; - - GS_ASSERT(str != NULL); - GS_ASSERT(gsi_is_false(stream->mClosed)); - - strLen = gsUnicodeStringLen(str); - utf8String[3] = '\0'; - - for (pos = 0; pos < strLen; pos++) - { - utf8Len = _UCS2CharToUTF8String(str[pos], utf8String); - utf8String[utf8Len] = '\0'; // null terminate it - if (gsi_is_false(gsiXmlUtilWriteXmlSafeString(stream, utf8String))) - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilWriteXmlSafeString(GSIXmlStreamWriter * stream, const char * str) -{ - int strLen = 0; - int pos = 0; - gsi_bool result = gsi_false; - - GS_ASSERT(str != NULL); - GS_ASSERT(gsi_is_false(stream->mClosed)); - - strLen = (int)strlen(str); - - for (pos = 0; pos < strLen; pos++) - { - if (str[pos] == '&') - result = gsiXmlUtilWriteString(stream, "&"); - else if (str[pos] == '\'') - result = gsiXmlUtilWriteString(stream, "'"); - else if (str[pos] == '"') - result = gsiXmlUtilWriteString(stream, """); - else if (str[pos] == '<') - result = gsiXmlUtilWriteString(stream, "<"); - else if (str[pos] == '>') - result = gsiXmlUtilWriteString(stream, ">"); - else if (str[pos] == ' ') - result = gsiXmlUtilWriteString(stream, " "); - else if (str[pos] < 0x20 || ((unsigned char)str[pos]) > 0x7F) - { - // write as hex - char numeric[7]; - sprintf(numeric, "&#x%02x;", (unsigned char)str[pos]); - numeric[6] = '\0'; - result = gsiXmlUtilWriteString(stream, numeric); - } - else - result = gsiXmlUtilWriteChar(stream, str[pos]); - - if (gsi_is_false(result)) - return gsi_false; - } - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool gsiXmlUtilGrowBuffer(GSIXmlStreamWriter * stream) -{ - int newCapacity = stream->mCapacity + GS_XML_SOAP_BUFFER_INCREMENT_SIZE; - void* newBuf = NULL; - - newBuf = gsirealloc(stream->mBuffer, (size_t)newCapacity); - if (newBuf == NULL) - return gsi_false; - if (newBuf != stream->mBuffer) - stream->mBuffer = (char*)newBuf; - stream->mCapacity = newCapacity; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlMoveToStart(GSXmlStreamReader stream) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - reader->mElemReadIndex = -1; // start BEFORE first element - reader->mValueReadIndex = -1; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Move to next occurance of "matchtag" at any level -gsi_bool gsXmlMoveToNext(GSXmlStreamReader stream, const char * matchtag) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - int i=0; - - for (i=(reader->mElemReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - GSIXmlElement * elem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &elem->mName))) - { - reader->mElemReadIndex = i; - reader->mValueReadIndex = -1; - return gsi_true; - } - } - // no matching element found - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Move up one level in tree -gsi_bool gsXmlMoveToParent(GSXmlStreamReader stream) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - - // check for invalid position - if (reader->mElemReadIndex >= ArrayLength(reader->mElementArray) || - reader->mElemReadIndex == -1) - { - return gsi_false; // current position invalid - } - else - { - GSIXmlElement * elem = (GSIXmlElement*)ArrayNth(reader->mElementArray, reader->mElemReadIndex); - if (elem->mParentIndex == -1) - return gsi_false; // current elem is at highest level - if (elem->mParentIndex >= ArrayLength(reader->mElementArray)) - return gsi_false; // parent is invalid! - reader->mElemReadIndex = elem->mParentIndex; - reader->mValueReadIndex = -1; - return gsi_true; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Move to next unit who shares common parent -gsi_bool gsXmlMoveToSibling (GSXmlStreamReader stream, const char * matchtag) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - int i=0; - - int curElemParent = -1; - GSIXmlElement * searchElem = NULL; - - // If the current element is valid use its parent id - if (reader->mElemReadIndex < ArrayLength(reader->mElementArray)) - { - GSIXmlElement * curElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, reader->mElemReadIndex); - curElemParent = curElem->mParentIndex; - } - else - // otherwise search root elements only - curElemParent = -1; - - for (i=(reader->mElemReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - // if sibling... - if (searchElem->mParentIndex == curElemParent) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchElem->mName))) - { - reader->mElemReadIndex = i; - reader->mValueReadIndex = -1; - return gsi_true; - } - } - // bail if we reach a higher brance - if (searchElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - - // no matching element found - return gsi_false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlMoveToChild(GSXmlStreamReader stream, const char * matchtag) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchElem = NULL; - int i=0; - - for (i=(reader->mElemReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchElem->mName))) - { - reader->mElemReadIndex = i; - reader->mValueReadIndex = -1; - return gsi_true; - } - } - // check if we've reached a higher branch - // -- we know this when we've reached an element whose - // parent is above our level in the tree - if (searchElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsString(GSXmlStreamReader stream, const char * matchtag, - const char ** valueOut, int * lenOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - reader->mValueReadIndex = i; - *valueOut = (const char*)searchValueElem->mValue.mData; - *lenOut = searchValueElem->mValue.mLen; - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/* -gsi_bool gsXmlReadChildAsUnicodeString(GSXmlStreamReader stream, const char * matchtag, - gsi_char ** valueOut, int * lenOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - reader->mValueReadIndex = i; - if (searchValueElem->mValue.mData == NULL) - { - *valueOut = NULL; - *lenOut = 0; - return gsi_true; - } - *lenOut = UTF8ToUCS2StringLen((const char *)searchValueElem->mValue.mData, (unsigned short *) *valueOut, searchValueElem->mValue.mLen); - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -}*/ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Same as read child as string, but copies into valueOut and null terminates -gsi_bool gsXmlReadChildAsStringNT(GSXmlStreamReader stream, const char * matchtag, char valueOut[], int maxLen) -{ - const char * strValue = NULL; - int strLen = 0; - - if (gsi_is_false(gsXmlReadChildAsString(stream, matchtag, &strValue, &strLen))) - { - valueOut[0] = '\0'; - return gsi_false; - } - else - { - strncpy(valueOut, strValue, (size_t)min(maxLen, strLen)); - valueOut[min(maxLen-1, strLen)] = '\0'; - return gsi_true; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Same as readChildAsStringNT, but converts Ascii/UTF-8 to USC2 -gsi_bool gsXmlReadChildAsUnicodeStringNT(GSXmlStreamReader stream, const char * matchtag, gsi_char valueOut[], int maxLen) -{ - const char * utf8Value = NULL; - int unicodeLen = 0; - int utf8Len = 0; - - if (gsi_is_false(gsXmlReadChildAsString(stream, matchtag, &utf8Value, &utf8Len))) - { - valueOut[0] = '\0'; - return gsi_false; - } - else - { - // Convert into destination buffer - unicodeLen = UTF8ToUCS2StringLen(utf8Value, (unsigned short *)valueOut, utf8Len); - valueOut[min(maxLen-1, unicodeLen)] = '\0'; - return gsi_true; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsHexBinary(GSXmlStreamReader stream, const char * matchtag, - gsi_u8 valueOut[], int maxLen, int * lenOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - // switch endianess, e.g. first character in hexstring is HI byte - gsi_u32 temp = 0; - int writepos = 0; - int readpos = 0; - int bytesleft = min(maxLen*2, searchValueElem->mValue.mLen); - - // special case: zero length value - if (searchValueElem->mValue.mLen == 0 || searchValueElem->mValue.mData == NULL) - { - valueOut[0] = 0; - *lenOut = 0; - return gsi_true; - } - - // Checking length only? - if (valueOut == NULL) - { - *lenOut = searchValueElem->mValue.mLen / 2; - - // note: read position left at this elemtent so next read can record the data - return gsi_true; - } - - // 2 characters of hexbyte = 1 value byte - while(bytesleft > 1) - { - sscanf((char*)(&searchValueElem->mValue.mData[readpos]), "%02x", &temp); // sscanf requires a 4 byte dest - valueOut[writepos] = (gsi_u8)temp; // then we convert to byte, to ensure correct byte order - readpos += 2; - writepos += 1; - bytesleft -= 2; - } - if (bytesleft == 1) - { - sscanf((char*)(&searchValueElem->mValue.mData[readpos]), "%01x", &temp); // sscanf requires a 4 byte dest - valueOut[writepos] = (gsi_u8)temp; // then we convert to byte, to ensure correct byte order - readpos += 1; - writepos += 1; - bytesleft -= 1; - } - if (lenOut != NULL) - *lenOut = writepos; - - reader->mValueReadIndex = i; // mark that this element was read - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsBase64Binary(GSXmlStreamReader stream, const char * matchtag, gsi_u8 valueOut[], int * lenOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - if(valueOut) - { - reader->mValueReadIndex = i; - if(searchValueElem->mValue.mData) - B64Decode((char*)searchValueElem->mValue.mData, (char*)valueOut, searchValueElem->mValue.mLen, lenOut, GS_XML_BASE64_ENCODING_TYPE); - else - *lenOut = 0; - } - else - { - if(searchValueElem->mValue.mData) - *lenOut = B64DecodeLen((const char*)searchValueElem->mValue.mData, GS_XML_BASE64_ENCODING_TYPE); - else - *lenOut = 0; - } - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsInt (GSXmlStreamReader stream, const char * matchtag, - int * valueOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - reader->mValueReadIndex = i; - if (searchValueElem->mValue.mData == NULL) - return gsi_false; // invalid type! - *valueOut = atoi((const char*)searchValueElem->mValue.mData); - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsInt64(GSXmlStreamReader stream, const char * matchtag, - gsi_i64 * valueOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - reader->mValueReadIndex = i; - if (searchValueElem->mValue.mData == NULL) - return gsi_false; // invalid type! - *valueOut = gsiStringToInt64((const char*)searchValueElem->mValue.mData); - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsDateTimeElement (GSXmlStreamReader stream, const char * matchtag, - time_t * valueOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - struct tm timePtr; - - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - reader->mValueReadIndex = i; - if (searchValueElem->mValue.mData == NULL) - return gsi_false; // invalid type! - - // convert the time to from a string to a time struct - sscanf((const char*)searchValueElem->mValue.mData, "%i-%02d-%02dT%02d:%02d:%02d", - &timePtr.tm_year, &timePtr.tm_mon, &timePtr.tm_mday, - &timePtr.tm_hour, &timePtr.tm_min, &timePtr.tm_sec); - - timePtr.tm_year -= 1900; - timePtr.tm_mon -= 1; - timePtr.tm_isdst = -1; - *valueOut = gsiDateToSeconds(&timePtr); - - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool gsXmlReadChildAsFloat (GSXmlStreamReader stream, const char * matchtag, - float * valueOut) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchValueElem = NULL; - int i=0; - - // Do we have a valid value position already? - if (reader->mValueReadIndex == -1) - reader->mValueReadIndex = reader->mElemReadIndex; // start at current element - - for (i=(reader->mValueReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchValueElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchValueElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if (gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchValueElem->mName))) - { - reader->mValueReadIndex = i; - if (searchValueElem->mValue.mData == NULL) - return gsi_false; // invalid type! - *valueOut = (float)atof((const char*)searchValueElem->mValue.mData); - return gsi_true; - } - } - // bail if we've reached a higher branch - if (searchValueElem->mParentIndex < reader->mElemReadIndex) - return gsi_false; - } - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Compare only the text following the namespace character -static gsi_bool gsiXmlUtilTagMatches(const char * matchtag, GSIXmlString * xmlstr) -{ - const char * matchNoNamespace = NULL; - GSIXmlString xmlNoNamespace; - int xmlNamespacePos=0; - - GS_ASSERT(xmlstr != NULL); - - if (matchtag == NULL) - return gsi_true; - if (matchtag[strlen(matchtag)-1] == ':') - return gsi_false; // illegal to end with ':' - - // find post-namespace positions - matchNoNamespace = strchr(matchtag, ':'); - if (matchNoNamespace == NULL) - matchNoNamespace = matchtag; - - while(xmlNamespacePos < xmlstr->mLen && xmlstr->mData[xmlNamespacePos] != ':') - xmlNamespacePos++; - if (xmlNamespacePos == xmlstr->mLen) - xmlNamespacePos=0; - else - xmlNamespacePos++; // add one more to skip over the ':' - xmlNoNamespace.mData = xmlstr->mData + xmlNamespacePos; - xmlNoNamespace.mLen = xmlstr->mLen - xmlNamespacePos; - - // compare strings - if (0 == strncmp(matchNoNamespace, (const char*)xmlNoNamespace.mData, (size_t)xmlNoNamespace.mLen)) - return gsi_true; - else - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Reads childs as bin-endian hexbinary, then converts to little-endian large int -gsi_bool gsXmlReadChildAsLargeInt(GSXmlStreamReader stream, const char * matchtag, struct gsLargeInt_s * valueOut) -{ - int len = 0; - - // set to zero - memset(valueOut, 0, sizeof(struct gsLargeInt_s)); - - // parse the hexbinary - if (gsi_is_false(gsXmlReadChildAsHexBinary(stream, matchtag, (gsi_u8*)valueOut->mData, GS_LARGEINT_BINARY_SIZE/8*2, &len))) - return gsi_false; - - // save off length - valueOut->mLength = (l_word)(len/GS_LARGEINT_DIGIT_SIZE_BYTES); - if (len%GS_LARGEINT_DIGIT_SIZE_BYTES != 0) - valueOut->mLength++; - - // reverse byte order - if (gsi_is_false(gsLargeIntReverseBytes(valueOut))) - return gsi_false; - else - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Resets the child read position to the first child of the current element -// -gsi_bool gsXmlResetChildReadPosition(GSXmlStreamReader stream) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - reader->mValueReadIndex = -1; // no current child position means start at first - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Count the number of children with the tag -// If the tag is NULL, count all the children -// Only counts direct children, not grandchildren or lower -int gsXmlCountChildren(GSXmlStreamReader stream, const char * matchtag) -{ - GSIXmlStreamReader * reader = (GSIXmlStreamReader*)stream; - GSIXmlElement * searchElem = NULL; - int i=0; - int count=0; - - for (i=(reader->mElemReadIndex+1); i < ArrayLength(reader->mElementArray); i++) - { - searchElem = (GSIXmlElement*)ArrayNth(reader->mElementArray, i); - if (searchElem->mParentIndex == reader->mElemReadIndex) - { - // check match - if ((matchtag == NULL) || gsi_is_true(gsiXmlUtilTagMatches(matchtag, &searchElem->mName))) - { - count++; - } - } - // check if we've reached a higher branch - // -- we know this when we've reached an element whose - // parent is above our level in the tree - else if (searchElem->mParentIndex < reader->mElemReadIndex) - break; - } - return count; -} - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsXML.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/gsXML.h deleted file mode 100644 index 6f9a0c72271..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/gsXML.h +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GSXML_H__ -#define __GSXML_H__ - - -#include "gsPlatform.h" -#include "gsLargeInt.h" // so that it can write large ints - - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// GameSpy XML parser for soap messages -// Create the stream object and attach to an XML text buffer. -// The stream will not modify the buffer. -// The buffer should not be released until after the stream is destroyed -// -// -// Limitations: -// Processing instructions other than ' - -#define _REENTRANT - -#define PTHREAD_NO_ERROR 0 - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// These functions are unsupported in the current version of the SDK - -gsi_u32 gsiInterlockedIncrement(gsi_u32 * value) -{ - //GS_ASSERT_STR(gsi_false, "gsiInterlockIncrement is unsupported for LINUX in the current version of the SDK\n"); - return __sync_add_and_fetch(value, 1); -} - -gsi_u32 gsiInterlockedDecrement(gsi_u32 * value) -{ - //GS_ASSERT_STR(gsi_false, "gsiInterlockIncrement is unsupported for LINUX in the current version of the SDK\n"); - return __sync_add_and_fetch(value, -1); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int gsiStartThread(GSThreadFunc func, gsi_u32 theStackSize, void *arg, GSIThreadID * id) -{ - pthread_attr_init(&id->attr); - pthread_attr_setstacksize(&id->attr, theStackSize); - - if (pthread_create(&id->thread, &id->attr, (void *)func, arg) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create thread\r\n"); - return -1; - } - - return 0; -} - -void gsiCancelThread(GSIThreadID id) -{ - //should i destroy the attributes here? - pthread_attr_destroy(&id.attr); - - if (pthread_cancel(id.thread) != PTHREAD_NO_ERROR) { - //there was an error - how should we handle these? or should we? - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to cancel thread\r\n"); - } - //free up memory and set to NULL - - gsifree(&id.thread); -} - -// This must be called from INSIDE the thread you wish to exit -void gsiExitThread(GSIThreadID id) -{ - // detach the thread so that it knows to free resources upon exit - pthread_detach(id.thread); - - // exit thread to free up resources - pthread_exit(NULL); -} - -void gsiCleanupThread(GSIThreadID id) -{ - // destroy any leftover attributes associated with the thread - pthread_attr_destroy(&id.attr); -} - -gsi_u32 gsiHasThreadShutdown(GSIThreadID id) -{ - // pthreads lacks detection mechanism for this - GSI_UNUSED(id); - return 1; -} - -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_init(theCrit, NULL) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to initialize critical section\r\n"); - } -} - -void gsiEnterCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_lock(theCrit) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to lock mutex for entering critical section\r\n"); - } -} - -void gsiLeaveCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_unlock(theCrit) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to unlock mutex for leaving critical section\r\n"); - } -} - -void gsiDeleteCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_destroy(theCrit) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to destroy mutex\r\n"); - } - theCrit = NULL; -} - -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - int result; - GSISemaphoreID semaphore; - - //we can use the default attributes for the mutex by passing NULL - result = pthread_mutex_init(&semaphore.mLock, NULL); - - if (result != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create semaphore\r\n"); - } - - semaphore.mValue = theInitialCount; - semaphore.mMax = theMaxCount; - - GSI_UNUSED(theName); - return semaphore; -} - -// Waits for -- and signals -- the semaphore -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - gsi_time startTime = current_time(); - gsi_bool infinite = (theTimeoutMs == GSI_INFINITE)?gsi_true:gsi_false; - - do - { - //try to lock, if it doesn't then its busy - if(pthread_mutex_trylock(&theSemaphore.mLock) == PTHREAD_NO_ERROR) - { - if(theSemaphore.mValue > 0) - { - theSemaphore.mValue--; - pthread_mutex_unlock(&theSemaphore.mLock); - return 1; - } - - pthread_mutex_unlock(&theSemaphore.mLock); - } - - if(theTimeoutMs != 0) - msleep(2); - - } while(gsi_is_true(infinite) || ((current_time() - startTime) < theTimeoutMs)); - - return 0; -} - -// Allow other objects to access the semaphore -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - if(pthread_mutex_trylock(&theSemaphore.mLock) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to lock semaphore\r\n"); - - GSI_UNUSED(theReleaseCount); - } - else - { - theSemaphore.mValue += theReleaseCount; - if(theSemaphore.mValue > theSemaphore.mMax) - theSemaphore.mValue = theSemaphore.mMax; - - pthread_mutex_unlock(&theSemaphore.mLock); - } -} - -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - if (pthread_mutex_destroy(&theSemaphore.mLock) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to destroy semaphore\r\n"); - GSI_UNUSED(theSemaphore); - } - - //need to free up memory - gsifree(&theSemaphore.mValue); - gsifree(&theSemaphore.mMax); - gsifree(&theSemaphore); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/linux/gsUtilLinux.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/linux/gsUtilLinux.c deleted file mode 100644 index 537b7426eb4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/linux/gsUtilLinux.c +++ /dev/null @@ -1,17 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return atoll(theNumberStr); -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%lld", theNumber); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/MacOSXCommon.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/MacOSXCommon.c deleted file mode 100644 index d4abb55ef2a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/MacOSXCommon.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "../gsCommon.h" -#include "../gsMemory.h" -#include "../gsDebug.h" - -// sample common entry point -extern int test_main(int argc, char ** argp); - -// Debug output -#ifdef GSI_COMMON_DEBUG -static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - -{ - GSI_UNUSED(theLevel); - { - static char string[256]; - vsprintf(string, theTokenStr, theParamList); - printf(string); - } - printf("[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - - vprintf(theTokenStr, theParamList); -} -#endif - -// Common entry point -int main(int argc, char** argp) -{ - int ret = 0; - // set up memanager - //void *heap = (void*)gsiMemManagedInit(); - -#ifdef GSI_COMMON_DEBUG - // Set up debugging - gsSetDebugCallback(DebugCallback); - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Verbose); -#endif - - ret = test_main(argc, argp); - - //gsiMemManagedClose(heap); - - return ret; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/Makefile deleted file mode 100644 index d39190849b9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -GOA = $(shell pwd)/../.. - -all: - cd '$(GOA)/Chat/chatc/chatmacosx/' ; make clean - cd '$(GOA)/Chat/chatc/chatmacosx/' ; make - cd '$(GOA)/Chat/chatc/chatmacosx/' ; make clean - cd '$(GOA)/Chat/chatc/chatmacosx/' ; make unicode - cd '$(GOA)/gcdkey/gcdkeymacosx/gcdkeyclientmacosx' ; make clean - cd '$(GOA)/gcdkey/gcdkeymacosx/gcdkeyclientmacosx' ; make - cd '$(GOA)/gcdkey/gcdkeymacosx/gcdkeyservermacosx' ; make clean - cd '$(GOA)/gcdkey/gcdkeymacosx/gcdkeyservermacosx' ; make - cd '$(GOA)/ghttp/ghttpc/ghttpmacosx/' ; make clean - cd '$(GOA)/ghttp/ghttpc/ghttpmacosx/' ; make - cd '$(GOA)/ghttp/ghttpc/ghttpmacosx/' ; make clean - cd '$(GOA)/ghttp/ghttpc/ghttpmacosx/' ; make unicode - cd '$(GOA)/GP/gptestc/gpmacosx' ; make clean - cd '$(GOA)/GP/gptestc/gpmacosx' ; make - cd '$(GOA)/GP/gptestc/gpmacosx' ; make clean - cd '$(GOA)/GP/gptestc/gpmacosx' ; make unicode - cd '$(GOA)/gstats/statstest/gstatsmacosx' ; make clean - cd '$(GOA)/gstats/statstest/gstatsmacosx' ; make - cd '$(GOA)/gstats/statstest/gstatsmacosx' ; make clean - cd '$(GOA)/gstats/statstest/gstatsmacosx' ; make unicode - cd '$(GOA)/gstats/persisttest/persistmacosx' ; make clean - cd '$(GOA)/gstats/persisttest/persistmacosx' ; make - cd '$(GOA)/gstats/persisttest/persistmacosx' ; make clean - cd '$(GOA)/gstats/persisttest/persistmacosx' ; make unicode - cd '$(GOA)/gt2/gt2testc/gt2macosx' ; make clean - cd '$(GOA)/gt2/gt2testc/gt2macosx' ; make - cd '$(GOA)/gt2/gt2testc/gt2macosx' ; make clean - cd '$(GOA)/gt2/gt2testc/gt2macosx' ; make unicode - cd '$(GOA)/natneg/simpletest/natnegmacosx' ; make clean - cd '$(GOA)/natneg/simpletest/natnegmacosx' ; make - cd '$(GOA)/Peer/peerc/peermacosx' ; make clean - cd '$(GOA)/Peer/peerc/peermacosx' ; make - cd '$(GOA)/Peer/peerc/peermacosx' ; make clean - cd '$(GOA)/Peer/peerc/peermacosx' ; make unicode - cd '$(GOA)/pt/pttestc/ptmacosx' ; make clean - cd '$(GOA)/pt/pttestc/ptmacosx' ; make - cd '$(GOA)/pt/pttestc/ptmacosx' ; make clean - cd '$(GOA)/pt/pttestc/ptmacosx' ; make unicode - cd '$(GOA)/qr2/qr2csample/qr2macosx' ; make clean - cd '$(GOA)/qr2/qr2csample/qr2macosx' ; make - cd '$(GOA)/qr2/qr2csample/qr2macosx' ; make clean - cd '$(GOA)/qr2/qr2csample/qr2macosx' ; make unicode - cd '$(GOA)/serverbrowsing/sbctest/sbmacosx' ; make clean - cd '$(GOA)/serverbrowsing/sbctest/sbmacosx' ; make - cd '$(GOA)/serverbrowsing/sbctest/sbmacosx' ; make clean - cd '$(GOA)/serverbrowsing/sbctest/sbmacosx' ; make unicode - cd '$(GOA)/Voice2/Voice2Test/gvmacosx' ; make clean - cd '$(GOA)/Voice2/Voice2Test/gvmacosx' ; make - cd '$(GOA)/Voice2/voice2bench/voice2benchmacosx' ; make clean - cd '$(GOA)/Voice2/voice2bench/voice2benchmacosx' ; make diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/Makefile.common b/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/Makefile.common deleted file mode 100644 index 3595117c2e8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/Makefile.common +++ /dev/null @@ -1,33 +0,0 @@ -# OSX Common Makefile -# Copyright 2006 GameSpy Industries - -CC=cc -BASE_CFLAGS=$(DEFINES) $(INCLUDES) -I../ -I../.. - -unicode: UNICODE_CFLAGS = -DGSI_UNICODE -fshort-wchar - -CFLAGS=$(BASE_CFLAGS) $(UNICODE_CFLAGS) -D_MACOSX -DGSI_COMMON_DEBUG -D_NO_NOPORT_H_ -g -O0 -Wall -Werror - -#optimization flags -#CFLAGS=$(BASE_CFLAGS) $(UNICODE_CFLAGS) -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -lpthreads - -############################################################################# -# SETUP AND BUILD -############################################################################# - -$(PROJECT): $(PROG_OBJS) - $(CC) $(CFLAGS) -o $@ $(PROG_OBJS) $(LIBS) - -############################################################################# -# MISC -############################################################################# - -unicode: $(PROJECT) - -clean: - rm -f $(PROG_OBJS) - -depend: - $(CC) -MM $(PROG_OBJS:.o=.c) - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/changelog.txt deleted file mode 100644 index 132e9c76fee..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/changelog.txt +++ /dev/null @@ -1,15 +0,0 @@ -Changelog for: MacOSX Common Code --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -06-03-2005 1.00.03 SN RELEASE Releasing to developer site. -04-28-2005 1.00.03 SN RELEASE Releasing to developer site. -04-04-2005 1.00.03 SN RELEASE Releasing to developer site. -09-30-2004 1.00.03 DES FEATURE Makefile.common can now include defines set in SDK Makefiles. - DES FEATURE Added optional optimization flags to Makefile.common. -09-16-2004 1.00.02 SN RELEASE Releasing to developer site. -08-27-2004 1.00.02 DES FEATURE Makefile also builds unicode versions (where applicable) - DES FEATURE Added a Makefile.common that us used by all other OSX makefiles -08-25-2004 1.00.01 DES FEATURE Added a makefile to build all the test apps on MacOS X. -08-24-2004 1.00.00 DES OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/gsThreadMacOSX.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/gsThreadMacOSX.c deleted file mode 100644 index e0522a5b60f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/gsThreadMacOSX.c +++ /dev/null @@ -1,213 +0,0 @@ -// -// Mac OSX Threading Support (pthreads) -// *same as Linux* -// -// NOTE: when implementing this make sure the "-lpthread" compiler option is used -// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsPlatformUtil.h" -#include "../gsPlatformThread.h" -#include "../gsAssert.h" -#include "../gsDebug.h" -#include - -#define _REENTRANT - -#define PTHREAD_NO_ERROR 0 - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// These functions are unsupported in the current version of the SDK - -gsi_u32 gsiInterlockedIncrement(gsi_u32 * value) -{ - GS_ASSERT_STR(gsi_false, "gsiInterlockIncrement is unsupported for Mac OSX in the current version of the SDK\n"); - return 1; -} - -gsi_u32 gsiInterlockedDecrement(gsi_u32 * value) -{ - GS_ASSERT_STR(gsi_false, "gsiInterlockIncrement is unsupported for Mac OSX in the current version of the SDK\n"); - return 1; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int gsiStartThread(GSThreadFunc func, gsi_u32 theStackSize, void *arg, GSIThreadID * id) -{ - pthread_attr_init(&id->attr); - pthread_attr_setstacksize(&id->attr, theStackSize); - - if (pthread_create(&id->thread, &id->attr, (void *)func, arg) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create thread\r\n"); - return -1; - } - - return 0; -} - -void gsiCancelThread(GSIThreadID id) -{ - //should i destroy the attributes here? - pthread_attr_destroy(&id.attr); - - if (pthread_cancel(id.thread) != PTHREAD_NO_ERROR) { - //there was an error - how should we handle these? or should we? - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to cancel thread\r\n"); - } - //free up memory and set to NULL - - gsifree(&id.thread); -} - -// This must be called from INSIDE the thread you wish to exit -void gsiExitThread(GSIThreadID id) -{ - // detach the thread so that it knows to free resources upon exit - pthread_detach(id.thread); - - // exit thread to free up resources - pthread_exit(NULL); -} - -void gsiCleanupThread(GSIThreadID id) -{ - // destroy any leftover attributes associated with the thread - pthread_attr_destroy(&id.attr); -} - -gsi_u32 gsiHasThreadShutdown(GSIThreadID id) -{ - // pthreads lacks detection mechanism for this - GSI_UNUSED(id); - return 1; -} - -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_init(theCrit, NULL) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to initialize critical section\r\n"); - } -} - -void gsiEnterCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_lock(theCrit) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to lock mutex for entering critical section\r\n"); - } -} - -void gsiLeaveCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_unlock(theCrit) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to unlock mutex for leaving critical section\r\n"); - } -} - -void gsiDeleteCriticalSection(GSICriticalSection *theCrit) -{ - if (pthread_mutex_destroy(theCrit) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to destroy mutex\r\n"); - } - theCrit = NULL; -} - -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - int result; - GSISemaphoreID semaphore; - - //we can use the default attributes for the mutex by passing NULL - result = pthread_mutex_init(&semaphore.mLock, NULL); - - if (result != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create semaphore\r\n"); - } - - semaphore.mValue = theInitialCount; - semaphore.mMax = theMaxCount; - - GSI_UNUSED(theName); - return semaphore; -} - -// Waits for -- and signals -- the semaphore -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - gsi_time startTime = current_time(); - gsi_bool infinite = (theTimeoutMs == GSI_INFINITE)?gsi_true:gsi_false; - - do - { - //try to lock, if it doesn't then its busy - if(pthread_mutex_trylock(&theSemaphore.mLock) == PTHREAD_NO_ERROR) - { - if(theSemaphore.mValue > 0) - { - theSemaphore.mValue--; - pthread_mutex_unlock(&theSemaphore.mLock); - return 1; - } - - pthread_mutex_unlock(&theSemaphore.mLock); - } - - if(theTimeoutMs != 0) - msleep(2); - - } while(gsi_is_true(infinite) || ((current_time() - startTime) < theTimeoutMs)); - - return 0; -} - -// Allow other objects to access the semaphore -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - if(pthread_mutex_trylock(&theSemaphore.mLock) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to lock semaphore\r\n"); - - GSI_UNUSED(theReleaseCount); - } - else - { - theSemaphore.mValue += theReleaseCount; - if(theSemaphore.mValue > theSemaphore.mMax) - theSemaphore.mValue = theSemaphore.mMax; - - pthread_mutex_unlock(&theSemaphore.mLock); - } -} - -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - if (pthread_mutex_destroy(&theSemaphore.mLock) != PTHREAD_NO_ERROR) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to destroy semaphore\r\n"); - GSI_UNUSED(theSemaphore); - } - - //need to free up memory - gsifree(&theSemaphore.mValue); - gsifree(&theSemaphore.mMax); - gsifree(&theSemaphore); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/gsUtilMacOSX.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/gsUtilMacOSX.c deleted file mode 100644 index a5e038ccd90..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/macosx/gsUtilMacOSX.c +++ /dev/null @@ -1,17 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return atoll(theNumberStr); -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%lld", theNumber); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/backup.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/backup.c deleted file mode 100644 index 6b5200dc524..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/backup.c +++ /dev/null @@ -1,185 +0,0 @@ -#include "..\nonport.h" -#include "backup.h" -#include "screen.h" - -//#define SUPPORT_FLASH -//#define SUPPORT_FRAM - -static const CARDBackupType BackupTypes[] = -{ - CARD_BACKUP_TYPE_EEPROM_4KBITS, - CARD_BACKUP_TYPE_EEPROM_64KBITS, - CARD_BACKUP_TYPE_EEPROM_512KBITS, -#if defined(SUPPORT_FLASH) - CARD_BACKUP_TYPE_FLASH_2MBITS, -#endif -#if defined(SUPPORT_FRAM) - CARD_BACKUP_TYPE_FRAM_256KBITS, -#endif -}; -static const char * BackupTypeDescriptions[] = -{ - "EEPROM 4 kb", - "EEPROM 64 kb", - "EEPROM 512 kb", -#if defined(SUPPORT_FLASH) - "FLASH 2 mb", -#endif -#if defined(SUPPORT_FRAM) - "FRAM 256 kb" -#endif -}; -static const int NumBackupTypes = (sizeof(BackupTypes) / sizeof(BackupTypes[0])); -static const CARDBackupType NullBackupType = CARD_BACKUP_TYPE_NOT_USE; - -static CARDBackupType InstalledBackupType; -static int InstalledBackupTypeIndex; - -static u16 LockID; - -static BOOL TestForBackupType(int index) -{ - const CARDBackupType type = BackupTypes[index]; - u32 totalSize; - BOOL result; - u8 buffer; - - Printf("Testing for %s\n", BackupTypeDescriptions[index]); - - CARD_LockBackup(LockID); - { - CARD_IdentifyBackup(type); - - totalSize = CARD_GetBackupTotalSize(); - - // set the buffer - buffer = (u8)(rand() & 0xFF); - - // write the buffer to the card - if(CARD_IsBackupEeprom()) - result = CARD_WriteAndVerifyEeprom(totalSize - 1, &buffer, 1); - else if(CARD_IsBackupFlash()) - result = CARD_WriteAndVerifyFlash(totalSize - 1, &buffer, 1); - else if(CARD_IsBackupFram()) - result = CARD_WriteAndVerifyFram(totalSize - 1, &buffer, 1); - } - CARD_UnlockBackup(LockID); - - return result; -} - -static void DetermineBackupType(void) -{ - int i; - - // determine what, if any, backup type is installed - for(i = 0 ; i < NumBackupTypes ; i++) - { - if(TestForBackupType(i) == TRUE) - { - InstalledBackupType = BackupTypes[i]; - InstalledBackupTypeIndex = i; - return; - } - } - - InstalledBackupType = NullBackupType; - InstalledBackupTypeIndex = -1; -} - -void BackupInit(void) -{ - // get an id for locking the card - s32 lockID = OS_GetLockID(); - if(lockID == OS_LOCK_ID_ERROR) - OS_Panic("OS_GetLockID() failed\n"); - LockID = (u16)lockID; - - // figure out the backup type - DetermineBackupType(); - - // make sure we have the right type identified - if(BackupExists()) - { - CARD_LockBackup(LockID); - { - CARD_IdentifyBackup(InstalledBackupType); - } - CARD_UnlockBackup(LockID); - } - - // show what we detected - if(BackupExists()) - Printf("Backup type: %s\n", BackupTypeDescriptions[InstalledBackupTypeIndex]); - else - Printf("No backup card detected\n"); -} - -BOOL BackupExists(void) -{ - return (InstalledBackupType != NullBackupType)?TRUE:FALSE; -} - -static const int StartPos = 32; - -BOOL WriteToBackup(const void * src, int len) -{ - BOOL result; - - if(!BackupExists()) - return FALSE; - - CARD_LockBackup(LockID); - - if(CARD_IsBackupEeprom()) - result = CARD_WriteAndVerifyEeprom(StartPos, src, (u32)len); - else if(CARD_IsBackupFlash()) - result = CARD_WriteAndVerifyFlash(StartPos, src, (u32)len); - else if(CARD_IsBackupFram()) - result = CARD_WriteAndVerifyFram(StartPos, src, (u32)len); - else - result = FALSE; - - CARD_UnlockBackup(LockID); - - if(result == FALSE) - { - u32 code = CARD_GetResultCode(); - Printf("CARD-WRITE-FAILURE: %d\n", code); - while(1) - ; - } - - return result; -} - -BOOL ReadFromBackup(void * dst, int len) -{ - BOOL result; - - if(!BackupExists()) - return FALSE; - - CARD_LockBackup(LockID); - - if(CARD_IsBackupEeprom()) - result = CARD_ReadEeprom(StartPos, dst, (u32)len); - else if(CARD_IsBackupFlash()) - result = CARD_ReadFlash(StartPos, dst, (u32)len); - else if(CARD_IsBackupFram()) - result = CARD_ReadFram(StartPos, dst, (u32)len); - else - result = FALSE; - - CARD_UnlockBackup(LockID); - - if(result == FALSE) - { - u32 code = CARD_GetResultCode(); - Printf("CARD-READ-FAILURE: %d\n", code); - while(1) - ; - } - - return result; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/backup.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/backup.h deleted file mode 100644 index b5a7854d924..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/backup.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _BACKUP_H_ -#define _BACKUP_H_ - -void BackupInit(void); - -BOOL BackupExists(void); - -BOOL WriteToBackup(const void * src, int len); -BOOL ReadFromBackup(void * dst, int len); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/changelog.txt deleted file mode 100644 index fabc5db84ce..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/changelog.txt +++ /dev/null @@ -1,28 +0,0 @@ -Changelog for: Nitro (Nintendo DS) Common Code --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -05-17-2006 1.00.05 DES UPDATE Updated to use gsTestMain - DES FEATURE Added gmtime and ctime - DES FEATURE Added gsiInterlockedIncrement/Decrement -11-17-2005 1.00.04 DES FIX Updated sample project and common workspace. - DES CLEANUP Now using SOC_ instead of SO_. -09-21-2005 1.00.03 DES FEATURE Added support for more backup types - DES FIX Updated thread support - DES FIX nitrosample now uses the gmtest gamename -06-03-2005 1.00.02 SN RELEASE Releasing to developer site. -04-28-2005 1.00.02 SN RELEASE Releasing to developer site. -04-27-2005 1.00.02 DES RELEASE Limited release to Nintendo DS developers. -04-27-2005 1.00.02 DES CLEANUP The backup code now only checks for flash backup - if SUPPORT_FLASH is defined. - DES FEATURE Cosmetic changes to nitrosample and launcher code. - DES FIX Changed SDK_IRQ_STACKSIZE in nitro.lcf files to 4096. - DES FEATURE printf()'s can now be directed to the screen and/or the debugger. - DES FEATURE Updates to work with the latest NitroInet. - DES FEATURE Added nitrocommon.cww, workspace for CW with all test apps. -04-11-2005 1.00.01 DES CLEANUP Removed 232-bit WEP key, which is no longer supported by Nitro. - DES FEATURE Show a default network config if no backup memory is detected. - DES FIX Fixed bug with showing the failure reason in nitrosample. - DES FIX Fixed bug in handling Peer errors in nitrosample. -04-04-2005 1.00.00 DES OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/font.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/font.c deleted file mode 100644 index 58613576d64..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/font.c +++ /dev/null @@ -1,587 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: NitroSDK - RTC - demos - File: font.c - - Copyright 2003,2004 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Log: font.c,v $ - Revision 1.2 2004/11/02 07:19:52 terui - Fixed spelling mistakes in comments. - - Revision 1.1 2004/05/12 02:38:49 terui - initial upload - - $NoKeywords: $ - *---------------------------------------------------------------------------*/ - -#include "font.h" - - -/*---------------------------------------------------------------------------* - Character data - *---------------------------------------------------------------------------*/ -const u32 d_CharData[ 8 * 256 ] = -{ - 0x00000000,0x00000000,0x00000000,0x00000000, // 0000h - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x01010010,0x01010010,0x00000110, // 0001h - 0x00011010,0x01100010,0x00000010,0x00000010, - 0x00000000,0x01011010,0x01010010,0x00010010, // 0002h - 0x00100010,0x00100010,0x00100001,0x00100001, - 0x00000000,0x01010001,0x01010001,0x01111111, // 0003h - 0x00000001,0x00000001,0x00000001,0x01111110, - 0x00000000,0x01010000,0x01111111,0x00100000, // 0004h - 0x00100000,0x00010000,0x00001000,0x00000110, - 0x00000000,0x01010000,0x01010100,0x00001010, // 0005h - 0x00010001,0x00100001,0x01000000,0x00000000, - 0x00000000,0x01011000,0x01011000,0x01111111, // 0006h - 0x00001000,0x00101010,0x01001010,0x01001001, - 0x00000000,0x01010010,0x01101111,0x01010010, // 0007h - 0x00010010,0x00010010,0x00010010,0x00001001, - 0x00000000,0x01010010,0x01011111,0x00000100, // 0008h - 0x00011111,0x00001000,0x00000001,0x00011110, - 0x00000000,0x01010000,0x01011000,0x00000110, // 0009h - 0x00000001,0x00000110,0x00011000,0x00100000, - 0x00000000,0x01010000,0x01111101,0x00010001, // 000ah - 0x00010001,0x00010001,0x00010001,0x00001010, - 0x00000000,0x01010000,0x01011110,0x00100000, // 000bh - 0x00000000,0x00000001,0x00000001,0x00111110, - 0x00000000,0x01010100,0x01011111,0x00001000, // 000ch - 0x00010000,0x00000001,0x00000001,0x00011110, - 0x00000000,0x01010001,0x01010001,0x00000001, // 000dh - 0x01000001,0x01000001,0x00100010,0x00011100, - 0x00000000,0x01010000,0x01111111,0x00011000, // 000eh - 0x00010100,0x00010100,0x00011000,0x00001100, - 0x00000000,0x01010010,0x01111111,0x00010010, // 000fh - 0x00010010,0x00000010,0x00000010,0x00111100, - 0x00000000,0x00001110,0x01010100,0x01010010, // 0010h - 0x00111111,0x00000100,0x00000100,0x00011000, - 0x00000000,0x01010100,0x01011111,0x00000100, // 0011h - 0x01110100,0x00000010,0x00001010,0x01110010, - 0x00000000,0x01010100,0x01011111,0x00000010, // 0012h - 0x00011110,0x00100001,0x00100000,0x00011110, - 0x00000000,0x01010000,0x01011100,0x00100011, // 0013h - 0x01000000,0x01000000,0x00100000,0x00011100, - 0x00000000,0x01010000,0x01111111,0x00010000, // 0014h - 0x00001000,0x00001000,0x00001000,0x00110000, - 0x00000000,0x01010010,0x01010010,0x00001100, // 0015h - 0x00000010,0x00000001,0x00000001,0x00111110, - 0x00000000,0x01010001,0x01111101,0x00010001, // 0016h - 0x00010001,0x00111001,0x01010101,0x00011001, - 0x00000000,0x01010100,0x01010011,0x01110010, // 0017h - 0x00010001,0x00010001,0x00001010,0x00000100, - 0x00000000,0x01011110,0x01011000,0x00000100, // 0018h - 0x00101001,0x01010001,0x01010001,0x00001100, - 0x00000000,0x01010000,0x01011100,0x00010010, // 0019h - 0x00010010,0x00100001,0x01000000,0x00000000, - 0x00000000,0x01011101,0x01010001,0x00111101, // 001ah - 0x00010001,0x00011001,0x00110101,0x00001001, - 0x00000000,0x01110001,0x01011101,0x00110001, // 001bh - 0x00010001,0x00111001,0x01010101,0x00011001, - 0x00000000,0x01110100,0x01010011,0x00110010, // 001ch - 0x00010001,0x00010001,0x00001010,0x00000100, - 0x00000000,0x01101110,0x01011000,0x00100100, // 001dh - 0x00101001,0x01010001,0x01010001,0x00001100, - 0x00000000,0x01110000,0x01011100,0x00110010, // 001eh - 0x00010010,0x00100001,0x01000000,0x00000000, - 0x00000000,0x01111101,0x01010001,0x00111101, // 001fh - 0x00010001,0x00011001,0x00110101,0x00001001, - 0x00000000,0x00000000,0x00000000,0x00000000, // 0020h - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00001000,0x00001000,0x00001000, // 0021h - 0x00001000,0x00001000,0x00000000,0x00001000, - 0x00000000,0x01101100,0x01001000,0x00100100, // 0022h - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00100100,0x01111111,0x00100100, // 0023h - 0x00100100,0x01111111,0x00010010,0x00010010, - 0x00000000,0x00001000,0x01111110,0x00001001, // 0024h - 0x00111110,0x01001000,0x00111111,0x00001000, - 0x00000000,0x01000010,0x00100101,0x00010010, // 0025h - 0x00001000,0x00100100,0x01010010,0x00100001, - 0x00000000,0x00001110,0x00010001,0x00001001, // 0026h - 0x01000110,0x00101001,0x00110001,0x01001110, - 0x00000000,0x00011000,0x00010000,0x00001000, // 0027h - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x01110000,0x00001000,0x00000100, // 0028h - 0x00000100,0x00000100,0x00001000,0x01110000, - 0x00000000,0x00000111,0x00001000,0x00010000, // 0029h - 0x00010000,0x00010000,0x00001000,0x00000111, - 0x00000000,0x00001000,0x01001001,0x00101010, // 002ah - 0x00011100,0x00101010,0x01001001,0x00001000, - 0x00000000,0x00001000,0x00001000,0x00001000, // 002bh - 0x01111111,0x00001000,0x00001000,0x00001000, - 0x00000000,0x00000000,0x00000000,0x00000000, // 002ch - 0x00000000,0x00001100,0x00001000,0x00000100, - 0x00000000,0x00000000,0x00000000,0x00000000, // 002dh - 0x01111111,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00000000,0x00000000,0x00000000, // 002eh - 0x00000000,0x00000000,0x00000000,0x00001100, - 0x00000000,0x01000000,0x00100000,0x00010000, // 002fh - 0x00001000,0x00000100,0x00000010,0x00000001, - 0x00000000,0x00111110,0x01000001,0x01000001, // 0030h - 0x01000001,0x01000001,0x01000001,0x00111110, - 0x00000000,0x00011100,0x00010000,0x00010000, // 0031h - 0x00010000,0x00010000,0x00010000,0x00010000, - 0x00000000,0x00111110,0x01000001,0x01000000, // 0032h - 0x00111110,0x00000001,0x00000001,0x01111111, - 0x00000000,0x00111110,0x01000001,0x01000000, // 0033h - 0x00111110,0x01000000,0x01000001,0x00111110, - 0x00000000,0x00100000,0x00110000,0x00101000, // 0034h - 0x00100100,0x00100010,0x01111111,0x00100000, - 0x00000000,0x01111111,0x00000001,0x00111111, // 0035h - 0x01000000,0x01000000,0x01000001,0x00111110, - 0x00000000,0x00111110,0x00000001,0x00111111, // 0036h - 0x01000001,0x01000001,0x01000001,0x00111110, - 0x00000000,0x01111111,0x00100000,0x00100000, // 0037h - 0x00010000,0x00010000,0x00001000,0x00001000, - 0x00000000,0x00111110,0x01000001,0x01000001, // 0038h - 0x00111110,0x01000001,0x01000001,0x00111110, - 0x00000000,0x00111110,0x01000001,0x01000001, // 0039h - 0x01000001,0x01111110,0x01000000,0x00111110, - 0x00000000,0x00000000,0x00001100,0x00000000, // 003ah - 0x00000000,0x00000000,0x00001100,0x00000000, - 0x00000000,0x00000000,0x00001100,0x00000000, // 003bh - 0x00000000,0x00001100,0x00001000,0x00000100, - 0x00000000,0x01100000,0x00011000,0x00000110, // 003ch - 0x00000001,0x00000110,0x00011000,0x01100000, - 0x00000000,0x00000000,0x01111111,0x00000000, // 003dh - 0x00000000,0x00000000,0x01111111,0x00000000, - 0x00000000,0x00000011,0x00001100,0x00110000, // 003eh - 0x01000000,0x00110000,0x00001100,0x00000011, - 0x00000000,0x00111110,0x01000001,0x01000001, // 003fh - 0x00110000,0x00001000,0x00000000,0x00001000, - 0x00000000,0x00011100,0x00100010,0x01001001, // 0040h - 0x01010101,0x01010101,0x01010101,0x00111010, - 0x00000000,0x00001000,0x00010100,0x00010100, // 0041h - 0x00100010,0x00111110,0x01000001,0x01000001, - 0x00000000,0x00111111,0x01000001,0x01000001, // 0042h - 0x00111111,0x01000001,0x01000001,0x00111111, - 0x00000000,0x00111100,0x01000010,0x00000001, // 0043h - 0x00000001,0x00000001,0x01000010,0x00111100, - 0x00000000,0x00011111,0x00100001,0x01000001, // 0044h - 0x01000001,0x01000001,0x00100001,0x00011111, - 0x00000000,0x01111111,0x00000001,0x00000001, // 0045h - 0x01111111,0x00000001,0x00000001,0x01111111, - 0x00000000,0x01111111,0x00000001,0x00000001, // 0046h - 0x00111111,0x00000001,0x00000001,0x00000001, - 0x00000000,0x00111100,0x01000010,0x00000001, // 0047h - 0x01111001,0x01000001,0x01000010,0x00111100, - 0x00000000,0x01000001,0x01000001,0x01000001, // 0048h - 0x01111111,0x01000001,0x01000001,0x01000001, - 0x00000000,0x00111110,0x00001000,0x00001000, // 0049h - 0x00001000,0x00001000,0x00001000,0x00111110, - 0x00000000,0x01000000,0x01000000,0x01000000, // 004ah - 0x01000001,0x01000001,0x00100010,0x00011100, - 0x00000000,0x01100001,0x00011001,0x00000101, // 004bh - 0x00000011,0x00000101,0x00011001,0x01100001, - 0x00000000,0x00000001,0x00000001,0x00000001, // 004ch - 0x00000001,0x00000001,0x00000001,0x01111111, - 0x00000000,0x01000001,0x01100011,0x01010101, // 004dh - 0x01001001,0x01000001,0x01000001,0x01000001, - 0x00000000,0x01000001,0x01000011,0x01000101, // 004eh - 0x01001001,0x01010001,0x01100001,0x01000001, - 0x00000000,0x00011100,0x00100010,0x01000001, // 004fh - 0x01000001,0x01000001,0x00100010,0x00011100, - 0x00000000,0x00111111,0x01000001,0x01000001, // 0050h - 0x00111111,0x00000001,0x00000001,0x00000001, - 0x00000000,0x00011100,0x00100010,0x01000001, // 0051h - 0x01000001,0x01011001,0x00100010,0x01011100, - 0x00000000,0x00111111,0x01000001,0x01000001, // 0052h - 0x00111111,0x01000001,0x01000001,0x01000001, - 0x00000000,0x00111110,0x01000001,0x00000001, // 0053h - 0x00111110,0x01000000,0x01000001,0x00111110, - 0x00000000,0x01111111,0x00001000,0x00001000, // 0054h - 0x00001000,0x00001000,0x00001000,0x00001000, - 0x00000000,0x01000001,0x01000001,0x01000001, // 0055h - 0x01000001,0x01000001,0x00100010,0x00011100, - 0x00000000,0x01000001,0x01000001,0x00100010, // 0056h - 0x00100010,0x00010100,0x00010100,0x00001000, - 0x00000000,0x01000001,0x01000001,0x01000001, // 0057h - 0x01001001,0x01010101,0x01100011,0x01000001, - 0x00000000,0x01000001,0x00100010,0x00010100, // 0058h - 0x00001000,0x00010100,0x00100010,0x01000001, - 0x00000000,0x01000001,0x00100010,0x00010100, // 0059h - 0x00001000,0x00001000,0x00001000,0x00001000, - 0x00000000,0x01111111,0x00100000,0x00010000, // 005ah - 0x00001000,0x00000100,0x00000010,0x01111111, - 0x00000000,0x01111100,0x00000100,0x00000100, // 005bh - 0x00000100,0x00000100,0x00000100,0x01111100, - 0x00000000,0x00100010,0x00010100,0x00111110, // 005ch - 0x00001000,0x00111110,0x00001000,0x00001000, - 0x00000000,0x00011111,0x00010000,0x00010000, // 005dh - 0x00010000,0x00010000,0x00010000,0x00011111, - 0x00000000,0x00001000,0x00010100,0x00100010, // 005eh - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00000000,0x00000000,0x00000000, // 005fh - 0x00000000,0x00000000,0x00000000,0x01111111, - 0x00000000,0x00010000,0x00001000,0x00011000, // 0060h - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00000000,0x00011110,0x00100001, // 0061h - 0x00111110,0x00100001,0x00100001,0x01011110, - 0x00000000,0x00000001,0x00000001,0x00111111, // 0062h - 0x01000001,0x01000001,0x01000001,0x00111111, - 0x00000000,0x00000000,0x00111100,0x01000010, // 0063h - 0x00000001,0x00000001,0x01000010,0x00111100, - 0x00000000,0x01000000,0x01000000,0x01111110, // 0064h - 0x01000001,0x01000001,0x01000001,0x01111110, - 0x00000000,0x00000000,0x00111110,0x01000001, // 0065h - 0x01111111,0x00000001,0x01000001,0x00111110, - 0x00000000,0x00110000,0x00001000,0x00001000, // 0066h - 0x01111111,0x00001000,0x00001000,0x00001000, - 0x00000000,0x00000000,0x01111110,0x01000001, // 0067h - 0x01000001,0x01111110,0x01000000,0x00111110, - 0x00000000,0x00000001,0x00000001,0x00000001, // 0068h - 0x00111111,0x01000001,0x01000001,0x01000001, - 0x00000000,0x00001000,0x00000000,0x00001000, // 0069h - 0x00001000,0x00001000,0x00001000,0x00001000, - 0x00000000,0x00100000,0x00000000,0x00100000, // 006ah - 0x00100000,0x00100001,0x00100001,0x00011110, - 0x00000000,0x00000001,0x00000001,0x01100001, // 006bh - 0x00011001,0x00000111,0x00011001,0x01100001, - 0x00000000,0x00001000,0x00001000,0x00001000, // 006ch - 0x00001000,0x00001000,0x00001000,0x00001000, - 0x00000000,0x00000000,0x00110111,0x01001001, // 006dh - 0x01001001,0x01001001,0x01001001,0x01001001, - 0x00000000,0x00000000,0x00111111,0x01000001, // 006eh - 0x01000001,0x01000001,0x01000001,0x01000001, - 0x00000000,0x00000000,0x00011100,0x00100010, // 006fh - 0x01000001,0x01000001,0x00100010,0x00011100, - 0x00000000,0x00000000,0x00111101,0x01000011, // 0070h - 0x01000001,0x01000011,0x00111101,0x00000001, - 0x00000000,0x00000000,0x01011110,0x01100001, // 0071h - 0x01000001,0x01100001,0x01011110,0x01000000, - 0x00000000,0x00000000,0x00110001,0x00001101, // 0072h - 0x00000011,0x00000001,0x00000001,0x00000001, - 0x00000000,0x00000000,0x00111110,0x01000001, // 0073h - 0x00001110,0x00110000,0x01000001,0x00111110, - 0x00000000,0x00000100,0x00000100,0x01111111, // 0074h - 0x00000100,0x00000100,0x00000100,0x01111000, - 0x00000000,0x00000000,0x01000001,0x01000001, // 0075h - 0x01000001,0x01000001,0x01000001,0x01111110, - 0x00000000,0x00000000,0x01000001,0x01000001, // 0076h - 0x00100010,0x00100010,0x00010100,0x00001000, - 0x00000000,0x00000000,0x01000001,0x01000001, // 0077h - 0x01001001,0x00101010,0x00101010,0x00010100, - 0x00000000,0x00000000,0x00100001,0x00010010, // 0078h - 0x00001100,0x00001100,0x00010010,0x00100001, - 0x00000000,0x00000000,0x01000001,0x01000001, // 0079h - 0x00100010,0x00011100,0x00001000,0x00000110, - 0x00000000,0x00000000,0x00111111,0x00010000, // 007ah - 0x00001000,0x00000100,0x00000010,0x00111111, - 0x00000000,0x00001000,0x00011110,0x01100100, // 007bh - 0x00011000,0x00100100,0x00000100,0x01111000, - 0x00000000,0x00000000,0x00011110,0x00000100, // 007ch - 0x00011110,0x00110101,0x00101101,0x00010010, - 0x00000000,0x00000000,0x00000000,0x00010001, // 007dh - 0x00100001,0x00100001,0x00000001,0x00000010, - 0x00000000,0x00000000,0x00011100,0x00000000, // 007eh - 0x00011110,0x00100000,0x00100000,0x00011100, - 0x00000000,0x00000000,0x00011100,0x00000000, // 007fh - 0x00111110,0x00010000,0x00001100,0x00110010, - 0x00000000,0x00000000,0x00000100,0x00101111, // 0080h - 0x01000100,0x00011110,0x00100101,0x00010110, - 0x00000000,0x00000000,0x00001010,0x00011110, // 0081h - 0x00101011,0x00100010,0x00010100,0x00000100, - 0x00000000,0x00000000,0x00001000,0x00011101, // 0082h - 0x00101011,0x00101001,0x00011001,0x00000100, - 0x00000000,0x00000000,0x00001000,0x00111000, // 0083h - 0x00001000,0x00011110,0x00101001,0x00000110, - 0x00000000,0x00000000,0x00000000,0x00011100, // 0084h - 0x00100011,0x00100000,0x00100000,0x00011100, - 0x00000000,0x00000110,0x01001001,0x00110000, // 0085h - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00000100,0x00111111,0x00000100, // 0086h - 0x00111110,0x01010101,0x01001101,0x00100110, - 0x00000000,0x00000000,0x00100001,0x01000001, // 0087h - 0x01000001,0x01000001,0x00000001,0x00000010, - 0x00000000,0x00111100,0x00000000,0x00111110, // 0088h - 0x01000000,0x01000000,0x00100000,0x00011100, - 0x00000000,0x00011100,0x00000000,0x00111110, // 0089h - 0x00010000,0x00001000,0x00010100,0x01100010, - 0x00000000,0x00100100,0x01011111,0x00000100, // 008ah - 0x00111110,0x01000101,0x01000101,0x00100010, - 0x00000000,0x00100010,0x01001111,0x01010010, // 008bh - 0x01010010,0x00010010,0x00010010,0x00001001, - 0x00000000,0x00000100,0x00111110,0x00001000, // 008ch - 0x00111110,0x00010000,0x00000010,0x00111100, - 0x00000000,0x00100000,0x00011000,0x00000110, // 008dh - 0x00000001,0x00000110,0x00011000,0x00100000, - 0x00000000,0x00100000,0x01111101,0x00100001, // 008eh - 0x00100001,0x00100001,0x00100001,0x00010010, - 0x00000000,0x00011110,0x00100000,0x00000000, // 008fh - 0x00000000,0x00000001,0x00000001,0x00111110, - 0x00000000,0x00001000,0x01111111,0x00010000, // 0090h - 0x00100000,0x00000010,0x00000010,0x00111100, - 0x00000000,0x00000001,0x00000001,0x00000001, // 0091h - 0x01000001,0x01000001,0x00100010,0x00011100, - 0x00000000,0x00010000,0x01111111,0x00011000, // 0092h - 0x00010100,0x00010100,0x00011000,0x00001100, - 0x00000000,0x00100010,0x01111111,0x00100010, // 0093h - 0x00100010,0x00000010,0x00000010,0x01111100, - 0x00000000,0x00111100,0x00010000,0x00001100, // 0094h - 0x01111111,0x00001000,0x00001000,0x00110000, - 0x00000000,0x00000100,0x00011111,0x00000100, // 0095h - 0x01110100,0x00000010,0x00001010,0x01110010, - 0x00000000,0x00001000,0x01111111,0x00000100, // 0096h - 0x00111100,0x01000010,0x01000000,0x00111100, - 0x00000000,0x00000000,0x00011100,0x00100011, // 0097h - 0x01000000,0x01000000,0x00100000,0x00011100, - 0x00000000,0x01111111,0x00010000,0x00001000, // 0098h - 0x00001000,0x00001000,0x00001000,0x00110000, - 0x00000000,0x00000010,0x00110010,0x00001100, // 0099h - 0x00000010,0x00000001,0x00000001,0x00111110, - 0x00000000,0x00100100,0x01001111,0x01000010, // 009ah - 0x00010001,0x00111100,0x00010010,0x00001100, - 0x00000000,0x00000010,0x01111010,0x01000010, // 009bh - 0x00000010,0x00000010,0x00001010,0x01110010, - 0x00000000,0x00100010,0x00111110,0x01010010, // 009ch - 0x01001011,0x01101101,0x01010101,0x00110010, - 0x00000000,0x00110010,0x01001011,0x01000110, // 009dh - 0x01000110,0x01110010,0x01001011,0x00110010, - 0x00000000,0x00011100,0x00101010,0x01001001, // 009eh - 0x01001001,0x01000101,0x01000101,0x00110010, - 0x00000000,0x00100001,0x01111101,0x00100001, // 009fh - 0x00100001,0x00111001,0x01100101,0x00011001, - 0x00000000,0x00000100,0x00100011,0x01100010, // 00a0h - 0x00100001,0x00100001,0x00010010,0x00001100, - 0x00000000,0x00000000,0x00000000,0x00000000, // 00a1h - 0x00000000,0x00000100,0x00001010,0x00000100, - 0x00000000,0x01110000,0x00010000,0x00010000, // 00a2h - 0x00010000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00000000,0x00000000,0x00000000, // 00a3h - 0x00001000,0x00001000,0x00001000,0x00001110, - 0x00000000,0x00000000,0x00000000,0x00000000, // 00a4h - 0x00000000,0x00000010,0x00000100,0x00000100, - 0x00000000,0x00000000,0x00000000,0x00011000, // 00a5h - 0x00011000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x01111111,0x01000000,0x01111111, // 00a6h - 0x01000000,0x01000000,0x00100000,0x00011100, - 0x00000000,0x00000000,0x00111111,0x00100000, // 00a7h - 0x00010100,0x00001100,0x00000100,0x00000010, - 0x00000000,0x00000000,0x00100000,0x00100000, // 00a8h - 0x00010000,0x00001111,0x00001000,0x00001000, - 0x00000000,0x00000000,0x00000100,0x00111111, // 00a9h - 0x00100001,0x00100000,0x00010000,0x00001100, - 0x00000000,0x00000000,0x00000000,0x00111110, // 00aah - 0x00001000,0x00001000,0x00001000,0x01111111, - 0x00000000,0x00000000,0x00010000,0x00111111, // 00abh - 0x00011000,0x00010100,0x00010010,0x00011001, - 0x00000000,0x00000000,0x00000010,0x00111111, // 00ach - 0x00100010,0x00010010,0x00000100,0x00000100, - 0x00000000,0x00000000,0x00000000,0x00111110, // 00adh - 0x00100000,0x00100000,0x00100000,0x01111111, - 0x00000000,0x00000000,0x00111110,0x00100000, // 00aeh - 0x00111110,0x00100000,0x00100000,0x00111110, - 0x00000000,0x00000000,0x00100101,0x00101010, // 00afh - 0x00101010,0x00100000,0x00010000,0x00001110, - 0x00000000,0x00000000,0x00000000,0x00000000, // 00b0h - 0x01111111,0x00000000,0x00000000,0x00000000, - 0x00000000,0x01111111,0x01000000,0x00101000, // 00b1h - 0x00011000,0x00001000,0x00001000,0x00000100, - 0x00000000,0x01000000,0x00100000,0x00011000, // 00b2h - 0x00010111,0x00010000,0x00010000,0x00010000, - 0x00000000,0x00001000,0x01111111,0x01000001, // 00b3h - 0x01000001,0x01000000,0x00100000,0x00011000, - 0x00000000,0x00000000,0x00111110,0x00001000, // 00b4h - 0x00001000,0x00001000,0x00001000,0x01111111, - 0x00000000,0x00100000,0x01111111,0x00110000, // 00b5h - 0x00101000,0x00100100,0x00100010,0x00110001, - 0x00000000,0x00000100,0x01111111,0x01000100, // 00b6h - 0x01000100,0x01000100,0x01000010,0x00100001, - 0x00000000,0x00000100,0x00111111,0x00001000, // 00b7h - 0x01111111,0x00010000,0x00010000,0x00010000, - 0x00000000,0x01111100,0x01000100,0x01000100, // 00b8h - 0x01000010,0x01000000,0x00100000,0x00011000, - 0x00000000,0x00000010,0x01111110,0x00100010, // 00b9h - 0x00100001,0x00100000,0x00010000,0x00001100, - 0x00000000,0x01111110,0x01000000,0x01000000, // 00bah - 0x01000000,0x01000000,0x01000000,0x01111110, - 0x00000000,0x00100010,0x01111111,0x00100010, // 00bbh - 0x00100010,0x00100000,0x00010000,0x00001100, - 0x00000000,0x00000011,0x00000100,0x01000011, // 00bch - 0x01000100,0x00100000,0x00011000,0x00000111, - 0x00000000,0x01111111,0x01000000,0x00100000, // 00bdh - 0x00010000,0x00011000,0x00100100,0x01000011, - 0x00000000,0x00000010,0x01111111,0x01000010, // 00beh - 0x00100010,0x00000010,0x00000010,0x01111100, - 0x00000000,0x01000001,0x01000010,0x01000000, // 00bfh - 0x00100000,0x00100000,0x00011000,0x00000110, - 0x00000000,0x01111110,0x01000010,0x01001110, // 00c0h - 0x01110001,0x01000000,0x00100000,0x00011000, - 0x00000000,0x01100000,0x00011110,0x00010000, // 00c1h - 0x01111111,0x00010000,0x00010000,0x00001100, - 0x00000000,0x01000101,0x01001010,0x01001010, // 00c2h - 0x01000000,0x00100000,0x00010000,0x00001110, - 0x00000000,0x00111110,0x00000000,0x01111111, // 00c3h - 0x00010000,0x00010000,0x00001000,0x00000110, - 0x00000000,0x00000010,0x00000010,0x00000110, // 00c4h - 0x00011010,0x01100010,0x00000010,0x00000010, - 0x00000000,0x00010000,0x00010000,0x01111111, // 00c5h - 0x00010000,0x00010000,0x00001000,0x00000110, - 0x00000000,0x00000000,0x00111110,0x00000000, // 00c6h - 0x00000000,0x00000000,0x00000000,0x01111111, - 0x00000000,0x01111110,0x01000000,0x01000100, // 00c7h - 0x00101000,0x00010000,0x00101000,0x01000110, - 0x00000000,0x00001000,0x01111111,0x00100000, // 00c8h - 0x00010000,0x00011100,0x01101011,0x00001000, - 0x00000000,0x01000000,0x01000000,0x01000000, // 00c9h - 0x00100000,0x00100000,0x00011000,0x00000111, - 0x00000000,0x00010010,0x00100010,0x00100010, // 00cah - 0x01000010,0x01000010,0x01000001,0x01000001, - 0x00000000,0x00000001,0x00000001,0x01111111, // 00cbh - 0x00000001,0x00000001,0x00000001,0x01111110, - 0x00000000,0x01111111,0x01000000,0x01000000, // 00cch - 0x01000000,0x00100000,0x00010000,0x00001110, - 0x00000000,0x00000000,0x00000100,0x00001010, // 00cdh - 0x00010001,0x00100001,0x01000000,0x00000000, - 0x00000000,0x00001000,0x00001000,0x01111111, // 00ceh - 0x00001000,0x00101010,0x01001010,0x01001001, - 0x00000000,0x01111111,0x01000000,0x01000000, // 00cfh - 0x00100010,0x00010100,0x00001000,0x00010000, - 0x00000000,0x00001110,0x01110000,0x00001110, // 00d0h - 0x01110000,0x00000110,0x00011000,0x01100000, - 0x00000000,0x00001000,0x00001000,0x00000100, // 00d1h - 0x00000100,0x00100010,0x01000010,0x01111111, - 0x00000000,0x01000000,0x01000000,0x00100100, // 00d2h - 0x00101000,0x00010000,0x00101100,0x01000011, - 0x00000000,0x01111111,0x00000100,0x01111111, // 00d3h - 0x00000100,0x00000100,0x00000100,0x01111000, - 0x00000000,0x00000010,0x01111111,0x01000010, // 00d4h - 0x00100010,0x00010100,0x00000100,0x00000100, - 0x00000000,0x00000000,0x00111110,0x00100000, // 00d5h - 0x00100000,0x00100000,0x00100000,0x01111111, - 0x00000000,0x01111110,0x01000000,0x01000000, // 00d6h - 0x01111110,0x01000000,0x01000000,0x01111110, - 0x00000000,0x00111110,0x00000000,0x01111111, // 00d7h - 0x01000000,0x01000000,0x00100000,0x00011100, - 0x00000000,0x01000010,0x01000010,0x01000010, // 00d8h - 0x01000010,0x01000000,0x00100000,0x00011000, - 0x00000000,0x00001010,0x00001010,0x00001010, // 00d9h - 0x01001010,0x01001010,0x00101010,0x00011001, - 0x00000000,0x00000010,0x00000010,0x01000010, // 00dah - 0x01000010,0x00100010,0x00010010,0x00001110, - 0x00000000,0x01111111,0x01000001,0x01000001, // 00dbh - 0x01000001,0x01000001,0x01000001,0x01111111, - 0x00000000,0x01111111,0x01000001,0x01000001, // 00dch - 0x01000000,0x01000000,0x00100000,0x00011100, - 0x00000000,0x01000011,0x01000100,0x01000000, // 00ddh - 0x01000000,0x00100000,0x00010000,0x00001111, - 0x00000000,0x00000000,0x00000000,0x00000000, // 00deh - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00000000,0x00000000,0x00000000, // 00dfh - 0x00000000,0x00000000,0x00000000,0x00000000, - 0x00000000,0x00011110,0x00001000,0x00000100, // 00e0h - 0x00101001,0x01010001,0x01010001,0x00001100, - 0x00000000,0x00000000,0x00001100,0x00010010, // 00e1h - 0x00010010,0x00100001,0x01000000,0x00000000, - 0x00000000,0x01111101,0x00100001,0x01111101, // 00e2h - 0x00100001,0x00111001,0x01100101,0x00011001, - 0x00000000,0x00111100,0x00010000,0x00111100, // 00e3h - 0x00010000,0x00011100,0x00110010,0x00001100, - 0x00000000,0x00001110,0x00101000,0x00101000, // 00e4h - 0x00111110,0x01100101,0x00100101,0x00010010, - 0x00000000,0x00000100,0x00101111,0x01000100, // 00e5h - 0x00000110,0x01000101,0x01000101,0x00111110, - 0x00000000,0x00100010,0x00100010,0x00111110, // 00e6h - 0x01010010,0x01010101,0x01001101,0x00100110, - 0x00000000,0x00000100,0x00011111,0x00000010, // 00e7h - 0x00011111,0x01000010,0x01000010,0x00111100, - 0x00000000,0x00010010,0x00111110,0x01010011, // 00e8h - 0x01000010,0x00100100,0x00000100,0x00000100, - 0x00000000,0x00001000,0x00111101,0x01001011, // 00e9h - 0x01001001,0x01001001,0x00111000,0x00000100, - 0x00000000,0x00001000,0x00111000,0x00001000, // 00eah - 0x00001000,0x00011110,0x00101001,0x00000110, - 0x00000000,0x00011000,0x00100000,0x00000100, // 00ebh - 0x00111010,0x01000110,0x01000000,0x00111000, - 0x00000000,0x01000010,0x01000010,0x01000010, // 00ech - 0x01000110,0x01000000,0x00100000,0x00011000, - 0x00000000,0x00111110,0x00010000,0x00111100, // 00edh - 0x01000011,0x01001100,0x01010010,0x00111100, - 0x00000000,0x00100010,0x00110011,0x00101010, // 00eeh - 0x00100110,0x00100010,0x00100011,0x01000010, - 0x00000000,0x00111110,0x00010000,0x00111100, // 00efh - 0x01000011,0x01000000,0x01000010,0x00111100, - 0x00000000,0x00000010,0x00111011,0x01000110, // 00f0h - 0x01000010,0x01000011,0x01000010,0x00110010, - 0x00000000,0x00000100,0x00000100,0x00000010, // 00f1h - 0x01000110,0x01000101,0x01000101,0x00111001, - 0x00000000,0x01010100,0x01111111,0x00100100, // 00f2h - 0x00100100,0x00100100,0x00100010,0x00010001, - 0x00000000,0x01010100,0x01011111,0x00000100, // 00f3h - 0x00111111,0x00001000,0x00001000,0x00001000, - 0x00000000,0x01011110,0x01100010,0x00100010, // 00f4h - 0x00100001,0x00100000,0x00010000,0x00001100, - 0x00000000,0x01010010,0x01111110,0x00100010, // 00f5h - 0x00100001,0x00100000,0x00010000,0x00001100, - 0x00000000,0x01010000,0x01111111,0x00100000, // 00f6h - 0x00100000,0x00100000,0x00100000,0x00111111, - 0x00000000,0x01010010,0x01010010,0x00111111, // 00f7h - 0x00010010,0x00010000,0x00010000,0x00001100, - 0x00000000,0x01010011,0x01010100,0x00100011, // 00f8h - 0x00100100,0x00010000,0x00001000,0x00000111, - 0x00000000,0x01010000,0x01011111,0x00010000, // 00f9h - 0x00001000,0x00001100,0x00010010,0x00100001, - 0x00000000,0x01010010,0x01111111,0x00100010, // 00fah - 0x00010010,0x00000010,0x00000010,0x00111100, - 0x00000000,0x01010001,0x01010010,0x00100000, // 00fbh - 0x00100000,0x00010000,0x00001000,0x00000110, - 0x00000000,0x01011110,0x01010010,0x00100110, // 00fch - 0x00111001,0x00100000,0x00010000,0x00001100, - 0x00000000,0x01010000,0x01011110,0x00010000, // 00fdh - 0x01111111,0x00010000,0x00010000,0x00001100, - 0x00000000,0x00100101,0x01001010,0x00101010, // 00feh - 0x00100000,0x00010000,0x00001000,0x00000111, - 0x00000000,0x01011110,0x01010000,0x00111111, // 00ffh - 0x00001000,0x00001000,0x00001000,0x00000110 -}; - - -/*---------------------------------------------------------------------------* - Palette data - *---------------------------------------------------------------------------*/ -const u32 d_PaletteData[ 8 * 16 ] = -{ - 0x00000000, 0x00000000, 0x00000000, 0x00000000, // black - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x001f0000, 0x00000000, 0x00000000, 0x00000000, // red - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x03e00000, 0x00000000, 0x00000000, 0x00000000, // green - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x7c000000, 0x00000000, 0x00000000, 0x00000000, // blue - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x03ff0000, 0x00000000, 0x00000000, 0x00000000, // yellow - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x7c1f0000, 0x00000000, 0x00000000, 0x00000000, // purple - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x7fe00000, 0x00000000, 0x00000000, 0x00000000, // light blue - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00180000, 0x00000000, 0x00000000, 0x00000000, // dark red - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x03000000, 0x00000000, 0x00000000, 0x00000000, // dark green - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x60000000, 0x00000000, 0x00000000, 0x00000000, // dark blue - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x03180000, 0x00000000, 0x00000000, 0x00000000, // dark yellow - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x60180000, 0x00000000, 0x00000000, 0x00000000, // dark purple - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x63000000, 0x00000000, 0x00000000, 0x00000000, // dark light blue - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x56b50000, 0x00000000, 0x00000000, 0x00000000, // gray - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x2d6b0000, 0x00000000, 0x00000000, 0x00000000, // dark gray - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x7fff0000, 0x00000000, 0x00000000, 0x00000000, // white - 0x00000000, 0x00000000, 0x00000000, 0x00000000 -}; - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/font.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/font.h deleted file mode 100644 index f13b225dcfc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/font.h +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------* - Project: NitroSDK - RTC - demos - File: font.h - - Copyright 2003,2004 Nintendo. All rights reserved. - - These coded instructions, statements, and computer programs contain - proprietary information of Nintendo of America Inc. and/or Nintendo - Company Ltd., and are protected by Federal copyright law. They may - not be disclosed to third parties or copied or duplicated in any form, - in whole or in part, without the prior written consent of Nintendo. - - $Log: font.h,v $ - Revision 1.1 2004/05/12 02:39:13 terui - initial upload - - $NoKeywords: $ - *---------------------------------------------------------------------------*/ - -#ifndef FONT_H_ -#define FONT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/*===========================================================================*/ - -#include - -extern const u32 d_CharData[ 8 * 256 ]; -extern const u32 d_PaletteData[ 8 * 16 ]; - -/*===========================================================================*/ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* FONT_H_ */ - -/*---------------------------------------------------------------------------* - End of file - *---------------------------------------------------------------------------*/ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsSocketNitro.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsSocketNitro.c deleted file mode 100644 index bd97b2ea859..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsSocketNitro.c +++ /dev/null @@ -1,194 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(_NITRO) - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// static variables -static int GSINitroErrno; - -// prototypes of static functions -static int CheckRcode(int rcode, int errCode); - -#define NITRO_SOCKET_ERROR -1 - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static int CheckRcode(int rcode, int errCode) -{ - if(rcode >= 0) - return rcode; - GSINitroErrno = rcode; - return errCode; -} - -int socket(int pf, int type, int protocol) -{ - int rcode = SOC_Socket(pf, type, protocol); - return CheckRcode(rcode, INVALID_SOCKET); -} -int closesocket(SOCKET sock) -{ - int rcode = SOC_Close(sock); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -int shutdown(SOCKET sock, int how) -{ - int rcode = SOC_Shutdown(sock, how); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -int bind(SOCKET sock, const SOCKADDR* addr, int len) -{ - SOCKADDR localAddr; - int rcode; - - // with nitro, don't bind to 0, just start using the port - if(((const SOCKADDR_IN*)addr)->port == 0) - return 0; - - memcpy(&localAddr, addr, sizeof(SOCKADDR)); - localAddr.len = (u8)len; - - rcode = SOC_Bind(sock, &localAddr); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} - -int connect(SOCKET sock, const SOCKADDR* addr, int len) -{ - SOCKADDR remoteAddr; - int rcode; - - memcpy(&remoteAddr, addr, sizeof(SOCKADDR)); - remoteAddr.len = (u8)len; - - rcode = SOC_Connect(sock, &remoteAddr); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -int listen(SOCKET sock, int backlog) -{ - int rcode = SOC_Listen(sock, backlog); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -SOCKET accept(SOCKET sock, SOCKADDR* addr, int* len) -{ - int rcode; - addr->len = (u8)*len; - rcode = SOC_Accept(sock, addr); - *len = addr->len; - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} - -int recv(SOCKET sock, char* buf, int len, int flags) -{ - int rcode = SOC_Recv(sock, buf, len, flags); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -int recvfrom(SOCKET sock, char* buf, int len, int flags, SOCKADDR* addr, int* fromlen) -{ - int rcode; - addr->len = (u8)*fromlen; - rcode = SOC_RecvFrom(sock, buf, len, flags, addr); - *fromlen = addr->len; - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -SOCKET send(SOCKET sock, const char* buf, int len, int flags) -{ - int rcode = SOC_Send(sock, buf, len, flags); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -SOCKET sendto(SOCKET sock, const char* buf, int len, int flags, const SOCKADDR* addr, int tolen) -{ - SOCKADDR remoteAddr; - int rcode; - - memcpy(&remoteAddr, addr, sizeof(SOCKADDR)); - remoteAddr.len = (u8)tolen; - - rcode = SOC_SendTo(sock, buf, len, flags, &remoteAddr); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} - -int getsockopt(SOCKET sock, int level, int optname, char* optval, int* optlen) -{ - int rcode = SOC_GetSockOpt(sock, level, optname, optval, optlen); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} -SOCKET setsockopt(SOCKET sock, int level, int optname, const char* optval, int optlen) -{ - int rcode = SOC_SetSockOpt(sock, level, optname, optval, optlen); - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} - -int getsockname(SOCKET sock, SOCKADDR* addr, int* len) -{ - int rcode; - addr->len = (u8)*len; - rcode = SOC_GetSockName(sock, addr); - *len = addr->len; - return CheckRcode(rcode, NITRO_SOCKET_ERROR); -} - -unsigned long inet_addr(const char* name) -{ - int rcode; - SOInAddr addr; - rcode = SOC_InetAtoN(name, &addr); - if(rcode == FALSE) - return INADDR_NONE; - return addr.addr; -} - -int GOAGetLastError(SOCKET sock) -{ - GSI_UNUSED(sock); - return GSINitroErrno; -} - - - -int GSISocketSelect(SOCKET theSocket, int* theReadFlag, int* theWriteFlag, int* theExceptFlag) -{ - SOPollFD pollFD; - int rcode; - - pollFD.fd = theSocket; - pollFD.events = 0; - if(theReadFlag != NULL) - pollFD.events |= SOC_POLLRDNORM; - if(theWriteFlag != NULL) - pollFD.events |= SOC_POLLWRNORM; - pollFD.revents = 0; - - rcode = SOC_Poll(&pollFD, 1, 0); - if(rcode < 0) - return NITRO_SOCKET_ERROR; - - if(theReadFlag != NULL) - { - if((rcode > 0) && (pollFD.revents & (SOC_POLLRDNORM|SOC_POLLHUP))) - *theReadFlag = 1; - else - *theReadFlag = 0; - } - if(theWriteFlag != NULL) - { - if((rcode > 0) && (pollFD.revents & SOC_POLLWRNORM)) - *theWriteFlag = 1; - else - *theWriteFlag = 0; - } - if(theExceptFlag != NULL) - { - if((rcode > 0) && (pollFD.revents & SOC_POLLERR)) - *theExceptFlag = 1; - else - *theExceptFlag = 0; - } - return rcode; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // _NITRO \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsThreadNitro.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsThreadNitro.c deleted file mode 100644 index 515009d4ebc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsThreadNitro.c +++ /dev/null @@ -1,155 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsPlatformThread.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_u32 gsiInterlockedIncrement(gsi_u32 * value) -{ - OSIntrMode state = OS_DisableInterrupts_IrqAndFiq(); - gsi_u32 ret = ++(*value); - OS_RestoreInterrupts_IrqAndFiq(state); - - // return "ret" rather than "value" here b/c - // value may be modified by another thread - // before we can return it - return ret; -} - -gsi_u32 gsiInterlockedDecrement(gsi_u32 * value) -{ - OSIntrMode state = OS_DisableInterrupts_IrqAndFiq(); - gsi_u32 ret = --(*value); - OS_RestoreInterrupts_IrqAndFiq(state); - - // return "ret" rather than "value" here b/c - // value may be modified by another thread - // before we can return it - return ret; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int gsiStartThread(GSThreadFunc aThreadFunc, gsi_u32 theStackSize, void *arg, GSIThreadID* theThreadIdOut) -{ - if(theStackSize & 0x3) - { - theStackSize += 0x4; - theStackSize &= ~0x3; - } - - theThreadIdOut->mStack = gsimemalign(4, theStackSize); - - OS_CreateThread(&theThreadIdOut->mThread, aThreadFunc, arg, theThreadIdOut->mStack, theStackSize, 15); - OS_WakeupThreadDirect(&theThreadIdOut->mThread); - - return 0; -} - -void gsiCancelThread(GSIThreadID theThreadID) -{ - OS_DestroyThread(&theThreadID.mThread); - if(theThreadID.mStack) - { - gsifree(theThreadID.mStack); - theThreadID.mStack = NULL; - } -} - -void gsiCleanupThread(GSIThreadID theThreadID) -{ - OS_DestroyThread(&theThreadID.mThread); - if(theThreadID.mStack) - { - gsifree(theThreadID.mStack); - theThreadID.mStack = NULL; - } -} - -gsi_u32 gsiHasThreadShutdown(GSIThreadID theThreadID) -{ - BOOL shutdown = OS_IsThreadTerminated(&theThreadID.mThread); - - if(shutdown == TRUE) - return 1; - return 0; -} - -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) -{ - OS_InitMutex(theCrit); -} - -void gsiEnterCriticalSection(GSICriticalSection *theCrit) -{ - OS_LockMutex(theCrit); -} - -void gsiLeaveCriticalSection(GSICriticalSection *theCrit) -{ - OS_UnlockMutex(theCrit); -} - -void gsiDeleteCriticalSection(GSICriticalSection *theCrit) -{ - GSI_UNUSED(theCrit); -} - -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - GSISemaphoreID semaphore; - - OS_InitMutex(&semaphore.mLock); - - semaphore.mValue = theInitialCount; - semaphore.mMax = theMaxCount; - - GSI_UNUSED(theName); - - return semaphore; -} - -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - gsi_time startTime = current_time(); - gsi_bool infinite = (theTimeoutMs == GSI_INFINITE)?gsi_true:gsi_false; - - do - { - if(OS_TryLockMutex(&theSemaphore.mLock) == TRUE) - { - if(theSemaphore.mValue > 0) - { - theSemaphore.mValue--; - OS_UnlockMutex(&theSemaphore.mLock); - return 1; - } - - OS_UnlockMutex(&theSemaphore.mLock); - } - - if(theTimeoutMs != 0) - msleep(2); - - } while(gsi_is_true(infinite) || ((current_time() - startTime) < theTimeoutMs)); - - return 0; -} - -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - OS_LockMutex(&theSemaphore.mLock); - - theSemaphore.mValue += theReleaseCount; - if(theSemaphore.mValue > theSemaphore.mMax) - theSemaphore.mValue = theSemaphore.mMax; - - OS_UnlockMutex(&theSemaphore.mLock); -} - -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - GSI_UNUSED(theSemaphore); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsTimerNitro.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsTimerNitro.c deleted file mode 100644 index 3efd1f6add7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsTimerNitro.c +++ /dev/null @@ -1,19 +0,0 @@ -// NITRO -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - -// note that this doesn't return the standard time() value -// because the DS doesn't know what timezone it's in -time_t time(time_t *timer) -{ - time_t t; - - assert(OS_IsTickAvailable() == TRUE); - t = (time_t)OS_TicksToSeconds(OS_GetTick()); - - if(timer) - *timer = t; - - return t; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsUtilNitro.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsUtilNitro.c deleted file mode 100644 index c85744e7cda..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsUtilNitro.c +++ /dev/null @@ -1,18 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return atoll(theNumberStr); -} - - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%lld", theNumber); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/key.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/key.c deleted file mode 100644 index dcecb91ae05..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/key.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "..\nonport.h" -#include "key.h" - -#define KEY_REPEAT_START 25 // Number of frames before start of key repeat -#define KEY_REPEAT_SPAN 10 // Number of frames of key repeat interval - -static KeyInformation KeyInfo; - -/*---------------------------------------------------------------------------* - Name: KeyRead - - Description: Edit key input information - Detect pressing trigger, releasing trigger, and pressing hold repeat - *---------------------------------------------------------------------------*/ -const KeyInformation * KeyRead(void) -{ - static u16 repeat_count[12]; - int i; - u16 r; - - r = PAD_Read(); - KeyInfo.trg = 0x0000; - KeyInfo.up = 0x0000; - KeyInfo.rep = 0x0000; - - for( i = 0 ; i < 12 ; i ++ ) - { - if( r & ( 0x0001 << i ) ) - { - if( !( KeyInfo.cnt & ( 0x0001 << i ) ) ) - { - KeyInfo.trg |= ( 0x0001 << i ); // Pressing trigger input - repeat_count[ i ] = 1; - } - else - { - if( repeat_count[ i ] > KEY_REPEAT_START ) - { - KeyInfo.rep |= ( 0x0001 << i ); // Pressing hold repeat - repeat_count[ i ] = KEY_REPEAT_START - KEY_REPEAT_SPAN; - } - else - { - repeat_count[ i ] ++; - } - } - } - else - { - if( KeyInfo.cnt & ( 0x0001 << i ) ) - { - KeyInfo.up |= ( 0x0001 << i ); // Releasing trigger input - } - } - } - KeyInfo.cnt = r; // Unprocessed key input - - return &KeyInfo; -} - -void WaitForA(void) -{ - while(1) - { - SVC_WaitVBlankIntr(); - KeyRead(); - if(KEY_A_PRESSED(&KeyInfo)) - break; - } -} - -void KeyInit(void) -{ - // empty call of key input information acquisition (pushing the A button in IPL) - KeyRead(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/key.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/key.h deleted file mode 100644 index 3c04105ef47..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/key.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _KEY_H_ -#define _KEY_H_ - -// Key input information -typedef struct KeyInformation -{ - u16 cnt; // Unprocessed input value - u16 trg; // Pressing trigger input - u16 up; // Releasing trigger input - u16 rep; // Pressing hold repeat input -} KeyInformation; - -void KeyInit(void); - -const KeyInformation * KeyRead(void); - -#define KEY_A_PRESSED(info) (((info)->trg | (info)->rep) & PAD_BUTTON_A) -#define KEY_B_PRESSED(info) (((info)->trg | (info)->rep) & PAD_BUTTON_B) -#define KEY_X_PRESSED(info) (((info)->trg | (info)->rep) & PAD_BUTTON_X) -#define KEY_Y_PRESSED(info) (((info)->trg | (info)->rep) & PAD_BUTTON_Y) -#define KEY_UP_PRESSED(info) (((info)->trg | (info)->rep) & PAD_KEY_UP) -#define KEY_DOWN_PRESSED(info) (((info)->trg | (info)->rep) & PAD_KEY_DOWN) -#define KEY_LEFT_PRESSED(info) (((info)->trg | (info)->rep) & PAD_KEY_LEFT) -#define KEY_RIGHT_PRESSED(info) (((info)->trg | (info)->rep) & PAD_KEY_RIGHT) - -void WaitForA(void); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/main.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/main.c deleted file mode 100644 index 4905c5f168a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/main.c +++ /dev/null @@ -1,122 +0,0 @@ -#include "..\nonport.h" -#include "screen.h" -#include "key.h" -#include "wireless.h" -#include "touch.h" -#include "backup.h" - -static void Startup(void) -{ -/* System */ - // init the OS system - internally initializes: - // arena - OS_InitArenaEx() - // communication system between preprocessors - PXI_Init() - // lock system - OS_InitLock() - // IRQ interrupt tables - OS_InitIrqTable() - // exception display system - OS_InitException() - // both WRAMs to the ARM7 - MI_SetWramBank() - // V count alarm system - OS_InitVAlarm() - // thread system - OS_InitThread() - // reset system - OS_InitReset() - // Game Pak library - CTRDG_Init() - // Card library - CARD_Init() - // power control system - PM_Init() - OS_Init(); - -/* Time */ - // init the system tick count - OS_InitTick(); - - // init the alarm - // this is needed for OS_Sleep() - OS_InitAlarm(); - -/* RTC */ - RTC_Init(); - -/* FIFO */ - PXI_InitFifo(); - -/* Screen */ - ScreenInit(); - Printf("Screen initialized\n"); - - SetTopScreenLineCentered(SCREEN_HEIGHT / 2, SCWhite, "Starting GameSpy Sample"); - -/* Keys */ - KeyInit(); - Printf("Input initialized\n"); - -/* Touch */ - TouchInit(); - Printf("Touch initialized\n"); - -/* Interrupts */ - OS_EnableIrq(); - OS_EnableInterrupts(); - Printf("Interrupts initialized\n"); - -/* Heap */ - { - u32 nHeapAdrs = 0; - u32 nHeapSize = 1 * 1024 * 1024; - OSHeapHandle hHeap; - - OS_SetMainArenaLo(OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1)); - nHeapAdrs = (u32)OS_AllocFromMainArenaLo(nHeapSize, 32); - hHeap = OS_CreateHeap(OS_ARENA_MAIN, (void*)(nHeapAdrs), (void*)(nHeapAdrs + nHeapSize)); - OS_SetCurrentHeap(OS_ARENA_MAIN, hHeap); - } - Printf("Heap initialized\n"); - -/* Backup */ - BackupInit(); - -/* Wireless */ - WirelessInit(); -} - -static void Shutdown(void) -{ - // close down wireless - Printf("Wireless cleanup\n"); - WirelessCleanup(); - -// ClearScreens(); -// SetTopScreenLineCentered(SCREEN_HEIGHT / 2, SCWhite, "GameSpy Sample Shutdown"); -// SVC_WaitVBlankIntr(); - - // terminate the os system - Printf("Terminating OS\n"); - OS_Terminate(); -} - -extern int test_main(int argc, char ** argv); - -static void Run(void) -{ - SetPrintMode(PRINT_TO_SCREEN|PRINT_TO_DEBUGGER); - - Printf("\n"); - Printf("GameSpy Test App Starting\n"); - Printf("-------------------------\n"); - - test_main(0, NULL); - - Printf("------------------------\n"); - Printf("GameSpy Test App Exiting\n"); - - SetPrintMode(PRINT_TO_DEBUGGER); -} - -void NitroMain(void) -{ - // startup everything we need - Startup(); - - // do stuff - Run(); - - // shutdown the system - Shutdown(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/menu.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/menu.c deleted file mode 100644 index 6b3ddb81446..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/menu.c +++ /dev/null @@ -1,410 +0,0 @@ -#include "../nonport.h" -#include "menu.h" -#include "screen.h" -#include "key.h" -#include "touch.h" - -static MenuScreen Screen; - -static MenuScreenConfiguration * NextMenuScreenConfiguration; - -static MenuScreenConfiguration MenuExitScreenConfiguration; - -static void NewMenuScreen(MenuScreenConfiguration * configuration) -{ - int count; - - memset(&Screen, 0, sizeof(MenuScreen)); - Screen.configuration = configuration; - Screen.listSelection = -1; - count = 0; - while(configuration->choices[count].text && (count < MAX_CHOICES)) - count++; - Screen.numChoices = count; -} - -static void ShowMenuScreen(void) -{ - MenuScreenConfiguration * configuration = Screen.configuration; - MenuScreenChoice * choices = configuration->choices; - int options = configuration->options; - - const ScreenColor normalColor = SCGray; - const ScreenColor highlightColor = SCWhite; - const ScreenColor disabledColor = SCDarkGray; - const int topTextLine = 10; - const int animationLine = (topTextLine + 2); - const int extraTextLine = (animationLine + 2); - const int keyboardTextLine = 1; - const int startKeyboardRowsLine = 3; - const int numKeyboardRows = 3; - const int numListRows = 5; - const int startListLine = 1; - const int startChoicesLine = (SCREEN_HEIGHT - (Screen.numChoices * 2)); - const char keyboardRows[numKeyboardRows][32] = - { - "1 2 3 4 5 6 7 8 9 0 - + = _ . < ", - " A B C D E F G H I J K L M N O ", - " P Q R S T U V W X Y Z space " - }; - const char listBorder[32] = "--------------------"; - const int spacePos = (strchr(keyboardRows[2], 's') - keyboardRows[2]); - const char animationChars[] = "-*"; - const gsi_time animationTickTime = 500; - - BOOL done = FALSE; - int choiceIndex; - BOOL keyboard; - BOOL touching; - BOOL list; - BOOL animated; - int x, y; - int touchingLine; - int touchingPos; - int choiceLine; - int keyboardLine; - BOOL wasTouching = FALSE; - int wasTouchingChoice = -1; - ScreenColor color; - int i; - int range; - char touchingChar; - char wasTouchingChar = 0; - int keyboardPos; - int numListItems; - int listScroll = 0; - BOOL wasTouchingUp = FALSE; - BOOL wasTouchingDown = FALSE; - int listItem; - const char * choiceSelection; - int animationCount = 0; - gsi_time lastAnimationTime = current_time(); - gsi_time now; - char animationText[] = "-"; - - // is it animated? - animated = (options & SCREEN_OPTION_ANIMATED)?TRUE:FALSE; - - // is there a keyboard? - keyboard = (options & SCREEN_OPTION_KEYBOARD)?TRUE:FALSE; - - // is there a list? - list = (options & SCREEN_OPTION_LIST)?TRUE:FALSE; - - // we can't have a list and a keyboard - if(keyboard && list) - OS_Panic("Can't have a keyboard and a list on a menu screen\n"); - - // call the init func - if(configuration->initFunc) - { - configuration->initFunc(); - if(NextMenuScreenConfiguration) - return; - } - - // if there is a keyboard, get the initial position - if(keyboard) - keyboardPos = (int)strlen(Screen.keyboardText); - - // loop until we're done - while(!done) - { - // wait for a screen update to complete - SVC_WaitVBlankIntr(); - - // call the think func - if(configuration->thinkFunc) - { - configuration->thinkFunc(); - if(NextMenuScreenConfiguration) - return; - } - - // count the number of list items - if(list) - { - for(numListItems = 0 ; numListItems < MAX_LIST_STRINGS ; numListItems++) - { - if(Screen.list[numListItems][0] == '\0') - break; - } - } - - // check for a touch - touching = GetTouch(&x, &y); - if(touching) - { - // figure out which line we're touching - touchingLine = (y / (TOUCH_Y_RANGE / SCREEN_HEIGHT)); - - // figure out which position we're touching - touchingPos = (x / (TOUCH_X_RANGE / SCREEN_WIDTH)); - } - else if (wasTouching) - { - // check for touching a choice - if(wasTouchingChoice != -1) - { - choiceSelection = choices[wasTouchingChoice].text; - wasTouchingChoice = -1; - - // call the chose func - if(configuration->choseFunc) - { - configuration->choseFunc(choiceSelection); - if(NextMenuScreenConfiguration) - return; - } - } - // check for touching up on the list - else if(wasTouchingUp) - { - if(listScroll > 0) - listScroll--; - } - // check for touching down on the list - else if(wasTouchingDown) - { - if(listScroll < (numListItems - numListRows)) - listScroll++; - } - // check for touching a keyboard char - else if(wasTouchingChar != 0) - { - // check for backspace - if(wasTouchingChar == '<') - { - if(keyboardPos > 0) - { - keyboardPos--; - Screen.keyboardText[keyboardPos] = '\0'; - } - } - else - { - if(keyboardPos < MAX_KEYBOARD_TEXT_LEN) - { - Screen.keyboardText[keyboardPos] = wasTouchingChar; - keyboardPos++; - Screen.keyboardText[keyboardPos] = '\0'; - } - } - } - } - wasTouching = touching; - - // clear both screens - ClearScreens(); - - // show the title on the top screen - SetTopScreenLineCentered(topTextLine, SCYellow, configuration->topScreenText); - - // show animation - if(animated) - { - now = current_time(); - if((now - lastAnimationTime) >= animationTickTime) - { - animationCount++; - animationCount %= strlen(animationChars); - lastAnimationTime += animationTickTime; - } - - animationText[0] = animationChars[animationCount]; - - SetTopScreenLineCentered(animationLine, SCYellow, animationText); - } - - // show extra text - for(i = 0 ; i < MAX_EXTRA_TEXT_STRINGS ; i++) - { - if(options & SCREEN_OPTION_EXTRAS_CENTERED) - SetTopScreenLineCentered(extraTextLine + i, SCWhite, Screen.extraText[i]); - else - SetTopScreenLine(extraTextLine + i, SCWhite, Screen.extraText[i]); - } - - // show the list - if(list) - { - // clear touching vars - wasTouchingUp = FALSE; - wasTouchingDown = FALSE; - - // show "up" if needed - if(listScroll > 0) - { - if(touching && (touchingLine == startListLine)) - { - wasTouchingUp = TRUE; - color = highlightColor; - } - else - { - color = normalColor; - } - SetBottomScreenLineCentered(startListLine, color, "up"); - } - - // show the top line - SetBottomScreenLineCentered(startListLine + 1, normalColor, listBorder); - - // show the list items - for(i = 0 ; i < numListRows ; i++) - { - listItem = (listScroll + i); - - if(listItem >= numListItems) - break; - - // is this item being touched? - if(touching && (touchingLine == (startListLine + 2 + i))) - Screen.listSelection = listItem; - - // set the color - if(Screen.listSelection == listItem) - color = highlightColor; - else - color = normalColor; - - // show the item - SetBottomScreenLineCentered(startListLine + 2 + i, color, Screen.list[listScroll + i]); - } - - // show the bottom line - SetBottomScreenLineCentered(startListLine + numListRows + 2, normalColor, listBorder); - - // show "down" if needed - if(listScroll < (numListItems - numListRows)) - { - if(touching && (touchingLine == (startListLine + numListRows + 3))) - { - wasTouchingDown = TRUE; - color = highlightColor; - } - else - { - color = normalColor; - } - SetBottomScreenLineCentered(startListLine + numListRows + 3, color, "down"); - } - } - - // show a keyboard - if(keyboard) - { - // show the text - SetBottomScreenLine(keyboardTextLine, SCGreen, Screen.keyboardText); - - // clear touching var - wasTouchingChar = 0; - - // loop through the keyboard rows - for(i = 0 ; i < numKeyboardRows ; i++) - { - // get the line to show this row on - keyboardLine = (startKeyboardRowsLine + i); - - // check if we're touching this row - if(touching && (touchingLine == keyboardLine)) - { - // get the char we're touching - touchingChar = keyboardRows[i][touchingPos]; - - // handle touching 'space' specially - if(islower(touchingChar)) - { - wasTouchingChar = ' '; - - touchingPos = spacePos; - range = 5; - } - else - { - if(touchingChar != ' ') - wasTouchingChar = touchingChar; - - range = 1; - } - - // show the keyboard row with the selection highlighted - SetBottomScreenLineHighlight( - keyboardLine, normalColor, keyboardRows[i], - touchingPos, range, highlightColor); - } - else - { - // show the keyboard row - SetBottomScreenLine(keyboardLine, normalColor, keyboardRows[i]); - } - } - } - - // show the choices - wasTouchingChoice = -1; - for(choiceIndex = 0 ; choiceIndex < Screen.numChoices ; choiceIndex++) - { - // this is the line to show this choice on - choiceLine = (startChoicesLine + (choiceIndex * 2)); - - // check if we're touching this choice - if((choices[choiceIndex].options & CHOICE_OPTION_DISABLED) || - ((choices[choiceIndex].options & CHOICE_OPTION_NEEDS_LIST_SELECTION) && (Screen.listSelection == -1))) - { - color = disabledColor; - } - else if(touching && (touchingLine == choiceLine)) - { - color = highlightColor; - wasTouchingChoice = choiceIndex; - } - else - { - color = normalColor; - } - - // show the line - SetBottomScreenLineCentered(choiceLine, color, choices[choiceIndex].text); - } - } -} - -void StartMenuScreen(MenuScreenConfiguration * configuration) -{ - assert(configuration != NULL); - - // set the initial next screen - SetNextMenuScreen(configuration); - - // loop while there is a next screen to show - while(NextMenuScreenConfiguration != &MenuExitScreenConfiguration) - { - // setup the new screen - NewMenuScreen(NextMenuScreenConfiguration); - - // clear the next screen setting - SetNextMenuScreen(NULL); - - // show the menu screen - ShowMenuScreen(); - - // clear the display - ClearScreens(); - } -} - -void SetNextMenuScreen(MenuScreenConfiguration * configuration) -{ - NextMenuScreenConfiguration = configuration; -} - -void ExitMenu(void) -{ - SetNextMenuScreen(&MenuExitScreenConfiguration); -} - -MenuScreen * GetMenuScreen(void) -{ - return &Screen; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/menu.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/menu.h deleted file mode 100644 index ec8df39d58a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/menu.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _MENU_H_ -#define _MENU_H_ - -// various length defines -#define MAX_CHOICE_STRING_LEN 32 -#define MAX_TOP_SCREEN_TEXT 32 -#define MAX_CHOICES 10 -#define MAX_LIST_STRINGS 16 -#define MAX_LIST_STRING_LEN 32 -#define MAX_KEYBOARD_TEXT_LEN 32 -#define MAX_EXTRA_TEXT_STRINGS 10 -#define MAX_EXTRA_TEXT_STRING_LEN 32 - -// options for screens -#define SCREEN_OPTION_ANIMATED 0x1 -#define SCREEN_OPTION_KEYBOARD 0x2 -#define SCREEN_OPTION_LIST 0x4 -#define SCREEN_OPTION_EXTRAS_CENTERED 0x8 - -// options for screen choices -#define CHOICE_OPTION_NEEDS_LIST_SELECTION 0x1 -#define CHOICE_OPTION_DISABLED 0x2 - -// a single choice on a screen -typedef struct MenuScreenChoice -{ - const char * text; - int options; -} MenuScreenChoice; - -// an instance of a screen -typedef struct MenuScreen -{ - struct MenuScreenConfiguration * configuration; - char extraText[MAX_EXTRA_TEXT_STRINGS][MAX_EXTRA_TEXT_STRING_LEN + 1]; - char list[MAX_LIST_STRINGS][MAX_LIST_STRING_LEN + 1]; - int listSelection; // default -1, no selection - char keyboardText[MAX_KEYBOARD_TEXT_LEN + 1]; - int numChoices; -} MenuScreen; - -// the static configuration for a screen -typedef struct MenuScreenConfiguration -{ - const char * topScreenText; - MenuScreenChoice choices[MAX_CHOICES]; - void (* initFunc)(void); - void (* choseFunc)(const char * choice); - void (* thinkFunc)(void); - int options; -} MenuScreenConfiguration; - -// call this to start showing a menu, pass in the initial screen to show -void StartMenuScreen(MenuScreenConfiguration * configuration); - -// call this from any of the configuration callback funcs to set the next screen to show -void SetNextMenuScreen(MenuScreenConfiguration * configuration); - -// call this to exit the menu -void ExitMenu(void); - -// gets the current menu screen -MenuScreen * GetMenuScreen(void); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrocommon.cww b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrocommon.cww deleted file mode 100644 index c9a2625ec95..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrocommon.cww +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - -1 - 0 - true - nitrosample\nitrosample.mcp - - 604 - 352 - - - 400 - 372 - - - 1 - 0 - 0 - 59420 - 0.162898 - 378 - - 29705908 - 42137564 - - - - - -1 - 0 - ..\..\serverbrowsing\sbctest\sbnitrocw\sbnitrocw.mcp - - 458 - 315 - - - 400 - 372 - - - 1 - 0 - 2 - 59420 - 0.193501 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\qr2\qr2csample\qr2nitrocw\qr2nitrocw.mcp - - 285 - 274 - - - 400 - 379 - - - 1 - 0 - 1 - 59420 - 0.141566 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\pt\pttestc\ptnitrocw\ptnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 1 - 4 - 59420 - 0.165193 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\Peer\peerc\peernitrocw\peernitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 1 - 3 - 59420 - 0.172138 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\natneg\simpletest\natnegnitrocw\natnegnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 0 - 4 - 59420 - 0.174097 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\gt2\gt2testc\gt2nitrocw\gt2nitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 0 - 5 - 59420 - 0.152819 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\gstats\statstest\gstatsnitrocw\gstatsnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 1 - 1 - 59420 - 0.140610 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\gstats\persisttest\persistnitrocw\persistnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 1 - 2 - 59420 - 0.191763 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\GP\gptestc\gpnitrocw\gpnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 0 - 3 - 59420 - 0.175118 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\ghttp\ghttpc\ghttpnitrocw\ghttpnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 1 - 0 - 59420 - 0.163171 - 378 - - 0 - 0 - - - - - -1 - 0 - ..\..\Chat\chatc\chatnitrocw\chatnitrocw.mcp - - 457 - 317 - - - 392 - 344 - - - 1 - 1 - 5 - 59420 - 0.167125 - 378 - - 29736291 - 974026480 - - - - - 1073741824 - 35 - - 540 - 75 - - - 387 - 279 - - - 0 - - - - - - - - - - - GlobalSession, cpuARMLittle, osCWDS - C:\gamespy\GOA\GP\gptestc\gpnitrocw\bin\ARM9-TS\Debug\main.nef - 1 - - - - -2147483648 - 34 - - 4 - 23 - - - 528 - 334 - - - 0 - - - - - - - - - - - - - -2147483648 - 37 - - 4 - 22 - - - 358 - 327 - - - 0 - - - - - - - - - - - - - -2147483648 - 24 - - 6 - 81 - - - 566 - 477 - - - 0 - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/Nitro.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/Nitro.lcf deleted file mode 100644 index aedd7f177ce..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/Nitro.lcf +++ /dev/null @@ -1,509 +0,0 @@ -#--------------------------------------------------------------------------- -# Project: NitroSDK - tools - makelcf -# File: ARM9-TS.lcf.template -# -# Copyright 2003-2006 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ARM9-TS.lcf.template,v $ -# Revision 1.37 07/20/2006 07:29:12 kitase_hirotake -# Added descriptions explaining the version section. -# -# Revision 1.36 2006/07/18 11:11:01 yasu -# There was an error in the method for obtaining the size -# of the OVERLAY region when checking for overflow of the TCM region using check.xTCM. -# Stopped adding the OVERLAY region because the correct calculation method is unknown at this time. -# -# Revision 1.35 2006/05/10 03:19:47 yasu -# Added support for the CodeWarrior 2.x overlay expansion -# -# Revision 1.34 04/06/2006 09:02:36 kitase_hirotake -# support for .itcm.bss and .dtcm.bss -# -# Revision 1.33 2006/03/30 23:59:22 yasu -# changed creation year -# -# Revision 1.32 2006/03/29 13:14:22 yasu -# support for overlays in CWVER 2.x -# -# Revision 1.31 11/24/2005 01:16:47 yada -# change start address of mainEX arena from 0x2400000 to 0x23e0000 -# -# Revision 1.30 2005/09/02 04:14:22 yasu -# Old symbols were redefined so they can be used even under SDK2.2 -# -# Revision 1.29 2005/08/31 09:34:57 yasu -# Corrected a problem where code would not function normally when using section names such as section_BSS -# -# Revision 1.28 2005/08/26 11:22:16 yasu -# overlay support for ITCM/DTCM -# -# Revision 1.27 2005/06/20 12:29:20 yasu -# Changed Surffix to Suffix -# -# Revision 1.26 06/14/2005 09:03:42 yada -# fix around minus value of SDK_STACKSIZE -# -# Revision 1.25 04/13/2005 12:51:00 terui -# Change SDK_AUTOLOAD.DTCM.START 0x027c0000 -> 0x027e0000 -# -# Revision 1.24 03/30/2005 00:02:14 yosizaki -# fix copyright header. -# -# Revision 1.23 2005/03/25 12:54:59 yasu -# Include .version section -# -# Revision 1.22 2004/10/03 02:00:56 yasu -# Output component file list for compstatic tool -# -# Revision 1.21 2004/09/27 05:28:21 yasu -# Support .sinit -# -# Revision 1.20 2004/09/09 11:49:20 yasu -# Support compstatic in default -# -# Revision 1.19 2004/09/06 06:40:00 yasu -# Add labels for digest -# -# Revision 1.18 2004/08/20 06:19:59 yasu -# DTCM moves to 0x027c0000 at default -# -# Revision 1.17 2004/08/02 10:38:53 yasu -# Add autoload-done callback address in overlaydefs -# -# Revision 1.16 2004/07/26 02:22:32 yasu -# Change DTCM address to 0x023c0000 -# -# Revision 1.15 2004/07/26 00:08:27 yasu -# Fix label of exception table -# -# Revision 1.14 2004/07/24 05:42:25 yasu -# Set default values for SDK_AUTOGEN_xTCM_START -# -# Revision 1.13 2004/07/23 11:32:14 yasu -# Define labels for __exception_table_start__ and _end__ -# -# Revision 1.12 2004/07/12 12:21:08 yasu -# Check size of ITCM/DTCM -# -# Revision 1.11 2004/07/10 04:10:26 yasu -# Support command 'Library' -# -# Revision 1.10 2004/07/02 08:13:02 yasu -# Support OBJECT( ) -# -# Revision 1.9 07/01/2004 12:54:38 yasu -# support ITCM/DTCM/WRAM autoload -# -# Revision 1.8 07/01/2004 10:41:46 yasu -# support autoload -# -# Revision 1.7 06/02/2004 07:35:37 yasu -# Set libsyscall.a in FORCE_ACTIVE -# Put NitroMain at the top of ROM image -# -# Revision 1.6 06/02/2004 04:56:28 yasu -# Change to fit to new ROM map of TS -# -# Revision 1.5 2004/06/01 06:12:00 miya -# add padding at top of ROM image. -# -# Revision 1.4 04/26/2004 12:16:48 yasu -# add KEEP_SECTIONS -# -# Revision 1.3 04/20/2004 07:41:32 yasu -# Set STATICINIT instead of .ctor temporarily -# -# Revision 1.2 04/14/2004 07:16:42 yasu -# add ALIGN(32) for convenience to handle cache line -# -# Revision 1.1 04/06/2004 01:59:54 yasu -# newly added -# -# $NoKeywords: $ -#--------------------------------------------------------------------------- -MEMORY -{ - main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin - ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin - DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - - main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin - main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin - dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 - arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 - arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0 - arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0 - arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0 - binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files - check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check - check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check -} - -FORCE_ACTIVE -{ - SVC_SoftReset -} - -KEEP_SECTION -{ - .sinit -} - -SECTIONS -{ - ############################ STATIC ################################# - .main: - { - ALIGNALL(4); . = ALIGN(32); # Fit to cache line - - # - # TEXT BLOCK: READ ONLY - # - SDK_STATIC_START =.; - SDK_STATIC_TEXT_START =.; - #:::::::::: text/rodata - libsyscall.a (.text) - crt0.o (.text) - crt0.o (.rodata) - # - # Added .version section. - # The info in this section will be used for lotcheck. - # Make sure it remains at this locale. - # - * (.version) - OBJECT(NitroMain,*) - GROUP(ROOT) (.text) - . = ALIGN(4); - * (.exception) - . = ALIGN(4); - SDK_STATIC_ETABLE_START =.; - EXCEPTION - SDK_STATIC_ETABLE_END =.; - . = ALIGN(4); - GROUP(ROOT) (.init) - . = ALIGN(4); - GROUP(ROOT) (.rodata) - . = ALIGN(4); - - SDK_STATIC_SINIT_START =.; - #:::::::::: ctor - GROUP(ROOT) (.ctor) - GROUP(ROOT) (.sinit) - WRITEW 0; - #:::::::::: ctor - SDK_STATIC_SINIT_END =.; - - #:::::::::: text/rodata - . = ALIGN(32); - SDK_STATIC_TEXT_END =.; - - # - # DATA BLOCK: READ WRITE - # - SDK_STATIC_DATA_START =.; - #:::::::::: data - GROUP(ROOT) (.sdata) - . = ALIGN(4); - GROUP(ROOT) (.data) - . = ALIGN(4); - SDK_OVERLAY_DIGEST =.; - # NO DIGEST - SDK_OVERLAY_DIGEST_END =.; - #:::::::::: data - . = ALIGN(32); - SDK_STATIC_DATA_END =.; - SDK_STATIC_END =.; - - SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; - SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; - SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; - __sinit__ = SDK_STATIC_SINIT_START; # for static initializer - __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table - __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table - } > main - - .main.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_STATIC_BSS_START =.; - #:::::::::: bss - GROUP(ROOT) (.sbss) - . = ALIGN(4); - GROUP(ROOT) (.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_STATIC_BSS_END = .; - SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; - - } >> main - - - ############################ AUTOLOADS ############################## - SDK_AUTOLOAD.ITCM.START = 0x01ff8000; - SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.SIZE = 0; - SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; - SDK_AUTOLOAD.DTCM.START = 0x027e0000; - SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.SIZE = 0; - SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; - SDK_AUTOLOAD_START = SDK_STATIC_END; - SDK_AUTOLOAD_SIZE = 0; - SDK_AUTOLOAD_NUMBER = 2; - - .ITCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_ITCM_ID =0; - SDK_AUTOLOAD.ITCM.ID =0; - SDK_AUTOLOAD.ITCM.START =.; - SDK_AUTOLOAD.ITCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - * (.itcm) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.ITCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.ITCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.DATA_END =.; - SDK_AUTOLOAD.ITCM.END =.; - - SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START; - SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START; - SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE; - - } > ITCM - - .ITCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.ITCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - * (.itcm.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.BSS_END = .; - - SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START; - - } >> ITCM - - .DTCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_DTCM_ID =1; - SDK_AUTOLOAD.DTCM.ID =1; - SDK_AUTOLOAD.DTCM.START =.; - SDK_AUTOLOAD.DTCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.DTCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.DTCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm) - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.DATA_END =.; - SDK_AUTOLOAD.DTCM.END =.; - - SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START; - SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START; - SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE; - - } > DTCM - - .DTCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.DTCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm.bss) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.BSS_END = .; - - SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START; - - } >> DTCM - - - SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; - SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; - SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; - SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; - SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; - SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; - SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; - SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; - - ############################ AUTOLOAD_INFO ########################## - .binary.AUTOLOAD_INFO: - { - WRITEW ADDR(.ITCM); - WRITEW SDK_AUTOLOAD.ITCM.SIZE; - WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE; - WRITEW ADDR(.DTCM); - WRITEW SDK_AUTOLOAD.DTCM.SIZE; - WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE; - } > binary.AUTOLOAD_INFO - - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - - ############################ STATIC_FOOTER ########################## - .binary.STATIC_FOOTER: - { - WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE - WRITEW _start_ModuleParams - ADDR(.main); - WRITEW 0; # NO DIGEST - } > binary.STATIC_FOOTER - - ############################ OVERLAYS ############################### - SDK_OVERLAY_NUMBER = 0; - - - ############################ MAIN EX ################################## - # MAIN EX Area - .dummy.MAIN_EX: - { - . = ALIGN(32); - } > dummy.MAIN_EX - - ############################ ARENA ################################## - .arena.MAIN: - { - . = ALIGN(32); - SDK_SECTION_ARENA_START =.; - } > arena.MAIN - - .arena.MAIN_EX: - { - . = ALIGN(32); - SDK_SECTION_ARENA_EX_START =.; - } > arena.MAIN_EX - - .arena.ITCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_ITCM_START =.; - } > arena.ITCM - - .arena.DTCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_DTCM_START =.; - } > arena.DTCM - - ############################ OVERLAYDEFS ############################ - .main_defs: - { - ### main module information - WRITEW ADDR(.main); # load address - WRITEW _start; # entry address - WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module - WRITEW _start_AutoloadDoneCallback; # callback autoload done - - ### overlay filename - - } > main_defs - - - ############################ OVERLAYTABLE ########################### - .main_table: - { - - } > main_table - - - ############################ OTHERS ################################# - SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; - SDK_IRQ_STACKSIZE = 4096; # allocated in DTCM - SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM - - # Module filelist - .binary.MODULE_FILES: - { - WRITES ("main.sbin"); - WRITES ("main_defs.sbin"); - WRITES ("main_table.sbin"); - } > binary.MODULE_FILES - - # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM - .check.ITCM: - { - . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; - } > check.ITCM - - SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; - .check.DTCM: - { - . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; - . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; - } > check.DTCM - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/ROM-TS.rsf b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/ROM-TS.rsf deleted file mode 100644 index cec9e1dbf9a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/ROM-TS.rsf +++ /dev/null @@ -1,116 +0,0 @@ -#---------------------------------------------------------------------------- -# Project: NitroSDK - include -# File: ROM-TS.lsf -# -# Copyright 2003-2005 Nintendo. All rights reserved. -# -# These coded insructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ROM-TS.rsf,v $ -# Revision 1.6 2005/04/05 23:52:58 yosizaki -# fix copyright date. -# -# Revision 1.5 2005/04/05 12:16:10 yosizaki -# support RomSpeedType parameter. -# -# Revision 1.4 2004/09/21 02:18:49 yasu -# Add default banner -# -# Revision 1.3 2004/09/09 11:39:09 yasu -# Unified ROM-TS and ROM-TS-C, also ROM-TEG and ROM-TEG-C -# -# Revision 1.2 2004/05/26 12:03:38 yasu -# add :r option to get basename for supporting IDE with makerom -# -# Revision 1.1 2004/04/06 01:59:59 yasu -# newly added -# -# $NoKeywords: $ -#---------------------------------------------------------------------------- -# -# Nitro ROM SPEC FILE -# - -Arm9 -{ - Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" - OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" - OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" - Elf "$(MAKEROM_ARM9:r).nef" -} - -Arm7 -{ - Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" - OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" - OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" - Elf "$(MAKEROM_ARM7:r).nef" -} - -Property -{ - ### - ### Settings for FinalROM - ### - #### BEGIN - # - # TITLE NAME: Your product name within 12bytes - # - #TitleName "YourAppName" - - # - # MAKER CODE: Your company ID# in 2 ascii words - # issued by NINTENDO - # - #MakerCode "00" - - # - # REMASTER VERSION: Mastering version - # - #RomVersion 0 - - # - # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] - # - RomSpeedType $(MAKEROM_ROMSPEED) - - # - # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] - # - #RomSize 128M - #RomSize 256M - - # - # ROM PADDING: TRUE if finalrom - # - #RomFootPadding TRUE - - # - # ROM HEADER TEMPLATE: Provided to every product by NINTENDO - # - #RomHeaderTemplate ./etc/rom_header.template.sbin - - # - # BANNER FILE: generated from Banner Spec File - # - #BannerFile ./etc/myGameBanner.bnr - BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr - - ### - ### - ### - #### END -} - -RomSpec -{ - Offset 0x00000000 - Segment ALL - HostRoot $(MAKEROM_ROMROOT) - Root / - File $(MAKEROM_ROMFILES) -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/nitrosample.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/nitrosample.c deleted file mode 100644 index c129025f3d1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/nitrosample.c +++ /dev/null @@ -1,606 +0,0 @@ -#include "../../nonport.h" -#include "../../peer/peer.h" -#include "../../peer/peerMain.h" -#include "menu.h" -#include "screen.h" - -/************************************************************************/ -/* Sample Menu */ -/************************************************************************/ - -static const char mscHostServer[] = "Host Server"; -static const char mscListServers[] = "List Servers"; -static const char mscExit[] = "Exit"; -static const char mscStartHosting[] = "Start Hosting"; -static const char mscCancel[] = "Cancel"; -static const char mscStopHosting[] = "Stop Hosting"; -static const char mscViewHostInfo[] = "View Host Info"; -static const char mscMainMenu[] = "Main Menu"; -static const char mscBack[] = "Back"; - -static void CheckingBackendAvailabilityInit(void); -static void CheckingBackendAvailabilityChose(const char * choice); -static void CheckingBackendAvailabilityThink(void); - -static MenuScreenConfiguration msCheckingBackendAvailability = -{ - "Checking Backend Availability", - { - { mscCancel } - }, - CheckingBackendAvailabilityInit, - CheckingBackendAvailabilityChose, - CheckingBackendAvailabilityThink, - SCREEN_OPTION_ANIMATED -}; - -static void BackendUnavailableChose(const char * choice); - -static MenuScreenConfiguration msBackendUnavailable = -{ - "Backend Unavailable", - { - { mscExit } - }, - NULL, - BackendUnavailableChose -}; - -static void FailedToIntializePeerSDKChose(const char * choice); - -static MenuScreenConfiguration msFailedToIntializePeerSDK = -{ - "Failed to Initialize Peer SDK", - { - { mscExit } - }, - NULL, - FailedToIntializePeerSDKChose -}; - -static void HostOrListChose(const char * choice); - -static MenuScreenConfiguration msHostOrList = -{ - "Host or List", - { - { mscHostServer }, - { mscListServers }, - { mscExit } - }, - NULL, - HostOrListChose -}; - -static void ChooseHostingNameInit(void); -static void ChooseHostingNameChose(const char * choice); - -static MenuScreenConfiguration msChooseHostingName = -{ - "Choose Hosting Name", - { - { mscStartHosting }, - { mscCancel} - }, - ChooseHostingNameInit, - ChooseHostingNameChose, - NULL, - SCREEN_OPTION_KEYBOARD -}; - -static void HostingServerInit(void); -static void HostingServerChose(const char * choice); -static void HostingServerThink(void); - -static MenuScreenConfiguration msHostingServer = -{ - "Hosting Server", - { - { mscStopHosting } - }, - HostingServerInit, - HostingServerChose, - HostingServerThink, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void ErrorStartingHostInit(void); -static void ErrorStartingHostChose(const char * choice); - -static MenuScreenConfiguration msErrorStartingHost = -{ - "Error Starting Host", - { - { mscMainMenu } - }, - ErrorStartingHostInit, - ErrorStartingHostChose -}; - -static void ListingHostsInit(void); -static void ListingHostsChose(const char * choice); -static void ListingHostsThink(void); - -static MenuScreenConfiguration msListingHosts = -{ - "Listing Hosts", - { - { mscViewHostInfo, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscMainMenu } - }, - ListingHostsInit, - ListingHostsChose, - ListingHostsThink, - SCREEN_OPTION_LIST | SCREEN_OPTION_ANIMATED -}; - -static void ErrorListingHostsInit(void); -static void ErrorListingHostsChose(const char * choice); - -static MenuScreenConfiguration msErrorListingHosts = -{ - "Error Listing Hosts", - { - { mscMainMenu } - }, - ErrorListingHostsInit, - ErrorListingHostsChose -}; - -static void ViewHostInfoInit(void); -static void ViewHostInfoChose(const char * choice); - -static MenuScreenConfiguration msViewHostInfo = -{ - "View Host Info", - { - { mscBack } - }, - ViewHostInfoInit, - ViewHostInfoChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -/************************************************************************/ -/* Sample Funcs */ -/************************************************************************/ - - -#define GAMENAME "gmtest" -#define SECRETKEY "HA6zkS" - -#define MAX_HOSTNAME_LEN MAX_KEYBOARD_TEXT_LEN - -static char Hostname[MAX_HOSTNAME_LEN + 1] = "Nitro Host"; -static char FailureReason[MAX_EXTRA_TEXT_STRINGS][MAX_EXTRA_TEXT_STRING_LEN + 1]; -static qr2_error_t QR2AddError; -static BOOL ListingError; -static PEER Peer; -static SBServer SelectedServer; -static int Mapname; -static int Gametype; - -static const char Mapnames[][64] = { "Rome", "London", "New York" }; -static const char Gametypes[][64] = { "Deathmatch", "Teamplay", "1 on 1" }; -static const int NumMapnames = (sizeof(Mapnames) / sizeof(Mapnames[0])); -static const int NumGametypes = (sizeof(Gametypes) / sizeof(Gametypes[0])); - -static gsi_u32 DebugLog2(gsi_u32 level) -{ - gsi_u32 total = 0; - while (level > 1) - { - level = level >> 1; - total++; - } - return total; -} - -static void DebugCallback(GSIDebugCategory category, GSIDebugType type, - GSIDebugLevel level, const char * format, va_list params) -{ - // Output line prefix - Printf("[%s][%s][%s] ", - gGSIDebugCatStrings[category], - gGSIDebugTypeStrings[type], - gGSIDebugLevelStrings[DebugLog2(level)]); - - // Output to file - VPrintf(format, - params); -} - -int main(int argc, char * argv) -{ - gsSetDebugCallback(DebugCallback); - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Verbose); - - GSI_UNUSED(argc); - GSI_UNUSED(argv); - - StartMenuScreen(&msCheckingBackendAvailability); - - return 0; -} - -static const char * QR2ErrorToString(qr2_error_t result) -{ - if(result == e_qrnoerror) - return "no error"; - if(result == e_qrwsockerror) - return "socket error"; - if(result == e_qrbinderror) - return "bind error"; - if(result == e_qrdnserror) - return "dns lookup error"; - if(result == e_qrconnerror) - return "nat error"; - if(result == e_qrnochallengeerror) - return "no challenge received"; - return "unknown error"; -} - -static void SetFailureReason(const char * reason) -{ - int i; - const char * line; - const char * nextLine; - size_t len; - - memset(FailureReason, 0, sizeof(FailureReason)); - - nextLine = reason; - - for(i = 0 ; i < MAX_EXTRA_TEXT_STRINGS ; i++) - { - line = nextLine; - if(line[0] == '\0') - return; - - nextLine = strchr(line, '\n'); - if(nextLine && ((nextLine - line) < MAX_EXTRA_TEXT_STRING_LEN)) - { - len = (size_t)(nextLine - line); - nextLine++; - } - else if(strlen(line) >= MAX_EXTRA_TEXT_STRING_LEN) - { - len = MAX_EXTRA_TEXT_STRING_LEN; - nextLine = (line + MAX_EXTRA_TEXT_STRING_LEN); - } - else - { - len = strlen(line); - nextLine = ""; - } - - memcpy(FailureReason[i], line, len); - FailureReason[i][len] = '\0'; - } -} - -static void KeyListCallback(PEER peer, qr2_key_type type, qr2_keybuffer_t buffer, void * param) -{ - switch(type) - { - case key_server: - qr2_keybuffer_add(buffer, HOSTNAME_KEY); - qr2_keybuffer_add(buffer, MAPNAME_KEY); - qr2_keybuffer_add(buffer, GAMETYPE_KEY); - break; - case key_player: - break; - case key_team: - break; - } - - GSI_UNUSED(peer); - GSI_UNUSED(param); -} - -static void ServerKeyCallback(PEER peer, int key, qr2_buffer_t buffer, void * param) -{ - switch(key) - { - case HOSTNAME_KEY: - qr2_buffer_add(buffer, Hostname); - break; - case MAPNAME_KEY: - qr2_buffer_add(buffer, Mapnames[Mapname]); - break; - case GAMETYPE_KEY: - qr2_buffer_add(buffer, Gametypes[Gametype]); - break; - default: - qr2_buffer_add(buffer, _T("")); - } - - GSI_UNUSED(peer); - GSI_UNUSED(param); -} - -static void AddErrorCallback(PEER peer, qr2_error_t error, gsi_char * errorString, void * param) -{ - QR2AddError = error; - - SetFailureReason(errorString); - - GSI_UNUSED(peer); - GSI_UNUSED(param); -} - -static void ListingGamesCallback(PEER peer, PEERBool success, const gsi_char * name, SBServer server, - PEERBool staging, int msg, int progress, void * param) -{ - int num; - int i; - MenuScreen * screen = GetMenuScreen(); - piConnection * connection = (piConnection *)peer; - - if(success == PEERFalse) - { - ListingError = PEERTrue; - return; - } - - num = SBServerListCount(&connection->gameList); - - for(i = 0 ; i < MAX_LIST_STRINGS ; i++) - { - if(i < num) - { - server = SBServerListNth(&connection->gameList, i); - strncpy(screen->list[i], SBServerGetStringValue(server, "hostname", "[no name]"), MAX_LIST_STRING_LEN + 1); - screen->list[i][MAX_LIST_STRING_LEN] = '\0'; - } - else - { - screen->list[i][0] = '\0'; - } - } - - GSI_UNUSED(name); - GSI_UNUSED(staging); - GSI_UNUSED(msg); - GSI_UNUSED(progress); - GSI_UNUSED(param); -} - -/************************************************************************/ -/* Sample Menu Funcs */ -/************************************************************************/ - -static void CheckingBackendAvailabilityInit(void) -{ - GSIStartAvailableCheck(GAMENAME); -} -static void CheckingBackendAvailabilityChose(const char * choice) -{ - if(choice == mscCancel) - ExitMenu(); -} -static void CheckingBackendAvailabilityThink(void) -{ - GSIACResult result = GSIAvailableCheckThink(); - PEERCallbacks callbacks; - - if(result == GSIACWaiting) - return; - - if(result != GSIACAvailable) - { - SetNextMenuScreen(&msBackendUnavailable); - return; - } - - memset(&callbacks, 0, sizeof(PEERCallbacks)); - callbacks.qrKeyList = KeyListCallback; - callbacks.qrServerKey = ServerKeyCallback; - callbacks.qrAddError = AddErrorCallback; - - Peer = peerInitialize(&callbacks); - if(!Peer) - { - SetNextMenuScreen(&msFailedToIntializePeerSDK); - return; - } - - if(!peerSetTitle(Peer, GAMENAME, SECRETKEY, GAMENAME, SECRETKEY, 0, 10, PEERTrue, NULL, NULL)) - { - peerShutdown(Peer); - SetNextMenuScreen(&msFailedToIntializePeerSDK); - return; - } - - SetNextMenuScreen(&msHostOrList); -} - -static void BackendUnavailableChose(const char * choice) -{ - if(choice == mscExit) - ExitMenu(); -} - -static void FailedToIntializePeerSDKChose(const char * choice) -{ - if(choice == mscExit) - ExitMenu(); -} - -static void HostOrListChose(const char * choice) -{ - if(choice == mscHostServer) - SetNextMenuScreen(&msChooseHostingName); - else if(choice == mscListServers) - SetNextMenuScreen(&msListingHosts); - else if(choice == mscExit) - { - peerShutdown(Peer); - ExitMenu(); - } -} - -static void ChooseHostingNameInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->keyboardText, Hostname, MAX_KEYBOARD_TEXT_LEN + 1); - screen->keyboardText[MAX_KEYBOARD_TEXT_LEN] = '\0'; -} -static void ChooseHostingNameChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(Hostname, screen->keyboardText, MAX_HOSTNAME_LEN + 1); - Hostname[MAX_HOSTNAME_LEN] = '\0'; - - if(choice == mscStartHosting) - SetNextMenuScreen(&msHostingServer); - else if(choice == mscCancel) - SetNextMenuScreen(&msHostOrList); -} - -static void HostingServerInit(void) -{ - PEERBool result; - MenuScreen * screen = GetMenuScreen(); - int line = 0; - - QR2AddError = e_qrnoerror; - - srand((unsigned int)time(NULL)); - Mapname = (rand() % NumMapnames); - Gametype = (rand() % NumGametypes); - - result = peerStartReporting(Peer); - - if(result == PEERFalse) - { - SetFailureReason("Failed to initialize hosting"); - SetNextMenuScreen(&msErrorStartingHost); - return; - } - - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN + 1, "Mapname: %s", Mapnames[Mapname]); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN + 1, "Gametype: %s", Gametypes[Gametype]); -} -static void HostingServerChose(const char * choice) -{ - if(choice == mscStopHosting) - { - peerStopGame(Peer); - SetNextMenuScreen(&msHostOrList); - } -} -static void HostingServerThink(void) -{ - peerThink(Peer); - - if(QR2AddError != e_qrnoerror) - { - char text[256]; - - peerStopGame(Peer); - snprintf(text, sizeof(text), "Failed to initialize hosting:\n%s", QR2ErrorToString(QR2AddError)); - SetFailureReason(text); - SetNextMenuScreen(&msErrorStartingHost); - } -} - -static void ErrorStartingHostInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - memcpy(screen->extraText, FailureReason, sizeof(FailureReason)); -} -static void ErrorStartingHostChose(const char * choice) -{ - if(choice == mscMainMenu) - SetNextMenuScreen(&msHostOrList); -} - -static void ListingHostsInit(void) -{ - const unsigned char keys[] = { HOSTNAME_KEY, MAPNAME_KEY, GAMETYPE_KEY }; - ListingError = FALSE; - - peerStartListingGames(Peer, keys, sizeof(keys), NULL, ListingGamesCallback, NULL); -} -static void ListingHostsChose(const char * choice) -{ - if(choice == mscViewHostInfo) - { - MenuScreen * screen = GetMenuScreen(); - piConnection * connection = (piConnection *)Peer; - - SelectedServer = SBServerListNth(&connection->gameList, screen->listSelection); - SetNextMenuScreen(&msViewHostInfo); - } - else if(choice == mscMainMenu) - { - peerStopListingGames(Peer); - SetNextMenuScreen(&msHostOrList); - } -} -static void ListingHostsThink(void) -{ - peerThink(Peer); - - if(ListingError == TRUE) - { - peerStopListingGames(Peer); - SetFailureReason("Failed to list hosts"); - SetNextMenuScreen(&msErrorListingHosts); - } -} - -static void ErrorListingHostsInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - memcpy(screen->extraText, FailureReason, sizeof(FailureReason)); -} -static void ErrorListingHostsChose(const char * choice) -{ - if(choice == mscMainMenu) - SetNextMenuScreen(&msHostOrList); -} - -static void ViewHostInfoInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - int line = 0; - - // hostname - strcpy(screen->extraText[line++], "[hostname]"); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " %s", SBServerGetStringValue(SelectedServer, "hostname", "N/A")); - - // public address - strcpy(screen->extraText[line++], "[public address]"); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " %s:%d", - SBServerGetPublicAddress(SelectedServer), SBServerGetPublicQueryPort(SelectedServer)); - - // private address - strcpy(screen->extraText[line++], "[private address]"); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " %s:%d", - SBServerGetPrivateAddress(SelectedServer), SBServerGetPrivateQueryPort(SelectedServer)); - - // mapname - strcpy(screen->extraText[line++], "[mapname]"); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " %s", SBServerGetStringValue(SelectedServer, "mapname", "N/A")); - - // gametype - strcpy(screen->extraText[line++], "[gametype]"); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " %s", SBServerGetStringValue(SelectedServer, "gametype", "N/A")); -} -static void ViewHostInfoChose(const char * choice) -{ - if(choice == mscBack) - SetNextMenuScreen(&msListingHosts); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/nitrosample.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/nitrosample.mcp deleted file mode 100644 index fb93f166b46..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/nitrosample/nitrosample.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/screen.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/screen.c deleted file mode 100644 index 03404cc3ad7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/screen.c +++ /dev/null @@ -1,237 +0,0 @@ -#include "..\nonport.h" -#include "screen.h" -#include "font.h" - -static u16 gTopScreen[SCREEN_HEIGHT * SCREEN_WIDTH]; -static u16 gBottomScreen[SCREEN_HEIGHT * SCREEN_WIDTH]; -static int gPos; -static int gPrintMode = PRINT_TO_DEBUGGER; - -static void VBlankIntr(void) -{ - // Reflect virtual screen to VRAM - DC_FlushRange( gTopScreen , sizeof( gTopScreen ) ); - DC_FlushRange( gBottomScreen , sizeof( gBottomScreen ) ); - GX_LoadBG0Scr( gTopScreen , 0 , sizeof( gTopScreen ) ); - GXS_LoadBG0Scr( gBottomScreen , 0 , sizeof( gBottomScreen ) ); - - // Set IRQ check flag - OS_SetIrqCheckFlag( OS_IE_V_BLANK ); -} - -void ClearTopScreen(void) -{ - MI_CpuClearFast( (void*)gTopScreen , sizeof( gTopScreen ) ); -// DC_FlushRange( gTopScreen , sizeof( gTopScreen ) ); -} - -void ClearBottomScreen(void) -{ - MI_CpuClearFast( (void*)gBottomScreen , sizeof( gBottomScreen ) ); -// DC_FlushRange( gBottomScreen , sizeof( gBottomScreen ) ); -} - -void ClearScreens(void) -{ - ClearTopScreen(); - ClearBottomScreen(); -} - -static void ScrollTopScreen(void) -{ - int i; - for(i = 0 ; i < (SCREEN_HEIGHT - 1) ; i++) - MI_CpuCopyFast((void*)&gTopScreen[SCREEN_WIDTH*(i+1)], (void*)&gTopScreen[SCREEN_WIDTH*i], SCREEN_WIDTH*sizeof(gTopScreen[0])); - MI_CpuClearFast((void*)&gTopScreen[(SCREEN_HEIGHT-1)*SCREEN_WIDTH], SCREEN_WIDTH*sizeof(gTopScreen[0])); -} - -void PrintChar(char c) -{ - u8 palette = 0xf; - - if(c == '\r') - return; - - if(gPos == SCREEN_WIDTH) - { - ScrollTopScreen(); - gPos = 0; - if(c == '\n') - return; - } - - if(c == '\n') - { - gPos = SCREEN_WIDTH; - } - else - { - gTopScreen[((SCREEN_HEIGHT - 1) * SCREEN_WIDTH) + gPos] = (u16)((palette << 12) | c); - gPos++; - } -} - -void Printf(const char* format, ...) -{ - va_list vlist; - - va_start(vlist, format); - VPrintf(format, vlist); - va_end(vlist); -} - -void VPrintf(const char* format, va_list args) -{ - if(gPrintMode & PRINT_TO_SCREEN) - { - static char text[2048]; - int i; - - vsnprintf(text, sizeof(text) - 1, format, args); - text[sizeof(text) - 1] = '\0'; - - for(i = 0 ; text[i] ; i++) - PrintChar(text[i]); - - SVC_WaitVBlankIntr(); - } - if(gPrintMode & PRINT_TO_DEBUGGER) - { - OS_VPrintf(format, args); - } -} - -void SetPrintMode(int mode) -{ - gPrintMode = mode; -} - -static void SetScreenLine(u16 * screen, int line, int offset, ScreenColor color, const char * text, int pos, int range, ScreenColor posColor) -{ - u8 palette = (u8)color; - u8 posPalette = (u8)posColor; - u16 val; - int i; - char c; - BOOL inRange; - - MI_CpuClearFast((void*)&screen[line*SCREEN_WIDTH], SCREEN_WIDTH*sizeof(gTopScreen[0])); - - for(i = 0 ; i < SCREEN_WIDTH ; i++) - { - c = text[i]; - - if(c == '\0') - break; - - inRange = ((i >= pos) && (i < (pos + range)))?TRUE:FALSE; - - val = (u16)(((inRange?posPalette:palette) << 12) | c); - screen[(line * SCREEN_WIDTH) + offset + i] = val; - } -} - -static void SetScreenLineCentered(u16 * screen, int line, ScreenColor color, const char * text) -{ - int len; - int offset; - - len = (int)strlen(text); - if(len < SCREEN_WIDTH) - offset = (((SCREEN_WIDTH - len) & ~1) / 2); - else - offset = 0; - - SetScreenLine(screen, line, offset, color, text, 0, 0, color); -} - -void SetTopScreenLine(int line, ScreenColor color, const char * text) -{ - SetScreenLine(gTopScreen, line, 0, color, text, 0, 0, color); -} - -void SetTopScreenLineCentered(int line, ScreenColor color, const char * text) -{ - SetScreenLineCentered(gTopScreen, line, color, text); -} - -void SetTopScreenLineHighlight(int line, ScreenColor color, const char * text, int pos, int range, ScreenColor posColor) -{ - SetScreenLine(gTopScreen, line, 0, color, text, pos, range, posColor); -} - -void SetBottomScreenLine(int line, ScreenColor color, const char * text) -{ - SetScreenLine(gBottomScreen, line, 0, color, text, 0, 0, color); -} - -void SetBottomScreenLineCentered(int line, ScreenColor color, const char * text) -{ - SetScreenLineCentered(gBottomScreen, line, color, text); -} - -void SetBottomScreenLineHighlight(int line, ScreenColor color, const char * text, int pos, int range, ScreenColor posColor) -{ - SetScreenLine(gBottomScreen, line, 0, color, text, pos, range, posColor); -} - -void ScreenInit(void) -{ - // init the graphics engine - GX_Init(); - - // turn off the display engine output - GX_DispOff(); - GXS_DispOff(); - - // setup the display memory - GX_SetBankForLCDC( GX_VRAM_LCDC_ALL ); - MI_CpuClearFast( (void*)HW_LCDC_VRAM , HW_LCDC_VRAM_SIZE ); - GX_DisableBankForLCDC(); - MI_CpuFillFast( (void*)HW_OAM,192 , HW_OAM_SIZE ); - MI_CpuClearFast( (void*)HW_PLTT , HW_PLTT_SIZE ); - MI_CpuFillFast( (void*)HW_DB_OAM , 192,HW_DB_OAM_SIZE ); - MI_CpuClearFast( (void*)HW_DB_PLTT , HW_DB_PLTT_SIZE ); - - // clear the screens - ClearScreens(); - - // 2D display setup for displaying character string - //g2 - GX_SetBankForBG( GX_VRAM_BG_128_A ); - G2_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256 , - GX_BG_COLORMODE_16 , - GX_BG_SCRBASE_0xf800 , // SCR base block 31 - GX_BG_CHARBASE_0x00000 , // CHR base block 0 - GX_BG_EXTPLTT_01 ); - G2_SetBG0Priority( 0 ); - G2_BG0Mosaic( FALSE ); - GX_SetGraphicsMode( GX_DISPMODE_GRAPHICS , GX_BGMODE_0,GX_BG0_AS_2D ); - GX_SetVisiblePlane( GX_PLANEMASK_BG0 ); - GX_LoadBG0Char( d_CharData , 0 , sizeof( d_CharData ) ); - GX_LoadBGPltt( d_PaletteData , 0 , sizeof( d_PaletteData ) ); - GX_LoadBG0Scr( gTopScreen , 0 , sizeof( gTopScreen ) ); - //g2s - GX_SetBankForSubBG( GX_VRAM_SUB_BG_128_C ); - G2S_SetBG0Control(GX_BG_SCRSIZE_TEXT_256x256 , - GX_BG_COLORMODE_16 , - GX_BG_SCRBASE_0xf800 , // SCR base block 31 - GX_BG_CHARBASE_0x00000 , // CHR base block 0 - GX_BG_EXTPLTT_01 ); - G2S_SetBG0Priority( 0 ); - G2S_BG0Mosaic( FALSE ); - GXS_SetGraphicsMode( GX_BGMODE_0 ); - GXS_SetVisiblePlane( GX_PLANEMASK_BG0 ); - GXS_LoadBG0Char( d_CharData , 0 , sizeof( d_CharData ) ); - GXS_LoadBGPltt( d_PaletteData , 0 , sizeof( d_PaletteData ) ); - GXS_LoadBG0Scr( gBottomScreen , 0 , sizeof( gBottomScreen ) ); - - // Interrupt setup - OS_SetIrqFunction( OS_IE_V_BLANK , VBlankIntr ); - OS_EnableIrqMask( OS_IE_V_BLANK ); - GX_VBlankIntr( TRUE ); - - // Start LCD display - GX_DispOn(); - GXS_DispOn(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/screen.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/screen.h deleted file mode 100644 index 1099d93ca8b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/screen.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _SCREEN_H_ -#define _SCREEN_H_ - -#define SCREEN_WIDTH 32 -#define SCREEN_HEIGHT 24 - -typedef enum -{ - SCBlack, - SCRed, - SCGreen, - SCBlue, - SCYellow, - SCPurple, - SCLightBlue, - SCDarkRed, - SCDarkGreen, - SCDarkBlue, - SCDarkYellow, - SCDarkPurple, - SCDarkLightBlue, - SCGray, - SCDarkGray, - SCWhite -} ScreenColor; - -// can be combined -#define PRINT_TO_SCREEN 1 // default -#define PRINT_TO_DEBUGGER 2 - -void ScreenInit(void); - -void ClearTopScreen(void); -void ClearBottomScreen(void); -void ClearScreens(void); - -void PrintChar(char c); -void Printf(const char* format, ...); -void VPrintf(const char* format, va_list args); -void SetPrintMode(int mode); - -void SetTopScreenLine(int line, ScreenColor color, const char * text); -void SetTopScreenLineCentered(int line, ScreenColor color, const char * text); -void SetTopScreenLineHighlight(int line, ScreenColor color, const char * text, int pos, int range, ScreenColor posColor); - -void SetBottomScreenLine(int line, ScreenColor color, const char * text); -void SetBottomScreenLineCentered(int line, ScreenColor color, const char * text); -void SetBottomScreenLineHighlight(int line, ScreenColor color, const char * text, int pos, int range, ScreenColor posColor); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/touch.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/touch.c deleted file mode 100644 index 8c06b7cb730..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/touch.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "../nonport.h" -#include "touch.h" - -void TouchInit(void) -{ - TPCalibrateParam calibrate; - - TP_Init(); - - if(!TP_GetUserInfo(&calibrate)) - OS_Panic("Failed to initialize touch panel"); - - TP_SetCalibrateParam(&calibrate); -} - -// 0 <= x <= 255 -// 0 <= y <= 191 -BOOL GetTouch(int * x, int * y) -{ - TPData data; - u32 result; - - result = TP_RequestCalibratedSampling(&data); - - if((result != 0) || (data.touch == TP_TOUCH_OFF)) - return FALSE; - - if(x) - *x = data.x; - if(y) - *y = data.y; - - return TRUE; -} - -void WaitForTouch(void) -{ - while(1) - { - SVC_WaitVBlankIntr(); - if(GetTouch(NULL, NULL)) - break; - } -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/touch.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/touch.h deleted file mode 100644 index fa1b41d5d34..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/touch.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _TOUCH_H_ -#define _TOUCH_H_ - -#define TOUCH_X_RANGE 256 -#define TOUCH_Y_RANGE 192 - -void TouchInit(void); - -// 0 <= x <= 255 -// 0 <= y <= 191 -BOOL GetTouch(int * x, int * y); - -void WaitForTouch(void); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/wireless.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/wireless.c deleted file mode 100644 index 7eb0736333b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/wireless.c +++ /dev/null @@ -1,1541 +0,0 @@ -#include "../nonport.h" -#include "wireless.h" -#include "screen.h" -#include "menu.h" -#include "backup.h" -#include "touch.h" - -#define USE_DHCP -#define SUPPORT_SAVED_CONFIGS - -#define AUTO_CONNECT -//static u8 MyBSSID[IW_BSSID_SIZE] = { 0x00, 0x0f, 0x66, 0x82, 0x38, 0x70 }; -static u8 MyBSSID[IW_BSSID_SIZE] = { 0x00, 0x09, 0x5b, 0x3f, 0x4b, 0xfb }; -static u8 MyWEP[IW_WEP_SIZE] = { WM_WEPMODE_NO }; - -/************************************************************************/ -/* Wireless Menu */ -/************************************************************************/ - -static const char mscUseSelectedConfiguration[] = "Use Selected Configuration"; -static const char mscCreateNewConfiguration[] = "Create New Configuration"; -static const char mscRenameSelectedConfiguration[] = "Rename Selected Configuration"; -static const char mscDeleteSelectedConfiguration[] = "Delete Selected Configuration"; -static const char mscExit[] = "Exit"; -static const char mscYes[] = "Yes"; -static const char mscNo[] = "No"; -static const char mscOK[] = "OK"; -static const char mscCancel[] = "Cancel"; -static const char mscRename[] = "Rename"; -static const char mscConnectToSelectedNetwork[] = "Connect to Selected Network"; -static const char mscViewNetworkInformation[] = "View Network Information"; -static const char mscBack[] = "Back"; -static const char mscEnter[] = "Enter"; -static const char mscUseKeyType[] = "Use Key Type"; -static const char mscRetry[] = "Retry"; -static const char mscContinue[] = "Continue"; -static const char mscSave[] = "Save"; -static const char mscDontSave[] = "Don't Save"; - -static void InitializingWirelessInit(void); -static void InitializingWirelessThink(void); -static void InitializingWirelessChose(const char * choice); - -static MenuScreenConfiguration msInitializingWireless = -{ - "Initializing Wireless", - { - { mscCancel } - }, - InitializingWirelessInit, - InitializingWirelessChose, - InitializingWirelessThink, - SCREEN_OPTION_ANIMATED -}; - -static void FailedToInitializeWirelessInit(void); -static void FailedToInitializeWirelessChose(const char * choice); - -static MenuScreenConfiguration msFailedToInitializeWireless = -{ - "Failed to Initialize Wireless", - { - { mscOK } - }, - FailedToInitializeWirelessInit, - FailedToInitializeWirelessChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void SelectNetworkConfigurationInit(void); -static void SelectNetworkConfigurationChose(const char * choice); - -static MenuScreenConfiguration msSelectNetworkConfiguration = -{ - "Select Network Configuration", - { - { mscUseSelectedConfiguration, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscCreateNewConfiguration }, - { mscRenameSelectedConfiguration, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscDeleteSelectedConfiguration, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscExit } - }, - SelectNetworkConfigurationInit, - SelectNetworkConfigurationChose, - NULL, - SCREEN_OPTION_LIST -}; - -static void RenameConfigurationInit(void); -static void RenameConfigurationChose(const char * choice); - -static MenuScreenConfiguration msRenameConfiguration = -{ - "Rename Configuration", - { - { mscRename }, - { mscCancel } - }, - RenameConfigurationInit, - RenameConfigurationChose, - NULL, - SCREEN_OPTION_KEYBOARD | SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void ConfirmDeleteInit(void); -static void ConfirmDeleteChose(const char * choice); - -static MenuScreenConfiguration msConfirmDelete = -{ - "Confirm Delete", - { - { mscYes }, - { mscNo } - }, - ConfirmDeleteInit, - ConfirmDeleteChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void ConfigurationDeletedChose(const char * choice); - -static MenuScreenConfiguration msConfigurationDeleted = -{ - "Configuration Deleted", - { - { mscOK } - }, - NULL, - ConfigurationDeletedChose -}; - -static void SearchingForNetworksInit(void); -static void SearchingForNetworksThink(void); -static void SearchingForNetworksChose(const char * choice); - -static MenuScreenConfiguration msSearchingForNetworks = -{ - "Searching for Networks", - { - { mscConnectToSelectedNetwork, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscViewNetworkInformation, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscCancel } - }, - SearchingForNetworksInit, - SearchingForNetworksChose, - SearchingForNetworksThink, - SCREEN_OPTION_ANIMATED | SCREEN_OPTION_LIST -}; - -static void SearchingForSavedNetworkInit(void); -static void SearchingForSavedNetworkThink(void); -static void SearchingForSavedNetworkChose(const char * choice); -static MenuScreenConfiguration msSearchingForSavedNetwork = -{ - "Searching for Saved Network", - { - { mscCancel } - }, - SearchingForSavedNetworkInit, - SearchingForSavedNetworkChose, - SearchingForSavedNetworkThink, - SCREEN_OPTION_ANIMATED -}; - -static void SearchFailedInit(void); -static void SearchFailedChose(const char * choice); - -static MenuScreenConfiguration msSearchFailed = -{ - "Search Failed", - { - { mscOK } - }, - SearchFailedInit, - SearchFailedChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void NetworkInformationInit(void); -static void NetworkInformationChose(const char * choice); - -static MenuScreenConfiguration msNetworkInformation = -{ - "Network Information", - { - { mscBack } - }, - NetworkInformationInit, - NetworkInformationChose, - NULL -}; - -static void SelectSecurityTypeInit(void); -static void SelectSecurityTypeChose(const char * choice); - -static MenuScreenConfiguration msSelectSecurityType = -{ - "Select Security Type", - { - { mscUseKeyType, CHOICE_OPTION_NEEDS_LIST_SELECTION }, - { mscBack } - }, - SelectSecurityTypeInit, - SelectSecurityTypeChose, - NULL, - SCREEN_OPTION_LIST -}; - -static void EnterSecurityKeyInit(void); -static void EnterSecurityKeyChose(const char * choice); - -static MenuScreenConfiguration msEnterSecurityKey = -{ - "Enter Security (WEP) Key", - { - { mscEnter }, - { mscBack } - }, - EnterSecurityKeyInit, - EnterSecurityKeyChose, - NULL, - SCREEN_OPTION_KEYBOARD -}; - -static void BadSecurityKeyEnteredInit(void); -static void BadSecurityKeyEnteredChose(const char * choice); - -static MenuScreenConfiguration msBadSecurityKeyEntered = -{ - "Bad Security Key Entered", - { - { mscBack } - }, - BadSecurityKeyEnteredInit, - BadSecurityKeyEnteredChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void ConnectingToNetworkInit(void); -static void ConnectingToNetworkChose(const char * choice); -static void ConnectingToNetworkThink(void); - -static MenuScreenConfiguration msConnectingToNetwork = -{ - "Connecting to Network", - { - { mscCancel } - }, - ConnectingToNetworkInit, - ConnectingToNetworkChose, - ConnectingToNetworkThink, - SCREEN_OPTION_ANIMATED -}; - -static void FailedToConnectToNetworkInit(void); -static void FailedToConnectToNetworkChose(const char * choice); - -static MenuScreenConfiguration msFailedToConnectToNetwork = -{ - "Failed to Connect to Network", - { - { mscBack } - }, - FailedToConnectToNetworkInit, - FailedToConnectToNetworkChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void ConnectingToInternetInit(void); -static void ConnectingToInternetChose(const char * choice); -static void ConnectingToInternetThink(void); - -static MenuScreenConfiguration msConnectingToInternet = -{ - "Connecting to Internet", - { - { mscCancel } - }, - ConnectingToInternetInit, - ConnectingToInternetChose, - ConnectingToInternetThink, - SCREEN_OPTION_ANIMATED -}; - -static void FailedToConnectToInternetInit(void); -static void FailedToConnectToInternetChose(const char * choice); - -static MenuScreenConfiguration msFailedToConnectToInternet = -{ - "Failed to Connect to Internet", - { - { mscBack } - }, - FailedToConnectToInternetInit, - FailedToConnectToInternetChose, - NULL, - SCREEN_OPTION_EXTRAS_CENTERED -}; - -static void ConnectedToInternetInit(void); -static void ConnectedToInternetChose(const char * choice); - -static MenuScreenConfiguration msConnectedToInternet = -{ - "Connected to Internet", - { - { mscContinue } - }, - ConnectedToInternetInit, - ConnectedToInternetChose -}; - -static void SaveNetworkConfigurationInit(void); -static void SaveNetworkConfigurationChose(const char * choice); - -static MenuScreenConfiguration msSaveNetworkConfiguration = -{ - "Save Network Configuration", - { - { mscSave}, - { mscDontSave } - }, - SaveNetworkConfigurationInit, - SaveNetworkConfigurationChose, - NULL, - SCREEN_OPTION_KEYBOARD -}; - -static void ConfigurationSavedChose(const char * choice); - -static MenuScreenConfiguration msConfigurationSaved = -{ - "Configuration Saved", - { - { mscContinue } - }, - NULL, - ConfigurationSavedChose -}; - -static MenuScreenConfiguration msCancelled = -{ - "Wireless Setup Cancelled" -}; - -static MenuScreenConfiguration msFailed = -{ - "Wireless Setup Failed" -}; - -/************************************************************************/ -/* Wireless Funcs */ -/************************************************************************/ - -#define APLIST_COUNT 8 - -#define MAX_SAVED_CONFIGS 3 -#define MAX_CONFIG_NAME_LEN 32 - -#define BSSDESC_MAX 16 - -static const char MagicString[] = "GOA-SAVED-CONFIGS"; -static const size_t MagicStringLen = sizeof(MagicString); - -typedef struct SavedConfig -{ - char name[MAX_CONFIG_NAME_LEN + 1]; - u8 bssid[IW_BSSID_SIZE]; - u8 wep[IW_WEP_SIZE]; -} SavedConfig; - -typedef struct SavedFile -{ - char magic[MagicStringLen]; - u8 numConfigs; - SavedConfig configs[MAX_SAVED_CONFIGS]; -} SavedFile; - -static SavedFile SavedSettings; - -static u8 IWBuffer[IW_WORK_SIZE] ATTRIBUTE_ALIGN(32); - -static u8 BSSID[IW_BSSID_SIZE]; - -static u8 WEPAny[IW_WEP_SIZE]; -static char WEPEntered[256]; -static u8 WEPKey[IW_WEP_SIZE]; - -static unsigned long BSSDescBuffer[IW_BSS_SIZE * BSSDESC_MAX / 4]; - -static IWConfig WirelessConfig = -{ - 3, - BSSDescBuffer, - IW_BSS_SIZE * BSSDESC_MAX, - 0 -}; - -static WMBssDesc APList[APLIST_COUNT]; -static int APIndex; -static int WEPType; - -static char FailureReason[MAX_EXTRA_TEXT_STRING_LEN + 1]; - -static int SelectedConfig; - -static BOOL NewConfig; - -static gsi_bool KeepPolling; - -static void * soAlloc(u32 name, s32 size) -{ - OSIntrMode nOSIntrMode; - void * alloc = NULL; - - GSI_UNUSED(name); - - nOSIntrMode = OS_DisableInterrupts(); - alloc = OS_Alloc((u32)size); - OS_RestoreInterrupts(nOSIntrMode); - - return alloc; -} - -static void soFree(u32 name, void * ptr, s32 size) -{ - OSIntrMode nOSIntrMode; - - GSI_UNUSED(name); - GSI_UNUSED(size); - - nOSIntrMode = OS_DisableInterrupts(); - OS_Free(ptr); - OS_RestoreInterrupts(nOSIntrMode); -} - -SOConfig SocketsConfig = -{ - SOC_VENDOR_NINTENDO, // vendor - SOC_VERSION, // version - - soAlloc, // alloc - soFree, // free - -#if defined(USE_DHCP) - SOC_FLAG_DHCP, // flag - SOC_HtoNl(SOC_INADDR_ANY), // addr - SOC_HtoNl(SOC_INADDR_ANY), // netmask - SOC_HtoNl(SOC_INADDR_ANY), // router - SOC_HtoNl(SOC_INADDR_ANY), // dns1 - SOC_HtoNl(SOC_INADDR_ANY), // dns2 -#else - 0, // flag - SOC_HtoNl(0xC0A8000C), // addr 192.168. 0. 12 - SOC_HtoNl(0xFFFFFF00), // netmask 255.255.255. 0 - SOC_HtoNl(0xC0A80001), // router 192.168. 0. 1 - SOC_HtoNl(0xC0A80001), // dns1 192.168. 0. 1 - SOC_HtoNl(SOC_INADDR_ANY), // dns2 -#endif - 4096, // timeWaitBuffer - 4096, // reassemblyBuffer - 0, // maximum transmission unit size - - // TCP - 0, // default TCP receive window size (default 2 x MSS) - 0, // default TCP total retransmit timeout value (default 100 sec) - - // PPP - NULL, - NULL, - - // PPPoE - NULL, - - // DHCP - "NintendoDS", // DHCP host name - 50, // TCP total retransmit times (default 4) - - // UDP - 0, // default UDP send buffer size (default 1472) - 0 // defualt UDP receive buffer size (default 4416) -}; - -static const char * IWResultToString(int result) -{ - if(result == IW_RESULT_SUCCESS) - return "success"; - if(result == IW_RESULT_FAILURE) - return "failure"; - if(result == IW_RESULT_PROGRESS) - return "progress"; - if(result == IW_RESULT_ACCEPT) - return "accept"; - if(result == IW_RESULT_REJECT) - return "reject"; - if(result == IW_RESULT_WMDISABLE) - return "wmdisable"; - if(result == IW_RESULT_MEMORYERROR) - return "memoryerror"; - if(result == IW_RESULT_FATALERROR) - return "fatalerror"; - return "unknown result"; -} - -static const char * IWNotifyToString(int notify) -{ - if(notify == IW_NOTIFY_COMMON) - return "common"; - if(notify == IW_NOTIFY_STARTUP) - return "startup"; - if(notify == IW_NOTIFY_CLEANUP) - return "cleanup"; - if(notify == IW_NOTIFY_SEARCH_START) - return "search_start"; - if(notify == IW_NOTIFY_SEARCH_END) - return "search_end"; - if(notify == IW_NOTIFY_CONNECT) - return "connect"; - if(notify == IW_NOTIFY_DISCONNECT) - return "disconnect"; - if(notify == IW_NOTIFY_FOUND) - return "found"; - if(notify == IW_NOTIFY_BEACON_LOST) - return "beacon_lost"; - if(notify == IW_NOTIFY_FATALERROR) - return "fatalerror"; - return "unknown notify"; -} - -static const char * IWPhaseToString(int phase) -{ - if(phase == IW_PHASE_NULL) - return "null"; - if(phase == IW_PHASE_WAIT) - return "wait"; - if(phase == IW_PHASE_WAIT_IDLE) - return "wait_idle"; - if(phase == IW_PHASE_IDLE) - return "idle"; - if(phase == IW_PHASE_IDLE_WAIT) - return "idle_wait"; - if(phase == IW_PHASE_IDLE_SCAN) - return "idle_scan"; - if(phase == IW_PHASE_SCAN) - return "scan"; - if(phase == IW_PHASE_SCAN_IDLE) - return "scan_idle"; - if(phase == IW_PHASE_IDLE_LINK) - return "idle_link"; - if(phase == IW_PHASE_LINK) - return "link"; - if(phase == IW_PHASE_LINK_IDLE) - return "link_idle"; - if(phase == IW_PHASE_FATALERROR) - return "fatalerror"; - return "unknown phase"; -} - -static void IW_Callback(IWNotice * arg) -{ - GSI_UNUSED(arg); - OS_TPrintf("Notify: %s | Result: %s\n", IWNotifyToString(arg->notify), IWResultToString(arg->result)); -} - -static gsi_bool IW_CheckResult(int result, const char * funcName) -{ - assert(funcName); - - OS_Printf("%s: %s\n", funcName, IWResultToString(result)); - switch(result) - { - case IW_RESULT_SUCCESS: - case IW_RESULT_PROGRESS: - case IW_RESULT_ACCEPT: - return gsi_true; - case IW_RESULT_FAILURE: - case IW_RESULT_REJECT: - OS_Printf(" IW_Phase = %s\n", IWPhaseToString(IW_GetPhase())); - case IW_RESULT_WMDISABLE: - case IW_RESULT_MEMORYERROR: - case IW_RESULT_FATALERROR: - default: - snprintf(FailureReason, sizeof(FailureReason), "%s result: %s", funcName, IWResultToString(result)); - return gsi_false; - } -} - -static gsi_bool IW_Poll(int polling, int success, const char * funcName, gsi_bool * keepPolling) -{ - int phase; - - assert(funcName); - - phase = IW_GetPhase(); - if(phase == polling) - { - if(keepPolling) - *keepPolling = gsi_true; - return gsi_true; - } - - if(keepPolling) - *keepPolling = gsi_false; - - if(phase == success) - return gsi_true; - - snprintf(FailureReason, sizeof(FailureReason), "%s phase: %s", funcName, IWPhaseToString(phase)); - return gsi_false; -} - -static void LoadSettings(void) -{ - if(BackupExists()) - { - // load the saved settings from the backup - ReadFromBackup(&SavedSettings, sizeof(SavedSettings)); - } - else - { - // use a default when there isn't a backup device - // this makes debugging with the dev kit easier - SavedConfig config; - strcpy(config.name, "Default WEP"); - memcpy(config.bssid, MyBSSID, sizeof(MyBSSID)); - memcpy(config.wep, MyWEP, sizeof(MyWEP)); - - memcpy(SavedSettings.magic, MagicString, MagicStringLen); - SavedSettings.numConfigs = 1; - memcpy(&SavedSettings.configs[0], &config, sizeof(SavedConfig)); - } - - if(memcmp(SavedSettings.magic, MagicString, MagicStringLen) != 0) - SavedSettings.numConfigs = 0; - - SavedSettings.numConfigs = (u8)min(SavedSettings.numConfigs, MAX_SAVED_CONFIGS); -} - -static void SaveSettings(void) -{ - if(BackupExists()) - { - memcpy(SavedSettings.magic, MagicString, MagicStringLen); - WriteToBackup(&SavedSettings, sizeof(SavedSettings)); - } -} - -void WirelessInit(void) -{ - // load wireless settings - LoadSettings(); - - // start the menu - StartMenuScreen(&msInitializingWireless); -} - -void WirelessCleanup(void) -{ - int result; - - SOC_Cleanup(); - - result = IW_Disconnect(); - IW_CheckResult(result, "IW_Disconnect"); - - do - { - if(!IW_Poll(IW_PHASE_LINK_IDLE, IW_PHASE_IDLE, "IW_Disconnect", &KeepPolling)) - OS_TPrintf("Failuring waiting for wait phase\n"); - } while(KeepPolling); - - result = IW_Cleanup(); - IW_CheckResult(result, "IW_Cleanup"); - - do - { - if(!IW_Poll(IW_PHASE_IDLE_WAIT, IW_PHASE_WAIT, "IW_Cleanup", &KeepPolling)) - OS_TPrintf("Failuring waiting for wait phase\n"); - } while(KeepPolling); - - result = IW_Exit(); - IW_CheckResult(result, "IW_Exit"); -} - -/************************************************************************/ -/* Wireless Menu Funcs */ -/************************************************************************/ - -static void InitializingWirelessInit(void) -{ - int result; - - // init the wireless library - result = IW_Init(IWBuffer, sizeof(IWBuffer)); - if(!IW_CheckResult(result, "IW_Init")) - { - SetNextMenuScreen(&msFailedToInitializeWireless); - return; - } - - // startup wireless - result = IW_Startup(&WirelessConfig, IW_Callback); - if(!IW_CheckResult(result, "IW_Startup")) - { - SetNextMenuScreen(&msFailedToInitializeWireless); - return; - } - - KeepPolling = gsi_true; -} - -static void InitializingWirelessChose(const char * choice) -{ - if(choice == mscCancel) - SetNextMenuScreen(&msCancelled); -} - -static void InitializingWirelessThink(void) -{ - // poll the phase - if(KeepPolling) - { - if(!IW_Poll(IW_PHASE_WAIT_IDLE, IW_PHASE_IDLE, "IW_Startup", &KeepPolling)) - { - SetNextMenuScreen(&msFailedToInitializeWireless); - return; - } - if(KeepPolling) - return; - } - -#if defined(AUTO_CONNECT) - { - memcpy(WEPKey, MyWEP, sizeof(WEPKey)); - memcpy(BSSID, MyBSSID, WM_SIZE_BSSID); - NewConfig = FALSE; - SetNextMenuScreen(&msSearchingForSavedNetwork); - return; - } -#endif - - // we're done with the startup -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msSearchingForNetworks); -} - -static void FailedToInitializeWirelessInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], FailureReason, MAX_EXTRA_TEXT_STRING_LEN + 1); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN] = '\0'; -} - -static void FailedToInitializeWirelessChose(const char * choice) -{ - if(choice == mscOK) - SetNextMenuScreen(&msFailed); -} - -static void SelectNetworkConfigurationInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - int i; - - for(i = 0 ; i < SavedSettings.numConfigs ; i++) - { - strncpy(screen->list[i], SavedSettings.configs[i].name, MAX_LIST_STRING_LEN); - screen->list[i][MAX_LIST_STRING_LEN - 1] = '\0'; - } -} - -static void SelectNetworkConfigurationChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - SelectedConfig = screen->listSelection; - - if(choice == mscUseSelectedConfiguration) - { - memcpy(WEPKey, SavedSettings.configs[SelectedConfig].wep, sizeof(WEPKey)); - memcpy(BSSID, SavedSettings.configs[SelectedConfig].bssid, WM_SIZE_BSSID); - NewConfig = FALSE; - //SetNextMenuScreen(&msConnectingToNetwork); - SetNextMenuScreen(&msSearchingForSavedNetwork); - } - else if(choice == mscCreateNewConfiguration) - { - SetNextMenuScreen(&msSearchingForNetworks); - } - else if(choice == mscRenameSelectedConfiguration) - { - SetNextMenuScreen(&msRenameConfiguration); - } - else if(choice == mscDeleteSelectedConfiguration) - { - SetNextMenuScreen(&msConfirmDelete); - } - else if(choice == mscExit) - { - SetNextMenuScreen(&msCancelled); - } -} - -static void RenameConfigurationInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], SavedSettings.configs[SelectedConfig].name, MAX_EXTRA_TEXT_STRING_LEN); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN - 1] = '\0'; - - strncpy(screen->keyboardText, SavedSettings.configs[SelectedConfig].name, MAX_KEYBOARD_TEXT_LEN); - screen->keyboardText[MAX_KEYBOARD_TEXT_LEN - 1] = '\0'; -} - -static void RenameConfigurationChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - if(choice == mscRename) - { - strncpy(SavedSettings.configs[SelectedConfig].name, screen->keyboardText, MAX_CONFIG_NAME_LEN); - SavedSettings.configs[SelectedConfig].name[MAX_CONFIG_NAME_LEN - 1] = '\0'; - - SaveSettings(); - - SetNextMenuScreen(&msSelectNetworkConfiguration); - } - else if(choice == mscCancel) - { - SetNextMenuScreen(&msSelectNetworkConfiguration); - } -} - -static void ConfirmDeleteInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], SavedSettings.configs[SelectedConfig].name, MAX_EXTRA_TEXT_STRING_LEN); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN - 1] = '\0'; -} - -static void ConfirmDeleteChose(const char * choice) -{ - int i; - - if(choice == mscYes) - { - SavedSettings.numConfigs--; - for(i = SelectedConfig ; i < SavedSettings.numConfigs ; i++) - memcpy(&SavedSettings.configs[i], &SavedSettings.configs[i + 1], sizeof(SavedConfig)); - - SaveSettings(); - - SetNextMenuScreen(&msConfigurationDeleted); - } - else if(choice == mscNo) - { - SetNextMenuScreen(&msSelectNetworkConfiguration); - } -} - -static void ConfigurationDeletedChose(const char * choice) -{ - if(choice == mscOK) - { - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else - SetNextMenuScreen(&msSearchingForNetworks); - } -} - -static void SearchingForNetworksInit(void) -{ - int result; - - // search for access points - result = IW_Search(IW_BSSID_ANY, IW_ESSID_ANY, IW_OPT_CHANNEL_ALL|IW_OPT_SCANTYPE_PASSIVE); - if(!IW_CheckResult(result, "IW_Search")) - { - SetNextMenuScreen(&msSearchFailed); - return; - } - - KeepPolling = gsi_true; -} - -static void SearchingForNetworksChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - APIndex = screen->listSelection; - - if(choice == mscViewNetworkInformation) - { - SetNextMenuScreen(&msNetworkInformation); - return; - } - - // we're connecting or cancelling, so stop searching - IW_Search(NULL, NULL, 0); - - if(choice == mscConnectToSelectedNetwork) - { - SetNextMenuScreen(&msSelectSecurityType); - } - else if(choice == mscCancel) - { -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msCancelled); - } -} - -static void SearchingForNetworksThink(void) -{ - MenuScreen * screen; - int i; - int count; - WMBssDesc * desc; - - if(KeepPolling) - { - // poll the search - if(!IW_Poll(IW_PHASE_IDLE_SCAN, IW_PHASE_SCAN, "IW_Search", &KeepPolling)) - { - IW_Search(NULL, NULL, 0); - SetNextMenuScreen(&msSearchFailed); - return; - } - if(KeepPolling) - return; - } - - // get the screen - screen = GetMenuScreen(); - - // lock the AP descriptions - IW_LockBssDesc(1); - - // get a count - count = IW_CountBssDesc(); - count = min(count, APLIST_COUNT); - - // copy the access points - for(i = 0 ; i < count ; i++) - { - desc = IW_PointBssDesc(i); - if(!desc) - { - count = i; - break; - } - - memcpy(&APList[i], desc, sizeof(WMBssDesc)); - } - - // unlock the APs - IW_LockBssDesc(0); - - // fill the screen list - for(i = 0 ; i < MAX_LIST_STRINGS ; i++) - { - if(i < count) - { - if(APList[i].ssidLength > 0) - snprintf(screen->list[i], MAX_LIST_STRING_LEN, "%s", APList[i].ssid); - else - strcpy(screen->list[i], "[no name]"); - } - else - { - screen->list[i][0] = '\0'; - } - } -} - -static void SearchingForSavedNetworkInit(void) -{ - int result; - - // search for access points - result = IW_Search(BSSID, IW_ESSID_ANY, IW_OPT_CHANNEL_ALL|IW_OPT_SCANTYPE_PASSIVE); - if(!IW_CheckResult(result, "IW_Search")) - { - SetNextMenuScreen(&msSearchFailed); - return; - } - - KeepPolling = gsi_true; -} - -static void SearchingForSavedNetworkChose(const char * choice) -{ - if(choice == mscCancel) - { - // stop searching - IW_Search(NULL, NULL, 0); - - SetNextMenuScreen(&msSelectNetworkConfiguration); - } -} - -static void SearchingForSavedNetworkThink(void) -{ - int count; - WMBssDesc * desc = NULL; - - if(KeepPolling) - { - // poll the search - if(!IW_Poll(IW_PHASE_IDLE_SCAN, IW_PHASE_SCAN, "IW_Search", &KeepPolling)) - { - IW_Search(NULL, NULL, 0); - SetNextMenuScreen(&msSearchFailed); - return; - } - if(KeepPolling) - return; - } - // lock the AP descriptions - IW_LockBssDesc(1); - - // get a count - count = IW_CountBssDesc(); - - // if we found it, copy it - if(count > 0) - { - desc = IW_PointBssDesc(0); - if(desc) - { - memcpy(&APList[0], desc, sizeof(WMBssDesc)); - APIndex = 0; - } - } - - // unlock the APs - IW_LockBssDesc(0); - - // check if we found it - if(desc) - { - // stop searching - IW_Search(NULL, NULL, 0); - - // connect - SetNextMenuScreen(&msConnectingToNetwork); - } -} - -static void SearchFailedInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], FailureReason, MAX_EXTRA_TEXT_STRING_LEN + 1); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN] = '\0'; -} - -static void SearchFailedChose(const char * choice) -{ - if(choice == mscOK) - { -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msFailed); - } -} - -static void NetworkInformationInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - // BSSID / MAC - snprintf(screen->extraText[0], MAX_EXTRA_TEXT_STRING_LEN, - " MAC: %02X:%02X:%02X:%02X:%02X:%02X", - APList[APIndex].bssid[0], - APList[APIndex].bssid[1], - APList[APIndex].bssid[2], - APList[APIndex].bssid[3], - APList[APIndex].bssid[4], - APList[APIndex].bssid[5]); - - // channel - snprintf(screen->extraText[1], MAX_EXTRA_TEXT_STRING_LEN, - " Channel: %d", - APList[APIndex].channel); -} - -static void NetworkInformationChose(const char * choice) -{ - if(choice == mscBack) - SetNextMenuScreen(&msSearchingForNetworks); -} - -static void SelectSecurityTypeInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strcpy(screen->list[0], "No WEP key"); - strcpy(screen->list[1], "40/64 bit key"); - strcpy(screen->list[2], "104 bit key"); - strcpy(screen->list[3], "128 bit key"); -} - -static void SelectSecurityTypeChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - WEPType = screen->listSelection; - - if(choice == mscUseKeyType) - { - if(WEPType == WM_WEPMODE_NO) - { - memset(WEPKey, 0, sizeof(WEPKey)); - memcpy(BSSID, APList[APIndex].bssid, WM_SIZE_BSSID); - NewConfig = TRUE; - SetNextMenuScreen(&msConnectingToNetwork); - } - else - { - SetNextMenuScreen(&msEnterSecurityKey); - } - } - else if(choice == mscBack) - { - SetNextMenuScreen(&msSearchingForNetworks); - } -} - -static int HexToInt(char hex) -{ - switch(hex) - { - case '0': - return 0; - case '1': - return 1; - case '2': - return 2; - case '3': - return 3; - case '4': - return 4; - case '5': - return 5; - case '6': - return 6; - case '7': - return 7; - case '8': - return 8; - case '9': - return 9; - case 'A': - return 10; - case 'B': - return 11; - case 'C': - return 12; - case 'D': - return 13; - case 'E': - return 14; - case 'F': - return 15; - } - - return -1; -} - -static void EnterSecurityKeyInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->keyboardText, WEPEntered, sizeof(screen->keyboardText)); - screen->keyboardText[sizeof(screen->keyboardText) - 1] = '\0'; -} - -static void EnterSecurityKeyChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - // save off the key as entered - strncpy(WEPEntered, screen->keyboardText, sizeof(WEPEntered)); - WEPEntered[sizeof(WEPEntered) - 1] = '\0'; - - if(choice == mscEnter) - { - int i; - int len; - int correctLen; - int index; - int val[2]; - char badChar; - // get the key len - len = (int)strlen(screen->keyboardText); - - // get the correct len for the type - if(WEPType == WM_WEPMODE_40BIT) - correctLen = (40 / 4); - else if(WEPType == WM_WEPMODE_104BIT) - correctLen = (104 / 4); - else if(WEPType == WM_WEPMODE_128BIT) - correctLen = (128 / 4); - else - correctLen = -1; - - // check the len - if(len != correctLen) - { - snprintf(FailureReason, sizeof(FailureReason), "Bad length (%d instead of %d)", len, correctLen); - SetNextMenuScreen(&msBadSecurityKeyEntered); - return; - } - - // convert the keyboard text to hex - memset(WEPKey, 0, sizeof(WEPKey)); - WEPKey[0] = (u8)WEPType; - index = 2; - for(i = 0 ; i < len ; i += 2) - { - // convert the next two chars to ints - val[0] = HexToInt(screen->keyboardText[i]); - val[1] = HexToInt(screen->keyboardText[i + 1]); - - // check the values - if((val[0] == -1) || (val[1] == -1)) - { - if(val[0] == -1) - badChar = screen->keyboardText[i]; - else - badChar = screen->keyboardText[i + 1]; - snprintf(FailureReason, sizeof(FailureReason), "Bad value ('%c' instead of hex)", badChar); - SetNextMenuScreen(&msBadSecurityKeyEntered); - return; - } - - // enter them in the WEP array - WEPKey[index++] = (u8)((val[0] << 4) | val[1]); - } - - memcpy(BSSID, APList[APIndex].bssid, WM_SIZE_BSSID); - NewConfig = TRUE; - SetNextMenuScreen(&msConnectingToNetwork); - } - else if (choice == mscBack) - { - SetNextMenuScreen(&msSelectSecurityType); - } -} - -static void BadSecurityKeyEnteredInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], FailureReason, MAX_EXTRA_TEXT_STRING_LEN + 1); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN] = '\0'; -} - -static void BadSecurityKeyEnteredChose(const char * choice) -{ - if(choice == mscBack) - SetNextMenuScreen(&msEnterSecurityKey); -} - -static void ConnectingToNetworkInit(void) -{ - int result; - - // make sure we're idle - OS_TPrintf("Waiting for idle...\n"); - while(IW_GetPhase() != IW_PHASE_IDLE) - ; - - // connect - result = IW_Connect(&APList[APIndex], WEPKey, IW_OPT_POWER_FULL); - if(!IW_CheckResult(result, "IW_Connect")) - { - SetNextMenuScreen(&msFailedToConnectToNetwork); - return; - } - - KeepPolling = gsi_true; -} - -static void ConnectingToNetworkChose(const char * choice) -{ - if(choice == mscCancel) - { - // disconnect - IW_Disconnect(); - -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msSearchingForNetworks); - } -} - -static void ConnectingToNetworkThink(void) -{ - if(KeepPolling) - { - // poll the connect - if(!IW_Poll(IW_PHASE_IDLE_LINK, IW_PHASE_LINK, "IW_Connect", &KeepPolling)) - { - IW_Disconnect(); - SetNextMenuScreen(&msFailedToConnectToNetwork); - return; - } - if(KeepPolling) - return; - } - - // we're connected to the network - SetNextMenuScreen(&msConnectingToInternet); -} - -static void FailedToConnectToNetworkInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], FailureReason, MAX_EXTRA_TEXT_STRING_LEN + 1); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN] = '\0'; -} - -static void FailedToConnectToNetworkChose(const char * choice) -{ - if(choice == mscBack) - { -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msSearchingForNetworks); - } -} - -static void ConnectingToInternetInit(void) -{ - int result; - BOOL linkStatus = FALSE; - - // init the sockets library - SOC_Init(); - - // get the IP link - do - { - IP_GetLinkState(NULL, &linkStatus); - } - while(!linkStatus); - - // startup the sockets library - result = SOC_Startup(&SocketsConfig); - if(result < 0) - { - snprintf(FailureReason, sizeof(FailureReason), "SOC_Startup failed: %d", result); - SetNextMenuScreen(&msFailedToConnectToInternet); - return; - } -} - -static void ConnectingToInternetChose(const char * choice) -{ - if(choice == mscCancel) - { - SOC_Cleanup(); - IW_Disconnect(); - -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msSearchingForNetworks); - } -} - -static void ConnectingToInternetThink(void) -{ - u32 localIP; - - // check if we have been allocated an IP - localIP = (u32)SOC_GetHostID(); - if(localIP != SOC_HtoNl(SOC_INADDR_ANY)) - { -#if !defined(AUTO_CONNECT) - SetNextMenuScreen(&msConnectedToInternet); -#else - u8 ip[IP_ALEN]; - SOInAddr dns1, dns2; - u8 mac[MAC_ALEN]; - - IP_GetAddr(NULL, ip); - OS_Printf("IP: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]); - - IP_GetGateway (NULL, ip); - OS_Printf("Gateway: %d.%d.%d.%d\n", ip[0], ip[1], ip[2], ip[3]); - - SOC_GetResolver(&dns1, &dns2); - OS_Printf("DNS1: %s\n", inet_ntoa(dns1)); - OS_Printf("DNS2: %s\n", inet_ntoa(dns2)); - - IP_GetMacAddr(NULL, mac); - OS_Printf("MAC: %02X-%02X-%02X-%02X-%02X-%02X\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - - ExitMenu(); -#endif - } -} - -static void FailedToConnectToInternetInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->extraText[0], FailureReason, MAX_EXTRA_TEXT_STRING_LEN + 1); - screen->extraText[0][MAX_EXTRA_TEXT_STRING_LEN] = '\0'; -} - -static void FailedToConnectToInternetChose(const char * choice) -{ - if(choice == mscBack) - { -#if defined(SUPPORT_SAVED_CONFIGS) - if(SavedSettings.numConfigs > 0) - SetNextMenuScreen(&msSelectNetworkConfiguration); - else -#endif - SetNextMenuScreen(&msSearchingForNetworks); - } -} - -static void ConnectedToInternetInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - u8 ip[IP_ALEN]; - SOInAddr dns1, dns2; - u8 mac[MAC_ALEN]; - int line = 0; - - IP_GetAddr(NULL, ip); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " IP: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - - IP_GetAlias(NULL, ip); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " Alias: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - - IP_GetBroadcastAddr(NULL, ip); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " Broadcast: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - - IP_GetNetmask (NULL, ip); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " Netmask: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - - IP_GetGateway (NULL, ip); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " Gateway: %d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); - - SOC_GetResolver(&dns1, &dns2); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " DNS1: %s", inet_ntoa(dns1)); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " DNS2: %s", inet_ntoa(dns2)); - - IP_GetMacAddr(NULL, mac); - snprintf(screen->extraText[line++], MAX_EXTRA_TEXT_STRING_LEN, - " MAC: %02X-%02X-%02X-%02X-%02X-%02X", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); -} - -static void ConnectedToInternetChose(const char * choice) -{ - if(choice == mscContinue) - { -#if defined(SUPPORT_SAVED_CONFIGS) - if(BackupExists() && NewConfig && (SavedSettings.numConfigs < MAX_SAVED_CONFIGS)) - SetNextMenuScreen(&msSaveNetworkConfiguration); - else -#endif - ExitMenu(); - } -} - -static void SaveNetworkConfigurationInit(void) -{ - MenuScreen * screen = GetMenuScreen(); - - strncpy(screen->keyboardText, (const char *)APList[APIndex].ssid, MAX_KEYBOARD_TEXT_LEN); - screen->keyboardText[MAX_KEYBOARD_TEXT_LEN - 1] = '\0'; -} - -static void SaveNetworkConfigurationChose(const char * choice) -{ - MenuScreen * screen = GetMenuScreen(); - - if(choice == mscSave) - { - memcpy(SavedSettings.configs[SavedSettings.numConfigs].bssid, BSSID, IW_BSSID_SIZE); - memcpy(SavedSettings.configs[SavedSettings.numConfigs].wep, WEPKey, IW_WEP_SIZE); - strncpy(SavedSettings.configs[SavedSettings.numConfigs].name, screen->keyboardText, MAX_CONFIG_NAME_LEN); - SavedSettings.configs[SavedSettings.numConfigs].name[MAX_CONFIG_NAME_LEN - 1] = '\0'; - SavedSettings.numConfigs++; - SaveSettings(); - - SetNextMenuScreen(&msConfigurationSaved); - } - else if(choice == mscDontSave) - { - ExitMenu(); - } -} - -static void ConfigurationSavedChose(const char * choice) -{ - if(choice == mscContinue) - ExitMenu(); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/wireless.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/wireless.h deleted file mode 100644 index 18734eaafb2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/wireless.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _WIRELESS_H_ -#define _WIRELESS_H_ - -void WirelessInit(void); -void WirelessCleanup(void); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/Makefile deleted file mode 100644 index 9d7390f348c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -SHELL = /bin/sh -GOA = /usr/local/goa - -all: - cd $(GOA)/Chat/chatc/chatps2/ ; make clean - cd $(GOA)/Chat/chatc/chatps2/ ; make eenet - cd $(GOA)/Chat/chatc/chatps2/ ; make clean - cd $(GOA)/Chat/chatc/chatps2/ ; make snsystems - cd $(GOA)/ghttp/ghttpc/ghttpps2/ ; make clean - cd $(GOA)/ghttp/ghttpc/ghttpps2/ ; make eenet - cd $(GOA)/ghttp/ghttpc/ghttpps2/ ; make clean - cd $(GOA)/ghttp/ghttpc/ghttpps2/ ; make snsystems - cd $(GOA)/GP/gptestc/gpps2 ; make clean - cd $(GOA)/GP/gptestc/gpps2 ; make eenet - cd $(GOA)/GP/gptestc/gpps2 ; make clean - cd $(GOA)/GP/gptestc/gpps2 ; make snsystems - cd $(GOA)/gstats/statstest/gstatsps2 ; make clean - cd $(GOA)/gstats/statstest/gstatsps2 ; make eenet - cd $(GOA)/gstats/statstest/gstatsps2 ; make clean - cd $(GOA)/gstats/statstest/gstatsps2 ; make snsystems - cd $(GOA)/gstats/persisttest/persistps2 ; make clean - cd $(GOA)/gstats/persisttest/persistps2 ; make eenet - cd $(GOA)/gstats/persisttest/persistps2 ; make clean - cd $(GOA)/gstats/persisttest/persistps2 ; make snsystems - cd $(GOA)/gt2/gt2testc/gt2ps2 ; make clean - cd $(GOA)/gt2/gt2testc/gt2ps2 ; make eenet - cd $(GOA)/gt2/gt2testc/gt2ps2 ; make clean - cd $(GOA)/gt2/gt2testc/gt2ps2 ; make snsystems - cd $(GOA)/natneg/simpletest/natnegps2 ; make clean - cd $(GOA)/natneg/simpletest/natnegps2 ; make eenet - cd $(GOA)/natneg/simpletest/natnegps2 ; make clean - cd $(GOA)/natneg/simpletest/natnegps2 ; make snsystems - cd $(GOA)/Peer/peerc/peerps2 ; make clean - cd $(GOA)/Peer/peerc/peerps2 ; make eenet - cd $(GOA)/Peer/peerc/peerps2 ; make clean - cd $(GOA)/Peer/peerc/peerps2 ; make snsystems - cd $(GOA)/pt/pttestc/ptps2 ; make clean - cd $(GOA)/pt/pttestc/ptps2 ; make eenet - cd $(GOA)/pt/pttestc/ptps2 ; make clean - cd $(GOA)/pt/pttestc/ptps2 ; make snsystems - cd $(GOA)/qr2/qr2csample/qr2ps2 ; make clean - cd $(GOA)/qr2/qr2csample/qr2ps2 ; make eenet - cd $(GOA)/qr2/qr2csample/qr2ps2 ; make clean - cd $(GOA)/qr2/qr2csample/qr2ps2 ; make snsystems - cd $(GOA)/serverbrowsing/sbctest/sbps2 ; make clean - cd $(GOA)/serverbrowsing/sbctest/sbps2 ; make eenet - cd $(GOA)/serverbrowsing/sbctest/sbps2 ; make clean - cd $(GOA)/serverbrowsing/sbctest/sbps2 ; make snsystems - cd $(GOA)/Voice/voicetest/voicetestps2 ; make clean - cd $(GOA)/Voice/voicetest/voicetestps2 ; make eenet - cd $(GOA)/Voice/voicetest/voicetestps2 ; make clean - cd $(GOA)/Voice/voicetest/voicetestps2 ; make snsystems - cd $(GOA)/Voice/voicebench/voicebenchps2 ; make clean - cd $(GOA)/Voice/voicebench/voicebenchps2 ; make eenet - cd $(GOA)/Voice/voicebench/voicebenchps2 ; make clean - cd $(GOA)/Voice/voicebench/voicebenchps2 ; make snsystems diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/Makefile.common b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/Makefile.common deleted file mode 100644 index 56e56e86dcc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/Makefile.common +++ /dev/null @@ -1,81 +0,0 @@ -#GameSpy.net PS2 Makefile -#Included from sample-specific Makefiles - -SHELL = /bin/sh -SCE = /usr/local/sce -LIBDIR = $(SCE)/ee/lib -SYSINC = -I$(SCE)/ee/include -I$(SCE)/common/include -INCDIR = $(STACKINC) $(SYSINC) - -#the samples need this for EENet -ENTCNFDIR = $(SCE)/iop/sample/libeenet/ent_cnf -ENTCNF = $(ENTCNFDIR)/ent_cnf.irx - -LCFILE = $(LIBDIR)/app.cmd -LIBS = $(STACKLIB) \ - $(LIBDIR)/libdev.a \ - $(LIBDIR)/libgraph.a \ - $(LIBDIR)/libdma.a \ - $(LIBDIR)/libpkt.a \ - $(LIBDIR)/libcdvd.a \ - $(SDK_LIBS) - -snsystems: STACKLIB = $(LIBDIR)/sneetcp.a - -snsystems: STACKDEF = SN_SYSTEMS - -snsytems: STACKINC = - -eenet: STACKLIB = $(LIBDIR)/libeenet.a\ - $(LIBDIR)/eenetctl.a\ - $(LIBDIR)/ent_smap.a\ - $(LIBDIR)/ent_eth.a\ - $(LIBDIR)/ent_ppp.a\ - $(LIBDIR)/libscf.a - -eenet: STACKDEF = EENET - -eenet: STACKINC = -I$(SCE)/ee/include/libeenet/ - -PREFIX = ee -AS = $(PREFIX)-gcc -CC = $(PREFIX)-gcc -LD = $(PREFIX)-gcc -RUN = dsedb -r run -RM = /bin/rm -f - -CFLAGS = -g -O0 -Wall -Werror -Wa,-al -fno-common $(SDK_CFLAGS) -ASFLAGS = -c -xassembler-with-cpp -Wa,-al -LDFLAGS = -Wl,-Map,$(TARGET).map -mno-crt0 -L$(LIBDIR) -lm - -.SUFFIXES: .c .s - -all: FORCE - @echo type either make eenet or make snsystems - -$(TARGET).elf: $(OBJS) $(LIBS) - $(LD) -o $@ -T $(LCFILE) $(OBJS) $(STACKLIB) $(LIBS) $(LDFLAGS) - -crt0.o: $(LIBDIR)/crt0.s - $(AS) $(ASFLAGS) -o $@ $< > $*.lst - -.s.o: - $(AS) $(ASFLAGS) $(INCDIR) -o $@ $< > $*.lst - -.c.o: - $(CC) $(CFLAGS) -D$(STACKDEF) $(INCDIR) -c $< -o $*.o > $*.lst - -run: $(TARGET).elf - $(RUN) $(TARGET).elf - -snsystems: $(TARGET).elf - -$(ENTCNF): - cd $(ENTCNFDIR) ; make - -eenet: $(ENTCNF) $(TARGET).elf - -clean: - $(RM) $(OBJS) *.o *.map *.lst core *.dis *.elf - -FORCE: diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/changelog.txt deleted file mode 100644 index c5199f9afa4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/changelog.txt +++ /dev/null @@ -1,47 +0,0 @@ -Changelog for: PS2 Common Code --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -06-03-2005 1.05.19 SN RELEASE Releasing to developer site. -04-28-2005 1.05.19 SN RELEASE Releasing to developer site. -04-04-2005 1.05.19 SN RELEASE Releasing to developer site. -09-16-2004 1.05.19 SN RELEASE Releasing to developer site. -08-05-2004 1.05.19 SN RELEASE Releasing to developer site. -07-23-2004 1.05.19 SN FIX Updated code with explicit casts to remove implicit cast error - when compiling at highest level and warnings treated as errors.(ps2pad.c) -07-19-2004 1.05.18 SN FIX Updated code with explicit casts to remove implicit cast error - when compiling at highest level and warnings treated as errors.(ps2common.c) -07-14-2004 1.05.17 DES CLEANUP Updated and unified IRX module loading code. - FEATURE Added loading of IRX modules needed by GV SPU2 code. -06-22-2004 1.05.16 BED FEATURE Added PS2 Insock support -06-22-2004 1.05.15 DES FEATURE Add loading of Logitech video library for EyeToy support in GV. -06-08-2003 1.05.14 DES RELEASE Limited developer release (for GV) -04-22-2004 1.05.14 DES FEATURE Added ps2pad.c/h for getting input events from the controller. -10-21-2003 1.05.13 BED RELEASE Releasing to developer site. (UNIQUE NICK AND UNICODE SUPPORT) - BED FIX Removed misc compiler warnings on strict setting. -10-09-2003 1.05.13 BED FIX DHCP override settings defined but not used. Now passed into init call. -07-24-2003 1.05.12 DES RELEASE Releasing to developer site. -07-24-2003 1.05.12 DES FEATURE Added a Makefile for building all projects with gcc. - FEATURE Added a ProDG workspace that includes all the sample app projects. - FEATURE Added a CodeWarrior workspace that includes all the sample app projects. -07-23-2003 1.05.11 DES FIX Removed unneeded headers from ps2common.c which were causing warnings. - CLEANUP Removed EENet 2.6.0 compatibility. - CLEANUP Changed most printf()s in ps2common.c to scePrintf(). -07-21-2003 1.05.10 DES FIX Updated the gcc Makefile.common to automatically build the - ent_cnf.irx when making for EENet. -07-17-2003 1.05.09 DES FEATURE Put PS2 test app common Makefile code into Makefile.common. - It is then included from all the SDK-specific Makefiles. -07-16-2003 1.05.08 DES FIX EENet will no longer lockup if it can't load an irx module. - CLEANUP Removed Cisco NFT support. -02-25-2003 1.05.07 DES CLEANUP Changed sceEENetInit() for 2.6.1 EENet compatibility. - EENET_260 can be defined for 2.6.0 compatibility. -01-02-2003 1.05.06 DES FIX Added needed defines for modem support. - CLEANUP Removed references to ent_cnf.h and ent_cnf.irx. -12-18-2002 1.05.05 DES CLEANUP Updated SN Systems stack support. -12-13-2002 1.05.04 DES FEATURE Added PS2 eenet stack support. -12-05-2002 1.05.03 DES CLEANUP General cleanup - FEATURE Initial PS2 eenet stack support -11-20-2002 1.05.02 DES FEATURE Updated to use new Unique ID code. -11-14-2002 1.05.01 DES OTHER Updated the IOPIMAGE define to IOPRP255.IMG from IOPRP250.IMG -09-25-2002 1.05.00 DDW OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/LinkSegment_PS2.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/LinkSegment_PS2.lcf deleted file mode 100644 index bed58f27eef..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/LinkSegment_PS2.lcf +++ /dev/null @@ -1,161 +0,0 @@ -# =========================================================================== -# LinkSegment_PS2.lcf ©1999-2000 Metrowerks Inc. All rights reserved. -# =========================================================================== -# -# linker command file for PS2 -# -# 06/09/2000 kashima, put dummy nop after .text section -# 06/09/2000 kashima, change default entry address -# 02/10/2000 kashima, add ALIGNALL before each section -# 01/15/2000 kashima, support overlay by lcf generator -# 11/03/1999 kashima, for SDK 1.10 -# 10/22/1999 kashima, change file extention from txt to lcf -# 10/20/1999 kashima, put all sections into main -# 10/12/1999 kashima, separate each sections -# 09/14/1999 kashima, -# -# =========================================================================== - -MEMORY -{ - main (RWX) : ORIGIN = 0x100000, LENGTH = 0x0 - heap (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 -} - -#FORCE_ACTIVE -#{ -#} - -KEEP_SECTION -{ - .vutext, - .vudata, - .vubss -} - -#REF_INCLUDE -#{ - -SECTIONS -{ - # define for crt0 - _heap_size = -1; - _stack = -1; - _stack_size = 0x00100000; - # define for lcf - _align_segment = 0x80; - - .main : - { - # text sections - . = ALIGN(0x80); - crt0.s (.text) - . = ALIGN(0x10); - ALIGNALL(0x8); - GROUP(ROOT) (.text) - WRITEW 0x0; # text section patch for EE pipeline - WRITEW 0x0; # text section patch for EE pipeline - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.vutext) - - # .reginfo - crt0.s (.reginfo) - - # data sections - __data_start = .; - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.data) - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.vudata) - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.rodata) - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.rdata) - - # static initializers - . = ALIGN(0x10); - ALIGNALL(0x4); - GROUP(ROOT) (.init) - . = ALIGN(0x10); - ALIGNALL(0x4); - __static_init = .; - GROUP(ROOT) (.ctor) - __static_init_end = .; - - # .vtables - . = ALIGN(0x10); - ALIGNALL(0x4); - * (.vtables) - - # exception table - . = ALIGN(0x10); - __exception_table_start__ = .; - __exception_table_end__ = .; - - # addresses for each overlay module - . = ALIGN(0x10); - _overlay_group_addresses = .; - WRITEW ADDR(.main); # - - __data_end = .; - __data_size = __data_end - __data_start; - - # the address of gp register - _gp = ALIGN(128) + 0x7FF0; - - # literal - . = ALIGN(0x80); - ALIGNALL(0x8); - LITERAL - - # small data sections - . = ALIGN(0x80); - ALIGNALL(0x4); - * (.sdata) - . = ALIGN(0x80); - _fbss = .; - ALIGNALL(0x4); - * (.sbss) - ALIGNALL(0x4); - * (.scommon) - ALIGNALL(0x4); - * (SCOMMON) - - # bss sections - __bss_start = .; - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.bss) - ALIGNALL(0x8); - GROUP(ROOT) (.common) - ALIGNALL(0x8); - GROUP(ROOT) (COMMON) - . = ALIGN(0x80); - ALIGNALL(0x8); - GROUP(ROOT) (.vubss) - ALIGNALL(0x8); - __bss_end = .; - __bss_size = __bss_end - __bss_start; - - . = ALIGN(_align_segment); - - } > main - - .heap : - { - # to get the address for heap - end = .; - _end = .; - } > heap - - -} - -# =========================================================================== -# end of lcf (auto-generated by pre-linker for PS2) -# =========================================================================== diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/PREFIX_PS2_DEBUG_TC296.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/PREFIX_PS2_DEBUG_TC296.h deleted file mode 100644 index e28c214452d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/PREFIX_PS2_DEBUG_TC296.h +++ /dev/null @@ -1,12 +0,0 @@ -// =========================================================================== -// PREFIX_PS2_DEBUG_TC296.h (c) 2001 Metrowerks Inc. All rights reserved. -// =========================================================================== -// -// 08/02/2001 rcampana Created for support of GCC toolchain 2.96 - -#include - -#pragma divbyzerocheck on /* break if divided by zero */ - -#define DEBUG /* just for debugging */ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/PREFIX_PS2_RELEASE_TC296.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/PREFIX_PS2_RELEASE_TC296.h deleted file mode 100644 index df2447adc29..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/PREFIX_PS2_RELEASE_TC296.h +++ /dev/null @@ -1,11 +0,0 @@ -// =========================================================================== -// PREFIX_PS2_TC296.h ©2000-2001 Metrowerks Inc. All rights reserved. -// =========================================================================== -// -// 08/02/2001 rcampana Created for support of GCC toolchain 2.96 - -#include - -#define NDEBUG /* just for debugging */ - -#pragma cats off \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cw.cww b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cw.cww deleted file mode 100644 index f3df402ff69..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cw.cww +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]> - - - - -1 - 0 - true - ..\..\Chat\chatc\chatps2cw\chatps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\ghttp\ghttpc\ghttpps2cw\ghttpps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\GP\gptestc\gpps2cw\gpps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\gstats\statstest\gstatsps2cw\gstatsps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\gstats\persisttest\persistps2cw\persistps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\gt2\gt2testc\gt2ps2cw\gt2ps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\NATNEG\simpletest\natnegps2cw\natnegps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\peer\peerc\peerps2cw\peerps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\pt\pttestc\ptps2cw\ptps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\QR2\qr2csample\qr2ps2cw\qr2ps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\SERVERBROWSING\SBCTEST\sbps2cw\sbps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\Voice\voicetest\voicetestps2cw\voicetestps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - - -1 - 0 - ..\..\Voice\voicebench\voicebenchps2cw\voicebenchps2cw.mcp - - 30 - 30 - - - 400 - 200 - - - 1 - 0 - 0 - 59420 - 1.000000 - 425 - - -2 - -2 - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_debug.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_debug.h deleted file mode 100644 index 131b541e1af..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_debug.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "PREFIX_PS2_DEBUG_TC296.h" - -#define EENET -#define _DEBUG -//#define GSI_UNICODE -//#pragma ushort_wchar_t on \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_debug_uniqueid.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_debug_uniqueid.h deleted file mode 100644 index 264b4f63c87..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_debug_uniqueid.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "PREFIX_PS2_DEBUG_TC296.h" - -#define EENET -#define _DEBUG -#define UNIQUEID \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_release.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_release.h deleted file mode 100644 index c7649701138..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_release.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "PREFIX_PS2_RELEASE_TC296.h" - -#define EENET -//#define GSI_UNICODE -//#pragma ushort_wchar_t on \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_release_uniqueid.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_release_uniqueid.h deleted file mode 100644 index 996d90e598b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_eenet_release_uniqueid.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "PREFIX_PS2_RELEASE_TC296.h" - -#define EENET -#define UNIQUEID \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_debug.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_debug.h deleted file mode 100644 index 3fbc9793e7c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_debug.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "PREFIX_PS2_DEBUG_TC296.h" - -#define INSOCK -#define _DEBUG -//#define GSI_UNICODE -//#pragma ushort_wchar_t on \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_debug_uniqueid.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_debug_uniqueid.h deleted file mode 100644 index f18119251aa..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_debug_uniqueid.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "PREFIX_PS2_DEBUG_TC296.h" - -#define INSOCK -#define _DEBUG -#define UNIQUEID \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_release.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_release.h deleted file mode 100644 index 46220a81eb7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_release.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "PREFIX_PS2_RELEASE_TC296.h" - -#define INSOCK -//#define GSI_UNICODE -//#pragma ushort_wchar_t on \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_release_uniqueid.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_release_uniqueid.h deleted file mode 100644 index 1db3bb293e7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_insock_release_uniqueid.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "PREFIX_PS2_RELEASE_TC296.h" - -#define INSOCK -#define UNIQUEID \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_debug.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_debug.h deleted file mode 100644 index 81b86d14864..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_debug.h +++ /dev/null @@ -1,6 +0,0 @@ -#include "PREFIX_PS2_DEBUG_TC296.h" - -#define SN_SYSTEMS -#define _DEBUG -//#define GSI_UNICODE -//#pragma ushort_wchar_t on \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_debug_uniqueid.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_debug_uniqueid.h deleted file mode 100644 index 83f1f9d065a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_debug_uniqueid.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "PREFIX_PS2_DEBUG_TC296.h" - -#define SN_SYSTEMS -#define _DEBUG -#define UNIQUEID \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_release.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_release.h deleted file mode 100644 index 6f4e4955347..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_release.h +++ /dev/null @@ -1,5 +0,0 @@ -#include "PREFIX_PS2_RELEASE_TC296.h" - -#define SN_SYSTEMS -//#define GSI_UNICODE -//#pragma ushort_wchar_t on \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_release_uniqueid.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_release_uniqueid.h deleted file mode 100644 index 42c0791fe5d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/cw/cwprefix_snsystems_release_uniqueid.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "PREFIX_PS2_RELEASE_TC296.h" - -#define SN_SYSTEMS -#define UNIQUEID \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/LinkSegment_PS2IOP.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/LinkSegment_PS2IOP.lcf deleted file mode 100644 index bc865d96363..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/LinkSegment_PS2IOP.lcf +++ /dev/null @@ -1,78 +0,0 @@ -#=========================================================================== -# LinkSegment_PS2IOP.lcf ©1999-2003 Metrowerks Inc. All rights reserved. -#=========================================================================== -# -# Linker command file for PS2 IOP -# -#=========================================================================== - -MEMORY -{ - .text (RWX) : ORIGIN = 0x00000000, LENGTH = 0x00 - .data (RW) : ORIGIN = AFTER(.text), LENGTH = 0x00 - .bss (RW) : ORIGIN = AFTER(.data), LENGTH = 0X00 -} - -FORCE_ACTIVE{Module} - -SECTIONS -{ - .text : - { - . = ALIGN(0x10); - _ftext = .; - - # begin text section - * (.text) - * (.common) - * (.scommon) - # end of text section - - # align so that size of segment is 16 byte aligned - . = ALIGN(0x10); - _etext = .; - etext = .; - } > .text - - .data : - { - . = ALIGN(0x10); - _fdata = .; - - # start data section - * (.rodata) - * (.data) - _gp = ALIGN(0x10) + 0x7FF0; - * (.sdata) - # literal - LITERAL - - # end data section - - - # align so that size of segment is 16 byte aligned - . = ALIGN(0x10); - _edata = .; - edata = .; - - } > .data - - .bss : - { - . = ALIGN(0x10); - _fbss = .; - - # start bss section - * (.bss) - * (.sbss) - # end bss section - - # align so that size of segment is 16 byte aligned - . = ALIGN(0x10); - end = .; - _end = .; - - } > .bss -} - -#=========================================================================== diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/PREFIX_PS2IOP_DEBUG.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/PREFIX_PS2IOP_DEBUG.h deleted file mode 100644 index dd40e1d72b4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/PREFIX_PS2IOP_DEBUG.h +++ /dev/null @@ -1,13 +0,0 @@ -// =========================================================================== -// PREFIX_PS2_DEBUG.h ©2000 Metrowerks Inc. All rights reserved. -// =========================================================================== -// -// 07/18/2000 james combs, for SDK1.6 - - -#include - -#pragma divbyzerocheck on /* break if divided by zero */ - -#define DEBUG /* just for debugging */ - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/PREFIX_PS2IOP_RELEASE.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/PREFIX_PS2IOP_RELEASE.h deleted file mode 100644 index e2873aa556a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/PREFIX_PS2IOP_RELEASE.h +++ /dev/null @@ -1,9 +0,0 @@ -// =========================================================================== -// PREFIX_PS2_RELEASE.h ©2000 Metrowerks Inc. All rights reserved. -// =========================================================================== -// -// 07/18/2000 james combs, for SDK1.6 - -#include - -#define NDEBUG \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/ent_cnf.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/ent_cnf.mcp deleted file mode 100644 index b70c80076f0..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/cw/ent_cnf.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/prodg/ent_cnf.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/prodg/ent_cnf.dsp deleted file mode 100644 index a012bfd4bd9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/prodg/ent_cnf.dsp +++ /dev/null @@ -1,119 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ent_cnf" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=ent_cnf - Win32 PS2 IOP Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ent_cnf.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ent_cnf.mak" CFG="ent_cnf - Win32 PS2 IOP Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ent_cnf - Win32 PS2 IOP Debug" (based on "Win32 (x86) Application") -!MESSAGE "ent_cnf - Win32 PS2 IOP Release" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/ps2common/ent_cnf/prodg", UXEDAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ent_cnf - Win32 PS2 IOP Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ent_cnf___Win32_PS2_IOP_Debug" -# PROP BASE Intermediate_Dir "ent_cnf___Win32_PS2_IOP_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ent_cnf___Win32_PS2_IOP_Debug" -# PROP Intermediate_Dir "ent_cnf___Win32_PS2_IOP_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c -# ADD CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\sample\libeenet\ent_cnf" /D "SN_TARGET_PS2_IOP" /Fo"PS2_IOP_Debug/" /FD -G0 /debug /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 eenetctl.ilb netcnf.ilb C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.o /nologo /pdb:none /debug /machine:IX86 /out:"c:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnf.irx" /D:SN_TARGET_PS2_IOP -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Cmds=ioplibgen C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnf.tbl -e C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.s ps2cc -iop -o C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.o C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.s -# End Special Build Tool - -!ELSEIF "$(CFG)" == "ent_cnf - Win32 PS2 IOP Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ent_cnf___Win32_PS2_IOP_Release" -# PROP BASE Intermediate_Dir "ent_cnf___Win32_PS2_IOP_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "ent_cnf___Win32_PS2_IOP_Release" -# PROP Intermediate_Dir "ent_cnf___Win32_PS2_IOP_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c -# ADD CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\sample\libeenet\ent_cnf" /D "SN_TARGET_PS2_IOP" /Fo"PS2_IOP_Release/" /FD -G0 /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 eenetctl.ilb netcnf.ilb C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.o /nologo /pdb:none /machine:IX86 /out:"c:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnf.irx" /D:SN_TARGET_PS2_IOP -# Begin Special Build Tool -SOURCE="$(InputPath)" -PreLink_Cmds=ioplibgen C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnf.tbl -e C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.s ps2cc -iop -o C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.o C:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnfent.s -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "ent_cnf - Win32 PS2 IOP Debug" -# Name "ent_cnf - Win32 PS2 IOP Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=c:\usr\local\sce\iop\sample\libeenet\ent_cnf\ent_cnf.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=c:\usr\local\sce\iop\sample\libeenet\ent_cnf\ioptypes.h -# End Source File -# Begin Source File - -SOURCE=..\..\prodg\PS2_in_VC.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/prodg/ent_cnf.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/prodg/ent_cnf.dsw deleted file mode 100644 index 3a68ef0aa3e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ent_cnf/prodg/ent_cnf.dsw +++ /dev/null @@ -1,37 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "ent_cnf"=.\ent_cnf.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ps2common/ent_cnf/prodg", UXEDAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ps2common/ent_cnf/prodg", UXEDAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsSocketPs2.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsSocketPs2.c deleted file mode 100644 index f99d509c556..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsSocketPs2.c +++ /dev/null @@ -1,78 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gscommon.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// INSOCK -#if defined(INSOCK) -#define INSOCK_MAX_UDP_BUFSIZE 8000000 // default max -#define INSOCK_MAX_TCP_BUFSIZE 32000 - -extern sceSifMClientData gGSIInsockClientData; -extern u_int gGSIInsockSocketBuffer[NETBUFSIZE] __attribute__((aligned(64))); - -// NOT FULLY IMPLEMENTED -int SetReceiveBufferSize(SOCKET sock, int size) -{return -1; GSI_UNUSED(sock); GSI_UNUSED(size); } - -// NOT FULLY IMPLEMENTED -int SetSendBufferSize(SOCKET sock, int size) -{return -1; GSI_UNUSED(sock); GSI_UNUSED(size); } - -int GetReceiveBufferSize(SOCKET sock) -{return NETBUFSIZE; GSI_UNUSED(sock); } - -int GetSendBufferSize(SOCKET sock) -{return NETBUFSIZE; GSI_UNUSED(sock); } - -// Poll socket for Send, Recv and Except -int GSISocketSelect(SOCKET theSocket, int* theReadFlag, int* theWriteFlag, int* theExceptFlag) -{ - int result = 0; - sceInetPollFd_t aPollFdSet; - - // Init the flags to 0 - if ((theReadFlag != NULL)) - *theReadFlag = 0; - if ((theWriteFlag != NULL)) - *theWriteFlag = 0; - if ((theExceptFlag != NULL)) - *theExceptFlag = 0; - - // Setup the fd set - aPollFdSet.cid = theSocket; // the socket - aPollFdSet.events = 0; // events in - aPollFdSet.revents = 0; // events out - - if (theReadFlag != NULL) aPollFdSet.events |= sceINET_POLLIN; - if (theWriteFlag != NULL) aPollFdSet.events |= sceINET_POLLOUT; - if (theExceptFlag != NULL) aPollFdSet.events |= sceINET_POLLERR; - - // Poll the fds - // 1 fds, 0 ms timeout - result = sceInsockPoll(&aPollFdSet, 1, 0); - if (result > 0) - { - // If the Flag is valid, set the return value - if ((theReadFlag != NULL)) - *theReadFlag = (aPollFdSet.revents & sceINET_POLLIN) ? 1:0; - if ((theWriteFlag != NULL)) - *theWriteFlag = (aPollFdSet.revents & sceINET_POLLOUT) ? 1:0; - if ((theExceptFlag != NULL)) - *theExceptFlag = (aPollFdSet.revents & sceINET_POLLERR) ? 1:0; - } - return result; -} - -// shutdown needs to have a timeout that can be done -// right before shutting down -int gsiShutdown(SOCKET s, int how) -{ - // set the shutdown timeout to thirty milliseconds based on most games running - // thirty frames per second (33ms rounded down to 30) - sceInsockSetShutdownTimeout(s, 30); - return sceInsockShutdown(s, how); -} -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsThreadPs2.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsThreadPs2.c deleted file mode 100644 index 89594dbbac8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsThreadPs2.c +++ /dev/null @@ -1,204 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gscommon.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_u32 gsiInterlockedIncrement(gsi_u32 * value) -{ - int interrupt = DI(); - int ret = ++(*value); - if (interrupt) - EI(); - - // return "ret" rather than "value" here b/c - // value may be modified by another thread - // before we can return it - return ret; -} - -gsi_u32 gsiInterlockedDecrement(gsi_u32 * value) -{ - int interrupt = DI(); - int ret = --(*value); - if (interrupt) - EI(); - - // return "ret" rather than "value" here b/c - // value may be modified by another thread - // before we can return it - return ret; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) -{ - theCrit->mSemaphore = gsiCreateSemaphore(1, 1, NULL); - theCrit->mOwnerThread = 0; - theCrit->mEntryCount = 0; -} -void gsiEnterCriticalSection(GSICriticalSection *theCrit) -{ - // If we're not already in it, wait for it - if (GetThreadId() != theCrit->mOwnerThread) - { - gsiWaitForSemaphore(theCrit->mSemaphore, 0); - theCrit->mOwnerThread = GetThreadId(); - } - - // Increment entry count - theCrit->mEntryCount++; -} -void gsiLeaveCriticalSection(GSICriticalSection *theCrit) -{ - // We must be the owner? (assert?) - if (GetThreadId() != theCrit->mOwnerThread) - { - assert(GetThreadId() == theCrit->mOwnerThread); - return; - } - - // Release semaphore - theCrit->mEntryCount--; - if (theCrit->mEntryCount == 0) - { - theCrit->mOwnerThread = 0; - gsiReleaseSemaphore(theCrit->mSemaphore, 1); - } -} - -void gsiDeleteCriticalSection(GSICriticalSection *theCrit) -{ - gsiCloseSemaphore(theCrit->mSemaphore); -} - -gsi_u32 gsiHasThreadShutdown(GSIThreadID theThreadID) -{ - struct ThreadParam aStatus; - ReferThreadStatus(theThreadID, &aStatus); - if (aStatus.status == THS_DORMANT) - return 1; // dead - else - return 0; // still kicking; -} - -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - struct SemaParam aParam; - int aSemaphore = 0; - - aParam.initCount = theInitialCount; - aParam.maxCount = theMaxCount; - - aSemaphore = CreateSema(&aParam); - if (aSemaphore < 0) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create semaphore\r\n"); - } - - GSI_UNUSED(theName); - - return aSemaphore; -} - -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - int result = WaitSema(theSemaphore); - return (gsi_u32)result; - - GSI_UNUSED(theTimeoutMs); -} - -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - while (theReleaseCount-- > 0) - SignalSema(theSemaphore); - //ReleaseSemaphore(theSemaphore, theReleaseCount, NULL); -} - -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - DeleteSema(theSemaphore); -} - -int gsiStartThread(GSThreadFunc func, gsi_u32 theStackSize, void *arg, GSIThreadID *id) -{ - const unsigned int stackSize = theStackSize; - const int threadPriority = 3; - struct ThreadParam param; - void * stack; - int threadID; - - // allocate a stack - stack = gsimemalign(16, stackSize); - if(!stack) - return -1; - - // setup the thread parameters - param.entry = func; - param.stack = stack; - param.stackSize = (int)stackSize; - param.gpReg = &_gp; - param.initPriority = threadPriority; - - // create the thread - threadID = CreateThread(¶m); - if(threadID == -1) - { - gsifree(stack); - return -1; - } - - // start the thread - if(StartThread(threadID, arg) == -1) - { - DeleteThread(threadID); - gsifree(stack); - return -1; - } - - // store the id - *id = threadID; - - // Note: This was added to prevent PS2 lockups when starting multiple threads - // The PS2 would block for approx 5 seconds - msleep(1); - - return 0; -} - -void gsiCancelThread(GSIThreadID id) -{ - void* aStack = NULL; - - // get the stack ptr - struct ThreadParam aThreadParam; - ReferThreadStatus(id, &aThreadParam); - aStack = (void*)aThreadParam.stack; - - // terminate the thread - TerminateThread(id); - - // delete the thread - DeleteThread(id); - - //free the stack - gsifree(aStack); -} - -// This must be called from INSIDE the thread you wish to exit -void gsiExitThread(GSIThreadID id) -{ - // TODO: does PS2 need to explicitly EXIT a thread like win32/linux? - GSI_UNUSED(id); -} - -void gsiCleanupThread(GSIThreadID id) -{ - // same as cancel (terminates just to be sure) - gsiCancelThread(id); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsUtilPs2.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsUtilPs2.c deleted file mode 100644 index 71b10415274..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/gsUtilPs2.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "../gsCommon.h" - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return atol(theNumberStr); -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%ld", theNumber); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/PS2_in_VC.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/PS2_in_VC.h deleted file mode 100644 index c1aa1d86f66..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/PS2_in_VC.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// The purpose of this file is to, as much as possible, facilitate the -// compilation of the PS2 GNU files by the VC6 compiler. Not all problems -// can be solved via this file. So far, a couple of hacks are required -// directly within the headers themselves. -// - -// -// This will nullify all of the GNU compiler's __attribute__ things. -// -#define __attribute__(a) - -// -// This will prevent an Endian not defined error. -// -#define __IEEE_LITTLE_ENDIAN - -// -// This will prevent a size_t redefinition error. -// -#define __size_t__ - -// -// This will prevent errors by headers which use u_long128. Obviously -// the type defined below is only 32 bits, but (1) this is what the real -// headers seem to do in the GNU compiler and more importantly (2) it works! -// -typedef unsigned int u_long128; - - -#define long _int64 - -#define INLINE __inline - -#define size_t int - -#define __asm__ asm - -#define __volatile__ - -#define asm(a) asm() - -#define inline - -#define volatile diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/prodg.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/prodg.dsw deleted file mode 100644 index 5a3e33c310a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/prodg.dsw +++ /dev/null @@ -1,229 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "chatps2prodg"=..\..\Chat\chatc\chatps2prodg\chatps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/Chat/chatc/chatps2prodg", DSEDAAAA - ..\..\chat\chatc\chatps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "ghttpps2prodg"=..\..\ghttp\ghttpc\ghttpps2prodg\ghttpps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp/ghttpc/ghttpps2prodg", JSEDAAAA - ..\..\ghttp\ghttpc\ghttpps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gpps2prodg"=..\..\GP\gptestc\gpps2prodg\gpps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/GP/gptestc/gpps2prodg", PSEDAAAA - ..\..\gp\gptestc\gpps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gstatsps2prodg"=..\..\gstats\statstest\gstatsps2prodg\gstatsps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gstats/statstest/gstatsps2prodg", VSEDAAAA - ..\..\gstats\statstest\gstatsps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2ps2prodg"=..\..\gt2\gt2testc\gt2ps2prodg\gt2ps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2testc/gt2ps2prodg", XREDAAAA - ..\..\gt2\gt2testc\gt2ps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gvps2prodg"=..\..\Voice2\Voice2Test\gvps2prodg\gvps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/Voice2/Voice2Test/gvps2prodg", XPODAAAA - ..\..\voice2\voice2test\gvps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "natnegps2prodg"=..\..\NATNEG\simpletest\natnegps2prodg\natnegps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/natneg/simpletest/natnegps2prodg", HTEDAAAA - ..\..\natneg\simpletest\natnegps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "peerps2prodg"=..\..\peer\peerc\peerps2prodg\peerps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/Peer/peerc/peerps2prodg", NTEDAAAA - ..\..\peer\peerc\peerps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "persistps2prodg"=..\..\gstats\persisttest\persistps2prodg\persistps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gstats/persisttest/persistps2prodg", BTEDAAAA - ..\..\gstats\persisttest\persistps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "ptps2prodg"=..\..\pt\pttestc\ptps2prodg\ptps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/pt/pttestc/ptps2prodg", TTEDAAAA - ..\..\pt\pttestc\ptps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "qr2ps2prodg"=..\..\QR2\qr2csample\qr2ps2prodg\qr2ps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/qr2/qr2csample/qr2ps2prodg", ZTEDAAAA - ..\..\qr2\qr2csample\qr2ps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "sbps2prodg"=..\..\SERVERBROWSING\SBCTEST\sbps2prodg\sbps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/serverbrowsing/sbctest/sbps2prodg", FUEDAAAA - ..\..\serverbrowsing\sbctest\sbps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "voice2benchps2prodg"=..\..\Voice2\voice2bench\voice2benchps2prodg\voice2benchps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/Voice2/voice2bench/voice2benchps2prodg - ..\..\voice2\voice2bench\voice2benchps2prodg - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ps2common/prodg", DVEDAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/ps2.lk b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/ps2.lk deleted file mode 100644 index 826c59f71d3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/prodg/ps2.lk +++ /dev/null @@ -1,88 +0,0 @@ -; SN Systems default linker script for PS2. -; Updated for libraries 1.6.0 by Gil - -; Default libraries. (Supply others on the command line.) - - inclib libc.a - inclib libkernl.a - inclib libgcc.a - inclib libm.a - - -; The heap size and stack details are defined here. - -_heap_size equ 0xffffffff -_stack equ 0xffffffff -_stack_size equ 0x00100000 - - -; Groups represent entries in the output ELF's program headers table. -; Each contains one or more sections. -; A group only appears in the PHDRS table if it is named and has -; nonzero size. - - -; This group is for the program's code and initialised data. - - org 0x00100000 - -text group - - sectalign 8 - section .text,text - section .vutext,text - - sectalign 16 - section .data,text - section.128 .vudata,text - section .rodata,text - section .rdata,text - section .gcc_except_table,text - -; Collect everything else which is part of the image here. -; (Subsequent section directives get a chance to collect contents first.) - - section *,text - -; Set the GP register's value. -; The total size of these sections (from .lit8 to .scommon) cannot -; exceed 64K. - -_gp equ __lit8_obj+0x7FF0 - - section .lit8,text - section .lit4,text - section .sdata,text - - -; This group is for uninitialised data - -bss group bss - - -; This is the start marker for the startup code's zeroing routine. - -_fbss equ _bss_obj - -; These sections are to be zeroised by crt0.o. - - section .sbss,bss - section .scommon,bss - section .bss,bss - section.128 .vubss,bss - - -; This is crt0.o's marker for the start of the heap. - -_end equ _bss_objend - - -; This group is for the scratchpad. - - org 0x70000000 - -spad group - - sectalign 4 - - section .spad,spad diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2common.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2common.c deleted file mode 100644 index 248a7659fb2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2common.c +++ /dev/null @@ -1,876 +0,0 @@ -#include "../gsCommon.h" - -// One of the following network devices must be defined -#if 0 -#define T10K_ETHERNET -#endif -#if 0 -#define USB_ETHERNET -#endif -#if 0 -#define USB_ETHERNET_WITH_PPPOE -#endif -#if 1 -#define HDD_ETHERNET -#endif -#if 0 -#define HDD_ETHERNET_WITH_PPPOE -#endif -#if 0 -#define MODEM -#endif - -// attempts to load a module -static int load_module(const char * filename, int args, const char * argp) -{ - int result; - - result = sceSifLoadModule(filename, args, argp); - if(result < 0) - { - const char * errorString; - if(result == -100) - errorString = "Called from exception handler / interrupt handler"; - else if(result == -200) - errorString = "Resident library required by loaded module does not exist"; - else if(result == -201) - errorString = "Object file format is invalid"; - else if(result == -203) - errorString = "Specified file was not found"; - else if(result == -204) - errorString = "Error occurred when reading file"; - else if(result == -400) - errorString = "Insufficient memory"; - else if(result == -0x10000) - errorString = "Binding to the IOP module failed."; - else if(result == -0x10001) - errorString = "RPC to the IOP failed."; - else if(result == -0x10004) - errorString = "The IOP module version does not match."; - else - errorString = "Unknown error"; - scePrintf("FAILED TO LOAD MODULE: %s\n", filename); - scePrintf("\t(%d:%s)\n", result, errorString); - while(1) - msleep(1); - } - - return result; -} - -#define SCEROOT "host0:/usr/local/sce/" -#define MODROOT SCEROOT "iop/modules/" -#define APPROOT SCEROOT "conf/neticon/english/" - -// SN Systems stack -#ifdef SN_SYSTEMS - -// these only need to be set if using DHCP -// up to four DNS servers can be specified, and the list must be terminated with an empty string -#define SNPS2_IP_ADDR "0.0.0.0" -#define SNPS2_SUB_MSK "0.0.0.0" -#define SNPS2_GATEWAY "0.0.0.0" -static const sn_char* dns_servers[] = { "" }; - -static void load_network_modules() -{ - // load the TCP/IP stack module -#ifndef _DEBUG - load_module(MODROOT "snstkrel.irx", 0, NULL); -#else - const char iop_params[] - = SNPS2_IP_ADDR "\x00" SNPS2_SUB_MSK "\x00" SNPS2_GATEWAY; - - load_module(MODROOT "snstkdbg.irx", sizeof(iop_params), (char*) iop_params); -#endif - - // load device specific module(s) -#if defined(T10K_ETHERNET) - load_module(MODROOT "sndrv000.irx", 0, NULL); - -#elif defined(USB_ETHERNET) - load_module(MODROOT "usbd.irx", 0, NULL); - #if defined(USB_LUCENT) - load_module(MODROOT "sndrv002.irx", 0, NULL); - #elif defined(USB_CONEXANT) - load_module(MODROOT "sndrv003.irx", 0, NULL); - #else - load_module(MODROOT "sndrv001.irx", 0, NULL); - #endif - -#elif defined(USB_ETHERNET_WITH_PPPOE) - load_module(MODROOT "usbd.irx", 0, NULL); - load_module(MODROOT "sndrv200.irx", 0, NULL); - load_module(MODROOT "sndrv201.irx", 0, NULL); - -#elif defined(HDD_ETHERNET) - load_module(MODROOT "dev9.irx", 0, NULL); - load_module(MODROOT "sndrv100.irx", 0, NULL); - load_module(MODROOT "smap.irx", 0, NULL); - -#elif defined(HDD_ETHERNET_WITH_PPPOE) - load_module(MODROOT "dev9.irx", 0, NULL); - load_module(MODROOT "sndrv200.irx", 0, NULL); - load_module(MODROOT "sndrv202.irx", 0, NULL); - load_module(MODROOT "smap.irx", 0, NULL); - -#elif defined(MODEM) - load_module(MODROOT "dev9.irx", 0, NULL); - load_module(MODROOT "sndrv101.irx", 0, NULL); - load_module(MODROOT "spduart.irx", 0, NULL); -#endif -} - -static sn_int32 do_initialisation(void) -{ - sn_int32 result; - sn_int32 device_attached; - sn_int16 idVendor; - sn_int16 idProduct; - sn_int32 stack_state; - sndev_set_ether_ip_type params; - struct hostent * host; - sn_bool got_ip; - struct in_addr addr; - - // load network modules - load_network_modules(); - - // init the socket API - scePrintf("Initializing the sockets API\n"); - result = sockAPIinit(1); - if(result != 0) - { - scePrintf("sockAPIinit() failed %d\n", result); - return result; - } - - // register this thread with the socket API - result = sockAPIregthr(); - if(result != 0) - { - scePrintf("sockAPIregthr() failed %d\n", result); - return result; - } - - // wait for the device adaptor to be attached - scePrintf("Waiting for network device to be initialized\n"); - device_attached = SN_DEV_TYPE_NONE; - while(device_attached == SN_DEV_TYPE_NONE) - { - // check if attached - result = sndev_get_attached(0, &device_attached, &idVendor, &idProduct); - if(result != 0) - { - scePrintf("sndev_get_attached() failed %d\n", result); - return result; - } - - // if nothing attached, give it a rest before trying again - if(device_attached == SN_DEV_TYPE_NONE) - sn_delay(10); - } - - scePrintf("Device ready (idVendor=0x%04X idProduct=0x%04X)\n", ((int)idVendor) & 0xFFFF, ((int)idProduct) & 0xFFFF); - - // set the DNS servers - result = sntc_set_dns_server_list((const sn_char**)dns_servers); - if(result != 0) - { - scePrintf("sntc_set_dns_server_list() failed %d\n", result); - return result; - } - - // set the IP, subnet mask, and gateway (all 0's for DHCP) - inet_aton(SNPS2_IP_ADDR, (struct in_addr*)¶ms.ip_addr); - inet_aton(SNPS2_SUB_MSK, (struct in_addr*)¶ms.sub_mask); - inet_aton(SNPS2_GATEWAY, (struct in_addr*)¶ms.gateway); - result = sndev_set_options(0, SN_DEV_SET_ETHER_IP, ¶ms, sizeof(params)); - if(result != 0) - { - scePrintf("sndev_set_options() failed %d\n", result); - return result; - } - - // start the stack - scePrintf("Starting the TCP/IP stack\n"); - result = sn_stack_state(SN_STACK_STATE_START, &stack_state); - if(result != 0) - { - scePrintf("sn_stack_sate() failed %d\n", result); - return result; - } - - // wait for the stack to come up - while(sn_socket_api_ready() == SN_FALSE) - sn_delay(100); - - // wait for a non-zero IP (for DHCP) - scePrintf("Waiting for DHCP-supplied IP\n"); - got_ip = SN_FALSE; - do - { - // get the local host info - host = gethostbyname(LOCAL_NAME); - if(host && host->h_addr_list[0]) - { - // copy the IP - memcpy(&addr, host->h_addr_list[0], sizeof(addr)); - if(addr.s_addr) - { - got_ip = SN_TRUE; - scePrintf("DHCP allocated IP addr %s\n", inet_ntoa(addr)); - } - } - - // don't hog the CPU - if(got_ip == SN_FALSE) - sn_delay(100); - } - while(got_ip == SN_FALSE); - - return 0; -} - -static void do_shutdown(void) -{ - int result; - int stack_state; - - // stopping the stack - result = sn_stack_state(SN_STACK_STATE_STOP, &stack_state); - if(result != 0) - { - scePrintf("sn_stack_sate() failed %d\n", result); - return; - } - - // deregister this thread with the socket API - sockAPIderegthr(); -} -#endif // SN_SYSTEMS - -#ifdef EENET - -#ifdef __MWERKS__ -#include "/ee/sample/libeenet/ent_cnf/ent_cnf.h" -#else -#include "/usr/local/sce/ee/sample/libeenet/ent_cnf/ent_cnf.h" -#endif - -#if defined(USB_ETHERNET) -#define USR_CONF_NAME "Combination4" -#elif defined(USB_ETHERNET_WITH_PPPOE) -#define USR_CONF_NAME "Combination5" -#elif defined(HDD_ETHERNET) -#define USR_CONF_NAME "Combination6" -#elif defined(HDD_ETHERNET_WITH_PPPOE) -#define USR_CONF_NAME "Combination7" -#elif defined(MODEM) -#define USR_CONF_NAME "" -#endif - -#define MOD_NETCNF MODROOT "netcnf.irx" -#define MOD_EENETCTL MODROOT "eenetctl.irx" -#define MOD_DEV9 MODROOT "dev9.irx" -#define MOD_USBD MODROOT "usbd.irx" -#define MOD_ENT_DEVM MODROOT "ent_devm.irx" -#define MOD_ENT_SMAP MODROOT "ent_smap.irx" -#define MOD_ENT_ETH MODROOT "ent_eth.irx" -#define MOD_ENT_PPP MODROOT "ent_ppp.irx" -#define MOD_ENT_CNF SCEROOT "iop/sample/libeenet/ent_cnf/ent_cnf.irx" -#define MOD_MODEMDRV "" - -#define INETCTL_ARG "-no_auto" "\0" "-no_decode" -#define NETCNF_ICON APPROOT "SYS_NET.ICO" -#define NETCNF_ICONSYS APPROOT "icon.sys" -#define NETCNF_ARG "icon=" NETCNF_ICON "\0" "iconsys=" NETCNF_ICONSYS -#define MODEMDRV_ARG "" - -#define NET_DB SCEROOT "conf/net/net.db" - -#define EENET_MEMSIZE (512 * 1024) -#define EENET_TPL 32 -#define EENET_APP_PRIO 48 - -static int eenetctl_mid; -static int ent_cnf_mid; -static int ent_devm_mid; -#if defined(HDD_ETHERNET) || defined(HDD_ETHERNET_WITH_PPPOE) -#define EENET_IFNAME "smap0" -static int ent_smap_mid; -#endif -#if defined(USB_ETHERNET) || defined(USB_ETHERNET_WITH_PPPOE) -#define EENET_IFNAME "eth0" -static int ent_eth_mid; -#endif -#if defined(MODEM) -#define EENET_IFNAME "ppp0" -static int ent_ppp_mid; -static int modem_mid; -#endif - -static void * eenet_pool; - -static int sema_id; -static int event_flag = 0; -#define Ev_Attach 0x01 -#define Ev_UpCompleted 0x02 -#define Ev_DownCompleted 0x04 -#define Ev_DetachCompleted 0x08 - -#define WaitEvent(event) \ - while(1){ \ - WaitSema(sema_id); \ - if(event_flag & (event)) \ - break; \ - } - -static void event_handler(const char *ifname, int af, int type) -{ - scePrintf("event_handler: event happened. af = %d, type = %d\n", af, type); - - switch(type) - { - case sceEENETCTL_IEV_Attach: - if(strcmp(ifname, EENET_IFNAME)) - break; - event_flag |= Ev_Attach; - SignalSema(sema_id); - break; - case sceEENETCTL_IEV_UpCompleted: - event_flag |= Ev_UpCompleted; - SignalSema(sema_id); - break; - case sceEENETCTL_IEV_DownCompleted: - event_flag |= Ev_DownCompleted; - SignalSema(sema_id); - break; - case sceEENETCTL_IEV_DetachCompleted: - if(strcmp(ifname, EENET_IFNAME)) - break; - event_flag |= Ev_DetachCompleted; - SignalSema(sema_id); - break; - } - - return; -} - -static int create_sema(int init_count, int max_count){ - struct SemaParam sema_param; - int sema_id; - - memset(&sema_param, 0, sizeof(struct SemaParam)); - sema_param.initCount = init_count; - sema_param.maxCount = max_count; - sema_id = CreateSema(&sema_param); - - return sema_id; -} - -// ent_cnf sifrpc num -#define ENT_CNF_SIFRPC_NUM 0x0a31108e - -// code -#define ENT_CNF_SIFRPC_LOAD_CONFIG 1 -#define ENT_CNF_SIFRPC_SET_CONFIG 2 -#define ENT_CNF_SIFRPC_SET_SIFCMD 3 - -// utility macro -#define ee_rpc_size(size) ((size + 15) & ~15) -#define iop_rpc_size(size) ((size + 3) & ~3) - -#define NETBUFSIZE 512 -#define RPCSIZE NETBUFSIZE * 4 - -static sceSifClientData cd; -static u_int rpc_buffer[NETBUFSIZE] __attribute__((aligned(64))); - -int ent_cnf_init(void) -{ - int i; - - /* bind rpc */ - while(1){ - if (sceSifBindRpc(&cd, ENT_CNF_SIFRPC_NUM, 0) < 0) { - scePrintf("ent_cnf: sceSifBindRpc failed.\n"); - while(1) {}; - } - if (cd.serve != 0) break; - i = 0x10000; - while(i --) {}; - } - - return 0; -} - -int ent_cnf_load_config(const char *fname, const char *usr_name) -{ - int ret, len; - - strcpy((char *)rpc_buffer, fname); - len = (int)strlen(fname) + 1; - strcpy((char *)rpc_buffer + len, usr_name); - len += (int)strlen(usr_name) + 1; - - ret = sceSifCallRpc(&cd, ENT_CNF_SIFRPC_LOAD_CONFIG, 0, - (void *)rpc_buffer, ee_rpc_size(len), - (void *)rpc_buffer, ee_rpc_size(sizeof(u_int)), 0, 0); - if(ret < 0){ - scePrintf("ent_cnf: RPC call in ent_cnf_load_config() failed.\n"); - return -1; - } - - return (int)rpc_buffer[0]; -} - -int ent_cnf_set_config(void) -{ - int ret; - - ret = sceSifCallRpc(&cd, ENT_CNF_SIFRPC_SET_CONFIG, 0, - NULL, 0, (void *)rpc_buffer, ee_rpc_size(sizeof(u_int)), 0, 0); - if(ret < 0){ - scePrintf("ent_cnf: RPC call in ent_cnf_set_config() failed.\n"); - return -1; - } - - return (int)rpc_buffer[0]; -} - -static void load_network_modules() -{ - ent_devm_mid = load_module(MOD_ENT_DEVM, 0, NULL); - load_module(MOD_NETCNF, sizeof(NETCNF_ARG), NETCNF_ARG); - eenetctl_mid = load_module(MOD_EENETCTL, 0, NULL); - ent_cnf_mid = load_module(MOD_ENT_CNF, 0, NULL); -#if defined( HDD_ETHERNET ) || defined( HDD_ETHERNET_WITH_PPPOE ) - load_module(MOD_DEV9, 0, NULL); - ent_smap_mid = load_module(MOD_ENT_SMAP, 0, NULL); - //PreparePowerOff(); -#endif -#if defined( USB_ETHERNET ) || defined( USB_ETHERNET_WITH_PPPOE ) - load_module(MOD_USBD, 0, NULL); - ent_eth_mid = load_module(MOD_ENT_ETH, 0, NULL); -#endif -#if defined( MODEM ) - ent_ppp_mid = load_module(MOD_ENT_PPP, 0, NULL); - modem_mid = load_module(MOD_MODEMDRV, sizeof(MODEMDRV_ARG), MODEMDRV_ARG); -#endif -} - -static int do_initialisation(void) -{ - int rcode; - - // create a semaphore - sema_id = create_sema(0, 1); - if(sema_id < 0) - { - scePrintf("create_sema() failed.\n"); - return -1; - } - - // load network modules - load_network_modules(); - - // allocate memory for EENet - //eenet_pool = gsimemalign(64, EENET_MEMSIZE); - eenet_pool = memalign(64, EENET_MEMSIZE); - if(eenet_pool == NULL) - return -1; - - // initialize eenet - rcode = sceEENetInit(eenet_pool, EENET_MEMSIZE, EENET_TPL, 8192, EENET_APP_PRIO); - - - if(rcode < 0) - { - scePrintf("sceEENetInit failed (%d)\n", rcode); - return -1; - } - -#ifdef _DEBUG - sceEENetSetLogLevel(EENET_LOG_DEBUG); -#endif - - // init eenetctl.a - rcode = sceEENetCtlInit(8192, 32, 8192, 32, 8192, 32, 1, 0); - if(rcode < 0) - { - scePrintf("sceEENetCtlInit failed (%d)\n", rcode); - return -1; - } - - // add event handler - rcode = sceEENetCtlRegisterEventHandler(event_handler); - if(rcode < 0) - { - scePrintf("sceEENetCtlRegisterEventHandler failed (%d)\n", rcode); - return -1; - } - - // init ent_cnf - rcode = ent_cnf_init(); - if(rcode < 0) - { - scePrintf("ent_cnf_init failed (%d)\n", rcode); - return -1; - } - - // register network interface driver -#if defined( HDD_ETHERNET ) || defined( HDD_ETHERNET_WITH_PPPOE ) - rcode = sceEENetDeviceSMAPReg(8192, 8192); - if(rcode < 0) - { - scePrintf("sceEENetDeviceSMAPReg failed (%d)\n", rcode); - return -1; - } -#endif -#if defined( USB_ETHERNET ) || defined( USB_ETHERNET_WITH_PPPOE ) - rcode = sceEENetDeviceETHReg(8192, 8192); - if(rcode < 0) - { - scePrintf("sceEENetDeviceETHReg failed (%d)\n", rcode); - return -1; - } -#endif -#if defined( MODEM ) - rcode = sceEENetDevicePPPReg(8192, 8192); - if(rcode < 0) - { - scePrintf("sceEENetDevicePPPReg failed (%d)\n", rcode); - return -1; - } -#endif - - // wait until target interface is attached - WaitEvent(Ev_Attach); - - // load network configuration - rcode = ent_cnf_load_config(NET_DB, USR_CONF_NAME); - if(rcode < 0) - { - scePrintf("ent_cnf_load_config failed (%d)\n", rcode); - return -1; - } - - // set network configuration - rcode = ent_cnf_set_config(); - if(rcode < 0) - { - scePrintf("ent_cnf_set_config failed (%d)\n", rcode); - return -1; - } - - // wait for interface initialization to complete - WaitEvent(Ev_UpCompleted); - - return 0; -} - -static void do_shutdown(void) -{ - int rcode; - - // bring down the interface - rcode = sceEENetCtlDownInterface(EENET_IFNAME); - if(rcode < 0) - { - scePrintf("sceEENetCtlDownInterface failed (%d)\n", rcode); - return; - } - - // wait for the termination to complete - WaitEvent(Ev_DownCompleted); - - // unload the driver module -#if defined( HDD_ETHERNET ) || defined( HDD_ETHERNET_WITH_PPPOE ) - rcode = sceEENetDeviceSMAPUnreg(); - if(rcode < 0) - { - scePrintf("sceEENetDeviceSMAPUnreg failed (%d)\n", rcode); - return; - } -#endif -#if defined( USB_ETHERNET ) || defined( USB_ETHERNET_WITH_PPPOE ) - rcode = sceEENetDeviceETHUnreg(); - if(rcode < 0) - { - scePrintf("sceEENetDeviceETHUnreg failed (%d)\n", rcode); - return; - } -#endif -#if defined( MODEM ) - rcode = sceEENetDevicePPPUnreg(); - if(rcode < 0) - { - scePrintf("sceEENetDevicePPPUnreg failed (%d)\n", rcode); - return; - } -#endif - - // wait for the detach to complete - WaitEvent(Ev_DetachCompleted); - - // cancel the event handler - rcode = sceEENetCtlUnregisterEventHandler(event_handler); - if(rcode < 0) - { - scePrintf("sceEENetCtlUnRegisterEventHandler failed (%d)\n", rcode); - return; - } - - // eenetctl.a termination processing - rcode = sceEENetCtlTerm(); - if(rcode < 0) - { - scePrintf("sceEENetCtlTerm failed (%d)\n", rcode); - return; - } - - // terminate eenet - rcode = sceEENetTerm(); - if(rcode < 0) - { - scePrintf("sceEENetTerm failed (%d)\n", rcode); - return; - } - - // stop and unload modules -#if defined( HDD_ETHERNET ) || defined( HDD_ETHERNET_WITH_PPPOE ) - sceSifStopModule(ent_smap_mid, 0, NULL, &rcode); - sceSifUnloadModule(ent_smap_mid); -#endif -#if defined( USB_ETHERNET ) || defined( USB_ETHERNET_WITH_PPPOE ) - sceSifStopModule(ent_eth_mid, 0, NULL, &rcode); - sceSifUnloadModule(ent_eth_mid); -#endif -#if defined( MODEM ) - sceSifStopModule(modem_mid, 0, NULL, &rcode); - sceSifUnloadModule(modem_mid); - - sceSifStopModule(ent_ppp_mid, 0, NULL, &rcode); - sceSifUnloadModule(ent_ppp_mid); -#endif - - sceSifStopModule(ent_cnf_mid, 0, NULL, &rcode); - sceSifUnloadModule(ent_cnf_mid); - - sceSifStopModule(eenetctl_mid, 0, NULL, &rcode); - sceSifUnloadModule(eenetctl_mid); - - sceSifStopModule(ent_devm_mid, 0, NULL, &rcode); - sceSifUnloadModule(ent_devm_mid); - - // free the EENet pool - if(eenet_pool != NULL) - free(eenet_pool); -} - -#endif - -#ifdef INSOCK - -// These are also used in nonport.c to obtain the MAC address -sceSifMClientData gGSIInsockClientData; -u_int gGSIInsockSocketBuffer[NETBUFSIZE] __attribute__((aligned(64))); - - -// IRX paths -#define IOP_MOD_INET MODROOT "inet.irx" -#define IOP_MOD_AN986 MODROOT "an986.irx" -#define IOP_MOD_USBD MODROOT "usbd.irx" -#define IOP_MOD_NETCNF MODROOT "netcnf.irx" -#define IOP_MOD_INETCTL MODROOT "inetctl.irx" -#define IOP_MOD_MSIFRPC MODROOT "msifrpc.irx" -#define IOP_MOD_DEV9 MODROOT "dev9.irx" -#define IOP_MOD_SMAP MODROOT "smap.irx" -#define IOP_MOD_PPP MODROOT "ppp.irx" -#define IOP_MOD_PPPOE MODROOT "pppoe.irx" -#define IOP_MOD_LIBNET MODROOT "libnet.irx" -#define IOP_MOD_NETCNFIF MODROOT "netcnfif.irx" -#define IOP_MOD_INETLOG SCEROOT "iop/util/inet/inetlog.irx" -#define IOP_MOD_MODEMDRV "" -#define NET_DB SCEROOT "conf/net/net.db" -#define INET_ARG "debug=18" -#define INETCTL_ARG "-no_auto" "\0" "-no_decode" -#define LIBNET_ARG "-verbose" -#define NETCNF_ICON APPROOT "SYS_NET.ICO" -#define NETCNF_ICONSYS APPROOT "icon.sys" -#define NETCNF_ARG "icon=" NETCNF_ICON "\0" "iconsys=" NETCNF_ICONSYS -#define MODEMDRV_ARG "" - -#if defined( USB_ETHERNET ) -#define USR_CONF_NAME "Combination4" -#elif defined( USB_ETHERNET_WITH_PPPOE ) -#define USR_CONF_NAME "Combination5" -#elif defined( HDD_ETHERNET ) -#define USR_CONF_NAME "Combination6" -#elif defined( HDD_ETHERNET_WITH_PPPOE ) -#define USR_CONF_NAME "Combination7" -#elif defined( MODEM ) -#define USR_CONF_NAME "" -#endif - -static int do_initialisation(void) -{ - int result; - int i; - int if_id[sceLIBNET_MAX_INTERFACE]; - sceInetAddress_t myaddr; - - sceSifInitRpc( 0 ); - - load_module( IOP_MOD_INET, 0, NULL ); - load_module( IOP_MOD_NETCNF, sizeof( NETCNF_ARG ), NETCNF_ARG ); - load_module( IOP_MOD_INETCTL, sizeof( INETCTL_ARG ), INETCTL_ARG ); - -#if defined( USB_ETHERNET ) || defined( USB_ETHERNET_WITH_PPPOE ) - load_module( IOP_MOD_USBD, 0, NULL ); - load_module( IOP_MOD_AN986, 0, NULL ); -#endif - -#if defined( HDD_ETHERNET ) || defined( HDD_ETHERNET_WITH_PPPOE ) - load_module( IOP_MOD_DEV9, 0, NULL ); - load_module( IOP_MOD_SMAP, 0, NULL ); -#endif - -#if defined( USB_ETHERNET_WITH_PPPOE ) || defined( HDD_ETHERNET_WITH_PPPOE ) - load_module( IOP_MOD_PPP, 0, NULL ); - load_module( IOP_MOD_PPPOE, 0, NULL ); -#endif - -#if defined( MODEM ) - load_module( IOP_MOD_PPP, 0, NULL ); - load_module( IOP_MOD_USBD, 0, NULL ); - load_module( IOP_MOD_MODEMDRV, sizeof( MODEMDRV_ARG ), MODEMDRV_ARG ); -#endif - - load_module( IOP_MOD_MSIFRPC, 0, NULL ); - load_module( IOP_MOD_LIBNET, sizeof( LIBNET_ARG ), LIBNET_ARG ); - load_module( IOP_MOD_NETCNFIF, 0, NULL ); - -#if defined( HDD_ETHERNET ) || defined( HDD_ETHERNET_WITH_PPPOE ) -// PreparePowerOff(); -#endif - - // Initialize Libnet - sceSifMInitRpc(0); - - result = sceInsockSetSifMBindRpcValue(NETBUFSIZE, sceLIBNET_STACKSIZE, sceLIBNET_PRIORITY); - if (result < 0) - return result; - - result = sceLibnetInitialize(&gGSIInsockClientData, NETBUFSIZE, sceLIBNET_STACKSIZE, sceLIBNET_PRIORITY); - if (result < 0) - return result; - - result = sceLibnetRegisterHandler(&gGSIInsockClientData, gGSIInsockSocketBuffer); - if (result < 0) - return result; - - result = load_set_conf_extra(&gGSIInsockClientData, gGSIInsockSocketBuffer, NET_DB, USR_CONF_NAME, sceLIBNETF_AUTO_UPIF); - if (result < 0) - return result; - - result = sceLibnetWaitGetAddress( &gGSIInsockClientData, gGSIInsockSocketBuffer, if_id, sceLIBNET_MAX_INTERFACE, &myaddr, sceLIBNETF_AUTO_UPIF ); - if (result < 0) - return result; - - for ( i = 0; i < sceLIBNET_MAX_INTERFACE; i++ ) { - if ( if_id[ i ] == 0 ) { - break; - } - scePrintf( "interface: %d\n", if_id[ i ] ); - } - - return 0; -} - -static void do_shutdown(void) -{ - // Release the network interface - down_interface(&gGSIInsockClientData, gGSIInsockSocketBuffer, 0); - - // Shutdown libnet - libnet_term(&gGSIInsockClientData); - - sceSifMExitRpc(); -} - -#endif // INSOCK - -#ifdef GSI_VOICE -void load_voice_modules(void); // prototype so codewarrior will be happy -void load_voice_modules(void) -{ - // this is the maximum size of a raw frame, in bytes - char lgaudArgs[] = "maxstream=512\n"; - - // load the usb module - load_module("host0:/usr/local/sce/iop/modules/usbd.irx", 0, NULL); - - // load the lgAud module - // see the lgAud documentation for info on optional loading parameters - load_module("host0:/usr/local/sce/iop/modules/lgaud.irx", sizeof(lgaudArgs), lgaudArgs); - - // load the lgVid module - // see the lgVid documentation for info on optional loading parameters - load_module("host0:/usr/local/sce/iop/modules/lgvid.irx", 0, NULL); - - // load the SPU2 modules - load_module("host0:/usr/local/sce/iop/modules/libsd.irx", 0, NULL); - load_module("host0:/usr/local/sce/iop/modules/sdrdrv.irx", 0, NULL); -} -#endif - -// New hooks required by crt0.s -#if !defined(__MWERKS__) -int _init(){ return 0; } -int _fini(){ return 0; } - - #if (__GNUC__ >= 3) - int __main(int argc, char ** argp){ GSI_UNUSED(argp); GSI_UNUSED(argc); return 0; } - #endif -#endif - -extern int test_main(int argc, char ** argp); -int main(int argc, char ** argp) -{ - int result = 0; - - GSI_UNUSED(argc); - GSI_UNUSED(argp); - - printf("\nGameSpy Test App Initializing\n" - "----------------------------------\n"); - - // init RPC - sceSifInitRpc(0); - - // initialize the stack - result = (int)do_initialisation(); - if(result) - { - printf("Initialization failed\n"); - return result; - } - -#ifdef GSI_VOICE - load_voice_modules(); -#endif - - // start the actual program - printf("\nGameSpy Test App Starting\n" - "----------------------------------\n"); - test_main(argc, argp); - - // do any needed cleanup - do_shutdown(); - printf("\nGameSpy Test App Exiting\n" - "----------------------------------\n"); - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2pad.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2pad.c deleted file mode 100644 index 0b8ebe24354..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2pad.c +++ /dev/null @@ -1,214 +0,0 @@ -#include "ps2pad.h" -#include -#include -#include - -#define BUTTON_LEFT(d) ((d[2] & (1 << (3+4)))==0) -#define BUTTON_DOWN(d) ((d[2] & (1 << (2+4)))==0) -#define BUTTON_RIGHT(d) ((d[2] & (1 << (1+4)))==0) -#define BUTTON_UP(d) ((d[2] & (1 << (0+4)))==0) - -#define BUTTON_START(d) ((d[2] & (1 << 3))==0) -#define BUTTON_RSTICK(d) ((d[2] & (1 << 2))==0) -#define BUTTON_LSTICK(d) ((d[2] & (1 << 1))==0) -#define BUTTON_SELECT(d) ((d[2] & (1 << 0))==0) - -#define BUTTON_SQUARE(d) ((d[3] & (1 << (3+4)))==0) -#define BUTTON_X(d) ((d[3] & (1 << (2+4)))==0) -#define BUTTON_CIRCLE(d) ((d[3] & (1 << (1+4)))==0) -#define BUTTON_TRI(d) ((d[3] & (1 << (0+4)))==0) - -#define BUTTON_R1(d) ((d[3] & (1 << 3))==0) -#define BUTTON_L1(d) ((d[3] & (1 << 2))==0) -#define BUTTON_R2(d) ((d[3] & (1 << 1))==0) -#define BUTTON_L2(d) ((d[3] & (1 << 0))==0) - -static int term_id = 0; - -static u_long128 mPadDMABuf[scePadDmaBufferMax] __attribute__((aligned (64))); -static int mPadState; -static int mPadPhase; - -static unsigned char mActDirect[6]; -static unsigned char mActAlign[6]; - -static unsigned short PadReadData(int events[NumPadEvents]) -{ - static unsigned char rdata_prev[32]; - unsigned char rdata[32]; - unsigned short tpad = 0; - unsigned short paddata = 0; - static unsigned short rpad = 0; - - if (scePadRead(0,0,rdata) == 0) - return 0; - - if (rdata[0] == 0) - { - paddata = (unsigned short)(0xffff ^ ((rdata[2]<<8)|rdata[3])); - - tpad = (unsigned short)(paddata & ~rpad); - rpad = paddata; - - term_id = (rdata[1]>>4); - - events[PadLeft] = (BUTTON_LEFT(rdata) && !BUTTON_LEFT(rdata_prev)); - events[PadDown] = (BUTTON_DOWN(rdata) && !BUTTON_DOWN(rdata_prev)); - events[PadRight] = (BUTTON_RIGHT(rdata) && !BUTTON_RIGHT(rdata_prev)); - events[PadUp] = (BUTTON_UP(rdata) && !BUTTON_UP(rdata_prev)); - events[PadStart] = (BUTTON_START(rdata) && !BUTTON_START(rdata_prev)); - events[PadRightStick] = (BUTTON_RSTICK(rdata) && !BUTTON_RSTICK(rdata_prev)); - events[PadLeftStick] = (BUTTON_LSTICK(rdata) && !BUTTON_LSTICK(rdata_prev)); - events[PadSelect] = (BUTTON_SELECT(rdata) && !BUTTON_SELECT(rdata_prev)); - events[PadSquare] = (BUTTON_SQUARE(rdata) && !BUTTON_SQUARE(rdata_prev)); - events[PadX] = (BUTTON_X(rdata) && !BUTTON_X(rdata_prev)); - events[PadCircle] = (BUTTON_CIRCLE(rdata) && !BUTTON_CIRCLE(rdata_prev)); - events[PadTriangle] = (BUTTON_TRI(rdata) && !BUTTON_TRI(rdata_prev)); - events[PadR1] = (BUTTON_R1(rdata) && !BUTTON_R1(rdata_prev)); - events[PadL1] = (BUTTON_L1(rdata) && !BUTTON_L1(rdata_prev)); - events[PadR2] = (BUTTON_R2(rdata) && !BUTTON_R2(rdata_prev)); - events[PadL2] = (BUTTON_L2(rdata) && !BUTTON_L2(rdata_prev)); - } - - // store current data - memcpy(rdata_prev, rdata, 32); - - return (tpad); -} - -#define ROOT_DIR "host0:/usr/local/sce/iop/modules/" -int PadInit(void) -{ - int i; - - mPadPhase = 0; - mPadState = 0; - - for (i=0; i <6; i++) - { - mActDirect[i] = 0; - mActAlign[i] = 0; - } - - // Load serial io module - if (0 >= sceSifLoadModule(ROOT_DIR "sio2man.irx", 0, NULL)) - return 0; - - // Load control pad module - if (0 >= sceSifLoadModule(ROOT_DIR "padman.irx", 0, NULL)) - return 0; - - // Misc init - sceDmaReset(1); // reset DMA - sceGsResetPath(); // reset GS - sceGsSyncPath(0, 0); // wait for completion - - // Open the pad port - scePadInit(0); - if (0 == scePadPortOpen(0, 0, mPadDMABuf)) - return 0; // couldn't initialize pad - - return 1; -} - -void PadReadInput(int events[NumPadEvents]) -{ - static int id = 0; - int exid; - int i; - - for(i = 0 ; i < NumPadEvents ; i++) - events[i] = 0; - - // check buttons or some junk - mPadState = scePadGetState(0, 0); - //if (mPadState >= 0 && state <= 7) - // scePadStateIntToStr(state, buf); // get error string - if (mPadState == scePadStateDiscon) - mPadPhase = 0; // lost pad - - switch(mPadPhase) - { - case 0: - { - // Wait until stable or need to find ctp1 - if (mPadState != scePadStateStable && mPadState != scePadStateFindCTP1) - break; - - // Get controller ID - id = scePadInfoMode(0, 0, InfoModeCurID, 0); - if (id == 0) - break; - - // Is there an extended ID? - exid = scePadInfoMode(0,0, InfoModeCurExID, 0); - if (exid > 0) - id = exid; - - if (id == 40) - // Special processing for "standard" controller - mPadPhase = 40; - else if (id == 7) - // Special processing for "analog" controller - mPadPhase = 70; - else - // Skip to end of setup - mPadPhase = 99; - break; - } - - // 1st step special processing for "standard" controller - case 40: - if (scePadInfoMode(0, 0, InfoModeCurExID, 0)==0) - { - // Skip to end if this was set from an extended ID - mPadPhase = 99; - break; - } - - // Set main mode - if (scePadSetMainMode(0, 0, 1, 0)==1) - mPadPhase++; - break; - - // 2nd step special processing for "standard" controller - case 41: - if (scePadGetReqState(0,0) == scePadReqStateFaild) - mPadPhase--; // failed, go back a phase - if (scePadGetReqState(0,0) == scePadReqStateComplete) - mPadPhase = 0; // completed, go back to beginning to try again - break; - - // 1st step special processing for "analog" controller - case 70: - if (scePadInfoAct(0, 0, -1, 0)==0) - mPadPhase = 99; // done - mActAlign[0] = 0; - mActAlign[1] = 1; - for (i=2; i<6; i++) - mActAlign[i] = 0xff; - if (scePadSetActAlign(0, 0, mActAlign)) - mPadPhase++; - break; - - // 2nd step special processing for "analog" controller - case 71: - if (scePadGetReqState(0,0) == scePadReqStateFaild) - mPadPhase--; - if (scePadGetReqState(0,0) == scePadReqStateComplete) - mPadPhase = 99; // finished, jump to end - - case 99: - default: - if (mPadState == scePadStateStable || mPadState == scePadStateFindCTP1) - { - // read button states - //unsigned short pad = ReadPadData(); - PadReadData(events); - - if (term_id != id) - mPadPhase = 0; - } - break; - }; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2pad.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2pad.h deleted file mode 100644 index 4346039d716..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps2/ps2pad.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __PS2PAD_H__ -#define __PS2PAD_H__ - -#include "../../../nonport.h" - -typedef enum -{ - PadLeft, - PadDown, - PadRight, - PadUp, - PadStart, - PadRightStick, - PadLeftStick, - PadSelect, - PadSquare, - PadX, - PadCircle, - PadTriangle, - PadR1, - PadL1, - PadR2, - PadL2, - NumPadEvents -} PadEvents; - -int PadInit(void); -void PadReadInput(int events[NumPadEvents]); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/Makefile.common b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/Makefile.common deleted file mode 100644 index fb3edd3643b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/Makefile.common +++ /dev/null @@ -1,31 +0,0 @@ -#GameSpy.net PS3 Makefile -#Included from sample-specific Makefiles - -CELL_TARGET_PATH = $(CELL_SDK)/target-ceb -CELL_HOST_BIN_PATH = $(HOST_PATH)/bin - -LIBDIR = $(CELL_TARGET_PATH)/ppu/lib - -CFLAGS = -g -O0 -Wall -Werror -Wa,-al -fno-common -I$(GAMESPY_DIR) -DGSI_COMMON_DEBUG -D_PS3 $(SDK_CFLAGS) -ASFLAGS = -c -xassembler-with-cpp -Wa,-al -LDFLAGS = -lm -INCDIR = -I$(CELL_SDK)/target-ceb/ppu/include/network - -LIBS = $(SDK_LIBS) \ - $(LIBDIR)/libnet.a \ - $(LIBDIR)/libio.a - -AS = ppu-lv2-as -CC = ppu-lv2-gcc -LD = ppu-lv2-g++ - -.SUFFIXES: .c - -$(TARGET).elf: $(OBJS) - $(LD) -o $@ $(OBJS) $(LIBS) $(LDFLAGS) - -.c.o: - $(CC) $(CFLAGS) $(INCDIR) -c $< -o $*.o > /dev/null - -clean: - $(RM) $(OBJS) *.o $(TARGET).elf diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/CellConfiguration.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/CellConfiguration.h deleted file mode 100644 index 411c9da04d0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/CellConfiguration.h +++ /dev/null @@ -1,18 +0,0 @@ -/* [SCE CONFIDENTIAL DOCUMENT] - * PLAYSTATION(R)3 SPU Optimized Bullet Physics Library (http://bulletphysics.com) - * Copyright (C) 2007 Sony Computer Entertainment Inc. - * All Rights Reserved. - */ - -#ifndef __CELL_CONFIGURATION_H -#define __CELL_CONFIGURATION_H - -#undef SCE_CONTROL_CONSOLE - -#ifdef WIN32 -#define EXPORT_SYM __declspec( dllexport ) -#else -#define EXPORT_SYM -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/CellVectorMath.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/CellVectorMath.h deleted file mode 100644 index 01e2645f7c4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/CellVectorMath.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __CELL_VECTORMATH_H__ -#define __CELL_VECTORMATH_H__ - -#ifndef __CELLOS_LV2__ -class vec_float4 -{ - float x, y, z, w; -} -#ifdef __GNUC__ -__attribute__ ((aligned (16))); -#else -__declspec(align(16)); -#endif // __GNUC__ -#endif // __CELLOS_LV2__ - -#ifdef __CELLOS_LV2__ -#include "vectormath_soa.h" -#else -#include "vectormath_scalar/vectormath_aos.h" -#endif // __CELLOS_LV2__ - -using namespace Vectormath; -using namespace Vectormath::Aos; - -#endif /* __CELL_VECTORMATH_H__ */ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/PS3Types.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/PS3Types.h deleted file mode 100644 index d11567cfb38..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/PS3Types.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef PS3_TYPES_H -#define PS3_TYPES_H - -//#include "CellVectorMath.h" - - -#endif //PS3_TYPES_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SPUAssert.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SPUAssert.h deleted file mode 100644 index fb58827e5c5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SPUAssert.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __SPU_ASSERT_H__ -#define __SPU_ASSERT_H__ - -// Author: Sauce -// 1/18/2006 -// Better assert on SPU side, but it assumes spu_printf works. - -#ifdef _DEBUG - -#ifdef __CELLOS_LV2__ -#include -#define SPU_ASSERT(cond) do { if (__builtin_expect(!(cond), 0)) { spu_printf("SPU: Assertion failed! Expression: " #cond "\n in %s at " __FILE__ ":%i\n", __FUNCTION__, __LINE__); spu_hcmpeq((cond), 0); } } while (0) -#else // __CELLOS_LV2__ -#define SPU_ASSERT(cond) assert(cond) -#endif //__CELLOS_LV2__ - -#else // _DEBUG - -#ifdef __CELLOS_LV2__ -#include -#define SPU_ASSERT(cond) do { if (__builtin_expect(!(cond), 0)) { spu_printf("SPU: Assertion failed! Expression: " #cond "\n in %s at " __FILE__ ":%i\n", __FUNCTION__, __LINE__); spu_hcmpeq((cond), 0); } } while (0) -// Sauce -// Later on we'll want no asserts in release builds -//#define SPU_ASSERT(cond) do {} while (0) -#else // __CELLOS_LV2__ -#define SPU_ASSERT(cond) assert(cond) -#endif // __CELLOS_LV2__ - -#endif // _DEBUG - -// Usage: -// SPU_COMPILE_TIME_ASSERT(sizeof(MyStructure) <= 128); -// Gives the following error message if it fails: -// error: size of array `spu_compile_time_assert_failed' is negative -#define SPU_COMPILE_TIME_ASSERT(cond) extern char spu_compile_time_assert_failed[cond ? 1 : -1] - -// Usage: -// SPU_NAMED_COMPILE_TIME_ASSERT(MyStructure_is_more_than_128_bytes, sizeof(MyStructure) <= 128); -// Gives the following error message if it fails: -// error: size of array `MyStructure_is_more_than_128_bytes' is negative -#define SPU_NAMED_COMPILE_TIME_ASSERT(name, cond) extern char name[cond ? 1 : -1] - - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpeexSpursTask_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpeexSpursTask_vs2005.vcproj deleted file mode 100644 index 8f50e416fb5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpeexSpursTask_vs2005.vcproj +++ /dev/null @@ -1,644 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpeexSpursTask_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpeexSpursTask_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpeexSpursTask_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpuSpeexTaskMain.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpuSpeexTaskMain.cpp deleted file mode 100644 index b301ef29925..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTask/SpuSpeexTaskMain.cpp +++ /dev/null @@ -1,515 +0,0 @@ -// Copyright 2007 GameSpy Industries, Inc -// -// Speex SPURS Task -// Encode supported -// Decode supported -// - -#define __STDC_CONSTANT_MACROS - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include "SPUAssert.h" - -#include "spursSupportInterface.h" -#include "SpursSpeexTaskManager.h" -#include "SpuFakeDma.h" -#include "SpursSpeexCInterface.h" - -#include - -#include -#include "LibSN_SPU.h" - -#define GVRate_8KHz 8000 -#define GVRate_16KHz 16000 - -// use this for data read in from each task request -SpursSpeexTaskDesc gviSpursSpeexTaskDesc; - -// internal data used by speex functions -SpeexBits gviSpursSpeexBits; - -char gviSpursSpeexStateBuffer[SPEEX_ENCODER_STATE_BUFFER_SIZE] POST_ALIGN(128); -char gviSpursSpeexBitsBuffer[MAX_BYTES_PER_FRAME] POST_ALIGN(16); - -void spuDebugPrintf(const char *fmt, ...) -{ - #ifdef SPU_VERBOSE_DEBUGGING - char debugOut[256]; - va_list args; - va_start(args, fmt); - vsprintf(debugOut, fmt, args); - va_end(args); - spu_printf(debugOut); - #endif -} - -void gviSpursSpeexEncoderInitialize(SpursSpeexTaskOutput *spuOutput) -{ - void *gviSpeexEncoderState; - int sampleRate = gviSpursSpeexTaskDesc.mSamplesPerSecond; - int quality = gviSpursSpeexTaskDesc.mQuality; - int rate; - int bitsPerFrame; - - //spuDebugPrintf("[Speex][SPU] sample rate: %d, quality: %d\n", sampleRate, quality); - - // create a new encoder state - if (sampleRate == GVRate_8KHz) - gviSpeexEncoderState = speex_encoder_init(&speex_nb_mode, gviSpursSpeexStateBuffer); - else if (sampleRate == GVRate_16KHz) - gviSpeexEncoderState = speex_encoder_init(&speex_wb_mode, gviSpursSpeexStateBuffer); - else - { - //spuDebugPrintf("[Speex][SPU] Initializing Speex failed\n"); - spuOutput->mSpeexReturnCode = -2; - return; - } - - if(!gviSpeexEncoderState) - { - //spuDebugPrintf("[Speex][SPU] Initializing Speex failed\n"); - spuOutput->mSpeexReturnCode = -3; - return; - } - - //spuDebugPrintf("[Speex][SPU] Done getting speex mode\n"); - //spuDebugPrintf("[Speex][SPU] encoder state addr: 0x%8x\n", gviSpeexEncoderState); - - // set the sampling rate - speex_encoder_ctl(gviSpeexEncoderState, SPEEX_SET_SAMPLING_RATE, &sampleRate); - - // Get the samples per frame setting. - speex_encoder_ctl(gviSpeexEncoderState, SPEEX_GET_FRAME_SIZE, &spuOutput->mSpeexSamplesPerFrame); - - // set the quality - speex_encoder_ctl(gviSpeexEncoderState, SPEEX_SET_QUALITY, &quality); - - // (re)initialize the bits struct - speex_bits_init_buffer(&gviSpursSpeexBits,gviSpursSpeexBitsBuffer,sizeof(gviSpursSpeexBitsBuffer)); - - //spuDebugPrintf("[Speex][SPU] speex bits addr: 0x%8x\n", gviSpeexBits); - - // get the bit rate - speex_encoder_ctl(gviSpeexEncoderState, SPEEX_GET_BITRATE, &rate); - - //spuDebugPrintf("[Speex][SPU] Done with customizing options for speex\n"); - - // convert to bits per frame - bitsPerFrame = (rate / (sampleRate / spuOutput->mSpeexSamplesPerFrame)); - - // convert to bytes per frame and store, round up to allocate more space than needed. - spuOutput->mSpeexEncodedFrameSize = (bitsPerFrame / 8); - if (bitsPerFrame % 8) - spuOutput->mSpeexEncodedFrameSize++; - - // we're now initialized - spuOutput->mSpeexInitialized = 1; - - //spuDebugPrintf("[Speex][SPU] Done with initing speex\n"); - - spuOutput->mSpeexReturnCode = 0; -} - -void gviSpursSpeexDecoderInitialize(SpursSpeexTaskOutput *spuTaskOut) -{ - void * decoder = gviSpursSpeexStateBuffer; - int perceptualEnhancement = 1; - - // create a new decoder state - if (gviSpursSpeexTaskDesc.mSamplesPerSecond == GVRate_8KHz) - speex_decoder_init(&speex_nb_mode, decoder); - else if (gviSpursSpeexTaskDesc.mSamplesPerSecond == GVRate_16KHz) - speex_decoder_init(&speex_wb_mode, decoder); - else - { - //spuDebugPrintf("[Speex][SPU] Error: invalid sample rate!\n"); - spuTaskOut->mSpeexReturnCode = -1; - } - - if(!decoder) - { - //spuDebugPrintf("[Speex][SPU] Error: initializing decoder failed!\n"); - spuTaskOut->mSpeexReturnCode = -2; - } - - // turn on the perceptual enhancement - speex_decoder_ctl(decoder, SPEEX_SET_ENH, &perceptualEnhancement); - - spuTaskOut->mSpeexReturnCode = 0; -} - -void gviSpursSpeexEncode(SpursSpeexTaskOutput *spuTaskOut) -{ - short *inBuffer; - float *speexBuffer; - char *outBuffer; - unsigned int i; - spuTaskOut->mSpeexEncodedFrameSize = 0; - spuTaskOut->mSpeexInitialized = 1; - spuTaskOut->mSpeexSamplesPerFrame = 0; - spuTaskOut->mSpeexReturnCode = 0; - spuTaskOut->mSpeexOutBufferSize = 0; - - speexBuffer = (float *)memalign(16, gviSpursSpeexTaskDesc.mInputBufferSize * sizeof(float)); - inBuffer = (short *)memalign(16, gviSpursSpeexTaskDesc.mInputBufferSize * sizeof(short)); - outBuffer = (char *)memalign(16, gviSpursSpeexTaskDesc.mOutputBufferSize); - - memset(speexBuffer, 0, gviSpursSpeexTaskDesc.mInputBufferSize * sizeof(float)); - memset(inBuffer, 0, gviSpursSpeexTaskDesc.mInputBufferSize * sizeof(short)); - memset(outBuffer, 0, gviSpursSpeexTaskDesc.mOutputBufferSize); - - cellDmaGet(inBuffer, (uint64_t)gviSpursSpeexTaskDesc.mInputBuffer, gviSpursSpeexTaskDesc.mInputBufferSize * sizeof(short), DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - // convert the input to floats for encoding - for(i = 0 ; i < gviSpursSpeexTaskDesc.mInputBufferSize ; i++) - speexBuffer[i] = inBuffer[i]; - - // (re)initialize the bits struct - speex_bits_init_buffer(&gviSpursSpeexBits,gviSpursSpeexBitsBuffer,sizeof(gviSpursSpeexBitsBuffer)); - - // flush the bits - speex_bits_reset(&gviSpursSpeexBits); - - // encode the frame - speex_encode(gviSpursSpeexStateBuffer, speexBuffer, &gviSpursSpeexBits); - // write the bits to the output - spuTaskOut->mSpeexOutBufferSize = speex_bits_write(&gviSpursSpeexBits, (char *)outBuffer, gviSpursSpeexTaskDesc.mEncodedFrameSize); - //spuDebugPrintf("[Speex][SPU] transferring data back, output size should be: %d\n", gviSpursSpeexTaskDesc.mOutputBufferSize>16?gviSpursSpeexTaskDesc.mOutputBufferSize:16); - cellDmaPut(outBuffer, (uint64_t)gviSpursSpeexTaskDesc.mOutputBuffer, gviSpursSpeexTaskDesc.mOutputBufferSize, DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - //spuDebugPrintf("[Speex][SPU] done transferring data back\n"); - free(speexBuffer); - free(inBuffer); - free(outBuffer); - spuTaskOut->mSpeexReturnCode = 0; -} - -void gviSpursSpeexDecodeAdd(SpursSpeexTaskOutput *spuTaskOut) -{ - char *inBuffer; - float *speexBuffer; - short *outBuffer; - int rcode; - unsigned int i; - - //spuDebugPrintf("[Speex][SPU] allocating buffers for decoding\n"); - speexBuffer = (float *)memalign(16, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(float)); - outBuffer = (short *)memalign(16, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(short)); - inBuffer = (char *)memalign(16, gviSpursSpeexTaskDesc.mInputBufferSize); - - memset(speexBuffer, 0, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(float)); - memset(outBuffer, 0, gviSpursSpeexTaskDesc.mOutputBufferSize); - memset(inBuffer, 0, gviSpursSpeexTaskDesc.mInputBufferSize * sizeof(short)); - - - //spuDebugPrintf("[Speex][SPU] done allocating, getting input data, inbuffer size: %d\n", gSpuSampleTaskDesc.mInputBufferSize); - cellDmaGet(inBuffer, (uint64_t)gviSpursSpeexTaskDesc.mInputBuffer, gviSpursSpeexTaskDesc.mInputBufferSize, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - // spuDebugPrintf("[Speex][SPU] done getting input data, preparing for speex to decode\n"); - // read the data into the bits - // (re)initialize the bits struct - speex_bits_init_buffer(&gviSpursSpeexBits,gviSpursSpeexBitsBuffer,sizeof(gviSpursSpeexBitsBuffer)); - - speex_bits_read_from(&gviSpursSpeexBits, (char *)inBuffer, gviSpursSpeexTaskDesc.mEncodedFrameSize); - - // decode it - rcode = speex_decode((void *)gviSpursSpeexStateBuffer, &gviSpursSpeexBits, speexBuffer); - assert(rcode == 0); - //spuDebugPrintf("[Speex][SPU] done with speex decode\n"); - // convert the output from floats - for(i = 0 ; i < gviSpursSpeexTaskDesc.mOutputBufferSize ; i++) - outBuffer[i] = (short)speexBuffer[i]; - - //spuDebugPrintf("[Speex][SPU] transferring data back\n"); - cellDmaPut(outBuffer, (uint64_t)gviSpursSpeexTaskDesc.mOutputBuffer, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(short), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - //spuDebugPrintf("[Speex][SPU] done transferring data back\n"); - free(speexBuffer); - free(inBuffer); - free(outBuffer); - spuTaskOut->mSpeexReturnCode = 0; -} - -void gviSpursSpeexDecodeSet(SpursSpeexTaskOutput *spuTaskOut) -{ - char *inBuffer; - float *speexBuffer; - short *outBuffer; - int rcode; - unsigned int i; - - speexBuffer = (float *)memalign(16, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(float)); - outBuffer = (short *)memalign(16, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(short)); - inBuffer = (char *)memalign(16, gviSpursSpeexTaskDesc.mInputBufferSize); - - memset(speexBuffer, 0, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(float)); - memset(inBuffer, 0, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(short)); - memset(outBuffer, 0, gviSpursSpeexTaskDesc.mInputBufferSize); - - cellDmaGet(inBuffer, (uint64_t)gviSpursSpeexTaskDesc.mInputBuffer, gviSpursSpeexTaskDesc.mInputBufferSize, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - // read the data into the bits - speex_bits_read_from(&gviSpursSpeexBits, (char *)inBuffer, gviSpursSpeexTaskDesc.mEncodedFrameSize); - - // decode it - rcode = speex_decode((void *)gviSpursSpeexStateBuffer, &gviSpursSpeexBits, speexBuffer); - assert(rcode == 0); - - // convert the output from floats - for(i = 0 ; i < gviSpursSpeexTaskDesc.mOutputBufferSize ; i++) - // Expanded to remove warnings in VS2K5 - outBuffer[i] = (short)speexBuffer[i]; - - cellDmaPut(outBuffer, (uint64_t)gviSpursSpeexTaskDesc.mOutputBuffer, gviSpursSpeexTaskDesc.mOutputBufferSize * sizeof(short), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - free(speexBuffer); - free(inBuffer); - free(outBuffer); - spuTaskOut->mSpeexReturnCode = 0; -} - -void procesEncodeInit(unsigned int uiPtr) -{ - SpursSpeexTaskOutput spuOutput; - - //spuDebugPrintf("[Speex][SPU] CMD_SAMPLE_TASK_ENCODE_INIT_COMMAND\n"); - cellDmaGet(&gviSpursSpeexTaskDesc, uiPtr, sizeof(SpursSpeexTaskDesc), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - if (gviSpursSpeexTaskDesc.mDebugPause) - { - snPause(); - } - - gviSpursSpeexEncoderInitialize(&spuOutput); - if (spuOutput.mSpeexReturnCode < 0) - { - spuDebugPrintf("[Speex][SPU] failed to initialize encoder, ret = %d\n", spuOutput.mSpeexReturnCode); - } - - //spuDebugPrintf("[Speex][SPU] done with initializing things for speex, now returning data via DMA put\n"); - - //printGlobalTaskDescData(); - - cellDmaPut(&spuOutput, (uint64_t)gviSpursSpeexTaskDesc.mSpeexTaskOutput, sizeof(SpursSpeexTaskOutput), DMA_TAG(1), - 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] task dma done\n"); - - cellDmaLargePut(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, SPEEX_ENCODER_STATE_BUFFER_SIZE, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] buffer dma done\n"); -} - -void processDecodeInit(unsigned int uiPtr) -{ - SpursSpeexTaskOutput spuOutput; - cellDmaGet(&gviSpursSpeexTaskDesc, uiPtr, sizeof(SpursSpeexTaskDesc), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] CMD_SAMPLE_TASK_DECODE_INIT_COMMAND\n"); - - if (gviSpursSpeexTaskDesc.mDebugPause) - { - snPause(); - } - - gviSpursSpeexDecoderInitialize(&spuOutput); - - if (spuOutput.mSpeexReturnCode < 0) - { - spuDebugPrintf("[Speex][SPU] failed to initialize decoder, ret = %d\n", spuOutput.mSpeexReturnCode); - } - - cellDmaPut(&spuOutput, (uint64_t)gviSpursSpeexTaskDesc.mSpeexTaskOutput, sizeof(SpursSpeexTaskOutput), DMA_TAG(1), - 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - cellDmaLargePut(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, - gviSpursSpeexTaskDesc.mSpeexStateBufferSize, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] buffer dma done\n"); -} - -void processEncode(unsigned int uiPtr) -{ - SpursSpeexTaskOutput spuOutput; - cellDmaGet(&gviSpursSpeexTaskDesc, uiPtr, sizeof(SpursSpeexTaskDesc), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - spuDebugPrintf("[Speex][SPU] CMD_SAMPLE_TASK_ENCODE_COMMAND\n"); - - if (gviSpursSpeexTaskDesc.mDebugPause) - { - snPause(); - } - cellDmaLargeGet(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, SPEEX_ENCODER_STATE_BUFFER_SIZE, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - gviSpursSpeexEncode(&spuOutput); - - if (spuOutput.mSpeexReturnCode < 0) - { - spuDebugPrintf("SPU: failed to encode, ret = %d\n", spuOutput.mSpeexReturnCode); - } - - cellDmaPut(&spuOutput, (uint64_t)gviSpursSpeexTaskDesc.mSpeexTaskOutput, sizeof(SpursSpeexTaskOutput), DMA_TAG(1), - 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - cellDmaLargePut(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, SPEEX_ENCODER_STATE_BUFFER_SIZE, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - spuDebugPrintf("[Speex][SPU] buffer dma done\n"); -} - - -void processDecodeAdd(unsigned int uiPtr) -{ - SpursSpeexTaskOutput spuOutput; - cellDmaGet(&gviSpursSpeexTaskDesc, uiPtr, sizeof(SpursSpeexTaskDesc), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] CMD_SAMPLE_TASK_DECODEADD_COMMAND\n"); - - if (gviSpursSpeexTaskDesc.mDebugPause) - { - snPause(); - } - - cellDmaLargeGet(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, gviSpursSpeexTaskDesc.mSpeexStateBufferSize, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - gviSpursSpeexDecodeAdd(&spuOutput); - - if (spuOutput.mSpeexReturnCode < 0) - { - spuDebugPrintf("SPU: failed to decode, ret = %d\n", spuOutput.mSpeexReturnCode); - } - - cellDmaPut(&spuOutput, (uint64_t)gviSpursSpeexTaskDesc.mSpeexTaskOutput, sizeof(SpursSpeexTaskOutput), DMA_TAG(1), - 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - cellDmaLargePut(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, SPEEX_DECODER_STATE_BUFFER_SIZE, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] done sending back state buffer\n"); -} - -void processDecodeSet(unsigned int uiPtr) -{ - SpursSpeexTaskOutput spuOutput; - cellDmaGet(&gviSpursSpeexTaskDesc, uiPtr, sizeof(SpursSpeexTaskDesc), DMA_TAG(1), 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] CMD_SAMPLE_TASK_DECODESET_COMMAND\n"); - - if (gviSpursSpeexTaskDesc.mDebugPause) - { - snPause(); - } - cellDmaLargeGet(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, SPEEX_DECODER_STATE_BUFFER_SIZE, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - gviSpursSpeexDecodeSet(&spuOutput); - - if (spuOutput.mSpeexReturnCode < 0) - { - spuDebugPrintf("SPU: failed to encode, ret = %d\n", spuOutput.mSpeexReturnCode); - } - - cellDmaPut(&spuOutput, (uint64_t)gviSpursSpeexTaskDesc.mSpeexTaskOutput, sizeof(SpursSpeexTaskOutput), DMA_TAG(1), - 0, 0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - cellDmaLargePut(gviSpursSpeexStateBuffer, (uint64_t)gviSpursSpeexTaskDesc.mSpeexStateBuffer, SPEEX_DECODER_STATE_BUFFER_SIZE, DMA_TAG(1), 0,0); - cellDmaWaitTagStatusAll(DMA_MASK(1)); - - //spuDebugPrintf("[Speex][SPU] buffer dma done\n"); -} - -////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////// -void cellSpursMain(qword argTask, uint64_t argTaskset) -{ - // grab the arguments to extract the command - CellSPURSArgument args={uiQWord : (vec_uint4) argTask}; - - unsigned int uiCommand, uiArg1=0, uiArg2=0; - //int spuId = cellSpursGetCurrentSpuId(); - //int taskId = cellSpursGetTaskId(); - - //spuDebugPrintf("[Speex][SPU] taskid: %d, spuId: %d\n", taskId, spuId); - - // grab the command and arguments to be processed below - uiCommand=args.uiCommand; - uiArg1=args.uiArgument0; - uiArg2=args.uiArgument1; - - uint64_t uiPtr = uiArg1; - - switch(uiCommand) - { - - case SPEEX_TASK_ENCODE_INIT_COMMAND: - { - // cleaner this way - procesEncodeInit(uiPtr); - - sendResponseToPPUAndExit(args.ppuResponseQueue, (uint32_t)uiArg2, 0); - break; - } - - case SPEEX_TASK_ENCODE_COMMAND: - { - processEncode(uiPtr); - sendResponseToPPUAndExit(args.ppuResponseQueue, (uint32_t)uiArg2, 0); - break; - } - - case SPEEX_TASK_DECODE_INIT_COMMAND: - { - processDecodeInit(uiPtr); - sendResponseToPPUAndExit(args.ppuResponseQueue, (uint32_t)uiArg2, 0); - break; - } - case SPEEX_TASK_DECODEADD_COMMAND: - { - processDecodeAdd(uiPtr); - sendResponseToPPUAndExit(args.ppuResponseQueue, (uint32_t)uiArg2, 0); - break; - } - - case SPEEX_TASK_DECODESET_COMMAND: - { - processDecodeSet(uiPtr); - sendResponseToPPUAndExit(args.ppuResponseQueue, (uint32_t)uiArg2, 0); - break; - } - - default: - { - //spuDebugPrintf("SPURS Sample:unknown case in switch uiCommand: %x uiArg1 %x uiArg2 %x\n",uiCommand,uiArg1,uiArg2); - } - - } -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTaskManager_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTaskManager_vs2005.vcproj deleted file mode 100644 index c2503267680..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTaskManager_vs2005.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTaskManager_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTaskManager_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpeexSpursTaskManager_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpuDoubleBuffer.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpuDoubleBuffer.h deleted file mode 100644 index 2a333e237a0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpuDoubleBuffer.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef DOUBLE_BUFFER_H -#define DOUBLE_BUFFER_H - -#include "SpuFakeDma.h" - - -///DoubleBuffer -template -class DoubleBuffer -{ -#ifdef __CELLOS_LV2__ - T m_buffer0[size] __attribute__ ((aligned (128))); - T m_buffer1[size] __attribute__ ((aligned (128))); -#else - T m_buffer0[size]; - T m_buffer1[size]; -#endif - - T *m_frontBuffer; - T *m_backBuffer; - - unsigned int m_dmaTag; - bool m_dmaPending; -public: - bool isPending() const { return m_dmaPending;} - DoubleBuffer(); - - void init (); - - // dma get and put commands - void backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag); - void backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag); - - // gets pointer to a buffer - T *getFront(); - T *getBack(); - - // if back buffer dma was started, wait for it to complete - // then move back to front and vice versa - T *swapBuffers(); -}; - -template -DoubleBuffer::DoubleBuffer() -{ - init (); -} - -template -void DoubleBuffer::init() -{ - this->m_dmaPending = false; - this->m_frontBuffer = &this->m_buffer0[0]; - this->m_backBuffer = &this->m_buffer1[0]; -} - -template -void -DoubleBuffer::backBufferDmaGet(uint64_t ea, unsigned int numBytes, unsigned int tag) -{ - m_dmaPending = true; - m_dmaTag = tag; - cellDmaLargeGet(m_backBuffer, ea, numBytes, tag, 0, 0); -} - -template -void -DoubleBuffer::backBufferDmaPut(uint64_t ea, unsigned int numBytes, unsigned int tag) -{ - m_dmaPending = true; - m_dmaTag = tag; - cellDmaLargePut(m_backBuffer, ea, numBytes, tag, 0, 0); -} - -template -T * -DoubleBuffer::getFront() -{ - return m_frontBuffer; -} - -template -T * -DoubleBuffer::getBack() -{ - return m_backBuffer; -} - -template -T * -DoubleBuffer::swapBuffers() -{ - if (m_dmaPending) - { - cellDmaWaitTagStatusAll(1< -#include - -#define DMA_TAG(xfer) (xfer + 1) -#define DMA_MASK(xfer) (1 << DMA_TAG(xfer)) - -#elif defined (WIN32) - -#define DMA_TAG(a) (a) -#define DMA_MASK(a) (a) - - -/// cellDmaLargeGet Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy) -int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid); -int cellDmaGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid); -/// cellDmaLargePut Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy) -int cellDmaLargePut(const void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid); -/// cellDmaWaitTagStatusAll Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy) -void cellDmaWaitTagStatusAll(int ignore); -#endif //WIN32 - -///stallingUnalignedDmaSmallGet internally uses DMA_TAG(1) -int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size); - -#endif //FAKE_DMA_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpuSpeexTaskOutput.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpuSpeexTaskOutput.h deleted file mode 100644 index 9c0d0a99288..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpuSpeexTaskOutput.h +++ /dev/null @@ -1,33 +0,0 @@ - - -#ifndef __SPEEX_TASK_OUTPUT_H -#define __SPEEX_TASK_OUTPUT_H - -#define POST_ALIGN(x) __attribute__((aligned (x))) - -#ifdef __cplusplus -extern "C" { -#endif - -#define SPEEX_ENCODER_WB_BUFFERSIZE 32256 -#define SPEEX_ENCODER_NB_BUFFERSIZE 32288 -#define SPEEX_ENCODER_STATE_BUFFER_SIZE (SPEEX_ENCODER_NB_BUFFERSIZE + SPEEX_ENCODER_WB_BUFFERSIZE+128) -#define SPEEX_DECODER_NB_BUFFERSIZE 16832 -#define SPEEX_DEOCDER_WB_BUFFERSIZE 24192 -#define SPEEX_DECODER_STATE_BUFFER_SIZE (SPEEX_DECODER_NB_BUFFERSIZE+SPEEX_DEOCDER_WB_BUFFERSIZE+128) -//#define SPEEX_STATE_ - ///pure output, any input is in SpuSampleTaskDesc -struct SpursSpeexTaskOutput -{ - int mSpeexInitialized; - int mSpeexSamplesPerFrame; - int mSpeexEncodedFrameSize; - int mSpeexOutBufferSize; - int mSpeexReturnCode; -} POST_ALIGN(128); - -#ifdef __cplusplus -} -#endif - -#endif //__SPEEX_TASK_OUTPUT_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexCInterface.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexCInterface.cpp deleted file mode 100644 index 47d64db880e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexCInterface.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "spursConfiguration.h" -#include "SpursSpeexCInterface.h" -#include -#include "SpursSpeexTaskManager.h" -#include "spursSupportInterface.h" -#include - -SpursSpeexTaskManager* gSpursSpeexTaskManager = 0; -SpursSupportInterface* gSpursSupport = 0; -const unsigned int MAX_SPURS_SPEEX_TASKS=1; - - -///initialize SPURS -int initializeSpursSampleTask() -{ - gSpursSupport = new SpursSupportInterface(); - - gSpursSpeexTaskManager = new SpursSpeexTaskManager(gSpursSupport,MAX_SPURS_SPEEX_TASKS); - return gSpursSpeexTaskManager->initialize(); -} - -///not finished, need to pass proper data -int issueSampleTaskEncodeInit(int quality, int samplesPerFrame, SpursSpeexTaskOutput *taskOutput, char *userAllocatedSpeexBuffer, int userAllocatedSpeexBufferSize) -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - - return gSpursSpeexTaskManager->issueEncodeInitTask(quality, samplesPerFrame, taskOutput,userAllocatedSpeexBuffer,userAllocatedSpeexBufferSize); - - //printf("issueSampleTaskEncodeInit called\n"); -} - -///submit some work to SPURS -int issueSampleTaskEncode(short* inBuffer, int inBufferSize, int encodedFrameSize, char *outBuffer, int outBufferSize, - struct SpursSpeexTaskOutput *taskOuput, char *userAllocatedSpeexBuffer, int userAllocatedSpeexBufferSize ) -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - - return gSpursSpeexTaskManager->issueEncodeTask(inBuffer, inBufferSize, encodedFrameSize, outBuffer, outBufferSize, taskOuput, - userAllocatedSpeexBuffer,userAllocatedSpeexBufferSize); - - //printf("issueSampleTaskEncode called\n"); -} - -int issueSampleTaskDecodeAdd(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput) -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - - return gSpursSpeexTaskManager->issueDecodeAddTask(decoderStateBuffer, decoderStateBufferSize, inBuffer, inBufferSize, encodedFrameSize, - outBuffer, outBufferSize, taskOutput); - - //printf("issueSampleTaskDecode called\n"); -} - -int issueSampleTaskDecodeSet(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput) -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - - return gSpursSpeexTaskManager->issueDecodeSetTask(decoderStateBuffer, decoderStateBufferSize, inBuffer, inBufferSize, encodedFrameSize, - outBuffer, outBufferSize, taskOutput); - - //printf("issueSampleTaskDecode called\n"); -} - -int issueSampleTaskDecodeInit(char *decoderStateBuffer, int decoderStateBufferSize, int sampleRate, struct SpursSpeexTaskOutput *taskOutput) -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - - return gSpursSpeexTaskManager->issueDecodeInitTask(decoderStateBuffer, decoderStateBufferSize, sampleRate, taskOutput); - - //printf("issueSampleTaskDecode called\n"); -} - - -///wait for the work to be finished -/* -int flushSampleTask() -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - - //printf("flushSampleTask called\n"); -} -*/ - -///shutdown SPURS -int shutdownSpursTask() -{ - btAssert(gSpursSpeexTaskManager!=0); - btAssert(gSpursSupport!=0); - delete gSpursSpeexTaskManager; - delete gSpursSupport; - if (spursConfiguration_terminate() != 0) - return -1; - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexCInterface.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexCInterface.h deleted file mode 100644 index 3785165c1ee..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexCInterface.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef SPU_TASK_C_INTERFACE_H -#define SPU_TASK_C_INTERFACE_H - -//#include -#include "SpuSpeexTaskOutput.h" - -#define PL_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name - -typedef float plReal; -typedef plReal plVector3[3]; -typedef plReal plQuaternion[4]; - -#ifdef __cplusplus -extern "C" { -#endif - -#define GVI_REMAINING_BYTES 3 - - -///initialize SPURS -int initializeSpursSampleTask(); - -///submit some work to SPURS -int issueSampleTaskEncode(short* inBuffer, int inBufferSize, int encodedFrameSize, char *outBuffer, int outBufferSize, - struct SpursSpeexTaskOutput *taskOuput, char *userAllocatedSpeexBuffer, - int userAllocatedSpeexBufferSize); - -///not finished, need to pass proper data -int issueSampleTaskEncodeInit(int quality, int samplesPerFrame, struct SpursSpeexTaskOutput *taskOutput, - char *userAllocatedSpeexBuffer, int userAllocatedSpeexBufferSize); -///not finished, need to pass proper data -int issueSampleTaskDecodeAdd(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput); -int issueSampleTaskDecodeSet(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput); -///not finished, need to pass proper data -int issueSampleTaskDecodeInit(char *decoderStateBuffer, int decoderStateBufferSize, int sampleRate, struct SpursSpeexTaskOutput *taskOutput); - - - - -///wait for the work to be finished -//int flushSampleTask(); - -///shutdown SPURS -int shutdownSpursTask(); - -///used to pass into SPURS - -#ifdef __cplusplus -} -#endif - -#endif //SPU_TASK_C_INTERFACE_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexTaskManager.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexTaskManager.cpp deleted file mode 100644 index 1923db73f7f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexTaskManager.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -//#define __CELLOS_LV2__ 1 - -#define USE_SAMPLE_PROCESS 1 -#ifdef USE_SAMPLE_PROCESS - - -#include "spursThreadSupportInterface.h" - -//#include "SPUAssert.h" -#include - - -#include "SpursSpeexTaskManager.h" - - -#include - - -void SampleThreadFunc(void* userPtr,void* lsMemory) -{ - //do nothing - printf("hello world\n"); -} - -void* SamplelsMemoryFunc() -{ - //don't create local store memory, just return 0 - return 0; -} - - - -extern "C" -{ - extern char SPU_SAMPLE_ELF_SYMBOL[]; -}; - - - - - -SpursSpeexTaskManager::SpursSpeexTaskManager(spursThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks) -:m_threadInterface(threadInterface), -m_maxNumOutstandingTasks(maxNumOutstandingTasks) -{ - - m_taskBusy.resize(m_maxNumOutstandingTasks); - mSpursSpeexTaskDesc.resize(m_maxNumOutstandingTasks); - - for (int i = 0; (unsigned int)i < m_maxNumOutstandingTasks; i++) - { - m_taskBusy[i] = false; - } - m_numBusyTasks = 0; - m_currentTask = 0; - - m_initialized = false; -} - -SpursSpeexTaskManager::~SpursSpeexTaskManager() -{ - m_threadInterface->stopSPU(); -} - - - -int SpursSpeexTaskManager::initialize() -{ -#ifdef DEBUG_SPU_TASK_SCHEDULING - printf("SpuSampleTaskProcess::initialize()\n"); -#endif //DEBUG_SPU_TASK_SCHEDULING - - for (int i = 0; (unsigned int)i < m_maxNumOutstandingTasks; i++) - { - m_taskBusy[i] = false; - } - m_numBusyTasks = 0; - m_currentTask = 0; - m_initialized = true; - - if (m_threadInterface->startSPU() != 0) - { - return -1; - } - return 0; -} - - - -int SpursSpeexTaskManager::issueEncodeInitTask( int theQuality,int theGviSpeexSamplesPerSecond, SpursSpeexTaskOutput *taskOutput, char *userAllocatedSpeexBuffer,int userAllocatedSpeexBufferSize ) -{ - m_taskBusy[m_currentTask] = true; - m_numBusyTasks++; - - SpursSpeexTaskDesc& taskDesc = mSpursSpeexTaskDesc[m_currentTask]; - taskDesc.mSpeexStateBuffer = userAllocatedSpeexBuffer; - taskDesc.mSpeexStateBufferSize = userAllocatedSpeexBufferSize; - - taskDesc.mQuality = theQuality; - taskDesc.mSamplesPerSecond = theGviSpeexSamplesPerSecond; - taskDesc.mSpeexTaskOutput = taskOutput; - if (issueTask(taskDesc,SPEEX_TASK_ENCODE_INIT_COMMAND) != 0) - return -1; - return 0; -} - -int SpursSpeexTaskManager::issueEncodeTask(int16_t * inBuffer, int inBufferSize, int encodedFrameSize, char *outBuffer, - int outBufferSize, SpursSpeexTaskOutput *taskOuput,char *userAllocatedSpeexBuffer, - int userAllocatedSpeexBufferSize ) -{ - m_taskBusy[m_currentTask] = true; - m_numBusyTasks++; - - SpursSpeexTaskDesc& taskDesc = mSpursSpeexTaskDesc[m_currentTask]; - taskDesc.mSpeexStateBuffer = userAllocatedSpeexBuffer; - taskDesc.mSpeexStateBufferSize = userAllocatedSpeexBufferSize; - taskDesc.mEncodedFrameSize = encodedFrameSize; - taskDesc.mInputBuffer = inBuffer; - taskDesc.mInputBufferSize = inBufferSize; - taskDesc.mOutputBuffer = outBuffer; - taskDesc.mOutputBufferSize = outBufferSize; - taskDesc.mSpeexTaskOutput = taskOuput; - if (issueTask(taskDesc,SPEEX_TASK_ENCODE_COMMAND) != 0) - return -1; - return 0; -} - -int SpursSpeexTaskManager::issueDecodeAddTask(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput) -{ - m_taskBusy[m_currentTask] = true; - m_numBusyTasks++; - - SpursSpeexTaskDesc& taskDesc = mSpursSpeexTaskDesc[m_currentTask]; - taskDesc.mSpeexStateBuffer = decoderStateBuffer; - taskDesc.mSpeexStateBufferSize = decoderStateBufferSize; - taskDesc.mEncodedFrameSize = encodedFrameSize; - taskDesc.mInputBuffer = inBuffer; - taskDesc.mInputBufferSize = inBufferSize; - taskDesc.mOutputBuffer = outBuffer; - taskDesc.mOutputBufferSize = outBufferSize; - taskDesc.mSpeexTaskOutput = taskOutput; - if (issueTask(taskDesc,SPEEX_TASK_DECODEADD_COMMAND) != 0) - return -1; - return 0; -} - -int SpursSpeexTaskManager::issueDecodeSetTask(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput ) -{ - m_taskBusy[m_currentTask] = true; - m_numBusyTasks++; - - SpursSpeexTaskDesc& taskDesc = mSpursSpeexTaskDesc[m_currentTask]; - taskDesc.mSpeexStateBuffer = decoderStateBuffer; - taskDesc.mSpeexStateBufferSize = decoderStateBufferSize; - taskDesc.mEncodedFrameSize = encodedFrameSize; - taskDesc.mInputBuffer = inBuffer; - taskDesc.mInputBufferSize = inBufferSize; - taskDesc.mOutputBuffer = outBuffer; - taskDesc.mOutputBufferSize = outBufferSize; - taskDesc.mSpeexTaskOutput = taskOutput; - if (issueTask(taskDesc,SPEEX_TASK_DECODESET_COMMAND) != 0) - return -1; - return 0; -} - -int SpursSpeexTaskManager::issueDecodeInitTask( char *decoderStateBuffer, int decoderStateBufferSize, int sampleRate, struct SpursSpeexTaskOutput *taskOutput ) -{ - m_taskBusy[m_currentTask] = true; - m_numBusyTasks++; - - SpursSpeexTaskDesc& taskDesc = mSpursSpeexTaskDesc[m_currentTask]; - taskDesc.mSpeexStateBuffer = decoderStateBuffer; - taskDesc.mSpeexStateBufferSize = decoderStateBufferSize; - taskDesc.mSamplesPerSecond = sampleRate; - taskDesc.mSpeexTaskOutput = taskOutput; - if (issueTask(taskDesc,SPEEX_TASK_DECODE_INIT_COMMAND) != 0) - return -1; - return 0; -} - - -int SpursSpeexTaskManager::issueTask( SpursSpeexTaskDesc& taskDesc,uint32_t uiCommand ) -{ -#ifdef DEBUG_SPU_TASK_SCHEDULING - printf("SpuSampleTaskProcess::issueTask (m_currentTask= %d\)n", m_currentTask); -#endif //DEBUG_SPU_TASK_SCHEDULING - - //some bookkeeping to recognize finished tasks - taskDesc.mTaskId = m_currentTask; - - if (m_threadInterface->sendRequest(uiCommand, (uint32_t) &taskDesc, m_currentTask) != 0) - { - m_taskBusy[m_currentTask] = false; - m_numBusyTasks--; - return -1; - } - - // if all tasks busy, wait for spu event to clear the task. - if (m_numBusyTasks >= m_maxNumOutstandingTasks) - { - unsigned int taskId; - unsigned int outputSize; - - if (m_threadInterface->waitForResponse(&taskId, &outputSize) != 0) - { - return -2; - } - - //printf("PPU: after issue, received event: %u %d\n", taskId, outputSize); - //postProcess(taskId, outputSize); - m_taskBusy[taskId] = false; - m_numBusyTasks--; - } - - // find new task buffer - for (unsigned int i = 0; i < m_maxNumOutstandingTasks; i++) - { - if (!m_taskBusy[i]) - { - m_currentTask = i; - break; - } - } - return 0; -} - -///Optional PPU-size post processing for each task -// void SpuSampleTaskProcess::postProcess(int taskId, int outputSize) -// { -// -// } - - -int SpursSpeexTaskManager::flush() -{ -#ifdef DEBUG_SPU_TASK_SCHEDULING - printf("\nSpuCollisionTaskProcess::flush()\n"); -#endif //DEBUG_SPU_TASK_SCHEDULING - - // all tasks are issued, wait for all tasks to be complete - while(m_numBusyTasks > 0) - { - // Consolidating SPU code - unsigned int taskId; - unsigned int outputSize; - - if (m_threadInterface->waitForResponse(&taskId, &outputSize) != 0) - return -1; - //printf("PPU: flushing, received event: %u %d\n", taskId, outputSize); - //postProcess(taskId, outputSize); - m_taskBusy[taskId] = false; - m_numBusyTasks--; - } - return 0; -} -#endif //USE_SAMPLE_PROCESS diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexTaskManager.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexTaskManager.h deleted file mode 100644 index 887a5167166..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/SpursSpeexTaskManager.h +++ /dev/null @@ -1,122 +0,0 @@ -// Gamespy Technology -// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef SPU_SAMPLE_TASK_PROCESS_H -#define SPU_SAMPLE_TASK_PROCESS_H - -#include - - -#include "spursPlatformDefinitions.h" - -#include - -#include "spursAlignedObjectArray.h" - -#include "SpuSpeexTaskOutput.h" - -///SpuSampleTaskDesc -struct SpursSpeexTaskDesc -{ - SpursSpeexTaskDesc() - :mDebugPause(false) - { - - } - int mQuality; - int mSamplesPerSecond; - int mEncodedFrameSize; - void *mInputBuffer; // make it - unsigned int mInputBufferSize; - - SpursSpeexTaskOutput *mSpeexTaskOutput; - void *mOutputBuffer; - unsigned int mOutputBufferSize; - - char *mSpeexStateBuffer; - unsigned int mSpeexStateBufferSize; - bool mDebugPause; - - uint16_t mTaskId; - //uint16_t _padding_[3]; //padding to make this multiple of 16 bytes -} POST_ALIGN(128); - -//just add your commands here, try to keep them globally unique for debugging purposes -#define SPEEX_TASK_ENCODE_COMMAND 10 -#define SPEEX_TASK_ENCODE_INIT_COMMAND 11 -#define SPEEX_TASK_DECODEADD_COMMAND 12 -#define SPEEX_TASK_DECODESET_COMMAND 13 -#define SPEEX_TASK_DECODE_INIT_COMMAND 14 - - - -/// SpuSampleTaskProcess handles SPU processing of collision pairs. -/// When PPU issues a task, it will look for completed task buffers -/// PPU will do postprocessing, dependent on workunit output (not likely) -class SpursSpeexTaskManager -{ - // track task buffers that are being used, and total busy tasks - spursAlignedObjectArray m_taskBusy; - spursAlignedObjectArraymSpursSpeexTaskDesc; - - unsigned int m_numBusyTasks; - - // the current task and the current entry to insert a new work unit - unsigned int m_currentTask; - - bool m_initialized; - - //void postProcess(int taskId, int outputSize); - - class spursThreadSupportInterface* m_threadInterface; - - unsigned int m_maxNumOutstandingTasks; - - - int issueTask(SpursSpeexTaskDesc& taskDesc,uint32_t uiCommand); - - -public: - SpursSpeexTaskManager(spursThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks); - - ~SpursSpeexTaskManager(); - - ///call initialize in the beginning of the frame, before addCollisionPairToTask - int initialize(); - - int issueEncodeTask(int16_t * inBuffer, int inBufferSize, int encodedFrameSize, char *outBuffer, int outBufferSize, - SpursSpeexTaskOutput *taskOuput,char *m_userAllocatedSpeexBuffer,int userAllocatedSpeexBufferSize); - - int issueEncodeInitTask(int theQuality,int theGviSpeexSamplesPerSecond, SpursSpeexTaskOutput *taskOutput, char *m_userAllocatedSpeexBuffer, - int userAllocatedSpeexBufferSize); - - int issueDecodeAddTask(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput); - - int issueDecodeSetTask(char *decoderStateBuffer, int decoderStateBufferSize, char *inBuffer, int inBufferSize, int encodedFrameSize, - short* outBuffer, int outBufferSize, struct SpursSpeexTaskOutput *taskOutput); - - int issueDecodeInitTask(char *decoderStateBuffer, int decoderStateBufferSize, int sampleRate, struct SpursSpeexTaskOutput *taskOutput); - - ///call flush to submit potential outstanding work to SPUs and wait for all involved SPUs to be finished - int flush(); -}; - - -#endif // SPU_SAMPLE_TASK_PROCESS_H - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedAllocator.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedAllocator.cpp deleted file mode 100644 index 20221a87fe8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedAllocator.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Gamespy Technology -// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "spursAlignedAllocator.h" - -#include - -int numAllocs = 0; -int numFree = 0; - -void* spursAlignedAlloc (int size, int alignment) -{ - numAllocs++; - return memalign(alignment, size); -} - -void spursAlignedFree (void* ptr) -{ - numFree++; - free(ptr); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedAllocator.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedAllocator.h deleted file mode 100644 index 97f1c7fa91b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedAllocator.h +++ /dev/null @@ -1,81 +0,0 @@ -// Gamespy Technology -// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef BT_ALIGNED_ALLOCATOR -#define BT_ALIGNED_ALLOCATOR - -///we probably replace this with our own aligned memory allocator -///so we replace _aligned_malloc and _aligned_free with our own -///that is better portable and more predictable - -void* spursAlignedAlloc (int size, int alignment); - -void spursAlignedFree (void* ptr); - - -typedef int size_type; - - -template < typename T , unsigned Alignment > -class spursAlignedAllocator { - - typedef spursAlignedAllocator< T , Alignment > self_type; - -public: - - //just going down a list: - spursAlignedAllocator() {} - /* - btAlignedAllocator( const self_type & ) {} - */ - - template < typename Other > - spursAlignedAllocator( const spursAlignedAllocator< Other , Alignment > & ) {} - - typedef const T* const_pointer; - typedef const T& const_reference; - typedef T* pointer; - typedef T& reference; - typedef T value_type; - - pointer address ( reference ref ) const { return &ref; } - const_pointer address ( const_reference ref ) const { return &ref; } - pointer allocate ( size_type n , const_pointer * hint = 0 ) { - (void)hint; - return reinterpret_cast< pointer >(spursAlignedAlloc( sizeof(value_type) * n , Alignment )); - } - void construct ( pointer ptr , const value_type & value ) { new (ptr) value_type( value ); } - void deallocate( pointer ptr ) { - spursAlignedFree( reinterpret_cast< void * >( ptr ) ); - } - void destroy ( pointer ptr ) { ptr->~value_type(); } - - - template < typename O > struct rebind { - typedef spursAlignedAllocator< O , Alignment > other; - }; - template < typename O > - self_type & operator=( const spursAlignedAllocator< O , Alignment > & ) { return *this; } - - friend bool operator==( const self_type & , const self_type & ) { return true; } -}; - - - -#endif //BT_ALIGNED_ALLOCATOR - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedObjectArray.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedObjectArray.h deleted file mode 100644 index af13d3b5ae4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursAlignedObjectArray.h +++ /dev/null @@ -1,370 +0,0 @@ -// Gamespy Technology -// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - -#ifndef BT_OBJECT_ARRAY__ -#define BT_OBJECT_ARRAY__ - -#include "spursScalar.h" // has definitions like SIMD_FORCE_INLINE -#include "spursAlignedAllocator.h" - -///If the platform doesn't support placement new, you can disable BT_USE_PLACEMENT_NEW -///then the btAlignedObjectArray doesn't support objects with virtual methods, and non-trivial constructors/destructors -///You can enable BT_USE_MEMCPY, then swapping elements in the array will use memcpy instead of operator= -///see discussion here: http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1231 and -///http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1240 - -#define BT_USE_PLACEMENT_NEW 1 -//#define BT_USE_MEMCPY 1 //disable, because it is cumbersome to find out for each platform where memcpy is defined. It can be in or or otherwise... - -#ifdef BT_USE_MEMCPY -#include -#include -#endif //BT_USE_MEMCPY - -#ifdef BT_USE_PLACEMENT_NEW -#include //for placement new -#endif //BT_USE_PLACEMENT_NEW - - -///btAlignedObjectArray uses a subset of the stl::vector interface for its methods -///It is developed to replace stl::vector to avoid STL alignment issues to add SIMD/SSE data -template -//template -class spursAlignedObjectArray -{ - spursAlignedAllocator m_allocator; - - int m_size; - int m_capacity; - T* m_data; - - protected: - SIMD_FORCE_INLINE int allocSize(int size) - { - return (size ? size*2 : 1); - } - SIMD_FORCE_INLINE void copy(int start,int end, T* dest) - { - int i; - for (i=start;i size()) - { - reserve(newsize); - } -#ifdef BT_USE_PLACEMENT_NEW - for (int i=curSize;i - void downHeap(T *pArr, int k, int n,L CompareFunc) - { - /* PRE: a[k+1..N] is a heap */ - /* POST: a[k..N] is a heap */ - - T temp = pArr[k - 1]; - /* k has child(s) */ - while (k <= n/2) - { - int child = 2*k; - - if ((child < n) && CompareFunc(pArr[child - 1] , pArr[child])) - { - child++; - } - /* pick larger child */ - if (CompareFunc(temp , pArr[child - 1])) - { - /* move child up */ - pArr[k - 1] = pArr[child - 1]; - k = child; - } - else - { - break; - } - } - pArr[k - 1] = temp; - } /*downHeap*/ - - void swap(int index0,int index1) - { -#ifdef BT_USE_MEMCPY - char temp[sizeof(T)]; - memcpy(temp,&m_data[index0],sizeof(T)); - memcpy(&m_data[index0],&m_data[index1],sizeof(T)); - memcpy(&m_data[index1],temp,sizeof(T)); -#else - T temp = m_data[index0]; - m_data[index0] = m_data[index1]; - m_data[index1] = temp; -#endif //BT_USE_PLACEMENT_NEW - - } - - template - void heapSort(L CompareFunc) - { - /* sort a[0..N-1], N.B. 0 to N-1 */ - int k; - int n = m_size; - for (k = n/2; k > 0; k--) - { - downHeap(m_data, k, n, CompareFunc); - } - - /* a[1..N] is now a heap */ - while ( n>=1 ) - { - swap(0,n-1); /* largest of a[0..n-1] */ - - - n = n - 1; - /* restore a[1..i-1] heap */ - downHeap(m_data, 1, n, CompareFunc); - } - } - - ///non-recursive binary search, assumes sorted array - int findBinarySearch(const T& key) const - { - int first = 0; - int last = size(); - - //assume sorted array - while (first <= last) { - int mid = (first + last) / 2; // compute mid point. - if (key > m_data[mid]) - first = mid + 1; // repeat search in top half. - else if (key < m_data[mid]) - last = mid - 1; // repeat search in bottom half. - else - return mid; // found it. return position ///// - } - return size(); // failed to find key - } - - - int findLinearSearch(const T& key) const - { - int index=size(); - int i; - - for (i=0;i - -#ifdef __cplusplus -extern "C" { -#endif - -#define CELL_SPURS_DEFAULT_SPU_COUNT 1 - -// "-Wl,--whole-archive -lprof_stub -Wl,--no-whole-archive" - -enum CellSpursReturn { - CELL_SPURS_OK=0, - CELL_SPURS_EBUSY, - CELL_SPURS_EINVAL, - CELL_SPURS_EMISC -}; - -/** - * \brief This class controls the SPU usage of SPURS - * - * There are three ways to initialize SPU usage. - * - * The first way is to initialize SPURS yourself, and to pass in a pointer to - * SPURS as well as priorities for the use of the SPUs, using initWithSpurs. - * This is good if you intend to use SPURS elsewhere in your code, the management - * can be shared across all processes. - * - * The second way is to control the number of SPUs used by SPURS with - * initWithSpuCount. Software will create its own instance of SPURS when it needs - * it using that maximum number of SPUs. - * - * If you do neither of the two, Software will create its own instance of SPURS when - * it needs it using CELL_SPURS_DEFAULT_SPU_COUNT SPUs. - * - * terminate() can be used to either detatch from an existing SPURS or to - * terminate the Software-created SPURS. Note that this will only work if all collision - * scenes have been destroyed, otherwise SPURS would still be needed. - * - * Creating a new scene will cause SPURS to re-initialize. - * - * isSpursInitialized can be used to query whether software is currently using SPURS. - * - **/ - -/** - * \brief Initializes SPUs given a pre-configured SPURS. - * \param[in] pSpurs A pointer to SPURS - * \param[in] iSPUCount The number of SPUs - * \param[in] auiPriorities The priorities for the code to use - * \return Return is: - * CELL_SPURS_OK on success - * CELL_SPURS_EBUSY if SPU usage has already been initialized - * CELL_SPURS_EINVAL if the priorities or SPURS pointer is invalid. - */ -int spursConfiguration_initWithSpurs(CellSpurs *pSpurs, int iSPUCount, uint8_t auiPriorities[8]); - -/** - * \brief Sets the number of SPUs to be used by a software-initialized SPURS. - * \param[in] iSPUCount A valid value is in the range 1-6 - * \return Return is: - * CELL_SPURS_OK on success - * CELL_SPURS_EBUSY if SPU usage has already been initialized - * CELL_SPURS_EINVAL if iSPUCount is out of range or if SPURS couldn't be - * initialized to that many SPUs. - */ -int spursConfiguration_initWithSpuCount(int iSPUCount); - -/** - * \brief Terminates (or disconnects from) SPURS. - * \return Return is: - * CELL_SPURS_OK if SPURS terminates ok, or if it was previously terminated/ - * never initialized. - * CELL_SPURS_EBUSY if there are existing Scenes which would need SPURS. - */ -int spursConfiguration_terminate(); - -/** - * \brief Queries whether SPU usage has been initialized. - * \return True if initialized. - */ -bool spursConfiguration_isSpursInitialized(); - -#ifdef __cplusplus -} -#endif - -#endif //__CELL_SPU_CONFIG diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursPlatformDefinitions.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursPlatformDefinitions.h deleted file mode 100644 index 2d00593a308..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursPlatformDefinitions.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef TYPE_DEFINITIONS_H -#define TYPE_DEFINITIONS_H - -////////////////////////////////////////////////////////////////////////// -// Don't need printf in this sample -///Playstation 3 Cell SDK -//#include - -#include -#include -#include //for memcpy - -#endif //TYPE_DEFINITIONS_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursScalar.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursScalar.h deleted file mode 100644 index e766ca342d3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursScalar.h +++ /dev/null @@ -1,172 +0,0 @@ -// Gamespy Technology -// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager - -/* -Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - - - -#ifndef SIMD___SCALAR_H -#define SIMD___SCALAR_H - -#include - -#include -#include -#include - -#define SIMD_FORCE_INLINE inline -#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) -#ifndef assert -#include -#endif -#define btAssert assert -//btFullAssert is optional, slows down a lot -#define btFullAssert(x) - -////////////////////////////////////////////////////////////////////////// -// removed since only ps3 used -/* -/// older compilers (gcc 3.x) and Sun needs double version of sqrt etc. -/// exclude Apple Intel (i's assumed to be a Macbook or new Intel Dual Core Processor) -#if defined (__sun) || defined (__sun__) || defined (__sparc) || (defined (__APPLE__) && ! defined (__i386__)) -//use slow double float precision operation on those platforms -#ifndef BT_USE_DOUBLE_PRECISION -#define BT_FORCE_DOUBLE_FUNCTIONS -#endif -#endif -*/ - -////////////////////////////////////////////////////////////////////////// -// removed since only ps3 used -/* -#if defined(BT_USE_DOUBLE_PRECISION) -typedef double btScalar; -#else -typedef float btScalar; -#endif -*/ - -////////////////////////////////////////////////////////////////////////// -// removed since not needed -/* -#if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS) - -SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrt(x); } -SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); } -SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { return acos(x); } -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { return asin(x); } -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x, y); } -SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); } -SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); } -SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); } - -#else - -SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrtf(x); } -SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); } -SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { return acosf(x); } -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { return asinf(x); } -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); } -SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); } -SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); } -SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); } - -#endif -*/ - - -////////////////////////////////////////////////////////////////////////// -// removed since not necessary -/* -#define SIMD_2_PI btScalar(6.283185307179586232) -#define SIMD_PI (SIMD_2_PI * btScalar(0.5)) -#define SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25)) -#define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) -#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) - -#ifdef BT_USE_DOUBLE_PRECISION -#define SIMD_EPSILON DBL_EPSILON -#define SIMD_INFINITY DBL_MAX -#else -#define SIMD_EPSILON FLT_EPSILON -#define SIMD_INFINITY FLT_MAX -#endif - -SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x) -{ - btScalar coeff_1 = SIMD_PI / 4.0f; - btScalar coeff_2 = 3.0f * coeff_1; - btScalar abs_y = btFabs(y); - btScalar angle; - if (x >= 0.0f) { - btScalar r = (x - abs_y) / (x + abs_y); - angle = coeff_1 - coeff_1 * r; - } else { - btScalar r = (x + abs_y) / (abs_y - x); - angle = coeff_2 - coeff_1 * r; - } - return (y < 0.0f) ? -angle : angle; -} - -SIMD_FORCE_INLINE bool btFuzzyZero(btScalar x) { return btFabs(x) < SIMD_EPSILON; } - -SIMD_FORCE_INLINE bool btEqual(btScalar a, btScalar eps) { - return (((a) <= eps) && !((a) < -eps)); -} -SIMD_FORCE_INLINE bool btGreaterEqual (btScalar a, btScalar eps) { - return (!((a) <= eps)); -} -*/ - -/*SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { return acosf(x); } -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { return asinf(x); } -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); } -*/ - - -////////////////////////////////////////////////////////////////////////// -// removed since not necessary -/* -SIMD_FORCE_INLINE int btIsNegative(btScalar x) { - return x < btScalar(0.0) ? 1 : 0; -} - -SIMD_FORCE_INLINE btScalar btRadians(btScalar x) { return x * SIMD_RADS_PER_DEG; } -SIMD_FORCE_INLINE btScalar btDegrees(btScalar x) { return x * SIMD_DEGS_PER_RAD; } - -#define BT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name - -#ifndef btFsel -SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c) -{ - return a >= 0 ? b : c; -} -#endif -#define btFsels(a,b,c) (btScalar)btFsel(a,b,c) -*/ - -#endif //SIMD___SCALAR_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursSupportInterface.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursSupportInterface.cpp deleted file mode 100644 index 4b7a42759ff..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursSupportInterface.cpp +++ /dev/null @@ -1,553 +0,0 @@ -#include "spursConfiguration.h" -#include "spursSupportInterface.h" -#include -#include -#include -#include -#include -#include -#include - -#define SCE_EXTERNAL_RELEASE - -// for CELL_FS_MAX_FS_PATH_LENGTH -#include - -static uint32_t _g_uiNextEventQueueKey=0x92400ABDUL; -uint32_t _SpursSupportGetUniqueEventQueueKey() { - return _g_uiNextEventQueueKey++; -} - -sys_event_queue_t _g_SpuPrintfEventQueue; -sys_ppu_thread_t _g_SpursPrintfThread; - -void _SpursPrintfThreadMain(uint64_t arg); - -#define SPURS_PPU_THREAD_PRIO 1001 -#define SPU_PRINTF_EVENT_QUEUE_SIZE 8 -#define SPU_PRINTF_EVENT_QUEUE_PORT 0x1 -#define SPU_PRINTF_THREAD_PRIO 1001 -#define SPU_PRINTF_THREAD_STACK_SIZE (64 * 1024) - -/* -typedef struct BulletSpursElf { - const char *pcElfName; - void *pvElfImage; -} BulletSpursElf; -*/ - -#ifdef _DEBUG -extern char _binary_spu_SpeexSpursTaskDebug_elf_start[]; -void *g_SpursTaskElfStart = _binary_spu_SpeexSpursTaskDebug_elf_start; -#else -extern char _binary_spu_SpeexSpursTaskRelease_elf_start[]; -void *g_SpursTaskElfStart = _binary_spu_SpeexSpursTaskRelease_elf_start; -#endif //#ifdef _DEBUG - - -/* -BulletSpursElf _g_aSPURSElfs[]={ -#ifdef _DEBUG - {"test.elf", _binary_spu_PS3_SPURS_SpeexDebug_elf_start} -#else - {"test.elf", _binary_spu_PS3_SPURS_SpeexRelease_elf_start} -#endif -}; -*/ - -/* -#ifndef SCE_EXTERNAL_RELEASE -// Here's the search path for the SPURS programs: -char *_g_apcSPURSELFSearchPaths[]={ - "/app_home/", - "/app_home/../../lib/", // works with samples - "/app_home/../../../lib/", // works with tutorials - "/app_home/../../../../lib/", - "/app_home/../../../../../lib/", -}; -unsigned int _g_uiSPURSELFSearchPathCount=sizeof(_g_apcSPURSELFSearchPaths)/sizeof(char *); -#endif // SCE_EXTERNAL_RELEASE -*/ - -// E The priority for the SPU thread group used by SPURS -#define SPURS_SPU_THREAD_PRIORITY 200 - -static CellSpurs *g_spursInstance=0; -static CellSpursTaskset g_spursTaskSet __attribute__ ((aligned(128))); - -static int g_iDefaultSPUCount=CELL_SPURS_DEFAULT_SPU_COUNT; -static bool g_bSpursInitialized=false; -static bool g_bUserSpursGiven=false; -static uint32_t g_uiSpursReferenceCounter=0; - -/** - * E This is the main function of the spu_printf service thread. - * It listens for messages and calls the printf handler when it gets them, - * then notifies the SPU of completion by using a mailbox. - */ -//UPDATE: this function is not currently being used in the speex task or spurs manager -void _SpursPrintfThreadMain(uint64_t arg) -{ - sys_event_t event; - int iReturn; - - // E For unused parameter warnings - (void) arg; - - while (1) { - iReturn=sys_event_queue_receive(_g_SpuPrintfEventQueue, &event, - SYS_NO_TIMEOUT); - - if (iReturn!=CELL_OK) { - fprintf(stderr, "Event queue receive wasn't successful: %i\n", - iReturn); - exit(-1); - } - - iReturn=spu_thread_printf(event.data1, event.data3); - sys_spu_thread_write_spu_mb(event.data1, iReturn); - } -} - -/* -void *loadBulletImage(const char *pcFilename) { - void *pvElf; - FILE *pfInputFile=fopen(pcFilename, "rb"); - uint64_t uiFileSize; - - if (!pfInputFile) { - return 0; - } - - fseek(pfInputFile, 0, SEEK_END); - uiFileSize=ftell(pfInputFile); - fseek(pfInputFile, 0, SEEK_SET); - pvElf=memalign(128, uiFileSize); - - if (!pvElf) { - printf("Cannot allocate memory for file %s\n", pcFilename); - fclose(pfInputFile); - return 0; - } - - fread(pvElf, 1, uiFileSize, pfInputFile); - fclose(pfInputFile); - - return pvElf; -} - -void unloadBulletSpursElfs() { -#ifdef SCE_EXTERNAL_RELEASE - return; -#endif - - for (int iELF=0; iELF6) - { - return CELL_SPURS_EINVAL; - } - - return initializeSpursTaskSet(pSpurs, iSPUCount, auiPriorities); -} - -/** - * Sets the number of SPUs to be used by a Bullet-initialized SPURS. - * Valid iSPUCount is in the range 1-6. - * Return is: - * CELL_SPURS_OK on success - * CELL_SPURS_EBUSY if SPU usage has already been initialized - * CELL_SPURS_EINVAL if iSPUCount is out of range or if SPURS couldn't be - * initialized to that many SPUs. - */ -int spursConfiguration_initWithSpuCount(int iSPUCount) -{ - if (g_bSpursInitialized) - { - return CELL_SPURS_EBUSY; - } - - if (iSPUCount<1 || iSPUCount>6) - { - return CELL_SPURS_EINVAL; - } - - return initializeSpursTaskSet(0, iSPUCount, 0); -} - -/** - * Terminates (or disconnects from) SPURS. - * Return is: - * CELL_SPURS_OK if SPURS terminates ok, or if it was previously terminated/ - * never initialized. - * CELL_SPURS_EBUSY if there are existing Scenes which would need SPURS. - */ -int spursConfiguration_terminate() -{ - if (!g_bSpursInitialized) - { - return CELL_SPURS_OK; - } - - if (g_uiSpursReferenceCounter) - { - return CELL_SPURS_EBUSY; - } - int iReturn; - bool bUserSpurs=g_bUserSpursGiven; - - g_bSpursInitialized=false; - g_bUserSpursGiven=false; - - iReturn=cellSpursShutdownTaskset(&g_spursTaskSet); - if (iReturn!=CELL_OK) - { - return -1; - //fprintf(stderr, "Bullet: Error shutting down SPURS task set: %i\n", iReturn); - } - - iReturn=cellSpursJoinTaskset(&g_spursTaskSet); - if (iReturn!=CELL_OK) - { - return -2; - //fprintf(stderr, "Bullet: Error joining SPURS task set: %i\n", iReturn); - } - - if (!bUserSpurs) - { - int iReturn=cellSpursFinalize(g_spursInstance); - - if (iReturn!=CELL_OK) - { - return -3; - //fprintf(stderr, "Bullet: Error shutting down SPURS: %d\n", iReturn); - } - - free(g_spursInstance); - } - - g_spursInstance=0; - - // Not loading SPURS task from file anymore - //unloadBulletSpursElfs(); -// printf code is commented out for the time being -//#warning TODO: Clean up SPU printf thread. - - return CELL_SPURS_OK; -} - -/** - * Queries whether SPU usage has been initialized. - * Return is: - * true if initialized. - */ -bool spursConfiguration_isSpursInitialized() -{ - return g_bSpursInitialized; -} - - -SpursSupportInterface::SpursSupportInterface() -{ - //assert(elfId < SPU_ELF_LAST); - //m_elfId=elfId; - m_bQueueInitialized=false; - - cellAtomicIncr32(&g_uiSpursReferenceCounter); -} - -SpursSupportInterface::~SpursSupportInterface() -{ - stopSPU(); - - cellAtomicDecr32(&g_uiSpursReferenceCounter); -} - -int SpursSupportInterface::startSPU() -{ - int iReturn; - - if (!m_bQueueInitialized) - { - if (checkSpursTaskSet() != CELL_SPURS_OK) - { - return -1; - } - - iReturn=cellSpursQueueInitialize(&g_spursTaskSet, - &m_responseQueue, m_aResponseBuffer, sizeof(CellSPURSArgument), - CELL_SPURS_RESPONSE_QUEUE_SIZE, CELL_SPURS_QUEUE_SPU2PPU); - if (iReturn!=CELL_OK) - { - return -2; - } - - iReturn=cellSpursQueueAttachLv2EventQueue(&m_responseQueue); - if (iReturn!=CELL_OK) - { - return -3; - } - - m_bQueueInitialized=true; - } - return 0; -} - -int SpursSupportInterface::stopSPU() -{ - if (m_bQueueInitialized) - { - int iReturn=cellSpursQueueDetachLv2EventQueue(&m_responseQueue); - if (iReturn != CELL_OK) - return -1; - m_bQueueInitialized=false; - } - return 0; -} - -int SpursSupportInterface::sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1) -{ - int iReturn; - CellSpursTaskId taskId; - CellSPURSArgument arguments; - - arguments.ppuResponseQueue=&m_responseQueue; - arguments.uiCommand=uiCommand; - arguments.uiArgument0=uiArgument0; - arguments.uiArgument1=uiArgument1; - - if (checkSpursTaskSet() != CELL_SPURS_OK) - { - return -1; - } - - iReturn=cellSpursCreateTask(&g_spursTaskSet, &taskId, g_SpursTaskElfStart, NULL, 0, 0, &arguments.spursArgument); - if (iReturn!=CELL_OK) - { - return -2; - } - - return 0; -} - - -/** - * Wait for the SPU to send an event back to our event queue. - */ -int SpursSupportInterface::waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) -{ - CellSPURSArgument response __attribute__((aligned(16))); - int iReturn; - - iReturn=cellSpursQueuePop(&m_responseQueue, (void *) &response); - - if (iReturn!=CELL_OK) - { - return -1; - } - - if (puiArgument0) - *puiArgument0=response.uiArgument0; - - if (puiArgument1) - *puiArgument1=response.uiArgument1; - return 0; -} - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursSupportInterface.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursSupportInterface.h deleted file mode 100644 index a71f146133f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursSupportInterface.h +++ /dev/null @@ -1,133 +0,0 @@ -/* [SCE CONFIDENTIAL DOCUMENT] - * PLAYSTATION(R)3 SPU Optimized Bullet Physics Library (http://bulletphysics.com) - * Copyright (C) 2007 Sony Computer Entertainment Inc. - * All Rights Reserved. - */ - - -#ifndef __SPURS_SUPPORT_INTERFACE_H -#define __SPURS_SUPPORT_INTERFACE_H - -#include -#include "spursUtilityMacros.h" -#include "spursThreadSupportInterface.h" - -#ifdef __SPU__ -#include - -#include - -#if CELL_SDK_VERSION < 0x081000 -#define CELL_SPURS_TASK_ERROR_AGAIN CELL_SPURS_EAGAIN -#define CELL_SPURS_TASK_ERROR_BUSY CELL_SPURS_EBUSY -#endif // CELL_SDK_VERSION < 0x081000 - -#else // __SPU__ -#include - -#endif // __SPU__ - -#define CELL_SPURS_RESPONSE_QUEUE_SIZE 128 - -/** - * Note: - * The order of elements in this enum are important, that's why each one is explicitly - * given a value. They will correspond to the .elf names/addresses that will be - * loaded into SPURS. - * Mixing up these values will cause the wrong code to execute, for instance, the - * solver may be asked to do a collision detection job. - */ -////////////////////////////////////////////////////////////////////////// -// only one type of SPURS Task ELF -// typedef enum { -// // SPU_ELF_MID_PHASE=0, -// // SPU_ELF_SOLVER, -// SPU_ELF_SPEEX, -// SPU_ELF_LAST, -// } CellSpursElfId_t; - -typedef union CellSPURSArgument -{ - struct - { - CELL_PPU_POINTER(CellSpursQueue) ppuResponseQueue; - uint32_t uiCommand; - uint32_t uiArgument0; - uint32_t uiArgument1; - }; - -#if __PPU__ - CellSpursTaskArgument spursArgument; -#elif __SPU__ - vec_uint4 uiQWord; -#endif -} CellSPURSArgument __attribute__((aligned(16))); - -#if __SPU__ -#include "SPUAssert.h" -#include - -static inline void sendResponseToPPU(uint32_t ppuQueueEA, uint32_t uiArgument0, - uint32_t uiArgument1, int iTag=1) { - CellSPURSArgument response - __attribute__ ((aligned(16))); - - response.uiArgument0=uiArgument0; - response.uiArgument1=uiArgument1; - - int iReturn; - do { - iReturn=cellSpursQueueTryPushBegin(ppuQueueEA, &response, iTag); - } while (iReturn == CELL_SPURS_TASK_ERROR_AGAIN || - iReturn == CELL_SPURS_TASK_ERROR_BUSY); - - SPU_ASSERT((iReturn == CELL_OK) && "Error writing to SPURS queue."); - - cellSpursQueuePushEnd(ppuQueueEA, iTag); - -} - -static inline void sendResponseToPPUAndExit(uint32_t ppuQueueEA, uint32_t uiArgument0, - uint32_t uiArgument1, int iTag=1) { - CellSPURSArgument response - __attribute__ ((aligned(16))); - - response.uiArgument0=uiArgument0; - response.uiArgument1=uiArgument1; - - int iReturn; - do { - iReturn=cellSpursQueueTryPushBegin(ppuQueueEA, &response, iTag); - } while (iReturn == CELL_SPURS_TASK_ERROR_AGAIN || - iReturn == CELL_SPURS_TASK_ERROR_BUSY); - - SPU_ASSERT((iReturn == CELL_OK) && "Error writing to SPURS queue."); - - cellSpursQueuePushEnd(ppuQueueEA, iTag); - - cellSpursExit(); -} -#elif __PPU__ // not __SPU__ - -class SpursSupportInterface : public spursThreadSupportInterface -{ -public: - SpursSupportInterface(); - ~SpursSupportInterface(); - int sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1=0); - int waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1); - int startSPU(); - int stopSPU(); - -protected: - //CellSpursElfId_t m_elfId; - void *m_spursTaskAddress; - CellSpursQueue m_responseQueue __attribute__((aligned(128))); - CellSPURSArgument m_aResponseBuffer[CELL_SPURS_RESPONSE_QUEUE_SIZE] __attribute__((aligned(16))); - - bool m_bQueueInitialized; -}; -#endif // __SPU__ / __PPU__ - - -#endif // CELL_SPURS_SUPPORT_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursThreadSupportInterface.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursThreadSupportInterface.cpp deleted file mode 100644 index 411b57d93f8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursThreadSupportInterface.cpp +++ /dev/null @@ -1,21 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "spursThreadSupportInterface.h" - -spursThreadSupportInterface::~spursThreadSupportInterface() -{ - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursUtilityMacros.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursUtilityMacros.h deleted file mode 100644 index 3e348517b01..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursUtilityMacros.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __CELL_UTILITY_MACROS_H -#define __CELL_UTILITY_MACROS_H - -// This type pretends to be a pointer to a type on the PPU, and -// just an unsigned int on the SPU. -#ifndef CELL_PPU_POINTER -#define CELL_PPU_PTR_TYPE uint32_t - -#ifdef __SPU__ -#define CELL_PPU_POINTER(x) CELL_PPU_PTR_TYPE -#else // __SPU__ -#define CELL_PPU_POINTER(x) x * - -// Hope we never switch away from 32 bits... -// But this is here just in case... -//NX_COMPILE_TIME_ASSERT(sizeof(void *)==sizeof(CELL_PPU_PTR_TYPE)); -#endif // __SPU__ -#endif // CELL_PPU_POINTER - -#endif -// end __CELL_UTILITY_MACROS_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursthreadsupportinterface.h b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursthreadsupportinterface.h deleted file mode 100644 index a9a1627e564..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/SpeexSpursTaskManager/spursthreadsupportinterface.h +++ /dev/null @@ -1,43 +0,0 @@ -// Gamespy Technology -// NOTE: this code has been provided by Sony for usage in Speex SPURS Manager - -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef THREAD_SUPPORT_INTERFACE_H -#define THREAD_SUPPORT_INTERFACE_H - -#include "spursPlatformDefinitions.h" - -class spursThreadSupportInterface -{ -public: - - virtual ~spursThreadSupportInterface(); - -///send messages to SPUs - virtual int sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1) =0; - -///check for messages from SPUs - virtual int waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0; - -///start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded) - virtual int startSPU() =0; - -///tell the task scheduler we are done with the SPU tasks - virtual int stopSPU()=0; -}; - -#endif //THREAD_SUPPORT_INTERFACE_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/gsSocketPS3.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/gsSocketPS3.c deleted file mode 100644 index 45345c0e129..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/gsSocketPS3.c +++ /dev/null @@ -1,43 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" -#include "../gsPlatformSocket.h" -#include - - - -// ToDo: Move this to PS3 implemenation -HOSTENT * getlocalhost(void) -{ // Global storage - - #define MAX_IPS 10 - static HOSTENT localhost; - static char * aliases = NULL; - static char * ipPtrs[MAX_IPS + 1]; - static unsigned int ips [MAX_IPS]; - int r; - union CellNetCtlInfo gCellNetInfo; - // Todo: support mutliple ip's. - - // initialize the host - localhost.h_name = "localhost"; - localhost.h_aliases = &aliases; - localhost.h_addrtype = AF_INET; - localhost.h_length = sizeof(unsigned int); - localhost.h_addr_list = ipPtrs; - ipPtrs[0] = (char *)&ips[0]; - ipPtrs[1] = NULL; - - // to do, cache this, and do this once at init. - r = cellNetCtlGetInfo( CELL_NET_CTL_INFO_IP_ADDRESS,&gCellNetInfo ); - if (r == CELL_OK) - { - ips[0] = inet_addr(gCellNetInfo.ip_address); - - - return &localhost; - } - else - return NULL; - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/gsUtilPS3.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/gsUtilPS3.c deleted file mode 100644 index 3f556313baf..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/gsUtilPS3.c +++ /dev/null @@ -1,76 +0,0 @@ -#if defined(_PS3) - -#include -#include -#include -#include - -#include "../gsCommon.h" - -// This needs to be set during interface start -extern int gNetInterfaceID; - -#if defined(_PS3) && defined(UNIQUEID) - static const char * GetMAC(void) - { - // Get the MAC address using the interface control - static union CellNetCtlInfo gCellNetInfo; - int r; - // Get MAC - // to do, cache this, and do this once at init. - r = cellNetCtlGetInfo( CELL_NET_CTL_INFO_ETHER_ADDR,&gCellNetInfo ); - if (r == CELL_OK) - { - - return (const char *)&gCellNetInfo.ether_addr; - }// else error - return NULL; - } - - static const char * GOAGetUniqueID_Internal(void) - { - static char keyval[17]; - const char * MAC; - - // check if we already have the Unique ID - if(keyval[0]) - return keyval; - - // get the MAC - MAC = GetMAC(); - if(!MAC) - { - // error getting the MAC - static char errorMAC[6] = { 1, 2, 3, 4, 5, 6 }; - MAC = errorMAC; - } - - // format it - sprintf(keyval, "%02X%02X%02X%02X%02X%02X0000", - MAC[0] & 0xFF, - MAC[1] & 0xFF, - MAC[2] & 0xFF, - MAC[3] & 0xFF, - MAC[4] & 0xFF, - MAC[5] & 0xFF); - - return keyval; - } -#endif - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return atoll(theNumberStr); -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%lld", theNumber); -} -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // _PS3 only diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/ps3common.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/ps3common.c deleted file mode 100644 index 04057e07505..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/ps3/ps3common.c +++ /dev/null @@ -1,248 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Common code for GameSpy samples -// Note: This code is not intended to be used in a retail program -// -// Portions taken from PS3 sample applications. Please refer to Sony -// documentation and samples for application startup procedures. -#include -#include -#include -#include - -#include "../gsPlatform.h" -#include "../gsPlatformUtil.h" -#include "../gsMemory.h" -// entry point for GameSpy samples -extern int test_main(int argc, char ** argp); - -#define PRIO (1001) -#define HOST_NAME "localhost" - - -// * added due to PS3 SDK 092.00x and above - all stub libraries require you to load the module -// * for it to be properly linked -gsi_bool _LoadModules() -{ - cellSysmoduleInitialize(); - - if (cellSysmoduleLoadModule(CELL_SYSMODULE_NET) != CELL_OK) - { - printf("cellSysmoduleLoadModule(CELL_SYSMODULE_NET) failed\n"); - return gsi_false; - } - if (cellSysmoduleLoadModule(CELL_SYSMODULE_IO) != CELL_OK) - { - printf("cellSysmoduleLoadModule(CELL_SYSMODULE_IO) failed\n"); - return gsi_false; - } - if (cellSysmoduleLoadModule(CELL_SYSMODULE_USBD) != CELL_OK) - { - printf("cellSysmoduleLoadModule(CELL_SYSMODULE_USBD) failed\n"); - return gsi_false; - } - if (cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP) != CELL_OK) - { - printf("cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP) failed\n"); - return gsi_false; - } - if (cellSysmoduleLoadModule(CELL_SYSMODULE_RTC) != CELL_OK) - { - printf("cellSysmoduleLoadModule(CELL_SYSMODULE_RTC) failed\n"); - return gsi_false; - } - - return gsi_true; -} - -// unloads modules to free up memory -void _UnloadModules() -{ - cellSysmoduleUnloadModule(CELL_SYSMODULE_NET); - cellSysmoduleUnloadModule(CELL_SYSMODULE_IO); - cellSysmoduleUnloadModule(CELL_SYSMODULE_USBD); - cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_NP); - cellSysmoduleUnloadModule(CELL_SYSMODULE_RTC); - - cellSysmoduleFinalize(); -} - - -gsi_bool _NetworkInit() -{ - int r = sys_net_initialize_network(); - - if (r!=CELL_OK) - { - printf("ccNetworkInitializeNetwork: sys_net_initialize_network() failed: %i\n",r); - return gsi_false; - } - - - return (r==0); -} - - - -gsi_bool _NetworkStart() -{ - int iReturn, iNetworkState; - - /*iReturn = cellSysutilInit(); - if (iReturn < 0) - { - printf("cellSysutilInit() failed(%x)\n", iReturn); - return gsi_false; - }*/ - - iReturn = cellNetCtlInit(); - if (iReturn!=CELL_OK) - { - printf("ccNetworkInitializeNetwork: cellNetCtlInit() failed: %i\n", - iReturn); - return gsi_false; - } - - - while (1) - { - iReturn=cellNetCtlGetState(&iNetworkState); - - - if (iReturn!=CELL_OK) - { - printf("ccNetworkInitializeNetwork: cellNetCtlGetState() failed: %i\n", - iReturn); - return gsi_false; - } - - if (iNetworkState!=CELL_NET_CTL_STATE_IPObtained) - { - sys_timer_usleep(100 * 1000); - } - else - { - break; - } - }; - - return gsi_true; -} - -void _NetworkStop() -{ - cellNetCtlTerm(); - //cellSysutilShutdown(); -} - -void _NetworkClose() -{ - sys_net_finalize_network(); -} - -void * gsiMemManagedInit() -{ - // Init the GSI memory manager (optional - for limiting GSI mem usage) -#if defined GSI_MEM_MANAGED -#define aMemoryPoolSize (1024*1024*8) - char *aMemoryPool = calloc(aMemoryPoolSize,32); - if(aMemoryPool == NULL) - { - printf("Failed to create memory pool - aborting\r\n"); - return NULL; - } - else - { - gsMemMgrContext c = gsMemMgrCreate(gsMemMgrContext_Default, "Default",aMemoryPool, aMemoryPoolSize); - GSI_UNUSED(c); - } - return aMemoryPool; -#else - return NULL; -#endif - -} - -void gsiMemManagedClose(void * aMemoryPool) -{ -#if defined(GSI_MEM_MANAGED) - // Optional - Dump memory leaks - - gsi_u32 MemAvail = gsMemMgrMemAvailGet (gsMemMgrContext_Default); - gsi_u32 MemUsed = gsMemMgrMemUsedGet (gsMemMgrContext_Default); - gsi_u32 HwMark = gsMemMgrMemHighwaterMarkGet (gsMemMgrContext_Default); - - printf("MemAvail %u: MemUsed%u MemHWMark %u\n", MemAvail,MemUsed,HwMark); - gsMemMgrDumpStats(); - gsMemMgrDumpAllocations(); - gsMemMgrValidateMemoryPool(); - gsMemMgrDestroy(gsMemMgrContext_Default); - free(aMemoryPool); -#endif -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int main(int argc, char ** argp) -{ - //sys_pid_t pid = 0; - //int result = 0; - //int count = 0; - //int id_list[10]; - //int i=0; - void *heap; - printf("\nGameSpy Test App Initializing\n" - "----------------------------------\n"); -/* - // spawn IO module - if (sys_process_spawn(&pid, "brio.elf", NULL, 0, PRIO, 0) != SUCCEEDED) { - printf("sys_process_spawn(brio.elf) failed\n"); - return (0); - } -*/ - - // load required modules - if(!_LoadModules()) - { - printf("_LoadModules() failed\n"); - return (0); - } - - // initialize network using hardcoded settings above - if(!_NetworkInit()) - { - printf("_NetworkInit() failed\n"); - return (0); - } - - if(!_NetworkStart()) - { - printf("_NetworkStart() failed\n"); - return (0); - } - - heap = gsiMemManagedInit(); - // start the actual program - printf("\nGameSpy Test App Starting\n" - "----------------------------------\n"); - test_main(argc, argp); - - // do any needed cleanup - printf("\nGameSpy Test App Exiting\n" - "----------------------------------\n"); - gsiMemManagedClose(heap); - // close network - _NetworkStop(); - _NetworkClose(); - - // unload modules - _UnloadModules(); - - // don't exit into never never land and lose our tty output. - while(1) - { - msleep(100); - } - return 0; -} - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/Makefile.common b/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/Makefile.common deleted file mode 100644 index cf95bd08e9c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/Makefile.common +++ /dev/null @@ -1,48 +0,0 @@ -#GameSpy.net PSP Makefile -#Included from sample-specific Makefiles - -DEVKIT_TOP = /usr/local/psp/devkit -INCDIR = $(DEVKIT_TOP)/include -PLATFORMDEF = _PSP -AS = psp-gcc -CC = psp-gcc -LD = psp-ld - -DBGFLAG = -g -OPTFLAG = -O2 -CFLAGS = -W -Wall $(DBGFLAG) $(OPTFLAG) -D$(PLATFORMDEF) -I$(INCDIR) $(SDK_CFLAGS) -ASFLAGS = $(DBGFLAG) -LDFLAGS = $(DBGFLAG) -LDLIBS = -lgum -lgu -lm -LIB = \ - $(DEVKIT_TOP)/lib/wlan_stub.a \ - $(DEVKIT_TOP)/lib/rtc_stub.a \ - $(DEVKIT_TOP)/lib/pspnet_stub_weak.a \ - $(DEVKIT_TOP)/lib/pspnet_inet_stub_weak.a \ - $(DEVKIT_TOP)/lib/pspnet_resolver_stub_weak.a \ - $(DEVKIT_TOP)/lib/pspnet_apctl_stub_weak.a \ - $(DEVKIT_TOP)/lib/pspnet_ap_dialog_dummy_stub_weak.a - -.SUFFIXES: .c .s - -all: $(TARGET).prx $(TARGET).elf - -clean: - rm -f $(TARGET).prx $(TARGET).elf $(OBJS) *.o *~ *.bak - -$(TARGET).prx: $(OBJS) - $(LINK.c) $^ $(LDLIBS) $(LIB) -startfiles -o $@ - -$(TARGET).elf: $(OBJS) - $(LINK.c) $^ $(LDLIBS) $(LIB) -zgenelf -o $@ - -.s.o: - $(AS) $(ASFLAGS) -I$(INCDIR) -o $@ $< > $*.lst - -.c.o: - $(CC) $(CFLAGS) -D$(PLATFORMDEF) -I$(INCDIR) -c $< -o $*.o > $*.lst - -#----------- rules -------------- --include PathDefs -PathDefs: - psp-path-setup > PathDefs || (rm -f PathDefs ; exit 1) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/gsSocketPSP.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/gsSocketPSP.c deleted file mode 100644 index bbde4ca8695..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/gsSocketPSP.c +++ /dev/null @@ -1,350 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../gsCommon.h" -#include "../gsPlatformSocket.h" - - -#if(0) // enable after remove from platform socket -int SetSockBlocking(SOCKET sock, int isblocking) -{ - int rcode; - unsigned long argp; - - if(isblocking) - argp = 0; - else - argp = 1; - - rcode = setsockopt(sock, SCE_NET_INET_SOL_SOCKET, SCE_NET_INET_SO_NBIO, &argp, sizeof(argp)); - - if(rcode == 0) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "SetSockBlocking: Set socket %d to %s\r\n", (unsigned int)sock, isblocking ? "blocking":"non-blocking"); - return 1; - } - - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Comment, - "SetSockBlocking failed: tried to set socket %d to %s\r\n", (unsigned int)sock, isblocking ? "blocking":"non-blocking"); - return 0; -} -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define MAX_IPS 5 -struct hostent* gsSocketGetHostByName(const char* name) -{ - // parameter check - GS_ASSERT(name); - { - int result = 0; - int resolverID = 0; - // mj taking this off the stack 04/05/06 - #define GetHostByNameBufferSize 1024 - char *buf = gsimalloc(GetHostByNameBufferSize);//[GetHostByNameBufferSize]; // PSP documentation recommends 1024 - struct in_addr ip; - - static struct hostent ahostent; - static char * aliases = NULL; - static char * ipPtrs[MAX_IPS + 1]; - static unsigned int ips[MAX_IPS]; - - GS_ASSERT(buf); - - ahostent.h_name = ""; - ahostent.h_aliases = &aliases; - ahostent.h_addrtype = AF_INET; - ahostent.h_addr_list = ipPtrs; - - result = sceNetResolverCreate(&resolverID, buf, GetHostByNameBufferSize); - if (result < 0) - { - gsifree(buf); - return NULL; - } - // this will block until completed - result = sceNetResolverStartNtoA(resolverID, name, &ip, GSI_RESOLVER_TIMEOUT, GSI_RESOLVER_RETRY); - sceNetResolverDelete(resolverID); // delete right away, result is stored in ip - if (result < 0) - { - gsifree(buf); - return NULL; - } - ahostent.h_length = sizeof(struct in_addr); - memcpy(&ips[0], &ip, sizeof(struct in_addr)); - ahostent.h_addr_list[0] = (char*)&ips[0]; - ahostent.h_addr_list[1] = NULL; - - { - const char * out = sceNetInetInetNtop(SCE_NET_INET_AF_INET, &ip, buf, sizeof(buf)); - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Network, GSIDebugLevel_Notice, - "gsSocketGetHostByName: %s = %s\r\n", name, out?out:"void"); - } - gsifree(buf); - return &ahostent; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -const char* gsSocketInetNtoa(struct in_addr in) -{ - static char buf[sizeof("XXX.XXX.XXX.XXX")]; - sceNetInetInetNtop(SCE_NET_INET_AF_INET, &in, buf, sizeof(buf)); - return buf; -} - -HOSTENT * getlocalhost(void) -{ - #define MAX_IPS 5 - static HOSTENT localhost; - static char * aliases = NULL; - static char * ipPtrs[MAX_IPS + 1]; - static unsigned int ips[MAX_IPS]; - int result = 0; - gsi_u32 addr; - - static union SceNetApctlInfo info; - - localhost.h_name = "localhost"; - localhost.h_aliases = &aliases; - localhost.h_addrtype = AF_INET; - localhost.h_length = 0; - localhost.h_addr_list = (char **)ipPtrs; - ipPtrs[0] = (char *)&ips[0]; - ipPtrs[1] = NULL; - ips[0] = 0; - - result = sceNetApctlGetInfo(SCE_NET_APCTL_INFO_IP_ADDRESS, &info); - if (result < 0) - { - printf("getlocalhost sceNetApctlGetInfo returned %d\r\n", result); - return NULL; - } - - // fill in the hostent structure - addr = inet_addr(info.ip_address); // NBO - memcpy(&ips[0], &addr, sizeof(addr)); // still NBO - localhost.h_length = (gsi_u16)sizeof(addr); - - return &localhost; -} - - -// ******* PSP AdHoc Socket Code ******************** -// See SampleAPP SDK PSP gsNetwork.c code for sample, and network start-up code -#define RXBUFLEN 1024 - -#ifdef GSI_ADHOC -void NetAdhocMacGet (char *mac) -{ - int ret = sceWlanGetEtherAddr((struct SceNetEtherAddr *)mac); -} - - -int _NetworkAdHocSocketCreate(gsi_u16 port) -{ - int ret, id; - struct SceWlanEtherAddr tmp_local; - static struct SceNetEtherAddr addr; - // Get local MAC address - ret = sceWlanGetEtherAddr(&tmp_local); - if (ret < 0) - { - // Error handling - return -1;// INVALID_SOCKET - } - memcpy(&addr, &tmp_local.addr,sizeof(struct SceNetEtherAddr)); - #ifdef _PSPNET_LOG - printf("Create Adhoc Socket: MAC:%x,%x,%x,%x,%x,%x\n",(gsi_u32)tmp_local.addr[0],(gsi_u32)tmp_local.addr[1],(gsi_u32)tmp_local.addr[2],(gsi_u32)tmp_local.addr[3],(gsi_u32)tmp_local.addr[4],(gsi_u32)tmp_local.addr[5]); - #endif - - // Set socket buffer to 8192 bytes - id = sceNetAdhocPdpCreate(&addr, port, RXBUFLEN, 0); - if (id < 0) - { - // SCE_ERROR_NET_ADHOC_INVALID_ADDR - // ToDo: Error handling - return -1;// INVALID_SOCKET - } - return id; -} - -void _NetworkAdHocSocketDestroy(int socket) -{ - int ret; - ret = sceNetAdhocPdpDelete(socket,0); - if (ret < 0) - { - // ToDo: Error handling - } -} - -int _NetworkAdHocSocketBroadcast( int socketid, - const void *data, - int len, - int flags, - gsi_u16 dest_port - ) -{ - const static gsi_u8 broadcast_addr[SCE_NET_ETHER_ADDR_LEN] = {0xff}; - int ret = sceNetAdhocPdpSend( - socketid, // id Socket ID - broadcast_addr, // daddr Destination MAC address - dest_port, // dport Destination port number - data, // data Pointer to send data - len, // len Length of send data - 10, // timeout Timeout (µsec) - flags // flag Send options - ); - - // todo: translate return value to GSI specific - return ret; -} - - -int _NetworkAdHocSocketSendTo( int socketid, - const void *data, - int len, - int flags, - const char *dest_addr, - gsi_u16 dest_port - ) -{ -#if(0) // test - const static gsi_u8 broadcast_addr[SCE_NET_ETHER_ADDR_LEN] = {0xff}; - int ret = sceNetAdhocPdpSend( - socketid, // id Socket ID - broadcast_addr, // daddr Destination MAC address - dest_port, // dport Destination port number - data, // data Pointer to send data - len, // len Length of send data - 10, // timeout Timeout (µsec) - flags // flag Send options - ); -#else - - int ret = sceNetAdhocPdpSend( - socketid, // id Socket ID - dest_addr, // daddr Destination MAC address - dest_port, // dport Destination port number - data, // data Pointer to send data - len, // len Length of send data - 10, // timeout Timeout (µsec) - flags // flag Send options - ); -#endif - #ifdef _PSPNET_LOG - printf("AdHoc SendTo: MAC:%x,%x,%x,%x,%x,%x port=%d Len=%d\n",(gsi_u32)dest_addr[0],(gsi_u32)dest_addr[1],(gsi_u32)dest_addr[2],(gsi_u32)dest_addr[3],(gsi_u32)dest_addr[4],(gsi_u32)dest_addr[5],dest_port,len); - #endif - // todo: translate return value to GSI specific - return ret; -} - -// return 0 if no data, -1 if error, >0 if data to read -int _NetworkAdHocCanReceiveOnSocket(int socket_id) -{ - int ret; - struct SceNetAdhocPdpStat stat; - int stat_buflen; - - /* - // get SceNetAdhocPdpStat - next Pointer to next entry in list (NULL indicates end) - id Socket ID - laddr Local address - lport Local port number - rcv_sb_cc Size of data in receive buffer - */ - - stat_buflen = sizeof(struct SceNetAdhocPdpStat); - ret = sceNetAdhocGetPdpStat(&stat_buflen, (void *)&stat); - if (ret < 0) - { - // Error Condition - - if(ret == SCE_ERROR_NET_ADHOC_INVALID_ARG) - { - printf("sceNetAdhocGetPdpStat() failed. SCE_ERROR_NET_ADHOC_INVALID_ARG ret = 0x%x\n", ret); - } - else - if(ret == SCE_ERROR_NET_ADHOC_NOT_INITIALIZED) - { - printf("sceNetAdhocGetPdpStat() failed. SCE_ERROR_NET_ADHOC_NOT_INITIALIZED ret = 0x%x\n", ret); - } - else - { - printf("sceNetAdhocGetPdpStat() failed. ret = 0x%x\n", ret); - } - return -1; - } - - if (stat_buflen == 0 || stat.id != socket_id) - { - printf("sceNetAdhocGetPdpStat() invalid data.\n"); - return 0; - } - - return stat.rcv_sb_cc; // valid date to read -} - -// return length if successful -// <=0 on error -int _NetworkAdHocSocketRecv(int socket_id, - char *buf, - int bufferlen, - int flags, - char *saddr, //struct SceNetEtherAddr = char[6]; - u_int16 *sport - ) -{ - int ret = sceNetAdhocPdpRecv( - socket_id, // id Socket ID - saddr, // saddr Sender’s MAC address - sport, // sport Sender port number - buf, // buf Pointer to receive buffer - &bufferlen, // len Receive buffer size (IN), receive data length (OUT) - 0, // timeout Timeout (µsec) - SCE_NET_ADHOC_F_NONBLOCK// flag Receive options - ); - - // translate return values to gsi standard - if (ret < 0) - { - return ret; - } - if (ret == (int)SCE_ERROR_NET_ADHOC_WOULD_BLOCK) - { - // no data, just return - return SCE_OK; - } - #ifdef _PSPNET_LOG - if(ret >= 0) - printf("AdHoc Recv From: MAC:%x,%x,%x,%x,%x,%x: port=%d len:%d\n",saddr[0],saddr[1],saddr[2],saddr[3],saddr[4],saddr[5],*sport,bufferlen); - #endif - - - return bufferlen; -} -#endif - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/gsUtilPSP.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/gsUtilPSP.c deleted file mode 100644 index 4363a51a537..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/gsUtilPSP.c +++ /dev/null @@ -1,275 +0,0 @@ -#if defined(_PSP) -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if !defined(GSI_NO_THREADS) - -static void gsiResolveHostnameThread(void * arg) -{ - int result = 0; - int resolverID = 0; - char buf[1024]; // PSP documentation recommends 1024 - in_addr addr; - GSIResolveHostnameHandle * info = (GSIResolveHostnameHandle)arg; - - result = sceNetResolverCreate(&resolverID, buf, sizeof(buf)); - if (result < 0) - { - // failed to create resolver, did you call sceNetResolverInit() ? - info->ip = GSI_ERROR_RESOLVING_HOSTNAME; - return -1; - } - else - { - // this will block until completed - result = sceNetResolverStartNtoA(resolverID, info->hostname, &addr, &info->ip, GSI_RESOLVER_TIMEOUT, GSI_RESOLVER_RETRY); - if (result < 0) - info->ip = GSI_ERROR_RESOLVING_HOSTNAME; - sceNetResolverDelete(resolverID); - } -} - -int gsiStartResolvingHostname(const char * hostname, GSIResolveHostnameHandle * handle) -{ - GSIResolveHostnameInfo * info; - - // allocate a handle - info = (GSIResolveHostnameInfo *)gsimalloc(sizeof(GSIResolveHostnameInfo)); - if(!info) - return -1; - - // make a copy of the hostname so the thread has access to it - info->hostname = goastrdup(hostname); - if(!info->hostname) - { - gsifree(info); - return -1; - } - - // not resolved yet - info->finishedResolving = 0; - - // start the thread - if(gsiStartThread(gsiResolveHostnameThread, (0x1000), info, &info->threadID) == -1) - { - gsifree(info->hostname); - gsifree(info); - return -1; - } - - // set the handle to the info - *handle = info; - - return 0; -} - -void gsiCancelResolvingHostname(GSIResolveHostnameHandle handle) -{ - if (0 == handle->finishedResolving) - { - sceNetResolverStop(handle->resolverID); // safe to call from separate thread - gsiCancelThread(handle->threadID); - } -} - -unsigned int gsiGetResolvedIP(GSIResolveHostnameHandle handle) -{ - return handle->ip; -} - -#endif // (GSI_NO_THREADS) - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(UNIQUEID) - -static const char * GetMAC(void) -{ - static struct SceNetEtherAddr mac; - int result = 0; - - result = sceNetGetLocalEtherAddr(&mac); - if (result == 0) - return (char *)&mac.data; - else - return NULL; -} - -const char * GOAGetUniqueID_Internal(void) -{ - static char keyval[17]; - const char * MAC; - - // check if we already have the Unique ID - if(keyval[0]) - return keyval; - - // get the MAC - MAC = GetMAC(); - if(!MAC) - { - // error getting the MAC - static char errorMAC[6] = { 1, 2, 3, 4, 5, 6 }; - MAC = errorMAC; - } - - // format it - sprintf(keyval, "%02X%02X%02X%02X%02X%02X0000", - MAC[0] & 0xFF, - MAC[1] & 0xFF, - MAC[2] & 0xFF, - MAC[3] & 0xFF, - MAC[4] & 0xFF, - MAC[5] & 0xFF); - - return keyval; -} - -#endif - -//NEED These again since MAX INTEGRAL BITS is not defined -#define GSI_MIN_I64 LONG_LONG_MIN -#define GSI_MAX_I64 LONG_LONG_MAX -#define GSI_MAX_U64 ULONG_LONG_MAX -/* flag values */ -#define FL_UNSIGNED 1 /* strtouq called */ -#define FL_NEG 2 /* negative sign found */ -#define FL_OVERFLOW 4 /* overflow occured */ -#define FL_READDIGIT 8 /* we've read at least one correct digit */ - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - const char *p; - char c; - gsi_i64 number; - unsigned digval; - gsi_u64 maxval; - int flags = 0; - // Added for compatibility reasons - int ibase = 10; - - p = theNumberStr; // p is our scanning pointer - number = 0; // start with zero - - // read char - c = *p++; - - // skip whitespace - while ( isspace(c) ) - c = *p++; - - - if (c == '-') { - flags |= FL_NEG; // remember minus sign - c = *p++; - } - // skip sign - else if (c == '+') - c = *p++; - - if (ibase == 0) - { - // determine base free-lance, based on first two chars of - // string - if (c != '0') - ibase = 10; - else if (*p == 'x' || *p == 'X') - ibase = 16; - else - ibase = 8; - } - - if (ibase == 16) - { - // we might have 0x in front of number; remove if there - if (c == '0' && (*p == 'x' || *p == 'X')) { - ++p; - c = *p++; /* advance past prefix */ - } - } - - // if our number exceeds this, we will overflow on multiply - maxval = GSI_MAX_U64 / ibase; - - - // exit in middle of loop - for (;;) - { - // convert c to value - if ( isdigit(c) ) - digval = c - '0'; - else if ( isalpha(c) ) - digval = toupper(c) - 'A' + 10; - else - break; - - // exit loop if bad digit found - if (digval >= (unsigned)ibase) - break; - - /* record the fact we have read one digit */ - flags |= FL_READDIGIT; - - // we now need to compute number = number * base + digval, - // but we need to know if overflow occurred. This requires - // a tricky pre-check. - - if (number < maxval || (number == maxval && - (gsi_u64)digval <= GSI_MAX_U64 % ibase)) - { - // we won't overflow, go ahead and multiply - number = number * ibase + digval; - } - else - { - // we have overflowed, set the flag - flags |= FL_OVERFLOW; - break; - } - - c = *p++; /* read next digit */ - } - - --p; /* point to place that stopped scan */ - - if (!(flags & FL_READDIGIT)) { - /* no number there; return 0 and point to beginning of - string */ - number = 0L; /* return 0 */ - } - else if ( (flags & FL_OVERFLOW) || - ( !(flags & FL_UNSIGNED) && - ( ( (flags & FL_NEG) && (number > GSI_MIN_I64) ) || - ( !(flags & FL_NEG) && (number > GSI_MAX_I64) ) ) ) ) - { - /* overflow or signed overflow occurred */ - errno = ERANGE; - if ( flags & FL_NEG ) - number = GSI_MIN_I64; - else - number = GSI_MAX_I64; - } - - if (flags & FL_NEG) - /* negate result if there was a neg sign */ - number = -number; - - return number; /* done. */ -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%lld", theNumber); -} -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // _PSP only diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/pspcommon.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/pspcommon.c deleted file mode 100644 index 3015b591966..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/psp/pspcommon.c +++ /dev/null @@ -1,416 +0,0 @@ -#if defined(_PSP) -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - -#include -#include -#include - -/******** THIS FILE IS FOR USE BY THE GAMESPY SAMPLE APPLICATIONS ********/ - -// Portions taken from Sony PSP http_get sample have been modified to suite the -// sample/demonstration of the Gamespy SDKs -// This code is not intended to be used in a shipping title -// (e.g. You should have your own network setup code which supports other configurations) - - -// Code modified from http_get used to export information about this module -SCE_MODULE_INFO(PspCommon, 0, 1, 1); - -// Paths setup for specific modules and libraries used by the Tool -#define DEVKIT_PATH "host0:/usr/local/devkit/" -#define MODULE_PATH DEVKIT_PATH "module/" -#define PSPNET_AP_DIALOG_DUMMY_PRX MODULE_PATH "pspnet_ap_dialog_dummy.prx" - -// Memory pool size for network stack and other stacks -#define PSPNET_POOLSIZE (256 * 1024) -#define CALLOUT_TPL 32 -#define NETINTR_TPL 32 -#define SCE_APCTL_HANDLER_STACKSIZE (1024 * 1) -#define SCE_APCTL_STACKSIZE (SCE_NET_APCTL_LEAST_STACK_SIZE + SCE_APCTL_HANDLER_STACKSIZE) -#define SCE_APCTL_PRIO 40 - -#define AP_DIALOG_DUMMY_WAIT_TIME (1000 * 1000) - -#define PSPNET_APCTLHDLR 0x80 -#define PSPNET_APDUMDLG_STARTED 0x40 -#define PSPNET_CONNECTED 0x20 -// If necessary, use this to select a specific router by SSID. -#ifndef AUTO_SELECT_ROUTER -#define YOUR_WIRELESS_ROUTER_NAME "PubServ DLink" -#endif - -// function prototypes -int gsiPspLoadRequiredModules(void); -int gsiPspUnloadRequiredModules(void); - -// static vars used for disconnect warnings and setting up network connection -static int gDisconnected = 0; -static struct SceNetApDialogDummyParam gApDialogDummyParam; - -// Globals -// the sce kernel detects this global variable and sets the heapsize from it -// see devkit\src\crt0\kernel_bridge.c(232-253) -int sce_newlib_heap_kb_size = 1000; -SceUID gPspnetApDialogDummyModid = 0; -int gPspnetApctlHandlerId = -1; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Used to start needed kernel model -static SceUID gsiPspLoadModule(const char *path) -{ - SceUID modid = 0; - int ret = 0, mresult; - - ret = sceKernelLoadModule(path, 0, NULL); - if(ret < 0) - { - printf("sceKernelLoadModule() failed. ret = 0x%x\n", ret); - return ret; - } - modid = ret; - - ret = sceKernelStartModule(modid, 0, 0, &mresult, NULL); - if(ret < 0) - { - printf("sceKernelStartModule() failed. ret = 0x%x\n", ret); - ret = sceKernelUnloadModule(modid); - if (ret < 0) - printf("sceKernelUnloadModule() failed. ret = 0x%x\n", ret); - return ret; - } - ret = modid; - - return ret; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Used to stop kernel model -static int gsiPspUnloadModule(SceUID modid) -{ - int ret = 0; - - ret = sceKernelStopModule(modid, 0, NULL, NULL, NULL); - if (ret < 0) - { - printf("sceKernelStopModule() failed. ret = 0x%x\n", ret); - return ret; - } - - ret = sceKernelUnloadModule(modid); - if (ret < 0) - { - printf("sceKernelUnloadModule() failed. ret = 0x%x\n", ret); - return ret; - } - - return ret; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// used to start up network library modules -int gsiPspLoadRequiredModules() -{ - int ret = 0; - - ret = sceUtilityLoadModule(SCE_UTILITY_MODULE_NET_COMMON); - if(ret < 0) - { - printf("sceUtilityLoadModule(SCE_UTILITY_MODULE_NET_COMMON) failed. ret = 0x%x\n", ret); - gsiPspUnloadRequiredModules(); - return ret; - } - - ret = sceUtilityLoadModule(SCE_UTILITY_MODULE_NET_INET); - if(ret < 0) - { - printf("sceUtilityLoadModule(SCE_UTILITY_MODULE_NET_INET) failed. ret = 0x%x\n", ret); - gsiPspUnloadRequiredModules(); - return ret; - } - - ret = gsiPspLoadModule(PSPNET_AP_DIALOG_DUMMY_PRX); - if(ret < 0) - { - printf("load_module %s failed. ret = 0x%x\n",PSPNET_AP_DIALOG_DUMMY_PRX, ret); - gsiPspUnloadRequiredModules(); - return ret; - } - gPspnetApDialogDummyModid = ret; - - return ret; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Used to shutdown network library modules -int gsiPspUnloadRequiredModules() -{ - int ret = 0; - - - ret = gsiPspUnloadModule(gPspnetApDialogDummyModid); - if (ret < 0) - { - printf("unload_module() failed. ret = 0x%x\n", ret); - return ret; - } - - ret = sceUtilityUnloadModule(SCE_UTILITY_MODULE_NET_INET); - if (ret < 0) - { - printf("sceUtilityUnloadModule(SCE_UTILITY_MODULE_NET_INET) failed. ret = 0x%x\n", ret); - } - - ret = sceUtilityUnloadModule(SCE_UTILITY_MODULE_NET_COMMON); - if (ret < 0) - { - printf("sceUtilityUnloadModule(SCE_UTILITY_MODULE_NET_COMMON) failed. ret = 0x%x\n", ret); - } - return ret; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// AP network connection handler used to detect if psp was disconnected -void gsiPspApctlHandler(int prev_state, int new_state, int event, int error_code, void *arg) -{ - (void)arg; - - if(new_state == SCE_NET_APCTL_STATE_Disconnected) - { - if(event == SCE_NET_APCTL_EVENT_DISCONNECT_REQ) - gDisconnected = 1; - if(prev_state == SCE_NET_APCTL_STATE_IPObtained && - event == SCE_NET_APCTL_EVENT_ERROR) - printf("Apctl error happened, error = 0x%x\n", error_code); - } -} - -int gsiPspnetDisconnect() -{ - int ret; - - gDisconnected = 0; - - ret = sceNetApctlDisconnect(); - if(ret < 0) - { - printf("sceNetApctlDisconnect() failed. ret = 0x%x\n", ret); - return ret; - } - - while(gDisconnected == 0) - sceKernelDelayThread(AP_DIALOG_DUMMY_WAIT_TIME); - - sceNetApDialogDummyTerm(); - if (gPspnetApctlHandlerId >= 0) - { - sceNetApctlDelHandler(gPspnetApctlHandlerId); - } - - return ret; -} - -void gsiPspnetStop() -{ - // turn off all services if they are available - sceNetApctlTerm(); - - sceNetResolverTerm(); - - sceNetInetTerm(); - - sceNetTerm(); -} - -// Error Handler used to stop network libraries in case of failure -void gsiPspnetErrorHandler(int shutDownServices) -{ - - if (shutDownServices & PSPNET_CONNECTED) - gsiPspnetDisconnect(); - - if (shutDownServices & PSPNET_APDUMDLG_STARTED) - sceNetApDialogDummyTerm(); - - if (shutDownServices & PSPNET_APCTLHDLR) - if(gPspnetApctlHandlerId >= 0) - sceNetApctlDelHandler(gPspnetApctlHandlerId); - - gsiPspnetStop(); -} - -// -int gsiPspStartNetworkModules() -{ - struct SceNetApDialogDummyStateInfo ap_dialog_dummy_state; - union SceNetApctlInfo apctl_info; - int ret; - // error bit starts at 1 and is shifted left with one added - int serviceToShutDown = 0; - - ret = sceNetInit(PSPNET_POOLSIZE, CALLOUT_TPL, 0, - NETINTR_TPL, 0); - if(ret < 0) - { - printf("sceNetInit() failed. ret = 0x%x\n", ret); - return ret; - } - - - ret = sceNetInetInit(); - if(ret < 0) - { - printf("sceNetInetInit() failed. ret = 0x%x\n", ret); - gsiPspnetStop(); - return ret; - } - - - ret = sceNetResolverInit(); - if(ret < 0) - { - printf("sceNetResolverInit() failed. ret = 0x%x\n", ret); - gsiPspnetStop(); - return ret; - } - - - ret = sceNetApctlInit(SCE_APCTL_STACKSIZE, SCE_APCTL_PRIO); - if(ret < 0) - { - printf("sceNetApctlInit() failed. ret = 0x%x\n", ret); - gsiPspnetStop(); - return ret; - } - - - ret = sceNetApctlAddHandler(gsiPspApctlHandler, NULL); - if(ret < 0) - { - printf("sceNetApctlAddHandler() failed. ret = 0x%x\n", ret); - gsiPspnetStop(); - return ret; - } - gPspnetApctlHandlerId = ret; - - serviceToShutDown = serviceToShutDown | PSPNET_APCTLHDLR; - ret = sceNetApDialogDummyInit(); - if(ret < 0) - { - printf("sceNetApDialogDummyInit() failed. ret = 0x%x\n", ret); - gsiPspnetErrorHandler(serviceToShutDown); // called with 31 - return ret; - } - - serviceToShutDown = serviceToShutDown | PSPNET_APDUMDLG_STARTED; - /* check Wireless LAN switch */ - ret = sceWlanGetSwitchState(); - if(ret == SCE_WLAN_SWITCH_STATE_OFF){ - printf("Wireless LAN switch has been turned off.\n"); - gsiPspnetErrorHandler(serviceToShutDown); // called with 63 - return ret; - } - - - memset(&gApDialogDummyParam, 0, sizeof(gApDialogDummyParam)); -#ifndef AUTO_SELECT_ROUTER - strcpy(gApDialogDummyParam.ssid, YOUR_WIRELESS_ROUTER_NAME); -#endif - ret = sceNetApDialogDummyConnect(&gApDialogDummyParam); - if(ret < 0) - { - printf("sceNetApDialogDummyConnect() failed. ret = 0x%x\n", ret); - gsiPspnetErrorHandler(serviceToShutDown); // called with 63 - return ret; - } - - while(1){ - ret = sceNetApDialogDummyGetState(&ap_dialog_dummy_state); - if(ret == 0){ - if(ap_dialog_dummy_state.state == SceNetApDialogDummyState_Connected || - ap_dialog_dummy_state.state == SceNetApDialogDummyState_Disconnected) - break; - } - sceKernelDelayThread(AP_DIALOG_DUMMY_WAIT_TIME); - } - - if(ap_dialog_dummy_state.state == SceNetApDialogDummyState_Disconnected) - { - printf("failed to Join or Get IP addr. error = 0x%x\n", ap_dialog_dummy_state.error_code); - gsiPspnetErrorHandler(serviceToShutDown); // called with 63 - return ap_dialog_dummy_state.error_code; - } - - serviceToShutDown = serviceToShutDown | PSPNET_CONNECTED; - ret = sceNetApctlGetInfo(SCE_NET_APCTL_INFO_IP_ADDRESS, &apctl_info); - if(ret < 0) - { - printf("sceNetApctlGetInfo() failed. ret = 0x%x\n", ret); - gsiPspnetErrorHandler(serviceToShutDown); // called with 127 - return ret; - } - printf("obtained IP addr: %s\n", apctl_info.ip_address); - return ret; -} - -// sample entry point -extern int test_main(int argc, char ** argp); - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Common PSP entry point -int main(int argc, char** argp) -{ - int ret = 0; - - - // Load the modules required to do basic TCP/IP networking - ret = gsiPspLoadRequiredModules(); - if(ret < 0) - { - printf("gsiPspLoadRequiredModules failed. See previous return value. return = 0x%x\n", - ret); - return SCE_KERNEL_EXIT_SUCCESS; - } - - - // Start up PSPNET libraries - ret = gsiPspStartNetworkModules(); - if (ret < 0) - { - printf("gsiPspStartNetworkModules failed See previous return value. return = 0x%x\n", ret); - return ret; - } - - - /////////////////////////////////// - // Call the application entry point - ret = test_main(argc, argp); - - ret = gsiPspnetDisconnect(); - if (ret < 0) - { - printf("gsiPspnetDisconnect failed See previous return value. return = 0x%x\n", ret); - return ret; - } - - // Shut down the PSPNET network library - gsiPspnetStop(); - - ret = gsiPspUnloadRequiredModules(); - if(ret < 0) - return SCE_KERNEL_EXIT_SUCCESS; - - return SCE_KERNEL_EXIT_SUCCESS; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // _PSP only diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsSocketRevolution.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsSocketRevolution.c deleted file mode 100644 index 0b587ea2695..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsSocketRevolution.c +++ /dev/null @@ -1,197 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(_REVOLUTION) - -// include the revolution socket header -#include "../gsPlatform.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// static variables -static int GSIRevolutionErrno; - -// prototypes of static functions -static int CheckRcode(int rcode, int errCode); - -#define REVOlUTION_SOCKET_ERROR -1 - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// parses rcode into a generic -1 error if an error has occured -static int CheckRcode(int rcode, int errCode) -{ - if(rcode >= 0) - return rcode; - GSIRevolutionErrno = rcode; - return errCode; -} - -int socket(int pf, int type, int protocol) -{ - int rcode = SOSocket(pf, type, 0); - GSI_UNUSED(protocol); - return CheckRcode(rcode, INVALID_SOCKET); -} -int closesocket(SOCKET sock) -{ - int rcode = SOClose(sock); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -int shutdown(SOCKET sock, int how) -{ - int rcode = SOShutdown(sock, how); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -int bind(SOCKET sock, const SOCKADDR* addr, int len) -{ - SOCKADDR localAddr; - int rcode; - - // with Revolution, don't bind to 0, just start using the port - if(((const SOCKADDR_IN*)addr)->port == 0) - return 0; - - memcpy(&localAddr, addr, sizeof(SOCKADDR)); - localAddr.len = (u8)len; - - rcode = SOBind(sock, &localAddr); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} - -int connect(SOCKET sock, const SOCKADDR* addr, int len) -{ - SOCKADDR remoteAddr; - int rcode; - - memcpy(&remoteAddr, addr, sizeof(SOCKADDR)); - remoteAddr.len = (u8)len; - - rcode = SOConnect(sock, &remoteAddr); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -int listen(SOCKET sock, int backlog) -{ - int rcode = SOListen(sock, backlog); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -SOCKET accept(SOCKET sock, SOCKADDR* addr, int* len) -{ - int rcode; - addr->len = (u8)*len; - rcode = SOAccept(sock, addr); - *len = addr->len; - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} - -int recv(SOCKET sock, char* buf, int len, int flags) -{ - int rcode = SORecv(sock, buf, len, flags); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -int recvfrom(SOCKET sock, char* buf, int len, int flags, SOCKADDR* addr, int* fromlen) -{ - int rcode; - addr->len = (u8)*fromlen; - rcode = SORecvFrom(sock, buf, len, flags, addr); - *fromlen = addr->len; - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -SOCKET send(SOCKET sock, const char* buf, int len, int flags) -{ - int rcode = SOSend(sock, buf, len, flags); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -SOCKET sendto(SOCKET sock, const char* buf, int len, int flags, const SOCKADDR* addr, int tolen) -{ - SOCKADDR remoteAddr; - int rcode; - - memcpy(&remoteAddr, addr, sizeof(SOCKADDR)); - remoteAddr.len = (u8)tolen; - - rcode = SOSendTo(sock, buf, len, flags, &remoteAddr); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} - -int getsockopt(SOCKET sock, int level, int optname, char* optval, int* optlen) -{ - int rcode = SOGetSockOpt(sock, level, optname, optval, optlen); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} -SOCKET setsockopt(SOCKET sock, int level, int optname, const char* optval, int optlen) -{ - int rcode = SOSetSockOpt(sock, level, optname, optval, optlen); - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} - -int getsockname(SOCKET sock, SOCKADDR* addr, int* len) -{ - int rcode; - addr->len = (u8)*len; - rcode = SOGetSockName(sock, addr); - *len = addr->len; - return CheckRcode(rcode, REVOlUTION_SOCKET_ERROR); -} - -unsigned long inet_addr(const char* name) -{ - int rcode; - SOInAddr addr; - rcode = SOInetAtoN(name, &addr); - if(rcode == FALSE) - return INADDR_NONE; - return addr.addr; -} - -int GOAGetLastError(SOCKET sock) -{ - GSI_UNUSED(sock); - return GSIRevolutionErrno; -} - -int GSISocketSelect(SOCKET theSocket, int* theReadFlag, int* theWriteFlag, int* theExceptFlag) -{ - SOPollFD pollFD; - int rcode; - - pollFD.fd = theSocket; - pollFD.events = 0; - if(theReadFlag != NULL) - pollFD.events |= SO_POLLRDNORM; - if(theWriteFlag != NULL) - pollFD.events |= SO_POLLWRNORM; - pollFD.revents = 0; - - rcode = SOPoll(&pollFD, 1, 0); - if(rcode < 0) - return REVOlUTION_SOCKET_ERROR; - - if(theReadFlag != NULL) - { - if((rcode > 0) && (pollFD.revents & (SO_POLLRDNORM|SO_POLLHUP))) - *theReadFlag = 1; - else - *theReadFlag = 0; - } - if(theWriteFlag != NULL) - { - if((rcode > 0) && (pollFD.revents & SO_POLLWRNORM)) - *theWriteFlag = 1; - else - *theWriteFlag = 0; - } - if(theExceptFlag != NULL) - { - if((rcode > 0) && (pollFD.revents & SO_POLLERR)) - *theExceptFlag = 1; - else - *theExceptFlag = 0; - } - return rcode; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // _REVOLUTION \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsThreadRevoulution.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsThreadRevoulution.c deleted file mode 100644 index 9a9808d959d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsThreadRevoulution.c +++ /dev/null @@ -1,183 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" - - -// Begin of Threading for Revolution -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_u32 gsiInterlockedIncrement(gsi_u32 * value) -{ - BOOL enabled = OSDisableInterrupts(); - - gsi_u32 ret = ++(*value); - OSRestoreInterrupts(enabled); - - // return "ret" rather than "value" here b/c - // value may be modified by another thread - // before we can return it - return ret; -} - -gsi_u32 gsiInterlockedDecrement(gsi_u32 * value) -{ - BOOL state = OSDisableInterrupts(); - gsi_u32 ret = --(*value); - OSRestoreInterrupts(state); - - // return "ret" rather than "value" here b/c - // value may be modified by another thread - // before we can return it - return ret; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -int gsiStartThread(GSThreadFunc aThreadFunc, gsi_u32 theStackSize, void *arg, GSIThreadID* theThreadIdOut) -{ - char *aStackBase; - if(theStackSize % 32 != 0) - { - OSRoundUp32B(theStackSize); - } - - theThreadIdOut->mStack = gsimalloc(theStackSize); - aStackBase = (char *)theThreadIdOut->mStack; - aStackBase += theStackSize; - - OSCreateThread(&theThreadIdOut->mThread, aThreadFunc, arg, (void *)aStackBase, - theStackSize, 16, OS_THREAD_ATTR_DETACH); - - OSResumeThread(&theThreadIdOut->mThread); - - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiCancelThread(GSIThreadID theThreadID) -{ - OSCancelThread(&theThreadID.mThread); - if(theThreadID.mStack) - { - gsifree(theThreadID.mStack); - theThreadID.mStack = NULL; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiCleanupThread(GSIThreadID theThreadID) -{ - - if (!OSIsThreadTerminated(&theThreadID.mThread)) - OSCancelThread(&theThreadID.mThread); - if(theThreadID.mStack) - { - gsifree(theThreadID.mStack); - theThreadID.mStack = NULL; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_u32 gsiHasThreadShutdown(GSIThreadID theThreadID) -{ - BOOL shutdown = OSIsThreadTerminated(&theThreadID.mThread); - - if(shutdown == TRUE) - return 1; - return 0; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) -{ - OSInitMutex(theCrit); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiEnterCriticalSection(GSICriticalSection *theCrit) -{ - OSLockMutex(theCrit); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiLeaveCriticalSection(GSICriticalSection *theCrit) -{ - OSUnlockMutex(theCrit); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiDeleteCriticalSection(GSICriticalSection *theCrit) -{ - GSI_UNUSED(theCrit); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - GSISemaphoreID semaphore; - - OSInitSemaphore(&semaphore, theInitialCount); - - GSI_UNUSED(theName); - GSI_UNUSED(theMaxCount); - - return semaphore; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - gsi_u32 retval = (unsigned int)OSWaitSemaphore(&theSemaphore); - GSI_UNUSED(theTimeoutMs); - return retval; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - OSSignalSemaphore(&theSemaphore); - GSI_UNUSED(theReleaseCount); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - GSI_UNUSED(theSemaphore); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void gsiExitThread(GSIThreadID theThreadID) -{ - GSI_UNUSED(theThreadID); -} - - - -// End of Threading for Revolution -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsUtilRevolution.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsUtilRevolution.c deleted file mode 100644 index d0a34000dd5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/gsUtilRevolution.c +++ /dev/null @@ -1,108 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" -#include "../gsPlatformUtil.h" - -void gsiRevolutionSleep(u32 msec); -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static OSAlarm gAlarm; -static OSThreadQueue gQueue; -static BOOL gQueueInitialized; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static const char * GOAGetUniqueID_Internal(void) -{ - static char keyval[17]; - u8 aMac[ETH_ALEN]; - int aMacLen; - - // check if we already have the Unique ID - if(keyval[0]) - return keyval; - - aMacLen = ETH_ALEN; - SOGetInterfaceOpt (NULL, SO_SOL_CONFIG, SO_CONFIG_MAC_ADDRESS, - aMac, &aMacLen); - - // format it - sprintf(keyval, "%02X%02X%02X%02X%02X%02X0000", - aMac[0] & 0xFF, - aMac[1] & 0xFF, - aMac[2] & 0xFF, - aMac[3] & 0xFF, - aMac[4] & 0xFF, - aMac[5] & 0xFF); - - return keyval; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Time Functions -static char GSIMonthNames[12][3] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static char GSIWeekDayNames[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - -time_t gsiTimeInSec(time_t *timer) -{ - time_t t = 0; - t = (gsi_i32)OSTicksToSeconds(OSGetTime()); - - if (timer) - *timer = t; - - return t; -} - - -struct tm *gsiGetGmTime(time_t *theTime) -{ - static struct tm aTimeStruct; - static struct tm *aRetVal = &aTimeStruct; - OSCalendarTime aCalTimeStruct; - - OSTicksToCalendarTime(*theTime, &aCalTimeStruct); - - aRetVal->tm_sec = aCalTimeStruct.sec; - aRetVal->tm_min = aCalTimeStruct.min; - aRetVal->tm_hour = aCalTimeStruct.hour; - aRetVal->tm_mday = aCalTimeStruct.mday; - aRetVal->tm_mon = aCalTimeStruct.mon; - aRetVal->tm_year = aCalTimeStruct.year - 1900; - aRetVal->tm_wday = aCalTimeStruct.wday; - aRetVal->tm_yday = 0; - aRetVal->tm_isdst = 0; - return aRetVal; -} - -char *gsiCTime(time_t *theTime) -{ - static char str[26]; - struct tm *ptm = gsiGetGmTime(theTime); - - // e.g.: "Wed Jan 02 02:03:55 1980\n\0" - sprintf(str, "%s %s %02d %02d:%02d:%02d %d\n", - GSIWeekDayNames[ptm->tm_wday], - GSIMonthNames[ptm->tm_mon], ptm->tm_mday, - ptm->tm_hour, ptm->tm_min, ptm->tm_sec, - ptm->tm_year + 1900); - - return str; -} - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return atoll(theNumberStr); -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - - sprintf(theNumberStr, "%lld", theNumber); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/revolutionCommon.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/revolutionCommon.c deleted file mode 100644 index 221f849b2ce..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/revolution/revolutionCommon.c +++ /dev/null @@ -1,240 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// (C) Gamespy Industries -// -// Commonly shared network startup code -// WARNING: Please do not use this code as a basis for -// Game Network startup code. This is only for testing -// purposes. -// -// -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -#include "../gsCommon.h" -#include -#include -#include -#include - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -static NCDIfConfig gIfConfig; -static NCDIpConfig gIpConfig; -static OSMutex gOsMemMutex; -static MEMHeapHandle heapHandleSocket = NULL; - -#define SOCKET_HEAPSIZE_DEFAULT (1024*128) - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -static void SetDefaultIfConfig( NCDIfConfig* theIfConfig ) -{ - (void)memset( theIfConfig, 0, sizeof( NCDIfConfig ) ); - - theIfConfig->selectedMedia = NCD_IF_SELECT_WIRED; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -static void SetDefaultIpConfig( NCDIpConfig* theIpConfig ) -{ - - (void)memset( theIpConfig, 0, sizeof( NCDIpConfig ) ); - - theIpConfig->useDhcp = TRUE; - - theIpConfig->adjust.maxTransferUnit = 1300; // Value can be 1460 depending on network library - theIpConfig->adjust.tcpRetransTimeout = 100; - theIpConfig->adjust.dhcpRetransCount = 4; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// Memory functions used by the network library - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -static void* _Alloc(unsigned long theName, long theSize) -{ - void* a_memory_p = NULL; - - (void)theName; - - if (0 < theSize) - { - //OSLockMutex(&gOsMemMutex); - //a_memory_p = OSAlloc((u32)theSize); - //OSUnlockMutex(&gOsMemMutex); - - // 02OCT07 BED: MEM2 was initialized with MEM_HEAP_OPT_THREAD_SAFE - // so we don't need to manually lock it - a_memory_p = MEMAllocFromExpHeapEx( heapHandleSocket, (u32) theSize, 32 ); - } - - return a_memory_p; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -static void _Free(unsigned long theName, void* theMemoryPointer, long theSize) -{ - GSI_UNUSED(theName); - - if (theMemoryPointer && 0 < theSize) - { - //OSLockMutex(&gOsMemMutex); - //OSFree(theMemoryPointer); - //OSUnlockMutex(&gOsMemMutex); - - // 02OCT07 BED: MEM2 was initialized with MEM_HEAP_OPT_THREAD_SAFE - // so we don't need to manually lock it - MEMFreeToExpHeap( heapHandleSocket, theMemoryPointer); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// StartNetwork -// -BOOL StartNetwork() -{ - s32 rc; - - OSInitMutex(&gOsMemMutex); - - // Start up the network interface USB device - SetDefaultIfConfig( &gIfConfig ); - OSReport( "NCDSetIfConfig() ..." ); - rc = NCDSetIfConfig( &gIfConfig ); - if( rc != NCD_RESULT_SUCCESS ) - { - OSReport( "failed (%d)\n", rc ); - return FALSE; - } - OSReport( "success\n" ); - - - SetDefaultIpConfig( &gIpConfig ); - OSReport( "NCDSetIpConfig() ..." ); - rc = NCDSetIpConfig( &gIpConfig ); - if( rc != NCD_RESULT_SUCCESS ) - { - OSReport( "failed (%d)\n", rc ); - return FALSE; - } - OSReport( "success\n" ); - - - // Waiting for the network interface to come with the - // configuration previously set. - OSReport( "NCDIsInterfaceDecided() " ); - while( NCDIsInterfaceDecided() == FALSE ) - { - NCDSleep( OSMillisecondsToTicks( 10 ) ); - } - OSReport( "success\n" ); - - - // Finished bringing up network interface - // Now initializing the socket library - OSReport( "SOInit() ..." ); - { - SOLibraryConfig soLibConfig; - - (void)memset(&soLibConfig, 0, sizeof(soLibConfig)); - soLibConfig.alloc = _Alloc; - soLibConfig.free = _Free; - - rc = SOInit(&soLibConfig); - if( rc != SO_SUCCESS ) - { - switch(rc) - { - case SO_EALREADY: - OSReport("failed (SO_EALREADY)\n"); - break; - case SO_EINVAL: - OSReport("failed (SO_EINVAL)\n"); - break; - case SO_ENOMEM: - OSReport("failed (SO_ENOMEM)\n"); - break; - default: - OSReport("failed (%d)\n", rc); - }; - return FALSE; - } - } - OSReport( "success\n" ); - - - //Now Starting the sockets library - OSReport( "SOStartup() " ); - rc = SOStartup(); - if( rc != SO_SUCCESS ) - { - OSReport( "failed (%d)\n", rc ); - return FALSE; - } - OSReport( "success\n" ); - - // Getting the IP address of the local machine via DHCP - while( SOGetHostID() == 0 ) - { - NCDSleep( OSMillisecondsToTicks( 10 ) ); - } - { - SOInAddr addr; - addr.addr = (u32)SOGetHostID(); - OSReport( "IP address = %s\n", SOInetNtoA( addr ) ); - } - return TRUE; -} - - -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// StopNetwork -// -void StopNetwork() -{ - (void)SOCleanup(); -} - -extern int test_main(int argc, char **argv); -void main(int argc, char **argv) -{ -// init 128k memory for sockets - void* arenaLo; - void* arenaHi; - - DEMOInit(NULL); // Init the OS, game pad, graphics and video. - - // Initialize heap for socket allocations - // Nintendo samples say this must be in MEM2 - arenaLo = OSGetMEM2ArenaLo(); - arenaHi = OSGetMEM2ArenaHi(); - - if ((u32) arenaHi - (u32) arenaLo < SOCKET_HEAPSIZE_DEFAULT) - OSHalt("Insufficient memory in MEM2 for socket lib. Check SOCKET_HEAPSIZE_DEFAULT"); - heapHandleSocket = MEMCreateExpHeapEx( arenaLo, SOCKET_HEAPSIZE_DEFAULT, MEM_HEAP_OPT_THREAD_SAFE ); - if (heapHandleSocket == MEM_HEAP_INVALID_HANDLE) - OSHalt("MEMCreateExpHeapEx failed.\n"); - OSSetArenaLo((u8*)arenaLo + SOCKET_HEAPSIZE_DEFAULT); - - // Start the network - if (!StartNetwork()) - OSHalt("Network was not started\n"); - OSReport("=======================================================================\n"); - OSReport("Gamespy:// Starting App\n"); - test_main(argc, argv); - OSReport("=======================================================================\n"); - OSReport("Gamespy:// Ending App\n"); - StopNetwork(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/Win32Common.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/Win32Common.c deleted file mode 100644 index 49c13137cc2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/Win32Common.c +++ /dev/null @@ -1,98 +0,0 @@ -#include "../gsCommon.h" -#include "../gsMemory.h" -#include "../gsDebug.h" -#include -// Debug output -#ifdef GSI_COMMON_DEBUG - static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - - { - GSI_UNUSED(theLevel); - { - static char string[256]; - vsprintf(string, theTokenStr, theParamList); - OutputDebugString(string); - } - printf("[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - - vprintf(theTokenStr, theParamList); - } -#endif - -#if (_MSC_VER <= 1300) - //extern added for vc6 compatability. - extern void * __cdecl _aligned_malloc(size_t size, size_t boundary); - extern void __cdecl _aligned_free(void * memblock); -#endif -void * gsiMemManagedInit() -{ -// Init the GSI memory manager (optional - for limiting GSI mem usage) -#if defined GSI_MEM_MANAGED - #define aMemoryPoolSize (1024*1024*4) - char *aMemoryPool = (char *)_aligned_malloc(aMemoryPoolSize,64); - if(aMemoryPool == NULL) - { - printf("Failed to create memory pool - aborting\r\n"); - return NULL; - } - { - gsMemMgrCreate(gsMemMgrContext_Default, "Default",aMemoryPool, aMemoryPoolSize); - } - return aMemoryPool; -#else - return NULL; -#endif - -} - -void gsiMemManagedClose(void * theMemoryPool) -{ - #if defined(GSI_MEM_MANAGED) - // Optional - Dump memory leaks - - gsi_u32 MemAvail = gsMemMgrMemAvailGet (gsMemMgrContext_Default); - gsi_u32 MemUsed = gsMemMgrMemUsedGet (gsMemMgrContext_Default); - gsi_u32 HwMark = gsMemMgrMemHighwaterMarkGet (gsMemMgrContext_Default); - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Memory, GSIDebugLevel_Comment, - "MemAvail %u: MemUsed%u MemHWMark %u\n", MemAvail,MemUsed,HwMark); - gsMemMgrDumpStats(); - gsMemMgrDumpAllocations(); - gsMemMgrValidateMemoryPool(); - gsMemMgrDestroy(gsMemMgrContext_Default); - #endif - _aligned_free(theMemoryPool); -} - - -// sample common entry point -extern int test_main(int argc, char ** argp); - - -// Common entry point -int __cdecl main(int argc, char** argp) -{ - int ret = 0; - // set up memanager - void *heap = gsiMemManagedInit(); - - #ifdef GSI_COMMON_DEBUG - // Set up debugging - gsSetDebugCallback(DebugCallback); - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Verbose); - #endif - - ret = test_main(argc, argp); - - gsiMemManagedClose(heap); - - return ret; -} - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/changelog.txt deleted file mode 100644 index 825c2d1f308..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/changelog.txt +++ /dev/null @@ -1,14 +0,0 @@ -Changelog for: Win32 Common Code --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -09-15-2006 1.00.02 DES FIX Always call CreateSemaphoreA -09-21-2005 1.00.01 DES FEATURE Updated workspace -06-03-2005 1.00.00 SN RELEASE Releasing to developer site. -04-28-2005 1.00.00 SN RELEASE Releasing to developer site. -04-04-2005 1.00.00 SN RELEASE Releasing to developer site. -09-16-2004 1.00.00 SN RELEASE Releasing to developer site. -08-26-2004 1.00.00 DES OTHER Changelog started - FEATURE Added a workspace for building all the C test apps. - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsSocketWin32.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsSocketWin32.c deleted file mode 100644 index 9622b31f7cd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsSocketWin32.c +++ /dev/null @@ -1,3 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsThreadWin32.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsThreadWin32.c deleted file mode 100644 index 8bcb1d786b6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsThreadWin32.c +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsPlatformUtil.h" -#include "../gsPlatformThread.h" -#include "../gsAssert.h" -#include "../gsDebug.h" - - - -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) { InitializeCriticalSection(theCrit); } -void gsiEnterCriticalSection (GSICriticalSection *theCrit) { EnterCriticalSection(theCrit); } -void gsiLeaveCriticalSection (GSICriticalSection *theCrit) { LeaveCriticalSection(theCrit); } -void gsiDeleteCriticalSection (GSICriticalSection *theCrit) { DeleteCriticalSection(theCrit); } - -gsi_u32 gsiHasThreadShutdown(GSIThreadID theThreadID) -{ - DWORD result = WaitForSingleObject(theThreadID, 0); - if (result == WAIT_ABANDONED || result == WAIT_OBJECT_0) - return 1; // thread is dead - else - return 0; // keep waiting -} - -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - GSISemaphoreID aSemaphore = CreateSemaphoreA(NULL, theInitialCount, theMaxCount, theName); - if (aSemaphore == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create semaphore\r\n"); - } - return aSemaphore; -} - -// Waits for -- and signals -- the semaphore -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - DWORD result = WaitForSingleObject((HANDLE)theSemaphore, (DWORD)theTimeoutMs); - return (gsi_u32)result; -} - -// Allow other objects to access the semaphore -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - ReleaseSemaphore(theSemaphore, theReleaseCount, NULL); -} - -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - CloseHandle(theSemaphore); -} - - -int gsiStartThread(GSThreadFunc func, gsi_u32 theStackSize, void *arg, GSIThreadID * id) -{ - HANDLE handle; - DWORD threadID; - - // create the thread - handle = CreateThread(NULL, theStackSize, func, arg, 0, &threadID); - if(handle == NULL) - return -1; - - // store the id - *id = handle; - - return 0; -} - -void gsiCancelThread(GSIThreadID id) -{ - //TODO: is TerminateThread causing lost resources? - //should this be terminated with "failure" exit status? - TerminateThread(id, 0); -} - -void gsiExitThread(GSIThreadID id) -{ - GSI_UNUSED(id); -} - -void gsiCleanupThread(GSIThreadID id) -{ - CloseHandle(id); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsUtilWin32.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsUtilWin32.c deleted file mode 100644 index 84dd81662fd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/gsUtilWin32.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "../gsCommon.h" - -gsi_i64 gsiStringToInt64(const char *theNumberStr) -{ - return _atoi64(theNumberStr); -} - -void gsiInt64ToString(char theNumberStr[33], gsi_i64 theNumber) -{ - // you want to fit the number! - // give me a valid string! - GS_ASSERT(theNumberStr != NULL); - -#if _MSC_VER > 1300 - sprintf(theNumberStr, "%lld", theNumber); -#else - sprintf(theNumberStr, "%I64d", theNumber); -#endif -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/win32common.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/win32common.dsw deleted file mode 100644 index b46b3327341..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/win32/win32common.dsw +++ /dev/null @@ -1,245 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Voice2Test"=..\..\Voice2\Voice2Test\Voice2Test.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/Voice2/Voice2Test", MPNDAAAA - ..\..\voice2\voice2test - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "chatc"=..\..\Chat\chatc\chatc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/Chat/chatc", RRUAAAAA - ..\..\chat\chatc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gcdkeyclient"=..\..\gcdkey\gcdkeyclient.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gcdkey", JIGAAAAA - ..\..\gcdkey - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gcdkeyserver"=..\..\gcdkey\gcdkeyserver.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gcdkey", JIGAAAAA - ..\..\gcdkey - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "ghttpc"=..\..\ghttp\ghttpc\ghttpc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp/ghttpc", BUZAAAAA - ..\..\ghttp\ghttpc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gptestc"=..\..\GP\gptestc\gptestc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/GP/gptestc", ZHJAAAAA - ..\..\gp\gptestc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gstats"=..\..\gstats\gstats.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gstats", BSGAAAAA - ..\..\gstats - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2testc"=..\..\gt2\gt2testc\gt2testc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2testc", LPOCAAAA - ..\..\gt2\gt2testc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "peerc"=..\..\Peer\peerc\peerc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/Peer/peerc", GSUAAAAA - ..\..\peer\peerc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "persisttest"=..\..\gstats\persisttest\persisttest.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gstats/persisttest", BBVAAAAA - ..\..\gstats\persisttest - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "pttestc"=..\..\pt\pttestc\pttestc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/pt/pttestc", KCGBAAAA - ..\..\pt\pttestc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "qr2csample"=..\..\qr2\qr2csample\qr2csample.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/qr2/qr2csample - ..\..\qr2\qr2csample - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "sbctest"=..\..\serverbrowsing\sbctest\sbctest.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/serverbrowsing/sbctest - ..\..\serverbrowsing\sbctest - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "simpletest"=..\..\natneg\simpletest\simpletest.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/natneg/simpletest", HFUCAAAA - ..\..\natneg\simpletest - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/common/win32 - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/X360Common.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/X360Common.c deleted file mode 100644 index 73586221b60..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/X360Common.c +++ /dev/null @@ -1,93 +0,0 @@ -#include "../gsCommon.h" -#include "../gsMemory.h" -#include "../gsDebug.h" -#include -// Debug output -#ifdef GSI_COMMON_DEBUG - static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - - { - GSI_UNUSED(theLevel); - { - static char string[256]; - vsprintf(string, theTokenStr, theParamList); - OutputDebugString(string); - } - } -#endif - -#if (_MSC_VER <= 1300) - //extern added for vc6 compatability. - extern void * __cdecl _aligned_malloc(size_t size, int boundary); - extern void * __cdecl _aligned_free(void * memblock); -#endif -void * gsiMemManagedInit() -{ -// Init the GSI memory manager (optional - for limiting GSI mem usage) -#if defined GSI_MEM_MANAGED - #define aMemoryPoolSize (1024*1024*4) - char *aMemoryPool = _aligned_malloc(aMemoryPoolSize,64); - if(aMemoryPool == NULL) - { - printf("Failed to create memory pool - aborting\r\n"); - return NULL; - } - { - gsMemMgrCreate(gsMemMgrContext_Default, "Default",aMemoryPool, aMemoryPoolSize); - } - return aMemoryPool; -#else - return NULL; -#endif - -} - -void gsiMemManagedClose(void * theMemoryPool) -{ - #if defined(GSI_MEM_MANAGED) - // Optional - Dump memory leaks - - gsi_u32 MemAvail = gsMemMgrMemAvailGet (gsMemMgrContext_Default); - gsi_u32 MemUsed = gsMemMgrMemUsedGet (gsMemMgrContext_Default); - gsi_u32 HwMark = gsMemMgrMemHighwaterMarkGet (gsMemMgrContext_Default); - - gsDebugFormat(GSIDebugCat_GP, GSIDebugType_Memory, GSIDebugLevel_Comment, - "MemAvail %u: MemUsed%u MemHWMark %u\n", MemAvail,MemUsed,HwMark); - gsMemMgrDumpStats(); - gsMemMgrDumpAllocations(); - gsMemMgrValidateMemoryPool(); - - #endif - _aligned_free(theMemoryPool); -} - - -// sample common entry point -extern int test_main(int argc, char ** argp); - - -// Common entry point -int __cdecl main(int argc, char** argp) -{ - int ret = 0; - // set up memanager - void *heap = gsiMemManagedInit(); - - #ifdef GSI_COMMON_DEBUG - // Set up debugging - gsSetDebugCallback(DebugCallback); - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Verbose); - #endif - - ret = test_main(argc, argp); - - gsiMemManagedClose(heap); - - return ret; -} - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/gsSocketX360.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/gsSocketX360.c deleted file mode 100644 index d3ee7036cc1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/gsSocketX360.c +++ /dev/null @@ -1,52 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(_X360) -char * inet_ntoa(IN_ADDR in_addr) -{ - static char buffer[16]; - sprintf(buffer, "%d.%d.%d.%d", in_addr.S_un.S_un_b.s_b1, in_addr.S_un.S_un_b.s_b2, - in_addr.S_un.S_un_b.s_b3, in_addr.S_un.S_un_b.s_b4); - return buffer; -} - -struct hostent * gethostbyname(const char* name) -{ - XNDNS *pxndns; - static HOSTENT host; - HOSTENT *rvalue; - - if(XNetDnsLookup(name, NULL, &pxndns) != 0) - return NULL; - - while (pxndns->iStatus == WSAEINPROGRESS) - { - msleep(5); - } - - if ((pxndns->iStatus == 0) && (pxndns->cina > 0)) - { - static char * ipPtrs[2]; - static IN_ADDR ip; - - host.h_name = (char*)name; - host.h_aliases = NULL; - host.h_addrtype = AF_INET; - host.h_length = (gsi_u16)sizeof(IN_ADDR); - host.h_addr_list = (gsi_i8 **)ipPtrs; - - ip = pxndns->aina[0]; - ipPtrs[0] = (char *)&ip; - ipPtrs[1] = NULL; - - rvalue = &host; - } - else - { - rvalue = NULL; - } - XNetDnsRelease(pxndns); - - return rvalue; -} -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/gsThreadX360.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/gsThreadX360.c deleted file mode 100644 index 281067434ba..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/x360/gsThreadX360.c +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../gsPlatformUtil.h" -#include "../gsPlatformThread.h" -#include "../gsAssert.h" -#include "../gsDebug.h" - - - -void gsiInitializeCriticalSection(GSICriticalSection *theCrit) { InitializeCriticalSection(theCrit); } -void gsiEnterCriticalSection (GSICriticalSection *theCrit) { EnterCriticalSection(theCrit); } -void gsiLeaveCriticalSection (GSICriticalSection *theCrit) { LeaveCriticalSection(theCrit); } -void gsiDeleteCriticalSection (GSICriticalSection *theCrit) { DeleteCriticalSection(theCrit); } - -gsi_u32 gsiHasThreadShutdown(GSIThreadID theThreadID) -{ - DWORD result = WaitForSingleObject(theThreadID, 0); - if (result == WAIT_ABANDONED || result == WAIT_OBJECT_0) - return 1; // thread is dead - else - return 0; // keep waiting -} - -GSISemaphoreID gsiCreateSemaphore(gsi_i32 theInitialCount, gsi_i32 theMaxCount, char* theName) -{ - GSISemaphoreID aSemaphore = CreateSemaphoreA(NULL, theInitialCount, theMaxCount, theName); - if (aSemaphore == NULL) - { - gsDebugFormat(GSIDebugCat_Common, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "Failed to create semaphore\r\n"); - } - return aSemaphore; -} - -// Waits for -- and signals -- the semaphore -gsi_u32 gsiWaitForSemaphore(GSISemaphoreID theSemaphore, gsi_u32 theTimeoutMs) -{ - DWORD result = WaitForSingleObject((HANDLE)theSemaphore, (DWORD)theTimeoutMs); - return (gsi_u32)result; -} - -// Allow other objects to access the semaphore -void gsiReleaseSemaphore(GSISemaphoreID theSemaphore, gsi_i32 theReleaseCount) -{ - ReleaseSemaphore(theSemaphore, theReleaseCount, NULL); -} - -void gsiCloseSemaphore(GSISemaphoreID theSemaphore) -{ - CloseHandle(theSemaphore); -} - - -int gsiStartThread(GSThreadFunc func, gsi_u32 theStackSize, void *arg, GSIThreadID * id) -{ - HANDLE handle; - DWORD threadID; - - // create the thread - handle = CreateThread(NULL, theStackSize, func, arg, 0, &threadID); - if(handle == NULL) - return -1; - - // store the id - *id = handle; - - return 0; -} - -void gsiCancelThread(GSIThreadID id) -{ - //there is no way to terminate a thread - //we should move to always signalling threads to close - GSI_UNUSED(id); -} - -void gsiExitThread(GSIThreadID id) -{ - GSI_UNUSED(id); -} - -void gsiCleanupThread(GSIThreadID id) -{ - CloseHandle(id); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/common/xbox/gsSocketXbox.c b/src/utils/mp_gpprof_server/libraries/gamespy/common/xbox/gsSocketXbox.c deleted file mode 100644 index 41ab79788dc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/common/xbox/gsSocketXbox.c +++ /dev/null @@ -1,12 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(_XBOX) -char * inet_ntoa(IN_ADDR in_addr) -{ - static char buffer[16]; - sprintf(buffer, "%d.%d.%d.%d", in_addr.S_un.S_un_b.s_b1, in_addr.S_un.S_un_b.s_b2, - in_addr.S_un.S_un_b.s_b3, in_addr.S_un.S_un_b.s_b4); - return buffer; -} -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/darray.c b/src/utils/mp_gpprof_server/libraries/gamespy/darray.c deleted file mode 100644 index 8821a8fc864..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/darray.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * - * File: darray.c - * --------------- - * David Wright - * 10/8/98 - * - * See darray.h for function descriptions - */ -#include -#include -#include "darray.h" - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 202, 260 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - -#ifdef _MFC_MEM_DEBUG -#define _CRTDBG_MAP_ALLOC 1 -#include -#endif - - -#define DEF_GROWBY 8 - -#ifdef _NO_NOPORT_H_ - #define gsimalloc malloc - #define gsifree free - #define gsirealloc realloc - #include "common/gsAssert.h" -#else - #include "nonport.h" //for gsimalloc/realloc/free/GS_ASSERT -#endif - - -// STRUCTURES -struct DArrayImplementation -{ - int count, capacity; - int elemsize; - int growby; - ArrayElementFreeFn elemfreefn; - void *list; //array of elements -}; - -// PROTOTYPES -static void *mylsearch(const void *key, void *base, int count, int size, - ArrayCompareFn comparator); -static void *mybsearch(const void *elem, void *base, int num, int elemsize, - ArrayCompareFn comparator, int *found); -// FUNCTIONS - -/* FreeElement - * Frees the element at position N in the array - */ -static void FreeElement(DArray array, int n) -{ - if (array->elemfreefn != NULL) - array->elemfreefn(ArrayNth(array,n)); -} - -/* ArrayGrow - * Reallocates the array to a new size, incresed by growby - */ -static void ArrayGrow(DArray array) -{ - GS_ASSERT(array->elemsize) // sanity check -mj Oct 31st - array->capacity += array->growby; - array->list = gsirealloc(array->list, (size_t) array->capacity * array->elemsize); - GS_ASSERT(array->list); -} - -/* SetElement - * Sets the element at pos to the contents of elem - */ -static void SetElement(DArray array, const void *elem, int pos) -{ - GS_ASSERT(array) // safety check -mj Oct 31st - GS_ASSERT(elem) - GS_ASSERT(array->elemsize) - - memcpy(ArrayNth(array,pos), elem, (size_t)array->elemsize); -} - -DArray ArrayNew(int elemSize, int numElemsToAllocate, - ArrayElementFreeFn elemFreeFn) -{ - DArray array; - - array = (DArray) gsimalloc(sizeof(struct DArrayImplementation)); - GS_ASSERT(array); - GS_ASSERT(elemSize); - if (numElemsToAllocate == 0) - numElemsToAllocate = DEF_GROWBY; - array->count = 0; - array->capacity = numElemsToAllocate;; - array->elemsize = elemSize; - array->growby = numElemsToAllocate; - array->elemfreefn = elemFreeFn; - if (array->capacity != 0) - { - array->list = gsimalloc((size_t)array->capacity * array->elemsize); - GS_ASSERT(array->list); - } else - array->list = NULL; - - return array; -} - -void ArrayFree(DArray array) -{ - int i; - - GS_ASSERT(array); - for (i = 0; i < array->count; i++) - { - FreeElement(array, i); - } - // mj to do: move these asserts into gsi_free. maybe, depends on whether user overloads them - GS_ASSERT(array->list) - GS_ASSERT(array) - gsifree(array->list); - gsifree(array); -} - -void *ArrayGetDataPtr(DArray array) -{ - GS_ASSERT(array); - return array->list; -} - -void ArraySetDataPtr(DArray array, void *ptr, int count, int capacity) -{ - int i; - - GS_ASSERT(array); - if (array->list != NULL) - { - for (i = 0; i < array->count; i++) - { - FreeElement(array, i); - } - gsifree(array->list); - } - array->list = ptr; - array->count = count; - array->capacity = capacity; - -} - - -int ArrayLength(const DArray array) -{ - GS_ASSERT(array) - return array->count; -} - -void *ArrayNth(DArray array, int n) -{ - // 2004.Nov.16.JED - modified GS_ASSERT to include "if" to add robustness - GS_ASSERT( (n >= 0) && (n < array->count)); - if( ! ((n >= 0) && (n < array->count)) ) - return NULL; - - return (char *)array->list + array->elemsize*n; -} - -/* ArrayAppend - * Just do an Insert at the end of the array - */ -void ArrayAppend(DArray array, const void *newElem) -{ - GS_ASSERT(array); - if(array) - ArrayInsertAt(array, newElem, array->count); -} - -void ArrayInsertAt(DArray array, const void *newElem, int n) -{ - GS_ASSERT (array) - GS_ASSERT ( (n >= 0) && (n <= array->count)); - - if (array->count == array->capacity) - ArrayGrow(array); - array->count++; - if (n < array->count - 1) //if we aren't appending - memmove(ArrayNth(array, n+1), ArrayNth(array,n), - (size_t)(array->count - 1 - n) * array->elemsize); - SetElement(array, newElem, n); -} - -void ArrayInsertSorted(DArray array, const void *newElem, ArrayCompareFn comparator) -{ - int n; - void *res; - int found; - - GS_ASSERT (array) - GS_ASSERT (comparator); - - res=mybsearch(newElem, array->list, array->count, array->elemsize, comparator, &found); - n = (((char *)res - (char *)array->list) / array->elemsize); - ArrayInsertAt(array, newElem, n); -} - - -void ArrayRemoveAt(DArray array, int n) -{ - GS_ASSERT (array) - GS_ASSERT( (n >= 0) && (n < array->count)); - - if (n < array->count - 1) //if not last element - memmove(ArrayNth(array,n),ArrayNth(array,n+1), - (size_t)(array->count - 1 - n) * array->elemsize); - array->count--; -} - -void ArrayDeleteAt(DArray array, int n) -{ - GS_ASSERT (array) - GS_ASSERT ( (n >= 0) && (n < array->count)); - - FreeElement(array,n); - ArrayRemoveAt(array, n); -} - - -void ArrayReplaceAt(DArray array, const void *newElem, int n) -{ - GS_ASSERT (array) - GS_ASSERT ( (n >= 0) && (n < array->count)); - - FreeElement(array, n); - SetElement(array, newElem,n); -} - - -void ArraySort(DArray array, ArrayCompareFn comparator) -{ - GS_ASSERT (array) - qsort(array->list, (size_t)array->count, (size_t)array->elemsize, comparator); -} - -//GS_ASSERT will be raised by ArrayNth if fromindex out of range -int ArraySearch(DArray array, const void *key, ArrayCompareFn comparator, - int fromIndex, int isSorted) -{ - void *res; - int found = 1; - if (!array || array->count == 0) - return NOT_FOUND; - - if (isSorted) - res=mybsearch(key, ArrayNth(array,fromIndex), - array->count - fromIndex, array->elemsize, comparator, &found); - else - res=mylsearch(key, ArrayNth(array, fromIndex), - array->count - fromIndex, array->elemsize, comparator); - if (res != NULL && found) - return (((char *)res - (char *)array->list) / array->elemsize); - else - return NOT_FOUND; -} - - -void ArrayMap(DArray array, ArrayMapFn fn, void *clientData) -{ - int i; - - GS_ASSERT (array) - GS_ASSERT(fn); - - for (i = 0; i < array->count; i++) - fn(ArrayNth(array,i), clientData); - -} - -void ArrayMapBackwards(DArray array, ArrayMapFn fn, void *clientData) -{ - int i; - - GS_ASSERT(fn); - - for (i = (array->count - 1) ; i >= 0 ; i--) - fn(ArrayNth(array,i), clientData); - -} - -void * ArrayMap2(DArray array, ArrayMapFn2 fn, void *clientData) -{ - int i; - void * pcurr; - - GS_ASSERT(fn); - GS_ASSERT(clientData); - - for (i = 0; i < array->count; i++) - { - pcurr = ArrayNth(array,i); - if(!fn(pcurr, clientData)) - return pcurr; - } - - return NULL; -} - -void * ArrayMapBackwards2(DArray array, ArrayMapFn2 fn, void *clientData) -{ - int i; - void * pcurr; - - GS_ASSERT(fn); - GS_ASSERT(clientData); - - for (i = (array->count - 1) ; i >= 0 ; i--) - { - pcurr = ArrayNth(array,i); - if(!fn(pcurr, clientData)) - return pcurr; - } - - return NULL; -} - -void ArrayClear(DArray array) -{ - int i; - - // This could be more optimal! - ////////////////////////////// - for(i = (ArrayLength(array) - 1) ; i >= 0 ; i--) - ArrayDeleteAt(array, i); -} - -/* mylsearch - * Implementation of a standard linear search on an array, since we - * couldn't use lfind - */ -static void *mylsearch(const void *key, void *base, int count, int size, - ArrayCompareFn comparator) -{ - int i; - GS_ASSERT(key); - GS_ASSERT(base); - for (i = 0; i < count; i++) - { - if (comparator(key, (char *)base + size*i) == 0) - return (char *)base + size*i; - } - return NULL; -} - -/* mybsearch - * Implementation of a bsearch, since its not available on all platforms - */ -static void *mybsearch(const void *elem, void *base, int num, int elemsize, ArrayCompareFn comparator, int *found) -{ - int L, H, I, C; - - GS_ASSERT(elem); - GS_ASSERT(base); - GS_ASSERT(found); - - L = 0; - H = num - 1; - *found = 0; - while (L <= H) - { - I = (L + H) >> 1; - C = comparator(((char *)base) + I * elemsize,elem); - if (C == 0) - *found = 1; - if (C < 0) - L = I + 1; - else - { - H = I - 1; - } - } - return ((char *)base) + L * elemsize; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/darray.h b/src/utils/mp_gpprof_server/libraries/gamespy/darray.h deleted file mode 100644 index ad84b13f3bd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/darray.h +++ /dev/null @@ -1,317 +0,0 @@ -#ifndef _DARRAY_H -#define _DARRAY_H - -/* File: darray.h - * -------------- - * Defines the interface for the DynamicArray ADT. - * The DArray allows the client to store any number of elements of any desired - * base type and is appropriate for a wide variety of storage problems. It - * supports efficient element access, and appending/inserting/deleting elements - * as well as optional sorting and searching. In all cases, the DArray imposes - * no upper bound on the number of elements and deals with all its own memory - * management. The client specifies the size (in bytes) of the elements that - * will be stored in the array when it is created. Thereafter the client and - * the DArray can refer to elements via (void*) ptrs. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* Type: DArray - * ---------------- - * Defines the DArray type itself. The client can declare variables of type - * DArray, but these variables must be initialized with the result of ArrayNew. - * The DArray is implemented with pointers, so all client copies in variables - * or parameters will be "shallow" -- they will all actually point to the - * same DArray structure. Only calls to ArrayNew create new arrays. - * The struct declaration below is "incomplete"- the implementation - * details are literally not visible in the client .h file. - */ -typedef struct DArrayImplementation *DArray; - - -/* ArrayCompareFn - * -------------- - * ArrayCompareFn is a pointer to a client-supplied function which the - * DArray uses to sort or search the elements. The comparator takes two - * (const void*) pointers (these will point to elements) and returns an int. - * The comparator should indicate the ordering of the two elements - * using the same convention as the strcmp library function: - * If elem1 is "less than" elem2, return a negative number. - * If elem1 is "greater than" elem2, return a positive number. - * If the two elements are "equal", return 0. - */ -#if defined(WIN32) - typedef int (__cdecl *ArrayCompareFn)(const void *elem1, const void *elem2); -#else - typedef int (*ArrayCompareFn)(const void *elem1, const void *elem2); -#endif - - -/* ArrayMapFn - * ---------- - * ArrayMapFn defines the space of functions that can be used to map over - * the elements in a DArray. A map function is called with a pointer to - * the element and a client data pointer passed in from the original - * caller. - */ -typedef void (*ArrayMapFn)(void *elem, void *clientData); - -/* ArrayMapFn2 - * ----------_ - * Same as ArrayMapFn, but can return 0 to stop the mapping. - * Used by ArrayMap2 - */ -typedef int (*ArrayMapFn2)(void *elem, void *clientData); - - /* ArrayElementFreeFn - * ------------------ - * ArrayElementFreeFn defines the space of functions that can be used as the - * clean-up function for an element as it is deleted from the array - * or when the entire array of elements is freed. The cleanup function is - * called with a pointer to an element about to be deleted. - */ -typedef void (*ArrayElementFreeFn)(void *elem); - - -/* ArrayNew - * -------- - * Creates a new DArray and returns it. There are zero elements in the array. - * to start. The elemSize parameter specifies the number of bytes that a single - * element of this array should take up. For example, if you want to store - * elements of type Binky, you would pass sizeof(Binky) as this parameter. - * An assert is raised if the size is not greater than zero. - * - * The numElemsToAllocate parameter specifies the initial allocated length - * of the array, as well as the dynamic reallocation increment for when the - * array grows. Rather than growing the array one element at a time as - * elements are added (which is rather inefficient), you will grow the array - * in chunks of numElemsToAllocate size. The "allocated length" is the number - * of elements that have been allocated, the "logical length" is the number of - * those slots actually being currently used. - * - * A new array is initially allocated to the size of numElemsToAllocate, the - * logical length is zero. As elements are added, those allocated slots fill - * up and when the initial allocation is all used, grow the array by another - * numElemsToAllocate elements. You will continue growing the array in chunks - * like this as needed. Thus the allocated length will always be a multiple - * of numElemsToAllocate. Don't worry about using realloc to shrink the array - * allocation if many elements are deleted from the array. It turns out that - * many implementations of realloc don't even pay attention to such a request - * so there is little point in asking. Just leave the array over-allocated. - * - * The numElemsToAllocate is the client's opportunity to tune the resizing - * behavior for their particular needs. If constructing large arrays, - * specifying a large allocation chunk size will result in fewer resizing - * operations. If using small arrays, a small allocation chunk size will - * result in less space going unused. If the client passes 0 for - * numElemsToAllocate, the implementation will use the default value of 8. - * - * The elemFreeFn is the function that will be called on an element that - * is about to be deleted (using ArrayDeleteAt) or on each element in the - * array when the entire array is being freed (using ArrayFree). This function - * is your chance to do any deallocation/cleanup required for the element - * (such as freeing any pointers contained in the element). The client can pass - * NULL for the cleanupFn if the elements don't require any handling on free. - */ -DArray ArrayNew(int elemSize, int numElemsToAllocate, - ArrayElementFreeFn elemFreeFn); - - - - /* ArrayFree - * ---------- - * Frees up all the memory for the array and elements. It DOES NOT - * automatically free memory owned by pointers embedded in the elements. - * This would require knowledge of the structure of the elements which the - * DArray does not have. However, it will iterate over the elements calling - * the elementFreeFn earlier supplied to ArrayNew and therefore, the client, - * who knows what the elements are, can do the appropriate deallocation of any - * embedded pointers through that function. After calling this, the value of - * what array is pointing to is undefined. - */ -void ArrayFree(DArray array); - - -/* ArrayLength - * ----------- - * Returns the logical length of the array, i.e. the number of elements - * currently in the array. Must run in constant time. - */ -int ArrayLength(const DArray array); - - -/* ArrayNth - * -------- - * Returns a pointer to the element numbered n in the specified array. - * Numbering begins with 0. An assert is raised if n is less than 0 or greater - * than the logical length minus 1. Note this function returns a pointer into - * the DArray's element storage, so the pointer should be used with care. - * This function must operate in constant time. - * - * We could have written the DArray without this sort of access, but it - * is useful and efficient to offer it, although the client needs to be - * careful when using it. In particular, a pointer returned by ArrayNth - * becomes invalid after any calls which involve insertion, deletion or - * sorting the array, as all of these may rearrange the element storage. - */ -void *ArrayNth(DArray array, int n); - - -/* ArrayAppend - * ----------- - * Adds a new element to the end of the specified array. The element is - * passed by address, the element contents are copied from the memory pointed - * to by newElem. Note that right after this call, the new element will be - * the last in the array; i.e. its element number will be the logical length - * minus 1. This function must run in constant time (neglecting - * the memory reallocation time which may be required occasionally). - */ -void ArrayAppend(DArray array, const void *newElem); - -/* ArrayInsertAt - * ------------- - * Inserts a new element into the array, placing it at the position n. - * An assert is raised if n is less than 0 or greater than the logical length. - * The array elements after position n will be shifted over to make room. The - * element is passed by address, the new element's contents are copied from - * the memory pointed to by newElem. This function runs in linear time. - */ -void ArrayInsertAt(DArray array, const void *newElem, int n); - -/* ArrayInsertSorted - * ------------- - * Inserts a new element into the array, placing it at the position indicated by - * a binary search of the array using comparator. - * The array MUST be sorted prior to calling InsertSorted. - * Note that if you only ever call InsertSorted, the array will always be sorted. - */ -void ArrayInsertSorted(DArray array, const void *newElem, ArrayCompareFn comparator); - - /* ArrayDeleteAt - * ------------- - * Deletes the element numbered n from the array. Before being removed, - * the elemFreeFn that was supplied to ArrayNew will be called on the element. - * An assert is raised if n is less than 0 or greater than the logical length - * minus one. All the elements after position n will be shifted over to fill - * the gap. This function runs in linear time. It does not shrink the - * allocated size of the array when an element is deleted, the array just - * stays over-allocated. - */ -void ArrayDeleteAt(DArray array, int n); - - /* ArrayDeleteAt - * ------------- - * Removes the element numbered n from the array. The element will not be freed - * before being removed. All the elements after position n will be shifted over to fill - * the gap. This function runs in linear time. It does not shrink the - * allocated size of the array when an element is deleted, the array just - * stays over-allocated. - */ -void ArrayRemoveAt(DArray array, int n); - -/* ArrayReplaceAt - * ------------- - * Overwrites the element numbered n from the array with a new value. Before - * being overwritten, the elemFreeFn that was supplied to ArrayNew is called - * on the old element. Then that position in the array will get a new value by - * copying the new element's contents from the memory pointed to by newElem. - * An assert is raised if n is less than 0 or greater than the logical length - * minus one. None of the other elements are affected or rearranged by this - * operation and the size of the array remains constant. This function must - * operate in constant time. - */ -void ArrayReplaceAt(DArray array, const void *newElem, int n); - - -/* ArraySort - * --------- - * Sorts the specified array into ascending order according to the supplied - * comparator. The numbering of the elements will change to reflect the - * new ordering. An assert is raised if the comparator is NULL. - */ -void ArraySort(DArray array, ArrayCompareFn comparator); - - -#define NOT_FOUND -1 // returned when a search fails to find the key - -/* ArraySearch - * ----------- - * Searches the specified array for an element whose contents match - * the element passed as the key. Uses the comparator argument to test - * for equality. The "fromIndex" parameter controls where the search - * starts looking from. If the client desires to search the entire array, - * they should pass 0 as the fromIndex. The function will search from - * there to the end of the array. The "isSorted" parameter allows the client - * to specify that the array is already in sorted order, and thus it uses a - * faster binary search. If isSorted is false, a simple linear search is - * used. If a match is found, the position of the matching element is returned - * else the function returns NOT_FOUND. Calling this function does not - * re-arrange or change contents of DArray or modify the key in any way. - * An assert is raised if fromIndex is less than 0 or greater than - * the logical length (although searching from logical length will never - * find anything, allowing this case means you can search an entirely empty - * array from 0 without getting an assert). An assert is raised if the - * comparator is NULL. - */ -int ArraySearch(DArray array, const void *key, ArrayCompareFn comparator, - int fromIndex, int isSorted); - - -/* ArrayMap - * ----------- - * Iterates through each element in the array in order (from element 0 to - * element n-1) and calls the function fn for that element. The function is - * called with the address of the array element and the clientData pointer. - * The clientData value allows the client to pass extra state information to - * the client-supplied function, if necessary. If no client data is required, - * this argument should be NULL. An assert is raised if map function is NULL. - */ -void ArrayMap(DArray array, ArrayMapFn fn, void *clientData); - -/* ArrayMapBackwards - * ----------- - * Same as ArrayMap, but goes through the array from end to front. This - * makes it safe to free elements during the mapping. - */ -void ArrayMapBackwards(DArray array, ArrayMapFn fn, void *clientData); - -/* ArrayMap2 - * ----------- - * Same as ArrayMap, but allows the mapping to be stopped by returning 0 - * from the mapping function. If the mapping was stopped, the element - * it was stopped at will be returned. If it wasn't stopped, then NULL - * will be returned. - */ -void * ArrayMap2(DArray array, ArrayMapFn2 fn, void *clientData); - -/* ArrayMapBackwards2 - * ------------ - * Goes through the array backwards, and allows you to stop the mapping. - */ -void * ArrayMapBackwards2(DArray array, ArrayMapFn2 fn, void *clientData); - -/* ArrayClear - * ----------- - * Deletes all elements in the array, but without freeing the array. - */ -void ArrayClear(DArray array); - -/* ArrayGetDataPtr - * ----------- - * Obtain the pointer to the actual data storage - */ -void *ArrayGetDataPtr(DArray array); - -/* ArraySetDataPtr - * ----------- - * Set the pointer to the actual data storage, which must be allocated with malloc - */ -void ArraySetDataPtr(DArray array, void *ptr, int count, int capacity); - -#ifdef __cplusplus -} -#endif - -#endif //_DARRAY_ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/changelog.txt deleted file mode 100644 index b6ba926fb14..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/changelog.txt +++ /dev/null @@ -1,156 +0,0 @@ -Changelog for: GameSpy HTTP SDK --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -12-12-2007 1.11.00 RMV RELEASE Released to Developer Site -12-12-2007 1.10.05 RMV FIX Updated ghttpStreamEx call in ghttpc.c to use a URL requiring Nintendo certification, since it - uses REVOEXSSL -11-27-2007 1.10.04 SAH FIX Fixed bug where hostname lookup thread wasn't cancelled if request was - SAH CLEANUP Moved extern "c" block below includes to prevent linker errors -11-12-2007 1.10.03 SAH FIX Incorporated Nintendo suggestions for Built-in RevoEX SSL Certification -10-08-2007 1.10.02 BED RELEASE Limited Release -10-03-2007 1.10.02 BED FIX Switched use of GS_ASSERT(0) with GS_FAIL() -10-01-2007 1.10.01 BED FEATURE Added RevoEX SSL support -08-06-2007 1.10.00 RMV RELEASE Released to Developer Site -07-18-2007 1.09.03 SAH FIX Rolled back version of ghttpProcess to use stack allocation - DS changes were causing socket errors. -07-16-2007 1.09.02 RMV FIX Fixed URL for getting header in ghttpc -07-11-2007 1.09.02 RMV FIX Fixed ghttpc/ghttpmfc Project files to get rid of Unicode warnings and fixed other compiler warnings -04-19-2007 1.09.01 SAH FIX Fixed ghiDoReceivingHeaders/File to support DS limited stack size - uses heap allocation now. -03-05-2007 1.09.00 SAH RELEASE Released to Developer Site -03-02-2007 1.08.06 SN FIX Fixed some compiler warnings for code warrior -02-22-2007 1.08.05 SN FIX Changed parts of code that used strdup to use goastrdup -01-22-2007 1.08.04 SAH FIX Fixed unicode-specific bug for PostAddFileFromMemory -01-16-2007 1.08.03 DES FEATURE Added X360 support -01-04-2007 1.08.02 BED FIX Fixed PS3 Byte order bug in encryption algorithm -12-19-2006 1.08.01 BED FEATURE Added support for Unicode file names when saving to disk. -12-15-2006 1.08.00 MJW RELEASE Released to Developer Site -11-28-2006 1.07.49 SAH FIX Fixed previous change, postWaitContinue set to true for soap messages only -11-13-2006 1.07.48 SAH FIX Rolled back the 1.07.37 change, set postWaitContinue to FALSE. -11-10-2006 1.07.47 JR RELEASE Limited release -10-23-2006 1.07.47 DES RELEASE Limited release -10-05-2006 1.07.47 SAH FIX Updated MacOSX Makefile -09-28-2006 1.07.46 SAH FIX Fixed PS3 project to work with PS3 095.00x SDK; changed included libaries in linker input. -08-24-2006 1.07.45 SAH FIX Fixed VC7 project file -08-04-2006 1.07.44 SN FIX Fixed asynchronous DNS lookup code: removed unnecessary memory allocation -08-02-2006 1.07.43 SAH RELEASE Releasing to developer site -07-31-2006 1.07.43 SAH FIX Fixed PS3 project file - added post-build step to create *.SELF for execution -07-25-2006 1.07.42 SAH FIX Fixed NITRO project, include for crt0.o now above others so it add correct file -07-07-2006 1.07.41 SAH FIX Fixed HTTP DNS cleanup - needed to explicitly free handle pointer memory -07-06-2006 1.07.40 SAH FIX Fixed PSP project file to not explicitly include the PSP linker file -07-05-2006 1.07.39 SAH FIX Fixed postWaitContinue functionality to remain false when waiting - SAH FIX Fixed log call define -06-30-2006 1.07.38 SAH FIX Fixed Linux makefile -06-30-2006 1.07.37 SAH FIX Uncommented postWaitContinue if statement (caused extra newline sent in posts) - SAH FIX Fixed Nitro project file & linker command file to work with CW 2.0/NitroSDK 3.1 -06-20-2006 1.07.36 SAH FEATURE Added asynchronous DNS lookup for LINUX (pthreads) - SAH OTHER Added some more debugging statements for failed host lookups - SAH FIX Fixed Linux makefile - added "-lpthread" compiler option for asynch DNS -06-09-2006 1.07.35 SAH FEATURE Added asynchronous DNS lookup support for WIN32 (multi-threaded) -05-31-2006 1.07.34 SAH RELEASE Releasing to developer site -05-25-2006 1.07.33 SAH FIX Added GSI_UNUSED calls to get rid of PSP warnings - SAH FIX Changed PSP project warning levels - SAH FIX Fixed PS3 project to compile with 084_001 SDK -05-24-2006 1.07.32 SAH FIX Uncommented secure page test in gptestc.c -05-19-2006 1.07.31 SAH FIX Added gsTestMain.c to nitro CodeWarrior Project -05-18-2006 1.07.30 BED FIX Fixed bug with byte alignment for SSL on DS/PS3 - BED FIX Fixed bug where a line was mistakenly removed from previous version. -05-18-2006 1.07.29 DES RELEASE Limited developer release -05-18-2006 1.07.29 SAH FIX Added a check in ghiDoSend to ensure buffer != NULL and len != 0 -05-15-2006 1.07.28 SAH FIX Added "PS3 Release" configuration to project -05-08-2006 1.07.27 SAH FIX Fixed PS2 Project file (was missing gsXML) -05-02-2006 1.07.26 BED FIX Removed "expect continue" functionality that (may have) caused issues with some UK web proxies. -04-25-2006 1.07.25 SAH RELEASE Releasing to developer site -04-24-2006 1.07.25 SAH FIX added typecasts, fixed #includes to get rid of warnings in CW -04-20-2006 1.07.24 SAH FIX got rid of unused variables, switched GSI_USUNUSED above the returns -04-19-2006 1.07.23 SAH FIX Bill switched some byte ordering for PS3 compatibility -04-18-2006 1.07.22 SAH FIX Added || defined(_PS3) for PS3 support -04-13-2006 1.07.21 SAH FIX Replaced all (rcode == SOCKET_ERROR) w/ (gsiSocketIsError(rcode)) -02-21-2006 1.07.20 BED OTHER Adjusted debug output level for http continue. -01-26-2006 1.07.19 SN FIX Added psp to the test_main definition - SN OTHER Added and updated psp prodg project and solution -01-26-2006 1.07.18 BED FIX Added error checking between REQUEST and POST. - BED OTHER HTTPS requests now default to GameSpy SSL encryptor. - BED FIX Fixed an efficiency bug with plain text posts. -01-20-2006 1.07.17 BED FEATURE Added support for DIME attachments. -01-13-2006 1.07.16 BED FEATURE Added ghttpPostAddXml to support http soap requests. -12-16-2005 1.07.15 SN OTHER Cleaned up project files and added missing common code if any -11-17-2005 1.07.15 DES FIX Updated Nitro makefile. -11-14-2005 1.07.14 DES FIX Updated the makefiles and project files. - DES FIX Fixed a few minor HTTPS bugs. - DES FEATURE Updated MFC sample to work with HTTPS. -09-23-2005 1.07.13 DES FEATURE Updated DS support -07-28-2005 1.07.12 SN RELEASE Releasing to developer site. -07-28-2005 1.07.12 SN FEATURE Added HTTP SSL common code to projects -06-03-2005 1.07.11 SN RELEASE Releasing to developer site. -06-01-2004 1.07.11 SN FIX Fixed the function ghiParseStatus to find the status string after it checks for correct header information. -05-09-2005 1.07.10 BED FEATURE Added ghttpCloseRequest to handle graceful shutdowns -05-08-2005 1.07.09 DES FIX CompletedCallback now gets the file length for Save and Stream requests. -05-05-2005 1.07.08 BED FIX Updated project files to use new common folder -04-29-2005 1.07.07 SN OTHER Created Visual Studio .NET projects -04-28-2005 1.07.07 SN RELEASE Releasing to developer site. -04-27-2005 1.07.07 DES RELEASE Limited release to Nintendo DS developers. -04-25-2005 1.07.07 DES FEATURE Added debug logging. - DES CLEANUP Removed old commented-out code. - DES CLEANUP General cleanup of ghttpc. -04-12-2005 1.07.06 BED FIX Fixed bug where User-Agent header could appear twice. -04-04-2005 1.07.05 SN RELEASE Releasing to developer site. -03-29-2005 1.07.05 DES FIX Fixed warnings for internal functions -03-14-2005 1.07.04 DES FEATURE Nintendo DS support -01-12-2004 1.07.03 BED FIX Was missing a #ifdef around matrixssl.h -12-20-2004 1.07.02 BED FIX Fixed ghttpGetHeaders with SSL support. -12-06-2004 1.07.01 BED FEATURE Added initial support for SSL connections. -11-19-2004 1.07.00 DDW FEATURE Added internal support for persistent server connections -09-16-2004 1.06.25 SN RELEASE Releasing to developer site. -08-27-2004 1.06.25 DES CLEANUP Removed MacOS style includes - DES CLEANUP General Unicode cleanup - DES CLEANUP Updated Win32 project configurations - DES CLEANUP Fixed warnings under OSX - DES CLEANUP Updated OSX Makefile -08-13-2004 1.06.24 SN FIX Changed asserts in ghiParseProxyServer to reflect the correct checks on parameters -08-04-2004 1.06.23 SN RELEASE Releasing to developer site. -07-19-2004 1.06.23 SN FIX Updated code with explicit casts to remove implicit cast error - when compiling at highest level and warnings treated as errors. -06-18-2004 1.06.22 BED RELEASE Releasing to developer site. -06-17-2004 1.06.22 BED FIX ghttpc sample no longer builds UNICODE mode by default - BED FEATURE Added PS2 Insock support -01-26-2004 1.06.21 BED FEATURE Added the ability to set a "proxy override" on each request. -11-10-2003 1.06.20 DES RELEASE Releasing to developer site. -11-07-2003 1.06.20 DES FIX Updated the linux makefile. -10-21-2003 1.06.19 BED RELEASE Releasing to developer site. (UNIQUE NICK AND UNICODE SUPPORT) -10-20-2003 1.06.19 BED FEATURE Added ghttpSetMaxRecvTime() to prevent async downloads from blocking in special cases -01-05-2003 1.06.18 JED FEATURE Added download size checking and GHTTPFileToBig error code -09-30-2003 1.06.17 BED FEATURE Modified sample app to check (result < 0) instead of (result == -1) to handle additional error codes. -09-16-2003 1.06.16 JED FIX Added stringutil.c/h incudes to ghttp.dsp -09-08-2003 1.06.15 BED FEATURE Added wrapper for UNICODE support. (Two byte UNICODE converted to single byte ASCII) - BED FEATURE Added new return status "GHTTPFileIncomplete" to notify of a partial or interrupted download - BED FEATURE Added extra error return codes per JED request. To enable these define GHTTP_EXTENDEDERROR -07-24-2003 1.06.14 DES RELEASE Releasing to developer site. -07-18-2003 1.06.14 BED FEATURE Added CodeWarrior (PS2) sample project file. - BED CLEANUP General cleanup to remove CodeWarrior warnings. -07-17-2003 1.06.13 DES CLEANUP Cleaned up the PS2 Makefile, it now uses Makefile.commmon. -07-16-2003 1.06.12 DES FIX Changed a __mips64 checks to a _PS2 check. - BED FEATURE Added ProDG sample project files. -07-15-2003 1.06.11 DES RELEASE Releasing to developer site. -07-10-2003 1.06.11 BED FIX Added newline to end of file to prevent compiler warning. -05-09-2003 1.06.10 DES CLEANUP Removed Dreamcast support. - FIX Metrowerks for Win32 is no longer falsely identified as MacOS. -04-15-2003 1.06.09 JED CLEANUP More cleanup to remove a few DevStudio Level4 warnings -03-03-2003 1.06.08 DES CLEANUP General cleanup to remove warnings. -01-28-2003 1.06.07 DES FIX Fixed a bug which could cause a request to fail if a 1xx (Continue) - status response was received (common when posting). - CLEANUP Changed posting code to send no more than 32K in a single send() call. - Win98 was having trouble dealing with large blocks of data. -01-23-2003 1.06.06 DES FIX Replaced a malloc with gsimalloc. -01-15-2003 1.06.05 DES FIX Fixed a crashing bug involving parsing received data that started - with the last byte of a chunk header. -12-19-2002 1.06.04 DES RELEASE Releasing to developer site. -12-19-2002 1.06.04 DES CLEANUP Removed assert.h include. -12-16-2002 1.06.03 DES CLEANUP Removed call to GOAClearSocketError. -12-13-2002 1.06.02 DES FEATURE Added PS2 eenet stack support. - CLEANUP Cleaned up code to remove PS2 compiler warnings. -11-14-2002 1.06.01 DES FIX Send "Connection: close" in request header to be 1.1 compliant - FIX Fixed bug with reading end of chunked header - OTHER Removed "#if 1" block from around chunked transfer code - OTHER Each connection gets a unique ID (for debugging, not exposed in API) -09-25-2002 1.06.00 DDW OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.dsp deleted file mode 100644 index a1899677bb1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.dsp +++ /dev/null @@ -1,284 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ghttp" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=ghttp - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ghttp.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ghttp.mak" CFG="ghttp - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ghttp - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "ghttp - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/ghttp", PHXAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ghttp - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "ghttp - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "ghttp - Win32 Release" -# Name "ghttp - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\ghttpBuffer.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpCallbacks.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpCommon.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpConnection.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpEncryption.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpMain.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpPost.c -# End Source File -# Begin Source File - -SOURCE=.\ghttpProcess.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ghttp.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpBuffer.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpCallbacks.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpCommon.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpConnection.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpEncryption.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpMain.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpPost.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpProcess.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsCrypt.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsCrypt.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsLargeInt.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsLargeInt.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsRC4.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsRC4.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsSHA1.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsSHA1.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsSSL.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsSSL.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsStringUtil.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\changelog.txt -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.dsw deleted file mode 100644 index 6aa040dfac0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.dsw +++ /dev/null @@ -1,69 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "ghttp"=.\ghttp.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp", PHXAAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "ghttpc"=.\ghttpc\ghttpc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp/ghttpc", BUZAAAAA - .\ghttpc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "ghttpmfc"=.\ghttpmfc\ghttpmfc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp/ghttpmfc", PUZAAAAA - .\ghttpmfc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp", PHXAAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.h deleted file mode 100644 index 8e72c503ac3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp.h +++ /dev/null @@ -1,644 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTP_H_ -#define _GHTTP_H_ - -#include - -#include "../common/gsCommon.h" -#include "../common/gsXML.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef GSI_UNICODE -#define ghttpGet ghttpGetA -#define ghttpGetEx ghttpGetExA -#define ghttpSave ghttpSaveA -#define ghttpSaveEx ghttpSaveExA -#define ghttpStream ghttpStreamA -#define ghttpStreamEx ghttpStreamExA -#define ghttpHead ghttpHeadA -#define ghttpHeadEx ghttpHeadExA -#define ghttpPost ghttpPostA -#define ghttpPostEx ghttpPostExA -#define ghttpPostAddString ghttpPostAddStringA -#define ghttpPostAddFileFromDisk ghttpPostAddFileFromDiskA -#define ghttpPostAddFileFromMemory ghttpPostAddFileFromMemoryA -#else -#define ghttpGet ghttpGetW -#define ghttpGetEx ghttpGetExW -#define ghttpSave ghttpSaveW -#define ghttpSaveEx ghttpSaveExW -#define ghttpStream ghttpStreamW -#define ghttpStreamEx ghttpStreamExW -#define ghttpHead ghttpHeadW -#define ghttpHeadEx ghttpHeadExW -#define ghttpPost ghttpPostW -#define ghttpPostEx ghttpPostExW -#define ghttpPostAddString ghttpPostAddStringW -#define ghttpPostAddFileFromDisk ghttpPostAddFileFromDiskW -#define ghttpPostAddFileFromMemory ghttpPostAddFileFromMemoryW -#endif - -// Boolean. -/////////// -typedef enum -{ - GHTTPFalse, - GHTTPTrue -} GHTTPBool; - -// ByteCount. -///////////// -#if (GSI_MAX_INTEGRAL_BITS >= 64) -typedef gsi_i64 GHTTPByteCount; -#else -typedef gsi_i32 GHTTPByteCount; -#endif - -// The current state of an http request. -//////////////////////////////////////// -typedef enum -{ - GHTTPSocketInit, // Socket creation and initialization. - GHTTPHostLookup, // Resolving hostname to IP (asynchronously if possible). - GHTTPLookupPending, // Asychronous DNS lookup pending. - GHTTPConnecting, // Waiting for socket connect to complete. - GHTTPSecuringSession, // Setup secure channel. - GHTTPSendingRequest, // Sending the request. - GHTTPPosting, // Positing data (skipped if not posting). - GHTTPWaiting, // Waiting for a response. - GHTTPReceivingStatus, // Receiving the response status. - GHTTPReceivingHeaders, // Receiving the headers. - GHTTPReceivingFile // Receiving the file. -} GHTTPState; - -// The result of an http request. -///////////////////////////////// -typedef enum -{ - GHTTPSuccess, // 0: Successfully retrieved file. - GHTTPOutOfMemory, // 1: A memory allocation failed. - GHTTPBufferOverflow, // 2: The user-supplied buffer was too small to hold the file. - GHTTPParseURLFailed, // 3: There was an error parsing the URL. - GHTTPHostLookupFailed, // 4: Failed looking up the hostname. - GHTTPSocketFailed, // 5: Failed to create/initialize/read/write a socket. - GHTTPConnectFailed, // 6: Failed connecting to the http server. - GHTTPBadResponse, // 7: Error understanding a response from the server. - GHTTPRequestRejected, // 8: The request has been rejected by the server. - GHTTPUnauthorized, // 9: Not authorized to get the file. - GHTTPForbidden, // 10: The server has refused to send the file. - GHTTPFileNotFound, // 11: Failed to find the file on the server. - GHTTPServerError, // 12: The server has encountered an internal error. - GHTTPFileWriteFailed, // 13: An error occured writing to the local file (for ghttpSaveFile[Ex]). - GHTTPFileReadFailed, // 14: There was an error reading from a local file (for posting files from disk). - GHTTPFileIncomplete, // 15: Download started but was interrupted. Only reported if file size is known. - GHTTPFileToBig, // 16: The file is to big to be downloaded (size exceeds range of interal data types) - GHTTPEncryptionError, // 17: Error with encryption engine. - GHTTPRequestCancelled // 18: User requested cancel and/or graceful close. -} GHTTPResult; - -// Encryption engines -typedef enum -{ - GHTTPEncryptionEngine_None, - GHTTPEncryptionEngine_GameSpy, // must add /common/gsSSL.h and /common/gsSSL.c to project - GHTTPEncryptionEngine_MatrixSsl, // must define MATRIXSSL and include matrixssl source files - GHTTPEncryptionEngine_RevoEx, // must define REVOEXSSL and include RevoEX SSL source files - - GHTTPEncryptionEngine_Default // Will use GameSpy unless another engine is defined - // using MATRIXSSL or REVOEXSSL -} GHTTPEncryptionEngine; - -// Represents an http file request. -/////////////////////////////////// -typedef int GHTTPRequest; - -// Invalid GHTTPRequest values represent an error -/////////////////////////////////// -#ifdef GHTTP_EXTENDEDERROR - typedef enum - { - GHTTPErrorStart = -8, - GHTTPFailedToOpenFile, - GHTTPInvalidPost, - GHTTPInsufficientMemory, - GHTTPInvalidFileName, - GHTTPInvalidBufferSize, - GHTTPInvalidURL, - GHTTPUnspecifiedError = -1 - } GHTTPRequestError; -#else - // Backwards compatibility, developers may have relied on -1 as the only error code - typedef enum - { - GHTTPErrorStart = -1, - GHTTPFailedToOpenFile = -1, - GHTTPInvalidPost = -1, - GHTTPInsufficientMemory = -1, - GHTTPInvalidFileName = -1, - GHTTPInvalidBufferSize = -1, - GHTTPInvalidURL = -1, - GHTTPUnspecifiedError = -1 - } GHTTPRequestError; -#endif - -#define IS_GHTTP_ERROR(x) (x<0) - -// Data that can be posted to the server. -// Don't try to access this object directly, -// use the ghttpPost*() functions. -//////////////////////////////////////////// -typedef struct GHIPost * GHTTPPost; - - -// Called with updates on the current state of the request. -// The buffer should not be accessed once this callback returns. -// If ghttpGetFile[Ex] was used, buffer contains all of the data that has been -// received so far, and bufferSize is the total number of bytes received. -// If ghttpSaveFile[Ex] was used, buffer only contains the most recent data -// that has been received. This same data is saved to the file. The buffer -// will not be valid after this callback returns. -// If ghttpStreamFileEx was used, buffer only contains the most recent data -// that has been received. This data will be lost once the callback -// returns, and should be copied if it needs to be saved. bufferSize -// is the number of bytes in the current block of data. -////////////////////////////////////////////////////////////////////////////// -typedef void (* ghttpProgressCallback) -( - GHTTPRequest request, // The request. - GHTTPState state, // The current state of the request. - const char * buffer, // The file's bytes so far, NULL if state[:port]". If port is omitted, 80 will be used. -// If server is NULL or "", no proxy server will be used. -// This should not be called while there are any current requests. -////////////////////////////////////////////////////////////////// -GHTTPBool ghttpSetProxy -( - const char * server -); - -// Sets a proxy server for a specific request. The address should be of the -// form "[:port]". If port is omitted, 80 will be used. -// If server is NULL or "", no proxy server will be used. -////////////////////////////////////////////////////////////////// -GHTTPBool ghttpSetRequestProxy -( - GHTTPRequest request, - const char * server -); - -// Used to start/stop throttling an existing connection. -// This may not be as efficient as starting a request -// with the desired setting. -//////////////////////////////////////////////////////// -void ghttpSetThrottle -( - GHTTPRequest request, - GHTTPBool throttle -); - -// Used to adjust the throttle settings. -//////////////////////////////////////// -void ghttpThrottleSettings -( - int bufferSize, // The number of bytes to get each receive. - gsi_time timeDelay // How often to receive data, in milliseconds. -); - -// Used to throttle based on time, not on bandwidth -// Prevents recv-loop blocking on ultrafast connections without directly limiting transfer rate -//////////////////////////////////////// -void ghttpSetMaxRecvTime -( - GHTTPRequest request, - gsi_time maxRecvTime -); - -// Creates a new post object, which is used to represent data to send to -// the web server as part of a request. -// After getting the post object, use the ghttpPostAdd*() functions -// to add data to the object, and ghttPostSetCallback() to add a -// callback to monitor the progress of the data upload. -// By default post objects automatically free themselves after posting. -// To use the same post with more than one request, set auto-free to false, -// then use ghttpFreePost to free it _after_ every request its being used -// in is _completed_. -// Returns NULL on error. -/////////////////////////////////////////////////////////////////////////// -GHTTPPost ghttpNewPost -( - void -); - -// Sets a post object's auto-free flag. -// By default post objects automatically free themselves after posting. -// To use the same post with more than one request, set auto-free to false, -// then use ghttpFreePost to free it _after_ every request its being used -// in is _completed_. -/////////////////////////////////////////////////////////////////////////// -void ghttpPostSetAutoFree -( - GHTTPPost post, - GHTTPBool autoFree -); - -// Frees a post object. -/////////////////////// -void ghttpFreePost -( - GHTTPPost post // The post object to free. -); - -// Adds a string to the post object. -//////////////////////////////////// -GHTTPBool ghttpPostAddString -( - GHTTPPost post, // The post object to add to. - const gsi_char * name, // The name to attach to this string. - const gsi_char * string // The actual string. -); - -// Adds a disk file to the post object. -// The reportFilename is what is reported to the server as the filename. -// If NULL or empty, the filename will be used (including any possible path). -// The contentType is the MIME type to report for this file. -// If NULL, "application/octet-stream" is used. -// The file isn't read from until the data is actually sent to the server. -// Returns false for any error. -///////////////////////////////////////////////////////////////////////////// -GHTTPBool ghttpPostAddFileFromDisk -( - GHTTPPost post, // The post object to add to. - const gsi_char * name, // The name to attach to this file. - const gsi_char * filename, // The name (and possibly path) to the file to upload. - const gsi_char * reportFilename,// The filename given to the web server. - const gsi_char * contentType // The MIME type for this file. -); - -// Adds a file, in memory, to the post object. -// The reportFilename is what is reported to the server as the filename. -// Cannot be NULL or empty. -// The contentType is the MIME type to report for this file. -// If NULL, "application/octet-stream" is used. -// The data is NOT copied off in this call. The data pointer is read from -// as the data is actually sent to the server. The pointer must remain -// valid during requests. -// Returns false for any error. -////////////////////////////////////////////////////////////////////////// -GHTTPBool ghttpPostAddFileFromMemory -( - GHTTPPost post, // The post object to add to. - const gsi_char * name, // The name to attach to this string. - const char * buffer, // The data to send. - int bufferLen, // The number of bytes of data to send. - const gsi_char * reportFilename, // The filename given to the web server. - const gsi_char * contentType // The MIME type for this file. -); - -// Adds an XML SOAP object to the post object. -// See ghttpNewSoap and other Soap related functions -// Content-Type = text/xml -// The most common use of this function is to add ghttpSoap data -GHTTPBool ghttpPostAddXml -( - GHTTPPost post, - GSXmlStreamWriter xmlSoap -); - -// Called during requests to let the app know how much of the post -// data has been uploaded. -////////////////////////////////////////////////////////////////// -typedef void (* ghttpPostCallback) -( - GHTTPRequest request, // The request. - int bytesPosted, // The number of bytes of data posted so far. - int totalBytes, // The total number of bytes being posted. - int objectsPosted, // The total number of data objects uploaded so far. - int totalObjects, // The total number of data objects to upload. - void * param // User-data. -); - -// Set the callback for a post object. -////////////////////////////////////// -void ghttpPostSetCallback -( - GHTTPPost post, // The post object to set the callback on. - ghttpPostCallback callback, // The callback to call when using this post object. - void * param // User-data passed to the callback. -); - -// Use ssl encryption engine -GHTTPBool ghttpSetRequestEncryptionEngine -( - GHTTPRequest request, - GHTTPEncryptionEngine engine -); - - -// These are defined for backwards compatibility with the "file" function names. -//////////////////////////////////////////////////////////////////////////////// -#define ghttpGetFile(a, b, c, d) ghttpGet(a, b, c, d) -#define ghttpGetFileEx(a, b, c, d, e, f, g, h, i, j) ghttpGetEx(a, b, c, d, e, f, g, h, i, j) -#define ghttpSaveFile(a, b, c, d, e) ghttpSave(a, b, c, d, e) -#define ghttpSaveFileEx(a, b, c, d, e, f, g, h, i) ghttpSaveEx(a, b, c, d, e, f, g, h, i) -#define ghttpStreamFile(a, b, c, d, e) ghttpStream(a, b, c, d, e) -#define ghttpStreamFileEx(a, b, c, d, e, f, g, h) ghttpStreamEx(a, b, c, d, e, f, g, h) -#define ghttpHeadFile(a, b, c, d) ghttpHead(a, b, c, d) -#define ghttpHeadFileEx(a, b, c, d, e, f, g) ghttpHeadEx(a, b, c, d, e, f, g) - -// This ASCII version needs to be define even in UNICODE mode -GHTTPRequest ghttpGetA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - GHTTPBool blocking, // If true, this call doesn't return until the file has been recevied. - ghttpCompletedCallback completedCallback, // Called when the file has been received. - void * param // User-data to be passed to the callbacks. -); -#define ghttpGetFileA(a, b, c, d) ghttpGetA(a, b, c, d) - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpASCII.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpASCII.h deleted file mode 100644 index 6c427e06a4d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpASCII.h +++ /dev/null @@ -1,270 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -// ASCII PROTOTYPES FOR USE IN UNICODE MODE -// INCLUDED TO SILENCE CODEWARRIOR WARNINGS -#ifndef _GHTTPASCII_H_ -#define _GHTTPASCII_H_ - -#include "../common/gsCommon.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Get a file from an http server. -// Returns GHTTPRequestError if an error occurs. -////////////////////////////////// -GHTTPRequest ghttpGetA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - GHTTPBool blocking, // If true, this call doesn't return until the file has been recevied. - ghttpCompletedCallback completedCallback, // Called when the file has been received. - void * param // User-data to be passed to the callbacks. -); - -// Get a file from an http server. -// Returns GHTTPRequestError if an error occurs. -// Allows an optional user-supplied buffer to be used, -// optional extra http headers, -// and an optional progress callback. -// The optional headers must be 0 or more HTTP headers, -// each terminated by a CR-LF pair (0xD, 0xA). -// If using a user-supplied buffer: -// set buffer to the buffer to use, -// set bufferSize to the size of the buffer in bytes. -// To have the library allocate a buffer: -// set buffer to NULL, set bufferSize to 0 -/////////////////////////////////////////////////////// -GHTTPRequest ghttpGetExA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - const char * headers, // Optional headers to pass with the request. Can be NULL or "". - char * buffer, // Optional user-supplied buffer. Set to NULL to have one allocated. - int bufferSize, // The size of the user-supplied buffer in bytes. 0 if buffer is NULL. - GHTTPPost post, // Optional data to be posted. - GHTTPBool throttle, // If true, throttle this connection's download speed. - GHTTPBool blocking, // If true, this call doesn't return until the file has been recevied. - ghttpProgressCallback progressCallback, // Called periodically with progress updates. - ghttpCompletedCallback completedCallback, // Called when the file has been received. - void * param // User-data to be passed to the callbacks. -); - -// Gets a file and saves it to disk. -// Returns GHTTPRequestError if an error occurs. -//////////////////////////////////// -GHTTPRequest ghttpSaveA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - const char * filename, // The path and name to store the file as locally. - GHTTPBool blocking, // If true, this call doesn't return until the file has been recevied. - ghttpCompletedCallback completedCallback, // Called when the file has been received. - void * param // User-data to be passed to the callbacks. -); - -// Gets a file and saves it to disk. -// Returns GHTTPRequestError if an error occurs. -// Allows optional extra http headers and -// an optional progress callback. -///////////////////////////////////////// -GHTTPRequest ghttpSaveExA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - const char * filename, // The path and name to store the file as locally. - const char * headers, // Optional headers to pass with the request. Can be NULL or "". - GHTTPPost post, // Optional data to be posted. - GHTTPBool throttle, // If true, throttle this connection's download speed. - GHTTPBool blocking, // If true, this call doesn't return until the file has been recevied. - ghttpProgressCallback progressCallback, // Called periodically with progress updates. - ghttpCompletedCallback completedCallback, // Called when the file has been received. - void * param // User-data to be passed to the callbacks. -); - -// Streams a file from an http server. -// Returns GHTTPRequestError if an error occurs. -////////////////////////////////////// -GHTTPRequest ghttpStreamA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - GHTTPBool blocking, // If true, this call doesn't return until the file has finished streaming. - ghttpProgressCallback progressCallback, // Called whenever new data is received. - ghttpCompletedCallback completedCallback, // Called when the file has finished streaming. - void * param // User-data to be passed to the callbacks. -); - -// Streams a file from an http server. -// Returns GHTTPRequestError if an error occurs. -// Allows optional extra http headers. -////////////////////////////////////// -GHTTPRequest ghttpStreamExA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - const char * headers, // Optional headers to pass with the request. Can be NULL or "". - GHTTPPost post, // Optional data to be posted. - GHTTPBool throttle, // If true, throttle this connection's download speed. - GHTTPBool blocking, // If true, this call doesn't return until the file has finished streaming. - ghttpProgressCallback progressCallback, // Called whenever new data is received. - ghttpCompletedCallback completedCallback, // Called when the file has finished streaming. - void * param // User-data to be passed to the callbacks. -); - -// Does a file request without actually getting the file. -// Use this to check the headers returned by a server when a request is made. -// Returns GHTTPRequestError if an error occurs. -///////////////////////////////////////////////////////////////////////////// -GHTTPRequest ghttpHeadA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - GHTTPBool blocking, // If true, this call doesn't return until finished - ghttpCompletedCallback completedCallback, // Called when the request has finished. - void * param // User-data to be passed to the callbacks. -); - -// Does a file request without actually getting the file. -// Use this to check the headers returned by a server when a request is made. -// Returns GHTTPRequestError if an error occurs. -// Allows optional extra http headers. -///////////////////////////////////////////////////////////////////////////// -GHTTPRequest ghttpHeadExA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - const char * headers, // Optional headers to pass with the request. Can be NULL or "". - GHTTPBool throttle, // If true, throttle this connection's download speed. - GHTTPBool blocking, // If true, this call doesn't return until finished - ghttpProgressCallback progressCallback, // Called whenever new data is received. - ghttpCompletedCallback completedCallback, // Called when the request has finished. - void * param // User-data to be passed to the callbacks. -); - -// Does an HTTP POST, which can be used to upload data to a web server. -// The post parameter must be a valid GHTTPPost, setup with the data to be uploaded. -// No data will be returned from this request. If data is needed, use one of the -// ghttp*FileEx() functions, and pass in a GHTTPPost object. -// Returns GHTTPRequestError if an error occurs. -/////////////////////////////////////////////////////////////////////////////////// -GHTTPRequest ghttpPostA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - GHTTPPost post, // The data to be posted. - GHTTPBool blocking, // If true, this call doesn't return until finished - ghttpCompletedCallback completedCallback, // Called when the file has finished streaming. - void * param // User-data to be passed to the callbacks. -); - -// Does an HTTP POST, which can be used to upload data to a web server. -// The post parameter must be a valid GHTTPPost, setup with the data to be uploaded. -// No data will be returned from this request. If data is needed, use one of the -// ghttp*FileEx() functions, and pass in a GHTTPPost object. -// Returns GHTTPRequestError if an error occurs. -// Allows optional extra http headers and -// an optional progress callback. -/////////////////////////////////////////////////////////////////////////////////// -GHTTPRequest ghttpPostExA -( - const char * URL, // The URL for the file ("http://host.domain[:port]/path/filename"). - const char * headers, // Optional headers to pass with the request. Can be NULL or "". - GHTTPPost post, // The data to be posted. - GHTTPBool throttle, // If true, throttle this connection's download speed. - GHTTPBool blocking, // If true, this call doesn't return until finished - ghttpProgressCallback progressCallback, // Called whenever new data is received. - ghttpCompletedCallback completedCallback, // Called when the file has finished streaming. - void * param // User-data to be passed to the callbacks. -); - - -// Gets the status code and status string for a request. -// A pointer to the status string is returned, or NULL on error. -// Only valid if the GHTTPState for this request -// is greater than GHTTPReceivingStatus. -//////////////////////////////////////////////////////////////// -const char * ghttpGetResponseStatus -( - GHTTPRequest request, // The request to get the response state of. - int * statusCode // If not NULL, the status code is stored here. -); - -// Gets headers returned by the http server. -// Only valid if the GHTTPState for this -// request is GHTTPReceivingFile. -//////////////////////////////////////////// -const char * ghttpGetHeaders -( - GHTTPRequest request -); - -// Gets the URL for a given request. -//////////////////////////////////// -const char * ghttpGetURL -( - GHTTPRequest request -); - -// Sets a proxy server address. The address should be of the -// form "[:port]". If port is omitted, 80 will be used. -// If server is NULL or "", no proxy server will be used. -// This should not be called while there are any current requests. -////////////////////////////////////////////////////////////////// -GHTTPBool ghttpSetProxyA -( - const char * server -); - -// Adds a string to the post object. -//////////////////////////////////// -GHTTPBool ghttpPostAddStringA -( - GHTTPPost post, // The post object to add to. - const char * name, // The name to attach to this string. - const char * string // The actual string. -); - -// Adds a disk file to the post object. -// The reportFilename is what is reported to the server as the filename. -// If NULL or empty, the filename will be used (including any possible path). -// The contentType is the MIME type to report for this file. -// If NULL, "application/octet-stream" is used. -// The file isn't read from until the data is actually sent to the server. -// Returns false for any error. -///////////////////////////////////////////////////////////////////////////// -GHTTPBool ghttpPostAddFileFromDiskA -( - GHTTPPost post, // The post object to add to. - const char * name, // The name to attach to this file. - const char * filename, // The name (and possibly path) to the file to upload. - const char * reportFilename,// The filename given to the web server. - const char * contentType // The MIME type for this file. -); - -// Adds a file, in memory, to the post object. -// The reportFilename is what is reported to the server as the filename. -// Cannot be NULL or empty. -// The contentType is the MIME type to report for this file. -// If NULL, "application/octet-stream" is used. -// The data is NOT copied off in this call. The data pointer is read from -// as the data is actually sent to the server. The pointer must remain -// valid during requests. -// Returns false for any error. -////////////////////////////////////////////////////////////////////////// -GHTTPBool ghttpPostAddFileFromMemoryA -( - GHTTPPost post, // The post object to add to. - const char * name, // The name to attach to this string. - const char * buffer, // The data to send. - int bufferLen, // The number of bytes of data to send. - const char * reportFilename, // The filename given to the web server. - const char * contentType // The MIME type for this file. -); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpBuffer.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpBuffer.c deleted file mode 100644 index a70ad673387..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpBuffer.c +++ /dev/null @@ -1,561 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "ghttpBuffer.h" -#include "ghttpConnection.h" -#include "ghttpMain.h" -#include "ghttpCommon.h" -#include "../common/gsCrypt.h" -#include "../common/gsSSL.h" - - -// Resize the buffer. -///////////////////// -GHTTPBool ghiResizeBuffer -( - GHIBuffer * buffer, - int sizeIncrement -) -{ - char * tempPtr; - int newSize; - - assert(buffer); - assert(sizeIncrement > 0); - assert(buffer->fixed == GHTTPFalse); // implied by sizeIncrement > 0 - - // Check args. - ////////////// - if(!buffer) - return GHTTPFalse; - if(sizeIncrement <= 0) - return GHTTPFalse; - - // Reallocate with the bigger size. - /////////////////////////////////// - newSize = (buffer->size + sizeIncrement); - tempPtr = (char *)gsirealloc(buffer->data, (unsigned int)newSize); - if(!tempPtr) - return GHTTPFalse; - - // Set the new info. - //////////////////// - buffer->data = tempPtr; - buffer->size = newSize; - - return GHTTPTrue; -} - -GHTTPBool ghiInitBuffer -( - struct GHIConnection * connection, - GHIBuffer * buffer, - int initialSize, - int sizeIncrement -) -{ - GHTTPBool bResult; - - assert(connection); - assert(buffer); - assert(initialSize > 0); - assert(sizeIncrement > 0); - - // Check args. - ////////////// - if(!connection) - return GHTTPFalse; - if(!buffer) - return GHTTPFalse; - if(initialSize <= 0) - return GHTTPFalse; - if(sizeIncrement <= 0) - return GHTTPFalse; - - // Init the struct. - /////////////////// - buffer->connection = connection; - buffer->data = NULL; - buffer->size = 0; - buffer->len = 0; - buffer->pos = 0; - buffer->sizeIncrement = sizeIncrement; - buffer->fixed = GHTTPFalse; - buffer->dontFree = GHTTPFalse; - buffer->readOnly = GHTTPFalse; - - // Do the initial resize. - ///////////////////////// - bResult = ghiResizeBuffer(buffer, initialSize); - if(!bResult) - return GHTTPFalse; - - // Start with an empty string. - ////////////////////////////// - *buffer->data = '\0'; - - return GHTTPTrue; -} - -GHTTPBool ghiInitFixedBuffer -( - struct GHIConnection * connection, - GHIBuffer * buffer, - char * userBuffer, - int size -) -{ - assert(connection); - assert(buffer); - assert(userBuffer); - assert(size > 0); - - // Check args. - ////////////// - if(!connection) - return GHTTPFalse; - if(!buffer) - return GHTTPFalse; - if(!userBuffer) - return GHTTPFalse; - if(size <= 0) - return GHTTPFalse; - - // Init the struct. - /////////////////// - buffer->connection = connection; - buffer->data = userBuffer; - buffer->size = size; - buffer->len = 0; - buffer->pos = 0; - buffer->sizeIncrement = 0; - buffer->fixed = GHTTPTrue; - buffer->dontFree = GHTTPTrue; - buffer->readOnly = GHTTPFalse; - - // Start with an empty string. - ////////////////////////////// - *buffer->data = '\0'; - - return GHTTPTrue; -} - -GHTTPBool ghiInitReadOnlyBuffer -( - struct GHIConnection * connection, // The connection. - GHIBuffer * buffer, // The buffer to init. - const char * userBuffer, // The user-buffer to use. - int size // The size of the buffer. -) -{ - assert(connection); - assert(buffer); - assert(userBuffer); - assert(size > 0); - - // Check args. - ////////////// - if(!connection) - return GHTTPFalse; - if(!buffer) - return GHTTPFalse; - if(!userBuffer) - return GHTTPFalse; - if(size <= 0) - return GHTTPFalse; - - // Init the struct. - /////////////////// - buffer->connection = connection; - buffer->data = (char*)userBuffer; // cast away const - buffer->size = size; - buffer->pos = 0; - buffer->sizeIncrement = 0; - buffer->fixed = GHTTPTrue; - buffer->dontFree = GHTTPTrue; - buffer->readOnly = GHTTPTrue; - - // Start with user supplied data - ////////////////////////////// - buffer->len = size; - - return GHTTPTrue; -} - -void ghiFreeBuffer -( - GHIBuffer * buffer -) -{ - assert(buffer); - - // Check args. - ////////////// - if(!buffer) - return; - if(!buffer->data) - return; - - // Cleanup the struct. - ////////////////////// - if(!buffer->dontFree) - gsifree(buffer->data); - memset(buffer, 0, sizeof(GHIBuffer)); -} - -GHTTPBool ghiAppendDataToBuffer -( - GHIBuffer * buffer, - const char * data, - int dataLen -) -{ - GHTTPBool bResult; - int newLen; - - assert(buffer); - assert(data); - assert(dataLen >= 0); - - // Check args. - ////////////// - if(!buffer) - return GHTTPFalse; - if(!data) - return GHTTPFalse; - if(dataLen < 0) - return GHTTPFalse; - if (buffer->readOnly) - return GHTTPFalse; - - // Get the string length if needed. - /////////////////////////////////// - if(dataLen == 0) - dataLen = (int)strlen(data); - - // Get the new length. - ////////////////////// - newLen = (buffer->len + dataLen); - - // Make sure the array is big enough. - ///////////////////////////////////// - while(newLen >= buffer->size) - { - // Check for a fixed buffer. - //////////////////////////// - if(buffer->fixed) - { - buffer->connection->completed = GHTTPTrue; - buffer->connection->result = GHTTPBufferOverflow; - return GHTTPFalse; - } - - bResult = ghiResizeBuffer(buffer, buffer->sizeIncrement); - if(!bResult) - { - buffer->connection->completed = GHTTPTrue; - buffer->connection->result = GHTTPOutOfMemory; - return GHTTPFalse; - } - } - - // Add the data. - //////////////// - memcpy(buffer->data + buffer->len, data, (unsigned int)dataLen); - buffer->len = newLen; - buffer->data[buffer->len] = '\0'; - return GHTTPTrue; -} - - -// Use sparingly. This function wraps the data in an SSL record. -GHTTPBool ghiEncryptDataToBuffer -( - GHIBuffer * buffer, - const char * data, - int dataLen -) -{ - GHIEncryptionResult result; - int bufSpace = 0; - int pos = 0; - - assert(buffer); - assert(data); - assert(dataLen >= 0); - - // Check args. - ////////////// - if(!buffer) - return GHTTPFalse; - if(!data) - return GHTTPFalse; - if(dataLen < 0) - return GHTTPFalse; - if (buffer->readOnly) - return GHTTPFalse; - - // Switch to plain text append when not using SSL - if (buffer->connection->encryptor.mEngine == GHTTPEncryptionEngine_None || - buffer->connection->encryptor.mSessionEstablished == GHTTPFalse) - { - return ghiAppendDataToBuffer(buffer, data, dataLen); - } - - // Get the string length if needed. - /////////////////////////////////// - if(dataLen == 0) - dataLen = (int)strlen(data); - if (dataLen == 0) - return GHTTPTrue; // no data and strlen == 0 - bufSpace = buffer->size - buffer->len; - - do - { - int fragmentLen = min(dataLen, GS_SSL_MAX_CONTENTLENGTH); - - // Call the encryptor function - // bufSize is reduced by the number of bytes written - result = buffer->connection->encryptor.mEncryptFunc(buffer->connection, &buffer->connection->encryptor, - &data[pos], dataLen, - &buffer->data[buffer->len], &bufSpace); - if (result == GHIEncryptionResult_BufferTooSmall) - { - if (ghiResizeBuffer(buffer, buffer->sizeIncrement) == GHTTPFalse) - return GHTTPFalse; - bufSpace = buffer->size - buffer->len; - } - else if (result == GHIEncryptionResult_Success) - { - // update data and buffer positions - pos += fragmentLen; - buffer->len = buffer->size - bufSpace; - } - else - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_WarmError, - "ghiEncryptDataToBuffer encountered unhandled return code: %d\r\n", result); - return GHTTPFalse; - } - } while(pos < dataLen); - - return GHTTPTrue; -} - -GHTTPBool ghiAppendHeaderToBuffer -( - GHIBuffer * buffer, - const char * name, - const char * value -) -{ - if(!ghiAppendDataToBuffer(buffer, name, 0)) - return GHTTPFalse; - if(!ghiAppendDataToBuffer(buffer, ": ", 2)) - return GHTTPFalse; - if(!ghiAppendDataToBuffer(buffer, value, 0)) - return GHTTPFalse; - if(!ghiAppendDataToBuffer(buffer, CRLF, 2)) - return GHTTPFalse; - - return GHTTPTrue; -} - -GHTTPBool ghiAppendCharToBuffer -( - GHIBuffer * buffer, - int c -) -{ - GHTTPBool bResult; - assert(buffer); - - // Check args. - ////////////// - if(!buffer) - return GHTTPFalse; - if (buffer->readOnly) - return GHTTPFalse; - - // Make sure the array is big enough. - ///////////////////////////////////// - if((buffer->len + 1) >= buffer->size) - { - // Check for a fixed buffer. - //////////////////////////// - if(buffer->fixed) - { - buffer->connection->completed = GHTTPTrue; - buffer->connection->result = GHTTPBufferOverflow; - return GHTTPFalse; - } - - bResult = ghiResizeBuffer(buffer, buffer->sizeIncrement); - if(!bResult) - { - buffer->connection->completed = GHTTPTrue; - buffer->connection->result = GHTTPOutOfMemory; - return GHTTPFalse; - } - } - - // Add the char. - //////////////// - buffer->data[buffer->len] = (char)(c & 0xFF); - buffer->len++; - buffer->data[buffer->len] = '\0'; - - return GHTTPTrue; -} - -GHTTPBool ghiAppendIntToBuffer -( - GHIBuffer * buffer, - int i -) -{ - char intValue[16]; - - sprintf(intValue, "%d", i); - - return ghiAppendDataToBuffer(buffer, intValue, 0); -} - -void ghiResetBuffer -( - GHIBuffer * buffer -) -{ - assert(buffer); - - buffer->len = 0; - buffer->pos = 0; - - // Start with an empty string. - ////////////////////////////// - if (!buffer->readOnly) - *buffer->data = '\0'; -} - -GHTTPBool ghiSendBufferedData -( - struct GHIConnection * connection -) -{ - int rcode; - int writeFlag; - int exceptFlag; - char * data; - int len; - - // Loop while we can send. - ////////////////////////// - do - { - rcode = GSISocketSelect(connection->socket, NULL, &writeFlag, &exceptFlag); - if((gsiSocketIsError(rcode)) || ((rcode == 1) && exceptFlag)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPSocketFailed; - if(gsiSocketIsError(rcode)) - connection->socketError = GOAGetLastError(connection->socket); - else - connection->socketError = 0; - return GHTTPFalse; - } - if((rcode < 1) || !writeFlag) - { - // Can't send anything. - /////////////////////// - return GHTTPTrue; - } - - // Figure out what, and how much, to send. - ////////////////////////////////////////// - data = (connection->sendBuffer.data + connection->sendBuffer.pos); - len = (connection->sendBuffer.len - connection->sendBuffer.pos); - - // Do the send. - /////////////// - rcode = ghiDoSend(connection, data, len); - if(gsiSocketIsError(rcode)) - return GHTTPFalse; - - // Update the position. - /////////////////////// - connection->sendBuffer.pos += rcode; - } - while(connection->sendBuffer.pos < connection->sendBuffer.len); - - return GHTTPTrue; -} - - -// Read data from a buffer -GHTTPBool ghiReadDataFromBuffer -( - GHIBuffer * bufferIn, // the GHIBuffer to read from - char bufferOut[], // the raw buffer to write to - int * len // max number of bytes to append, becomes actual length written -) -{ - int bytesAvailable = 0; - int bytesToCopy = 0; - - - // Verify parameters - assert(bufferIn != NULL); - assert(len != NULL); - if (*len == 0) - return GHTTPFalse; - - // Make sure the bufferIn isn't emtpy - bytesAvailable = (int)bufferIn->len - bufferIn->pos; - if (bytesAvailable <= 0) - return GHTTPFalse; - - // Calculate the actual number of bytes to copy - bytesToCopy = min(*len-1, bytesAvailable); - - // Copy the bytes - memcpy(bufferOut, bufferIn->data + bufferIn->pos, (size_t)bytesToCopy); - bufferOut[bytesToCopy] = '\0'; - *len = bytesToCopy; - - // Adjust the bufferIn read position - bufferIn->pos += bytesToCopy; - return GHTTPTrue; -} - - -// Read data from a buffer with a garunteed length -GHTTPBool ghiReadDataFromBufferFixed -( - GHIBuffer * bufferIn, // the GHIBuffer to read from - char bufferOut[], // the raw buffer to write to - int bytesToCopy // number of bytes to read -) -{ - // Verify parameters - assert(bufferIn != NULL); - if (bytesToCopy == 0) - return GHTTPTrue; - - // Make sure the bufferIn isn't too small - if (bufferIn->len < bytesToCopy) - return GHTTPFalse; - - // Copy the bytes - memcpy(bufferOut, bufferIn->data + bufferIn->pos, (size_t)bytesToCopy); - - // Adjust the bufferIn read position - bufferIn->pos += bytesToCopy; - return GHTTPTrue; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpBuffer.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpBuffer.h deleted file mode 100644 index 3aea4a3e45d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpBuffer.h +++ /dev/null @@ -1,170 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPBUFFER_H_ -#define _GHTTPBUFFER_H_ - -#include "ghttpMain.h" -#include "ghttpEncryption.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// A data buffer. -///////////////// -typedef struct GHIBuffer -{ - struct GHIConnection * connection; // The connection. - char * data; // The actual bytes of data. - int size; // The number of bytes allocated for data. - int len; // The number of actual data bytes filled in. - int pos; // A marker to keep track of position. - int sizeIncrement; // How much to increment the buffer by when needed. - GHTTPBool fixed; // If true, don't resize the buffer. - GHTTPBool dontFree; // Don't free the data when the buffer is cleaned up. - GHTTPBool readOnly; // Read Only, write operations will fail -} GHIBuffer; - -// Initializes a buffer and allocates the initial data bytes. -// The initialSize and sizeIncrement must both be >0. -///////////////////////////////////////////////////////////// -GHTTPBool ghiInitBuffer -( - struct GHIConnection * connection, // The connection. - GHIBuffer * buffer, // The buffer to init. - int initialSize, // The initial size of the buffer. - int sizeIncrement // The size increment for the buffer. -); - -// Initializes a fixed-size buffer. This will not get resized. -/////////////////////////////////////////////////////////////// -GHTTPBool ghiInitFixedBuffer -( - struct GHIConnection * connection, // The connection. - GHIBuffer * buffer, // The buffer to init. - char * userBuffer, // The user-buffer to use. - int size // The size of the buffer. -); - -// Initializes a read-only fixed-size buffer. This will not get resized. -/////////////////////////////////////////////////////////////// -GHTTPBool ghiInitReadOnlyBuffer -( - struct GHIConnection * connection, // The connection. - GHIBuffer * buffer, // The buffer to init. - const char * userBuffer, // The user-buffer to use. - int size // The size of the buffer. -); - -// Free's a buffer's allocated memory (does -// not free the actual GHIBuffer structure). -//////////////////////////////////////////// -void ghiFreeBuffer -( - GHIBuffer * buffer -); - -// Appends data to the buffer. -// If data is a NUL-terminated string, 0 can be -// used for dataLen to use the length of the string. -//////////////////////////////////////////////////// -GHTTPBool ghiAppendDataToBuffer -( - GHIBuffer * buffer, // The buffer to append to. - const char * data, // The data to append. - int dataLen // The number of bytes of data to append, 0 for NUL-terminated string. -); - -// Appends data to the buffer, wrapped in an SSL record -// If data is a NUL-terminated string, 0 can be -// used for dataLen to use the length of the string. -// Encryption has some size overhead, so call this sparingly. -//////////////////////////////////////////////////// -GHTTPBool ghiEncryptDataToBuffer -( - GHIBuffer * buffer, // The buffer to append to. - const char * data, // The data to append. - int dataLen // The number of bytes of data to append, 0 for NUL-terminated string. -); - -// Appends a header to the buffer. -// Both the name and value must be NUL-terminated. -// The header will be added to the buffer as: -// : \n -////////////////////////////////////////////////// -GHTTPBool ghiAppendHeaderToBuffer -( - GHIBuffer * buffer, // The buffer to append to. - const char * name, // The name of the header. - const char * value // The value of the header. -); - -// Appends a single character to the buffer. -//////////////////////////////////////////// -GHTTPBool ghiAppendCharToBuffer -( - GHIBuffer * buffer, // The buffer to append to. - int c // The char to append. -); - -// Read data from a buffer -GHTTPBool ghiReadDataFromBuffer -( - GHIBuffer * bufferIn, // the GHIBuffer to read from - char bufferOut[], // the raw buffer to write to - int * len // max number of bytes to append, becomes actual length written -); - -// Read a fixed number of bytes from a buffer -GHTTPBool ghiReadDataFromBufferFixed -( - GHIBuffer * bufferIn, - char bufferOut[], - int len -); - -// Converts the int to a string and appends it to the buffer. -///////////////////////////////////////////////////////////// -GHTTPBool ghiAppendIntToBuffer -( - GHIBuffer * buffer, // The buffer to append to. - int i // The int to append. -); - -// Resets a buffer. -// Does this by setting both len and pos to 0. -////////////////////////////////////////////// -void ghiResetBuffer -( - GHIBuffer * buffer // The buffer to reset. -); - -// Sends as much buffer data as it can. -// Returns false if there was an error. -/////////////////////////////////////// -GHTTPBool ghiSendBufferedData -( - struct GHIConnection * connection -); - -// Increases the size of a buffer. -// This happens automatically when using the ghiAppend* functions -GHTTPBool ghiResizeBuffer -( - GHIBuffer * buffer, - int sizeIncrement -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCallbacks.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCallbacks.c deleted file mode 100644 index 7fecb00096c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCallbacks.c +++ /dev/null @@ -1,114 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "ghttpCallbacks.h" -#include "ghttpPost.h" - -void ghiCallCompletedCallback -( - GHIConnection * connection -) -{ - GHTTPBool freeBuffer; - char * buffer; - GHTTPByteCount bufferLen; - - assert(connection); - -#ifdef GSI_COMMON_DEBUG - if(connection->result != GHTTPSuccess) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_WarmError, - "Socket Error: %d\n", connection->socketError); - } -#endif - - // Check for no callback. - ///////////////////////// - if(!connection->completedCallback) - return; - - // Figure out the buffer/bufferLen parameters. - ////////////////////////////////////////////// - if(connection->type == GHIGET) - { - buffer = connection->getFileBuffer.data; - } - else - { - buffer = NULL; - } - bufferLen = connection->fileBytesReceived; - - // Call the callback. - ///////////////////// - freeBuffer = connection->completedCallback( - connection->request, - connection->result, - buffer, - bufferLen, - connection->callbackParam); - - // Check for gsifree. - ////////////////// - if(buffer && !freeBuffer) - connection->getFileBuffer.dontFree = GHTTPTrue; -} - -void ghiCallProgressCallback -( - GHIConnection * connection, - const char * buffer, - GHTTPByteCount bufferLen -) -{ - assert(connection); - - // Check for no callback. - ///////////////////////// - if(!connection->progressCallback) - return; - - // Call the callback. - ///////////////////// - connection->progressCallback( - connection->request, - connection->state, - buffer, - bufferLen, - connection->fileBytesReceived, - connection->totalSize, - connection->callbackParam - ); -} - -void ghiCallPostCallback -( - GHIConnection * connection -) -{ - assert(connection); - - // Check for no callback. - ///////////////////////// - if(!connection->postingState.callback) - return; - - // Call the callback. - ///////////////////// - connection->postingState.callback( - connection->request, - connection->postingState.bytesPosted, - connection->postingState.totalBytes, - connection->postingState.index, - ArrayLength(connection->postingState.states), - connection->callbackParam - ); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCallbacks.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCallbacks.h deleted file mode 100644 index d53835aafa7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCallbacks.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPCALLBACKS_H_ -#define _GHTTPCALLBACKS_H_ - -#include "ghttpMain.h" -#include "ghttpConnection.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Call the completed callback for this connection. -/////////////////////////////////////////////////// -void ghiCallCompletedCallback -( - GHIConnection * connection -); - -// Call the progress callback for this connection. -////////////////////////////////////////////////// -void ghiCallProgressCallback -( - GHIConnection * connection, - const char * buffer, - GHTTPByteCount bufferLen -); - -// Call the post callback for this connection. -////////////////////////////////////////////// -void ghiCallPostCallback -( - GHIConnection * connection -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCommon.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCommon.c deleted file mode 100644 index ee402b8531f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCommon.c +++ /dev/null @@ -1,597 +0,0 @@ -/* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "ghttpCommon.h" - -// Disable compiler warnings for issues that are unavoidable. -///////////////////////////////////////////////////////////// -#if defined(_MSC_VER) // DevStudio -// Level4, "conditional expression is constant". -// Occurs with use of the MS provided macro FD_SET -#pragma warning ( disable: 4127 ) -#endif // _MSC_VER - -#ifdef WIN32 -// A lock. -////////// -typedef void * GLock; - -// The lock used by ghttp. -////////////////////////// -static GLock ghiGlobalLock; -#endif - -// Proxy server. -//////////////// -char * ghiProxyAddress; -unsigned short ghiProxyPort; - -// Throttle settings. -///////////////////// -int ghiThrottleBufferSize = 125; -gsi_time ghiThrottleTimeDelay = 250; - -// Number of connections -///////////////////// -extern int ghiNumConnections; - - -#ifdef WIN32 -// Creates a lock. -////////////////// -static GLock GNewLock(void) -{ - CRITICAL_SECTION * criticalSection; - - criticalSection = (CRITICAL_SECTION *)gsimalloc(sizeof(CRITICAL_SECTION)); - if(!criticalSection) - return NULL; - - InitializeCriticalSection(criticalSection); - - return (GLock)criticalSection; -} - -// Frees a lock. -//////////////// -static void GFreeLock(GLock lock) -{ - CRITICAL_SECTION * criticalSection = (CRITICAL_SECTION *)lock; - - if(!lock) - return; - - DeleteCriticalSection(criticalSection); - - gsifree(criticalSection); -} - -// Locks a lock. -//////////////// -static void GLockLock(GLock lock) -{ - CRITICAL_SECTION * criticalSection = (CRITICAL_SECTION *)lock; - - if(!lock) - return; - - EnterCriticalSection(criticalSection); -} - -// Unlocks a lock. -////////////////// -static void GUnlockLock(GLock lock) -{ - CRITICAL_SECTION * criticalSection = (CRITICAL_SECTION *)lock; - - if(!lock) - return; - - LeaveCriticalSection(criticalSection); -} -#endif - -// Creates the ghttp lock. -////////////////////////// -void ghiCreateLock(void) -{ -#ifdef WIN32 - // We shouldn't already have a lock. - //////////////////////////////////// - assert(!ghiGlobalLock); - - // Create the lock. - /////////////////// - ghiGlobalLock = GNewLock(); -#endif -} - -// Frees the ghttp lock. -//////////////////////// -void ghiFreeLock(void) -{ -#ifdef WIN32 - if(!ghiGlobalLock) - return; - - GFreeLock(ghiGlobalLock); - ghiGlobalLock = NULL; -#endif -} - -// Locks the ghttp lock. -//////////////////////// -void ghiLock -( - void -) -{ -#ifdef WIN32 - if(!ghiGlobalLock) - return; - - GLockLock(ghiGlobalLock); -#endif -} - -// Unlocks the ghttp lock. -////////////////////////// -void ghiUnlock -( - void -) -{ -#ifdef WIN32 - if(!ghiGlobalLock) - return; - - GUnlockLock(ghiGlobalLock); -#endif -} - -// Logs traffic. -//////////////// -#ifdef HTTP_LOG -void ghiLogToFile(const char * buffer, int len, const char* fileName) -{ -#ifdef _NITRO - int i; - - if(!buffer || !len) - return; - - for(i = 0 ; i < len ; i++) - OS_PutChar(buffer[i]); -#else - FILE * file; - - if(!buffer || !len) - return; - - file = fopen(fileName, "ab"); - if(file) - { - fwrite(buffer, 1, len, file); - fclose(file); - } -#endif -} -#endif - -// Reads encrypted data from decodeBuffer -// Appends decrypted data to recvBuffer -// Returns GHTTPFalse if there was a fatal error -//////////////////////////////////////////////// -GHTTPBool ghiDecryptReceivedData(struct GHIConnection * connection) -{ - // Decrypt data from decodeBuffer to recvBuffer - GHIEncryptionResult aResult = GHIEncryptionResult_None; - - // data to be decrypted - char* aReadPos = NULL; - char* aWritePos = NULL; - int aReadLen = 0; - int aWriteLen = 0; - - do - { - // Call the decryption func - do - { - aReadPos = connection->decodeBuffer.data + connection->decodeBuffer.pos; - aReadLen = connection->decodeBuffer.len - connection->decodeBuffer.pos; - aWritePos = connection->recvBuffer.data + connection->recvBuffer.len; - aWriteLen = connection->recvBuffer.size - connection->recvBuffer.len; // the amount of room in recvbuffer - - aResult = (connection->encryptor.mDecryptFunc)(connection, &connection->encryptor, - aReadPos, &aReadLen, aWritePos, &aWriteLen); - if (aResult == GHIEncryptionResult_BufferTooSmall) - { - // Make some more room - if (GHTTPFalse == ghiResizeBuffer(&connection->recvBuffer, connection->recvBuffer.sizeIncrement)) - return GHTTPFalse; // error - } - else if(aResult == GHIEncryptionResult_Error) - { - return GHTTPFalse; - } - } while (aResult == GHIEncryptionResult_BufferTooSmall && aWriteLen == 0); - - // Adjust GHIBuffer sizes so they account for transfered data - if(aReadLen > connection->decodeBuffer.len) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_HotError, - "ghiDecryptReceivedData read past the end of connection->decodeBuffer! (%d\\%d bytes)\r\n", - aReadLen, connection->decodeBuffer.len); - return GHTTPFalse; - } - - connection->decodeBuffer.pos += aReadLen; - connection->recvBuffer.len += aWriteLen; - - } while(aWriteLen > 0); - - // Discard data from the decodedBuffer in chunks - if (connection->decodeBuffer.pos > 0xFF) - { - int bytesToKeep = connection->decodeBuffer.len - connection->decodeBuffer.pos; - if (bytesToKeep == 0) - ghiResetBuffer(&connection->decodeBuffer); - else - { - memmove(connection->decodeBuffer.data, - connection->decodeBuffer.data + connection->decodeBuffer.pos, - (size_t)bytesToKeep); - connection->decodeBuffer.pos = 0; - connection->decodeBuffer.len = bytesToKeep; - } - } - - return GHTTPTrue; -} - -// Receive some data. -///////////////////// -GHIRecvResult ghiDoReceive -( - GHIConnection * connection, - char buffer[], - int * bufferLen -) -{ - int rcode; - int socketError; - int len; - - // How much to try and receive. - /////////////////////////////// - len = (*bufferLen - 1); - - // Are we throttled? - //////////////////// - if(connection->throttle) - { - unsigned long now; - - // Don't receive too often. - /////////////////////////// - now = current_time(); - if(now < (connection->lastThrottleRecv + ghiThrottleTimeDelay)) - return GHINoData; - - // Update the receive time. - /////////////////////////// - connection->lastThrottleRecv = (unsigned int)now; - - // Don't receive too much. - ////////////////////////// - len = min(len, ghiThrottleBufferSize); - } - - // Receive some data. - ///////////////////// - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mSessionEstablished == GHTTPTrue && - connection->encryptor.mEncryptOnSend == GHTTPTrue ) - { - GHIEncryptionResult result; - int recvLength = len; - - result = ghiEncryptorSslDecryptRecv(connection, &connection->encryptor, buffer, &recvLength); - if (result == GHIEncryptionResult_Success) - rcode = recvLength; - else - rcode = -1; // signal termination of connection - } - else - { - rcode = recv(connection->socket, buffer, len, 0); - } - - - // There was an error. - ////////////////////// - if(gsiSocketIsError(rcode)) - { - // Get the error code. - ////////////////////// - socketError = GOAGetLastError(connection->socket); - - // Check for a closed connection. - ///////////////////////////////// - if(socketError == WSAENOTCONN) - { - connection->connectionClosed = GHTTPTrue; - return GHIConnClosed; - } - - // Check for nothing waiting. - ///////////////////////////// - if((socketError == WSAEWOULDBLOCK) || (socketError == WSAEINPROGRESS) || (socketError == WSAETIMEDOUT)) - return GHINoData; - - // There was a real error. - ////////////////////////// - connection->completed = GHTTPTrue; - connection->result = GHTTPSocketFailed; - connection->socketError = socketError; - connection->connectionClosed = GHTTPTrue; - - return GHIError; - } - - // The connection was closed. - ///////////////////////////// - if(rcode == 0) - { - connection->connectionClosed = GHTTPTrue; - return GHIConnClosed; - } - - // Cap the buffer. - ////////////////// - buffer[rcode] = '\0'; - *bufferLen = rcode; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_RawDump, "Received %d bytes\n", rcode); - - // Notify app. - ////////////// - return GHIRecvData; -} - -int ghiDoSend -( - struct GHIConnection * connection, - const char * buffer, - int len -) -{ - int rcode; - - if (buffer == NULL || len == 0) - return 0; - - // Do the send. - /////////////// - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mSessionEstablished == GHTTPTrue && - connection->encryptor.mEncryptOnSend == GHTTPTrue) - { - int bytesSent = 0; - GHIEncryptionResult result; - - // send through encryption engine - result = ghiEncryptorSslEncryptSend(connection, &connection->encryptor, buffer, len, &bytesSent); - - // Check for an error. - ////////////////////// - if(result != GHIEncryptionResult_Success) - rcode = -1; // signal termination of connection - else - rcode = bytesSent; - } - else - { - // send directly to socket - rcode = send(connection->socket, buffer, len, 0); - } - - // Check for an error. - ////////////////////// - if(gsiSocketIsError(rcode)) - { - int error; - - // Would block just means 0 bytes sent. - /////////////////////////////////////// - error = GOAGetLastError(connection->socket); - if((error == WSAEWOULDBLOCK) || (error == WSAEINPROGRESS) || (error == WSAETIMEDOUT)) - return 0; - - connection->completed = GHTTPTrue; - connection->result = GHTTPSocketFailed; - connection->socketError = error; - - return -1; - } - - //do not add CRLF as part of bytes posted - make sure waitPostContinue is false - if(connection->state == GHTTPPosting && connection->postingState.waitPostContinue == GHTTPFalse) - { - connection->postingState.bytesPosted += rcode; - ghiLogRequest(buffer, rcode); - } - - return rcode; -} - -GHITrySendResult ghiTrySendThenBuffer -( - GHIConnection * connection, - const char * buffer, - int len -) -{ - int rcode = 0; - - // **SSL pattern 1: buffer everything into an SSL record** - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mSessionEstablished == GHTTPTrue && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - if (!ghiEncryptDataToBuffer(&connection->sendBuffer, buffer + rcode, len - rcode)) - return GHITrySendError; - - // Try to send immediately - if (ghiSendBufferedData(connection) == GHTTPFalse) - return GHITrySendError; - if (connection->sendBuffer.pos >= connection->sendBuffer.len) - { - ghiResetBuffer(&connection->sendBuffer); - return GHITrySendSent; // everything sent - } - return GHITrySendBuffered; - } - - // **Plain text or SSL encrypt on send** - - // If we already have something buffered, don't send. - ///////////////////////////////////////////////////// - if(connection->sendBuffer.pos >= connection->sendBuffer.len) - { - // Try and send. - //////////////// - rcode = ghiDoSend(connection, buffer, len); - if(gsiSocketIsError(rcode)) - return GHITrySendError; - - // Was it all sent? - /////////////////// - if(rcode == len) - return GHITrySendSent; - } - - // Buffer whatever wasn't sent. - /////////////////////////////// - if(!ghiAppendDataToBuffer(&connection->sendBuffer, buffer + rcode, len - rcode)) - return GHITrySendError; - return GHITrySendBuffered; -} - -static GHTTPBool ghiParseProxyServer -( - const char * server, - char ** proxyAddress, // [out] the proxy address - unsigned short * proxyPort // [out] the proxy port -) -{ - char * strPort; - - // Make sure each pointer is valid as well as what it points to - assert(server && *server); - assert(proxyAddress && !*proxyAddress); - assert(proxyPort); - - // Copy off the server address. - /////////////////////////////// - *proxyAddress = goastrdup(server); - if(!*proxyAddress) - return GHTTPFalse; - - // Check for a port. - //////////////////// - if((strPort = strchr(*proxyAddress, ':')) != NULL) - { - *strPort++ = '\0'; - - // Try getting the port. - //////////////////////// - *proxyPort = (unsigned short)atoi(strPort); - if(!*proxyPort) - { - gsifree(*proxyAddress); - *proxyAddress = NULL; - return GHTTPFalse; - } - } - else - { - *proxyPort = GHI_DEFAULT_PORT; - } - return GHTTPTrue; -} - -GHTTPBool ghiSetProxy -( - const char * server -) -{ - // Free any existing proxy address. - /////////////////////////////////// - if(ghiProxyAddress) - { - gsifree(ghiProxyAddress); - ghiProxyAddress = NULL; - } - ghiProxyPort = 0; - - // If a server was supplied, try to parse it - if(server && *server) - return ghiParseProxyServer(server, &ghiProxyAddress, &ghiProxyPort); - - // No server supplied results in proxy being cleared - return GHTTPTrue; -} - -GHTTPBool ghiSetRequestProxy -( - GHTTPRequest request, - const char * server -) -{ - // Obtain the connection for this request - GHIConnection* connection = ghiRequestToConnection(request); - if (connection == NULL) - return GHTTPFalse; - - // Free any existing proxy address. - /////////////////////////////////// - if(connection->proxyOverrideServer) - { - gsifree(connection->proxyOverrideServer); - connection->proxyOverrideServer = NULL; - connection->proxyOverridePort = GHI_DEFAULT_PORT; - } - - // If a server was supplied, try to parse it - if(server && *server) - return ghiParseProxyServer(server, &connection->proxyOverrideServer, &connection->proxyOverridePort); - - // No server supplied results in proxy being cleared - return GHTTPTrue; -} - -void ghiThrottleSettings -( - int bufferSize, - gsi_time timeDelay -) -{ - ghiThrottleBufferSize = bufferSize; - ghiThrottleTimeDelay = timeDelay; -} - -// Re-enable previously disabled compiler warnings -/////////////////////////////////////////////////// -#if defined(_MSC_VER) -#pragma warning ( default: 4127 ) -#endif // _MSC_VER - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCommon.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCommon.h deleted file mode 100644 index 2034e80f6af..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpCommon.h +++ /dev/null @@ -1,154 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPCOMMON_H_ -#define _GHTTPCOMMON_H_ - -#include "ghttp.h" -#include "ghttpConnection.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// HTTP Line-terminator. -//////////////////////// -#define CRLF "\xD\xA" - -// HTTP URL Encoding -//////////////////////// -#define GHI_LEGAL_URLENCODED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@-.*" -#define GHI_DIGITS "0123456789ABCDEF" - -// Default HTTP port. -///////////////////// -#define GHI_DEFAULT_PORT 80 -#define GHI_DEFAULT_SECURE_PORT 443 -#define GHI_DEFAULT_THROTTLE_BUFFER_SIZE 125 -#define GHI_DEFAULT_THROTTLE_TIME_DELAY 250 - -// Proxy server. -//////////////// -extern char * ghiProxyAddress; -extern unsigned short ghiProxyPort; - -// Throttle settings. -///////////////////// -extern int ghiThrottleBufferSize; -extern gsi_time ghiThrottleTimeDelay; - -// Our thread lock. -/////////////////// -void ghiCreateLock(void); -void ghiFreeLock(void); -void ghiLock(void); -void ghiUnlock(void); - -// Do logging. -////////////// -#ifdef HTTP_LOG -void ghiLogToFile -( - const char * buffer, - int len, - const char * fileName -); -#define ghiLogRequest(b,c) ghiLogToFile(b,c,"request.log"); -#define ghiLogResponse(b,c) ghiLogToFile(b,c,"response.log"); -#define ghiLogPost(b,c) ghiLogToFile(b,c,"post.log"); -#else -#define ghiLogRequest(b,c) -#define ghiLogResponse(b,c) -#define ghiLogPost(b,c) -#endif - - -// Possible results from ghiDoReceive. -////////////////////////////////////// -typedef enum -{ - GHIRecvData, // Data was received. - GHINoData, // No data was available. - GHIConnClosed, // The connection was closed. - GHIError // There was a socket error. -} GHIRecvResult; - -// Receive some data. -///////////////////// -GHIRecvResult ghiDoReceive -( - GHIConnection * connection, - char buffer[], - int * bufferLen -); - -// Do a send on the connection's socket. -// Returns number of bytes sent (0 or more). -// If error, returns (-1). -//////////////////////////////////////////// -int ghiDoSend -( - GHIConnection * connection, - const char * buffer, - int len -); - -// Results for ghtTrySendThenBuffer. -//////////////////////////////////// -typedef enum -{ - GHITrySendError, // There was an error sending. - GHITrySendSent, // Everything was sent. - GHITrySendBuffered // Some or all of the data was buffered. -} GHITrySendResult; - -// Sends whatever it can on the socket. -// Buffers whatever can't be sent in the sendBuffer. -//////////////////////////////////////////////////// -GHITrySendResult ghiTrySendThenBuffer -( - GHIConnection * connection, - const char * buffer, - int len -); - -// Set the proxy server -//////////////////////// -GHTTPBool ghiSetProxy -( - const char * server -); - -// Set the proxy server for a specific request -//////////////////////// -GHTTPBool ghiSetRequestProxy -( - GHTTPRequest request, - const char * server -); - -// Set the throttle settings. -///////////////////////////// -void ghiThrottleSettings -( - int bufferSize, - gsi_time timeDelay -); - -// Decrypt data from the decode buffer into the receive buffer. -/////////////////////////////////////////////////////////////// -GHTTPBool ghiDecryptReceivedData(struct GHIConnection * connection); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpConnection.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpConnection.c deleted file mode 100644 index a0882b07f80..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpConnection.c +++ /dev/null @@ -1,424 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "ghttpConnection.h" -#include "ghttpCommon.h" - -// Initial size and increment amount for the connections array. -/////////////////////////////////////////////////////////////// -#define CONNECTIONS_CHUNK_LEN 4 - -// An array of pointers to GHIConnection objects. -// A GHTTPRequest is an index into this array. -///////////////////////////////////////////////// -static GHIConnection ** ghiConnections; -static int ghiConnectionsLen; -static int ghiNumConnections; -static int ghiNextUniqueID; - -// Finds a gsifree slot in the ghiConnections array. -// If there are no gsifree slots, the array size will be increased. -//////////////////////////////////////////////////////////////// -static int ghiFindFreeSlot -( - void -) -{ - int i; - GHIConnection ** tempPtr; - int oldLen; - int newLen; - - // Look for an open slot. - ///////////////////////// - for(i = 0 ; i < ghiConnectionsLen ; i++) - { - if(!ghiConnections[i]->inUse) - return i; - } - - assert(ghiNumConnections == ghiConnectionsLen); - - // Nothing found, resize the array. - /////////////////////////////////// - oldLen = ghiConnectionsLen; - newLen = (ghiConnectionsLen + CONNECTIONS_CHUNK_LEN); - tempPtr = (GHIConnection **)gsirealloc(ghiConnections, sizeof(GHIConnection *) * newLen); - if(!tempPtr) - return -1; - ghiConnections = tempPtr; - - // Create the new connection objects. - ///////////////////////////////////// - for(i = oldLen ; i < newLen ; i++) - { - ghiConnections[i] = (GHIConnection *)gsimalloc(sizeof(GHIConnection)); - if(!ghiConnections[i]) - { - for(i-- ; i >= oldLen ; i--) - gsifree(ghiConnections[i]); - return -1; - } - ghiConnections[i]->inUse = GHTTPFalse; - } - - // Update the length. - ///////////////////// - ghiConnectionsLen = newLen; - - return oldLen; -} - -GHIConnection * ghiNewConnection -( - void -) -{ - int slot; - GHIConnection * connection; - GHTTPBool bResult; - - ghiLock(); - - // Find a gsifree slot. - //////////////////// - slot = ghiFindFreeSlot(); - if(slot == -1) - { - ghiUnlock(); - return NULL; - } - - // Get a pointer to the object. - /////////////////////////////// - connection = ghiConnections[slot]; - - // Init the object. - /////////////////// - memset(connection, 0, sizeof(GHIConnection)); - connection->inUse = GHTTPTrue; - connection->request = (GHTTPRequest)slot; - connection->uniqueID = ghiNextUniqueID++; - connection->type = GHIGET; - connection->state = GHTTPSocketInit; - connection->URL = NULL; - connection->serverAddress = NULL; - connection->serverIP = INADDR_ANY; - connection->serverPort = (unsigned short)0; - connection->requestPath = NULL; - connection->sendHeaders = NULL; - connection->saveFile = NULL; - connection->blocking = GHTTPFalse; - connection->persistConnection = GHTTPFalse; - connection->result = GHTTPSuccess; - connection->progressCallback = NULL; - connection->completedCallback = NULL; - connection->callbackParam = NULL; - connection->socket = INVALID_SOCKET; - connection->socketError = 0; - connection->userBufferSupplied = GHTTPFalse; - connection->statusMajorVersion = 0; - connection->statusMinorVersion = 0; - connection->statusCode = 0; - connection->statusStringIndex = 0; - connection->headerStringIndex = 0; - connection->completed = GHTTPFalse; - connection->fileBytesReceived = 0; - connection->totalSize = -1; - connection->redirectURL = NULL; - connection->redirectCount = 0; - connection->chunkedTransfer = GHTTPFalse; - connection->processing = GHTTPFalse; - connection->throttle = GHTTPFalse; - connection->lastThrottleRecv = 0; - connection->post = NULL; - connection->maxRecvTime = 500; // Prevent blocking in async mode with systems that never generate WSAEWOULDBLOCK - connection->proxyOverridePort = GHI_DEFAULT_PORT; - connection->proxyOverrideServer = NULL; - connection->encryptor.mInterface = NULL; - -//handle used for asynch DNS lookups -#if !defined(GSI_NO_THREADS) - connection->handle = NULL; -#endif - - bResult = ghiInitBuffer(connection, &connection->sendBuffer, SEND_BUFFER_INITIAL_SIZE, SEND_BUFFER_INCREMENT_SIZE); - if(bResult) - bResult = ghiInitBuffer(connection, &connection->encodeBuffer, ENCODE_BUFFER_INITIAL_SIZE, ENCODE_BUFFER_INCREMENT_SIZE); - if(bResult) - bResult = ghiInitBuffer(connection, &connection->recvBuffer, RECV_BUFFER_INITIAL_SIZE, RECV_BUFFER_INCREMENT_SIZE); - if (bResult) - bResult = ghiInitBuffer(connection, &connection->decodeBuffer, DECODE_BUFFER_INITIAL_SIZE, DECODE_BUFFER_INCREMENT_SIZE); - - if(!bResult) - { - ghiFreeConnection(connection); - ghiUnlock(); - return NULL; - } - - // One more connection. - /////////////////////// - ghiNumConnections++; - - ghiUnlock(); - - return connection; -} - -GHTTPBool ghiFreeConnection -( - GHIConnection * connection -) -{ - assert(connection); - assert(connection->request >= 0); - assert(connection->request < ghiConnectionsLen); - assert(connection->inUse); - - // Check args. - ////////////// - if(!connection) - return GHTTPFalse; - if(!connection->inUse) - return GHTTPFalse; - if(connection->request < 0) - return GHTTPFalse; - if(connection->request >= ghiConnectionsLen) - return GHTTPFalse; - - ghiLock(); - - // Free data. - ///////////// - gsifree(connection->URL); - gsifree(connection->serverAddress); - gsifree(connection->requestPath); - gsifree(connection->sendHeaders); - gsifree(connection->redirectURL); - gsifree(connection->proxyOverrideServer); -#ifndef NOFILE - if(connection->saveFile) - fclose(connection->saveFile); -#endif - if(connection->socket != INVALID_SOCKET) - { - shutdown(connection->socket, 2); - closesocket(connection->socket); - } - ghiFreeBuffer(&connection->sendBuffer); - ghiFreeBuffer(&connection->encodeBuffer); - ghiFreeBuffer(&connection->recvBuffer); - ghiFreeBuffer(&connection->decodeBuffer); - ghiFreeBuffer(&connection->getFileBuffer); - if(connection->postingState.states) - ghiPostCleanupState(connection); - -#if !defined(GSI_NO_THREADS) - // Cancel and free asychronous lookup if it has not already been done - ///////////////////////////////////////////////////////////////////// - if (connection->handle) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, - "Cancelling Thread and freeing memory\n"); - gsiCancelResolvingHostname(connection->handle); - } -#endif - - // Check for an auto-free post. - /////////////////////////////// - if(connection->post && ghiIsPostAutoFree(connection->post)) - { - ghiFreePost(connection->post); - connection->post = NULL; - } - - // Check for an encryptor - if (connection->encryptor.mInitialized != GHTTPFalse) - { - if (connection->encryptor.mCleanupFunc) - (connection->encryptor.mCleanupFunc)(connection, &connection->encryptor); - connection->encryptor.mInitialized = GHTTPFalse; - } - - // Free the slot. - ///////////////// - connection->inUse = GHTTPFalse; - - // One less connection. - /////////////////////// - ghiNumConnections--; - - ghiUnlock(); - - return GHTTPTrue; -} - -GHIConnection * ghiRequestToConnection -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - assert(request >= 0); - assert(request < ghiConnectionsLen); - - ghiLock(); - - // Check args. - ////////////// - if((request < 0) || (request >= ghiConnectionsLen)) - { - ghiUnlock(); - return NULL; - } - - connection = ghiConnections[request]; - - // Check for not in use. - //////////////////////// - if(!connection->inUse) - connection = NULL; - - ghiUnlock(); - - return connection; -} - -void ghiEnumConnections -( - GHTTPBool (* callback)(GHIConnection *) -) -{ - int i; - - // Check for no connections. - //////////////////////////// - if(ghiNumConnections <= 0) - return; - - ghiLock(); - for(i = 0 ; i < ghiConnectionsLen ; i++) - if(ghiConnections[i]->inUse) - callback(ghiConnections[i]); - ghiUnlock(); -} - -void ghiRedirectConnection -( - GHIConnection * connection -) -{ - assert(connection); - assert(connection->redirectURL); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Redirecting Connection\n"); - - // Reset state. - /////////////// - connection->state = GHTTPSocketInit; - -#if !defined(GSI_NO_THREADS) - // Cancel and free asychronous lookup if it has not already been done - ///////////////////////////////////////////////////////////////////// - if (connection->handle) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, - "Cancelling Thread and freeing memory\n"); - gsiCancelResolvingHostname(connection->handle); - } -#endif - - // New URL. - /////////// - gsifree(connection->URL); - connection->URL = connection->redirectURL; - connection->redirectURL = NULL; - - // Reset stuff parsed from the URL. - /////////////////////////////////// - gsifree(connection->serverAddress); - connection->serverAddress = NULL; - connection->serverIP = 0; - connection->serverPort = 0; - gsifree(connection->requestPath); - connection->requestPath = NULL; - - // Close the socket. - //////////////////// - shutdown(connection->socket, 2); - closesocket(connection->socket); - connection->socket = INVALID_SOCKET; - - // Reset buffers. - ///////////////// - ghiResetBuffer(&connection->sendBuffer); - ghiResetBuffer(&connection->encodeBuffer); - ghiResetBuffer(&connection->recvBuffer); - ghiResetBuffer(&connection->decodeBuffer); - - // Reset status. - //////////////// - connection->statusMajorVersion = 0; - connection->statusMinorVersion = 0; - connection->statusCode = 0; - connection->statusStringIndex = 0; - - connection->headerStringIndex = 0; - - // The connection isn't closed. - /////////////////////////////// - connection->connectionClosed = GHTTPFalse; - - // Check for an encryptor - if (connection->encryptor.mInitialized != GHTTPFalse) - { - // cleanup the encryptor - if (connection->encryptor.mCleanupFunc) - (connection->encryptor.mCleanupFunc)(connection, &connection->encryptor); - connection->encryptor.mInitialized = GHTTPFalse; - - // if the redirect isn't secure, clear it - if(strncmp("https://", connection->URL, 8) != 0) - { - connection->encryptor.mEngine = GHTTPEncryptionEngine_None; - connection->encryptor.mInterface = NULL; - } - } - - // One more redirect. - ///////////////////// - connection->redirectCount++; -} - -void ghiCleanupConnections -( - void -) -{ - int i; - - if(!ghiConnections) - return; - - // Cleanup all running connections. - /////////////////////////////////// - ghiEnumConnections(ghiFreeConnection); - - // Cleanup the connection states. - ///////////////////////////////// - for(i = 0 ; i < ghiConnectionsLen ; i++) - gsifree(ghiConnections[i]); - gsifree(ghiConnections); - ghiConnections = NULL; - ghiConnectionsLen = 0; - ghiNumConnections = 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpConnection.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpConnection.h deleted file mode 100644 index b80b3bbfc94..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpConnection.h +++ /dev/null @@ -1,217 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPCONNECTION_H_ -#define _GHTTPCONNECTION_H_ - -#include "ghttpMain.h" -#include "ghttpEncryption.h" -#include "ghttpBuffer.h" -#include "ghttpPost.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Initial size and increment amount for the send buffer. -///////////////////////////////////////////////////////// -#define SEND_BUFFER_INITIAL_SIZE (2 * 1024) -#define SEND_BUFFER_INCREMENT_SIZE (4 * 1024) - -// Initial size and increment amount for the recv buffer. -///////////////////////////////////////////////////////////////// -#define RECV_BUFFER_INITIAL_SIZE (2 * 1024) -#define RECV_BUFFER_INCREMENT_SIZE (2 * 1024) - -// Initial size and increment amount for the get file buffer. -///////////////////////////////////////////////////////////// -#define GET_FILE_BUFFER_INITIAL_SIZE (2 * 1024) -#define GET_FILE_BUFFER_INCREMENT_SIZE (2 * 1024) - -// Initial size and increment amount for the ssl encoding buffer. -///////////////////////////////////////////////////////////////// -#define ENCODE_BUFFER_INITIAL_SIZE (2 * 1024) -#define ENCODE_BUFFER_INCREMENT_SIZE (1 * 1024) - -// Initial size and increment amount for the ssl decoding buffer. -///////////////////////////////////////////////////////////////// -#define DECODE_BUFFER_INITIAL_SIZE (2 * 1024) -#define DECODE_BUFFER_INCREMENT_SIZE (1 * 1024) - -// The size of the buffer for chunk headers (NOT including the NUL). -//////////////////////////////////////////////////////////////////// -#define CHUNK_HEADER_SIZE 10 - -// The type of request made. -//////////////////////////// -typedef enum -{ - GHIGET, // Buffer the file. - GHISAVE, // Save the file to disk. - GHISTREAM, // Stream the file. - GHIHEAD, // Get just the headers for a request. - GHIPOST // Only posting data (all types can post). -} GHIRequestType; - -// Chunk-reading states. -//////////////////////// -typedef enum -{ - CRHeader, // Reading a chunk header. - CRChunk, // Reading chunk (actual content). - CRCRLF, // Reading the CRLF at the end of a chunk. - CRFooter // Reading the footer at the end of the file (chunk with size of 0). -} CRState; - -// Protocol. -//////////// -typedef enum -{ - GHIHttp, - GHIHttps -} GHIProtocol; - -// This is the data for a single http connection. -///////////////////////////////////////////////// -typedef struct GHIConnection -{ - GHTTPBool inUse; // If true, this connection object is being used. - GHTTPRequest request; // This object's request index. - int uniqueID; // Every connection object has a unqiue ID. - - GHIRequestType type; // The type of request this connection is for. - - GHTTPState state; // The state of the request. - - char * URL; // The URL for the file. - char * serverAddress; // The address of the server as contained in the URL. - unsigned int serverIP; // The server's IP. - unsigned short serverPort; // The server's port. - char * requestPath; // The path as contained in the URL. - - GHIProtocol protocol; // Protocol used for this connection. - - char * sendHeaders; // Optional headers to pass with the request. - - FILE * saveFile; // If saving to disk, the file being saved to. - - GHTTPBool blocking; // Blocking flag. - - GHTTPBool persistConnection; // If TRUE, Connection: close will not be sent in the headers and the connection will be left open - - GHTTPResult result; // The result of the request. - ghttpProgressCallback progressCallback; // Called periodically with progress updates. - ghttpCompletedCallback completedCallback; // Called when the file has been received. - void * callbackParam; // User-data to be passed to the callbacks. - - SOCKET socket; // The socket for this connection. - int socketError; // If there was a socket error, the last error code is stored here. - - GHIBuffer sendBuffer; // The buffer for outgoing data. - GHIBuffer encodeBuffer; // The buffer for outgoing data. (will be encrypted; only used with https) - GHIBuffer recvBuffer; // The buffer for incoming data. (plain text) - GHIBuffer decodeBuffer; // The buffer for incoming data. (encrypted)(only used with https) - - GHIBuffer getFileBuffer; // ghttpGetFile[Ex] uses this buffer (which may be user-supplied). - GHTTPBool userBufferSupplied; // True if a user buffer was supplied. - - int statusMajorVersion; // The major-version number from the server's response. - int statusMinorVersion; // The minor-version number from the server's response. - int statusCode; // The status-code from the server's response. - int statusStringIndex; // Index in the recvBuffer where the status string starts. - - int headerStringIndex; // Index in the recvBuffer where the headers begin - - GHTTPBool completed; // This connection is completed - call the callback and kill it. - - GHTTPByteCount fileBytesReceived; // Number of file bytes received. - GHTTPByteCount totalSize; // Total size of the file, -1 if unknown. - - char * redirectURL; // If this is not NULL, we need to redirect the download to this URL. - int redirectCount; // Number of redirections done for this request. - - GHTTPBool chunkedTransfer; // The body of the response is chunky ("Transfer-Encoding: chunked"). - char chunkHeader[CHUNK_HEADER_SIZE + 1]; // Partial chunk headers are stored in here. - int chunkHeaderLen; // The number of bytes in chunkHeader. - int chunkBytesLeft; // Number of bytes left in the chunk (only valid for CRChunk). - CRState chunkReadingState; // Determines if a chunk header or chunk data is being read. - - GHTTPBool processing; // If true, being processed. Used to prevent recursive processing. - GHTTPBool connectionClosed; // If true, the connection has been closed (orderly or abortive) - - GHTTPBool throttle; // If true, throttle this connection. - gsi_time lastThrottleRecv; // The last time we received on a throttled connection. - - GHTTPPost post; // If not NULL, a reference to a post object to upload with the request. - GHIPostingState postingState; // If posting, the state of the upload. - - gsi_time maxRecvTime; // Max time spent receiving per call to "Think" - Prevents blocking on ultrafast connections - char * proxyOverrideServer; // Allows use of a different proxy than the global proxy - unsigned short proxyOverridePort; - - struct GHIEncryptor encryptor; - -#if !defined(GSI_NO_THREADS) - GSIResolveHostnameHandle handle; //handle used for asychronous DNS lookups -#endif - -} GHIConnection; - -// Create a new connection object. -// Returns NULL on failure. -////////////////////////////////// -GHIConnection * ghiNewConnection -( - void -); - -// Frees the connection object. -/////////////////////////////// -GHTTPBool ghiFreeConnection -( - GHIConnection * connection -); - -// Returns the connection object for a request index. -// Returns NULL if the index is bad. -///////////////////////////////////////////////////// -GHIConnection * ghiRequestToConnection -( - GHTTPRequest request -); - -// Calls the callback on each connection. -///////////////////////////////////////// -void ghiEnumConnections -( - GHTTPBool (* callback)(GHIConnection *) -); - -// Redirects the given connection. -// Resets the connection to get the -// file at connection->redirectURL. -/////////////////////////////////// -void ghiRedirectConnection -( - GHIConnection * connection -); - -// Kills all connections and frees up all memory. -///////////////////////////////////////////////// -void ghiCleanupConnections -( - void -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpEncryption.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpEncryption.c deleted file mode 100644 index ccc579cd6e2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpEncryption.c +++ /dev/null @@ -1,1786 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "ghttpCommon.h" -#if defined(MATRIXSSL) -#include "../matrixssl/matrixssl.h" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -GHTTPBool ghttpSetRequestEncryptionEngine(GHTTPRequest request, GHTTPEncryptionEngine engine) -{ - GHIConnection * connection = ghiRequestToConnection(request); - if(!connection) - return GHTTPFalse; - - // Translate default into the actual engine name - // We don't want to set the engine value to "default" because - // we'd lose the ability to determine the engine name in other places - if (engine == GHTTPEncryptionEngine_Default) - { - #if defined(MATRIXSSL) - engine = GHTTPEncryptionEngine_MatrixSsl; - #elif defined(REVOEXSSL) - engine = GHTTPEncryptionEngine_RevoEx; - #else - engine = GHTTPEncryptionEngine_GameSpy; - #endif - } - - // If the same engine has previously been set then we're done - if (connection->encryptor.mEngine == engine) - return GHTTPTrue; - - // If a different engine has previously been set then we're screwed - if (connection->encryptor.mInterface != NULL && - connection->encryptor.mEngine != engine) - { - return GHTTPFalse; - } - - // If the URL is HTTPS but the engine is specific as NONE then we can't connect - if((engine == GHTTPEncryptionEngine_None) && (strncmp(connection->URL, "https://", 8) == 0)) - return GHTTPFalse; - - // Initialize the engine - connection->encryptor.mEngine = engine; - - if (engine == GHTTPEncryptionEngine_None) - { - connection->encryptor.mInterface = NULL; - return GHTTPTrue; // this is the default, just return - } - else - { - // 02OCT07 BED: Design was changed to only allow one engine at a time - // Assert that the specified engine is the one supported - if (engine != GHTTPEncryptionEngine_Default) - { - #if defined(MATRIXSSL) - GS_ASSERT(engine==GHTTPEncryptionEngine_MatrixSsl); - #elif defined(REVOEXSSL) - GS_ASSERT(engine==GHTTPEncryptionEngine_RevoEx); - #else - GS_ASSERT(engine==GHTTPEncryptionEngine_GameSpy); - #endif - } - - connection->encryptor.mInterface = NULL; - connection->encryptor.mInitFunc = ghiEncryptorSslInitFunc; - connection->encryptor.mStartFunc = ghiEncryptorSslStartFunc; - connection->encryptor.mCleanupFunc = ghiEncryptorSslCleanupFunc; - connection->encryptor.mEncryptFunc = ghiEncryptorSslEncryptFunc; - connection->encryptor.mDecryptFunc = ghiEncryptorSslDecryptFunc; - connection->encryptor.mInitialized = GHTTPFalse; - connection->encryptor.mSessionStarted = GHTTPFalse; - connection->encryptor.mSessionEstablished = GHTTPFalse; - connection->encryptor.mEncryptOnBuffer = GHTTPTrue; - connection->encryptor.mEncryptOnSend = GHTTPFalse; - connection->encryptor.mLibSendsHandshakeMessages = GHTTPFalse; - return GHTTPTrue; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// ********************* MATRIXSSL ENCRYPTION ENGINE ********************* // -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifdef MATRIXSSL - -// SSL requires a certificate validator -static int ghiSslCertValidator(struct sslCertInfo* theCertInfo, void* theUserData) -{ - // Taken from matrisSslExample - sslCertInfo_t *next; -/* - Make sure we are checking the last cert in the chain -*/ - next = theCertInfo; - while (next->next != NULL) { - next = next->next; - } - return next->verified; -} - -// Init the engine -GHIEncryptionResult ghiEncryptorSslInitFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - sslKeys_t *keys = NULL; - sslSessionId_t *id = NULL; - - int ecodeResult; - - if (matrixSslOpen() < 0) - return GHIEncryptionResult_Error; - - if (matrixSslReadKeys(&keys, NULL, NULL, NULL, NULL) < 0) - return GHIEncryptionResult_Error; - - if (matrixSslNewSession((ssl_t**)&theEncryptor->mInterface, keys, id, 0) < 0) - return GHIEncryptionResult_Error; - - matrixSslSetCertValidator((ssl_t*)theEncryptor->mInterface, ghiSslCertValidator, NULL); - - theEncryptor->mInitialized = GHTTPTrue; - return GHIEncryptionResult_Success; -} - -// Start the handshake process -GHIEncryptionResult ghiEncryptorSslInitFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - sslBuf_t helloWrapper; - - // Prepare the hello message - helloWrapper.buf = connection->sendBuffer.data; - helloWrapper.size = connection->sendBuffer.size; - helloWrapper.start = connection->sendBuffer.data + connection->sendBuffer.pos; - helloWrapper.end = helloWrapper.start; // start writing here - - ecodeResult = matrixSslEncodeClientHello((ssl_t*)theEncryptor->mInterface, &helloWrapper, 0); // 0 = cipher - if (ecodeResult != 0) - return GHIEncryptionResult_Error; // error! - - // Adjust the sendBuffer to account for the new data - connection->sendBuffer.len += (int)(helloWrapper.end - helloWrapper.start); - connection->sendBuffer.encrypted = GHTTPTrue; - theEncryptor->mSessionStarted = GHTTPTrue; -} - -// Destroy the engine -GHIEncryptionResult ghiEncryptorSslCleanupFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - matrixSslClose(); - return GHIEncryptionResult_Success; -} - -// Encrypt some data -// - theEncryptedLength is reduced by the length of data written to theEncryptedBuffer -GHIEncryptionResult ghiEncryptorSslEncryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - char * theEncryptedBuffer, - int * theEncryptedLength) -{ - int encodeResult = 0; - - // SSL buffer wrapper - // Append to theDecryptedBuffer - sslBuf_t encryptedBuf; - encryptedBuf.buf = theEncryptedBuffer; // buf starts here - encryptedBuf.start = theEncryptedBuffer; // readpos, set to start - encryptedBuf.end = theEncryptedBuffer; // writepos, set to start - encryptedBuf.size = *theEncryptedLength; // total size of buf - - // perform the encryption - encodeResult = matrixSslEncode(connection->encryptor.mInterface, - (unsigned char*)thePlainTextBuffer, *thePlainTextLength, &encryptedBuf); - - if (encodeResult == SSL_ERROR) - return GHIEncryptionResult_Error; - else if (encodeResult == SSL_FULL) - return GHIEncryptionResult_BufferTooSmall; - else - { - //*thePlainTextLength = *thePlainTextLength; // we always use the entire buffer - *theEncryptedLength -= (int)(encryptedBuf.end - encryptedBuf.start); - return GHIEncryptionResult_Success; - } -} - -// Decrypt some data -// - During the handshaking process, this may result in data being appended to the send buffer -// - Data may be left in the encrypted buffer -// - theEncryptedLength becomes the length of data read from theEncryptedBuffer -// - theDecryptedLength becomes the length of data written to theDecryptedBuffer -GHIEncryptionResult ghiEncryptorSslDecryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * theEncryptedBuffer, - int * theEncryptedLength, - char * theDecryptedBuffer, - int * theDecryptedLength) -{ - GHTTPBool decryptMore = GHTTPTrue; - int decodeResult = 0; - - // SSL buffer wrappers - sslBuf_t inBuf; - sslBuf_t decryptedBuf; - int encryptedStartSize = *theEncryptedLength; - - // Read from theEncryptedBuffer - Have to cast away the "const" - inBuf.buf = (unsigned char*)theEncryptedBuffer; - inBuf.start = (unsigned char*)theEncryptedBuffer; - inBuf.end = (unsigned char*)theEncryptedBuffer + *theEncryptedLength; - inBuf.size = *theEncryptedLength; - - // Append to theDecryptedBuffer - decryptedBuf.buf = theDecryptedBuffer; // buf starts here - decryptedBuf.start = theDecryptedBuffer; // readpos, set to start - decryptedBuf.end = theDecryptedBuffer; // writepos, set to start - decryptedBuf.size = *theDecryptedLength; // total size of buf - - // Perform the decode operation - // - may require multiple tries - while(decryptMore != GHTTPFalse && ((inBuf.end-inBuf.start) > 0)) - { - unsigned char error = 0; - unsigned char alertlevel = 0; - unsigned char alertdescription = 0; - - // perform the decode, this will decode a single SSL message at a time - decodeResult = matrixSslDecode(theEncryptor->mInterface, &inBuf, &decryptedBuf, - &error, &alertlevel, &alertdescription); - switch(decodeResult) - { - case SSL_SUCCESS: - // a message was handled internally by matrixssl - // No data is appeneded to the decrypted buffer - if (matrixSslHandshakeIsComplete(theEncryptor->mInterface)) - theEncryptor->mSessionEstablished = GHTTPTrue; - break; - - case SSL_PROCESS_DATA: - // We've received app data, continue on. - // App data was appended to the decrypted buffer - break; - - case SSL_SEND_RESPONSE: - { - // we must send an SSL response which has been written to decryptedBuf - // transfer this response to the connection's sendBuffer - int responseSize = decryptedBuf.end - decryptedBuf.start; - - // force disable-encryption - // this may seem like a hack, but it's the best way to avoid - // unnecessary data copies without modifying matrixSSL - theEncryptor->mSessionEstablished = GHTTPFalse; - ghiTrySendThenBuffer(connection, decryptedBuf.start, responseSize); - theEncryptor->mSessionEstablished = GHTTPTrue; - - // Remove the bytes from the decrypted buffer (we don't want to return them to the app) - decryptedBuf.end = decryptedBuf.start; // bug? - break; - } - - case SSL_ERROR: - // error decoding the data - decryptMore = GHTTPFalse; - break; - - case SSL_ALERT: - // server sent an alert - if (alertdescription == SSL_ALERT_CLOSE_NOTIFY) - decryptMore = GHTTPFalse; - break; - - case SSL_PARTIAL: - // need to read more data from the socket(inbuf incomplete) - decryptMore = GHTTPFalse; - break; - - case SSL_FULL: - { - // decodeBuffer is too small, need to increase size and try again - decryptMore = GHTTPFalse; - break; - } - }; - } - - // Store off the lengths - *theEncryptedLength = encryptedStartSize - (inBuf.end - inBuf.start); - *theDecryptedLength = decryptedBuf.end - decryptedBuf.start; - - // Return status to app - if (decodeResult == SSL_FULL) - return GHIEncryptionResult_BufferTooSmall; - else if (decodeResult == SSL_ERROR || decodeResult == SSL_ALERT) - return GHIEncryptionResult_Error; - - //if ((int)(decryptedBuf.end - decryptedBuf.start) > 0) - // printf ("Decrypted: %d bytes\r\n", *theDecryptedLength); - return GHIEncryptionResult_Success; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// ********************* REVOEX SSL ENCRYPTION ENGINE ******************** // -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#elif defined(REVOEXSSL) -#include - -typedef struct gsRevoExInterface -{ - SSLId mId; - SSLClientCertId mClientCertId; - SSLRootCAId mRootCAId; - GHTTPBool mConnected; // means "connected to socket", not "connected to remote machine" -} gsRevoExInterface; - -// Init the engine -GHIEncryptionResult ghiEncryptorSslInitFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - int i=0; - gsRevoExInterface* sslInterface = NULL; - - // There is only one place where this function should be called, - // and it should check if the engine has been initialized - GS_ASSERT(theEncryptor->mInitialized == GHTTPFalse); - GS_ASSERT(theEncryptor->mInterface == NULL); - - // allocate the interface (need one per connection) - theEncryptor->mInterface = gsimalloc(sizeof(gsRevoExInterface)); - if (theEncryptor->mInterface == NULL) - { - // memory allocation failed - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Memory, GSIDebugLevel_WarmError, - "Failed to allocate SSL interface (out of memory: %d bytes)\r\n", sizeof(gsRevoExInterface)); - return GHIEncryptionResult_Error; - } - memset(theEncryptor->mInterface, 0, sizeof(gsRevoExInterface)); - sslInterface = (gsRevoExInterface*)theEncryptor->mInterface; - - { - int verifyOption = 0; - int rcode = 0; - - verifyOption = SSL_VERIFY_COMMON_NAME - | SSL_VERIFY_ROOT_CA - | SSL_VERIFY_DATE - | SSL_VERIFY_CHAIN - | SSL_VERIFY_SUBJECT_ALT_NAME; - - // todo serverAddress, is this used for certificate name? - sslInterface->mId = SSLNew(verifyOption, connection->serverAddress); - - rcode = SSLSetBuiltinRootCA(sslInterface->mId, SSL_ROOTCA_NINTENDO_1); - if(rcode != SSL_ENONE){ - SSLShutdown(sslInterface->mId); - return GHIEncryptionResult_Error; - } - - rcode = SSLSetBuiltinClientCert(sslInterface->mId, SSL_CLIENTCERT_NINTENDO_0); - if(rcode != SSL_ENONE){ - SSLShutdown(sslInterface->mId); - return GHIEncryptionResult_Error; - } - } - - theEncryptor->mInitialized = GHTTPTrue; - theEncryptor->mSessionStarted = GHTTPFalse; - theEncryptor->mSessionEstablished = GHTTPFalse; - //theEncryptor->mUseSSLConnect = GHTTPTrue; - theEncryptor->mEncryptOnBuffer = GHTTPFalse; - theEncryptor->mEncryptOnSend = GHTTPTrue; - theEncryptor->mLibSendsHandshakeMessages = GHTTPTrue; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx engine) initialized\r\n"); - - return GHIEncryptionResult_Success; -} - - -// Destroy the engine -GHIEncryptionResult ghiEncryptorSslCleanupFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - if (theEncryptor != NULL) - { - gsRevoExInterface* sslInterface = (gsRevoExInterface*)theEncryptor->mInterface; - if (sslInterface != NULL) - { - SSLShutdown(sslInterface->mId); - gsifree(sslInterface); - theEncryptor->mInterface = NULL; - } - theEncryptor->mInitialized = GHTTPFalse; - theEncryptor->mSessionStarted = GHTTPFalse; - theEncryptor->mSessionEstablished = GHTTPFalse; - } - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) engine cleanup called\r\n"); - - GSI_UNUSED(connection); - - return GHIEncryptionResult_Success; -} - - -GHIEncryptionResult ghiEncryptorSslStartFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - gsRevoExInterface* sslInterface = (gsRevoExInterface*)theEncryptor->mInterface; - int result = 0; - - GS_ASSERT(theEncryptor->mSessionStarted == GHTTPFalse); - - // Call this only AFTER the socket has been connected to the remote server - if (!sslInterface->mConnected) - { - result = SSLConnect(sslInterface->mId, connection->socket); - if (result != SSL_ENONE) - { - switch(result) - { - case SSL_EFAILED: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLConnect failed (SSL_EFAILED)\r\n"); - break; - case SSL_ESSLID: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLConnect failed (SSL_ESSLID)\r\n"); - break; - default: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLConnect failed (Unhandled Error)\r\n"); - break; - } - return GHIEncryptionResult_Error; - } - sslInterface->mConnected = GHTTPTrue; - } - - GS_ASSERT(sslInterface->mConnected == GHTTPTrue); - - // begin securing the session - result = SSLDoHandshake(sslInterface->mId); - if (result != SSL_ENONE) - { - // Check for EWOULDBLOCK conditions - if (result == SSL_EWANT_READ || result == SSL_EWANT_WRITE) - return GHIEncryptionResult_Success; - - switch(result) - { - case SSL_EFAILED: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EFAILED)\r\n"); - break; - case SSL_ESSLID: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_ESSLID)\r\n"); - break; - case SSL_ESYSCALL: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_ESYSCALL)\r\n"); - break; - case SSL_EZERO_RETURN: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EZERO_RETURN)\r\n"); - break; - case SSL_EWANT_CONNECT: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EWANT_CONNECT)\r\n"); - break; - case SSL_EVERIFY_COMMON_NAME: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EVERIFY_COMMON_NAME)\r\n"); - break; - case SSL_EVERIFY_CHAIN: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EVERIFY_CHAIN)\r\n"); - break; - case SSL_EVERIFY_ROOT_CA: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EVERIFY_ROOT_CA)\r\n"); - break; - case SSL_EVERIFY_DATE: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (SSL_EVERIFY_DATE)\r\n"); - break; - default: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLDoHandshake failed (Unhandled Error)\r\n"); - break; - } - return GHIEncryptionResult_Error; - } - - // Success - theEncryptor->mSessionStarted = GHTTPTrue; - theEncryptor->mSessionEstablished = GHTTPTrue; - return GHIEncryptionResult_Success; -} - -// Encrypt and send some data -GHIEncryptionResult ghiEncryptorSslEncryptSend(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - int * theBytesSentOut) -{ - gsRevoExInterface* sslInterface = (gsRevoExInterface*)theEncryptor->mInterface; - int result = 0; - - result = SSLWrite(sslInterface->mId, thePlainTextBuffer, thePlainTextLength); - if (result == SSL_EZERO_RETURN) - { - // send 0 is not fatal - *theBytesSentOut = 0; - } - else if (result == SSL_EWANT_WRITE) - { - // signal socket error, GetLastError will return EWOULDBLOCK or EINPROGRESS - *theBytesSentOut = -1; - } - else if (result < 0) - { - switch(result) - { - case SSL_EFAILED: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLWrite failed (SSL_EFAILED)\r\n"); - break; - case SSL_ESSLID: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLWrite failed (SSL_ESSLID)\r\n"); - break; - case SSL_EWANT_READ: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLWrite failed (SSL_EWANT_READ)\r\n"); - break; - case SSL_ESYSCALL: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLWrite failed (SSL_ESYSCALL)\r\n"); - break; - case SSL_EWANT_CONNECT: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLWrite failed (SSL_EWANT_CONNECT)\r\n"); - break; - default: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLWrite failed (Unhandled Error)\r\n"); - break; - } - return GHIEncryptionResult_Error; - } - else - { - GS_ASSERT(result > 0); - *theBytesSentOut = result; - } - GSI_UNUSED(connection); - return GHIEncryptionResult_Success; -} - -// Receive and decrypt some data -GHIEncryptionResult ghiEncryptorSslDecryptRecv(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - char * theDecryptedBuffer, - int * theDecryptedLength) -{ - gsRevoExInterface* sslInterface = (gsRevoExInterface*)theEncryptor->mInterface; - int result = 0; - - result = SSLRead(sslInterface->mId, theDecryptedBuffer, *theDecryptedLength); - if (result == SSL_EZERO_RETURN) - { - // receive 0 is not fatal - *theDecryptedLength = 0; - } - else if (result == SSL_EWANT_READ) - { - // signal socket error, GetLastError will return EWOULDBLOCK or EINPROGRESS - *theDecryptedLength = -1; - } - else if (result < 0) - { - // Fatal errors - switch(result) - { - case SSL_EFAILED: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLRead failed (SSL_EFAILED)\r\n"); - break; - case SSL_ESSLID: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLRead failed (SSL_ESSLID)\r\n"); - break; - case SSL_EWANT_WRITE: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLRead failed (SSL_EWANT_WRITE)\r\n"); - break; - case SSL_ESYSCALL: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLRead failed (SSL_ESYSCALL)\r\n"); - break; - case SSL_EWANT_CONNECT: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLRead failed (SSL_EWANT_CONNECT)\r\n"); - break; - default: - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL (RevoEx) SSLRead failed (Unhandled Error)\r\n"); - break; - } - return GHIEncryptionResult_Error; - } - else - { - GS_ASSERT(result > 0); - *theDecryptedLength = result; - } - GSI_UNUSED(connection); - return GHIEncryptionResult_Success; -} - -GHIEncryptionResult ghiEncryptorSslEncryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - char * theEncryptedBuffer, - int * theEncryptedLength) -{ - GS_FAIL(); // Should never call this for RevoEx SSL! It uses encrypt on send - - GSI_UNUSED(connection); - GSI_UNUSED(theEncryptor); - GSI_UNUSED(thePlainTextBuffer); - GSI_UNUSED(thePlainTextLength); - GSI_UNUSED(theEncryptedBuffer); - GSI_UNUSED(theEncryptedLength); - - return GHIEncryptionResult_Error; -} - -GHIEncryptionResult ghiEncryptorSslDecryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * theEncryptedBuffer, - int * theEncryptedLength, - char * theDecryptedBuffer, - int * theDecryptedLength) -{ - GS_FAIL(); // Should never call this for RevoEx SSL! It uses decrypt on recv - - GSI_UNUSED(connection); - GSI_UNUSED(theEncryptor); - GSI_UNUSED(theEncryptedBuffer); - GSI_UNUSED(theEncryptedLength); - GSI_UNUSED(theDecryptedBuffer); - GSI_UNUSED(theDecryptedLength); - - return GHIEncryptionResult_Error; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// *********************** GS SSL ENCRYPTION ENGINE ********************** // -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#else - -#include "../common/gsSSL.h" -#include "../common/gsSHA1.h" -#include "../common/gsRC4.h" -#include "../md5.h" - - -// Processor for SSL state messages (transparent to application) -static GHIEncryptionResult ghiEncryptorProcessSSLHandshake(struct GHIConnection * connection, - struct GHIEncryptor * encryptor, - GHIBuffer * data); - -// SSL-ASN.1 lengths are variable length NBO integers -// we use this utility to make data packing easier -// example: 61 little-endian(intel) = 61 00 00 00 -// big-endian(network) = 00 00 00 61 -static void ghiEncryptorWriteNBOLength(unsigned char* buf, int value, int size) -{ - int NBO = (int)htonl(value); - unsigned char* NBOData = (unsigned char*)&NBO; - - assert(size <= sizeof(NBO)); - if (size > sizeof(NBO)) - return; // can't write more than 4 bytes! - - // this won't work if NBO ever changes from big-endian - memcpy(buf, NBOData+(sizeof(int)-size), (size_t)size); -} -static GHTTPBool ghiEncryptorReadNBOLength(GHIBuffer * data, int* value, int size) -{ - assert(size <= sizeof(*value)); - if (size > sizeof(*value)) - return GHTTPFalse; - if (GHTTPFalse == ghiReadDataFromBufferFixed(data, ((char*)value)+(sizeof(int)-size), size)) - return GHTTPFalse; - - *value = (int)htonl(*value); - return GHTTPTrue; -} - -static GHTTPBool ghiEncryptorParseASN1Sequence(GHIBuffer * data, int* lenOut) -{ - char tempChar = '\0'; - - if (GHTTPFalse == ghiReadDataFromBufferFixed(data, &tempChar, 1)) - return GHTTPFalse; - if (tempChar != 0x30) // sequence start byte - return GHTTPFalse; - - if (GHTTPFalse == ghiReadDataFromBufferFixed(data, &tempChar, 1)) - return GHTTPFalse; - if ((tempChar & 0x80) == 0x80) - { - int tempInt = 0; - - // length is stored in next (tempChar^0x80) bytes - tempChar ^= 0x80; - if (GHTTPFalse == ghiEncryptorReadNBOLength(data, &tempInt, tempChar)) - return GHTTPFalse; - if (tempInt > (data->len - data->pos)) - return GHTTPFalse; - - *lenOut = tempInt; - return GHTTPTrue; - } - else - { - if ((int)tempChar > (data->len - data->pos)) - return GHTTPFalse; - - *lenOut = tempChar; - return GHTTPTrue; - } -} - -static void ghiEncryptorGenerateEncryptionKeys(gsSSL* sslInterface) -{ - // Use the server random, client random and pre master secret - // to compute the encryption key. - - // SSLv3 style - // master_secret = { - // MD5(pre_master_secret + SHA1("A"+pre_master_secret+client_random+server_random)) + - // MD5(pre_master_secret + SHA1("BB"+pre_master_secret+client_random+server_random)) + - // MD5(pre_master_secret + SHA1("CCC"+pre_master_secret+client_random+server_random)) - // } - // key_block = { - // MD5(master_secret + SHA1("A"+master_secret+server_random+client_random)) + - // MD5(master_secret + SHA1("BB"+master_secret+server_random+client_random)) + - // MD5(master_secret + SHA1("CCC"+master_secret+server_random+client_random)) - - SHA1Context sha1; - MD5_CTX md5; - unsigned char temp[SHA1HashSize]; - - unsigned int randomSize = 32; - unsigned char keyblock[64]; // todo: support different key sizes - - // master_secret "A" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"A", 1); - SHA1Input(&sha1, (const unsigned char*)sslInterface->premastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->premastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final((unsigned char*)&sslInterface->mastersecret[0*GS_CRYPT_MD5_HASHSIZE], &md5); - - // master_secret "BB" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"BB", 2); - SHA1Input(&sha1, (const unsigned char*)sslInterface->premastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->premastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final((unsigned char*)&sslInterface->mastersecret[1*GS_CRYPT_MD5_HASHSIZE], &md5); - - // master_secret "CCC" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"CCC", 3); - SHA1Input(&sha1, (const unsigned char*)sslInterface->premastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->premastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final((unsigned char*)&sslInterface->mastersecret[2*GS_CRYPT_MD5_HASHSIZE], &md5); - - // key_block "A" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"A", 1); - SHA1Input(&sha1, (const unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final(&keyblock[0*GS_CRYPT_MD5_HASHSIZE], &md5); - - // key_block "BB" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"BB", 2); - SHA1Input(&sha1, (const unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final(&keyblock[1*GS_CRYPT_MD5_HASHSIZE], &md5); - - // key_block "CCC" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"CCC", 3); - SHA1Input(&sha1, (const unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final(&keyblock[2*GS_CRYPT_MD5_HASHSIZE], &md5); - - // key_block "DDDD" - SHA1Reset(&sha1); - SHA1Input(&sha1, (const unsigned char*)"DDDD", 4); - SHA1Input(&sha1, (const unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sha1, (const unsigned char*)sslInterface->serverRandom, randomSize); - SHA1Input(&sha1, (const unsigned char*)sslInterface->clientRandom, randomSize); - SHA1Result(&sha1, temp); - MD5Init(&md5); - MD5Update(&md5, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&md5, temp, GS_CRYPT_SHA1_HASHSIZE); - MD5Final(&keyblock[3*GS_CRYPT_MD5_HASHSIZE], &md5); - - // key_block "EEEEE" - // key_block "FFFFFF" - // ... continue if more key material is needed - - // todo: support different key sizes - // KEYBLOCK - // writemac[16], readmac[16], writekey[16], readkey[16], writeIV[0], readIV[0] - memcpy(sslInterface->clientWriteMACSecret, &keyblock[0], 16); - memcpy(sslInterface->clientReadMACSecret, &keyblock[16], 16); - memcpy(sslInterface->clientWriteKey, &keyblock[32], 16); - memcpy(sslInterface->clientReadKey, &keyblock[48], 16); - - sslInterface->clientWriteMACLen = 16; - sslInterface->clientReadMACLen = 16; - sslInterface->clientWriteKeyLen = 16; - sslInterface->clientReadKeyLen = 16; - - // Init the stream cipher - RC4Init(&sslInterface->sendRC4, (const unsigned char*)sslInterface->clientWriteKey, sslInterface->clientWriteKeyLen); - RC4Init(&sslInterface->recvRC4, (const unsigned char*)sslInterface->clientReadKey, sslInterface->clientReadKeyLen); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "Generated SSL session keys\r\n"); -} - - -// Init the engine -GHIEncryptionResult ghiEncryptorSslInitFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - gsSSL* sslInterface = NULL; - - // There is only one place where this function should be called, - // and it should check if the engine has been initialized - assert(theEncryptor->mInitialized == GHTTPFalse); - assert(theEncryptor->mInterface == NULL); - - // Make sure the send buffer is large enough for the SSL handshake (handshake is <1k) - if (connection->sendBuffer.size - connection->sendBuffer.len < sizeof(gsSSLClientHelloMsg)) - return GHIEncryptionResult_BufferTooSmall; - - // allocate the interface (need one per connection) - theEncryptor->mInterface = gsimalloc(sizeof(gsSSL)); - if (theEncryptor->mInterface == NULL) - { - // memory allocation failed - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Memory, GSIDebugLevel_WarmError, - "Failed to allocate SSL interface (out of memory: %d bytes)\r\n", sizeof(gsSSL)); - return GHIEncryptionResult_Error; - } - memset(theEncryptor->mInterface, 0, sizeof(gsSSL)); - sslInterface = (gsSSL*)theEncryptor->mInterface; - - theEncryptor->mInitialized = GHTTPTrue; - theEncryptor->mSessionStarted = GHTTPFalse; - theEncryptor->mSessionEstablished = GHTTPFalse; - theEncryptor->mEncryptOnBuffer = GHTTPTrue; - theEncryptor->mEncryptOnSend = GHTTPFalse; - theEncryptor->mLibSendsHandshakeMessages = GHTTPFalse; - MD5Init(&sslInterface->finishHashMD5); - SHA1Reset(&sslInterface->finishHashSHA1); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL engine initialized\r\n"); - - return GHIEncryptionResult_Success; -} - -// Destroy the engine -GHIEncryptionResult ghiEncryptorSslCleanupFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - if (theEncryptor != NULL) - { - gsSSL* sslInterface = (gsSSL*)theEncryptor->mInterface; - if (sslInterface != NULL) - { - gsifree(sslInterface); - theEncryptor->mInterface = NULL; - } - theEncryptor->mInitialized = GHTTPFalse; - theEncryptor->mSessionStarted = GHTTPFalse; - theEncryptor->mSessionEstablished = GHTTPFalse; - } - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL engine cleanup called\r\n"); - - GSI_UNUSED(connection); - - return GHIEncryptionResult_Success; -} - -// Init the engine -GHIEncryptionResult ghiEncryptorSslStartFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor) -{ - gsSSL* sslInterface = (gsSSL*)theEncryptor->mInterface; - gsSSLClientHelloMsg helloMsg; - int i=0; - - // prepare the client hello - // 1) - helloMsg.header.contentType = GS_SSL_CONTENT_HANDSHAKE; - helloMsg.header.versionMajor = GS_SSL_VERSION_MAJOR; - helloMsg.header.versionMinor = GS_SSL_VERSION_MINOR; - - // Set the length of the client hello message (2-byte NBO int, not including record header) - ghiEncryptorWriteNBOLength(helloMsg.header.lengthNBO, sizeof(gsSSLClientHelloMsg)-sizeof(gsSSLRecordHeaderMsg), 2); - - helloMsg.handshakeType = GS_SSL_HANDSHAKE_CLIENTHELLO; - helloMsg.versionMajor = GS_SSL_VERSION_MAJOR; - helloMsg.versionMinor = GS_SSL_VERSION_MINOR; - - // Set the length of the client hello data (3 byte NBO int) - // This is the total message length MINUS the SSL record header MINUS four additional header bytes - ghiEncryptorWriteNBOLength(helloMsg.lengthNBO, sizeof(gsSSLClientHelloMsg)-sizeof(gsSSLRecordHeaderMsg)-4, 3); - //ghttpEncryptorSetNBOBytesFromHBOInt(helloMsg.time, (gsi_u32)current_time(), 4); // 4 byte time value (for randomness) - ghiEncryptorWriteNBOLength(helloMsg.time, 0, 4); // test code: no randomness - - // fill in the [rest of the] random - // Security Note: If a hacker is able to discern the current_time() they may be able to - // recreate the random bytes and recover the session key. - Util_RandSeed(current_time()); - for (i=0; i<28; i++) - { - #if defined(GS_CRYPT_NO_RANDOM) - #pragma message ("!!!WARNING: SSL Random disable for debug purposes. SSL not secured!!!") - helloMsg.random[i] = 0; // test code: no randomness - #else - helloMsg.random[i] = (unsigned char)Util_RandInt(0, 0xff); - #endif - } - - // store a copy of the random (used later for key generation) - memcpy(&sslInterface->clientRandom[0], helloMsg.time, 4); - memcpy(&sslInterface->clientRandom[4], helloMsg.random, 28); - - // todo: session resumption - helloMsg.sessionIdLen = 0; - - // fill in cipher suite IDs - helloMsg.cipherSuitesLength = htons(sizeof(gsi_u16)*GS_SSL_NUM_CIPHER_SUITES); - for (i=0; i < GS_SSL_NUM_CIPHER_SUITES; i++) - helloMsg.cipherSuites[i] = htons((unsigned short)gsSSLCipherSuites[i].mSuiteID); - - // there are no standard SSL compression methods - helloMsg.compressionMethodLen = 1; - helloMsg.compressionMethodList = 0; - - // We need to compute a hash of all the handshake messages - // Add this message to the hash (both MD5 hash and SHA1 hash) - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)&helloMsg+sizeof(gsSSLRecordHeaderMsg), sizeof(gsSSLClientHelloMsg)-sizeof(gsSSLRecordHeaderMsg)); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)&helloMsg+sizeof(gsSSLRecordHeaderMsg), sizeof(gsSSLClientHelloMsg)-sizeof(gsSSLRecordHeaderMsg)); - - // Now send it (we already verified the length, so this should not fail) - if (GHTTPFalse == ghiAppendDataToBuffer(&connection->sendBuffer, (const char*)&helloMsg, sizeof(gsSSLClientHelloMsg))) - { - // assert or just return? - return GHIEncryptionResult_BufferTooSmall; - } - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "GameSpy SSL engine handshake started\r\n"); - - theEncryptor->mSessionStarted = GHTTPTrue; - return GHIEncryptionResult_Success; - -} - -// Encrypt some data -// - theEncryptedLength is reduced by the length of data written to theEncryptedBuffer -// So if the encrypted buffer is 255 bytes long and we write 50 additional bytes, we'll return 205. -GHIEncryptionResult ghiEncryptorSslEncryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - char * theEncryptedBuffer, - int * theEncryptedLength) -{ - if (theEncryptor != NULL) - { - gsSSL* sslInterface = (gsSSL*)theEncryptor->mInterface; - if (sslInterface == NULL || theEncryptor->mSessionEstablished == GHTTPFalse) - { - // not secured yet, send as plain text - if (thePlainTextLength > *theEncryptedLength) - return GHIEncryptionResult_BufferTooSmall; - memcpy(theEncryptedBuffer, thePlainTextBuffer, (size_t)thePlainTextLength); - *theEncryptedLength += thePlainTextLength; // number of bytes written - } - else - { - // Create an SSL encrypted record - // The order of operations below is very important. - // The MAC must be computed before ciphering the plain text because - // theEncryptedBuffer may be the same memory location as thePlainTextBuffer - - gsSSL* sslInterface = (gsSSL*)theEncryptor->mInterface; - gsSSLRecordHeaderMsg* header = NULL; - MD5_CTX md5; - int pos = 0; - unsigned short lengthNBO = htons((unsigned short)thePlainTextLength); - unsigned char MAC[GS_CRYPT_MD5_HASHSIZE]; - - // The SSL record adds a little overhead - if (*theEncryptedLength < (thePlainTextLength+(int)sizeof(gsSSLRecordHeaderMsg))) - return GHIEncryptionResult_BufferTooSmall; - - // write the SSL header - header = (gsSSLRecordHeaderMsg*)theEncryptedBuffer; - header->contentType = GS_SSL_CONTENT_APPLICATIONDATA; - header->versionMajor = GS_SSL_VERSION_MAJOR; - header->versionMinor = GS_SSL_VERSION_MINOR; - pos += sizeof(gsSSLRecordHeaderMsg); - - // calculate the MAC - MD5Init(&md5); - MD5Update(&md5, sslInterface->clientWriteMACSecret, (unsigned int)sslInterface->clientWriteMACLen); - MD5Update(&md5, (unsigned char*)GS_SSL_PAD_ONE, GS_SSL_MD5_PAD_LEN); - MD5Update(&md5, sslInterface->sendSeqNBO, sizeof(sslInterface->sendSeqNBO)); - MD5Update(&md5, (unsigned char*)"\x17", 1); // content type application data - MD5Update(&md5,(unsigned char*)&lengthNBO, sizeof(lengthNBO)); - MD5Update(&md5, (unsigned char*)thePlainTextBuffer, (unsigned int)thePlainTextLength); // **cast-away const** - MD5Final(MAC, &md5); // first half of MAC - - MD5Init(&md5); - MD5Update(&md5, sslInterface->clientWriteMACSecret, (unsigned int)sslInterface->clientWriteMACLen); - MD5Update(&md5, (unsigned char*)GS_SSL_PAD_TWO, GS_SSL_MD5_PAD_LEN); - MD5Update(&md5, MAC, GS_CRYPT_MD5_HASHSIZE); - MD5Final(MAC, &md5); // complete MAC - - // apply stream cipher to data + MAC - RC4Encrypt(&sslInterface->sendRC4, (const unsigned char*)thePlainTextBuffer, (unsigned char*)&theEncryptedBuffer[pos], thePlainTextLength); - pos += thePlainTextLength; - RC4Encrypt(&sslInterface->sendRC4, MAC, (unsigned char*)&theEncryptedBuffer[pos], GS_CRYPT_MD5_HASHSIZE); - pos += GS_CRYPT_MD5_HASHSIZE; - - // Now that we know the final length (data+mac+pad), write it into the header - ghiEncryptorWriteNBOLength(header->lengthNBO, (int)(pos - sizeof(gsSSLRecordHeaderMsg)), 2); - - // adjust encrypted length - *theEncryptedLength -= pos; - - // Update the sequence number for the next message (8-byte, NBO) - pos = 7; // **changing the semantic of variable "pos" - do - { - //int carry = 0; - if (sslInterface->sendSeqNBO[pos] == 0xFF) // wraparound means carry - { - //carry = 1; - sslInterface->sendSeqNBO[pos] = 0; - pos -= 1; - } - else - { - sslInterface->sendSeqNBO[pos] += 1; - pos = 0; // end addition - } - } while(pos >= 0); - } - } - - GSI_UNUSED(connection); - return GHIEncryptionResult_Success; -} - -// Decrypt some data -// - During the handshaking process, this may result in data being appended to the send buffer -// - Data may be left in the encrypted buffer -// - theEncryptedLength becomes the length of data read from theEncryptedBuffer -// - theDecryptedLength becomes the length of data written to theDecryptedBuffer -GHIEncryptionResult ghiEncryptorSslDecryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * theEncryptedBuffer, - int * theEncryptedLength, - char * theDecryptedBuffer, - int * theDecryptedLength) -{ - gsSSL* sslInterface = NULL; - int readPos = 0; - int writePos = 0; - - // Make sure we have a valid encryptor - assert(theEncryptor != NULL); - assert(theEncryptor->mInterface != NULL); - if (theEncryptor == NULL || theEncryptor->mInterface == NULL) - { - // no encryption set? copy as plain text - memcpy(theDecryptedBuffer, theEncryptedBuffer, (size_t)(*theEncryptedLength)); - *theDecryptedLength = *theEncryptedLength; - *theEncryptedLength = 0; // no bytes remaining - return GHIEncryptionResult_Success; - } - - sslInterface = (gsSSL*)theEncryptor->mInterface; - if (sslInterface == NULL) - return GHIEncryptionResult_Error; - - // Read each SSL message from the stream (leave partial messages) - while(readPos < *theEncryptedLength) - { - gsSSLRecordHeaderMsg* header = NULL; - unsigned short length = 0; - GHIEncryptionResult result; - - // make sure we have the complete record header - if ((*theEncryptedLength-readPos) < sizeof(gsSSLRecordHeaderMsg)) - break; - header = (gsSSLRecordHeaderMsg*)&theEncryptedBuffer[readPos]; - - // make sure we have the complete record data - // Warning: Convert the length in two steps to avoid issues with byte order - // BAD!! -> length = ntohs((header->lengthNBO[0] | (header->lengthNBO[1] << 8))); - //length = (unsigned short)(header->lengthNBO[0] | (header->lengthNBO[1] << 8)); - memcpy(&length, &header->lengthNBO[0], sizeof(length)); - length = ntohs(length); - if ( *theEncryptedLength < (readPos + length +(int)sizeof(gsSSLRecordHeaderMsg))) - break; // wait for more data - - // if we have to decrypt, make sure there is room in the decrypt buffer - if (connection->encryptor.mSessionEstablished) - { - if ((*theDecryptedLength-writePos) < length) - { - *theEncryptedLength = readPos; // bytes read *NOT* bytes remaining - *theDecryptedLength = writePos; // bytes written - - if (*theDecryptedLength>0) - return GHIEncryptionResult_Success; - else - return GHIEncryptionResult_BufferTooSmall; - } - } - - //readPos += sizeof(gsSSLRecordHeaderMsg); - - // process the record data - switch(header->contentType) - { - case GS_SSL_CONTENT_HANDSHAKE: - { - GHIBuffer data; - - // Apply stream cipher if the session has been established - readPos += sizeof(gsSSLRecordHeaderMsg); - if (connection->encryptor.mSessionEstablished) - RC4Encrypt(&sslInterface->recvRC4, (const unsigned char*)&theEncryptedBuffer[readPos], (unsigned char*)&theEncryptedBuffer[readPos], length); - - ghiInitReadOnlyBuffer(connection, &data, &theEncryptedBuffer[readPos], length); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "SSL handshake message received\r\n"); - - result = ghiEncryptorProcessSSLHandshake(connection, theEncryptor, &data); - if (result != GHIEncryptionResult_Success) - return result; // error! - - break; - } - case GS_SSL_CONTENT_APPLICATIONDATA: - { - // make sure there is enough room to receive this data - if ( (*theDecryptedLength-writePos) < length) - { - } - - // Apply stream cipher if the session has been established - readPos += sizeof(gsSSLRecordHeaderMsg); - if (connection->encryptor.mSessionEstablished) - RC4Encrypt(&sslInterface->recvRC4, (const unsigned char*)&theEncryptedBuffer[readPos], (unsigned char*)&theEncryptedBuffer[readPos], length); - - // verify MAC and pad - // verifyMAC(); - - // copy to decrypted buffer so HTTP layer can process - memcpy(theDecryptedBuffer+writePos, &theEncryptedBuffer[readPos], (size_t)(length - GS_CRYPT_MD5_HASHSIZE)); - writePos += length - GS_CRYPT_MD5_HASHSIZE; - break; - } - - case GS_SSL_CONTENT_CHANGECIPHERSPEC: - readPos += sizeof(gsSSLRecordHeaderMsg); - //if(readPos > *theEncryptedLength) - // _asm int 3; - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Misc, GSIDebugLevel_Debug, - "SSL change cipher spec message received\r\n"); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_Notice, - "SSL: Incoming traffic now encrypted\r\n"); - connection->encryptor.mSessionEstablished = GHTTPTrue; - break; - - case GS_SSL_CONTENT_ALERT: - readPos += sizeof(gsSSLRecordHeaderMsg); - //if(readPos > *theEncryptedLength) - // _asm int 3; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_WarmError, - "SSL received unhandled ALERT\r\n"); - // server alert - break; - - default: - readPos += sizeof(gsSSLRecordHeaderMsg); - return GHIEncryptionResult_Error; // unhandled content type - }; - - readPos += length; - }; - - // remove read bytes from the stream - *theEncryptedLength = readPos; // bytes read *NOT* bytes remaining - *theDecryptedLength = writePos; // bytes written - - if (*theEncryptedLength < 0) - return GHIEncryptionResult_Error; - else - return GHIEncryptionResult_Success; -} - -static GHTTPBool ghiCertificateChainIsValid(gsSSL* sslInterface) -{ - GSI_UNUSED(sslInterface); - - return GHTTPTrue; -} - -#define CHECK(a) { if (GHTTPFalse == a) return GHIEncryptionResult_Error; } - - -// Programmer note: -// The structure of these SSL handshake messages may seem a bit cryptic, -// due to their variable length data items. Refer to the ASN1/DER encoding guide -// for tag specifics. -GHIEncryptionResult ghiEncryptorProcessSSLHandshake(struct GHIConnection * connection, - struct GHIEncryptor * encryptor, - GHIBuffer * data) -{ - // There may be multiple messages within the handshake message - // length must be completely used, otherwise it's a protocol error - gsSSL* sslInterface = (gsSSL*)encryptor->mInterface; - - while(data->pos < data->len) - { - // Parse each SSL handshake message (there may be multiple) - int messageStart = data->pos; - char messageType = 0; - CHECK(ghiReadDataFromBufferFixed(data, &messageType, 1)); - - if (messageType == GS_SSL_HANDSHAKE_SERVERHELLO) - { - int totalMsgLen = 0; // length of header + data - int msgDataLen = 0; // length of data - int tempInt = 0; - char tempChar = '\0'; - - // make sure we don't have a session already (e.g. dupe hello message) - if (sslInterface->sessionLen != 0) - return GHIEncryptionResult_Error; // abort connection - - CHECK(ghiEncryptorReadNBOLength(data, &msgDataLen, 3)); - - // check reported size against the actual bytes remaining - if (msgDataLen > (data->len - data->pos)) - return GHIEncryptionResult_Error; // abort connection - - // skip SSL version - // (length check not required because we did that above) - data->pos += 2; - - // store server random (used for key generation) - CHECK(ghiReadDataFromBufferFixed(data, (char*)&sslInterface->serverRandom[0], 32)); - - // store session information (length followed by data) - CHECK(ghiReadDataFromBufferFixed(data, &tempChar, 1)); - CHECK(ghiReadDataFromBufferFixed(data, (char*)sslInterface->sessionData, tempChar)); - sslInterface->sessionLen = (int)tempChar; - - // store cipher suite - CHECK(ghiEncryptorReadNBOLength(data, &tempInt, 2)); - sslInterface->cipherSuite = (unsigned short)tempInt; - - // skip compression algorithms (should always be 0x00 since we don't support any!) - CHECK(ghiReadDataFromBufferFixed(data, &tempChar, 1)); - if (tempChar != 0x00) - return GHIEncryptionResult_Error; - - // add it to the running handshake hash - totalMsgLen = data->pos - messageStart; - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)&data->data[messageStart], (unsigned int)totalMsgLen); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)&data->data[messageStart], (unsigned int)totalMsgLen); - } - else if (messageType == GS_SSL_HANDSHAKE_CERTIFICATE) - { - int msgLength = 0; // combined length of the message (size in SSL message header) - int certListLen = 0; // combined length of all certificates - int totalMsgLen = 0; // our calculated msg length (for handshake hashing) - - int certCount = 0; - int certListEndPos = 0; - - CHECK(ghiEncryptorReadNBOLength(data, &msgLength, 3)); - CHECK(ghiEncryptorReadNBOLength(data, &certListLen, 3)); - if (msgLength != certListLen + 3) - return GHIEncryptionResult_Error; - - // make sure we don't have the certificates already (e.g. dupe message) - //if (sslInterface->certificateArray != NULL) - // return GHIEncryptionResult_Error; // abort connection - - // make sure we have enough data to cover the certificate list - certListEndPos = data->pos + certListLen; - if (certListLen > (data->len - data->pos)) - return GHIEncryptionResult_Error; - - // read the certificates - while(data->pos < certListEndPos) - { - int certLength = 0; - int certStartPos = 0; - - int temp = 0; - int version = 0; - - // Must start with a 3 byte length - CHECK(ghiEncryptorReadNBOLength(data, &certLength, 3)); - - // Make sure we have enough data to cover this certificate - if (certLength > (data->len - data->pos)) - return GHIEncryptionResult_Error; // certificate too big - - // 0xFFFF is max message size in SSL v3.0, we don't currently support - // split messages - if (certLength > 0xFFFF) - return GHIEncryptionResult_Error; - - certStartPos = data->pos; // remember this for a shortcut later - certCount++; - - // make a copy of the certificate data - //certCopy = gsimalloc(certLength); - //if (certCopy == NULL) - //{ - // gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Memory, GSIDebugLevel_WarmError, - // "SSL failed to allocate certificate #%d (out of memory)\r\n", certCount); - // return GHIEncryptionResult_Error; - //} - //memcpy(certCopy, &data[browsePos], certLength); - //ArrayAppend(sslInterface->certificateArray, &certCopy); - - // The first certificate holds the server's public key - if (certCount == 1) - { - // X.509 format is rather convoluted. Since we only support - // one variation anyways, I'm hardcoding the specific values - // we require. Anything else is a protocol error. - // 0x30 marks the start of a sequence. next byte is a length field size - // 0x82 is a length tag, meaning the next two bytes contain the length - // 0x81 is the same thing, only the next one byte contains the length - // The other values usually denote required types - - // Certificate SEQUENCE - int seqLen = 0; - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - // todo: verify reported length of this sequence - - // TBSCertificate SEQUENCE - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - // todo: verify reported length of this sequence - - // EXPLICIT Version (must be one of: 0x03,0x02,0x01) - if (5 > (data->len - data->pos)) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0xa0) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x03) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x02) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x01) return GHIEncryptionResult_Error; - version = (unsigned char)data->data[data->pos++]; - - // Serial Number (variable length, with 2-byte length field) - if ((unsigned char)data->data[data->pos++] != 0x02) return GHIEncryptionResult_Error; - temp = (unsigned char)data->data[data->pos++]; // len of serial number - if (data->pos + temp > certListEndPos) return GHIEncryptionResult_Error; - data->pos += temp; // skip the serial number - - // Signature algorithm identifier SEQUENCE - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - data->pos += seqLen; // skip algorithm ID (todo: verify signatures) - - // Issuer Name - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - data->pos += seqLen; // skip the issuer name sequence - - // Validity - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - data->pos += seqLen; // skip the validity sequence - - // Subject Name - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - data->pos += seqLen; // skip the subject name sequence - - // Subject Public Key Info - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - // AlgorithmIdentifier - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - if (seqLen != 0x0d) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x06) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x09) return GHIEncryptionResult_Error; - if (0 != memcmp(&data->data[data->pos], gsSslRsaOid, sizeof(gsSslRsaOid))) - return GHIEncryptionResult_Error; // only RSA certs are supported - data->pos += sizeof(gsSslRsaOid); - if ((unsigned char)data->data[data->pos++] != 0x05) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x00) return GHIEncryptionResult_Error; - - // Bitstring (subject public key) - if (2 > (certListEndPos - data->pos)) return GHIEncryptionResult_Error; - if ((unsigned char)data->data[data->pos++] != 0x03) return GHIEncryptionResult_Error; // bitstring - if ((unsigned char)data->data[data->pos++] != 0x81) return GHIEncryptionResult_Error; // 1 byte len field - if (temp > (certListEndPos - data->pos)) return GHIEncryptionResult_Error; - temp = (unsigned char)data->data[data->pos++]; // remaining data size (check or ignore) - - if ((unsigned char)data->data[data->pos++] != 0x00) return GHIEncryptionResult_Error; - - // Start of the public key modulus - CHECK(ghiEncryptorParseASN1Sequence(data, &seqLen)); - - // Read out the public key modulus - if (data->data[data->pos++] != 0x02) return GHIEncryptionResult_Error; // integer tag - if ((data->data[data->pos]&0x80)==0x80) // ASN1 variable length field - { - int lensize = data->data[data->pos++]&0x7f; - if (lensize > 4) - return GHIEncryptionResult_Error; - temp = 0; - while(lensize-- > 0) - temp = (temp << 8) | (unsigned char)data->data[data->pos++]; - } - else - { - temp = (unsigned char)data->data[data->pos++]; - } - if (data->pos + temp > certListEndPos) return GHIEncryptionResult_Error; - if (data->data[data->pos++] != 0x00) return GHIEncryptionResult_Error; // ignore bits must be 0x00 - if (temp-1 > GS_LARGEINT_BINARY_SIZE/sizeof(char)) return GHIEncryptionResult_Error; - sslInterface->serverpub.modulus.mLength = (unsigned int)((temp-1)/GS_LARGEINT_DIGIT_SIZE_BYTES); //-1 to subtract the previous 0x00 byte - gsLargeIntSetFromMemoryStream(&sslInterface->serverpub.modulus, (const gsi_u8*)&data->data[data->pos], (gsi_u32)temp-1); - data->pos += temp-1; - - // Read out the public key exponent - if (data->data[data->pos++] != 0x02) return GHIEncryptionResult_Error; // integer - if ((data->data[data->pos]&0x80)==0x80) - { - int lensize = data->data[data->pos++]&0x7f; - if (lensize > 4) - return GHIEncryptionResult_Error; - temp = 0; - while(lensize-- > 0) - temp = (temp << 8) | (unsigned char)data->data[data->pos++]; - } - else - { - temp = (unsigned char)data->data[data->pos++]; - } - if (data->pos + temp > certListEndPos) return GHIEncryptionResult_Error; - if (temp == 0) return GHIEncryptionResult_Error; // no exponent? - if (temp > GS_LARGEINT_BINARY_SIZE/sizeof(char)) return GHIEncryptionResult_Error; - sslInterface->serverpub.exponent.mLength = (unsigned int)(((temp-1)/GS_LARGEINT_DIGIT_SIZE_BYTES)+1); // ceiling of temp/4 - gsLargeIntSetFromMemoryStream(&sslInterface->serverpub.exponent, (const gsi_u8*)&data->data[data->pos], (gsi_u32)temp); - data->pos += temp; - } - - // update the position - data->pos = certStartPos + certLength; - - GSI_UNUSED(version); - } - if (data->pos != certListEndPos) - return GHIEncryptionResult_Error; // bytes hanging off the end! - - // todo: verify certificate chain - // first certificate is the server's, the rest likely belong to CA - if (GHTTPFalse == ghiCertificateChainIsValid(sslInterface)) - return GHIEncryptionResult_Error; - - // add it to the running handshake hash - totalMsgLen = data->pos - messageStart; - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)&data->data[messageStart], (unsigned int)totalMsgLen); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)&data->data[messageStart], (unsigned int)totalMsgLen); - } - else if (messageType == GS_SSL_HANDSHAKE_SERVERHELLODONE) - { - // Process the hello done - // Respond with 3 messages - // ClientKeyExchange - // ChangeCipherSpec - // Finished (final handshake) - int i=0; - - gsSSLClientKeyExchangeMsg* clientKeyExchange = NULL; - gsSSLRecordHeaderMsg* changeCipherSpec = NULL; - gsSSLRecordHeaderMsg* finalHandshake = NULL; - - unsigned char temp[7]; - unsigned char hashTempMD5[GS_CRYPT_MD5_HASHSIZE]; - unsigned char hashTempSHA1[GS_CRYPT_SHA1_HASHSIZE]; - int tempInt = 0; - - // ServerHelloDone has a zero length data field - CHECK(ghiEncryptorReadNBOLength(data, &tempInt, 3)); - if (tempInt != 0x00) return GHIEncryptionResult_Error; - - // add it to the running handshake hash - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)&data->data[messageStart], (unsigned int)(data->pos - messageStart)); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)&data->data[messageStart], (unsigned int)(data->pos - messageStart)); - - // Make sure there is room in the send buffer for the response messages - tempInt = (int)(sizeof(gsSSLClientKeyExchangeMsg) + sslInterface->serverpub.modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES); - while (connection->sendBuffer.size - connection->sendBuffer.len < tempInt) - { - // not enough room in send buffer, try to grow it - if (GHTTPFalse == ghiResizeBuffer(&connection->sendBuffer, connection->sendBuffer.sizeIncrement)) - return GHIEncryptionResult_Error; - } - - // 1) Client key exchange, - // create the pre-master-secret - sslInterface->premastersecret[0] = GS_SSL_VERSION_MAJOR; - sslInterface->premastersecret[1] = GS_SSL_VERSION_MINOR; - for (i=2; ipremastersecret[i] = 0; // rand() - #else - Util_RandSeed(current_time()); - sslInterface->premastersecret[i] = (unsigned char)(Util_RandInt(0, 0x0100)); // range = [0...FF] - #endif - } - - clientKeyExchange = (gsSSLClientKeyExchangeMsg*)&connection->sendBuffer.data[connection->sendBuffer.len]; - connection->sendBuffer.len += sizeof(gsSSLClientKeyExchangeMsg); - clientKeyExchange->header.contentType = GS_SSL_CONTENT_HANDSHAKE; - clientKeyExchange->header.versionMajor = GS_SSL_VERSION_MAJOR; - clientKeyExchange->header.versionMinor = GS_SSL_VERSION_MINOR; - ghiEncryptorWriteNBOLength(clientKeyExchange->header.lengthNBO, (int)(sslInterface->serverpub.modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES+4), 2); - clientKeyExchange->handshakeType = GS_SSL_HANDSHAKE_CLIENTKEYEXCHANGE; - ghiEncryptorWriteNBOLength(clientKeyExchange->lengthNBO, (int)(sslInterface->serverpub.modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES), 3); - // encrypt the preMasterSecret using the server's public key (store result in sendbuffer) - gsCryptRSAEncryptBuffer(&sslInterface->serverpub, sslInterface->premastersecret, - GS_SSL_MASTERSECRET_LEN, (unsigned char*)&connection->sendBuffer.data[connection->sendBuffer.len]); - connection->sendBuffer.len += sslInterface->serverpub.modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES; - - // add it to the running handshake hash - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)clientKeyExchange+sizeof(gsSSLRecordHeaderMsg), - sizeof(gsSSLClientKeyExchangeMsg) - sizeof(gsSSLRecordHeaderMsg) + - sslInterface->serverpub.modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)clientKeyExchange+sizeof(gsSSLRecordHeaderMsg), - sizeof(gsSSLClientKeyExchangeMsg) - sizeof(gsSSLRecordHeaderMsg) + - sslInterface->serverpub.modulus.mLength*GS_LARGEINT_DIGIT_SIZE_BYTES); - - - // 2) change cipher spec - changeCipherSpec = (gsSSLRecordHeaderMsg*)&connection->sendBuffer.data[connection->sendBuffer.len]; - changeCipherSpec->contentType = GS_SSL_CONTENT_CHANGECIPHERSPEC; - changeCipherSpec->versionMajor = GS_SSL_VERSION_MAJOR; - changeCipherSpec->versionMinor = GS_SSL_VERSION_MINOR; - changeCipherSpec->lengthNBO[0] = 0; - changeCipherSpec->lengthNBO[1] = 1; // always one byte length - connection->sendBuffer.len += sizeof(gsSSLRecordHeaderMsg); - connection->sendBuffer.data[connection->sendBuffer.len++] = 0x01; // always set to 0x01 - // DO NOT add it to the running handshake hash (its content is not GS_SSL_CONTENT_HANDSHAKE) - - // Calculate the encryption keys - ghiEncryptorGenerateEncryptionKeys(sslInterface); - - // 3) final handshake message (encrypted) - finalHandshake = (gsSSLRecordHeaderMsg*)&connection->sendBuffer.data[connection->sendBuffer.len]; - finalHandshake->contentType = GS_SSL_CONTENT_HANDSHAKE; - finalHandshake->versionMajor = GS_SSL_VERSION_MAJOR; - finalHandshake->versionMinor = GS_SSL_VERSION_MINOR; - finalHandshake->lengthNBO[0] = 0; - finalHandshake->lengthNBO[1] = 56; // handshake type(1)+handshake lenNBO(3)+SHA1(20)+MD5(16)+MAC(16) - connection->sendBuffer.len += sizeof(gsSSLRecordHeaderMsg); - connection->sendBuffer.data[connection->sendBuffer.len++] = GS_SSL_HANDSHAKE_FINISHED; - ghiEncryptorWriteNBOLength((unsigned char*)&connection->sendBuffer.data[connection->sendBuffer.len], 36, 3); - connection->sendBuffer.len += 3; - - - // MD5(master_secret + pad2 + MD5(handshake_messages+"CLNT"+master_secret+pad1)) - // SHA1(master_secret + pad2 + SHA1(handshake_messages+"CLNT"+master_secret+pad1)) - // prepare the final hashes (inner hashes) - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)GS_SSL_CLIENT_FINISH_VALUE, 4); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)GS_SSL_PAD_ONE, GS_SSL_MD5_PAD_LEN); - MD5Final(hashTempMD5, &sslInterface->finishHashMD5); - - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)GS_SSL_CLIENT_FINISH_VALUE, 4); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)GS_SSL_PAD_ONE, GS_SSL_SHA1_PAD_LEN); - SHA1Result(&sslInterface->finishHashSHA1, hashTempSHA1); - - // prepare the final hashes (outer hashes) - MD5Init(&sslInterface->finishHashMD5); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)GS_SSL_PAD_TWO, GS_SSL_MD5_PAD_LEN); - MD5Update(&sslInterface->finishHashMD5, hashTempMD5, GS_CRYPT_MD5_HASHSIZE); - MD5Final(hashTempMD5, &sslInterface->finishHashMD5); - - SHA1Reset(&sslInterface->finishHashSHA1); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)sslInterface->mastersecret, GS_SSL_MASTERSECRET_LEN); - SHA1Input(&sslInterface->finishHashSHA1, (unsigned char*)GS_SSL_PAD_TWO, GS_SSL_SHA1_PAD_LEN); - SHA1Input(&sslInterface->finishHashSHA1, hashTempSHA1, GS_CRYPT_SHA1_HASHSIZE); - SHA1Result(&sslInterface->finishHashSHA1, hashTempSHA1); - - // copy results into the sendbuffer - memcpy(&connection->sendBuffer.data[connection->sendBuffer.len], hashTempMD5, GS_CRYPT_MD5_HASHSIZE); - connection->sendBuffer.len += GS_CRYPT_MD5_HASHSIZE; - memcpy(&connection->sendBuffer.data[connection->sendBuffer.len], hashTempSHA1, GS_CRYPT_SHA1_HASHSIZE); - connection->sendBuffer.len += GS_CRYPT_SHA1_HASHSIZE; - - // output the message MAC (hash(MAC_write_secret+pad_2+ hash(MAC_write_secret+pad_1+seq_num+length+content))); - // Re-using the finishHashMD5 since it has already been allocated - MD5Init(&sslInterface->finishHashMD5); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)sslInterface->clientWriteMACSecret, GS_CRYPT_MD5_HASHSIZE); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)GS_SSL_PAD_ONE, GS_SSL_MD5_PAD_LEN); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)sslInterface->sendSeqNBO, 8); - temp[0] = 0x16; - temp[1] = (unsigned char)((GS_CRYPT_MD5_HASHSIZE+GS_CRYPT_SHA1_HASHSIZE+4)>>8); - temp[2] = (unsigned char)((GS_CRYPT_MD5_HASHSIZE+GS_CRYPT_SHA1_HASHSIZE+4)); - //temp[1] = (unsigned char)(htons(GS_CRYPT_MD5_HASHSIZE+GS_CRYPT_SHA1_HASHSIZE)); - //temp[2] = (unsigned char)(htons(GS_CRYPT_MD5_HASHSIZE+GS_CRYPT_SHA1_HASHSIZE+4)>>8); - temp[3] = 0x14; // 20-bytes of data (MD5+SHA1) - temp[4] = 0x00; // 3-byte length NBO - temp[5] = 0x00; // .. - temp[6] = 0x24; // .. - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)&temp, 7); - MD5Update(&sslInterface->finishHashMD5, hashTempMD5, GS_CRYPT_MD5_HASHSIZE); // content part 1 - MD5Update(&sslInterface->finishHashMD5, hashTempSHA1, GS_CRYPT_SHA1_HASHSIZE); // content part 2 - MD5Final(hashTempMD5, &sslInterface->finishHashMD5); - MD5Init(&sslInterface->finishHashMD5); // reset for outer hash - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)sslInterface->clientWriteMACSecret, GS_CRYPT_MD5_HASHSIZE); - MD5Update(&sslInterface->finishHashMD5, (unsigned char*)GS_SSL_PAD_TWO, GS_SSL_MD5_PAD_LEN); - MD5Update(&sslInterface->finishHashMD5, hashTempMD5, GS_CRYPT_MD5_HASHSIZE); - MD5Final(hashTempMD5, &sslInterface->finishHashMD5); - - memcpy(&connection->sendBuffer.data[connection->sendBuffer.len], hashTempMD5, GS_CRYPT_MD5_HASHSIZE); - connection->sendBuffer.len += GS_CRYPT_MD5_HASHSIZE; - - // increment sequence each time we send a message - // ...assume NBO is bigendian for simplicity - memset(sslInterface->sendSeqNBO, 0, sizeof(sslInterface->sendSeqNBO)); - ghiEncryptorWriteNBOLength(&sslInterface->sendSeqNBO[4], 1, 4); - - // now encrypt the message (not including record header) - RC4Encrypt(&sslInterface->sendRC4, - ((unsigned char*)finalHandshake)+sizeof(gsSSLRecordHeaderMsg), - ((unsigned char*)finalHandshake)+sizeof(gsSSLRecordHeaderMsg), - 56); - } - else if (messageType == GS_SSL_HANDSHAKE_FINISHED) - { - // process server finished and verify hashes - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_Notice, - "SSL: todo - verify server finished hash\r\n"); - data->pos = data->len; - } - else - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_WarmError, - "SSL received unexpected handshake message type: %d\r\n", messageType); - return GHIEncryptionResult_Error; // abort connection - } - } - - GSI_UNUSED(connection); - - if (data->pos == data->len) - return GHIEncryptionResult_Success; - else - return GHIEncryptionResult_Error; // too many or too few bytes, protocol error! -} - -GHIEncryptionResult ghiEncryptorSslEncryptSend(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - int * theBytesSentOut) -{ - GS_FAIL(); // Should never call this for GameSpy SSL! It uses encrypt on buffer - - GSI_UNUSED(connection); - GSI_UNUSED(theEncryptor); - GSI_UNUSED(thePlainTextBuffer); - GSI_UNUSED(thePlainTextLength); - GSI_UNUSED(theBytesSentOut); - - return GHIEncryptionResult_Error; -} - -GHIEncryptionResult ghiEncryptorSslDecryptRecv(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - char * theDecryptedBuffer, - int * theDecryptedLength) -{ - GS_FAIL(); // Should never call this for GameSpy SSL! It uses decrypt on buffer - - GSI_UNUSED(connection); - GSI_UNUSED(theEncryptor); - GSI_UNUSED(theDecryptedBuffer); - GSI_UNUSED(theDecryptedLength); - - return GHIEncryptionResult_Error; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // encryption engine switch - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpEncryption.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpEncryption.h deleted file mode 100644 index f0c0ea005cd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpEncryption.h +++ /dev/null @@ -1,137 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __GHTTPENCRYPTION_H__ -#define __GHTTPENCRYPTION_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//#include "ghttpCommon.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Encryption method -typedef enum -{ - GHIEncryptionMethod_None, - GHIEncryptionMethod_Encrypt, // encrypt raw data written to buffer - GHIEncryptionMethod_Decrypt // decrypt raw data written to buffer -} GHIEncryptionMethod; - -// Encryption results -typedef enum -{ - GHIEncryptionResult_None, - GHIEncryptionResult_Success, // successfully encrypted/decrypted - GHIEncryptionResult_BufferTooSmall, // buffer was too small to hold converted data - GHIEncryptionResult_Error // some other kind of error -} GHIEncryptionResult; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -struct GHIEncryptor; // forward declare for callbacks -struct GHIConnection; - -// Called to init the encryption engine -typedef GHIEncryptionResult (*GHTTPEncryptorInitFunc) (struct GHIConnection * theConnection, - struct GHIEncryptor * theEncryptor); - -// Called to connect the socket (some engines do this internally) -typedef GHIEncryptionResult (*GHTTPEncryptorConnectFunc)(struct GHIConnection * theConnection, - struct GHIEncryptor * theEncryptor); - -// Called to start the handshake process engine -typedef GHIEncryptionResult (*GHTTPEncryptorStartFunc)(struct GHIConnection * theConnection, - struct GHIEncryptor * theEncryptor); - -// Called to destroy the encryption engine -typedef GHIEncryptionResult (*GHTTPEncryptorCleanupFunc)(struct GHIConnection * theConnection, - struct GHIEncryptor * theEncryptor); - -// Called when data needs to be encrypted -// - entire plain text buffer will be encrypted -typedef GHIEncryptionResult (*GHTTPEncryptorEncryptFunc)(struct GHIConnection * theConnection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, // [in] - char * theEncryptedBuffer, - int * theEncryptedLength); // [in/out] - -// Called when data needs to be decrypted -// - encrypted data may be left in the buffer -// - decrypted buffer is appended to, not overwritten -typedef GHIEncryptionResult (*GHTTPEncryptorDecryptFunc)(struct GHIConnection * theConnection, - struct GHIEncryptor* theEncryptor, - const char * theEncryptedBuffer, - int * theEncryptedLength, // [in/out] - char * theDecryptedBuffer, - int * theDecryptedLength);// [in/out] - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct GHIEncryptor -{ - void* mInterface; // only SSL is currently supported - GHTTPEncryptionEngine mEngine; - GHTTPBool mInitialized; - GHTTPBool mSessionStarted; // handshake started? - GHTTPBool mSessionEstablished; // handshake completed? - - // (As coded, these two are exclusive!) - // pattern 1 = manually encrypt the buffer, then send using normal socket functions - // pattern 2 = send plain text through the encryption engine, it will send - GHTTPBool mEncryptOnBuffer; // engine encrypts when writing to a buffer? (pattern 1) - GHTTPBool mEncryptOnSend; // engine encrypts when sending over socket? (pattern 2) - - // If GHTTPTrue, the SSL library handles sending/receiving handshake messages - GHTTPBool mLibSendsHandshakeMessages; - - // Functions for engine use - GHTTPEncryptorInitFunc mInitFunc; - GHTTPEncryptorCleanupFunc mCleanupFunc; - GHTTPEncryptorStartFunc mStartFunc; // start the handshake process - GHTTPEncryptorEncryptFunc mEncryptFunc; - GHTTPEncryptorDecryptFunc mDecryptFunc; -} GHIEncryptor; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// ssl encryption -GHIEncryptionResult ghiEncryptorSslInitFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor); -GHIEncryptionResult ghiEncryptorSslCleanupFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor); - -GHIEncryptionResult ghiEncryptorSslStartFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor); - -GHIEncryptionResult ghiEncryptorSslEncryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - char * theEncryptedBuffer, - int * theEncryptedLength); -GHIEncryptionResult ghiEncryptorSslDecryptFunc(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * theEncryptedBuffer, - int * theEncryptedLength, - char * theDecryptedBuffer, - int * theDecryptedLength); -GHIEncryptionResult ghiEncryptorSslEncryptSend(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - const char * thePlainTextBuffer, - int thePlainTextLength, - int * theBytesSent); -GHIEncryptionResult ghiEncryptorSslDecryptRecv(struct GHIConnection * connection, - struct GHIEncryptor * theEncryptor, - char * theDecryptedBuffer, - int * theDecryptedLength); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __GHTTPENCRYPTION_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpMain.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpMain.c deleted file mode 100644 index ddbc3bda0fe..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpMain.c +++ /dev/null @@ -1,1485 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2001 GameSpy Industries, Inc - -18002 Skypark Circle -Irvine, California 92614 -949.798.4200 (Tel) -949.798.4299 (Fax) -devsupport@gamespy.com -*/ - -#include "ghttpMain.h" -#include "ghttpASCII.h" -#include "ghttpConnection.h" -#include "ghttpCallbacks.h" -#include "ghttpProcess.h" -#include "ghttpPost.h" -#include "ghttpCommon.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Ascii versions which must be available even in the unicode build -GHTTPRequest ghttpGetExA(const char * URL, const char * headers, char * buffer, int bufferSize, GHTTPPost post, GHTTPBool throttle, GHTTPBool blocking, ghttpProgressCallback progressCallback, ghttpCompletedCallback completedCallback, void * param); -GHTTPRequest ghttpSaveExA(const char * URL, const char * filename, const char * headers, GHTTPPost post, GHTTPBool throttle, GHTTPBool blocking, ghttpProgressCallback progressCallback, ghttpCompletedCallback completedCallback, void * param); -GHTTPRequest ghttpStreamExA(const char * URL, const char * headers, GHTTPPost post, GHTTPBool throttle, GHTTPBool blocking, ghttpProgressCallback progressCallback, ghttpCompletedCallback completedCallback, void * param); -GHTTPRequest ghttpHeadExA(const char * URL, const char * headers, GHTTPBool throttle, GHTTPBool blocking, ghttpProgressCallback progressCallback, ghttpCompletedCallback completedCallback, void * param); -GHTTPRequest ghttpPostExA(const char * URL, const char * headers, GHTTPPost post, GHTTPBool throttle, GHTTPBool blocking, ghttpProgressCallback progressCallback, ghttpCompletedCallback completedCallback, void * param); - - - -// Reference count. -/////////////////// -static int ghiReferenceCount; - -// Called right before callback is called. -// Sets result based on response status code. -///////////////////////////////////////////// -static void ghiHandleStatus -( - GHIConnection * connection -) -{ - // Check the status code. - ///////////////////////// - switch(connection->statusCode / 100) - { - case 1: // Informational. - return; - case 2: // Successful. - return; - case 3: // Redirection. - return; - case 4: // Client Error. - switch(connection->statusCode) - { - case 401: - connection->result = GHTTPUnauthorized; - break; - case 403: - connection->result = GHTTPForbidden; - break; - case 404: - case 410: - connection->result = GHTTPFileNotFound; - break; - default: - connection->result = GHTTPRequestRejected; - break; - } - return; - case 5: // Internal Server Error. - connection->result = GHTTPServerError; - return; - } -} - -// Processes a single connection based on its state. -// Returns true if the connection is finished. -//////////////////////////////////////////////////// -static GHTTPBool ghiProcessConnection -( - GHIConnection * connection -) -{ - GHTTPBool completed; - - assert(connection); - assert(ghiRequestToConnection(connection->request) == connection); - - // Don't process if already processing this connection. - // Happens if, for example, ghttpThink is called from a callback. - ///////////////////////////////////////////////////////////////// - if(connection->processing) - return GHTTPFalse; - - // We're now processing. - //////////////////////// - connection->processing = GHTTPTrue; - - // Process based on state. - // else-if is not used so that if one ghiDo*() - // finishes the one after it can start. - ////////////////////////////////////////////// - - if(connection->state == GHTTPSocketInit) - ghiDoSocketInit(connection); - if(connection->state == GHTTPHostLookup) - ghiDoHostLookup(connection); - if(connection->state == GHTTPLookupPending) - ghiDoLookupPending(connection); - if(connection->state == GHTTPConnecting) - ghiDoConnecting(connection); - if(connection->state == GHTTPSecuringSession) - ghiDoSecuringSession(connection); - if(connection->state == GHTTPSendingRequest) - ghiDoSendingRequest(connection); - if(connection->state == GHTTPPosting) - ghiDoPosting(connection); - if(connection->state == GHTTPWaiting) - ghiDoWaiting(connection); - if(connection->state == GHTTPReceivingStatus) - ghiDoReceivingStatus(connection); - if(connection->state == GHTTPReceivingHeaders) - ghiDoReceivingHeaders(connection); - if(connection->state == GHTTPReceivingFile) - ghiDoReceivingFile(connection); - - // Check for a redirect. - //////////////////////// - if(connection->redirectURL) - ghiRedirectConnection(connection); - - // Grab completed before we possibly free it. - ///////////////////////////////////////////// - completed = connection->completed; - - // Graceful shutdown support. - // Close connection when there is no more data - if (connection->result == GHTTPRequestCancelled && !connection->completed && !CanReceiveOnSocket(connection->socket)) - { - connection->completed = GHTTPTrue; - } - - // Is it finished? - ////////////////// - if(connection->completed) - { - // Set result based on status code. - /////////////////////////////////// - ghiHandleStatus(connection); - - // If we're saving to file, close it before the callback. - ///////////////////////////////////////////////////////// -#ifndef NOFILE - if(connection->saveFile) - { - fclose(connection->saveFile); - connection->saveFile = NULL; - } -#endif - // Log buffer data - ghiLogResponse(connection->getFileBuffer.data, connection->getFileBuffer.len); - - // Call the callback. - ///////////////////// - ghiCallCompletedCallback(connection); - - // Free it. - /////////// - ghiFreeConnection(connection); - } - else - { - // Done processing. This is in the else, - // because we don't want to set it if the - // connection has already been freed. - ///////////////////////////////////////// - connection->processing = GHTTPFalse; - } - - return completed; -} - -void ghttpStartup -( - void -) -{ - // This will just return if we haven't created the lock yet. - //////////////////////////////////////////////////////////// - ghiLock(); - - // One more startup. - //////////////////// - ghiReferenceCount++; - - // Check if we are the first. - ///////////////////////////// - if(ghiReferenceCount == 1) - { - // Create the lock. - /////////////////// - ghiCreateLock(); - - // Set some defaults. - ///////////////////// - ghiThrottleBufferSize = GHI_DEFAULT_THROTTLE_BUFFER_SIZE; - ghiThrottleTimeDelay = GHI_DEFAULT_THROTTLE_TIME_DELAY; - } - else - { - // Unlock the lock. - /////////////////// - ghiUnlock(); - } -} - -void ghttpCleanup -( - void -) -{ - // Lockdown for cleanup. - //////////////////////// - ghiLock(); - - // One less. - //////////// - ghiReferenceCount--; - - // Should we cleanup? - ///////////////////// - if(!ghiReferenceCount) - { - // Cleanup the connections. - /////////////////////////// - ghiCleanupConnections(); - - // Cleanup proxy. - ///////////////// - if(ghiProxyAddress) - { - gsifree(ghiProxyAddress); - ghiProxyAddress = NULL; - } - - // Unlock the lock before freeing it. - ///////////////////////////////////// - ghiUnlock(); - - // Free the lock. - ///////////////// - ghiFreeLock(); - } - else - { - // Unlock our lock. - /////////////////// - ghiUnlock(); - } -} - -GHTTPRequest ghttpGetA -( - const char * URL, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - return ghttpGetExA(URL, NULL, NULL, 0, NULL, GHTTPFalse, blocking, NULL, completedCallback, param); -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpGetW -( - const unsigned short * URL, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024]; - - assert(URL != NULL); - UCS2ToAsciiString(URL, (char*)URL_A); - return ghttpGetA(URL_A, blocking, completedCallback, param); -} -#endif - -GHTTPRequest ghttpGetExA -( - const char * URL, - const char * headers, - char * buffer, - int bufferSize, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - GHTTPBool bResult; - GHIConnection * connection; - - assert(URL && URL[0]); - assert(bufferSize >= 0); - assert(!buffer || bufferSize); - - // Check args. - ////////////// - if(!URL || !URL[0]) - return GHTTPInvalidURL; - if(bufferSize < 0) - return GHTTPInvalidBufferSize; - if(buffer && !bufferSize) - return GHTTPInvalidBufferSize; - - // Startup if it hasn't been done. - ////////////////////////////////// - if(!ghiReferenceCount) - ghttpStartup(); - - // Get a new connection object. - /////////////////////////////// - connection = ghiNewConnection(); - if(!connection) - return GHTTPInsufficientMemory; - - // Fill in the necessary info. - ////////////////////////////// - connection->type = GHIGET; - connection->URL = goastrdup(URL); - if(!connection->URL) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - if(headers && *headers) - { - connection->sendHeaders = goastrdup(headers); - if(!connection->sendHeaders) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - } - connection->post = post; - connection->blocking = blocking; - connection->progressCallback = progressCallback; - connection->completedCallback = completedCallback; - connection->callbackParam = param; - connection->throttle = throttle; - connection->userBufferSupplied = (buffer != NULL)?GHTTPTrue:GHTTPFalse; - if(connection->userBufferSupplied) - bResult = ghiInitFixedBuffer(connection, &connection->getFileBuffer, buffer, bufferSize); - else - bResult = ghiInitBuffer(connection, &connection->getFileBuffer, GET_FILE_BUFFER_INITIAL_SIZE, GET_FILE_BUFFER_INCREMENT_SIZE); - if(!bResult) - { - ghiFreeConnection(connection); - return GHTTPUnspecifiedError; - } - - // Setup the post state if needed. - ////////////////////////////////// - if(post && !ghiPostInitState(connection)) - { - ghiFreeConnection(connection); - return GHTTPInvalidPost; - } - - // Check blocking. - ////////////////// - if(blocking) - { - // Loop until completed. - //////////////////////// - while(!ghiProcessConnection(connection)) - msleep(10); - - // Done. - //////// - return 0; - } - - return connection->request; -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpGetExW -( - const unsigned short * URL, - const unsigned short * headers, - char * buffer, - int bufferSize, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024]; - char headers_A[1024] = { '\0' }; - - assert(URL != NULL); - UCS2ToAsciiString(URL, (char*)URL_A); - if (headers != NULL) - UCS2ToAsciiString(headers, headers_A); - return ghttpGetExA((char*)URL_A, (char*)headers_A, buffer, bufferSize, post, throttle, blocking, progressCallback, completedCallback, param); -} -#endif - -GHTTPRequest ghttpSaveA -( - const char * URL, - const char * filename, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - return ghttpSaveExA(URL, filename, NULL, NULL, GHTTPFalse, blocking, NULL, completedCallback, param); -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpSaveW -( - const unsigned short * URL, - const unsigned short * filename, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024] = { '\0' }; - char filename_A[1024] = { '\0' }; - - assert(URL != NULL); - UCS2ToAsciiString(URL, URL_A); - UCS2ToAsciiString(filename, filename_A); - return ghttpSaveA(URL_A, filename_A, blocking, completedCallback, param); -} -#endif - -static GHTTPRequest _ghttpSaveEx -( - const char * URL, - const gsi_char * filename, - const char * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - GHIConnection * connection; - - assert(URL && URL[0]); - assert(filename && filename[0]); - - // Check args. - ////////////// - if(!URL || !URL[0]) - return GHTTPInvalidURL; - if(!filename || !filename[0]) - return GHTTPInvalidFileName; - - // Startup if it hasn't been done. - ////////////////////////////////// - if(!ghiReferenceCount) - ghttpStartup(); - - // Get a new connection object. - /////////////////////////////// - connection = ghiNewConnection(); - if(!connection) - return GHTTPInsufficientMemory; - - // Fill in the necessary info. - ////////////////////////////// - connection->type = GHISAVE; - connection->URL = goastrdup(URL); - if(!connection->URL) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - if(headers && *headers) - { - connection->sendHeaders = goastrdup(headers); - if(!connection->sendHeaders) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - } - connection->post = post; - connection->blocking = blocking; - connection->progressCallback = progressCallback; - connection->completedCallback = completedCallback; - connection->callbackParam = param; - connection->throttle = throttle; - - // Setup the post state if needed. - ////////////////////////////////// - if(post && !ghiPostInitState(connection)) - { - ghiFreeConnection(connection); - return GHTTPInvalidPost; - } - - // Open the file we're saving to. - ///////////////////////////////// -#ifdef NOFILE - connection->saveFile = NULL; -#else - connection->saveFile = _tfopen(filename, _T("wb")); -#endif - if(!connection->saveFile) - { - ghiFreeConnection(connection); - return GHTTPFailedToOpenFile; - } - - // Check blocking. - ////////////////// - if(blocking) - { - // Loop until completed. - //////////////////////// - while(!ghiProcessConnection(connection)) - msleep(10); - - // Done. - //////// - return 0; - } - - return connection->request; -} - -GHTTPRequest ghttpSaveExA -( - const char * URL, - const char * filename, - const char * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - #ifdef GSI_UNICODE - unsigned short filename_W[1024]; - AsciiToUCS2String(filename, filename_W); - return _ghttpSaveEx(URL, filename_W, headers, post, throttle, blocking, progressCallback, completedCallback, param); - #else - return _ghttpSaveEx(URL, filename, headers, post, throttle, blocking, progressCallback, completedCallback, param); - #endif -} - -#ifdef GSI_UNICODE -GHTTPRequest ghttpSaveExW -( - const unsigned short * URL, - const unsigned short * filename, - const unsigned short * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024]; - //char filename_A[1024] = { '\0' }; - char headers_A[1024] = { '\0' }; - - assert(URL_A != NULL); - UCS2ToAsciiString(URL, URL_A); - //if (filename != NULL) - // UCS2ToAsciiString(filename, filename_A); - if (headers != NULL) - UCS2ToAsciiString(headers, headers_A); - - return _ghttpSaveEx(URL_A, filename, headers_A, post, throttle, blocking, progressCallback, completedCallback, param); -} -#endif - -GHTTPRequest ghttpStreamA -( - const char * URL, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - return ghttpStreamExA(URL, NULL, NULL, GHTTPFalse, blocking, progressCallback, completedCallback, param); -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpStreamW -( - const unsigned short * URL, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char* URL_A = { '\0' }; - UCS2ToAsciiString(URL, URL_A); - return ghttpStreamA(URL_A, blocking, progressCallback, completedCallback, param); -} -#endif - -GHTTPRequest ghttpStreamExA -( - const char * URL, - const char * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - GHIConnection * connection; - - assert(URL && URL[0]); - - // Check args. - ////////////// - if(!URL || !URL[0]) - return GHTTPInvalidURL; - - // Startup if it hasn't been done. - ////////////////////////////////// - if(!ghiReferenceCount) - ghttpStartup(); - - // Get a new connection object. - /////////////////////////////// - connection = ghiNewConnection(); - if(!connection) - return GHTTPInsufficientMemory; - - // Fill in the necessary info. - ////////////////////////////// - connection->type = GHISTREAM; - connection->URL = goastrdup(URL); - if(!connection->URL) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - if(headers && *headers) - { - connection->sendHeaders = goastrdup(headers); - if(!connection->sendHeaders) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - } - connection->post = post; - connection->blocking = blocking; - connection->progressCallback = progressCallback; - connection->completedCallback = completedCallback; - connection->callbackParam = param; - connection->throttle = throttle; - - // Setup the post state if needed. - ////////////////////////////////// - if(post && !ghiPostInitState(connection)) - { - ghiFreeConnection(connection); - return GHTTPInvalidPost; - } - - // Check blocking. - ////////////////// - if(blocking) - { - // Loop until completed. - //////////////////////// - while(!ghiProcessConnection(connection)) - msleep(10); - - // Done. - //////// - return 0; - } - - return connection->request; -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpStreamExW -( - const unsigned short * URL, - const unsigned short * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024] = {'\0'}; - char headers_A[1024] = {'\0'}; - UCS2ToAsciiString(URL, URL_A); - if(headers != NULL) - UCS2ToAsciiString(headers, headers_A); - return ghttpStreamExA(URL_A, headers_A, post, throttle, blocking, progressCallback, completedCallback, param); -} -#endif - -GHTTPRequest ghttpHeadA -( - const char * URL, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - return ghttpHeadExA(URL, NULL, GHTTPFalse, blocking, NULL, completedCallback, param); -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpHeadW -( - const unsigned short * URL, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024] = {'\0'}; - UCS2ToAsciiString(URL, URL_A); - return ghttpHeadA(URL_A, blocking, completedCallback, param); -} -#endif - -GHTTPRequest ghttpHeadExA -( - const char * URL, - const char * headers, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - GHIConnection * connection; - - assert(URL && URL[0]); - - // Check args. - ////////////// - if(!URL || !URL[0]) - return GHTTPInvalidURL; - - // Startup if it hasn't been done. - ////////////////////////////////// - if(!ghiReferenceCount) - ghttpStartup(); - - // Get a new connection object. - /////////////////////////////// - connection = ghiNewConnection(); - if(!connection) - return GHTTPInsufficientMemory; - - // Fill in the necessary info. - ////////////////////////////// - connection->type = GHIHEAD; - connection->URL = goastrdup(URL); - if(!connection->URL) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - if(headers && *headers) - { - connection->sendHeaders = goastrdup(headers); - if(!connection->sendHeaders) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - } - connection->blocking = blocking; - connection->progressCallback = progressCallback; - connection->completedCallback = completedCallback; - connection->callbackParam = param; - connection->throttle = throttle; - - // Check blocking. - ////////////////// - if(blocking) - { - // Loop until completed. - //////////////////////// - while(!ghiProcessConnection(connection)) - msleep(10); - - // Done. - //////// - return 0; - } - - return connection->request; -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpHeadExW -( - const unsigned short * URL, - const unsigned short * headers, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024] = {'\0'}; - char headers_A[1024] = {'\0'}; - if (URL != NULL) - UCS2ToAsciiString(URL, URL_A); - if (headers != NULL) - UCS2ToAsciiString(headers, headers_A); - return ghttpHeadExA(URL_A, headers_A, throttle, blocking, progressCallback, completedCallback, param); -} -#endif - -GHTTPRequest ghttpPostA -( - const char * URL, - GHTTPPost post, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - return ghttpPostExA(URL, NULL, post, GHTTPFalse, blocking, NULL, completedCallback, param); -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpPostW -( - const unsigned short * URL, - GHTTPPost post, - GHTTPBool blocking, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024] = {'\0'}; - UCS2ToAsciiString(URL, URL_A); - return ghttpPostA(URL_A, post, blocking, completedCallback, param); -} -#endif - -GHTTPRequest ghttpPostExA -( - const char * URL, - const char * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - GHIConnection * connection; - - assert(URL && URL[0]); - assert(post); - - // Check args. - ////////////// - if(!URL || !URL[0]) - return GHTTPInvalidURL; - if(!post) - return GHTTPInvalidPost; - - // Startup if it hasn't been done. - ////////////////////////////////// - if(!ghiReferenceCount) - ghttpStartup(); - - // Get a new connection object. - /////////////////////////////// - connection = ghiNewConnection(); - if(!connection) - return GHTTPInsufficientMemory; - - // Fill in the necessary info. - ////////////////////////////// - connection->type = GHIPOST; - connection->URL = goastrdup(URL); - if(!connection->URL) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - if(headers && *headers) - { - connection->sendHeaders = goastrdup(headers); - if(!connection->sendHeaders) - { - ghiFreeConnection(connection); - return GHTTPInsufficientMemory; - } - } - connection->post = post; - connection->blocking = blocking; - connection->progressCallback = progressCallback; - connection->completedCallback = completedCallback; - connection->callbackParam = param; - connection->throttle = throttle; - - // Setup the post state if needed. - ////////////////////////////////// - if(post && !ghiPostInitState(connection)) - { - ghiFreeConnection(connection); - return GHTTPInvalidPost; - } - - // Check blocking. - ////////////////// - if(blocking) - { - // Loop until completed. - //////////////////////// - while(!ghiProcessConnection(connection)) - msleep(10); - - // Done. - //////// - return 0; - } - - return connection->request; -} -#ifdef GSI_UNICODE -GHTTPRequest ghttpPostExW -( - const unsigned short * URL, - const unsigned short * headers, - GHTTPPost post, - GHTTPBool throttle, - GHTTPBool blocking, - ghttpProgressCallback progressCallback, - ghttpCompletedCallback completedCallback, - void * param -) -{ - char URL_A[1024] = {'\0'}; - char headers_A[1024] = {'\0'}; - UCS2ToAsciiString(URL, URL_A); - if (headers != NULL) - UCS2ToAsciiString(headers, headers_A); - return ghttpPostExA(URL_A, headers_A, post, throttle, blocking, progressCallback, completedCallback, param); -} -#endif - -void ghttpThink -( - void -) -{ - // Process all the connections. - /////////////////////////////// - ghiEnumConnections(ghiProcessConnection); -} - -GHTTPBool ghttpRequestThink -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return GHTTPFalse; - - // Think. - ///////// - ghiProcessConnection(connection); - return GHTTPTrue; -} - -void ghttpCancelRequest -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return; - - // Free it. - /////////// - ghiFreeConnection(connection); -} - -#if !defined(INSOCK) -// INSOCK does not support partial shutdown -void ghttpCloseRequest -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - connection = ghiRequestToConnection(request); - if (!connection) - return; - - if (connection->socket) - { - // Gracefully close the connection - // SDK will dispatch a "request cancelled" callback when all data - // has been received - shutdown(connection->socket, 1); - connection->result = GHTTPRequestCancelled; - } -} -#endif - -GHTTPState ghttpGetState -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return (GHTTPState)0; - - return connection->state; -} - -const char * ghttpGetResponseStatus -( - GHTTPRequest request, - int * statusCode -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return NULL; - - // Check if we don't have the status yet. - ///////////////////////////////////////// - if(connection->state <= GHTTPReceivingStatus) - return NULL; - - // Set the status code. - /////////////////////// - if(statusCode) - *statusCode = connection->statusCode; - - return (connection->recvBuffer.data + connection->statusStringIndex); -} - -const char * ghttpGetHeaders -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return NULL; - - // Check if we don't have the headers yet. - ////////////////////////////////////////// - if(connection->state < GHTTPReceivingHeaders) - return NULL; - - // Verify we have headers. - ////////////////////////// - if(connection->headerStringIndex >= connection->recvBuffer.len) - return NULL; - - return (connection->recvBuffer.data + connection->headerStringIndex); -} - -const char * ghttpGetURL -( - GHTTPRequest request -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return NULL; - - return connection->URL; -} - -GHTTPBool ghttpSetProxy -( - const char * server -) -{ - return ghiSetProxy(server); -} - -GHTTPBool ghttpSetRequestProxy -( - GHTTPRequest request, - const char * server -) -{ - return ghiSetRequestProxy(request, server); -} - - -void ghttpSetThrottle -( - GHTTPRequest request, - GHTTPBool throttle -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return; - - connection->throttle = throttle; - - // Set the buffer size based on the throttle setting. - ///////////////////////////////////////////////////// - if(connection->socket != INVALID_SOCKET) - SetReceiveBufferSize(connection->socket, throttle?ghiThrottleBufferSize:(8 * 1024)); -} - -void ghttpThrottleSettings -( - int bufferSize, - gsi_time timeDelay -) -{ - ghiThrottleSettings(bufferSize, timeDelay); -} - -void ghttpSetMaxRecvTime -( - GHTTPRequest request, - gsi_time maxRecvTime -) -{ - GHIConnection* connection = ghiRequestToConnection(request); - if (connection == NULL) - return; - - connection->maxRecvTime = maxRecvTime; -} - -// Internal prototypes for persistent HTTP connections -// Prevents warnings from strict compilers -////////////////////////////////////////////////////// -SOCKET ghttpGetSocket(GHTTPRequest request); -GHTTPBool ghttpReuseSocket(GHTTPRequest request, SOCKET socket); - -// For use in persistent HTTP connections -// Call this in the completed callback to obtain the socket, which can be used with -// ghttpReuseSocket to make a second request to the same host -/////////////////////////////////////////////////////////////////// -SOCKET ghttpGetSocket -( - GHTTPRequest request -) -{ - GHIConnection * connection; - SOCKET ret; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return INVALID_SOCKET; - - // Only allow them to grab the socket during the competion callback (not while a request is in process) - ///////////////////////////////////////////////////////// - if (!connection->completed) - return INVALID_SOCKET; - - ret = connection->socket; - // Mark the connection as invalid so that it doesn't get closed - connection->socket = INVALID_SOCKET; - - return ret; -} - -// For use in persistent HTTP connections -// Call this after creating a request, but before calling think the first time in order to reuse -// an existing connection to the same server -// If the socket passed is INVALID_SOCKET, a new connection will be created and marked as persistent -/////////////////////////////////////////////////////////////////// -GHTTPBool ghttpReuseSocket -( - GHTTPRequest request, - SOCKET socket -) -{ - GHIConnection * connection; - - // Get the connection object for this request. - ////////////////////////////////////////////// - connection = ghiRequestToConnection(request); - if(!connection) - return GHTTPFalse; - if (connection->state != GHTTPSocketInit) - return GHTTPFalse; - if (connection->socket != INVALID_SOCKET) - return GHTTPFalse; - - connection->persistConnection = GHTTPTrue; - connection->socket = socket; - - - /* - if (socket == INVALID_SOCKET) - { - // The connection is marked as persistent, but we still need to lookup and connect, so don't advance the state - ///////////////////////////////////////////////////////////////////// - return GHTTPTrue; - } - - // Skip the host lookup & connect - send data once the socket is writable - ////////////////////////////////////////////// - connection->state = GHTTPConnecting; - */ - return GHTTPTrue; -} - - -GHTTPPost ghttpNewPost -( - void -) -{ - return ghiNewPost(); -} - -void ghttpPostSetAutoFree -( - GHTTPPost post, - GHTTPBool autoFree -) -{ - assert(post); - if(!post) - return; - - ghiPostSetAutoFree(post, autoFree); -} - -void ghttpFreePost -( - GHTTPPost post -) -{ - assert(post); - if(!post) - return; - - ghiFreePost(post); -} - -GHTTPBool ghttpPostAddStringA -( - GHTTPPost post, - const char * name, - const char * string -) -{ - assert(post); - assert(name && name[0]); - - if(!post) - return GHTTPFalse; - if(!name || !name[0]) - return GHTTPFalse; - if(!string) - string = ""; - - return ghiPostAddString(post, name, string); -} -#ifdef GSI_UNICODE -GHTTPBool ghttpPostAddStringW -( - GHTTPPost post, - const unsigned short * name, - const unsigned short * string -) -{ - char name_A[1024] = {'\0'}; - char string_A[1024] = {'\0'}; - if (name != NULL) - UCS2ToAsciiString(name, name_A); - if (string != NULL) - UCS2ToAsciiString(string, string_A); - return ghttpPostAddStringA(post, name_A, string_A); -} -#endif - -GHTTPBool ghttpPostAddFileFromDiskA -( - GHTTPPost post, - const char * name, - const char * filename, - const char * reportFilename, - const char * contentType -) -{ - assert(post); - assert(name && name[0]); - assert(filename && filename[0]); - - if(!post) - return GHTTPFalse; - if(!name || !name[0]) - return GHTTPFalse; - if(!filename || !filename[0]) - return GHTTPFalse; - if(!reportFilename || !reportFilename[0]) - reportFilename = filename; - if(!contentType) - contentType = "application/octet-stream"; - - return ghiPostAddFileFromDisk(post, name, filename, reportFilename, contentType); -} -#ifdef GSI_UNICODE -GHTTPBool ghttpPostAddFileFromDiskW -( - GHTTPPost post, - const unsigned short * name, - const unsigned short * filename, - const unsigned short * reportFilename, - const unsigned short * contentType -) -{ - char name_A[1024] = {'\0'}; - char filename_A[1024] = {'\0'}; - char reportFilename_A[1024] = {'\0'}; - char contentType_A[1024] = {'\0'}; - if (name != NULL) UCS2ToAsciiString(name, name_A); - if (filename != NULL) UCS2ToAsciiString(filename, filename_A); - if (reportFilename != NULL) UCS2ToAsciiString(reportFilename, reportFilename_A); - if (contentType != NULL) UCS2ToAsciiString(contentType, contentType_A); - return ghttpPostAddFileFromDiskA(post, name_A, filename_A, reportFilename_A, contentType_A); -} -#endif - -GHTTPBool ghttpPostAddFileFromMemoryA -( - GHTTPPost post, - const char * name, - const char * buffer, - int bufferLen, - const char * reportFilename, - const char * contentType -) -{ - assert(post); - assert(name && name[0]); - assert(bufferLen >= 0); -#ifdef _DEBUG - if(bufferLen > 0) - assert(buffer); -#endif - assert(reportFilename && reportFilename[0]); - - if(!post) - return GHTTPFalse; - if(!name || !name[0]) - return GHTTPFalse; - if(bufferLen < 0) - return GHTTPFalse; - if(!bufferLen && !buffer) - return GHTTPFalse; - if(!contentType) - contentType = "application/octet-stream"; - - return ghiPostAddFileFromMemory(post, name, buffer, bufferLen, reportFilename, contentType); -} -#ifdef GSI_UNICODE -GHTTPBool ghttpPostAddFileFromMemoryW -( - GHTTPPost post, - const unsigned short * name, - const char * buffer, - int bufferLen, - const unsigned short * reportFilename, - const unsigned short * contentType -) -{ - char name_A[1024] = { '\0' }; - char reportFilename_A[1024] = { '\0' }; - char contentType_A[1024] = { '\0' }; - if (name != NULL) - UCS2ToAsciiString(name, name_A); - if (reportFilename != NULL) - UCS2ToAsciiString(reportFilename, reportFilename_A); - if (contentType != NULL) - UCS2ToAsciiString(contentType, contentType_A); - - - return ghttpPostAddFileFromMemoryA(post, name_A, buffer, bufferLen, reportFilename_A, contentType_A); - - GSI_UNUSED(reportFilename); - GSI_UNUSED(contentType); -} -#endif - -GHTTPBool ghttpPostAddXml -( - GHTTPPost post, - GSXmlStreamWriter soap -) -{ - GS_ASSERT(post != NULL); - GS_ASSERT(soap != NULL); - - return ghiPostAddXml(post, soap); -} - -void ghttpPostSetCallback -( - GHTTPPost post, - ghttpPostCallback callback, - void * param -) -{ - assert(post); - - if(!post) - return; - - ghiPostSetCallback(post, callback, param); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpMain.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpMain.h deleted file mode 100644 index 0b19a7cd84c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpMain.h +++ /dev/null @@ -1,19 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPMAIN_H_ -#define _GHTTPMAIN_H_ - -#include -#include "ghttp.h" -#include "../common/gsCommon.h" -#include "../common/gsStringUtil.h" - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpPost.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpPost.c deleted file mode 100644 index fd4d05afddc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpPost.c +++ /dev/null @@ -1,1647 +0,0 @@ -/* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4267) //lines: 1334, 1344, 1400, 1410 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - -#include "ghttpPost.h" -#include "ghttpMain.h" -#include "ghttpConnection.h" -#include "ghttpCommon.h" - -#include "../common/gsCrypt.h" -#include "../common/gsSSL.h" -#include "../common/gsXML.h" - - -// The border between parts in a file send. -/////////////////////////////////////////// -#define GHI_MULTIPART_BOUNDARY "Qr4G823s23d---<<><><<<>--7d118e0536" -#define GHI_MULTIPART_BOUNDARY_BASE "--" GHI_MULTIPART_BOUNDARY -#define GHI_MULTIPART_BOUNDARY_FIRST GHI_MULTIPART_BOUNDARY_BASE CRLF -#define GHI_MULTIPART_BOUNDARY_NORMAL CRLF GHI_MULTIPART_BOUNDARY_BASE CRLF -#define GHI_MULTIPART_BOUNDARY_END CRLF GHI_MULTIPART_BOUNDARY_BASE "--" CRLF - -#define GHI_LEGAL_URLENCODED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@-.*" -#define GHI_DIGITS "0123456789ABCDEF" - -// DIME header settings - // first byte is a combination of VERSION + first/last/chunked -#define GHI_DIME_VERSION (0x1<<3) // 5th bit (from the left) -#define GHI_DIMEFLAG_FIRSTRECORD (1<<2) -#define GHI_DIMEFLAG_LASTRECORD (1<<1) -#define GHI_DIMEFLAG_CHUNKED (1<<0) - // second byte is combination of TYPE_T and reserved (4bits = 0) -#define GHI_DIMETYPE_T_UNCHANGED (0x0 << 4) -#define GHI_DIMETYPE_T_MEDIA (0x1 << 4) -#define GHI_DIMETYPE_T_URI (0x2 << 4) -#define GHI_DIMETYPE_T_UNKNOWN (0x3 << 4) -#define GHI_DIMETYPE_T_EMPTY (0x4 << 4) // lengths must be set to 0 - -//#define GHI_DIME_SOAPID "gsi:soap" -#define GHI_DIME_SOAPID "cid:id0" -#define GHI_DIME_SOAPTYPE "http://schemas.xmlsoap.org/soap/envelope/" - -typedef struct GSIDimeHeader -{ - gsi_u8 mVersionAndFlags; - gsi_u8 mTypeT; - gsi_u16 mOptionsLength; - gsi_u16 mIdLength; - gsi_u16 mTypeLength; - gsi_u32 mDataLength; - // gsi_u8 mOptions[mOptionsLength]; - // gsi_u8 mId[mIdLength]; - // gsi_u8 mType[mTypeLength]; - // gsi_u8 mData[mDataLength]; -} GHIDimeHeader; - -// POST TYPES. -////////////// -typedef enum -{ - GHIString, // A regular string. - GHIFileDisk, // A file from disk. - GHIFileMemory, // A file from memory. - GHIXmlData // XML Soap. (long string) -} GHIPostDataType; - -// POST OBJECT. -/////////////// -typedef struct GHIPost -{ - DArray data; - ghttpPostCallback callback; - void * param; - GHTTPBool hasFiles; - GHTTPBool hasSoap; - GHTTPBool useDIME; - GHTTPBool autoFree; -} GHIPost; - -// POST DATA. -///////////// -typedef struct GHIPostStringData -{ - char * string; - int len; - GHTTPBool invalidChars; - int extendedChars; -} GHIPostStringData; - -typedef struct GHIPostFileDiskData -{ - char * filename; - char * reportFilename; - char * contentType; -} GHIPostFileDiskData; - -typedef struct GHIPostFileMemoryData -{ - const char * buffer; - int len; - char * reportFilename; - char * contentType; -} GHIPostFileMemoryData; - -typedef struct GHIPostXmlData -{ - GSXmlStreamWriter xml; -} GHIPostXmlData; - -typedef struct GHIPostData -{ - GHIPostDataType type; - char * name; - union - { - GHIPostStringData string; - GHIPostFileDiskData fileDisk; - GHIPostFileMemoryData fileMemory; - GHIPostXmlData xml; - } data; -} GHIPostData; - -// POST STATE. -////////////// -//typedef struct GHIPostStringState -//{ -//} GHIPostStringState; - -typedef struct GHIPostFileDiskState -{ - FILE * file; - long len; -} GHIPostFileDiskState; - -//typedef struct GHIPostFileMemoryState -//{ -//} GHIPostFileMemoryState; - - -//typedef struct GHIPostSoapState -//{ -//} GHIPostSoapState; - -typedef struct GHIPostState -{ - GHIPostData * data; - int pos; - union - { - //GHIPostStringState string; - GHIPostFileDiskState fileDisk; - //GHIPostFileMemoryState fileMemory; - //GHIPostSoapState soap; - } state; -} GHIPostState; - -// FUNCTIONS. -///////////// -static void ghiPostDataFree -( - void * elem -) -{ - GHIPostData * data = (GHIPostData *)elem; - - // Free the name. - ///////////////// - if (data->type != GHIXmlData) - gsifree(data->name); - - // Free based on type. - ////////////////////// - if(data->type == GHIString) - { - // Free the string string. - ///////////////////////// - gsifree(data->data.string.string); - } - else if(data->type == GHIFileDisk) - { - // Free the strings. - //////////////////// - gsifree(data->data.fileDisk.filename); - gsifree(data->data.fileDisk.reportFilename); - gsifree(data->data.fileDisk.contentType); - } - else if(data->type == GHIFileMemory) - { - // Free the strings. - //////////////////// - gsifree(data->data.fileMemory.reportFilename); - gsifree(data->data.fileMemory.contentType); - } - else if(data->type == GHIXmlData) - { - gsXmlFreeWriter(data->data.xml.xml); - } - else - { - // The type didn't match any known types. - ///////////////////////////////////////// - assert(0); - } -} - -GHTTPPost ghiNewPost -( - void -) -{ - GHIPost * post; - - // Allocate the post object. - //////////////////////////// - post = (GHIPost *)gsimalloc(sizeof(GHIPost)); - if(!post) - return NULL; - - // Initialize it. - ///////////////// - memset(post, 0, sizeof(GHIPost)); - post->autoFree = GHTTPTrue; - - // Create the array of data objects. - //////////////////////////////////// - post->data = ArrayNew(sizeof(GHIPostData), 0, ghiPostDataFree); - if(!post->data) - { - gsifree(post); - return NULL; - } - - return (GHTTPPost)post; -} - -void ghiPostSetAutoFree -( - GHTTPPost _post, - GHTTPBool autoFree -) -{ - GHIPost * post = (GHIPost *)_post; - - post->autoFree = autoFree; -} - -GHTTPBool ghiIsPostAutoFree -( - GHTTPPost _post -) -{ - GHIPost * post = (GHIPost *)_post; - - return post->autoFree; -} - -void ghiFreePost -( - GHTTPPost _post -) -{ - GHIPost * post = (GHIPost *)_post; - - // Free the array of data objects. - ////////////////////////////////// - ArrayFree(post->data); - - // Free the post object. - //////////////////////// - gsifree(post); -} - -GHTTPBool ghiPostAddString -( - GHTTPPost _post, - const char * name, - const char * string -) -{ - GHIPost * post = (GHIPost *)_post; - GHIPostData data; - int len; - int rcode; - - // Copy the strings. - //////////////////// - name = goastrdup(name); - string = goastrdup(string); - if(!name || !string) - { - gsifree((char *)name); - gsifree((char *)string); - return GHTTPFalse; - } - - // Set the data. - //////////////// - memset(&data, 0, sizeof(GHIPostData)); - data.type = GHIString; - data.name = (char *)name; - data.data.string.string = (char *)string; - len = (int)strlen(string); - data.data.string.len = len; - data.data.string.invalidChars = GHTTPFalse; - - // Are there any invalid characters? - //////////////////////////////////// - rcode = (int)strspn(string, GHI_LEGAL_URLENCODED_CHARS); - if(rcode != len) - { - int i; - int count = 0; - - data.data.string.invalidChars = GHTTPTrue; - - // Count the number, not including spaces. - ////////////////////////////////////////// - for(i = 0 ; string[i] ; i++) - if(!strchr(GHI_LEGAL_URLENCODED_CHARS, string[i]) && (string[i] != ' ')) - count++; - - data.data.string.extendedChars = count; - } - - // Add it. - ////////// - ArrayAppend(post->data, &data); - - return GHTTPTrue; -} - -GHTTPBool ghiPostAddFileFromDisk -( - GHTTPPost _post, - const char * name, - const char * filename, - const char * reportFilename, - const char * contentType -) -{ - GHIPost * post = (GHIPost *)_post; - GHIPostData data; - - // Copy the strings. - //////////////////// - name = goastrdup(name); - filename = goastrdup(filename); - reportFilename = goastrdup(reportFilename); - contentType = goastrdup(contentType); - if(!name || !filename || !reportFilename || !contentType) - { - gsifree((char *)name); - gsifree((char *)filename); - gsifree((char *)reportFilename); - gsifree((char *)contentType); - return GHTTPFalse; - } - - // Set the data. - //////////////// - memset(&data, 0, sizeof(GHIPostData)); - data.type = GHIFileDisk; - data.name = (char *)name; - data.data.fileDisk.filename = (char *)filename; - data.data.fileDisk.reportFilename = (char *)reportFilename; - data.data.fileDisk.contentType = (char *)contentType; - - // Add it. - ////////// - ArrayAppend(post->data, &data); - - // We have files. - ///////////////// - post->hasFiles = GHTTPTrue; - - // if we have both soap and a file we MUST use DIME - if (post->hasSoap == GHTTPTrue) - post->useDIME = GHTTPTrue; - - return GHTTPTrue; -} - -GHTTPBool ghiPostAddFileFromMemory -( - GHTTPPost _post, - const char * name, - const char * buffer, - int bufferLen, - const char * reportFilename, - const char * contentType -) -{ - GHIPost * post = (GHIPost *)_post; - GHIPostData data; - - // Copy the strings. - //////////////////// - name = goastrdup(name); - reportFilename = goastrdup(reportFilename); - contentType = goastrdup(contentType); - if(!name || !reportFilename || !contentType) - { - gsifree((char *)name); - gsifree((char *)reportFilename); - gsifree((char *)contentType); - return GHTTPFalse; - } - - // Set it. - ////////// - memset(&data, 0, sizeof(GHIPostData)); - data.type = GHIFileMemory; - data.name = (char *)name; - data.data.fileMemory.buffer = (char *)buffer; - data.data.fileMemory.len = bufferLen; - data.data.fileMemory.reportFilename = (char *)reportFilename; - data.data.fileMemory.contentType = (char *)contentType; - - // Add it. - ////////// - ArrayAppend(post->data, &data); - - // We have a file. - ////////////////// - post->hasFiles = GHTTPTrue; - - // if we have both soap and a file we MUST use DIME - if (post->hasSoap == GHTTPTrue) - post->useDIME = GHTTPTrue; - - return GHTTPTrue; -} - -GHTTPBool ghiPostAddXml -( - GHTTPPost _post, - GSXmlStreamWriter xml -) -{ - GHIPostData data; - //unsigned int rcode = 0; - - GHIPost * post = (GHIPost *)_post; - - data.type = GHIXmlData; - data.data.xml.xml = xml; - ArrayAppend(post->data, &data); - post->hasSoap = GHTTPTrue; - - // if we have both soap and a file we MUST use DIME - if (post->hasFiles == GHTTPTrue) - post->useDIME = GHTTPTrue; - - return GHTTPTrue; -} - -void ghiPostSetCallback -( - GHTTPPost _post, - ghttpPostCallback callback, - void * param -) -{ - GHIPost * post = (GHIPost *)_post; - - // Set the callback and param. - ////////////////////////////// - post->callback = callback; - post->param = param; -} - -const char * ghiPostGetContentType -( - struct GHIConnection * connection -) -{ - GHIPost * post = connection->post; - - assert(post); - if(!post) - return ""; - - // Report content-type based on if we are sending files or not. - /////////////////////////////////////////////////////////////// - if(post->useDIME) - return ("application/dime"); - else if (post->hasFiles) - { - GS_ASSERT(!post->hasSoap); - return ("multipart/form-data; boundary=" GHI_MULTIPART_BOUNDARY); - } - else if (post->hasSoap) - { - GS_ASSERT(!post->hasFiles); - return ("text/xml"); - } - else - { - GS_ASSERT(!post->hasSoap); - GS_ASSERT(!post->hasFiles); - return "application/x-www-form-urlencoded"; - } -} - -static int ghiPostGetNoFilesContentLength -( - struct GHIConnection * connection -) -{ - GHIPost * post = connection->post; - GHIPostData * data; - int i; - int num; - int total = 0; - int foundSoapAlready = 0; - - num = ArrayLength(post->data); - if(!num) - return 0; - - for(i = 0 ; i < num ; i++) - { - data = (GHIPostData *)ArrayNth(post->data, i); - - GS_ASSERT(data->type == GHIString || data->type == GHIXmlData); - - if (data->type == GHIString) - { - total += (int)strlen(data->name); - total += data->data.string.len; - total += (data->data.string.extendedChars * 2); - total++; // '=' - } - else if (data->type == GHIXmlData) - { - GS_ASSERT(foundSoapAlready == 0); // only support one soap object per request - foundSoapAlready = 1; - total += gsXmlWriterGetDataLength(data->data.xml.xml); - } - } - - total += (num - 1); // '&' - - GSI_UNUSED(foundSoapAlready); - return total; -} - -static int ghiPostGetHasFilesContentLength -( - struct GHIConnection * connection -) -{ - GHIPost * post = connection->post; - GHIPostData * data; - int i; - int num; - int total = 0; - int foundSoapAlready = 0; - static int boundaryLen; - static int stringBaseLen; - static int fileBaseLen; - static int endLen; - static int xmlBaseLen; - - if(!boundaryLen) - { - if (post->useDIME) - { - GS_ASSERT(post->hasSoap); - GS_ASSERT(post->hasFiles); - boundaryLen = sizeof(GHIDimeHeader); - stringBaseLen = boundaryLen; - fileBaseLen = boundaryLen; - xmlBaseLen = boundaryLen; - endLen = 0; - } - else - { - GS_ASSERT(!post->hasSoap); - boundaryLen = (int)strlen(GHI_MULTIPART_BOUNDARY_BASE); - stringBaseLen = (boundaryLen + 47); // + name + string - fileBaseLen = (boundaryLen + 76); // + name + filename + content-type + file - xmlBaseLen = 0; // no boundaries for text/xml type soap - endLen = (boundaryLen + 4); - } - } - - num = ArrayLength(post->data); - - for(i = 0 ; i < num ; i++) - { - data = (GHIPostData *)ArrayNth(post->data, i); - - if(data->type == GHIString) - { - total += stringBaseLen; - total += (int)strlen(data->name); - total += data->data.string.len; - } - else if(data->type == GHIFileDisk) - { - GHIPostState * state; - - total += fileBaseLen; - total += (int)strlen(data->name); - total += (int)strlen(data->data.fileDisk.contentType); - state = (GHIPostState *)ArrayNth(connection->postingState.states, i); - assert(state); - total += (int)state->state.fileDisk.len; - - if (!post->useDIME) - total += (int)strlen(data->data.fileDisk.reportFilename); - - if (post->useDIME) - { - // have to include padding bytes! - int padBytes = 0; - - padBytes = 4-(int)strlen(data->name)%4; - if (padBytes != 4) - total += padBytes; - padBytes = 4-(int)strlen(data->data.fileDisk.contentType)%4; - if (padBytes != 4) - total += padBytes; - padBytes = 4-(int)state->state.fileDisk.len%4; - if (padBytes != 4) - total += padBytes; - } - } - else if(data->type == GHIFileMemory) - { - total += fileBaseLen; - total += (int)strlen(data->name); - total += (int)strlen(data->data.fileMemory.contentType); - total += data->data.fileMemory.len; - - if (!post->useDIME) - total += (int)strlen(data->data.fileMemory.reportFilename); - - if (post->useDIME) - { - // have to include padding bytes! - int padBytes = 0; - - padBytes = 4-(int)strlen(data->name)%4; - if (padBytes != 4) - total += padBytes; - padBytes = 4-(int)strlen(data->data.fileMemory.contentType)%4; - if (padBytes != 4) - total += padBytes; - padBytes = 4-(int)data->data.fileMemory.len%4; - if (padBytes != 4) - total += padBytes; - } - } - else if(data->type == GHIXmlData) - { - int padBytes = 0; - - GS_ASSERT(foundSoapAlready == 0); // only one soap envelope per request - GS_ASSERT(post->useDIME); // soap+file = use DIME - foundSoapAlready = 1; - total += xmlBaseLen; - total += gsXmlWriterGetDataLength(data->data.xml.xml); - - // have to include padding bytes! - padBytes = 4-(int)gsXmlWriterGetDataLength(data->data.xml.xml)%4; - if (padBytes != 4) - total += padBytes; - total += (int)strlen(GHI_DIME_SOAPID); - padBytes = 4-(int)strlen(GHI_DIME_SOAPID)%4; - if (padBytes != 4) - total += padBytes; - total += (int)strlen(GHI_DIME_SOAPTYPE); - padBytes = 4-(int)strlen(GHI_DIME_SOAPTYPE)%4; - if (padBytes != 4) - total += padBytes; - } - else - { - assert(0); - return 0; - } - } - - // Add the end. - /////////////// - total += endLen; - - GSI_UNUSED(foundSoapAlready); - return total; -} - -static int ghiPostGetContentLength -( - struct GHIConnection * connection -) -{ - GHIPost * post = connection->post; - - assert(post); - if(!post) - return 0; - - if(post->hasFiles) - return ghiPostGetHasFilesContentLength(connection); - - return ghiPostGetNoFilesContentLength(connection); -} - -static GHTTPBool ghiPostStateInit -( - GHIPostState * state -) -{ - GHIPostDataType type; - - // The type. - //////////// - type = state->data->type; - - // Set the position to sending header. - ////////////////////////////////////// - state->pos = -1; - - // Init based on type. - ////////////////////// - if(type == GHIString) - { - } - else if(type == GHIFileDisk) - { - // Open the file. - ///////////////// -#ifndef NOFILE - state->state.fileDisk.file = fopen(state->data->data.fileDisk.filename, "rb"); -#endif - if(!state->state.fileDisk.file) - return GHTTPFalse; - - // Get the file length. - /////////////////////// - if(fseek(state->state.fileDisk.file, 0, SEEK_END) != 0) - return GHTTPFalse; - state->state.fileDisk.len = ftell(state->state.fileDisk.file); - if(state->state.fileDisk.len == EOF) - return GHTTPFalse; - rewind(state->state.fileDisk.file); - } - else if(type == GHIFileMemory) - { - } - else if(type == GHIXmlData) - { - } - else - { - // The type didn't match any known types. - ///////////////////////////////////////// - assert(0); - - return GHTTPFalse; - } - - return GHTTPTrue; -} - -static void ghiPostStateCleanup -( - GHIPostState * state -) -{ - GHIPostDataType type; - - // The type. - //////////// - type = state->data->type; - - // Init based on type. - ////////////////////// - if(type == GHIString) - { - } - else if(type == GHIFileDisk) - { - if(state->state.fileDisk.file) - fclose(state->state.fileDisk.file); - state->state.fileDisk.file = NULL; - } - else if(type == GHIFileMemory) - { - } - else if(type == GHIXmlData) - { - } - else - { - // The type didn't match any known types. - ///////////////////////////////////////// - assert(0); - } -} - -GHTTPBool ghiPostInitState -( - struct GHIConnection * connection -) -{ - int i; - int len; - GHIPostData * data; - GHIPostState state; - GHIPostState * pState; - - assert(connection->post); - if(!connection->post) - return GHTTPFalse; - - // Create an array for the states. - ////////////////////////////////// - connection->postingState.index = 0; - connection->postingState.bytesPosted = 0; - connection->postingState.totalBytes = 0; - connection->postingState.completed = GHTTPFalse; - connection->postingState.callback = connection->post->callback; - connection->postingState.param = connection->post->param; - len = ArrayLength(connection->post->data); - connection->postingState.states = ArrayNew(sizeof(GHIPostState), len, NULL); - if(!connection->postingState.states) - return GHTTPFalse; - - // Setup all the states. - //////////////////////// - for(i = 0 ; i < len ; i++) - { - // Get the data object for this index. - ////////////////////////////////////// - data = (GHIPostData *)ArrayNth(connection->post->data, i); - - // Initialize the state's members. - ////////////////////////////////// - memset(&state, 0, sizeof(GHIPostState)); - state.data = data; - - // Call the init function. - ////////////////////////// - if(!ghiPostStateInit(&state)) - { - // We need to cleanup everything we just initialized. - ///////////////////////////////////////////////////// - for(i-- ; i >= 0 ; i--) - { - pState = (GHIPostState *)ArrayNth(connection->postingState.states, i); - ghiPostStateCleanup(pState); - } - - // Free the array. - ////////////////// - ArrayFree(connection->postingState.states); - connection->postingState.states = NULL; - - return GHTTPFalse; - } - - // Add it to the array. - /////////////////////// - ArrayAppend(connection->postingState.states, &state); - } - - // If this asserts, there aren't the same number of state objects as data objects. - // There should be a 1-to-1 mapping between data and states. - ////////////////////////////////////////////////////////////////////////////////// - assert(ArrayLength(connection->post->data) == ArrayLength(connection->postingState.states)); - - // Get the total number of bytes. - ///////////////////////////////// - connection->postingState.totalBytes = ghiPostGetContentLength(connection); - - // Wait for continue before posting. - // -- Enabled for Soap messages only - // -- Disabled for all other content because many web servers do not support it - ////////////////////////////////////////////////////// - if (connection->post->hasSoap == GHTTPTrue) - connection->postingState.waitPostContinue = GHTTPTrue; - else - connection->postingState.waitPostContinue = GHTTPFalse; - - return GHTTPTrue; -} - -void ghiPostCleanupState -( - struct GHIConnection * connection -) -{ - int i; - int len; - GHIPostState * state; - - // Loop through and call the cleanup function. - ////////////////////////////////////////////// - if(connection->postingState.states) - { - len = ArrayLength(connection->postingState.states); - for(i = 0 ; i < len ; i++) - { - state = (GHIPostState *)ArrayNth(connection->postingState.states, i); - ghiPostStateCleanup(state); - } - - // Free the array. - ////////////////// - ArrayFree(connection->postingState.states); - connection->postingState.states = NULL; - } - - // Free the post. - ///////////////// - if(connection->post && connection->post->autoFree) - { - ghiFreePost(connection->post); - connection->post = NULL; - } -} - -static GHIPostingResult ghiPostStringStateDoPosting -( - GHIPostState * state, - GHIConnection * connection -) -{ - //GHTTPBool result; - - assert(state->pos >= 0); - - // Is this an empty string? - /////////////////////////// - if(state->data->data.string.len == 0) - return GHIPostingDone; - - assert(state->pos < state->data->data.string.len); - - // If we're doing a simple post, we need to fix invalid characters. - // - only applies to simple posts - /////////////////////////////////////////////////////////////////// - if(!connection->post->hasFiles && !connection->post->hasSoap && state->data->data.string.invalidChars) - { - int i; - int c; - const char * string = state->data->data.string.string; - char hex[4] = "%00"; - GHIBuffer *writeBuffer; - - // When encrypting, we need space for two copies - if (connection->encryptor.mEngine == GHTTPEncryptionEngine_None) - writeBuffer = &connection->sendBuffer; - else - writeBuffer = &connection->encodeBuffer; - - // This could probably be done a lot better. - //////////////////////////////////////////// - for(i = 0 ; (c = string[i]) != 0 ; i++) - { - if(strchr(GHI_LEGAL_URLENCODED_CHARS, c)) - { - // Legal. - ///////// - //result = ghiAppendCharToBuffer(writeBuffer, c); - ghiAppendCharToBuffer(writeBuffer, c); - } - else if(c == ' ') - { - // Space. - ///////// - //result = ghiAppendCharToBuffer(writeBuffer, '+'); - ghiAppendCharToBuffer(writeBuffer, '+'); - } - else - { - // To hex. - ////////// - assert((c / 16) < 16); - hex[1] = GHI_DIGITS[c / 16]; - hex[2] = GHI_DIGITS[c % 16]; - //result = ghiAppendDataToBuffer(writeBuffer, hex, 3); - ghiAppendDataToBuffer(writeBuffer, hex, 3); - } - } - } - else - { - // copy the string as-is, encrypting if necessary - GHITrySendResult result = ghiTrySendThenBuffer(connection, - state->data->data.string.string, state->data->data.string.len); - if (result == GHITrySendError) - return GHIPostingError; - else - return GHIPostingDone; - } - - // Send the URL fixed string - //////////////////////////// - if (connection->encryptor.mEngine == GHTTPEncryptionEngine_None) - { - // The URL fixed string was written to the send buffer, so send it! - if (!ghiSendBufferedData(connection)) - return GHIPostingError; - - if (connection->sendBuffer.pos == connection->sendBuffer.len) - ghiResetBuffer(&connection->sendBuffer); - return GHIPostingDone; - } - else - { - // SSL data is in the "to be encrypted" buffer, so wait until - // we have the full MIME form before encrypting (for efficiency) - return GHIPostingDone; - } -} - -static GHIPostingResult ghiPostXmlStateDoPosting -( - GHIPostState * state, - GHIConnection * connection -) -{ - GSXmlStreamWriter xml = state->data->data.xml.xml; - char pad[3] = { '\0', '\0', '\0' }; - int padlen = 0; - - // make sure state is valid - GS_ASSERT(state->pos >= 0); - GS_ASSERT(connection->post != NULL); - - // when using a DIME, we have to pad to multiple of 4 - if (connection->post->useDIME) - { - padlen = 4-(gsXmlWriterGetDataLength(xml)%4); - if (padlen == 4) - padlen = 0; - } - - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - // Copy to encode buffer before encrypting - GS_ASSERT(connection->encodeBuffer.len >= 0); // there must be a header for this soap data! - if (!ghiAppendDataToBuffer(&connection->encodeBuffer, gsXmlWriterGetData(xml), gsXmlWriterGetDataLength(xml)) || - !ghiAppendDataToBuffer(&connection->encodeBuffer, pad, padlen) || - !ghiEncryptDataToBuffer(&connection->sendBuffer, connection->encodeBuffer.data, connection->encodeBuffer.len) - ) - { - return GHIPostingError; - } - - // Clear out our temporary buffer - ghiResetBuffer(&connection->encodeBuffer); - - // Send what we can now - if (GHTTPFalse == ghiSendBufferedData(connection)) - return GHIPostingError; - - // is there more to send? - if (connection->sendBuffer.pos == connection->sendBuffer.len) - ghiResetBuffer(&connection->sendBuffer); - - return GHIPostingDone; - } - else - { - GHITrySendResult result; - - // plain text - send immediately - result = ghiTrySendThenBuffer(connection, gsXmlWriterGetData(xml), gsXmlWriterGetDataLength(xml)); - if (result == GHITrySendError) - return GHIPostingError; - result = ghiTrySendThenBuffer(connection, pad, padlen); - if (result == GHITrySendError) - return GHIPostingError; - return GHIPostingDone; - } -} - -static GHIPostingResult ghiPostFileDiskStateDoPosting -( - GHIPostState * state, - GHIConnection * connection -) -{ - char buffer[4096]; - int len; - GHITrySendResult result; - - assert(state->pos >= 0); - assert(state->pos < state->state.fileDisk.len); - assert(state->pos == (int)ftell(state->state.fileDisk.file)); - - // Loop while data is being sent. - ///////////////////////////////// - do - { - // Read some data from the file. - //////////////////////////////// - len = (int)fread(buffer, 1, sizeof(buffer), state->state.fileDisk.file); - if(len <= 0) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPFileReadFailed; - return GHIPostingError; - } - - // Update our position. - /////////////////////// - state->pos += len; - - // Check for too much. - ////////////////////// - if(state->pos > state->state.fileDisk.len) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPFileReadFailed; - return GHIPostingError; - } - - // Send. - //////// - result = ghiTrySendThenBuffer(connection, buffer, len); - if(result == GHITrySendError) - return GHIPostingError; - - // Check if we've handled everything. - ///////////////////////////////////// - if(state->pos == state->state.fileDisk.len) - { - // when using a DIME, we have to pad to multiple of 4 - if (connection->post->useDIME) - { - char pad[3] = { '\0', '\0', '\0' }; - int padlen = 4-state->state.fileDisk.len%4; - if (padlen != 4 && padlen > 0) - { - if (GHITrySendError == ghiTrySendThenBuffer(connection, pad, padlen)) - return GHIPostingError; - } - } - return GHIPostingDone; - } - } - while(result == GHITrySendSent); - - return GHIPostingPosting; -} - -static GHIPostingResult ghiPostFileMemoryStateDoPosting -( - GHIPostState * state, - GHIConnection * connection -) -{ - int rcode; - int len; - - assert(state->pos >= 0); - - // Is this an empty file? - ///////////////////////// - if(state->data->data.fileMemory.len == 0) - return GHIPostingDone; - - assert(state->pos < state->data->data.fileMemory.len); - - // Send what we can. - //////////////////// - if (connection->encryptor.mEngine == GHTTPEncryptionEngine_None) - { - // Plain text: Send directly from memory - do - { - len = (state->data->data.fileMemory.len - state->pos); - rcode = ghiDoSend(connection, state->data->data.fileMemory.buffer + state->pos, len); - if(gsiSocketIsError(rcode)) - return GHIPostingError; - - // Update the pos. - ////////////////// - state->pos += rcode; - - // Did we send it all? - ////////////////////// - if(state->data->data.fileMemory.len == state->pos) - { - // when using a DIME, we have to pad to multiple of 4 - if (connection->post->useDIME) - { - char pad[3] = { '\0', '\0', '\0' }; - int padlen = 4-state->data->data.fileMemory.len%4; - if (padlen != 4 && padlen > 0) - { - if (GHITrySendError == ghiTrySendThenBuffer(connection, pad, padlen)) - return GHIPostingError; - } - } - return GHIPostingDone; - } - } - while(rcode); - return GHIPostingPosting; // (rcode == 0) ? - } - else - { - // Encrypted: can't avoid the copy due to encryption+MAC - GHITrySendResult result; - do - { - len = (state->data->data.fileMemory.len - state->pos); - len = min(len, GS_SSL_MAX_CONTENTLENGTH); - result = ghiTrySendThenBuffer(connection, state->data->data.fileMemory.buffer + state->pos, len); - if (result == GHITrySendError) - return GHIPostingError; - - // Update the pos. - ////////////////// - state->pos += len; - - // Did we send it all? - ////////////////////// - if(state->data->data.fileMemory.len == state->pos) - { - // when using a DIME, we have to pad to multiple of 4 - if (connection->post->useDIME) - { - char pad[3] = { '\0', '\0', '\0' }; - int padlen = 4-state->data->data.fileMemory.len%4; - if (padlen != 4 && padlen > 0) - { - if (GHITrySendError == ghiTrySendThenBuffer(connection, pad, padlen)) - return GHIPostingError; - } - } - return GHIPostingDone; - } - } - while(result == GHITrySendSent); - return GHIPostingPosting; - } -} - -static GHIPostingResult ghiPostStateDoPosting -( - GHIPostState * state, - GHIConnection * connection, - GHTTPBool first, - GHTTPBool last -) -{ - int len = 0; - GHITrySendResult result; - - // Check for sending the header. - //////////////////////////////// - if(state->pos == -1) - { - char buffer[2048]; - - // Bump up the position so we only send the header once. - //////////////////////////////////////////////////////// - state->pos = 0; - - // Check if this is a simple post. - ////////////////////////////////// - if(!connection->post->hasFiles && !connection->post->hasSoap) - { - // Simple post only supports strings. - ///////////////////////////////////// - assert(state->data->type == GHIString); - - // Format the header. - ///////////////////// - if(first) - sprintf(buffer, "%s=", state->data->name); - else - sprintf(buffer, "&%s=", state->data->name); - } - else - { - // Format the header based on string or file. - ///////////////////////////////////////////// - if(state->data->type == GHIString) - { - sprintf(buffer, - "%s" - "Content-Disposition: form-data; " - "name=\"%s\"" CRLF - CRLF, - first?GHI_MULTIPART_BOUNDARY_FIRST:GHI_MULTIPART_BOUNDARY_NORMAL, - state->data->name); - } - else if(state->data->type == GHIXmlData) - { - if (connection->post->useDIME) - { - // use DIME header - // Copy from a temp struct to circumvent alignment issues - int writePos = 0; - int padBytes = 0; - GHIDimeHeader header; - - header.mVersionAndFlags = GHI_DIME_VERSION; - if (first) - header.mVersionAndFlags |= GHI_DIMEFLAG_FIRSTRECORD; - if (last) - header.mVersionAndFlags |= GHI_DIMEFLAG_LASTRECORD; - header.mTypeT = GHI_DIMETYPE_T_URI; - header.mOptionsLength = 0; - header.mIdLength = htons((short)strlen(GHI_DIME_SOAPID)); - header.mTypeLength = htons((short)strlen(GHI_DIME_SOAPTYPE)); - header.mDataLength = htonl(gsXmlWriterGetDataLength(state->data->data.xml.xml)); - - memcpy(&buffer[writePos], &header, sizeof(GHIDimeHeader)); - writePos += sizeof(GHIDimeHeader); - - // id - strcpy(&buffer[writePos], GHI_DIME_SOAPID); - writePos += strlen(GHI_DIME_SOAPID); - padBytes = (int)(4-strlen(GHI_DIME_SOAPID)%4); - if (padBytes != 4) - { - while(padBytes-- > 0) - buffer[writePos++] = '\0'; - } - - // type - strcpy(&buffer[writePos], GHI_DIME_SOAPTYPE); - writePos += strlen(GHI_DIME_SOAPTYPE); - padBytes = (int)(4-strlen(GHI_DIME_SOAPTYPE)%4); - if (padBytes != 4) - { - while(padBytes-- > 0) - buffer[writePos++] = '\0'; - } - - len = writePos; - } - else - buffer[0] = '\0'; - } - else if((state->data->type == GHIFileDisk) || (state->data->type == GHIFileMemory)) - { - const char * filename; - const char * contentType; - int filelen; - - if(state->data->type == GHIFileDisk) - { - filelen = state->state.fileDisk.len; - filename = state->data->data.fileDisk.reportFilename; - contentType = state->data->data.fileDisk.contentType; - } - else - { - filelen = state->data->data.fileMemory.len; - filename = state->data->data.fileMemory.reportFilename; - contentType = state->data->data.fileMemory.contentType; - } - - if (connection->post->useDIME) - { - // use DIME header - // Copy from a temp struct to circumvent alignment issues - int writePos = 0; - int padBytes = 0; - GHIDimeHeader header; - - header.mVersionAndFlags = GHI_DIME_VERSION; - if (first) - header.mVersionAndFlags |= GHI_DIMEFLAG_FIRSTRECORD; - if (last) - header.mVersionAndFlags |= GHI_DIMEFLAG_LASTRECORD; - header.mTypeT = GHI_DIMETYPE_T_MEDIA; - header.mOptionsLength = 0; - header.mIdLength = htons((short)strlen(state->data->name)); - header.mTypeLength = htons((short)strlen(contentType)); - header.mDataLength = htonl(filelen); - - memcpy(&buffer[writePos], &header, sizeof(GHIDimeHeader)); - writePos += sizeof(GHIDimeHeader); - - // id - strcpy(&buffer[writePos], state->data->name); - writePos += strlen(state->data->name); - padBytes = (int)(4-strlen(state->data->name)%4); - if (padBytes != 4) - { - while(padBytes-- > 0) - buffer[writePos++] = '\0'; - } - - // type - strcpy(&buffer[writePos], contentType); - writePos += strlen(contentType); - padBytes = (int)(4-strlen(contentType)%4); - if (padBytes != 4) - { - while(padBytes-- > 0) - buffer[writePos++] = '\0'; - } - - len = writePos; - } - else - { - // use MIME header - sprintf(buffer, - "%s" - "Content-Disposition: form-data; " - "name=\"%s\"; " - "filename=\"%s\"" CRLF - "Content-Type: %s" CRLF CRLF, - first?GHI_MULTIPART_BOUNDARY_FIRST:GHI_MULTIPART_BOUNDARY_NORMAL, - state->data->name, - filename, - contentType); - } - } - else - { - assert(0); - } - } - - // SSL: encrypt and send - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - if (len == 0) - len = (int)strlen(buffer); - if (GHTTPFalse == ghiEncryptDataToBuffer(&connection->sendBuffer, buffer, len)) - return GHIPostingError; - if (GHTTPFalse == ghiSendBufferedData(connection)) - return GHIPostingError; - - // any data remaining? - if (connection->sendBuffer.pos < connection->sendBuffer.len) - return GHIPostingPosting; - - // We sent everything, reset the send buffer to conserve space - ghiResetBuffer(&connection->sendBuffer); - } - // If sending plain text, send right away - else - { - // Try sending. (the one-time header) - ///////////////////////////////////// - if (len == 0) - len = (int)strlen(buffer); - result = ghiTrySendThenBuffer(connection, buffer, len); - if(result == GHITrySendError) - return GHIPostingError; - - // If it was buffered, don't try anymore. - ///////////////////////////////////////// - if(result == GHITrySendBuffered) - return GHIPostingPosting; - - // We sent everything, reset the send buffer to conserve space - ghiResetBuffer(&connection->sendBuffer); - } - } - - // Post based on type. - ////////////////////// - if(state->data->type == GHIString) - return ghiPostStringStateDoPosting(state, connection); - - if(state->data->type == GHIXmlData) - return ghiPostXmlStateDoPosting(state, connection); - - if(state->data->type == GHIFileDisk) - return ghiPostFileDiskStateDoPosting(state, connection); - - assert(state->data->type == GHIFileMemory); - return ghiPostFileMemoryStateDoPosting(state, connection); -} - -GHIPostingResult ghiPostDoPosting -( - struct GHIConnection * connection -) -{ - GHIPostingResult postingResult; - GHITrySendResult trySendResult; - GHIPostingState * postingState; - GHIPostState * postState; - int len; - - assert(connection); - assert(connection->post); - assert(connection->postingState.states); - assert(ArrayLength(connection->post->data) == ArrayLength(connection->postingState.states)); - assert(connection->postingState.index >= 0); - assert(connection->postingState.index <= ArrayLength(connection->postingState.states)); - - // Cache some stuff. - //////////////////// - postingState = &connection->postingState; - len = ArrayLength(postingState->states); - - // Check for buffered data. - /////////////////////////// - if(connection->sendBuffer.pos < connection->sendBuffer.len) - { - // Send the buffered data. - ////////////////////////// - if(!ghiSendBufferedData(connection)) - return GHIPostingError; - - // Check if we couldn't send it all. - //////////////////////////////////// - if(connection->sendBuffer.pos < connection->sendBuffer.len) - return GHIPostingPosting; - - // We sent it all, so reset the buffer. - /////////////////////////////////////// - ghiResetBuffer(&connection->sendBuffer); - - // If uploading a DIME attachment, wait for HTTP continue. - ////////////////////////////////////////////////////////// - if (connection->postingState.waitPostContinue) - return GHIPostingWaitForContinue; - - // Was that all that's left? - //////////////////////////// - if(connection->postingState.index == len) - return GHIPostingDone; - } - - // When posting soap and DIME attachments, we should terminate the - // header and wait for a response. This will either be a continue or - // a server error. - if (connection->postingState.waitPostContinue) - { - if (connection->post->hasFiles || connection->post->hasSoap) - { - // terminate the header and wait for a response - GS_ASSERT(connection->encodeBuffer.len == 0); - trySendResult = ghiTrySendThenBuffer(connection, CRLF, (int)strlen(CRLF)); - if(trySendResult == GHITrySendError) - return GHIPostingError; - else if (trySendResult == GHITrySendBuffered) - return GHIPostingPosting; - else - { - if (connection->postingState.waitPostContinue == GHTTPTrue) - return GHIPostingWaitForContinue; - //else - // fall through - } - } - else - { - // simple posts don't have to wait - connection->postingState.waitPostContinue = GHTTPFalse; - // fall through - } - } - - // Loop while there's data to upload. - ///////////////////////////////////// - while(postingState->index < len) - { - // Get the current data state. - ////////////////////////////// - postState = (GHIPostState *)ArrayNth(postingState->states, postingState->index); - assert(postState); - - // Upload the current data. - /////////////////////////// - postingResult = ghiPostStateDoPosting(postState, connection, - (postingState->index == 0)?GHTTPTrue:GHTTPFalse, - (postingState->index == (ArrayLength(postingState->states)-1))?GHTTPTrue:GHTTPFalse); - - // Check for error. - /////////////////// - if(postingResult == GHIPostingError) - { - // Make sure we already set the error stuff. - //////////////////////////////////////////// - assert(connection->completed && connection->result); - - return GHIPostingError; - } - - // Check for still posting. - /////////////////////////// - if(postingResult == GHIPostingPosting) - return GHIPostingPosting; - - // One more done. - ///////////////// - postingState->index++; - } - - // Encrypt and send anything left in the encode buffer - // -- for example, when posting string data we don't encrypt until we have the entire string (for efficiency only) - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None) - { - if (connection->encodeBuffer.len > 0) - { - GS_ASSERT(connection->encodeBuffer.pos == 0); // if you hit this, it means you forgot the clear the buffer - if (GHTTPFalse == ghiEncryptDataToBuffer(&connection->sendBuffer, - connection->encodeBuffer.data, connection->encodeBuffer.len)) - { - return GHIPostingError; - } - ghiResetBuffer(&connection->encodeBuffer); - } - } - - // Send or buffer the end marker. - ///////////////////////////////// - if(connection->post->hasFiles && !connection->post->useDIME) - { - GS_ASSERT(!connection->post->hasSoap); - - // send MIME boundary end - trySendResult = ghiTrySendThenBuffer(connection, GHI_MULTIPART_BOUNDARY_END, (int)strlen(GHI_MULTIPART_BOUNDARY_END)); - if(trySendResult == GHITrySendError) - return GHIPostingError; - } - - // We're not done if there's stuff in the buffer. - ///////////////////////////////////////////////// - if(connection->sendBuffer.pos < connection->sendBuffer.len) - return GHIPostingPosting; - - return GHIPostingDone; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpPost.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpPost.h deleted file mode 100644 index 1fab2a832fb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpPost.h +++ /dev/null @@ -1,126 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPPOST_H_ -#define _GHTTPPOST_H_ - -#include "ghttp.h" -#include "ghttpBuffer.h" -#include "../darray.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{ - GHIPostingError, - GHIPostingDone, - GHIPostingPosting, - GHIPostingWaitForContinue -} GHIPostingResult; - -typedef struct GHIPostingState -{ - DArray states; - int index; - int bytesPosted; - int totalBytes; - ghttpPostCallback callback; - void * param; - GHTTPBool waitPostContinue; // does DIME need to wait for continue? - GHTTPBool completed; // prevent re-post in the event of a redirect. -} GHIPostingState; - -GHTTPPost ghiNewPost -( - void -); - -void ghiPostSetAutoFree -( - GHTTPPost post, - GHTTPBool autoFree -); - -GHTTPBool ghiIsPostAutoFree -( - GHTTPPost post -); - -void ghiFreePost -( - GHTTPPost post -); - -GHTTPBool ghiPostAddString -( - GHTTPPost post, - const char * name, - const char * string -); - -GHTTPBool ghiPostAddFileFromDisk -( - GHTTPPost post, - const char * name, - const char * filename, - const char * reportFilename, - const char * contentType -); - -GHTTPBool ghiPostAddFileFromMemory -( - GHTTPPost post, - const char * name, - const char * buffer, - int bufferLen, - const char * reportFilename, - const char * contentType -); - -GHTTPBool ghiPostAddXml -( - GHTTPPost post, - GSXmlStreamWriter xmlSoap -); - -void ghiPostSetCallback -( - GHTTPPost post, - ghttpPostCallback callback, - void * param -); - -const char * ghiPostGetContentType -( - struct GHIConnection * connection -); - -GHTTPBool ghiPostInitState -( - struct GHIConnection * connection -); - -void ghiPostCleanupState -( - struct GHIConnection * connection -); - -GHIPostingResult ghiPostDoPosting -( - struct GHIConnection * connection -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpProcess.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpProcess.c deleted file mode 100644 index 5d9df87e365..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpProcess.c +++ /dev/null @@ -1,1745 +0,0 @@ -/* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 980, 1202, 1207, 1298, 1447, 1451 -#pragma warning(disable: 4267) //lines: 1071 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - -#include "ghttpProcess.h" -#include "ghttpCallbacks.h" -#include "ghttpPost.h" -#include "ghttpMain.h" -#include "ghttpCommon.h" - -// Parse the URL into: -// server address (and IP) -// server port -// request path. -///////////////////////////// -static GHTTPBool ghiParseURL -( - GHIConnection * connection -) -{ - char * URL; - int nIndex; - char tempChar; - char * str; - - assert(connection); - if(!connection) - return GHTTPFalse; - - // 2002.Apr.18.JED - Make sure we have an URL - ///////////////////////////////////////////// - assert(connection->URL); - if(!connection->URL) - return GHTTPFalse; - - URL = connection->URL; - - // Check for "http://". - ////////////////////// - if(strncmp(URL, "http://", 7) == 0) - { - connection->protocol = GHIHttp; - URL += 7; - } - else if (strncmp(URL, "https://", 8) == 0) - { - connection->protocol = GHIHttps; - URL += 8; - } - else - { - return GHTTPFalse; - } - - // Read the address. - //////////////////// - nIndex = (int)strcspn(URL, ":/"); - tempChar = URL[nIndex]; - URL[nIndex] = '\0'; - connection->serverAddress = goastrdup(URL); - if(!connection->serverAddress) - return GHTTPFalse; - URL[nIndex] = tempChar; - URL += nIndex; - - // Read the port. - ///////////////// - if(*URL == ':') - { - URL++; - connection->serverPort = (unsigned short)atoi(URL); - if(!connection->serverPort) - return GHTTPFalse; - do - { - URL++; - }while(*URL && (*URL != '/')); - } - else - { - if (connection->protocol == GHIHttps) - connection->serverPort = GHI_DEFAULT_SECURE_PORT; - else - connection->serverPort = GHI_DEFAULT_PORT; - } - - // Read the path. - ///////////////// - if(!*URL) - URL = "/"; - connection->requestPath = goastrdup(URL); - while((str = strchr(connection->requestPath, ' ')) != NULL) - *str = '+'; - if(!connection->requestPath) - return GHTTPFalse; - - return GHTTPTrue; -} - -/**************** -** SOCKET INIT ** -****************/ -void ghiDoSocketInit -( - GHIConnection * connection -) -{ - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Socket Initialization\n"); - - // Progress. - //////////// - ghiCallProgressCallback(connection, NULL, 0); - - // Init sockets. - //////////////// - SocketStartUp(); - - // Parse the URL. - ///////////////// - if(!ghiParseURL(connection)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPParseURLFailed; - return; - } - - // Check if an encryption type was set. - /////////////////////////////////////// - if((connection->protocol == GHIHttps) && (connection->encryptor.mEngine == GHTTPEncryptionEngine_None)) - { - // default to gamespy engine - //ghttpSetRequestEncryptionEngine(connection->request, GHTTPEncryptionEngine_GameSpy); - - // 02OCT07 BED: Design changed so that only one engine can be active at a time - // Use the active engine rather than GameSpy - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_WarmError, - "Encryption engine not set for HTTPS. Using default engine\r\n"); - ghttpSetRequestEncryptionEngine(connection->request, GHTTPEncryptionEngine_Default); - } - else if ((connection->protocol != GHIHttps) && (connection->encryptor.mEngine != GHTTPEncryptionEngine_None)) - { - // URL is not secured - ghttpSetRequestEncryptionEngine(connection->request, GHTTPEncryptionEngine_None); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_WarmError, - "Encryption engine set for unsecured URL. Removing encryption.\r\n"); - } - - // Init the encryption engine. - ////////////////////////////// - if ((connection->protocol == GHIHttps) && connection->encryptor.mInitialized == GHTTPFalse) - { - GHIEncryptionResult aResult; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Debug, "Initializing SSL engine\n"); - aResult = (connection->encryptor.mInitFunc)(connection, &connection->encryptor); - if (aResult == GHIEncryptionResult_Error) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_WarmError, "Failed to initialize SSL engine\n"); - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - } - - // Progress. - //////////// - connection->state = GHTTPHostLookup; - ghiCallProgressCallback(connection, NULL, 0); -} - -/**************** -** HOST LOOKUP ** -****************/ -void ghiDoHostLookup -( - GHIConnection * connection -) -{ - HOSTENT * host = NULL; - const char * server = NULL; - -#if !defined(GSI_NO_THREADS) - // Check to see if asynch lookup is taking place - //////////////////////////////////////////////// - if (connection->handle) - { - GSI_UNUSED(host); - GSI_UNUSED(server); - - // Lookup incomplete - set to lookupPending state - ///////////////////////////////////////////////// - connection->state = GHTTPLookupPending; - ghiCallProgressCallback(connection, NULL, 0); - return; - } -#endif - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Host Lookup\n"); - - - // Check for using a proxy. - /////////////////////////// - if (connection->proxyOverrideServer) // request specific proxy - server = connection->proxyOverrideServer; - else if(ghiProxyAddress) - server = ghiProxyAddress; - else - server = connection->serverAddress; - - // Try resolving the address as an IP a.b.c.d number. - ///////////////////////////////////////////////////// - connection->serverIP = inet_addr(server); - if(connection->serverIP == INADDR_NONE) - { - // Try resolving with DNS - asynchronously if possible - ////////////////////////// - -#if defined(GSI_NO_THREADS) - //blocking version - no threads - host = gethostbyname(server); - - if(host == NULL) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_HotError, - "Host Lookup failed\n"); - connection->completed = GHTTPTrue; - connection->result = GHTTPHostLookupFailed; - return; - } - - // Get the IP. - ////////////// - connection->serverIP = *(unsigned int *)host->h_addr_list[0]; -#else - - //threaded version - if (gsiStartResolvingHostname(server, &(connection->handle)) == -1) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_HotError, - "Thread Creation Failed\n"); - - //make sure to set it back to NULL - connection->handle = NULL; - - //exit with Host Lookup Failed error message - connection->completed = GHTTPTrue; - connection->result = GHTTPHostLookupFailed; - return; - } - else - { - //thread created properly - continue into lookupPending state - GSI_UNUSED(host); - } -#endif - } - - // Progress. - //////////// - - //check to see if lookup is complete - if (connection->serverIP == INADDR_NONE) - { - //lookup incomplete - set to lookupPending state - connection->state = GHTTPLookupPending; - ghiCallProgressCallback(connection, NULL, 0); - } - else - { - //lookup complete - proceed with connection stage - connection->state = GHTTPConnecting; - ghiCallProgressCallback(connection, NULL, 0); - } -} - -/****************** -** LOOKUP PENDING** -******************/ -void ghiDoLookupPending -( - GHIConnection * connection -) -{ -#if !defined(GSI_NO_THREADS) - //check if lookup is complete - connection->serverIP = gsiGetResolvedIP(connection->handle); - - //make sure there were no problems with the IP - if (connection->serverIP == GSI_ERROR_RESOLVING_HOSTNAME) - { - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_HotError, - "Error resolving hostname\n"); - - //set to NULL - connection->handle = NULL; - - //notify that the lookup failed - connection->completed = GHTTPTrue; - connection->result = GHTTPHostLookupFailed; - return; - } - - if (connection->serverIP == GSI_STILL_RESOLVING_HOSTNAME) - { - //lookup incomplete - keep calling this function - connection->state = GHTTPLookupPending; - ghiCallProgressCallback(connection, NULL, 0); - } - else - { - //set to NULL - connection->handle = NULL; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, - "DNS lookup complete\n"); - //looks like we got ourselves a server! proceed with connection phase - connection->state = GHTTPConnecting; - ghiCallProgressCallback(connection, NULL, 0); - } -#endif -} - -/*************** -** CONNECTING ** -***************/ -void ghiDoConnecting -( - GHIConnection * connection -) -{ - int rcode; - SOCKADDR_IN address; - int writeFlag; - int exceptFlag; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Connecting\n"); - - // If we don't have a socket yet, set it up. - //////////////////////////////////////////// - if(connection->socket == INVALID_SOCKET) - { - // Create the socket. - ///////////////////// - connection->socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if(connection->socket == INVALID_SOCKET) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPSocketFailed; - connection->socketError = GOAGetLastError(connection->socket); - return; - } - - // Set the socket to non-blocking. - ////////////////////////////////// - if(!SetSockBlocking(connection->socket, 0)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPSocketFailed; - connection->socketError = GOAGetLastError(connection->socket); - return; - } - - // If throttling, use a small receive buffer. - ///////////////////////////////////////////// - if(connection->throttle) - SetReceiveBufferSize(connection->socket, ghiThrottleBufferSize); - - // Setup the server address. - //////////////////////////// - memset(&address, 0, sizeof(SOCKADDR_IN)); - address.sin_family = AF_INET; - if (connection->proxyOverrideServer) - address.sin_port = htons(connection->proxyOverridePort); - else if(ghiProxyAddress) - address.sin_port = htons(ghiProxyPort); - else - address.sin_port = htons(connection->serverPort); - address.sin_addr.s_addr = connection->serverIP; - - // Start the connect. - ///////////////////// - rcode = connect(connection->socket, (SOCKADDR *)&address, sizeof(address)); - if(gsiSocketIsError(rcode)) - { - int socketError = GOAGetLastError(connection->socket); - if((socketError != WSAEWOULDBLOCK) && (socketError != WSAEINPROGRESS) && (socketError != WSAETIMEDOUT)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPConnectFailed; - connection->socketError = socketError; - return; - } - } - } - - // Check if the connect has completed. - ////////////////////////////////////// - rcode = GSISocketSelect(connection->socket, NULL, &writeFlag, &exceptFlag); - if((gsiSocketIsError(rcode)) || ((rcode == 1) && exceptFlag)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPConnectFailed; - if(gsiSocketIsError(rcode)) - connection->socketError = GOAGetLastError(connection->socket); - else - connection->socketError = 0; - return; - } - - // Check if we're connected. - //////////////////////////// - if((rcode == 1) && writeFlag) - { - // Progress. - //////////// - if (connection->encryptor.mEngine == GHTTPEncryptionEngine_None) - connection->state = GHTTPSendingRequest; - else - connection->state = GHTTPSecuringSession; - ghiCallProgressCallback(connection, NULL, 0); - } -} - -/****************** -** SSL HANDSHAKE ** -*******************/ -void ghiDoSecuringSession -( - GHIConnection * connection -) -{ - // Client sends hello - // Server sends hello, [certificate], [certificate request], [server key exchange] - // Client sends client , , [certificate], [certificate verify] - // Server sends finished - - // skip the ghiDoSecuringSession step... - // - when not using encryption or - // - if the connection is already secure - - GHIRecvResult result; - - // This buffer must be large enough to receive any handshake messages. - char buffer[1025]; - int bufferLen; - - // Start the handshake process - if (connection->encryptor.mSessionStarted == GHTTPFalse) - { - GHIEncryptionResult aResult; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Securing Session\n"); - - GS_ASSERT(connection->encryptor.mStartFunc != NULL); - if (connection->encryptor.mStartFunc != NULL) - { - aResult = (connection->encryptor.mStartFunc)(connection, &connection->encryptor); - if (aResult == GHIEncryptionResult_Error) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - } - - // Check for session established - if (connection->encryptor.mSessionEstablished) - { - connection->state = GHTTPSendingRequest; - ghiCallProgressCallback(connection, NULL, 0); - return; - } - } - - // if the SSL lib controls the handshake, just keep calling - // start until the session has been established - GS_ASSERT(connection->encryptor.mSessionEstablished == GHTTPFalse); - if (connection->encryptor.mLibSendsHandshakeMessages) - { - GS_ASSERT(connection->encryptor.mStartFunc != NULL); - if (connection->encryptor.mStartFunc != NULL) - { - GHIEncryptionResult aResult = (connection->encryptor.mStartFunc)(connection, &connection->encryptor); - if (aResult == GHIEncryptionResult_Error) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - } - - // Check for session established - if (connection->encryptor.mSessionEstablished) - { - connection->state = GHTTPSendingRequest; - ghiCallProgressCallback(connection, NULL, 0); - } - } - else - { - // Continue to send and receive handshake messages until the session has been secured - // Send any session messages - if (connection->sendBuffer.pos < connection->sendBuffer.len) - { - if (!ghiSendBufferedData(connection)) - return; // Todo: handle error? - - // Check for data still buffered. - ///////////////////////////////// - if(connection->sendBuffer.pos < connection->sendBuffer.len) - return; - - ghiResetBuffer(&connection->sendBuffer); - } - - // Get data - bufferLen = sizeof(buffer); - result = ghiDoReceive(connection, buffer, &bufferLen); - - // Handle error or conn closed. - /////////////////////////////// - if((result == GHIError) || (result == GHIConnClosed)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - - // check for received data - if(result == GHIRecvData) - { - // Append new encrypted data to anything we've held over - // We have to do this because we can't decrypt partial SSL messages - if (!ghiAppendDataToBuffer(&connection->decodeBuffer, buffer, bufferLen)) - return; - - // Decrypt as much as we can - if (!ghiDecryptReceivedData(connection)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - - // Check for session established (handshake complete) - if (connection->encryptor.mSessionEstablished) - { - connection->state = GHTTPSendingRequest; - ghiCallProgressCallback(connection, NULL, 0); - return; - } - } - } -} - - -/******************** -** SENDING REQUEST ** -********************/ -void ghiDoSendingRequest -( - GHIConnection * connection -) -{ - char * requestType; - int oldPos; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Sending Request\n"); - - // If we haven't filled the send buffer yet, do that first. - /////////////////////////////////////////////////////////// - if(!connection->sendBuffer.len) - { - // Using a pointer so we can pipe output to a different destination - // (e.g. for efficiency and testing purposes we may want to encrypt in larger blocks) - GHIBuffer* writeBuffer = NULL; - if (connection->encryptor.mEngine == GHTTPEncryptionEngine_None || - connection->encryptor.mEncryptOnBuffer == GHTTPFalse) - { - // write directly to send buffer - writeBuffer = &connection->sendBuffer; - } - else - { - // write to temp buffer so it can be encrypted before sending - writeBuffer = &connection->encodeBuffer; - } - - // Fill in the request line. - //////////////////////////// - if(connection->post && !connection->postingState.completed) - requestType = "POST "; - else if(connection->type == GHIHEAD) - requestType = "HEAD "; - else - requestType = "GET "; - ghiAppendDataToBuffer(writeBuffer, requestType, 0); - if (connection->proxyOverrideServer || ghiProxyAddress) - ghiAppendDataToBuffer(writeBuffer, connection->URL, 0); - else - ghiAppendDataToBuffer(writeBuffer, connection->requestPath, 0); - ghiAppendDataToBuffer(writeBuffer, " HTTP/1.1" CRLF, 0); - - // Add the host header. - /////////////////////// - if(connection->serverPort == GHI_DEFAULT_PORT) - { - ghiAppendHeaderToBuffer(writeBuffer, "Host", connection->serverAddress); - } - else - { - ghiAppendDataToBuffer(writeBuffer, "Host: ", 0); - ghiAppendDataToBuffer(writeBuffer, connection->serverAddress, 0); - ghiAppendCharToBuffer(writeBuffer, ':'); - ghiAppendIntToBuffer(writeBuffer, connection->serverPort); - ghiAppendDataToBuffer(writeBuffer, CRLF, 2); - } - - // Add the user-agent header. - ///////////////////////////// - if (connection->sendHeaders == NULL || strstr(connection->sendHeaders, "User-Agent")==NULL) - ghiAppendHeaderToBuffer(writeBuffer, "User-Agent", "GameSpyHTTP/1.0"); - - // Check for persistant connections. - ////////////////////////////////////// - if (connection->persistConnection) - ghiAppendHeaderToBuffer(writeBuffer, "Connection", "Keep-Alive"); - else - ghiAppendHeaderToBuffer(writeBuffer, "Connection", "close"); - - // Post needs extra headers. - //////////////////////////// - if(connection->post && !connection->postingState.completed) - { - char buf[16]; - - // Add the content-length header. - ///////////////////////////////// - sprintf(buf, "%d", connection->postingState.totalBytes); - ghiAppendHeaderToBuffer(writeBuffer, "Content-Length", buf); - - // Add the content-type header. - /////////////////////////////// - ghiAppendHeaderToBuffer(writeBuffer, "Content-Type", ghiPostGetContentType(connection)); - } - - // Not supported by all servers - //ghiAppendHeaderToBuffer(writeBuffer, "Expect", "100-continue"); - - // Add user-headers. - //////////////////// - if(connection->sendHeaders) - ghiAppendDataToBuffer(writeBuffer, connection->sendHeaders, 0); - - // Add the blank line to finish it off. - /////////////////////////////////////// - ghiAppendDataToBuffer(writeBuffer, CRLF, 2); - - // Encrypt it, if necessary. This copy is unfortunate since matrixSsl can't encrypt in place - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - GS_ASSERT(writeBuffer == &connection->encodeBuffer); - if (!ghiEncryptDataToBuffer(&connection->sendBuffer, writeBuffer->data, writeBuffer->len)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - ghiResetBuffer(writeBuffer); - } - } - - // Store the old position. - ////////////////////////// - oldPos = connection->sendBuffer.pos; - - // Send what we can. - //////////////////// - if(!ghiSendBufferedData(connection)) - return; - - // Log anything we sent. - //////////////////////// - #ifdef HTTP_LOG - if(connection->sendBuffer.pos != oldPos) - ghiLogRequest(connection->sendBuffer.data + oldPos, connection->sendBuffer.pos - oldPos); - #endif - - // Check for data still buffered. - ///////////////////////////////// - if(connection->sendBuffer.pos < connection->sendBuffer.len) - return; - - // Clear the send buffer. - ///////////////////////// - ghiResetBuffer(&connection->sendBuffer); - - // Finished sending. - //////////////////// - if(connection->post && !connection->postingState.completed) - connection->state = GHTTPPosting; - else - connection->state = GHTTPWaiting; - ghiCallProgressCallback(connection, NULL, 0); - - GSI_UNUSED(oldPos); -} - -/************ -** POSTING ** -************/ -void ghiDoPosting -( - GHIConnection * connection -) -{ - GHIPostingResult result; - int oldBytesPosted; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Posting\n"); - - // Store the old bytes posted. - ////////////////////////////// - oldBytesPosted = connection->postingState.bytesPosted; - - // Do some posting. - /////////////////// - result = ghiPostDoPosting(connection); - - // Check for an error. - ////////////////////// - if(result == GHIPostingError) - { - int rcode = 0; - int readFlag = 0; - - // Make sure we already set the error stuff. - //////////////////////////////////////////// - assert(connection->completed && connection->result); - - // Cleanup the posting state. - ///////////////////////////// - ghiPostCleanupState(connection); - - // Is there a server response? - rcode = GSISocketSelect(connection->socket, &readFlag, NULL, NULL); - if((rcode == 1) && readFlag) - { - // Ready to receive. - //////////////////// - connection->state = GHTTPReceivingStatus; - ghiCallProgressCallback(connection, NULL, 0); - } - return; - } - - // When sending DIME wait for initial - // continue before uploading - ///////////////////////////////////////// - if (result == GHIPostingWaitForContinue) - { - // Disable by skipping the wait - connection->postingState.waitPostContinue = GHTTPFalse; - return; - - //connection->state = GHTTPWaiting; - //return; - } - - // Call the callback if we sent anything. - ///////////////////////////////////////// - if(oldBytesPosted != connection->postingState.bytesPosted) - ghiCallPostCallback(connection); - - // Check for done. - ////////////////// - if(result == GHIPostingDone) - { - // Cleanup the posting state. - ///////////////////////////// - ghiPostCleanupState(connection); - connection->postingState.completed = GHTTPTrue; - - // Set the new connection state. - //////////////////////////////// - connection->state = GHTTPWaiting; - ghiCallProgressCallback(connection, NULL, 0); - - return; - } -} - -/************ -** WAITING ** -************/ -void ghiDoWaiting -( - GHIConnection * connection -) -{ - int readFlag; - int exceptFlag; - int rcode; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Waiting\n"); - - // We're waiting to receive something. - ////////////////////////////////////// - rcode = GSISocketSelect(connection->socket, &readFlag, NULL, &exceptFlag); - if((gsiSocketIsError(rcode)) || ((rcode == 1) && exceptFlag)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPSocketFailed; - if(gsiSocketIsError(rcode)) - connection->socketError = GOAGetLastError(connection->socket); - else - connection->socketError = 0; - return; - } - - // Check for waiting data. - ////////////////////////// - if((rcode == 1) && readFlag) - { - // Ready to receive. - //////////////////// - connection->state = GHTTPReceivingStatus; - ghiCallProgressCallback(connection, NULL, 0); - } -} - -// Parse the status line. -///////////////////////// -static GHTTPBool ghiParseStatus -( - GHIConnection * connection -) -{ - int majorVersion; - int minorVersion; - int statusCode; - int statusStringIndex; - int rcode; - char c; - - GS_ASSERT(connection); - GS_ASSERT(connection->recvBuffer.len > 0); - -#if defined(_X360) - //Xbox 360 needs "%n" to be manually enabled - { - int oldPrintCountValue = _set_printf_count_output(1); -#endif - - // Parse the string. - //////////////////// - rcode = sscanf(connection->recvBuffer.data, "HTTP/%d.%d %d%n", - &majorVersion, - &minorVersion, - &statusCode, - &statusStringIndex); - -#if defined(_X360) - _set_printf_count_output(oldPrintCountValue); - } -#endif - - // Check what we got. - ///////////////////// - if((rcode != 3) || // Not all fields read. - //!*statusString || // No status string. PANTS|9.16.02 - apparently some servers don't return a status string - (majorVersion < 1) || // Major version is less than 1. - (statusCode < 100) || // 1xx is lowest status code. - (statusCode >= 600)) // 5xx is highest status code. - { - connection->completed = GHTTPTrue; - connection->result = GHTTPBadResponse; - return GHTTPFalse; - } - - // Figure out where the status string starts. - ///////////////////////////////////////////// - while((c = connection->recvBuffer.data[statusStringIndex]) != '\0' && isspace(c)) - statusStringIndex++; - - // Set connection members. - ////////////////////////// - connection->statusMajorVersion = majorVersion; - connection->statusMinorVersion = minorVersion; - connection->statusCode = statusCode; - connection->statusStringIndex = statusStringIndex; - - return GHTTPTrue; -} - -/********************* -** RECEIVING STATUS ** -*********************/ -void ghiDoReceivingStatus -( - GHIConnection * connection -) -{ - char buffer[1024]; - int bufferLen; - GHIRecvResult result; - char * endOfStatus; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Receiving Status\n"); - - // Get data. - //////////// - bufferLen = sizeof(buffer); - result = ghiDoReceive(connection, buffer, &bufferLen); - - // Handle error or no data. - /////////////////////////// - if(result == GHIError) - return; - if(result == GHINoData) - return; - - // Only append data if we got data. - /////////////////////////////////// - if(result == GHIRecvData) - { - // Check for encryption. - //////////////////////// - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - // Append new encrypted data to anything we've held over - // We have to do this because we can't decrypt partial SSL messages - if (!ghiAppendDataToBuffer(&connection->decodeBuffer, buffer, bufferLen)) - return; - - // Decrypt as much as we can - if (!ghiDecryptReceivedData(connection)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - } - else - { - // Add the data directly to the buffer. - /////////////////////////////////////// - if(!ghiAppendDataToBuffer(&connection->recvBuffer, buffer, bufferLen)) - return; - } - } - - // Check if the status is finished. - ///////////////////////////////////// - endOfStatus = strstr(connection->recvBuffer.data, CRLF); - if(endOfStatus) - { - int statusLength; - - // Cap the status. - ////////////////// - *endOfStatus = '\0'; - - // Get the status length. - ///////////////////////// - statusLength = (endOfStatus - connection->recvBuffer.data); - - // Log it. - ////////// - ghiLogResponse(connection->recvBuffer.data, statusLength); - ghiLogResponse("\n", 1); - - // Parse the status line. - ///////////////////////// - if(!ghiParseStatus(connection)) - return; - - // Store the position of the start of the headers. - ////////////////////////////////////////////////// - connection->headerStringIndex = (statusLength + 2); - - - if (connection->statusCode == 100 && connection->postingState.waitPostContinue) - { - // DIME uploads must wait for initial continue before posting - connection->postingState.waitPostContinue = GHTTPFalse; - ghiResetBuffer(&connection->recvBuffer); // clear the continue - connection->state = GHTTPPosting; - ghiCallProgressCallback(connection, NULL, 0); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_Comment, - "Got HTTP continue\r\n"); - } - else - { - // We're receiving headers now. - /////////////////////////////// - connection->state = GHTTPReceivingHeaders; - ghiCallProgressCallback(connection, NULL, 0); - } - } - else if(result == GHIConnClosed) - { - // Connection closed. - ///////////////////// - connection->completed = GHTTPTrue; - connection->result = GHTTPBadResponse; - connection->socketError = GOAGetLastError(connection->socket); - return; - } -} - -// Delivers incoming file data to the appropriate place, -// then calls the progress callback. -// For GetFile, adds to buffer. -// For SaveFile, writes to disk. -// For StreamFile, does nothing. -// Returns false on error. -//////////////////////////////////////////////////////// -static GHTTPBool ghiDeliverIncomingFileData -( - GHIConnection * connection, - char * data, - int len -) -{ - char * buffer = NULL; - int bufferLen = 0; - - // Add this to the total. - ///////////////////////// - connection->fileBytesReceived += len; - - // Do we have the whole thing? - ////////////////////////////// - if(connection->fileBytesReceived == connection->totalSize || connection->connectionClosed) - connection->completed = GHTTPTrue; - - // Handle based on type. - //////////////////////// - if(connection->type == GHIGET) - { - // Put this in the buffer. - ////////////////////////// - if(!ghiAppendDataToBuffer(&connection->getFileBuffer, data, len)) - return GHTTPFalse; - - // Set the callback parameters. - /////////////////////////////// - buffer = connection->getFileBuffer.data; - bufferLen = connection->getFileBuffer.len; - } - else if(connection->type == GHISAVE) - { - int bytesWritten = 0; -#ifndef NOFILE - bytesWritten = fwrite(data, 1, len, connection->saveFile); -#endif - if(bytesWritten != len) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPFileWriteFailed; - return GHTTPFalse; - } - - // Set the callback parameters. - /////////////////////////////// - buffer = data; - bufferLen = len; - } - else if(connection->type == GHISTREAM) - { - // Set the callback parameters. - /////////////////////////////// - buffer = data; - bufferLen = len; - } - - // Call the callback. - ///////////////////// - ghiCallProgressCallback(connection, buffer, bufferLen); - - return GHTTPTrue; -} - -// Gets the size of a chunk from a chunk header. -// Returns -1 on error. -//////////////////////////////////////////////// -static int ghiParseChunkSize -( - GHIConnection * connection -) -{ - char * header; - int len; - int num; - int rcode; - - header = connection->chunkHeader; - len = connection->chunkHeaderLen; - - assert(len); - GSI_UNUSED(len); - - rcode = sscanf(header, "%x", &num); - if(rcode != 1) - return -1; - - return num; -} - -// Appends the data to the chunk header buffer. -/////////////////////////////////////////////// -static void ghiAppendToChunkHeaderBuffer -( - GHIConnection * connection, - char * data, - int len -) -{ - assert(connection); - assert(data); - assert(len >= 0); - - // This can happen at the end of a header. - ////////////////////////////////////////// - if(len == 0) - return; - - // Is there room in the buffer? If not, just - // skip, we most likely already have the chunk size. - //////////////////////////////////////////////////// - if(connection->chunkHeaderLen < CHUNK_HEADER_SIZE) - { - int numBytes; - - // How many bytes are we copying? - ///////////////////////////////// - numBytes = min(CHUNK_HEADER_SIZE - connection->chunkHeaderLen, len); - - // Move the (possibly partial) header into the buffer. - ////////////////////////////////////////////////////// - memcpy(connection->chunkHeader + connection->chunkHeaderLen, data, (unsigned int)numBytes); - - // Cap off the buffer. - ////////////////////// - connection->chunkHeaderLen += numBytes; - connection->chunkHeader[connection->chunkHeaderLen] = '\0'; - } -} - -// Does any neccessary processing to incoming file data -// before it gets delivered. This includes un-chunking. -// Returns false on error. -//////////////////////////////////////////////////////// -static GHTTPBool ghiProcessIncomingFileData -( - GHIConnection * connection, - char * data, - int len -) -{ - assert(connection); - assert(data); - assert(len > 0); - - // Is this a chunked transfer? - ////////////////////////////// - if(connection->chunkedTransfer) - { - // Loop while there's stuff to process. - /////////////////////////////////////// - while(len > 0) - { - // Reading a header? - //////////////////// - if(connection->chunkReadingState == CRHeader) - { - char * endOfHeader; - - // Have we hit the LF (as in the CRLF ending the header)? - ///////////////////////////////////////////////////////// - endOfHeader = strchr(data, 0xA); - if(endOfHeader) - { - // Append what we have to the buffer. - ///////////////////////////////////// - ghiAppendToChunkHeaderBuffer(connection, data, endOfHeader - data); - - // Adjust data and len. - /////////////////////// - endOfHeader++; - len -= (endOfHeader - data); - data = endOfHeader; - - // Read the chunk size. - /////////////////////// - connection->chunkBytesLeft = ghiParseChunkSize(connection); - if(connection->chunkBytesLeft == -1) - { - // There was an error reading the chunk size. - ///////////////////////////////////////////// - connection->completed = GHTTPTrue; - connection->result = GHTTPBadResponse; - return GHTTPFalse; - } - - // Set the chunk reading state. - /////////////////////////////// - if(connection->chunkBytesLeft == 0) - { - connection->chunkReadingState = CRFooter; - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "Reading footer\n"); - } - else - { - connection->chunkReadingState = CRChunk; - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "Reading %d byte chunk\n", connection->chunkBytesLeft); - } - } - else - { - // Move it all into the buffer. - /////////////////////////////// - ghiAppendToChunkHeaderBuffer(connection, data, len); - - // Nothing else we can do now. - ////////////////////////////// - return GHTTPTrue; - } - } - // Reading a chunk? - /////////////////// - else if(connection->chunkReadingState == CRChunk) - { - int numBytes; - - // How many bytes of data are we dealing with? - ////////////////////////////////////////////// - numBytes = min(connection->chunkBytesLeft, len); - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "Read %d bytes of chunk\n", numBytes); - - // Deliver the bytes. - ///////////////////// - if(!ghiDeliverIncomingFileData(connection, data, numBytes)) - return GHTTPFalse; - - // Adjust data and len. - /////////////////////// - data += numBytes; - len -= numBytes; - - // Figure out how many bytes left in chunk. - /////////////////////////////////////////// - connection->chunkBytesLeft -= numBytes; - - // Did we finish the chunk? - /////////////////////////// - if(connection->chunkBytesLeft == 0) - connection->chunkReadingState = CRCRLF; - } - // Reading a chunk footer (CRLF)? - ///////////////////////////////// - else if(connection->chunkReadingState == CRCRLF) - { - char * endOfFooter; - - // Did we get an LF? - //////////////////// - endOfFooter = strchr(data, 0xA); - - // The footer hasn't ended yet. - /////////////////////////////// - if(!endOfFooter) - return GHTTPTrue; - - // Adjust data and len. - /////////////////////// - endOfFooter++; - len -= (endOfFooter - data); - data = endOfFooter; - - // Set up for reading the next header. - ////////////////////////////////////// - connection->chunkHeader[0] = '\0'; - connection->chunkHeaderLen = 0; - connection->chunkBytesLeft = 0; - connection->chunkReadingState = CRHeader; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "Read chunk footer\n"); - } - // Reading the footer? - ////////////////////// - else if(connection->chunkReadingState == CRFooter) - { - // We're done. - ////////////// - connection->completed = GHTTPTrue; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_Network, GSIDebugLevel_RawDump, - "Finished reading chunks\n"); - - return GHTTPTrue; - } - // Bad state! - ///////////// - else - { - assert(0); - return GHTTPFalse; - } - } - - return GHTTPTrue; - } - - // Regular transfer, just deliver it. - ///////////////////////////////////// - return ghiDeliverIncomingFileData(connection, data, len); -} - -/********************** -** RECEIVING HEADERS ** -**********************/ -void ghiDoReceivingHeaders -( - GHIConnection * connection -) -{ - char buffer[4096]; - int bufferLen; - GHIRecvResult result; - GHTTPBool hasHeaders = GHTTPTrue; - char * headers; - char * endOfHeaders = NULL; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Receiving Headers\n"); - - // Get data. - //////////// - bufferLen = sizeof(buffer); - result = ghiDoReceive(connection, buffer, &bufferLen); - - // Handle error, no data, conn closed. - ////////////////////////////////////// - if(result == GHIError) - return; - if(result == GHINoData) - return; - - // Only append data if we got data. - /////////////////////////////////// - if(result == GHIRecvData) - { - // Check for encryption. - //////////////////////// - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - // Append new encrypted data to anything we've held over - // We have to do this because we can't decrypt partial SSL messages - if (!ghiAppendDataToBuffer(&connection->decodeBuffer, buffer, bufferLen)) - return; - - // Decrypt as much as we can - if (!ghiDecryptReceivedData(connection)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - } - else - { - // Add the data directly to the buffer. - /////////////////////////////////////// - if(!ghiAppendDataToBuffer(&connection->recvBuffer, buffer, bufferLen)) - return; - } - } - - // Cache a pointer to the front of the headers. - /////////////////////////////////////////////// - headers = (connection->recvBuffer.data + connection->headerStringIndex); - - // Check if the headers are finished. - ///////////////////////////////////// - if( ((connection->statusCode / 100) == 1) && - (strncmp(headers, "\r\n", 2) == 0 || strncmp(headers, "\xA\xA", 2) == 0) - ) - { - // If a continue doesn't have a header (immediate CRLF) move on to next status - endOfHeaders = headers; - hasHeaders = GHTTPFalse; - } - else - { - endOfHeaders = strstr(headers, CRLF CRLF); - } - if(!endOfHeaders) - { - endOfHeaders = strstr(headers, "\xA\xA"); // some servers seem to use LFs only?! Seen in 302 redirect. (28may01/bgw) - } - if(endOfHeaders) - { - char * fileStart; - int fileLength; - //int headersLength; - char * contentLength; - -#ifdef HTTP_LOG - int headersLength; -#endif - - // Clear off the empty line. - //////////////////////////// - if (GHTTPTrue == hasHeaders) - endOfHeaders += 2; - *endOfHeaders = '\0'; - - // Figure out where the file starts, and how many bytes. - //////////////////////////////////////////////////////// -#ifdef HTTP_LOG - headersLength = (endOfHeaders - headers); -#endif - - fileStart = (endOfHeaders + 2); - fileLength = (connection->recvBuffer.len - (fileStart - connection->recvBuffer.data)); - - // Set the headers buffer's new length. - /////////////////////////////////////// - connection->recvBuffer.len = (endOfHeaders - connection->recvBuffer.data + 1); - connection->recvBuffer.pos = connection->recvBuffer.len; - - // Log it. - ////////// -#ifdef HTTP_LOG - ghiLogResponse(headers, headersLength); - ghiLogResponse("\n", 1); -#endif - - // Check for continue. - ////////////////////// - if((connection->statusCode / 100) == 1) - { - if(fileLength) - { - // Move any data to the front of the buffer. - //////////////////////////////////////////// - memmove(connection->recvBuffer.data, fileStart, (unsigned int)fileLength + 1); - connection->recvBuffer.len = fileLength; - } - else - { - // Reset the buffer. - ///////////////////////// - ghiResetBuffer(&connection->recvBuffer); - } - - // Some posts must wait for continue before uploading - // Check if we should return to posting - if (connection->postingState.waitPostContinue) - { - connection->postingState.waitPostContinue = GHTTPFalse; - connection->state = GHTTPPosting; - ghiCallProgressCallback(connection, NULL, 0); - } - - // We're back to receiving status. - ////////////////////////////////// - connection->state = GHTTPReceivingStatus; - ghiCallProgressCallback(connection, NULL, 0); - - return; - } - - // Check for redirection. - ///////////////////////// - if((connection->statusCode / 100) == 3) - { - char * location; - - // Are we over our redirection count? - ///////////////////////////////////// - if(connection->redirectCount > 10) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPFileNotFound; - return; - } - - // Find the new location. - ///////////////////////// - location = strstr(headers, "Location:"); - if(location) - { - char * end; - - // Find the start of the URL. - ///////////////////////////// - location += 9; - while(isspace(*location)) - location++; - - // Find the end. - //////////////// - for(end = location; *end && !isspace(*end) ; end++) { }; - *end = '\0'; - - // Check if this is not a full URL. - /////////////////////////////////// - if(*location == '/') - { - int len; - - // Recompose the URL ourselves. - /////////////////////////////// - len = (int)(strlen(connection->serverAddress) + 13 + strlen(location) + 1); - connection->redirectURL = (char *)gsimalloc((unsigned int)len); - if(!connection->redirectURL) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPOutOfMemory; - } - sprintf(connection->redirectURL, "http://%s:%d%s", connection->serverAddress, connection->serverPort, location); - } - else - { - // Set the redirect URL. - //////////////////////// - connection->redirectURL = goastrdup(location); - if(!connection->redirectURL) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPOutOfMemory; - } - } - - return; - } - } - - // If we know the file-length, set it. - ////////////////////////////////////// - contentLength = strstr(headers, "Content-Length:"); - if(contentLength) - { - // Verify that the download size is something we can handle - /////////////////////////////////////////////////////////// -#if (GSI_MAX_INTEGRAL_BITS >= 64) - char szMaxSize[] = "9223372036854775807"; // == GSI_MAX_I64 -#else - char szMaxSize[] = "2147483647"; // == GSI_MAX_I32 -#endif - char* pStart = contentLength+16; - char* pEnd = pStart; - int nMaxLen = (int)strlen(szMaxSize); - - // Skip to the end of the line - while( pEnd && *pEnd != '\0' && *pEnd != '\n' && *pEnd != '\r' && *pEnd != ' ' ) - pEnd++; - - if( pEnd-pStart > nMaxLen ) - { - // Wow, that IS a big number - connection->completed = GHTTPTrue; - connection->result = GHTTPFileToBig; - return; - } - else - if( pEnd-pStart == nMaxLen ) - { - // Same length, maybe a bigger number - if( strncmp(pStart,szMaxSize,(unsigned int)(pEnd-pStart)) >= 0 ) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPFileToBig; - return; - } - } - - // Record the full size of the expected download - //////////////////////////////////////////////// -#if (GSI_MAX_INTEGRAL_BITS >= 64) - connection->totalSize = _atoi64(pStart); -#else - connection->totalSize = atoi(pStart); -#endif - } - - // Check the chunky. - //////////////////// - connection->chunkedTransfer = (strstr(headers, "Transfer-Encoding: chunked") != NULL)?GHTTPTrue:GHTTPFalse; - if(connection->chunkedTransfer) - { - connection->chunkHeader[0] = '\0'; - connection->chunkHeaderLen = 0; - connection->chunkBytesLeft = 0; - connection->chunkReadingState = CRHeader; - } - - // If we're just getting headers, or only posting data, we're done. - /////////////////////////////////////////////////////////////////// - if((connection->type == GHIHEAD) || (connection->type == GHIPOST)) - { - connection->completed = GHTTPTrue; - return; - } - - // We're receiving file data now. - ///////////////////////////////// - connection->state = GHTTPReceivingFile; - - // Is this an empty file? - ///////////////////////// - if(contentLength && !connection->totalSize) - { - connection->completed = GHTTPTrue; - return; - } - - // If any of the body has arrived, handle it. - ///////////////////////////////////////////// - if(fileLength > 0) - ghiProcessIncomingFileData(connection, fileStart, fileLength); - - // Don't reset the buffer -- we store status and header info - //ghiResetBuffer(&connection->recvBuffer); - } - else if(result == GHIConnClosed) - { - // The conn was closed, and we didn't finish the headers - bad. - /////////////////////////////////////////////////////////////// - connection->completed = GHTTPTrue; - connection->result = GHTTPBadResponse; - connection->socketError = GOAGetLastError(connection->socket); - } -} - -/******************* -** RECEIVING FILE ** -*******************/ -void ghiDoReceivingFile -( - GHIConnection * connection -) -{ - char buffer[8192]; - int bufferLen; - GHIRecvResult result; - gsi_time start_time = current_time(); - gsi_time running_time = 0; - - gsDebugFormat(GSIDebugCat_HTTP, GSIDebugType_State, GSIDebugLevel_Comment, "Receiving File\n"); - - while(!connection->completed && (running_time < connection->maxRecvTime)) - { - // Get data. - //////////// - bufferLen = sizeof(buffer); - result = ghiDoReceive(connection, buffer, &bufferLen); - - // Handle error, no data, conn closed. - ////////////////////////////////////// - if(result == GHIError) - return; - if(result == GHINoData) - return; - if(result == GHIConnClosed) - { - // The file is done (hopefully). - //////////////////////////////// - connection->completed = GHTTPTrue; - - if (connection->totalSize > 0 && connection->fileBytesReceived < connection->totalSize) - connection->result = GHTTPFileIncomplete; - return; - } - - // Check for encryption. - //////////////////////// - if (connection->encryptor.mEngine != GHTTPEncryptionEngine_None && - connection->encryptor.mEncryptOnBuffer == GHTTPTrue) - { - char * decryptedData; - int decryptedLen; - - // Append new encrypted data to anything we've held over - // We have to do this because we can't decrypt partial SSL messages - if (!ghiAppendDataToBuffer(&connection->decodeBuffer, buffer, bufferLen)) - return; - - // Previously decrypted parts of the file have already been handled. - connection->recvBuffer.len = connection->recvBuffer.pos; - - // Decrypt as much as we can - if (!ghiDecryptReceivedData(connection)) - { - connection->completed = GHTTPTrue; - connection->result = GHTTPEncryptionError; - return; - } - - // Check for decrypted data. - //////////////////////////// - decryptedLen = (connection->recvBuffer.len - connection->recvBuffer.pos); - if(decryptedLen) - { - // Process the data. - //////////////////// - decryptedData = (connection->recvBuffer.data + connection->recvBuffer.pos); - if(!ghiProcessIncomingFileData(connection, decryptedData, decryptedLen)) - return; - } - } - else - { - // Process the data. - //////////////////// - if(!ghiProcessIncomingFileData(connection, buffer, bufferLen)) - return; - } - - running_time = current_time() - start_time; - } -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpProcess.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpProcess.h deleted file mode 100644 index 6710b7970d7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpProcess.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GHTTPPROCESS_H_ -#define _GHTTPPROCESS_H_ - -#include "ghttpMain.h" -#include "ghttpConnection.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void ghiDoSocketInit (GHIConnection * connection); -void ghiDoHostLookup (GHIConnection * connection); -void ghiDoLookupPending (GHIConnection * connection); -void ghiDoConnecting (GHIConnection * connection); -void ghiDoSecuringSession (GHIConnection * connection); -void ghiDoSendingRequest (GHIConnection * connection); -void ghiDoPosting (GHIConnection * connection); -void ghiDoWaiting (GHIConnection * connection); -void ghiDoReceivingStatus (GHIConnection * connection); -void ghiDoReceivingHeaders(GHIConnection * connection); -void ghiDoReceivingFile (GHIConnection * connection); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp_vs2005.sln b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp_vs2005.sln deleted file mode 100644 index fbe71b5f905..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttp_vs2005.sln +++ /dev/null @@ -1,35 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghttpc_vs2005", "ghttpc\ghttpc_vs2005.vcproj", "{C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghttpmfc_vs2005", "ghttpmfc\ghttpmfc_vs2005.vcproj", "{0DC21D1C-D515-43C9-969C-29B89E0A8A20}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release|Win32 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Debug|Win32.ActiveCfg = Debug|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Debug|Win32.Build.0 = Debug|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Release|Win32.ActiveCfg = Release|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Release|Win32.Build.0 = Release|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 - {C6D52E9E-FA4B-4654-829D-9D12A1B29AA6}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Debug|Win32.Build.0 = Debug|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Release|Win32.ActiveCfg = Release|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Release|Win32.Build.0 = Release|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {0DC21D1C-D515-43C9-969C-29B89E0A8A20}.Unicode Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc.c b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc.c deleted file mode 100644 index 68696b04823..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc.c +++ /dev/null @@ -1,313 +0,0 @@ - /* -GameSpy GHTTP SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "../../common/gsCommon.h" -#include "../ghttp.h" - -#ifdef UNDER_CE - void RetailOutputA(CHAR *tszErr, ...); - #define printf RetailOutputA -#elif defined(_NITRO) - #include "../../common/nitro/screen.h" - #define printf Printf - #define vprintf VPrintf -#endif - -#define MAX_REQUESTS 20 - -typedef struct Result -{ - GHTTPBool started; - gsi_time startTime; - gsi_time stopTime; - GHTTPResult result; -} Result; - -static int pendingRequests; -static Result results[MAX_REQUESTS]; - -static gsi_char * stateStrings[] = -{ - _T("Socket Init"), - _T("Host Lookup"), - _T("Lookup Pending"), - _T("Connecting"), - _T("Securing Session"), - _T("Sending Request"), - _T("Posting"), - _T("Waiting"), - _T("Receiving Status"), - _T("Receiving Headers"), - _T("Receiving File") -}; - -static gsi_char * resultStrings[] = -{ - _T("GHTTPSuccess"), - _T("GHTTPOutOfMemory"), - _T("GHTTPBufferOverflow"), - _T("GHTTPParseURLFailed"), - _T("GHTTPHostLookupFailed"), - _T("GHTTPSocketFailed"), - _T("GHTTPConnectFailed"), - _T("GHTTPBadResponse"), - _T("GHTTPRequestRejected"), - _T("GHTTPUnauthorized"), - _T("GHTTPForbidden"), - _T("GHTTPFileNotFound"), - _T("GHTTPServerError"), - _T("GHTTPFileWriteFailed"), - _T("GHTTPFileReadFailed"), - _T("GHTTPFileIncomplete"), - _T("GHTTPFileToBig"), - _T("GHTTPEncryptionError"), - _T("GHTTPRequestCancelled") -}; - - -#ifdef __MWERKS__ // CodeWarrior will warn if function not prototyped -int test_main(int argc, char **argv); -#endif - -#ifdef GSI_COMMON_DEBUG - static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - { - GSI_UNUSED(theLevel); - - printf("[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - vprintf(theTokenStr, theParamList); - -#if defined(_WIN32) && !defined(_XBOX) - { - static char buffer[4098]; - sprintf(buffer, "[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - OutputDebugString(buffer); - vsprintf(buffer, theTokenStr, theParamList); - OutputDebugString(buffer); - } -#endif - } -#endif - -static GHTTPBool CompletedCallback -( - GHTTPRequest request, - GHTTPResult result, - char * buffer, - GHTTPByteCount bufferLen, - void * param -) -{ - int index = (int)param; - - pendingRequests--; - - // Save off the result. - /////////////////////// - results[index].result = result; - - // Save the time. - ///////////////// - results[index].stopTime = current_time(); - - // Check the result and print out some info. - //////////////////////////////////////////// - if(result == GHTTPSuccess) - _tprintf(_T("%d finished\n"), index); - else - _tprintf(_T("%d failed: %s\n"), index, resultStrings[result]); - - // Don't free this buffer, its from the stack. - ////////////////////////////////////////////// - if(index == 1) - return GHTTPFalse; - - // Free the buffer (if there is one). - ///////////////////////////////////// - GSI_UNUSED(request); - GSI_UNUSED(buffer); - GSI_UNUSED(bufferLen); - - return GHTTPTrue; -} - -static void ProgressCallback -( - GHTTPRequest request, - GHTTPState state, - const char * buffer, - GHTTPByteCount bufferLen, - GHTTPByteCount bytesReceived, - GHTTPByteCount totalSize, - void * param -) -{ - int index = (int)param; - - // Show the current state. - ////////////////////////// - _tprintf(_T("%d state: %s"), index, stateStrings[state]); - - // If we're receiving the file, show the progress. - ////////////////////////////////////////////////// - if(state == GHTTPReceivingFile) - { - // Display based on if we know the total size. - ////////////////////////////////////////////// - if(totalSize != -1) - _tprintf(_T(" (%d / %d bytes)\n"), bytesReceived, totalSize); - else - _tprintf(_T(" (%d bytes)\n"), bytesReceived); - } - else - _tprintf(_T("\n")); - - GSI_UNUSED(request); - GSI_UNUSED(buffer); - GSI_UNUSED(bufferLen); -} - -static void CheckRequest(GHTTPRequest request, int index) -{ - assert(index < MAX_REQUESTS); - results[index].started = (request < 0)?GHTTPFalse:GHTTPTrue; - if(results[index].started) - results[index].startTime = current_time(); -} - -int test_main(int argc, char **argv) -{ - int i; - static char buffer[10000] = ""; - GHTTPRequest request; - int numRequests; - -#ifdef GSI_COMMON_DEBUG - // Define GSI_COMMON_DEBUG if you want to view the SDK debug output - // Set the SDK debug log file, or set your own handler using gsSetDebugCallback - //gsSetDebugFile(stdout); // output to console - gsSetDebugCallback(DebugCallback); - - // Set some debug levels - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Hardcore); - //gsSetDebugLevel(GSIDebugCat_QR2, GSIDebugType_Network, GSIDebugLevel_Verbose); // Show Detailed data on network traffic - //gsSetDebugLevel(GSIDebugCat_App, GSIDebugType_All, GSIDebugLevel_Hardcore); // Show All app comment -#endif - - // get a file - request = ghttpGet( - _T("http://www.gamespy.net/images/dev_serv_main.jpg"), - GHTTPFalse, - CompletedCallback, - (void *)pendingRequests); - CheckRequest(request, pendingRequests); - pendingRequests++; - - // put a file into our own buffer, with progress updates - // also gets redirected - request = ghttpGetEx( - _T("http://google.com/intl/en_ALL/images/logo.gif"), - NULL, - buffer, sizeof(buffer), - NULL, - GHTTPFalse, - GHTTPFalse, - ProgressCallback, - CompletedCallback, - (void *)pendingRequests); - CheckRequest(request, pendingRequests); - pendingRequests++; - - // download a file -#if !defined(NOFILE) - request = ghttpSave( - _T("http://www.gamespy.net/images/dev_serv_logo.jpg"), - _T("logo.jpg"), - GHTTPFalse, - CompletedCallback, - (void *)pendingRequests); - CheckRequest(request, pendingRequests); - pendingRequests++; -#endif - - // stream a page - request = ghttpStreamEx( - _T("http://www.gamespy.net"), - NULL, - NULL, - GHTTPFalse, - GHTTPFalse, - ProgressCallback, - CompletedCallback, - (void *)pendingRequests); - CheckRequest(request, pendingRequests); - pendingRequests++; - - // get a header - request = ghttpHead( - _T("http://sdkdev.gamespy.com/games/st_ladder/web/index.html"), - GHTTPFalse, - CompletedCallback, - (void *)pendingRequests); - CheckRequest(request, pendingRequests); - pendingRequests++; - - // stream a secure page - request = ghttpStreamEx( -#if defined(_REVOLUTION) - _T("https://mariokartwii.race.gs.nintendowifi.net/RaceService/test.txt"), -#else - _T("https://www.gamespyid.com/"), -#endif - NULL, - NULL, - GHTTPFalse, - GHTTPFalse, - ProgressCallback, - CompletedCallback, - (void *)pendingRequests); - - //if(!IS_GHTTP_ERROR(request)) - // ghttpSetRequestEncryptionEngine(request, GHTTPEncryptionEngine_GameSpy); - CheckRequest(request, pendingRequests); - pendingRequests++; - - // store the number of requests - numRequests = pendingRequests; - - do - { - ghttpThink(); - msleep(20); - } - while(pendingRequests); - - ghttpCleanup(); - - _tprintf(_T("Results:\n")); - for(i = 0 ; i < numRequests ; i++) - { - if(results[i].started == GHTTPFalse) - _tprintf(_T("%d: Failed to start\n"), i); - else - _tprintf(_T("%d: %s [%dms]\n"), i, resultStrings[results[i].result], results[i].stopTime - results[i].startTime); - } - - GSI_UNUSED(argc); - GSI_UNUSED(argv); - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc.dsp deleted file mode 100644 index c49764fe869..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc.dsp +++ /dev/null @@ -1,364 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ghttpc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ghttpc - Win32 Unicode Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ghttpc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ghttpc.mak" CFG="ghttpc - Win32 Unicode Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ghttpc - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpc - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpc - Win32 Unicode Release" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpc - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/ghttp/ghttpc", BUZAAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ghttpc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "ghttpc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_COMMON_DEBUG" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "ghttpc - Win32 Unicode Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "ghttpc___Win32_Unicode_Release" -# PROP BASE Intermediate_Dir "ghttpc___Win32_Unicode_Release" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "UnicodeRelease" -# PROP Intermediate_Dir "UnicodeRelease" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_UNICODE" /YX /FD /c -# ADD CPP /nologo /MT /W3 /WX /GX /O2 /D "GSI_UNICODE" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "ghttpc - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ghttpc___Win32_Unicode_Debug" -# PROP BASE Intermediate_Dir "ghttpc___Win32_Unicode_Debug" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "UnicodeDebug" -# PROP Intermediate_Dir "UnicodeDebug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_UNICODE" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "ghttpc - Win32 Release" -# Name "ghttpc - Win32 Debug" -# Name "ghttpc - Win32 Unicode Release" -# Name "ghttpc - Win32 Unicode Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\ghttpc.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "HttpSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\ghttp.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpCallbacks.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpCallbacks.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpCommon.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpCommon.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpConnection.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpConnection.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpEncryption.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpEncryption.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpMain.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpMain.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpPost.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpPost.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpProcess.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpProcess.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.c -# End Source File -# Begin Source File - -SOURCE=..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\win32\Win32Common.c -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc_vs2005.vcproj deleted file mode 100644 index 859e75a8733..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpc_vs2005.vcproj +++ /dev/null @@ -1,942 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttplinux/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttplinux/Makefile deleted file mode 100644 index e42d6417ad9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttplinux/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -# HTTP SDK Makefile -# Copyright 2004 GameSpy Industries - -PROJECT=ghttplinux - -CC=gcc -BASE_CFLAGS=-D_LINUX -DGSI_COMMON_DEBUG -D_DEBUG - -#use these cflags to optimize it -CFLAGS=$(BASE_CFLAGS) -march=i486 -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -falign-loops=2 \ - -falign-jumps=2 -falign-functions=2 -lpthread - -#use these when debugging -DEBUG_CFLAGS=$(BASE_CFLAGS) -g -lpthread -march=i486 -O6 - -PROG_OBJS = \ - ../../../md5c.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/linux/LinuxCommon.o\ - ../../../common/gsAssert.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsDebug.o\ - ../../../common/gsCrypt.o\ - ../../../common/gsLargeInt.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsXML.o\ - ../../../common/gsSHA1.o\ - ../../../common/gsRC4.o\ - ../../../common/gsSSL.o\ - ../../ghttpBuffer.o\ - ../../ghttpCallbacks.o\ - ../../ghttpConnection.o\ - ../../ghttpEncryption.o\ - ../../ghttpMain.o\ - ../../ghttpProcess.o\ - ../../ghttpCommon.o\ - ../../ghttpPost.o\ - ../ghttpc.o - - -############################################################################# -# SETUP AND BUILD -############################################################################# - -$(PROJECT): $(PROG_OBJS) - $(CC) $(DEBUG_CFLAGS) -o $@ $(PROG_OBJS) - -############################################################################# -# MISC -############################################################################# -ghttp_debug: $(PROG_OBJS) - $(CC) $(DEBUG_CFLAGS) -o $@ $(PROG_OBJS) - -clean: - rm -f $(PROG_OBJS) - -depend: - gcc -MM $(PROG_OBJS:.o=.c) - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpmacosx/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpmacosx/Makefile deleted file mode 100644 index 098ac1a461c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpmacosx/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# HTTP SDK Makefile - Mac OSX -# Copyright 2006 GameSpy Industries - -PROJECT=ghttpc - -PROG_OBJS = \ - ../../../md5c.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/macosx/MacOSXCommon.o\ - ../../../common/gsAssert.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsDebug.o\ - ../../../common/gsCrypt.o\ - ../../../common/gsLargeInt.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsXML.o\ - ../../../common/gsSHA1.o\ - ../../../common/gsRC4.o\ - ../../../common/gsSSL.o\ - ../../ghttpBuffer.o\ - ../../ghttpCallbacks.o\ - ../../ghttpConnection.o\ - ../../ghttpEncryption.o\ - ../../ghttpMain.o\ - ../../ghttpProcess.o\ - ../../ghttpCommon.o\ - ../../ghttpPost.o\ - ../ghttpc.o - - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/macosx/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/Nitro.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/Nitro.lcf deleted file mode 100644 index 998f6b00259..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/Nitro.lcf +++ /dev/null @@ -1,493 +0,0 @@ -#--------------------------------------------------------------------------- -# Project: NitroSDK - tools - makelcf -# File: ARM9-TS.lcf.template -# -# Copyright 2003-2006 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ARM9-TS.lcf.template,v $ -# Revision 1.34 04/06/2006 09:02:36 kitase_hirotake -# support for .itcm.bss and .dtcm.bss -# -# Revision 1.33 03/30/2006 23:59:22 AM yasu -# changed creation year -# -# Revision 1.32 03/29/2006 13:14:22 AM yasu -# support for overlays in CWVER 2.x -# -# Revision 1.31 11/24/2005 01:16:47 yada -# change start address of mainEX arena from 0x2400000 to 0x23e0000 -# -# Revision 1.30 09/02/2005 04:14:22 AM yasu -# Old symbols were redefined so they can be used even under SDK2.2 -# -# Revision 1.29 08/31/2005 09:34:57 AM yasu -# Corrected a problem where code would not function normally when using section names such as section_BSS -# -# Revision 1.28 08/26/2005 11:22:16 AM yasu -# overlay support for ITCM/DTCM -# -# Revision 1.27 06/20/2005 12:29:20 AM yasu -# Changed Surffix to Suffix -# -# Revision 1.26 06/14/2005 09:03:42 yada -# fix around minus value of SDK_STACKSIZE -# -# Revision 1.25 04/13/2005 12:51:00 terui -# Change SDK_AUTOLOAD.DTCM.START 0x027c0000 -> 0x027e0000 -# -# Revision 1.24 03/30/2005 00:02:14 yosizaki -# fix copyright header. -# -# Revision 1.23 03/25/2005 12:54:59 AM yasu -# Include .version section -# -# Revision 1.22 10/03/2004 02:00:56 AM yasu -# Output component file list for compstatic tool -# -# Revision 1.21 09/27/2004 05:28:21 AM yasu -# Support .sinit -# -# Revision 1.20 09/09/2004 11:49:20 AM yasu -# Support compstatic in default -# -# Revision 1.19 09/06/2004 06:40:00 AM yasu -# Add labels for digest -# -# Revision 1.18 08/20/2004 06:19:59 AM yasu -# DTCM moves to 0x027c0000 at default -# -# Revision 1.17 08/02/2004 10:38:53 AM yasu -# Add autoload-done callback address in overlaydefs -# -# Revision 1.16 07/26/2004 02:22:32 AM yasu -# Change DTCM address to 0x023c0000 -# -# Revision 1.15 07/26/2004 00:08:27 AM yasu -# Fix label of exception table -# -# Revision 1.14 07/24/2004 05:42:25 AM yasu -# Set default values for SDK_AUTOGEN_xTCM_START -# -# Revision 1.13 07/23/2004 11:32:14 AM yasu -# Define labels for __exception_table_start__ and _end__ -# -# Revision 1.12 07/12/2004 12:21:08 AM yasu -# Check size of ITCM/DTCM -# -# Revision 1.11 07/10/2004 04:10:26 AM yasu -# Support command 'Library' -# -# Revision 1.10 07/02/2004 08:13:02 AM yasu -# Support OBJECT( ) -# -# Revision 1.9 07/01/2004 12:54:38 yasu -# support ITCM/DTCM/WRAM autoload -# -# Revision 1.8 07/01/2004 10:41:46 yasu -# support autoload -# -# Revision 1.7 06/02/2004 07:35:37 yasu -# Set libsyscall.a in FORCE_ACTIVE -# Put NitroMain at the top of ROM image -# -# Revision 1.6 06/02/2004 04:56:28 yasu -# Change to fit to new ROM map of TS -# -# Revision 1.5 2004/06/01 06:12:00 miya -# add padding at top of ROM image. -# -# Revision 1.4 04/26/2004 12:16:48 yasu -# add KEEP_SECTIONS -# -# Revision 1.3 04/20/2004 07:41:32 yasu -# Set STATICINIT instead of .ctor temporarily -# -# Revision 1.2 04/14/2004 07:16:42 yasu -# add ALIGN(32) for convenience to handle cache line -# -# Revision 1.1 04/06/2004 01:59:54 yasu -# newly added -# -# $NoKeywords: $ -#--------------------------------------------------------------------------- -MEMORY -{ - main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin - ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin - DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - - main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin - main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin - dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 - arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 - arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0 - arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0 - arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0 - binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files - check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check - check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check -} - -FORCE_ACTIVE -{ - SVC_SoftReset -} - -KEEP_SECTION -{ - .sinit -} - -SECTIONS -{ - ############################ STATIC ################################# - .main: - { - ALIGNALL(4); . = ALIGN(32); # Fit to cache line - - # - # TEXT BLOCK: READ ONLY - # - SDK_STATIC_START =.; - SDK_STATIC_TEXT_START =.; - #:::::::::: text/rodata - libsyscall.a (.text) - crt0.o (.text) - crt0.o (.rodata) - * (.version) - OBJECT(NitroMain,*) - GROUP(ROOT) (.text) - . = ALIGN(4); - * (.exception) - . = ALIGN(4); - SDK_STATIC_ETABLE_START =.; - EXCEPTION - SDK_STATIC_ETABLE_END =.; - . = ALIGN(4); - GROUP(ROOT) (.init) - . = ALIGN(4); - GROUP(ROOT) (.rodata) - . = ALIGN(4); - - SDK_STATIC_SINIT_START =.; - #:::::::::: ctor - GROUP(ROOT) (.ctor) - GROUP(ROOT) (.sinit) - WRITEW 0; - #:::::::::: ctor - SDK_STATIC_SINIT_END =.; - - #:::::::::: text/rodata - . = ALIGN(32); - SDK_STATIC_TEXT_END =.; - - # - # DATA BLOCK: READ WRITE - # - SDK_STATIC_DATA_START =.; - #:::::::::: data - GROUP(ROOT) (.sdata) - . = ALIGN(4); - GROUP(ROOT) (.data) - . = ALIGN(4); - SDK_OVERLAY_DIGEST =.; - # NO DIGEST - SDK_OVERLAY_DIGEST_END =.; - #:::::::::: data - . = ALIGN(32); - SDK_STATIC_DATA_END =.; - SDK_STATIC_END =.; - - SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; - SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; - SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; - __sinit__ = SDK_STATIC_SINIT_START; # for static initializer - __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table - __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table - } > main - - .main.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_STATIC_BSS_START =.; - #:::::::::: bss - GROUP(ROOT) (.sbss) - . = ALIGN(4); - GROUP(ROOT) (.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_STATIC_BSS_END = .; - SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; - - } >> main - - - ############################ AUTOLOADS ############################## - SDK_AUTOLOAD.ITCM.START = 0x01ff8000; - SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.SIZE = 0; - SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; - SDK_AUTOLOAD.DTCM.START = 0x027e0000; - SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.SIZE = 0; - SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; - SDK_AUTOLOAD_START = SDK_STATIC_END; - SDK_AUTOLOAD_SIZE = 0; - SDK_AUTOLOAD_NUMBER = 2; - - .ITCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_ITCM_ID =0; - SDK_AUTOLOAD.ITCM.ID =0; - SDK_AUTOLOAD.ITCM.START =.; - SDK_AUTOLOAD.ITCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - * (.itcm) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.ITCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.ITCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.DATA_END =.; - SDK_AUTOLOAD.ITCM.END =.; - - SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START; - SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START; - SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE; - - } > ITCM - - .ITCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.ITCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - * (.itcm.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.BSS_END = .; - - SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START; - - } >> ITCM - - .DTCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_DTCM_ID =1; - SDK_AUTOLOAD.DTCM.ID =1; - SDK_AUTOLOAD.DTCM.START =.; - SDK_AUTOLOAD.DTCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.DTCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.DTCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm) - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.DATA_END =.; - SDK_AUTOLOAD.DTCM.END =.; - - SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START; - SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START; - SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE; - - } > DTCM - - .DTCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.DTCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm.bss) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.BSS_END = .; - - SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START; - - } >> DTCM - - - SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; - SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; - SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; - SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; - SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; - SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; - SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; - SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; - - ############################ AUTOLOAD_INFO ########################## - .binary.AUTOLOAD_INFO: - { - WRITEW ADDR(.ITCM); - WRITEW SDK_AUTOLOAD.ITCM.SIZE; - WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE; - WRITEW ADDR(.DTCM); - WRITEW SDK_AUTOLOAD.DTCM.SIZE; - WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE; - } > binary.AUTOLOAD_INFO - - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - - ############################ STATIC_FOOTER ########################## - .binary.STATIC_FOOTER: - { - WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE - WRITEW _start_ModuleParams - ADDR(.main); - WRITEW 0; # NO DIGEST - } > binary.STATIC_FOOTER - - ############################ OVERLAYS ############################### - SDK_OVERLAY_NUMBER = 0; - - - ############################ MAIN EX ################################## - # MAIN EX Area - .dummy.MAIN_EX: - { - . = ALIGN(32); - } > dummy.MAIN_EX - - ############################ ARENA ################################## - .arena.MAIN: - { - . = ALIGN(32); - SDK_SECTION_ARENA_START =.; - } > arena.MAIN - - .arena.MAIN_EX: - { - . = ALIGN(32); - SDK_SECTION_ARENA_EX_START =.; - } > arena.MAIN_EX - - .arena.ITCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_ITCM_START =.; - } > arena.ITCM - - .arena.DTCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_DTCM_START =.; - } > arena.DTCM - - ############################ OVERLAYDEFS ############################ - .main_defs: - { - ### main module information - WRITEW ADDR(.main); # load address - WRITEW _start; # entry address - WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module - WRITEW _start_AutoloadDoneCallback; # callback autoload done - - ### overlay filename - - } > main_defs - - - ############################ OVERLAYTABLE ########################### - .main_table: - { - - } > main_table - - - ############################ OTHERS ################################# - SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; - SDK_IRQ_STACKSIZE = 4096; # allocated in DTCM - SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM - - # Module filelist - .binary.MODULE_FILES: - { - WRITES ("main.sbin"); - WRITES ("main_defs.sbin"); - WRITES ("main_table.sbin"); - } > binary.MODULE_FILES - - # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM - .check.ITCM: - { - . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; - } > check.ITCM - - SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; - .check.DTCM: - { - . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; - . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; - } > check.DTCM - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/ROM-TS.rsf b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/ROM-TS.rsf deleted file mode 100644 index cec9e1dbf9a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/ROM-TS.rsf +++ /dev/null @@ -1,116 +0,0 @@ -#---------------------------------------------------------------------------- -# Project: NitroSDK - include -# File: ROM-TS.lsf -# -# Copyright 2003-2005 Nintendo. All rights reserved. -# -# These coded insructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ROM-TS.rsf,v $ -# Revision 1.6 2005/04/05 23:52:58 yosizaki -# fix copyright date. -# -# Revision 1.5 2005/04/05 12:16:10 yosizaki -# support RomSpeedType parameter. -# -# Revision 1.4 2004/09/21 02:18:49 yasu -# Add default banner -# -# Revision 1.3 2004/09/09 11:39:09 yasu -# Unified ROM-TS and ROM-TS-C, also ROM-TEG and ROM-TEG-C -# -# Revision 1.2 2004/05/26 12:03:38 yasu -# add :r option to get basename for supporting IDE with makerom -# -# Revision 1.1 2004/04/06 01:59:59 yasu -# newly added -# -# $NoKeywords: $ -#---------------------------------------------------------------------------- -# -# Nitro ROM SPEC FILE -# - -Arm9 -{ - Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" - OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" - OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" - Elf "$(MAKEROM_ARM9:r).nef" -} - -Arm7 -{ - Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" - OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" - OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" - Elf "$(MAKEROM_ARM7:r).nef" -} - -Property -{ - ### - ### Settings for FinalROM - ### - #### BEGIN - # - # TITLE NAME: Your product name within 12bytes - # - #TitleName "YourAppName" - - # - # MAKER CODE: Your company ID# in 2 ascii words - # issued by NINTENDO - # - #MakerCode "00" - - # - # REMASTER VERSION: Mastering version - # - #RomVersion 0 - - # - # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] - # - RomSpeedType $(MAKEROM_ROMSPEED) - - # - # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] - # - #RomSize 128M - #RomSize 256M - - # - # ROM PADDING: TRUE if finalrom - # - #RomFootPadding TRUE - - # - # ROM HEADER TEMPLATE: Provided to every product by NINTENDO - # - #RomHeaderTemplate ./etc/rom_header.template.sbin - - # - # BANNER FILE: generated from Banner Spec File - # - #BannerFile ./etc/myGameBanner.bnr - BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr - - ### - ### - ### - #### END -} - -RomSpec -{ - Offset 0x00000000 - Segment ALL - HostRoot $(MAKEROM_ROMROOT) - Root / - File $(MAKEROM_ROMFILES) -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/ghttpnitrocw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/ghttpnitrocw.mcp deleted file mode 100644 index 68c5fd58798..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpnitrocw/ghttpnitrocw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2/Makefile deleted file mode 100644 index a04bef91975..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -#GameSpy.net PS2 Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CLFAGS = - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -SDK_LIBS = - -#Name of the SDK sample -TARGET = ghttpc - -#All the object files needed for this SDK -OBJS = ../../../ps2common/ps2common.o \ - ../../../nonport.o \ - ../../../darray.o\ - ../../../stringutil.o\ - ../../ghttpBuffer.o \ - ../../ghttpCallbacks.o \ - ../../ghttpConnection.o \ - ../../ghttpMain.o \ - ../../ghttpProcess.o \ - ../../ghttpCommon.o \ - ../../ghttpPost.o \ - crt0.o\ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../ps2common/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2cw/ghttpps2cw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2cw/ghttpps2cw.mcp deleted file mode 100644 index a6078d64be6..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2cw/ghttpps2cw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.dsp deleted file mode 100644 index d72929bc7cc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.dsp +++ /dev/null @@ -1,444 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ghttpps2prodg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=ghttpps2prodg - Win32 PS2 EE Debug Insock -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ghttpps2prodg.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ghttpps2prodg.mak" CFG="ghttpps2prodg - Win32 PS2 EE Debug Insock" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ghttpps2prodg - Win32 PS2 EE Debug EENet" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpps2prodg - Win32 PS2 EE Debug Insock" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpps2prodg - Win32 PS2 EE Debug SNSystems" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpps2prodg - Win32 PS2 EE Release EENet" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpps2prodg - Win32 PS2 EE Release Insock" (based on "Win32 (x86) Console Application") -!MESSAGE "ghttpps2prodg - Win32 PS2 EE Release SNSystems" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/ghttp/ghttpc/ghttpps2prodg", JSEDAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ghttpps2prodg - Win32 PS2 EE Debug EENet" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Debug EENet" -# PROP BASE Intermediate_Dir "PS2 EE Debug EENet" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_EENet" -# PROP Intermediate_Dir "Debug_EENet" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Debug/" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "EENET" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"PS2_EE_Debug\ghttpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 ent_smap.a ent_eth.a ent_ppp.a eenetctl.a libeenet.a libscf.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_EENet\ghttpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "ghttpps2prodg - Win32 PS2 EE Debug Insock" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ghttpps2prodg___Win32_PS2_EE_Debug_Insock" -# PROP BASE Intermediate_Dir "ghttpps2prodg___Win32_PS2_EE_Debug_Insock" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_Insock" -# PROP Intermediate_Dir "Debug_Insock" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "EENET" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "INSOCK" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 ent_smap.a ent_eth.a ent_ppp.a eenetctl.a libeenet.a libscf.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_EENet\ghttpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_Insock\ghttpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "ghttpps2prodg - Win32 PS2 EE Debug SNSystems" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Debug SNSystems" -# PROP BASE Intermediate_Dir "PS2 EE Debug SNSystems" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_SNSystems" -# PROP Intermediate_Dir "Debug_SNSystems" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Debug/" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_SYSTEMS" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"PS2_EE_Debug\ghttpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libcdvd.a sneetcp.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_SNSystems\ghttpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "ghttpps2prodg - Win32 PS2 EE Release EENet" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Release EENet" -# PROP BASE Intermediate_Dir "PS2 EE Release EENet" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_EENet" -# PROP Intermediate_Dir "Release_EENet" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Release/" /FD /c -# ADD CPP /nologo /W4 /WX /O2 /I "c:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "EENET" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"PS2_EE_Release\ghttpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 ent_smap.a ent_eth.a ent_ppp.a eenetctl.a libeenet.a libscf.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_EENet\ghttpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "ghttpps2prodg - Win32 PS2 EE Release Insock" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "ghttpps2prodg___Win32_PS2_EE_Release_Insock" -# PROP BASE Intermediate_Dir "ghttpps2prodg___Win32_PS2_EE_Release_Insock" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_Insock" -# PROP Intermediate_Dir "Release_Insock" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "SN_SYSTEMS" /FD /c -# ADD CPP /nologo /W4 /WX /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "INSOCK" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libcdvd.a sneetcp.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_SNSystems\ghttpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /machine:IX86 /out:"Release_Insock\ghttpps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "ghttpps2prodg - Win32 PS2 EE Release SNSystems" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "PS2 EE Release SNSystems" -# PROP BASE Intermediate_Dir "PS2 EE Release SNSystems" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_SNSystems" -# PROP Intermediate_Dir "Release_SNSystems" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Release/" /FD /c -# ADD CPP /nologo /W4 /WX /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "SN_SYSTEMS" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"PS2_EE_Release\ghttpps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libcdvd.a sneetcp.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_SNSystems\ghttpps2prodg.elf" /D:SN_TARGET_PS2 - -!ENDIF - -# Begin Target - -# Name "ghttpps2prodg - Win32 PS2 EE Debug EENet" -# Name "ghttpps2prodg - Win32 PS2 EE Debug Insock" -# Name "ghttpps2prodg - Win32 PS2 EE Debug SNSystems" -# Name "ghttpps2prodg - Win32 PS2 EE Release EENet" -# Name "ghttpps2prodg - Win32 PS2 EE Release Insock" -# Name "ghttpps2prodg - Win32 PS2 EE Release SNSystems" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\ghttpc.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\common\ps2\prodg\PS2_in_VC.h -# End Source File -# End Group -# Begin Group "HttpSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\ghttp.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpASCII.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpCallbacks.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpCallbacks.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpCommon.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpConnection.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpConnection.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpEncryption.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpEncryption.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpMain.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpMain.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpPost.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpPost.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpProcess.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttpProcess.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsCrypt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsCrypt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsLargeInt.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsLargeInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsRC4.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsRC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsSHA1.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsSHA1.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsSSL.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsSSL.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsXML.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsXML.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\md5c.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\ps2\ps2common.c -# End Source File -# End Group -# Begin Source File - -SOURCE=c:\usr\local\sce\ee\lib\app.cmd -# End Source File -# Begin Source File - -SOURCE=c:\usr\local\sce\ee\lib\crt0.s -# End Source File -# Begin Source File - -SOURCE=..\..\..\ps2common\prodg\ps2.lk -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.dsw deleted file mode 100644 index 01bdfc75283..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.dsw +++ /dev/null @@ -1,37 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "ghttpps2prodg"=.\ghttpps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp/ghttpc/ghttpps2prodg", JSEDAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/ghttp/ghttpc/ghttpps2prodg", JSEDAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.sln deleted file mode 100644 index 07701f7afe4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.sln +++ /dev/null @@ -1,43 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghttpps2prodg", "ghttpps2prodg.vcproj", "{2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfsapp1:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = ghttpps2prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS2 EENET Debug|Win32 = PS2 EENET Debug|Win32 - PS2 EENET Release|Win32 = PS2 EENET Release|Win32 - PS2 INET Debug|Win32 = PS2 INET Debug|Win32 - PS2 INET Release|Win32 = PS2 INET Release|Win32 - PS2 SN Systems Debug|Win32 = PS2 SN Systems Debug|Win32 - PS2 SN Systems Release|Win32 = PS2 SN Systems Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 EENET Debug|Win32.ActiveCfg = PS2 EENET Debug|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 EENET Debug|Win32.Build.0 = PS2 EENET Debug|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 EENET Release|Win32.ActiveCfg = PS2 EENET Release|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 EENET Release|Win32.Build.0 = PS2 EENET Release|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 INET Debug|Win32.ActiveCfg = PS2 INET Debug|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 INET Debug|Win32.Build.0 = PS2 INET Debug|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 INET Release|Win32.ActiveCfg = PS2 INET Release|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 INET Release|Win32.Build.0 = PS2 INET Release|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 SN Systems Debug|Win32.ActiveCfg = PS2 SN Systems Debug|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 SN Systems Debug|Win32.Build.0 = PS2 SN Systems Debug|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 SN Systems Release|Win32.ActiveCfg = PS2 SN Systems Release|Win32 - {2ED3F6B0-2F00-40B7-ADDF-5F489BD0300D}.PS2 SN Systems Release|Win32.Build.0 = PS2 SN Systems Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.vcproj deleted file mode 100644 index bea43f672a7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps2prodg/ghttpps2prodg.vcproj +++ /dev/null @@ -1,744 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3/Makefile deleted file mode 100644 index d0934737f4a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -#GameSpy.net PS3 Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CFLAGS = -DGSI_COMMON_DEBUG -DUNIQUEID - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -SDK_LIBS = - - -#Name of the SDK sample -TARGET = ghttpc - -#All the object files needed for this SDK -OBJS = ../../../common/ps3/ps3common.o \ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o \ - ../../../common/gsPlatformThread.o \ - ../../../common/gsPlatformUtil.o \ - ../../../common/gsAvailable.o \ - ../../../common/gsDebug.o \ - ../../../common/gsMemory.o \ - ../../../common/gsStringUtil.o \ - ../../../darray.o \ - ../../ghttpBuffer.o \ - ../../ghttpCallbacks.o \ - ../../ghttpConnection.o \ - ../../ghttpMain.o \ - ../../ghttpProcess.o \ - ../../ghttpCommon.o \ - ../../ghttpPost.o \ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/ps3/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3prodg/ghttpps3prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3prodg/ghttpps3prodg.sln deleted file mode 100644 index 83f27d78558..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3prodg/ghttpps3prodg.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghttpps3prodg", "ghttpps3prodg.vcproj", "{A089D0F3-E861-4309-89A4-A47A61401A3D}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = ghttpps3prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS3 Debug|Win32 = PS3 Debug|Win32 - PS3 Release|Win32 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.ActiveCfg = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.Build.0 = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.ActiveCfg = PS3 Release|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.Build.0 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3prodg/ghttpps3prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3prodg/ghttpps3prodg.vcproj deleted file mode 100644 index 5054885652f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpps3prodg/ghttpps3prodg.vcproj +++ /dev/null @@ -1,475 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttppspprodg/ghttppspprodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttppspprodg/ghttppspprodg.sln deleted file mode 100644 index e2c2d87afba..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttppspprodg/ghttppspprodg.sln +++ /dev/null @@ -1,34 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghttppspprodg", "ghttppspprodg.vcproj", "{14A2AE0A-2925-4605-924B-8558FBB37F2F}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = ghttppspprodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PSP Debug Opt|Win32 = PSP Debug Opt|Win32 - PSP Debug|Win32 = PSP Debug|Win32 - PSP Release|Win32 = PSP Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {14A2AE0A-2925-4605-924B-8558FBB37F2F}.PSP Debug Opt|Win32.ActiveCfg = PSP Debug Opt|Win32 - {14A2AE0A-2925-4605-924B-8558FBB37F2F}.PSP Debug Opt|Win32.Build.0 = PSP Debug Opt|Win32 - {14A2AE0A-2925-4605-924B-8558FBB37F2F}.PSP Debug|Win32.ActiveCfg = PSP Debug|Win32 - {14A2AE0A-2925-4605-924B-8558FBB37F2F}.PSP Debug|Win32.Build.0 = PSP Debug|Win32 - {14A2AE0A-2925-4605-924B-8558FBB37F2F}.PSP Release|Win32.ActiveCfg = PSP Release|Win32 - {14A2AE0A-2925-4605-924B-8558FBB37F2F}.PSP Release|Win32.Build.0 = PSP Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttppspprodg/ghttppspprodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttppspprodg/ghttppspprodg.vcproj deleted file mode 100644 index bfb4f2f7769..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttppspprodg/ghttppspprodg.vcproj +++ /dev/null @@ -1,522 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttprevolutioncw/ghttprevolutioncw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttprevolutioncw/ghttprevolutioncw.mcp deleted file mode 100644 index a495034d17d..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttprevolutioncw/ghttprevolutioncw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpx360/ghttpx360.sln b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpx360/ghttpx360.sln deleted file mode 100644 index 8bc12353076..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpx360/ghttpx360.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghttpx360", "ghttpx360.vcproj", "{71B578A2-4F9A-4DD0-A406-74F11FDAF91B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Xbox 360 = Debug|Xbox 360 - Profile_FastCap|Xbox 360 = Profile_FastCap|Xbox 360 - Profile|Xbox 360 = Profile|Xbox 360 - Release_LTCG|Xbox 360 = Release_LTCG|Xbox 360 - Release|Xbox 360 = Release|Xbox 360 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Profile_FastCap|Xbox 360.ActiveCfg = Profile_FastCap|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Profile_FastCap|Xbox 360.Build.0 = Profile_FastCap|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Profile|Xbox 360.ActiveCfg = Profile|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Profile|Xbox 360.Build.0 = Profile|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Release_LTCG|Xbox 360.ActiveCfg = Release_LTCG|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Release_LTCG|Xbox 360.Build.0 = Release_LTCG|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 - {71B578A2-4F9A-4DD0-A406-74F11FDAF91B}.Release|Xbox 360.Build.0 = Release|Xbox 360 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpx360/ghttpx360.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpx360/ghttpx360.vcproj deleted file mode 100644 index d026d614cda..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpc/ghttpx360/ghttpx360.vcproj +++ /dev/null @@ -1,632 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ReadMe.txt b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ReadMe.txt deleted file mode 100644 index 68dd40ecef6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ReadMe.txt +++ /dev/null @@ -1,88 +0,0 @@ -======================================================================== - MICROSOFT FOUNDATION CLASS LIBRARY : ghttpmfc -======================================================================== - - -AppWizard has created this ghttpmfc application for you. This application -not only demonstrates the basics of using the Microsoft Foundation classes -but is also a starting point for writing your application. - -This file contains a summary of what you will find in each of the files that -make up your ghttpmfc application. - -ghttpmfc.dsp - This file (the project file) contains information at the project level and - is used to build a single project or subproject. Other users can share the - project (.dsp) file, but they should export the makefiles locally. - -ghttpmfc.h - This is the main header file for the application. It includes other - project specific headers (including Resource.h) and declares the - CGhttpmfcApp application class. - -ghttpmfc.cpp - This is the main application source file that contains the application - class CGhttpmfcApp. - -ghttpmfc.rc - This is a listing of all of the Microsoft Windows resources that the - program uses. It includes the icons, bitmaps, and cursors that are stored - in the RES subdirectory. This file can be directly edited in Microsoft - Visual C++. - -ghttpmfc.clw - This file contains information used by ClassWizard to edit existing - classes or add new classes. ClassWizard also uses this file to store - information needed to create and edit message maps and dialog data - maps and to create prototype member functions. - -res\ghttpmfc.ico - This is an icon file, which is used as the application's icon. This - icon is included by the main resource file ghttpmfc.rc. - -res\ghttpmfc.rc2 - This file contains resources that are not edited by Microsoft - Visual C++. You should place all resources not editable by - the resource editor in this file. - - - - -///////////////////////////////////////////////////////////////////////////// - -AppWizard creates one dialog class: - -ghttpmfcDlg.h, ghttpmfcDlg.cpp - the dialog - These files contain your CGhttpmfcDlg class. This class defines - the behavior of your application's main dialog. The dialog's - template is in ghttpmfc.rc, which can be edited in Microsoft - Visual C++. - - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named ghttpmfc.pch and a precompiled types file named StdAfx.obj. - -Resource.h - This is the standard header file, which defines new resource IDs. - Microsoft Visual C++ reads and updates this file. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -If your application uses MFC in a shared DLL, and your application is -in a language other than the operating system's current language, you -will need to copy the corresponding localized resources MFC42XXX.DLL -from the Microsoft Visual C++ CD-ROM onto the system or system32 directory, -and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation. -For example, MFC42DEU.DLL contains resources translated to German.) If you -don't do this, some of the UI elements of your application will remain in the -language of the operating system. - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/StdAfx.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/StdAfx.cpp deleted file mode 100644 index 652cfa41d1a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// ghttpmfc.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/StdAfx.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/StdAfx.h deleted file mode 100644 index 445888962f4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/StdAfx.h +++ /dev/null @@ -1,27 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__5ED40F92_A7FA_40E2_B911_E0DA573FB72A__INCLUDED_) -#define AFX_STDAFX_H__5ED40F92_A7FA_40E2_B911_E0DA573FB72A__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include "../ghttp.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__5ED40F92_A7FA_40E2_B911_E0DA573FB72A__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.cpp deleted file mode 100644 index bd40f5fba0b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// ghttpmfc.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "ghttpmfc.h" -#include "ghttpmfcDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcApp - -BEGIN_MESSAGE_MAP(CGhttpmfcApp, CWinApp) - //{{AFX_MSG_MAP(CGhttpmfcApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcApp construction - -CGhttpmfcApp::CGhttpmfcApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CGhttpmfcApp object - -CGhttpmfcApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcApp initialization - -BOOL CGhttpmfcApp::InitInstance() -{ - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. -/* -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif -*/ - CGhttpmfcDlg dlg; - m_pMainWnd = &dlg; - int nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: Place code here to handle when the dialog is - // dismissed with OK - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.dsp deleted file mode 100644 index e249c78a30b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.dsp +++ /dev/null @@ -1,377 +0,0 @@ -# Microsoft Developer Studio Project File - Name="ghttpmfc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=ghttpmfc - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "ghttpmfc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "ghttpmfc.mak" CFG="ghttpmfc - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "ghttpmfc - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "ghttpmfc - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/ghttp/ghttpmfc", PUZAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "ghttpmfc - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 wsock32.lib /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "ghttpmfc - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "HTTP_LOG" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "ghttpmfc - Win32 Release" -# Name "ghttpmfc - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\ghttpmfc.cpp -# End Source File -# Begin Source File - -SOURCE=.\ghttpmfc.rc -# End Source File -# Begin Source File - -SOURCE=.\ghttpmfcDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ghttpmfc.h -# End Source File -# Begin Source File - -SOURCE=.\ghttpmfcDlg.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\ghttpmfc.ico -# End Source File -# Begin Source File - -SOURCE=.\res\ghttpmfc.rc2 -# End Source File -# End Group -# Begin Group "HttpSDK" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\ghttp.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpBuffer.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpCallbacks.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpCallbacks.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpCommon.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpCommon.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpConnection.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpConnection.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpEncryption.c -# End Source File -# Begin Source File - -SOURCE=..\ghttpEncryption.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpMain.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpMain.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpPost.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpPost.h -# End Source File -# Begin Source File - -SOURCE=..\ghttpProcess.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\ghttpProcess.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "c,h" -# Begin Source File - -SOURCE=..\..\darray.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.h deleted file mode 100644 index f2ebcbaea8a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.h +++ /dev/null @@ -1,49 +0,0 @@ -// ghttpmfc.h : main header file for the GHTTPMFC application -// - -#if !defined(AFX_GHTTPMFC_H__30518F92_6CEC_4512_AC74_EF31A5DE2D1C__INCLUDED_) -#define AFX_GHTTPMFC_H__30518F92_6CEC_4512_AC74_EF31A5DE2D1C__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcApp: -// See ghttpmfc.cpp for the implementation of this class -// - -class CGhttpmfcApp : public CWinApp -{ -public: - CGhttpmfcApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CGhttpmfcApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CGhttpmfcApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_GHTTPMFC_H__30518F92_6CEC_4512_AC74_EF31A5DE2D1C__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.rc b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.rc deleted file mode 100644 index e636e8070ea..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc.rc +++ /dev/null @@ -1,240 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\ghttpmfc.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\ghttpmfc.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_GHTTPMFC_DIALOG DIALOGEX 0, 0, 320, 262 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "ghttp mfc test" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Get File",IDC_GET_FILE,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,7,78,40,10 - CONTROL "Save File",IDC_SAVE_FILE,"Button",BS_AUTORADIOBUTTON,7, - 92,45,10 - CONTROL "Stream File",IDC_STREAM_FILE,"Button", - BS_AUTORADIOBUTTON,7,106,51,10 - CONTROL "Head File",IDC_HEAD_FILE,"Button",BS_AUTORADIOBUTTON,7, - 120,46,10 - CONTROL "Post",IDC_POST,"Button",BS_AUTORADIOBUTTON,7,134,30,10 - CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | - WS_BORDER | WS_GROUP,8,154,230,8 - CONTROL "Host Lookup",IDC_HOST_LOOKUP,"Button", - BS_AUTORADIOBUTTON | WS_GROUP,240,154,57,10 - CONTROL "Connecting",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,240, - 167,52,10 - CONTROL "Sending Request",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON, - 240,180,71,10 - CONTROL "Posting",IDC_RADIO6,"Button",BS_AUTORADIOBUTTON,240,193, - 39,10 - CONTROL "Waiting",IDC_RADIO5,"Button",BS_AUTORADIOBUTTON,240,206, - 40,10 - CONTROL "Receiving Status",IDC_RADIO7,"Button", - BS_AUTORADIOBUTTON,240,219,70,10 - CONTROL "Receiving Headers",IDC_RADIO8,"Button", - BS_AUTORADIOBUTTON,240,232,77,10 - CONTROL "Receiving File",IDC_RADIO9,"Button",BS_AUTORADIOBUTTON, - 240,245,61,10 - DEFPUSHBUTTON "Quit",IDOK,260,7,50,14,WS_GROUP - EDITTEXT IDC_URL,32,7,214,12,ES_AUTOHSCROLL - EDITTEXT IDC_HEADERS,44,22,202,22,ES_MULTILINE | ES_AUTOHSCROLL - CONTROL "Blocking",IDC_BLOCKING,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,8,64,43,10 - CONTROL "Progress Callback",IDC_PROGRESS_CALLBACK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,53,64,73,10 - CONTROL "Completed Callback",IDC_COMPLETED_CALLBACK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,128,64,79,10 - CONTROL "Throttle",IDC_THROTTLE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,209,64,40,10 - CONTROL "User Buffer",IDC_USER_BUFFER,"Button",BS_AUTOCHECKBOX | - WS_GROUP | WS_TABSTOP,68,78,51,10 - EDITTEXT IDC_BUFFER_SIZE,151,77,94,12,ES_AUTOHSCROLL - EDITTEXT IDC_SAVE_AS,104,92,94,12,ES_AUTOHSCROLL - DEFPUSHBUTTON "Start",IDC_START,260,26,50,14 - DEFPUSHBUTTON "Cancel",IDC_CANCEL,260,45,50,14 - EDITTEXT IDC_FILE,8,218,230,36,ES_MULTILINE | ES_AUTOHSCROLL | - ES_READONLY | WS_VSCROLL - LTEXT "URL:",IDC_STATIC,9,8,18,8 - LTEXT "Headers:",IDC_STATIC,9,23,30,8 - LTEXT "Size:",IDC_STATIC,129,79,16,8 - LTEXT "Save as:",IDC_STATIC,70,93,29,8 - LTEXT "X/X",IDC_SO_FAR,8,144,225,8 - EDITTEXT IDC_HEADERS_RECV,8,178,230,37,ES_MULTILINE | - ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL - EDITTEXT IDC_STATUS,8,163,230,12,ES_MULTILINE | ES_AUTOHSCROLL | - ES_READONLY - DEFPUSHBUTTON "Think",IDC_THINK,258,108,50,14 - CONTROL "Step Think",IDC_STEP_THINK,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,258,93,51,10 - CONTROL "Post File",IDC_POST_FILE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,68,134,43,10 - LTEXT "Objects:",IDC_STATIC,118,135,27,8 - LTEXT "X/X",IDC_POST_OBJECTS,149,135,24,8 - LTEXT "Bytes:",IDC_STATIC,182,135,20,8 - LTEXT "X/X",IDC_POST_BYTES,209,135,99,8 - EDITTEXT IDC_PROXY,30,48,112,12,ES_AUTOHSCROLL - LTEXT "Proxy:",IDC_STATIC,7,49,20,8 - DEFPUSHBUTTON "IE Settings",IDC_IE_SETTINGS,196,48,50,12 - DEFPUSHBUTTON "Set Proxy",IDC_SET_PROXY,144,48,50,12 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "ghttpmfc MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "ghttpmfc\0" - VALUE "LegalCopyright", "Copyright (C) 2000\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "ghttpmfc.EXE\0" - VALUE "ProductName", "ghttpmfc Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_GHTTPMFC_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 313 - TOPMARGIN, 7 - BOTTOMMARGIN, 255 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\ghttpmfc.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfcDlg.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfcDlg.cpp deleted file mode 100644 index ce8990922b7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfcDlg.cpp +++ /dev/null @@ -1,577 +0,0 @@ -// ghttpmfcDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "ghttpmfc.h" -#include "ghttpmfcDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -#include "InetReg.h" - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcDlg dialog - -CGhttpmfcDlg::CGhttpmfcDlg(CWnd* pParent /*=NULL*/) - : CDialog(CGhttpmfcDlg::IDD, pParent) -{ - char buffer[512]; - int rcode; - FILE * fp; - fp = fopen("url.cache", "rt"); - if(fp) - { - rcode = fread(buffer, 1, 511, fp); - buffer[rcode] = '\0'; - m_url = buffer; - fclose(fp); - } - else - m_url = _T("http://planetquake.com/excessive"); - - fp = fopen("saveas.cache", "rt"); - if(fp) - { - rcode = fread(buffer, 1, 511, fp); - buffer[rcode] = '\0'; - m_saveAs = buffer; - fclose(fp); - } - else - m_saveAs = _T("file.html"); - - //{{AFX_DATA_INIT(CGhttpmfcDlg) - m_blocking = FALSE; - m_completedCallback = TRUE; - m_headers = _T(""); - m_progressCallback = TRUE; - m_bufferSize = 0; - m_userBuffer = FALSE; - m_type = 0; - m_file = _T(""); - m_soFar = _T(""); - m_state = -1; - m_throttle = FALSE; - m_headersRecv = _T(""); - m_status = _T(""); - m_stepThink = FALSE; - m_postFile = FALSE; - m_postObjects = _T(""); - m_postBytes = _T(""); - m_proxy = _T(""); - //}}AFX_DATA_INIT - // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CGhttpmfcDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CGhttpmfcDlg) - DDX_Control(pDX, IDC_PROGRESS, m_progress); - DDX_Check(pDX, IDC_BLOCKING, m_blocking); - DDX_Check(pDX, IDC_COMPLETED_CALLBACK, m_completedCallback); - DDX_Text(pDX, IDC_HEADERS, m_headers); - DDX_Check(pDX, IDC_PROGRESS_CALLBACK, m_progressCallback); - DDX_Text(pDX, IDC_URL, m_url); - DDX_Text(pDX, IDC_BUFFER_SIZE, m_bufferSize); - DDX_Text(pDX, IDC_SAVE_AS, m_saveAs); - DDX_Check(pDX, IDC_USER_BUFFER, m_userBuffer); - DDX_Radio(pDX, IDC_GET_FILE, m_type); - DDX_Text(pDX, IDC_FILE, m_file); - DDX_Text(pDX, IDC_SO_FAR, m_soFar); - DDX_Radio(pDX, IDC_HOST_LOOKUP, m_state); - DDX_Check(pDX, IDC_THROTTLE, m_throttle); - DDX_Text(pDX, IDC_HEADERS_RECV, m_headersRecv); - DDX_Text(pDX, IDC_STATUS, m_status); - DDX_Check(pDX, IDC_STEP_THINK, m_stepThink); - DDX_Check(pDX, IDC_POST_FILE, m_postFile); - DDX_Text(pDX, IDC_POST_OBJECTS, m_postObjects); - DDX_Text(pDX, IDC_POST_BYTES, m_postBytes); - DDX_Text(pDX, IDC_PROXY, m_proxy); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CGhttpmfcDlg, CDialog) - //{{AFX_MSG_MAP(CGhttpmfcDlg) - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDC_START, OnStart) - ON_BN_CLICKED(IDC_CANCEL, OnCancel_) - ON_WM_TIMER() - ON_WM_DESTROY() - ON_BN_CLICKED(IDC_THROTTLE, OnThrottle) - ON_BN_CLICKED(IDC_THINK, OnThink) - ON_BN_CLICKED(IDC_SET_PROXY, OnSetProxy) - ON_BN_CLICKED(IDC_IE_SETTINGS, OnIeSettings) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcDlg message handlers - -BOOL CGhttpmfcDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // Set the icon for this dialog. The framework does this automatically - // when the application's main window is not a dialog - SetIcon(m_hIcon, TRUE); // Set big icon - SetIcon(m_hIcon, FALSE); // Set small icon - - m_request = -1; - m_memFile = NULL; - SetTimer(50, 50, NULL); - - return TRUE; // return TRUE unless you set the focus to a control -} - -// If you add a minimize button to your dialog, you will need the code below -// to draw the icon. For MFC applications using the document/view model, -// this is automatically done for you by the framework. - -void CGhttpmfcDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // device context for painting - - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); - - // Center icon in client rectangle - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // Draw the icon - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -// The system calls this to obtain the cursor to display while the user drags -// the minimized window. -HCURSOR CGhttpmfcDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - -static GHTTPBool CompletedCallback -( - GHTTPRequest request, - GHTTPResult result, - char * buffer, - GHTTPByteCount bufferLen, - void * param -) -{ - CGhttpmfcDlg * dlg = (CGhttpmfcDlg *)param; - - static char * resultStrings[] = - { - "GHTTPSuccess", - "GHTTPOutOfMemory", - "GHTTPBufferOverflow", - "GHTTPParseURLFailed", - "GHTTPHostLookupFailed", - "GHTTPSocketFailed", - "GHTTPConnectFailed", - "GHTTPBadResponse", - "GHTTPRequestRejected", - "GHTTPUnauthorized", - "GHTTPForbidden", - "GHTTPFileNotFound", - "GHTTPServerError", - "GHTTPFileWriteFailed", - "GHTTPFileReadFailed", - "GHTTPFileIncomplete", - "GHTTPFileToBig", - "GHTTPEncryptionError", - "GHTTPRequestCancelled" - }; - - CString msg; - - if( GHTTPSuccess == result ) - { - msg = "File received successfully"; - } - else - { - msg.Format("Error: (%d) ", result); - if( result < 0 || result >= sizeof(resultStrings)/sizeof(resultStrings[0]) ) - msg += "Unknown - local error table may be out of date"; - else - msg += resultStrings[(int)result]; - } - - dlg->MessageBox(msg); - - dlg->m_request = -1; - - return GHTTPTrue; - - GSI_UNUSED(bufferLen); - GSI_UNUSED(buffer); - GSI_UNUSED(request); -} - -void ProgressCallback -( - GHTTPRequest request, - GHTTPState state, - const char * buffer, - GHTTPByteCount bufferLen, - GHTTPByteCount bytesReceived, - GHTTPByteCount totalSize, - void * param -) -{ - CGhttpmfcDlg * dlg = (CGhttpmfcDlg *)param; - - dlg->UpdateData(); - - dlg->m_state = state; - - //added new states for asynch DNS lookup - set all to HOST_LOOKUP for radio buttons - if (dlg->m_state == GHTTPSocketInit || dlg->m_state == GHTTPHostLookup || dlg->m_state == GHTTPLookupPending) - dlg->m_state = 0; - - if(state == GHTTPReceivingFile) - { - if(totalSize == -1) - dlg->m_soFar.Format("%d bytes", bytesReceived); - else - { - int percent = (int)((bytesReceived * 100) / totalSize); - dlg->m_soFar.Format("%d%% (%d / %d bytes)", percent, bytesReceived, totalSize); - dlg->m_progress.SetPos(percent); - } - if((dlg->m_type == 0) || (dlg->m_type == 4)) - dlg->m_file = buffer; - } - - dlg->UpdateData(FALSE); - - GSI_UNUSED(bufferLen); - GSI_UNUSED(request); -} - -void PostCallback -( - GHTTPRequest request, - int bytesPosted, - int totalBytes, - int objectsPosted, - int totalObjects, - void * param -) -{ - CGhttpmfcDlg * dlg = (CGhttpmfcDlg *)param; - - dlg->UpdateData(); - - int percent = ((bytesPosted * 100) / totalBytes); - dlg->m_postObjects.Format("%d / %d", objectsPosted, totalObjects); - dlg->m_postBytes.Format("%d%% (%d / %d)", percent, bytesPosted, totalBytes); - - dlg->UpdateData(FALSE); - - GSI_UNUSED(request); -} - -void CGhttpmfcDlg::OnStart() -{ - UpdateData(); - - if(m_type == 0) - { - m_request = ghttpGetEx( - m_url, - m_headers, - NULL, - 0, - NULL, - (GHTTPBool)m_throttle, - (GHTTPBool)m_blocking, - ProgressCallback, - CompletedCallback, - this); - } - else if(m_type == 1) - { - m_request = ghttpSaveEx( - m_url, - m_saveAs, - m_headers, - NULL, - (GHTTPBool)m_throttle, - (GHTTPBool)m_blocking, - ProgressCallback, - CompletedCallback, - this); - } - else if(m_type == 2) - { - m_request = ghttpStreamEx( - m_url, - m_headers, - NULL, - (GHTTPBool)m_throttle, - (GHTTPBool)m_blocking, - ProgressCallback, - CompletedCallback, - this); - } - else if(m_type == 3) - { - m_request = ghttpHeadEx( - m_url, - m_headers, - (GHTTPBool)m_throttle, - (GHTTPBool)m_blocking, - ProgressCallback, - CompletedCallback, - this); - } - else if(m_type == 4) - { - GHTTPPost post; - post = ghttpNewPost(); - ghttpPostSetCallback(post, PostCallback, this); - ghttpPostAddString(post, "test1", "bag"); - ghttpPostAddString(post, "test2", "test%test!@#) $(%^(*&test"); - if(m_postFile) - { - static int memFileSize = 100000; - if(!m_memFile) - m_memFile = (char *)malloc(memFileSize); - memset(m_memFile, 0, memFileSize); - sprintf(m_memFile, "steve"); - ghttpPostAddFileFromMemory(post, "memfile", m_memFile, memFileSize, "steve.txt", NULL); - ghttpPostAddFileFromDisk(post, "diskfile", "../ghttpMain.c", "main.c", "text/html"); - } - -#if 1 - m_request = ghttpGetEx( - m_url, - m_headers, - NULL, - 0, - post, - (GHTTPBool)m_throttle, - (GHTTPBool)m_blocking, - ProgressCallback, - CompletedCallback, - this); -#else - m_request = ghttpPostEx( - m_url, - m_headers, - post, - (GHTTPBool)m_throttle, - (GHTTPBool)m_blocking, - ProgressCallback, - CompletedCallback, - this); -#endif - } - - if(m_request == -1) - MessageBox("Unable to start request"); - else if(m_url.Left(8).Compare("https://") == 0) - ghttpSetRequestEncryptionEngine(m_request, GHTTPEncryptionEngine_GameSpy); - - m_state = 0; - m_soFar = ""; - m_file = ""; - m_postObjects = ""; - m_postBytes = ""; - - UpdateData(FALSE); -} - -void CGhttpmfcDlg::OnCancel_() -{ - if(m_request >= 0) - ghttpCancelRequest(m_request); -} - -void CGhttpmfcDlg::OnTimer(UINT nIDEvent) -{ - if(nIDEvent == 50) - { - UpdateData(); - - if(!m_stepThink) - ghttpThink(); - - if(m_request >= 0) - { - const char * statusString; - int statusCode; - statusString = ghttpGetResponseStatus(m_request, &statusCode); - if(statusString) - m_status.Format("%d: %s", statusCode, statusString); - else - m_status.Empty(); - - const char * headers; - headers = ghttpGetHeaders(m_request); - if(headers) - m_headersRecv = headers; - else - m_headersRecv.Empty(); - - m_state = (int)ghttpGetState(m_request); - //added new states for asynch DNS lookup - set all to HOST_LOOKUP for radio buttons - if (m_state == GHTTPSocketInit || m_state == GHTTPHostLookup || m_state == GHTTPLookupPending) - m_state = 0; - UpdateData(FALSE); - } - } - - CDialog::OnTimer(nIDEvent); -} - -void CGhttpmfcDlg::OnDestroy() -{ - CDialog::OnDestroy(); - - FILE * fp; - fp = fopen("url.cache", "wt"); - if(fp) - { - fprintf(fp, "%s", m_url); - fclose(fp); - } - - fp = fopen("saveas.cache", "wt"); - if(fp) - { - fprintf(fp, "%s", m_saveAs); - fclose(fp); - } - - ghttpCleanup(); - - if(m_memFile) - free(m_memFile); - m_memFile = NULL; -} - -void CGhttpmfcDlg::OnThrottle() -{ - UpdateData(); - - if(m_request >= 0) - ghttpSetThrottle(m_request, (GHTTPBool)m_throttle); -} - -void CGhttpmfcDlg::OnThink() -{ - if(m_request >= 0) - ghttpThink(); -} - -void CGhttpmfcDlg::OnSetProxy() -{ - UpdateData(); - - ghttpSetProxy(m_proxy); -} - -// Copied from JED's ProxyInfo. Edited down for this app's purposes. -void CGhttpmfcDlg::OnIeSettings() -{ - HKEY key; - LONG result; - DWORD type; - DWORD data; - DWORD len; - CString str; - int nStart; - int nEnd; - - UpdateData(); - - // Open the IE settings in the registry. - //////////////////////////////////////// - result = RegOpenKeyEx(HKEY_CURRENT_USER, REGSTR_PATH_INTERNETSETTINGS, 0, KEY_READ, &key); - if(SUCCEEDED(result)) - { - // Is the proxy enabled? - //////////////////////// - len = sizeof(DWORD); - data = 0; - result = RegQueryValueEx(key, REGSTR_VAL_PROXYENABLE, 0, &type, (LPBYTE)&data, &len); - if(SUCCEEDED(result) && data) - { - //---------------------------------------------------------------------- - // - // The list of proxy servers to use - // - len = 0; - result = RegQueryValueEx(key, REGSTR_VAL_PROXYSERVER, 0, &type, NULL, &len); - result = RegQueryValueEx(key, REGSTR_VAL_PROXYSERVER, 0, &type, (LPBYTE)str.GetBuffer(len), &len); - str.ReleaseBuffer(); - if(SUCCEEDED(result) && (len > 0)) - { - // Find the http proxy. - // - // Use the same proxy for all protocols: "single_proxy_address:13" - // read as: server:port - // individualized protocols: "ftp=ftp_address;gopher=gopher_address:4;http=http_address:1;https=secure_address:2;socks=socks_address:5" - // read as: protocol=server:port;protocol=server:port - // If only protocol is to use proxy: "socks=socks_address:5" - // Apparently, ports are optional - I would presume that you should revert to the default port when it is missing - // - // First search for "http=[:port]". - /////////////////////////////////////////// - nStart = str.Find("http="); - if(nStart != -1) - { - nStart += 5; - nEnd = str.Find(';', nStart); - if(nEnd == -1) - nEnd = str.GetLength(); - } - else if(str.Find('=') == -1) - { - nStart = 0; - nEnd = str.GetLength(); - } - else - { - nStart = -1; - nEnd = 0; //won't be used; need to initialize to prevent compiler warning - } - - if((nStart != -1) && (nStart != nEnd)) - str = str.Mid(nStart, nEnd - nStart); - else - str = ""; - } - } - - // Cleanup. - /////////// - RegCloseKey(key); - } - - m_proxy = str; - - UpdateData(FALSE); - - OnSetProxy(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfcDlg.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfcDlg.h deleted file mode 100644 index 11681d5df84..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfcDlg.h +++ /dev/null @@ -1,79 +0,0 @@ -// ghttpmfcDlg.h : header file -// - -#if !defined(AFX_GHTTPMFCDLG_H__14B35CAF_3960_4669_972D_59B741AA032C__INCLUDED_) -#define AFX_GHTTPMFCDLG_H__14B35CAF_3960_4669_972D_59B741AA032C__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -///////////////////////////////////////////////////////////////////////////// -// CGhttpmfcDlg dialog - -class CGhttpmfcDlg : public CDialog -{ -// Construction -public: - CGhttpmfcDlg(CWnd* pParent = NULL); // standard constructor - -// Dialog Data - //{{AFX_DATA(CGhttpmfcDlg) - enum { IDD = IDD_GHTTPMFC_DIALOG }; - CProgressCtrl m_progress; - BOOL m_blocking; - BOOL m_completedCallback; - CString m_headers; - BOOL m_progressCallback; - CString m_url; - int m_bufferSize; - CString m_saveAs; - BOOL m_userBuffer; - int m_type; - CString m_file; - CString m_soFar; - int m_state; - BOOL m_throttle; - CString m_headersRecv; - CString m_status; - BOOL m_stepThink; - BOOL m_postFile; - CString m_postObjects; - CString m_postBytes; - CString m_proxy; - //}}AFX_DATA - - GHTTPRequest m_request; - char * m_memFile; - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CGhttpmfcDlg) - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - HICON m_hIcon; - - // Generated message map functions - //{{AFX_MSG(CGhttpmfcDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnStart(); - afx_msg void OnCancel_(); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg void OnDestroy(); - afx_msg void OnThrottle(); - afx_msg void OnThink(); - afx_msg void OnSetProxy(); - afx_msg void OnIeSettings(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_GHTTPMFCDLG_H__14B35CAF_3960_4669_972D_59B741AA032C__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc_vs2005.vcproj deleted file mode 100644 index d65aea56260..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/ghttpmfc_vs2005.vcproj +++ /dev/null @@ -1,712 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/res/ghttpmfc.ico b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/res/ghttpmfc.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/res/ghttpmfc.ico and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/res/ghttpmfc.rc2 b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/res/ghttpmfc.rc2 deleted file mode 100644 index b5533ab2e4f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/res/ghttpmfc.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// GHTTPMFC.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/resource.h b/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/resource.h deleted file mode 100644 index bc4776ba1b5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/ghttp/ghttpmfc/resource.h +++ /dev/null @@ -1,54 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by ghttpmfc.rc -// -#define IDD_GHTTPMFC_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_URL 1000 -#define IDC_HEADERS 1001 -#define IDC_BLOCKING 1002 -#define IDC_PROGRESS_CALLBACK 1003 -#define IDC_COMPLETED_CALLBACK 1004 -#define IDC_USER_BUFFER 1005 -#define IDC_GET_FILE 1006 -#define IDC_SAVE_FILE 1007 -#define IDC_STREAM_FILE 1008 -#define IDC_BUFFER_SIZE 1009 -#define IDC_FILE 1010 -#define IDC_SAVE_AS 1011 -#define IDC_SO_FAR 1012 -#define IDC_HEAD_FILE 1013 -#define IDC_HOST_LOOKUP 1014 -#define IDC_RADIO3 1015 -#define IDC_RADIO4 1016 -#define IDC_RADIO5 1017 -#define IDC_RADIO6 1018 -#define IDC_PROGRESS 1019 -#define IDC_THROTTLE 1020 -#define IDC_RADIO7 1021 -#define IDC_RADIO8 1022 -#define IDC_RADIO9 1023 -#define IDC_HEADERS_RECV 1024 -#define IDC_STATUS 1025 -#define IDC_POST 1026 -#define IDC_STEP_THINK 1027 -#define IDC_POST_FILE 1028 -#define IDC_POST_OBJECTS 1029 -#define IDC_POST_BYTES 1030 -#define IDC_PROXY 1031 -#define IDC_START 1050 -#define IDC_CANCEL 1051 -#define IDC_THINK 1052 -#define IDC_IE_SETTINGS 1053 -#define IDC_SET_PROXY 1054 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1029 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/changelog.txt deleted file mode 100644 index 8d6dd70d914..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/changelog.txt +++ /dev/null @@ -1,144 +0,0 @@ -Changelog for: GameSpy Transport SDK 2 --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -12-12-2007 2.09.00 RMV RELEASE Released to Developer Site -12-07-2007 2.08.03 SAH OTHER Fixed VC6 projects missing dependencies -12-07-2007 2.08.02 SN FIX Added check to sample app for PS3 maximum send size -11-27-2007 2.08.01 SAH CLEANUP Moved extern "c" block below includes to prevent linker errors -08-06-2007 2.08.00 RMV RELEASE Released to Developer Site -07-11-2007 2.07.03 RMV FIX Fixed gt2testc Project files to get rid of Unicode warnings and fixed other compiler warnings -06-07-2007 2.07.02 SN RELEASE Released to Developer Site -04-16-2007 2.07.02 SN CLEANUP Put back a removed calling convention - 2.07.02 SN CLEANUP Added a check to the message handler to pass messages to unrecognized message callback - if a GT2Connection has not been complete. -01-16-2007 2.07.01 DES FEATURE Added X360 support -12-15-2006 2.07.00 MJW RELEASE Released to Developer Site -12-04-2006 2.06.78 SN FIX Added some checks to message size in test application for revolution -12-04-2006 2.06.77 SN FIX Changed the gti2MacToIP and gti2IpToMac functions to be public functions -11-10-2006 2.06.76 JR RELEASE Limited release -10-23-2006 2.06.76 DES RELEASE Limited release -10-05-2006 2.06.76 SAH FIX Updated MacOSX Makefile -09-28-2006 2.06.75 SAH FIX Fixed PS3 project to work with PS3 095.00x SDK; changed included libaries in linker input. -09-07-2006 2.06.74 DES FEATURE Added support for string arrays to gt2Encode - DES FIX Fixed potential to read past the end of a truncated buffer when decoding strings -08-24-2006 2.06.73 SAH FIX Fixed VC7 Project file -08-15-2006 2.06.72 SAH FIX Fixed VDP assertion in gt2main.c (call to gt2Send) -08-04-2006 2.06.71 SAH FIX Changed call in gt2proxy.c from ctime to gsiSecondsToString -08-02-2006 2.06.70 SAH RELEASE Releasing to developer site -07-31-2006 2.06.70 SAH FIX Fixed PS3 project file - added post-build step to create *.SELF for execution -07-25-2006 2.06.69 SAH FIX Fixed NITRO project, include for crt0.o now above others so it add correct file -07-24-2006 2.06.68 SAH FIX Removed #ifdef _PS3 for socket calls (changed platformSocket.h to typecast calls) -07-06-2006 2.06.67 SAH FIX Fixed PSP project file to not explicitly include the PSP linker file -06-30-2006 2.06.66 SAH FIX Fixed NITRO project & linker command file (to work with CW 2.0/NitroSDK 3.1) - SAH FIX Fixed Linux makefile -06-06-2006 2.06.65 MJ FEATURE Added Adhoc Support for PSP. -05-31-2006 2.06.64 SAH RELEASE Releasing to developer site - SAH FIX Fixed Linux makefile -05-30-2006 2.06.63 SAH FIX Fixed PS3 projects to work with PS3(084_001 SDK) -05-25-2006 2.06.62 SAH FIX Changed PSP project warning levels -05-24-2006 2.06.61 SAH FIX Added (socklen_t) typecast for PS3 warnings to gt2socket.c -05-19-2006 2.06.60 SAH FIX Added gsTestMain.c to nitro CodeWarrior project -05-19-2006 2.06.59 SAH FIX Added GS_STATIC_CALLBACK in front of 3 compare functions for __fastcall support -05-15-2006 2.06.58 SAH FIX Added "PS3 Release" configuration to project -05-05-2006 2.06.57 SAH FIX Fixed the gt2action.dsp project - needed to include a few encryption files for http -04-27-2006 2.06.56 MJ FEATURE Added gtEncodedMessageTypeSet -04-25-2006 2.06.55 SAH RELEASE Releasing to developer site -04-24-2006 2.06.55 SAH FIX Added function prototypes, fixed/added typecasts and Nitro project files -04-20-2006 2.06.54 SAH FIX Commented out unused variables, break; statements - FIX Commented out unncessary checks (if unsigned int > 0) -04-20-2006 2.06.53 SAH FIX Added _PS3 wrapper typecast for socket calls -04-14-2006 2.06.52 SAH FIX few more typecasts in gt2memcpy calls (forgot to do PC ones) -04-14-2006 2.06.51 SAH FIX Added some typecasts in gt2memcpy calls to get rid of warnings -01-27-2006 2.05.50 SN RELEASE Releasing to developer site -01-27-2006 2.05.50 SN FIX Updated test_main define for PSP - SN FIX PSP and PS2 only use messages smaller than 8K - SN OTHER Added psp prodg project and solution to sgv -01-26-2006 2.05.49 SN FIX Force gt2IPToHostInfo to return NULL for PSP since PSP doesn't have a gethostbyaddr -01-11-2006 2.05.49 SN FIX Added platform checks to socket error handlers - SN FIX Added visual studio .net project and solution -01-11-2006 2.05.48 SN FIX updated callling convention to only be WIN32 -12-20-2005 2.05.47 SN OTHER Cleaned up and added missing common code to projects if needed -12-20-2005 2.05.46 SN FIX Fixed VDP specific changes that caused messages to be truncated - Removed VDP checks in parts of code that previously had them -12-19-2005 2.05.45 SN FIX Added preprocessor directive around code creating a VDP socket - Changed buffer offset to use a constant -12-07-2005 2.05.44 DDW FEATURE Added Win64 build support -12-06-2005 2.05.43 SN FEATURE Added Xbox VDP support -11-17-2005 2.05.42 DES FIX Updated Nitro Makefile. -11-14-2005 2.05.41 DES FIX Updated the OSX Makefile. -10-11-2005 2.05.40 SN FIX Updated gt2test dsp to have new common code files gsassert and gsmemory -09-21-2005 2.05.39 DES FEATURE Updated DS support - DES FIX Updated to handle additional UDP sending errors - DES FIX Updated OSX Makefile -09-12-2005 2.05.38 SN FIX Fixed unhandled socket error code -07-28-2005 2.05.37 SN RELEASE Releasing to developer site. -07-28-2005 2.05.37 SN FIX Changed IP address to use local host for gt2testc -06-03-2005 2.05.36 SN RELEASE Releasing to developer site. -05-05-2005 2.05.36 BED FIX Updated project files to use new common folder. -05-04-2005 2.05.35 SN FIX Changes for XBox platform -05-03-2005 2.05.34 SN FIX Removed deprecated MFC code for VS .NET project - And fixed implicit cast performed in a callback - SN OTHER Created Visual Studio .NET projects -04-28-2005 2.05.33 SN RELEASE Releasing to developer site. -04-27-2005 2.05.33 DES RELEASE Limited release to Nintendo DS developers. -04-25-2005 2.05.33 DES FIX Limit the Nitro to a 1500 byte message buffer. - DES CLEANUP Disable Win32 linker warning. -04-19-2005 2.05.32 DES FEATURE Added the ability to send raw UDP datagrams through a GT2Socket. - This feature can also be used to send broadcast datagrams. -04-15-2005 2.05.31 DES FIX XBox fix. -04-08-2005 2.05.30 DES FEATURE Changes for XBox support. -04-04-2005 2.05.29 SN RELEASE Release to developer site. -03-14-2005 2.05.29 DES FIX Fixed buffering multiple copies of incoming reliable messages - FIX Fixed detection of incoming reliable message buffer overflow -03-14-2005 2.05.28 DES FEATURE Nintendo DS support -01-27-2003 2.05.27 DES FIX Fixed custom SN sendto and moved it to nonport -01-03-2005 2.05.26 SN FIX Added const qualifiers to unmodified formal function parameters -09-23-2004 2.05.25 DES FIX Changed IPs that were using unsigned long to unsigned int. - DES FIX Changed times that were using unsigned long to gsi_time. - DES FIX Sockets now correctly bind to a provided local IP when created. -09-17-2004 2.05.24 DES FEATURE Added functions for confirming receipt of reliable messages. -09-16-2004 2.05.23 SN RELEASE Releasing to developer site. -08-27-2004 2.05.23 DES CLEANUP General Unicode cleanup - DES CLEANUP Removed MacOS style includes - DES CLEANUP Updated Win32 project configurations - DES CLEANUP Fixed warnings under OSX - DES FEATURE Added OSX Makefile -08-25-2004 2.05.22 DES FEATURE Added OSX makefile -08-16-2004 2.05.22 SN FEATURE Updated gt2hostmig and gt2nat to use QR2 instead of legacy Q & R -08-05-2004 2.05.21 SN RELEASE Releasing to developer site. -07-20-2004 2.05.21 SN FIX Updated code with explicit casts to remove implicit cast error - when compiling at highest level and warnings treated as errors. -06-18-2004 2.05.20 BED RELEASE Releasing to developer site. -06-18-2004 2.05.20 DES FIX Checking for trying to connect to an invalid IP range. -10-21-2003 2.05.19 BED RELEASE Releasing to developer site. (UNIQUE NICK AND UNICODE SUPPORT) -10-21-2003 2.05.19 BED FIX Added #ifdef because SN_SYSTEMS doesn't support EHOSTDOWN -10-09-2003 2.05.18 BED FIX Switched to gsi_time type instead of unsinged long for PS2 compatibility -07-25-2003 2.05.17 DES FIX Ignoring EHOSTDOWN sendto error. -07-24-2003 2.05.16 DES RELEASE Releasing to developer site. -07-18-2003 2.05.16 BED FEATURE Added CodeWarrior (PS2) sample project file. - BED CLEANUP General cleanup to remove CodeWarrior warnings. -07-17-2003 2.05.15 DES CLEANUP Cleaned up the PS2 Makefile, it now uses Makefile.commmon. -07-16-2003 2.05.14 DES FIX Changed a few __mips64 checks to _PS2 checks. - BED FEATURE Added ProDG sample project files. -07-11-2003 2.05.13 DES RELEASE Releasing to developer site. -05-12-2003 2.05.13 DES FIX Fixed a crashing bug that could occur on socket errors. -05-09-2003 2.05.12 DES CLEANUP Removed Dreamcast support. -03-24-2003 2.05.11 DES FIX Fixed assumption that messages passed to callbacks were always NUL terminated. -03-03-2003 2.05.10 DES CLEANUP General cleanup to remove warnings. -02-05-2003 2.05.09 DES RELEASE Releasing to developer site. -02-05-2003 2.05.09 DES CLEANUP Switched to use the common code CanReceiveOnSocket and CanSendOnSocket. -12-19-2002 2.05.08 DES RELEASE Releasing to developer site. -12-19-2002 2.05.08 DES CLEANUP Removed assert.h includes. -12-16-2002 2.05.07 DES OTHER Moved handling of SN Systems lack of support for gethostbyaddr() to nonport. - CLEANUP Removed call to GOAClearSocketError. -12-13-2002 2.05.06 DES FEATURE Added PS2 eenet stack support. -11-22-2002 2.05.05 DES RELEASE Releasing to developer site. -11-20-2002 2.05.05 DES CLEANUP Cleaned up code to remove PS2 compiler warnings. -11-18-2002 2.05.04 DES RELEASE Release to developer site. -11-18-2002 2.05.04 DES FIX Fixed alignment bug in gtEncodedMessageType. -11-14-2002 2.05.03 DES OTHER Removed BLOCKING_SOCKETS define from PS2 makefile, leftover from GT -11-14-2002 2.05.02 DES FIX Fixed gt2testc to stop sending messages at the correct time -11-13-2002 2.05.01 DES FIX Resends an ack if a duplicate message is received -09-25-2002 2.05.00 DDW OTHER Changelog started diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.dsp deleted file mode 100644 index 12c64bdaed7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.dsp +++ /dev/null @@ -1,268 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=gt2 - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2.mak" CFG="gt2 - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2 - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "gt2 - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2", PSNCAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2 - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=snLib.exe -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "gt2 - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=snLib.exe -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "gt2 - Win32 Release" -# Name "gt2 - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=.\gt2Utility.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\gt2.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=.\gt2Utility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\hashtable.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\changelog.txt -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.dsw deleted file mode 100644 index 2d9aca774d1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.dsw +++ /dev/null @@ -1,133 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gt2"=.\gt2.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2", PSNCAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2action"=.\gt2action\gt2action.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2action", DQOCAAAA - .\gt2action - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2hostmig"=.\gt2hostmig\gt2hostmig.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2hostmig", AQOCAAAA - .\gt2hostmig - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2nat"=.\gt2nat\gt2nat.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2nat", TTOCAAAA - .\gt2nat - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2proxy"=.\gt2proxy\gt2proxy.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2proxy", RSOCAAAA - .\gt2proxy - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2test"=.\gt2test\gt2test.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2test", IBOCAAAA - .\gt2test - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "gt2testc"=.\gt2testc\gt2testc.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2testc", LPOCAAAA - .\gt2testc - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2", PSNCAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.h deleted file mode 100644 index 5ef96914ba7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2.h +++ /dev/null @@ -1,664 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -/**************************** -** GameSpy Transport SDK 2 ** -****************************/ - -/* -** see "configurable defines" in gt2Main.h for certain performance settings that can be changed -*/ - -#ifndef _GT2_H_ -#define _GT2_H_ - -#include "../common/gsCommon.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/********** -** TYPES ** -**********/ - -// boolean -typedef int GT2Bool; -#define GT2False 0 -#define GT2True 1 - -// a byte -typedef unsigned char GT2Byte; - -// a handle to a socket object (can be used to accept connections and initiate connections) -typedef struct GTI2Socket * GT2Socket; - -// a handle to an object representing a connection to a specific IP and port -// the local endpoint is a GT2Socket -typedef struct GTI2Connection * GT2Connection; - -// the id of a reliably sent message -// unreliable messages don't have ids -typedef unsigned short GT2MessageID; - -// the result of a GT2 operation -// check individual function definitions to see possible results -// TODO: list possible results wherever this is used -typedef enum -{ - GT2Success, // success - // errors: - GT2OutOfMemory, // ran out of memory - GT2Rejected, // attempt rejected - GT2NetworkError, // networking error (could be local or remote) - GT2AddressError, // invalid or unreachable address - GT2DuplicateAddress, // a connection was attempted to an address that already has a connection on the socket - GT2TimedOut, // time out reached - GT2NegotiationError, // there was an error negotiating with the remote side - GT2InvalidConnection, // the connection didn't exist - GT2InvalidMessage, // used for vdp reliable messages containing voice data, no voice data in reliable messages - GT2SendFailed // the send failed, -} GT2Result; - -// possible states for any GT2Connection -typedef enum -{ - GT2Connecting, // negotiating the connection - GT2Connected, // the connection is active - GT2Closing, // the connection is being closed - GT2Closed // the connection has been closed and can no longer be used -} GT2ConnectionState; - -// The cause of the connection being closed. -typedef enum -{ - GT2LocalClose, // The connection was closed with gt2CloseConnection. - GT2RemoteClose, // The connection was closed remotely. - // errors: - GT2CommunicationError, // An invalid message was received (it was either unexpected or wrongly formatted). - GT2SocketError, // An error with the socket forced the connection to close. - GT2NotEnoughMemory // There wasn't enough memory to store an incoming or outgoing message. -} GT2CloseReason; - -/************ -** GLOBALS ** -************/ - -// The challenge key is a 32 character string -// that is used in the authentication process. -// The key can be set before GT2 is used so -// that the key will be application-specific. -extern char GT2ChallengeKey[33]; - -/********************* -** SOCKET CALLBACKS ** -*********************/ - -// this callback gets called when there was is an error that forces a socket to close -// all connections that use this socket are terminated, and their gt2CloseCallback callbacks -// will be called before this callback is called (with the reason set to GT2SocketError). -// the socket cannot be used again after this callback returns -typedef void (* gt2SocketErrorCallback) -( - GT2Socket socket -); - -/********************* -** SOCKET FUNCTIONS ** -*********************/ - -// creates a local socket -// if the IP of the local address is 0, then any/all ips will be bound. -// if the port of the local address is 0, then a port will be assigned. -// if either buffer sizes is set to 0, a default value will be used (currently 64K for PC, 4k for Xbox). -// the buffer needs to be able to hold all messages waiting for confirmation of delivery, -// and it needs to hold any messages that arrive out of order. if either buffer runs out -// of space the connection will be dropped. -GT2Result gt2CreateSocket -( - GT2Socket * socket, // if the result is GT2Success, the socket object handle will be stored at this address - const char * localAddress, // the local address to bind to - int outgoingBufferSize, // size of per-connection buffer where sent messages waiting to be confirmed are held, use 0 for default - int incomingBufferSize, // size of per-connection buffer where out-of-order received messages are held, use 0 for default - gt2SocketErrorCallback callback // a callback that is called if there is an error with the socket -); - -// AdHoc Sockets use MAC address instead of IP address. -GT2Result gt2CreateAdHocSocket -( - GT2Socket * socket, // if the result is GT2Success, the socket object handle will be stored at this address - const char * localAddress, // the local address to bind to - int outgoingBufferSize, // size of per-connection buffer where sent messages waiting to be confirmed are held, use 0 for default - int incomingBufferSize, // size of per-connection buffer where out-of-order received messages are held, use 0 for default - gt2SocketErrorCallback callback // a callback that is called if there is an error with the socket -); - -#ifdef _XBOX -// creates a local VDP socket on the Xbox platform -// if the IP of the local address is 0, then any/all ips will be bound. -// if the port of the local address is 0, then a port will be assigned. -// if either buffer sizes is set to 0, a default value will be used (currently 4K). -// the buffer needs to be able to hold all messages waiting for confirmation of delivery, -// and it needs to hold any messages that arrive out of order. if either buffer runs out -// of space the connection will be dropped. -GT2Result gt2CreateVDPSocket -( - GT2Socket * socket, // if the result is GT2Success, the socket object handle will be stored at this address - const char * localAddress, // the local address to bind to - int outgoingBufferSize, // size of per-connection buffer where sent messages waiting to be confirmed are held, use 0 for default - int incomingBufferSize, // size of per-connection buffer where out-of-order received messages are held, use 0 for default - gt2SocketErrorCallback callback // a callback that is called if there is an error with the socket -); -#endif - -// closes a local socket. -// all existing connections will be hard closed, as if gt2CloseAllConnectionsHard was -// called for this socket. all connections send a close message to the remote side, -// and any closed callbacks will be called from within this function -void gt2CloseSocket(GT2Socket socket); - -// processes a socket (and all associated connections) -void gt2Think(GT2Socket socket); - -// sends a raw UDP datagram through the socket -// this function bypasses the normal connection logic -// note that all messages sent this way will be unreliable -// to broadcast a datagram, omit the IP from the remoteAddress (e.g., ":12345") -GT2Result gt2SendRawUDP -( - GT2Socket socket, // the socket through which to send the raw UDP datagram - const char * remoteAddress, // the address to which to send the datagram - const GT2Byte * message, // the message to send, or NULL for an empty datagram - int len // the len of the message (0 for an empty message, ignored if message==NULL) -); - -/************************* -** CONNECTION CALLBACKS ** -*************************/ - -// Called when the connect has completed. -// If the result is GT2Rejected, -// then message is the message that the -// listener passed to gt2Reject. If the -// result is anything else, then message -// is NULL and len is 0. -typedef void (* gt2ConnectedCallback) -( - GT2Connection connection, // The connection object. - GT2Result result, // Result from connect attempt. - GT2Byte * message, // If result==GT2Rejected, the reason. Otherwise, NULL. - int len // If result==GT2Rejected, the length of the reason. Otherwise, 0. -); - -// Called when a message is received. -typedef void (* gt2ReceivedCallback) -( - GT2Connection connection, // The connection the message was received on. - GT2Byte * message, // The message that was received. Will be NULL if an empty message. - int len, // The length of the message in bytes. Will be 0 if an empty message. - GT2Bool reliable // True if this is was sent reliably. -); - -// Called when the connection is closed (remotely or locally). -// The connection can no longer be used after this callback returns. -typedef void (* gt2ClosedCallback) -( - GT2Connection connection, // The connection that was closed. - GT2CloseReason reason // The reason the connection was closed. -); - -// When a reply is received for a ping that was sent, this callback is called. -// The latency reported here is the amount of time between when the ping -// was first sent with gt2Ping and when the pong was received. -typedef void (* gt2PingCallback) -( - GT2Connection connection, // the connection the ping was sent on - int latency // the round-trip time for the ping, in milliseconds -); - -// Callbacks set for each connection. -// The connected callback is ignored -// when this is passed to gt2Accept. -typedef struct -{ - gt2ConnectedCallback connected; // Called when gt2Connect is complete. - gt2ReceivedCallback received; // Called when a message is received. - gt2ClosedCallback closed; // Called when the connection is closed (remotely or locally). - gt2PingCallback ping; // Called when a ping reply is received. -} GT2ConnectionCallbacks; - -/************************* -** CONNECTION FUNCTIONS ** -*************************/ - -// initiates a connection between a local socket and a remote socket -// if blocking is true, the return value signals the connection result: -// GT2Success means the connect attempt succeeded -// anything else means it failed -// if blocking is false, the return value signals the current status of the attempt -// GT2Success means the connection is being attempted -// anything else means there was an error and the connection attempt has been aborted -GT2Result gt2Connect -( - GT2Socket socket, // the local socket to use for the connection - GT2Connection * connection, // if the result is GT2Success, and blocking is false, the connection object handle is stored here - const char * remoteAddress, // the address to connect to - const GT2Byte * message, // an optional initial message (may be NULL) - int len, // length of the initial message (may be 0, or -1 for strlen) - int timeout, // timeout in milliseconds (may be 0 for infinite retries) - GT2ConnectionCallbacks * callbacks, // callbacks for connection related stuff - GT2Bool blocking // if true, don't return until complete (successfuly or unsuccessfuly) -); - -// sends data reliably or unreliably -// reliable messages are guaranteed to arrive, arrive in order, and arrive only once. -// unreliable messages are not guaranteed to arrive, arrive in order, or arrive only once. -// because messages may be held in the outgoing buffer (even unreliable messages may need -// to be put in the buffer), the message size cannot exceed -GT2Result gt2Send -( - GT2Connection connection, // the connection to send the message on - const GT2Byte * message, // the message to send, or NULL for an empty message0 - int len, // the len of the message (0 for an empty message, ignored if message==NULL) - GT2Bool reliable // if true, send the message reliably -); - -// sends a ping on a connection in an attempt to determine latency -// the ping is unreliable, and either it or the pong sent in reply -// could be dropped (resulting in the callback never being called), -// or it could even arrive multiple times (resulting in multiple -// calls to the callback). -void gt2Ping(GT2Connection connection); - -// starts an attempt to close the connection -// when the close is completed, the connection's closed callback will be called -void gt2CloseConnection(GT2Connection connection); - -// same as gt2CloseConnection, but doesn't wait for confirmation from the remote side of the connection -// the closed callback will be called from within this function -void gt2CloseConnectionHard(GT2Connection connection); - -// closes all of a socket's connections (essentially calls gt2CloseConnection on each of them). -void gt2CloseAllConnections(GT2Socket socket); - -// same as gt2CloseAllConnections, but does a hard close -// any closed callbacks will be called from within this function -void gt2CloseAllConnectionsHard(GT2Socket socket); - -/********************* -** LISTEN CALLBACKS ** -*********************/ - -// callback gets called when someone attempts to connect to a socket that is listening for new connections. -// in response to this callback the application should call gt2Accept or gt2Reject. they do not need -// to be called from inside the callback, however they should be called in a timely manner so that the -// remote side does not need to sit around indefinitely waiting for a response. -// the latency is an estimate of the round trip time between connections. -typedef void (* gt2ConnectAttemptCallback) -( - GT2Socket socket, // the socket the attempt came in on - GT2Connection connection, // a connection object for the incoming connection attempt - unsigned int ip, // the IP being used remotely for the connection attempt - unsigned short port, // the port being used remotely for the connection attempt - int latency, // the approximate latency on the connection - GT2Byte * message, // an optional message sent with the attempt. Will be NULL if an empty message. - int len // the length of the message, in characters. Will be 0 if an empty message. -); - -/********************* -** LISTEN FUNCTIONS ** -*********************/ - -// tells a socket to start listening for incoming connections -// any connections attempts will cause the callback to be called -// if the socket is already listening, this callback will replace the exsiting callback being used -// if the callback is NULL, this will cause the connection to stop listening -void gt2Listen(GT2Socket socket, gt2ConnectAttemptCallback callback); - -// after a socket's gt2ConnectAttemptCallback has been called, this function can be used to accept -// the incoming connection attempt. it can be called from either within the callback or some later time. -// as soon as it is called the connection is active, and messages can be sent and received. the remote side -// of the connection will have it's connected callback called with the result set to GT2Success. the callbacks -// that are passed in to this function are the same callbacks that get passed to gt2Connect, with the exception -// that the connected callback can be ignored, as the connection is already established. -// if this function returns GT2True, then the connection has been successfully accepted. if it returns -// GT2False, then the remote side has already closed the connection attempt. in that case, the connection -// is considered closed, and it cannot be referenced again. -GT2Bool gt2Accept(GT2Connection connection, GT2ConnectionCallbacks * callbacks); - -// after a socket's gt2ConnectAttemptCallback has been called, this function can be used to reject -// the incoming connection attempt. it can be called from either within the callback or some later time. -// once the function is called the connection is considered closed and cannot be referenced again. the remote -// side attempting the connection will have its connected callback called with the result set to GT2Rejected. -// if the message is not NULL and the len is not 0, the message will be sent with the rejection, and passed -// into the remote side's connected callback. -void gt2Reject(GT2Connection connection, const GT2Byte * message, int len); - -/************************* -** MESSAGE CONFIRMATION ** -*************************/ -// gets the message id for the last reliably sent message. unreliable messages do not have ids. -// this should be called immediately after gt2Send. waiting until after a call to gt2Think can result in -// an invalid message id being returned. -// note that the use of filters that can either drop or delay messages can complicate the process, because -// in those cases a call to gt2Send does not guarantee that a message will actually be sent. in those cases, -// gt2GetLastSentMessageID should be called after gt2FilteredSend, because the actual message will be sent -// from within that function. -GT2MessageID gt2GetLastSentMessageID(GT2Connection connection); - -// returns true if confirmation was received locally that the reliable message represented by the message id -// was received by the remote end of the connection. returns false if confirmation was not yet received. -// this should only be called on message ids that were returned by gt2GetLastSendMessageID, and should be -// used relatively soon after the message was sent, due to message ids wrapping around after a period of time. -GT2Bool gt2WasMessageIDConfirmed(GT2Connection connection, GT2MessageID messageID); - -/********************* -** FILTER CALLBACKS ** -*********************/ - -// Callback for filtering outgoing data. -// Call gt2FilteredSend with the filtered data, either from within the callback or later. -// the message points to the same memory location as the message passed to gt2Send (or gt2FilteredSend). -// so if the call to gt2FilteredSend is delayed, it is the filter's responsibility to make sure the -// data is still around when and if it is needed. -typedef void (* gt2SendFilterCallback) -( - GT2Connection connection, // The connection on which the message is being sent. - int filterID, // Pass this ID to gt2FilteredSend. - const GT2Byte * message, // The message being sent. Will be NULL if an empty message. - int len, // The length of the message being sent, in bytes. Will be 0 if an empty message. - GT2Bool reliable // If the message is being sent reliably. -); - -// Callback for filtering incoming data. -// Call gt2FilteredRecieve with the filtered data, -// either from within the callback or later. -// the message may point to a memory location supplied to gt2FilteredReceive by a previous filter. -// so if this filter's call to gt2FilteredReceive is delayed, it is the filter's responsibility -// to make sure the data is still around when and if it is needed. -typedef void (* gt2ReceiveFilterCallback) -( - GT2Connection connection, // The connection the message was received on. - int filterID, // Pass this ID to gtFilteredReceive. - GT2Byte * message, // The message that was received. Will be NULL if an empty message. - int len, // The length of the message in bytes. Will be 0 if an empty message. - GT2Bool reliable // True if this is a reliable message. -); - -/********************* -** FILTER FUNCTIONS ** -*********************/ - -// Adds a filter to the connection's outgoing data. -// Returns GT2False if there was an error adding the filter (due to no free memory) -GT2Bool gt2AddSendFilter -( - GT2Connection connection, // The connection on which to add the filter. - gt2SendFilterCallback callback // The callback the outgoing data is filtered through. -); - -// Removes a filter from the connection's outgoing data. -// if callback is NULL, all send filters are removed -void gt2RemoveSendFilter -( - GT2Connection connection, // The connection on which to remove the filter. - gt2SendFilterCallback callback // The callback to remove. -); - -// Called in response to a gt2SendFilterCallback being called. -// It can be called from within the callback, or at any later time. -void gt2FilteredSend -( - GT2Connection connection, // The connection on which the message is being sent. - int filterID, // The ID passed to the gt2SendFilterCallback. - const GT2Byte * message, // The message being sent. May be NULL. - int len, // The lengt2h of the message being sent, in bytes. May be 0 or -1. - GT2Bool reliable // If the message should be sent reliably. -); - -// Adds a filter to the connection's incoming data. -// Returns GT2False if there was an error adding the filter (due to no free memory) -GT2Bool gt2AddReceiveFilter -( - GT2Connection connection, // The connection on which to add the filter. - gt2ReceiveFilterCallback callback // The callback the incoming data is filtered through. -); - -// Removes a filter from the connection's incoming data. -// if callback is NULL, all receive filters are removed -void gt2RemoveReceiveFilter -( - GT2Connection connection, // The connection on which to remove the filter. - gt2ReceiveFilterCallback callback // The callback to remove. -); - -// Called in response to a gt2ReceiveFilterCallback being called. -// It can be called from within the callback, or at any later time. -void gt2FilteredReceive -( - GT2Connection connection, // The connection the message was received on. - int filterID, // The ID passed to the gt2ReceiveFilterCallback. - GT2Byte * message, // The message that was received. May be NULL. - int len, // The lengt2h of the message in bytes. May be 0. - GT2Bool reliable // True if this is a reliable message. -); - -/***************************** -** SOCKET SHARING CALLBACKS ** -*****************************/ - -// this callback gets called when the sock receives a message that it cannot match to an existing -// connection. if the callback recognizes the message and handles it, it should return GT2True, which -// will tell the socket to ignore the message. if the callback does not recognize the message, it -// should return GT2False, which tells the socket to let the other side know there is no connection. -typedef GT2Bool (* gt2UnrecognizedMessageCallback) -( - GT2Socket socket, // the socket the message was received on - unsigned int ip, // the ip of the remote machine the message came from (in network byte order) - unsigned short port, // the port on the remote machine (in host byte order) - GT2Byte * message, // the message (may be NULL for an empty message) - int len // the length of the message (may be 0) -); - -/***************************** -** SOCKET SHARING FUNCTIONS ** -*****************************/ - -// this function returns the actual underlying socket for a GT2Socket. -// this can be used for socket sharing purposes, along with the gt2UnrecognizedMessageCallback. -SOCKET gt2GetSocketSOCKET(GT2Socket socket); - -// sets a callback that all unrecognized messages are passed to. an unrecognized message is one -// that can't be matched up to a specific connection. if the callback handles the message, it -// returns true, and the GT2Socket ignores the message. if the callback does not recognize the message, -// it returns false, and the socket handles the message (by sending a message back indicating the connection -// is closed). if the callback is NULL, it removes any previously set callback. -void gt2SetUnrecognizedMessageCallback(GT2Socket socket, gt2UnrecognizedMessageCallback callback); - -/******************* -** INFO FUNCTIONS ** -*******************/ - -// gets the socket this connection exists on -GT2Socket gt2GetConnectionSocket(GT2Connection connection); - -// gets the connection's connection state -// GT2Connecting - the connection is still being negotiated -// GT2Connected - the connection is active (has successfully connected, and not yet closed) -// GT2Closing - the connection is in the process of closing (i.e., sent a close message and waiting for confirmation). -// GT2Closed - the connection has already been closed and will soon be freed -GT2ConnectionState gt2GetConnectionState(GT2Connection connection); - -// gets a connection's remote IP (in network byte order) -unsigned int gt2GetRemoteIP(GT2Connection connection); - -// gets a connection's remote port (in host byte order) -unsigned short gt2GetRemotePort(GT2Connection connection); - -// gets a socket's local IP (in network byte order) -unsigned int gt2GetLocalIP(GT2Socket socket); - -// gets a socket's local port (in host byte order) -unsigned short gt2GetLocalPort(GT2Socket socket); - -// gets the total size of the connection's incoming buffer. -int gt2GetIncomingBufferSize(GT2Connection connection); - -// gets the amount of available space in the connection's incoming buffer. -int gt2GetIncomingBufferFreeSpace(GT2Connection connection); - -// gets the total size of the connection's outgoing buffer. -int gt2GetOutgoingBufferSize(GT2Connection connection); - -// gets the amount of available space in the connection's outgoing buffer. -int gt2GetOutgoingBufferFreeSpace(GT2Connection connection); - -/************************ -** USER DATA FUNCTIONS ** -************************/ - -void gt2SetSocketData(GT2Socket socket, void * data); -void * gt2GetSocketData(GT2Socket socket); -void gt2SetConnectionData(GT2Connection connection, void * data); -void * gt2GetConnectionData(GT2Connection connection); - -/************************* -** BYTE ORDER FUNCTIONS ** -*************************/ - -unsigned int gt2NetworkToHostInt(unsigned int i); -unsigned int gt2HostToNetworkInt(unsigned int i); -unsigned short gt2HostToNetworkShort(unsigned short s); -unsigned short gt2NetworkToHostShort(unsigned short s); - -/********************** -** ADDRESS FUNCTIONS ** -**********************/ - -// Converts an IP and a port into a text string. The IP must be in network byte order, and the port -// in host byte order. The string must be able to hold at least 22 characters (including the NUL). -// "XXX.XXX.XXX.XXX:XXXXX" -// If both the IP and port are non-zero, the string will be of the form "1.2.3.4:5" (":"). -// If the port is zero, and the IP is non-zero, the string will be of the form "1.2.3.4" (""). -// If the IP is zero, and the port is non-zero, the string will be of the form ":5" (":"). -// If both the IP and port are zero, the string will be an empty string ("") -// The string is returned. If the string paramater is NULL, then an internal static string will be -// used. There are two internal strings that are alternated between. -const char * gt2AddressToString -( - unsigned int ip, // IP in network byte order. Can be 0. - unsigned short port, // Port in host byte order. Can be 0. - char string[22] // String will be placed in here. Can be NULL. -); - -// Converts a string address into an IP and a port. The IP is stored in network byte order, and the port -// is stored in host byte order. Returns false if there was an error parsing the string, or if a supplied -// hostname can't be resolved. -// Possible string forms: -// NULL => all IPs, any port (localAddress only). -// "" => all IPs, any port (localAddress only). -// "1.2.3.4" => 1.2.3.4 IP, any port (localAddress only). -// "host.com" => host.com's IP, any port (localAddress only). -// ":2786" => all IPs, 2786 port (localAddress only). -// "1.2.3.4:0" => 1.2.3.4 IP, any port (localAddress only). -// "host.com:0" => host.com's IP, any port (localAddress only). -// "0.0.0.0:2786" => all IPs, 2786 port (localAddress only). -// "1.2.3.4:2786" => 1.2.3.4 IP, 2786 port (localAddress or remoteAddress). -// "host.com:2786" => host.com's IP, 2786 port (localAddress or remoteAddress). -// If this function needs to resolve a hostname ("host.com") it may need to contact a DNS server, which can -// cause the function to block for an indefinite period of time. Usually it is < 2 seconds, but on certain -// systems, and under certain circumstances, it can take 30 seconds or longer. -GT2Bool gt2StringToAddress -( - const char * string, // The string to convert. - unsigned int * ip, // The IP is stored here, in network byte order. Can be NULL. - unsigned short * port // The port is stored here, in host byte order. Can be NULL. -); - -// Gets the host information for a machine on the Internet. The first version takes an IP in network byte order, -// and the second version takes a string that is either a dotted ip ("1.2.3.4"), or a hostname ("www.gamespy.com"). -// If the function can successfully lookup the host's info, the host's main hostname will be returned. If it -// cannot find the host's info, it returns NULL. -// For the aliases parameter, pass in a pointer to a variable of type (char **). If this parameter is not NULL, -// and the function succeeds, the variable will point to a NULL-terminated list of alternate names for the host. -// For the ips parameter, pass in a pointer to a variable of type (int **). If this parameter is not NULL, and -// the function succeeds, the variable will point to a NULL-terminated list of altername IPs for the host. Each -// element in the list is actually a pointer to an unsigned int, which is an IP address in network byte order. -// The return value, aliases, and IPs all point to an internal data structure, and none of these values should -// be modified directly. Also, the data is only valid until another call needs to use the same data structure -// (virtually ever internet address function will use this data structure). If the data will be needed in the -// future, it should be copied off. -// If this function needs to resolve a hostname ("host.com") it may need to contact a DNS server, which can -// cause the function to block for an indefinite period of time. Usually it is < 2 seconds, but on certain -// systems, and under certain circumstances, it can take 30 seconds or longer. -const char * gt2IPToHostInfo(unsigned int ip, char *** aliases, unsigned int *** ips); -const char * gt2StringToHostInfo(const char * string, char *** aliases, unsigned int *** ips); - -// The following functions are shortcuts for the above two functions (gt2*ToHostInfo()), and each performs a subset -// of the functionality. They are provided so that code that only needs certain information can be a little simpler. -// Before using these, read the comments for the gt2*ToHostInfo() functions, as the info also applies to these functions. -const char * gt2IPToHostname(unsigned int ip); -const char * gt2StringToHostname(const char * string); -char ** gt2IPToAliases(unsigned int ip); -char ** gt2StringToAliases(const char * string); -unsigned int ** gt2IPToIPs(unsigned int ip); -unsigned int ** gt2StringToIPs(const char * string); - -#ifdef _XBOX -unsigned int gt2XnAddrToIP(XNADDR theAddr, XNKID theKeyId); -GT2Bool gt2IPToXnAddr(int ip, XNADDR *theAddr, XNKID *theKeyId); -#endif - -// these are for getting around adhoc which requires a 48 bit address v.s. a 32 bit inet address -void gt2IpToMac(gsi_u32 ip,char *mac); -// change IP address to mac ethernet -gsi_u32 gt2MacToIp(const char *mac); -// change mac ethernet to IP address - -/******************* -** DUMP CALLBACKS ** -*******************/ - -// called with either sent or received data -// trying to send a message from within the send dump callback, or letting the socket think from within the receive -// dump callback can cause serious problems, and should not be done. -typedef void (* gt2DumpCallback) -( - GT2Socket socket, // the socket the message was on - GT2Connection connection, // the connection the message was on, or NULL if there is no connection for this message - unsigned int ip, // the remote ip, in network byte order - unsigned short port, // the remote port, in host byte order - GT2Bool reset, // if true, the connection has been reset (only used by the receive callback) - const GT2Byte * message, // the message (should not be modified) - int len // the length of the message -); - -/******************* -** DUMP FUNCTIONS ** -*******************/ - -// sets a callback to be called whenever a UDP datagram is sent or received, and when a connection reset is received. -// pass in a callback of NULL to remove the callback. the dumps sit at a lower level than the filters, and allow an -// app to keep an eye on exactly what datagrams are being sent and received, allowing for close monitoring. however -// the dumps cannot be used to modify data, only monitor it. the dumps are useful for debugging purposes, and -// to keep track of data send and receive rates (e.g., the Quake 3 engine's netgraph). -// note that these are the actual UDP datagrams being sent and received - datagrams may be dropped, repeated, or -// out-of-order. control datagrams (those used internally by the protocol) will be passed to the dump callbacks, -// and certain application messages will have a header at the beginning. -void gt2SetSendDump(GT2Socket socket, gt2DumpCallback callback); -void gt2SetReceiveDump(GT2Socket socket, gt2DumpCallback callback); - - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Auth.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Auth.c deleted file mode 100644 index 6594e042de1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Auth.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Main.h" -#include "gt2Auth.h" -#include - -#define CALCULATEODDMODE(buffer, i, oddmode) ((buffer[i-1] & 1) ^ (i & 1) ^ oddmode ^ (buffer[0] & 1) ^ ((buffer[0] < 79) ? 1 : 0) ^ ((buffer[i-1] < buffer[0]) ? 1 : 0)); - -char GT2ChallengeKey[33] = "3b8dd8995f7c40a9a5c5b7dd5b481341"; - -static int gti2VerifyChallenge(const GT2Byte *buffer) -{ - int oddmode = 0; - int i; - for (i = 1; i < GTI2_CHALLENGE_LEN ; i++) - { - oddmode = CALCULATEODDMODE(buffer,i, oddmode); - if ((oddmode && (buffer[i] & 1) == 0) || (!oddmode && ((buffer[i] & 1) == 1))) - return 0; //failed!! - } - return 1; -} - -GT2Byte * gti2GetChallenge -( - GT2Byte * buffer -) -{ - int i; - int oddmode; - assert(buffer); - - srand((unsigned int)current_time()); - buffer[0] = (GT2Byte)(33 + rand() % 93); //use chars in the range 33 - 125 - oddmode = 0; - for (i = 1; i < GTI2_CHALLENGE_LEN ; i++) - { - oddmode = CALCULATEODDMODE(buffer,i, oddmode); - buffer[i] = (GT2Byte)(33 + rand() % 93); //use chars in the range 33 - 125 - //if oddmode make sure the char is odd, otherwise make sure it's even - if ((oddmode && (buffer[i] & 1) == 0) || (!oddmode && ((buffer[i] & 1) == 1))) - buffer[i]++; - - } - return buffer; -} - -GT2Byte * gti2GetResponse -( - GT2Byte * buffer, - const GT2Byte * challenge -) -{ - int i; - int valid; - char cchar; - int keylen = (int)strlen(GT2ChallengeKey); - int chalrand; - valid = gti2VerifyChallenge(challenge); //it's an invalid challenge, give them a bogus response - //assert(GTI2_RESPONSE_LEN <= GTI2_CHALLENGE_LEN); - for (i = 0 ; i < GTI2_RESPONSE_LEN ; i++) - { - //use random vals for spots 0 and 13 - if (!valid || i == 0 || i == 13) - buffer[i] = (GT2Byte)(33 + rand() % 93); //use chars in the range 33 - 125 - else - { //set the character to look back at, never use the random ones! - if (i == 1 || i == 14) - cchar = (char)challenge[i]; - else - cchar = (char)challenge[i-1]; - chalrand = abs((challenge[((i * challenge[i]) + GT2ChallengeKey[(i + challenge[i]) % keylen]) % GTI2_CHALLENGE_LEN] ^ GT2ChallengeKey[(i * 17991 * cchar) % keylen])); - buffer[i] = (GT2Byte)(33 + chalrand % 93); - } - } - return buffer; -} - - -GT2Bool gti2CheckResponse -( - const GT2Byte * response1, - const GT2Byte * response2 -) -{ - int i; //when comparing ignore the ones that are random - for (i = 0 ; i < GTI2_RESPONSE_LEN ; i++) - { - if (i != 0 && i != 13 && response1[i] != response2[i]) - return GT2False; - } - return GT2True; -} - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Auth.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Auth.h deleted file mode 100644 index 8d3134d6427..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Auth.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_AUTH_H_ -#define _GT2_AUTH_H_ - -#define GTI2_CHALLENGE_LEN 32 -#define GTI2_RESPONSE_LEN 32 - -#ifdef __cplusplus -extern "C" { -#endif - -GT2Byte * gti2GetChallenge -( - GT2Byte * buffer -); - -GT2Byte * gti2GetResponse -( - GT2Byte * buffer, - const GT2Byte * challenge -); - -GT2Bool gti2CheckResponse -( - const GT2Byte * response1, - const GT2Byte * response2 -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Buffer.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Buffer.c deleted file mode 100644 index 43821a41042..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Buffer.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Buffer.h" -#include - -GT2Bool gti2AllocateBuffer(GTI2Buffer * buffer, int size) -{ - buffer->buffer = (GT2Byte *)gsimalloc((unsigned int)size); - if(!buffer->buffer) - return GT2False; - buffer->size = size; - - return GT2True; -} - -int gti2GetBufferFreeSpace(const GTI2Buffer * buffer) -{ - return (buffer->size - buffer->len); -} - -void gti2BufferWriteByte(GTI2Buffer * buffer, GT2Byte b) -{ - assert(buffer->len < buffer->size); -#if 0 - if(buffer->len >= buffer->size) - return; -#endif - - buffer->buffer[buffer->len++] = b; -} - -void gti2BufferWriteUShort(GTI2Buffer * buffer, unsigned short s) -{ - assert((buffer->len + 2) <= buffer->size); -#if 0 - if((buffer->len + 2) > buffer->size) - return; -#endif - - buffer->buffer[buffer->len++] = (GT2Byte)((s >> 8) & 0xFF); - buffer->buffer[buffer->len++] = (GT2Byte)(s & 0xFF); -} - -void gti2BufferWriteData(GTI2Buffer * buffer, const GT2Byte * data, int len) -{ - if(!data || !len) - return; - - if(len == -1) - len = (int)strlen((const char *)data); - - assert((buffer->len + len) <= buffer->size); -#if 0 - if(buffer->len >= buffer->size) - return; -#endif - - memcpy(buffer->buffer + buffer->len, data, (unsigned int)len); - buffer->len += len; -} - -void gti2BufferShorten(GTI2Buffer * buffer, int start, int shortenBy) -{ - if(start == -1) - start = (buffer->len - shortenBy); - - assert(start <= buffer->len); - assert(shortenBy <= (buffer->len - start)); - - memmove(buffer->buffer + start, buffer->buffer + start + shortenBy, (unsigned int)(buffer->len - start - shortenBy)); - buffer->len -= shortenBy; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Buffer.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Buffer.h deleted file mode 100644 index d93f39270f1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Buffer.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_BUFFER_H_ -#define _GT2_BUFFER_H_ - -#include "gt2Main.h" - -GT2Bool gti2AllocateBuffer(GTI2Buffer * buffer, int size); - -int gti2GetBufferFreeSpace(const GTI2Buffer * buffer); - -void gti2BufferWriteByte(GTI2Buffer * buffer, GT2Byte b); -void gti2BufferWriteUShort(GTI2Buffer * buffer, unsigned short s); -void gti2BufferWriteData(GTI2Buffer * buffer, const GT2Byte * data, int len); - -// shortens the buffer by "shortenBy" (length, not size) -void gti2BufferShorten(GTI2Buffer * buffer, int start, int shortenBy); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Callback.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Callback.c deleted file mode 100644 index b42e03651ff..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Callback.c +++ /dev/null @@ -1,431 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Callback.h" -#include "gt2Socket.h" - -/********************* -** SOCKET CALLBACKS ** -*********************/ - -GT2Bool gti2SocketErrorCallback -( - GT2Socket socket -) -{ - assert(socket); - if(!socket) - return GT2True; - - if(!socket->socketErrorCallback) - return GT2True; - - socket->callbackLevel++; - - socket->socketErrorCallback(socket); - - socket->callbackLevel--; - - // check if the socket should be closed - if(socket->close && !socket->callbackLevel) - { - gti2CloseSocket(socket); - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2ConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -) -{ - assert(socket && connection); - if(!socket || !connection) - return GT2True; - - if(!socket->connectAttemptCallback) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - socket->callbackLevel++; - connection->callbackLevel++; - - socket->connectAttemptCallback(socket, connection, ip, port, latency, message, len); - - socket->callbackLevel--; - connection->callbackLevel--; - - // check if the socket should be closed - if(socket->close && !socket->callbackLevel) - { - gti2CloseSocket(socket); - return GT2False; - } - - return GT2True; -} - -/************************* -** CONNECTION CALLBACKS ** -*************************/ - -GT2Bool gti2ConnectedCallback -( - GT2Connection connection, - GT2Result result, - GT2Byte * message, - int len -) -{ - assert(connection); - if(!connection) - return GT2True; - - // store the result - connection->connectionResult = result; - - if(!connection->callbacks.connected) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - connection->callbackLevel++; - connection->socket->callbackLevel++; - - connection->callbacks.connected(connection, result, message, len); - - connection->callbackLevel--; - connection->socket->callbackLevel--; - - // check if the socket should be closed - if(connection->socket->close && !connection->socket->callbackLevel) - { - gti2CloseSocket(connection->socket); - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2ReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - assert(connection); - if(!connection) - return GT2True; - - if(!connection->callbacks.received) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - connection->callbackLevel++; - connection->socket->callbackLevel++; - - connection->callbacks.received(connection, message, len, reliable); - - connection->callbackLevel--; - connection->socket->callbackLevel--; - - // check if the socket should be closed - if(connection->socket->close && !connection->socket->callbackLevel) - { - gti2CloseSocket(connection->socket); - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2ClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - assert(connection); - if(!connection) - return GT2True; - - if(!connection->callbacks.closed) - return GT2True; - - connection->callbackLevel++; - connection->socket->callbackLevel++; - - connection->callbacks.closed(connection, reason); - - connection->callbackLevel--; - connection->socket->callbackLevel--; - - // check if the socket should be closed - if(connection->socket->close && !connection->socket->callbackLevel) - { - gti2CloseSocket(connection->socket); - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2PingCallback -( - GT2Connection connection, - int latency -) -{ - assert(connection); - if(!connection) - return GT2True; - - if(!connection->callbacks.ping) - return GT2True; - - connection->callbackLevel++; - connection->socket->callbackLevel++; - - connection->callbacks.ping(connection, latency); - - connection->callbackLevel--; - connection->socket->callbackLevel--; - - // check if the socket should be closed - if(connection->socket->close && !connection->socket->callbackLevel) - { - gti2CloseSocket(connection->socket); - return GT2False; - } - - return GT2True; -} - -/********************* -** FILTER CALLBACKS ** -*********************/ - -GT2Bool gti2SendFilterCallback -( - GT2Connection connection, - int filterID, - const GT2Byte * message, - int len, - GT2Bool reliable -) -{ - gt2SendFilterCallback * callback; - - assert(connection); - if(!connection) - return GT2True; - - callback = (gt2SendFilterCallback *)ArrayNth(connection->sendFilters, filterID); - if(!callback) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - connection->callbackLevel++; - connection->socket->callbackLevel++; - - (*callback)(connection, filterID, message, len, reliable); - - connection->callbackLevel--; - connection->socket->callbackLevel--; - - // check if the socket should be closed - if(connection->socket->close && !connection->socket->callbackLevel) - { - gti2CloseSocket(connection->socket); - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2ReceiveFilterCallback -( - GT2Connection connection, - int filterID, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - gt2ReceiveFilterCallback * callback; - - assert(connection); - if(!connection) - return GT2True; - - callback = (gt2ReceiveFilterCallback *)ArrayNth(connection->receiveFilters, filterID); - if(!callback) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - connection->callbackLevel++; - connection->socket->callbackLevel++; - - (*callback)(connection, filterID, message, len, reliable); - - connection->callbackLevel--; - connection->socket->callbackLevel--; - - // check if the socket should be closed - if(connection->socket->close && !connection->socket->callbackLevel) - { - gti2CloseSocket(connection->socket); - return GT2False; - } - - return GT2True; -} - -/******************* -** DUMP CALLBACKS ** -*******************/ - -GT2Bool gti2DumpCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - GT2Bool reset, - const GT2Byte * message, - int len, - GT2Bool send -) -{ - gt2DumpCallback callback; - - assert(socket); - if(!socket) - return GT2True; - - if(send) - callback = socket->sendDumpCallback; - else - callback = socket->receiveDumpCallback; - - if(!callback) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - socket->callbackLevel++; - if(connection) - connection->callbackLevel++; - - callback(socket, connection, ip, port, reset, message, len); - - socket->callbackLevel--; - if(connection) - connection->callbackLevel--; - - // check if the socket should be closed - if(socket->close && !socket->callbackLevel) - { - gti2CloseSocket(socket); - return GT2False; - } - - return GT2True; -} - -/***************************** -** SOCKET SHARING CALLBACKS ** -*****************************/ - -GT2Bool gti2UnrecognizedMessageCallback -( - GT2Socket socket, - unsigned int ip, - unsigned short port, - GT2Byte * message, - int len, - GT2Bool * handled -) -{ - *handled = GT2False; - - assert(socket); - if(!socket) - return GT2True; - - if(!socket->unrecognizedMessageCallback) - return GT2True; - - // check for an empty message - if(!len || !message) - { - message = NULL; - len = 0; - } - - socket->callbackLevel++; - - *handled = socket->unrecognizedMessageCallback(socket, ip, port, message, len); - - socket->callbackLevel--; - - // check if the socket should be closed - if(socket->close && !socket->callbackLevel) - { - gti2CloseSocket(socket); - return GT2False; - } - - return GT2True; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Callback.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Callback.h deleted file mode 100644 index f1a74cc5b95..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Callback.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_CALLBACK_H_ -#define _GT2_CALLBACK_H_ - -#include "gt2Main.h" - -/********************* -** SOCKET CALLBACKS ** -*********************/ - -GT2Bool gti2SocketErrorCallback -( - GT2Socket socket -); - -GT2Bool gti2ConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -); - -/************************* -** CONNECTION CALLBACKS ** -*************************/ - -GT2Bool gti2ConnectedCallback -( - GT2Connection connection, - GT2Result result, - GT2Byte * message, - int len -); - -GT2Bool gti2ReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -); - -GT2Bool gti2ClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -); - -GT2Bool gti2PingCallback -( - GT2Connection connection, - int latency -); - -/********************* -** FILTER CALLBACKS ** -*********************/ - -GT2Bool gti2SendFilterCallback -( - GT2Connection connection, - int filterID, - const GT2Byte * message, - int len, - GT2Bool reliable -); - -GT2Bool gti2ReceiveFilterCallback -( - GT2Connection connection, - int filterID, - GT2Byte * message, - int len, - GT2Bool reliable -); - -/******************* -** DUMP CALLBACKS ** -*******************/ - -GT2Bool gti2DumpCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - GT2Bool reset, - const GT2Byte * message, - int len, - GT2Bool send -); - -/***************************** -** SOCKET SHARING CALLBACKS ** -*****************************/ - -GT2Bool gti2UnrecognizedMessageCallback -( - GT2Socket socket, - unsigned int ip, - unsigned short port, - GT2Byte * message, - int len, - GT2Bool * handled -); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Connection.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Connection.c deleted file mode 100644 index a17d54bb193..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Connection.c +++ /dev/null @@ -1,343 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Connection.h" -#include "gt2Socket.h" -#include "gt2Message.h" -#include "gt2Callback.h" -#include "gt2Utility.h" -#include - -GT2Result gti2NewOutgoingConnection(GT2Socket socket, GT2Connection * connection, unsigned int ip, unsigned short port) -{ - GT2Result result; - - // create the object - result = gti2NewSocketConnection(socket, connection, ip, port); - if(result != GT2Success) - return result; - - // set initial states - (*connection)->state = GTI2AwaitingServerChallenge; - (*connection)->initiated = GT2True; - - return GT2Success; -} - -GT2Result gti2NewIncomingConnection(GT2Socket socket, GT2Connection * connection, unsigned int ip, unsigned short port) -{ - GT2Result result; - - // create the object - result = gti2NewSocketConnection(socket, connection, ip, port); - if(result != GT2Success) - return result; - - // set initial states - (*connection)->state = GTI2AwaitingClientChallenge; - (*connection)->initiated = GT2False; - - return GT2Success; -} - -GT2Result gti2StartConnectionAttempt -( - GT2Connection connection, - const GT2Byte * message, - int len, - GT2ConnectionCallbacks * callbacks -) -{ - char challenge[GTI2_CHALLENGE_LEN]; - - // check the message and len - gti2MessageCheck(&message, &len); - - // copy off the message - if(len > 0) - { - connection->initialMessage = (char *)gsimalloc((unsigned int)len); - if(!connection->initialMessage) - return GT2OutOfMemory; - - memcpy(connection->initialMessage, message, (unsigned int)len); - connection->initialMessageLen = len; - } - - // copy the callbacks - if(callbacks) - connection->callbacks = *callbacks; - - // generate a challenge - gti2GetChallenge((GT2Byte *)challenge); - - // generate and store the expected response - gti2GetResponse((GT2Byte *)connection->response, (GT2Byte *)challenge); - - // send the client challenge - gti2SendClientChallenge(connection, challenge); - - // update our state - connection->state = GTI2AwaitingServerChallenge; - - return GT2Success; -} - -GT2Bool gti2AcceptConnection(GT2Connection connection, GT2ConnectionCallbacks * callbacks) -{ - // was the connection already closed? - if(connection->freeAtAcceptReject) - { - // clear the flag - connection->freeAtAcceptReject = GT2False; - - // let the app know if was already closed - return GT2False; - } - - // make sure this flag gets cleared - connection->freeAtAcceptReject = GT2False; - - // check that we're still awaiting this - if(connection->state != GTI2AwaitingAcceptReject) - return GT2False; - - // let the other side know - gti2SendAccept(connection); - - // update our state - connection->state = GTI2Connected; - - // store the callbacks - if(callbacks) - connection->callbacks = *callbacks; - - return GT2True; -} - -void gti2RejectConnection(GT2Connection connection, const GT2Byte * message, int len) -{ - // make sure this flag gets cleared - connection->freeAtAcceptReject = GT2False; - - // check that we're still awaiting this - if(connection->state != GTI2AwaitingAcceptReject) - return; - - // check the message and len - gti2MessageCheck(&message, &len); - - // let the other side know - gti2SendReject(connection, message, len); - - // update our state - connection->state = GTI2Closing; -} - -GT2Bool gti2ConnectionSendData(GT2Connection connection, const GT2Byte * message, int len) -{ - // send the data on the socket - if(!gti2SocketSend(connection->socket, connection->ip, connection->port, message, len)) - return GT2False; - - // mark the time (used for keep-alives) - connection->lastSend = current_time(); - - return GT2True; -} - -static GT2Bool gti2CheckTimeout(GT2Connection connection, gsi_time now) -{ - // are we still trying to connect? - if(connection->state < GTI2Connected) - { - GT2Bool timedOut = GT2False; - - // is this the initiator - if(connection->initiated) - { - // do we have a timeout? - if(connection->timeout) - { - // check the time taken against the timeout - if((now - connection->startTime) > connection->timeout) - timedOut = GT2True; - } - } - else - { - // don't time them out if they're waiting for us - if(connection->state < GTI2AwaitingAcceptReject) - { - // check the time taken against the timeout - if((now - connection->startTime) > GTI2_SERVER_TIMEOUT) - timedOut = GT2True; - } - } - - // check if we timed out - if(timedOut) - { - // let them know - gti2SendClosed(connection); - - // mark it as closed - gti2ConnectionClosed(connection); - - // call the callback - if(!gti2ConnectedCallback(connection, GT2TimedOut, NULL, 0)) - return GT2False; - } - } - - return GT2True; -} - -static GT2Bool gti2SendRetries(GT2Connection connection, gsi_time now) -{ - int i; - int len; - GTI2OutgoingBufferMessage * message; - - // go through the list of outgoing messages awaiting confirmation - len = ArrayLength(connection->outgoingBufferMessages); - for(i = 0 ; i < len ; i++) - { - // get the message - message = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, i); - - // check if it's time to resend it - if((now - message->lastSend) > GTI2_RESEND_TIME) - { - if(!gti2ResendMessage(connection, message)) - return GT2False; - } - } - - return GT2True; -} - -static GT2Bool gti2CheckPendingAck(GT2Connection connection, gsi_time now) -{ - // check for nothing pending - if(!connection->pendingAck) - return GT2True; - - // check how long it has been pending - if((now - connection->pendingAckTime) > GTI2_PENDING_ACK_TIME) - { - if(!gti2SendAck(connection)) - return GT2False; - } - - return GT2True; -} - -static GT2Bool gti2CheckKeepAlive(GT2Connection connection, gsi_time now) -{ - if((now - connection->lastSend) > GTI2_KEEP_ALIVE_TIME) - { - if(!gti2SendKeepAlive(connection)) - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2ConnectionThink(GT2Connection connection, gsi_time now) -{ - // check timeout - if(!gti2CheckTimeout(connection, now)) - return GT2False; - - // check keep alives - if(!gti2CheckKeepAlive(connection, now)) - return GT2False; - - // send retries - if(!gti2SendRetries(connection, now)) - return GT2False; - - // check the pending ack - if(!gti2CheckPendingAck(connection, now)) - return GT2False; - - return GT2True; -} - -void gti2CloseConnection(GT2Connection connection, GT2Bool hard) -{ - // check if it should be hard or soft closed - if(hard) - { - // check if it's already closed - if(connection->state >= GTI2Closed) - return; - - // mark it as closed - gti2ConnectionClosed(connection); - - // send a closed message - gti2SendClosed(connection); - - // call the callback - gti2ClosedCallback(connection, GT2LocalClose); - - // try and free it - gti2FreeSocketConnection(connection); - } - else - { - // mark it as closing - connection->state = GTI2Closing; - - // send the close - gti2SendClose(connection); - } -} - -void gti2ConnectionClosed(GT2Connection connection) -{ - // check for already closed - if(connection->state == GTI2Closed) - return; - - // mark the connection as closed - connection->state = GTI2Closed; - - // remove it from the connected list - TableRemove(connection->socket->connections, &connection); - - // add it to the closed list - ArrayAppend(connection->socket->closedConnections, &connection); -} - -void gti2ConnectionCleanup(GT2Connection connection) -{ - if(connection->initialMessage) - gsifree(connection->initialMessage); - - if(connection->incomingBuffer.buffer) - gsifree(connection->incomingBuffer.buffer); - if(connection->outgoingBuffer.buffer) - gsifree(connection->outgoingBuffer.buffer); - - if(connection->incomingBufferMessages) - ArrayFree(connection->incomingBufferMessages); - if(connection->outgoingBufferMessages) - ArrayFree(connection->outgoingBufferMessages); - - if(connection->sendFilters) - ArrayFree(connection->sendFilters); - if(connection->receiveFilters) - ArrayFree(connection->receiveFilters); - - gsifree(connection); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Connection.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Connection.h deleted file mode 100644 index 43423f348e5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Connection.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_CONNECTION_H_ -#define _GT2_CONNECTION_H_ - -#include "gt2Main.h" - -GT2Result gti2NewOutgoingConnection(GT2Socket socket, GT2Connection * connection, unsigned int ip, unsigned short port); -GT2Result gti2NewIncomingConnection(GT2Socket socket, GT2Connection * connection, unsigned int ip, unsigned short port); - -GT2Result gti2StartConnectionAttempt -( - GT2Connection connection, - const GT2Byte * message, - int len, - GT2ConnectionCallbacks * callbacks -); - -GT2Bool gti2AcceptConnection(GT2Connection connection, GT2ConnectionCallbacks * callbacks); - -void gti2RejectConnection(GT2Connection connection, const GT2Byte * message, int len); - -GT2Bool gti2ConnectionSendData(GT2Connection connection, const GT2Byte * message, int len); - -GT2Bool gti2ConnectionThink(GT2Connection connection, gsi_time now); - -void gti2CloseConnection(GT2Connection connection, GT2Bool hard); - -void gti2ConnectionClosed(GT2Connection connection); - -void gti2ConnectionCleanup(GT2Connection connection); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Encode.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Encode.c deleted file mode 100644 index aa2f2cea47b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Encode.c +++ /dev/null @@ -1,648 +0,0 @@ -#include -#include -#include "gt2Encode.h" -#include "gt2Main.h" - - - -// This handles alignment issues and endianess -void gt2MemCopy16(char *out, char const *in) -{ - #ifdef _GT2_ENDIAN_CONVERT - *out = in[1]; - out[1] = *in; - #else - // straight copy - *out = *in; - out[1] = in[1]; - #endif -} - -// This handles alignment issues and endianess -void gt2MemCopy32(char *out, char const *in) -{ - #ifdef _GT2_ENDIAN_CONVERT - out[0] = in[3]; - out[1] = in[2]; - out[2] = in[1]; - out[3] = in[0]; - #else - // straight copy - *out = *in; - out[1] = in[1]; - out[2] = in[2]; - out[3] = in[3]; - #endif -} - -// This handles alignment issues and endianess -void gt2MemCopy64(char *out, char const *in) -{ - #ifdef _GT2_ENDIAN_CONVERT - out[0] = in[7]; - out[1] = in[6]; - out[2] = in[5]; - out[3] = in[4]; - out[4] = in[3]; - out[5] = in[2]; - out[6] = in[1]; - out[7] = in[0]; - #else - // straight copy - memcpy(out, in, 8); - #endif - -} -void gt2MemCopy(char *out, char const *in, int size) -{ - if (size == 2) - { - gt2MemCopy16(out, in); - } - else - if (size == 4) - { - gt2MemCopy32(out, in); - } - else - if (size == 8) - { - gt2MemCopy64(out, in); - } - else - { - // warning... no endianess decode. - memcpy(out,in,(size_t)size); - } -} -#if defined(_PS2) || defined(_UNIX) || defined(_PS3) || defined(_WIN64) || defined(_X360) - -#define GT_ENCODE_ELEM(TYPE,b,l,args) \ -{ \ - TYPE v; \ - if (l < sizeof(TYPE)) \ - return -1; \ - v = (TYPE)va_arg(*args, int); \ - gt2MemCopy(b, (const char *)&v, sizeof(TYPE)); \ - return (int)sizeof(TYPE); \ -} - -#define GT_DECODE_ELEM(TYPE,b,l,args) \ -{ \ - TYPE* v; \ - if (l < sizeof(TYPE)) \ - return -1; \ - v = va_arg(*args, TYPE*); \ - gt2MemCopy((char *)v, b, sizeof(TYPE)); \ - return (int)sizeof(TYPE); \ -} - -#define GT_ENCODE_ELEM_NC(TYPE,b,l,args) \ -{ \ - TYPE v; \ - if (l < sizeof(TYPE)) \ - return -1; \ - v = (TYPE)va_arg(*args, int); \ - memcpy(b, &v, sizeof(TYPE)); \ - return (int)sizeof(TYPE); \ -} - -#define GT_DECODE_ELEM_NC(TYPE,b,l,args) \ -{ \ - TYPE* v; \ - if (l < sizeof(TYPE)) \ - return -1; \ - v = va_arg(*args, TYPE*); \ - memcpy(v, b, sizeof(TYPE)); \ - return (int)sizeof(TYPE); \ -} - -#else - -#define GT_ENCODE_ELEM(TYPE,b,l,args) {if (l < sizeof(TYPE)) return -1; gt2MemCopy(b,(const char *)&va_arg(*args,TYPE),sizeof(TYPE)); return sizeof(TYPE);} -#define GT_DECODE_ELEM(TYPE,b,l,args) {if (l < sizeof(TYPE)) return -1; gt2MemCopy((char *)va_arg(*args,TYPE*),b,sizeof(TYPE)); return sizeof(TYPE);} -// nc = no endian convert -#define GT_ENCODE_ELEM_NC(TYPE,b,l,args) {if (l < sizeof(TYPE)) return -1; memcpy(b,&va_arg(*args,TYPE),sizeof(TYPE)); return sizeof(TYPE);} -#define GT_DECODE_ELEM_NC(TYPE,b,l,args) {if (l < sizeof(TYPE)) return -1; memcpy(va_arg(*args,TYPE*),b,sizeof(TYPE)); return sizeof(TYPE);} - -#endif /* _PS || _UNIX */ - -static int dbstrlen(GT_DBSTR_TYPE dbstr) -{ - int len = 0; -#ifdef ALIGNED_COPY - short achar; - do - { - memcpy(&achar, dbstr, sizeof(achar)); - dbstr++; - len++; - } while (achar != 0); - len--; -#else - while (*dbstr++) - len++; -#endif - return len; -} - -static short *dbstrcpy(GT_DBSTR_TYPE dest, GT_DBSTR_TYPE src) -{ - GT_DBSTR_TYPE hold = dest; - #ifdef ALIGNED_COPY - int len = dbstrlen(src); - memcpy(dest, src, (unsigned int)(len + 1) * 2); - #else - while ((*dest++ = *src++) != 0) ; - #endif - return hold; -} - -static int gtiDecodeBits(int bitcount, char *inBuffer, int inLength, va_list *args) -{ - char bucket; - int i; - - if (inLength < 1) - return -1; - bucket = *inBuffer; - for (i = 0 ; i < bitcount ; i++) - { - *va_arg(*args,char*) = (char)((bucket & (1 << i)) ? 1 : 0); - } - - return 1; -} - -static int gtiEncodeBits(int bitcount, char *outBuffer, int outLength, va_list *args) -{ - char bucket = 0; - int i; - - if (outLength < 1) - return -1; - for (i = 0 ; i < bitcount ; i++) - { - bucket |= (char)((va_arg(*args,int) ? 1 : 0) << i); - //bucket |= ((va_arg(*args,char) ? 1 : 0) << i); - } - *outBuffer = bucket; - return 1; -} - -// length in bytes including NUL, or -1 if error -static int gtiCheckStringLen(char *inBuffer, int inLength) -{ - int len = 0; - do - { - len++; - if(len > inLength) - return -1; - } - while(inBuffer[len - 1] != '\0'); - return len; -} - -// length in bytes (not chars) including NUL, or -1 if error -static int gtiCheckDoubleStringLen(char *inBuffer, int inLength) -{ - int len = 0; - do - { - len += 2; - if(len > inLength) - return -1; - } - while((inBuffer[len - 2] != '\0') || (inBuffer[len - 1] != '\0')); - return len; -} - -// length in bytes including NULs, or -1 if error -static int gtiCheckStringArrayLen(char *inBuffer, int inLength) -{ - int len = 0; - int strLen; - do - { - strLen = gtiCheckStringLen(inBuffer + len, inLength - len); - if(strLen == -1) - return -1; - len += strLen; - } - while(strLen > 1); - return len; -} - -static int gtiDecodeSingle(char elemType, char *inBuffer, int inLength, va_list *args) -{ - switch (elemType) - { - case GT_INT: - GT_DECODE_ELEM(GT_INT_TYPE,inBuffer, inLength, args); - //break; - case GT_UINT: - GT_DECODE_ELEM(GT_UINT_TYPE,inBuffer, inLength, args); - //break; - case GT_SHORT: - GT_DECODE_ELEM(GT_SHORT_TYPE,inBuffer, inLength, args); - //break; - case GT_USHORT: - GT_DECODE_ELEM(GT_USHORT_TYPE,inBuffer, inLength, args); - //break; - case GT_CHAR: - GT_DECODE_ELEM(GT_CHAR_TYPE,inBuffer, inLength, args); - //break; - case GT_UCHAR: - GT_DECODE_ELEM(GT_UCHAR_TYPE,inBuffer, inLength, args); - //break; - case GT_FLOAT: - { - #if(0) - // no endian convert - GT_FLOAT_TYPE* v; - if (inLength < sizeof(GT_FLOAT_TYPE)) - return -1; - v = va_arg(*args, GT_FLOAT_TYPE*); - v[0] = inBuffer[0]; - v[1] = inBuffer[1]; - v[2] = inBuffer[2]; - v[3] = inBuffer[3]; - return (int)sizeof(GT_FLOAT_TYPE); - #else - GT_DECODE_ELEM_NC(GT_FLOAT_TYPE,inBuffer, inLength, args); - #endif - } - case GT_DOUBLE: - #if(0) - // no endian convert - { GT_DOUBLE_TYPE* v; - if (inLength < sizeof(GT_DOUBLE_TYPE)) - return -1; - v = va_arg(*args, GT_DOUBLE_TYPE*); - v[0] = inBuffer[0]; - v[1] = inBuffer[1]; - v[2] = inBuffer[2]; - v[3] = inBuffer[3]; - v[4] = inBuffer[4]; - v[5] = inBuffer[5]; - v[6] = inBuffer[6]; - v[7] = inBuffer[7]; - return (int)sizeof(GT_DOUBLE_TYPE); - } - #else - GT_DECODE_ELEM_NC(GT_DOUBLE_TYPE,inBuffer, inLength, args); - #endif - //break; - case GT_BIT: - GT_DECODE_ELEM(GT_BIT_TYPE,inBuffer, inLength, args); - //break; - case GT_CSTR: - { - int len; - GT_CSTR_TYPE s = va_arg(*args, GT_CSTR_TYPE); - assert(s != NULL); - len = gtiCheckStringLen(inBuffer, inLength); - if(len == -1) - return -1; - memcpy(s, inBuffer, (size_t)len); - return len; - } - //break; - case GT_CSTR_PTR: - *va_arg(*args, GT_CSTR_PTR_TYPE) = (GT_CSTR_TYPE)inBuffer; - return gtiCheckStringLen(inBuffer, inLength); - //break; - case GT_DBSTR: - { - int len; - GT_DBSTR_TYPE s = va_arg(*args, GT_DBSTR_TYPE); - assert(s != NULL); - len = gtiCheckDoubleStringLen(inBuffer, inLength); - if (len == -1) - return -1; - memcpy(s, inBuffer, (size_t)len); - return len; - } - //break; - case GT_DBSTR_PTR: - *va_arg(*args, GT_DBSTR_PTR_TYPE) = (GT_DBSTR_TYPE)inBuffer; - return gtiCheckDoubleStringLen(inBuffer, inLength); - //break; - case GT_CSTR_ARRAY: - { - int len; - GT_CSTR_ARRAY_TYPE s = va_arg(*args, GT_CSTR_ARRAY_TYPE); - assert(s != NULL); - len = gtiCheckStringArrayLen(inBuffer, inLength); - if(len == -1) - return -1; - memcpy(s, inBuffer, (size_t)len); - return len; - } - //break; - case GT_CSTR_ARRAY_PTR: - *va_arg(*args, GT_CSTR_ARRAY_PTR_TYPE) = (GT_CSTR_ARRAY_TYPE)inBuffer; - return gtiCheckStringArrayLen(inBuffer, inLength); - //break; - case GT_RAW: - { - int *len, holdlen; - GT_RAW_TYPE data = va_arg(*args, GT_RAW_TYPE); - len = va_arg(*args, int *); - if (inLength < sizeof(*len)) - return -1; - holdlen = *len; - memcpy(len, inBuffer, sizeof(*len)); - if (*len > holdlen) //there isn't enough room in their dest! - return -1; - if (inLength < (int)sizeof(*len) + *len) - return -1; - memcpy(data, inBuffer + sizeof(*len), (unsigned int)*len); - return *len + (int)sizeof(*len); - } - case GT_RAW_PTR: - { - int *len; - *va_arg(*args, GT_RAW_PTR_TYPE) = (GT_RAW_TYPE)(inBuffer + sizeof(*len)); - len = va_arg(*args, int *); - if (inLength < sizeof(*len)) - return -1; - memcpy(len, inBuffer, sizeof(*len)); - return *len + (int)sizeof(*len); - } - //break; - - } - return -1; //bad type! -} - -static int gtiEncodeSingle(char elemType, char *outBuffer, int outLength, va_list *args) -{ - switch (elemType) - { - case GT_INT: - GT_ENCODE_ELEM(GT_INT_TYPE,outBuffer, outLength, args); - //break; - case GT_UINT: - GT_ENCODE_ELEM(GT_UINT_TYPE,outBuffer, outLength, args); - //break; - case GT_SHORT: - GT_ENCODE_ELEM(GT_SHORT_TYPE,outBuffer, outLength, args); - //break; - case GT_USHORT: - GT_ENCODE_ELEM(GT_USHORT_TYPE,outBuffer, outLength, args); - //break; - case GT_CHAR: - GT_ENCODE_ELEM(GT_CHAR_TYPE,outBuffer, outLength, args); - //break; - case GT_UCHAR: - GT_ENCODE_ELEM(GT_UCHAR_TYPE,outBuffer, outLength, args); - //break; - case GT_FLOAT: //floats are promoted to double in varargs, need to demote - { - double temp; - float f; - double v = va_arg(*args,double); - memcpy(&temp,&v,sizeof(double)); - f = (float)temp; - if (outLength < sizeof(float)) - return -1; - memcpy(outBuffer, &f, sizeof(float)); - return sizeof(float); - } - //break; - case GT_DOUBLE: - { - double v; - if(outLength < sizeof(double)) - return -1; - v = va_arg(*args, double); - memcpy(outBuffer, &v, sizeof(double)); - return sizeof(double); - } - //break; - case GT_BIT: - GT_ENCODE_ELEM(GT_BIT_TYPE,outBuffer, outLength, args); - //break; - case GT_CSTR: - case GT_CSTR_PTR: - { - int len; - GT_CSTR_TYPE s = va_arg(*args, GT_CSTR_TYPE); - assert(s != NULL); - len = (int)strlen(s) + 1; - if (outLength < len ) - return -1; - strcpy(outBuffer, s); - return len; - } - //break; - case GT_DBSTR: - case GT_DBSTR_PTR: - { - int len; - GT_DBSTR_TYPE s = va_arg(*args, GT_DBSTR_TYPE); - assert(s != NULL); - len = dbstrlen(s) + 1; - if (outLength < len * 2) - return -1; - dbstrcpy((short *)outBuffer, s); - return len * 2; - } - //break; - case GT_CSTR_ARRAY: - case GT_CSTR_ARRAY_PTR: - { - int len = 0; - int strLen; - GT_CSTR_ARRAY_TYPE s = va_arg(*args, GT_CSTR_ARRAY_TYPE); - assert(s != NULL); - do - { - strLen = (int)strlen(s + len) + 1; - len += strLen; - if(outLength < len) - return -1; - } - while(strLen != 1); - memcpy(outBuffer, s, (size_t)len); - return len; - } - //break; - case GT_RAW: - case GT_RAW_PTR: - { - int len; - GT_RAW_TYPE data = va_arg(*args, GT_RAW_TYPE); - len = va_arg(*args, int); - if (outLength < len + (int)sizeof(len)) - return -1; - memcpy(outBuffer, &len, sizeof(len)); - memcpy(outBuffer + sizeof(len), data, (unsigned int)len); - return len + (int)sizeof(len); - } - - } - return -1; //bad type! -} - -static int gtInternalEncodeV(int usetype, GTMessageType msgType, const char *fmtString, char *outBuffer, int outLength, va_list *args) -{ - int elemSize; - int totSize = outLength; - const char *bitCounter; - - //set the message type - if (usetype) - { - elemSize = sizeof(msgType); - if (outLength < elemSize) - return -1; - - gt2MemCopy(outBuffer, (const char *)&msgType, elemSize); - outBuffer += elemSize; - outLength -= elemSize; - } - while (*fmtString) - { - if (*fmtString == GT_BIT) //see how many - { - for (bitCounter = fmtString; *bitCounter == GT_BIT && bitCounter - fmtString <= 8; bitCounter++) - {}; - elemSize = gtiEncodeBits((int)(bitCounter - fmtString), outBuffer, outLength, args); - fmtString = bitCounter - 1; - } else - elemSize = gtiEncodeSingle(*fmtString, outBuffer, outLength, args); - if (elemSize < 0) - return -1; //out of space - outBuffer += elemSize; - outLength -= elemSize; - fmtString++; - } - return totSize - outLength; -} - -int gtEncodeNoTypeV(const char *fmtString, char *outBuffer, int outLength, va_list *args) -{ - return gtInternalEncodeV(0,0,fmtString, outBuffer, outLength, args); -} - -int gtEncodeV(GTMessageType msgType, const char *fmtString, char *outBuffer, int outLength, va_list *args) -{ - return gtInternalEncodeV(1,msgType,fmtString, outBuffer, outLength, args); -} - -int gtEncode(GTMessageType msgType, const char *fmtString, char *outBuffer, int outLength, ...) -{ - int rcode; - va_list args; - - //set the values - va_start(args, outLength); - rcode = gtEncodeV(msgType, fmtString, outBuffer, outLength, &args); - va_end(args); - - return rcode; -} - -int gtEncodeNoType(const char *fmtString, char *outBuffer, int outLength, ...) -{ - int rcode; - va_list args; - - //set the values - va_start(args, outLength); - rcode = gtEncodeNoTypeV(fmtString, outBuffer, outLength, &args); - va_end(args); - - return rcode; -} - -static int gtDecodeInternalV(int usetype, const char *fmtString, char *inBuffer, int inLength, va_list *args) -{ - int elemSize; - int totSize = inLength; - const char *bitCounter; - - //skip the message type - if (usetype) - { - inBuffer += sizeof(GTMessageType); - inLength -= sizeof(GTMessageType); - } - - while (*fmtString) - { - if (*fmtString == GT_BIT) //see how many - { - for (bitCounter = fmtString; *bitCounter == GT_BIT && bitCounter - fmtString <= 8; bitCounter++) - {}; - elemSize = gtiDecodeBits((int)(bitCounter - fmtString), inBuffer, inLength, args); - fmtString = bitCounter - 1; - } else - elemSize = gtiDecodeSingle(*fmtString, inBuffer, inLength, args); - if (elemSize < 0) - return -1; //out of space - inBuffer += elemSize; - inLength -= elemSize; - fmtString++; - } - //NOTE: inLength should be 0 here if we "ate" the whole message - //If it's not 0, then the encoding and decoding strings probably did not match - //which would generally indicate a bug - //PANTS - commented out because we could be decoding the rest with a gtDecodeNoType -// assert(inLength == 0); - return totSize - inLength; -} - -int gtDecodeV(const char *fmtString, char *inBuffer, int inLength, va_list *args) -{ - return gtDecodeInternalV(1,fmtString, inBuffer, inLength, args); -} - -int gtDecodeNoTypeV(const char *fmtString, char *inBuffer, int inLength, va_list *args) -{ - return gtDecodeInternalV(0,fmtString, inBuffer, inLength, args); -} - -int gtDecode(const char *fmtString, char *inBuffer, int inLength, ...) -{ - int rcode; - va_list args; - - //set the values - va_start(args, inLength); - rcode = gtDecodeV(fmtString, inBuffer, inLength, &args); - va_end(args); - - return rcode; -} - -int gtDecodeNoType(const char *fmtString, char *inBuffer, int inLength, ...) -{ - int rcode; - va_list args; - - //set the values - va_start(args, inLength); - rcode = gtDecodeNoTypeV(fmtString, inBuffer, inLength, &args); - va_end(args); - - return rcode; -} - -GTMessageType gtEncodedMessageType(char *inBuffer) -{ - GTMessageType type; - //GS_ASSERT(sizeof(GTMessageType) ==2 ) - gt2MemCopy16((char *)&type, inBuffer); - return type; -} - -// change the message type for an encoded message -void gtEncodedMessageTypeSet (char *inBuffer, GTMessageType newtype) -{ - gt2MemCopy16(inBuffer, (char *)&newtype); -} - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Encode.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Encode.h deleted file mode 100644 index 4e49fba5182..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Encode.h +++ /dev/null @@ -1,180 +0,0 @@ -//TODO: Address Byte order & Byte alignment issues -#ifndef _GT_ENCODE_H -#define _GT_ENCODE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(UNDER_CE) || defined(__mips64) || defined(_PSP) -#define ALIGNED_COPY -//the aligned copy code all needs to be optimized -#endif - - - - -// Used to identify the type of message so you can look up the correct format string -// and pass the correct parameters -// You should use 1 msgType for each unique format string/parameter combination -//////////////////////////////////////////////////////// -typedef unsigned short GTMessageType; - -// Encode a message into outBuffer -// Returns the length of the encoded message, or -1 to indicate insufficient space -// You must make sure the number of arguments match the fmtString list -//////////////////////////////////////////////////////// -int gtEncode(GTMessageType msgType, const char *fmtString, char *outBuffer, int outLength, ...); -int gtEncodeV(GTMessageType msgType, const char *fmtString, char *outBuffer, int outLength, va_list *args); -int gtEncodeNoType(const char *fmtString, char *outBuffer, int outLength, ...); -int gtEncodeNoTypeV(const char *fmtString, char *outBuffer, int outLength, va_list *args); - -// Decode the message from inBuffer into the vars provided -// Returns -1 if there was a problem with the buffer -// Vars should all be pointers (as if using scanf) -// You must make sure the number of arguments match the fmtString list -//////////////////////////////////////////////////////// -int gtDecode(const char *fmtString, char *inBuffer, int inLength, ...); -int gtDecodeV(const char *fmtString, char *inBuffer, int inLength, va_list *args); -int gtDecodeNoType(const char *fmtString, char *inBuffer, int inLength, ...); -int gtDecodeNoTypeV(const char *fmtString, char *inBuffer, int inLength, va_list *args); - -// Retrieve the message type for an encoded message -//////////////////////////////////////////////////////// -GTMessageType gtEncodedMessageType (char *inBuffer); -// change the message type for an encoded message -void gtEncodedMessageTypeSet (char *inBuffer, GTMessageType newtype); - -// This handles alignment issues and endianess -///////////////////////////////////////////////////////// -void gt2MemCopy16(char *out, char const *in); -void gt2MemCopy32(char *out, char const *in); -void gt2MemCopy64(char *out, char const *in); -void gt2MemCopy(char *out, char const *in, int size); - -/**************************** -Types that can be sent using the encode/decode functions -Most are self-explanatory, but the following require some clarification: - -GT_CSTR: This is a NUL terminated C-string. The length is determined automatically. -The NUL character is restored in decode. You simply pass the char * string as -the arguement for Encode. Note that in the pointer passed to Decode must have enough -memory allocated to it for the max string that will be encoded - otherwise -the destination may get trashed. If you cannot guarantee them max length of the -string, you should use GT_RAW (see below). - -GT_DBSTR: Same as a GT_CSTR, except with 2-byte characters instead of single byte. -String must be terminated with a double NUL character. - -GT_RAW: Use raw to send data blocks, structures, arrays, etc - although you must -make sure they're the same on all platforms! -Requires you to pass both a buffer and a length arguement to Encode and Decode. -You should pass the buffer first, then the length. -For Decode, you must initialize the length pointer to the max length of the buffer. -If the decoded data exceeds this length, the Decode function will return -1, and the -length pointer will be set to the actual length. You can then call Decode again with -a buffer that is at least the required length. -Example: -gtEncode(0, "r", buf, buflen, "somerawdata",10); -char *rawbuffer = malloc(5); -char rawlen = 5; -ret = gtDecode(0, "r", buf, buflen, rawbuffer, &rawlen); -//gtDecode will return -1, and rawlen will be set to 10 -if (ret == -1) -{ - rawbuffer = realloc(rawbuffer, rawlen); - gtDecode(0, "r", buf, buflen, rawbuffer, &rawlen); - //gtDecode will now succeed -} - -GT_CSTR_PTR, GT_DBSTR_PTR, GT_RAW_PTR: For Decode, instead of copying the data from -input buffer into the pointer provided, the pointer is simply set to the -offset of the data in the input buffer. This removes the need to allocate -memory for the pointers before hand, and elimantes an extra memory copy. -You will need to pass in double pointers (e.g. char **) so that the pointer -can be changed. -However, you must make sure you don't try to use the pointers after the -input buffer is freed/changed. -Note that the buffer passed in gtReceivedCallback must be copied off if -you want to continue using it after you return from the callback (or, you -can use the non-PTR versions that copy off into the buffers you provide -automatically) -You can pass the _PTR versions to Encode and they will behave exactly as -the regular versions. - -GT_CSTR_PTR, GT_CSTR_ARRAY_PTR: Same as GT_CSTR and GT_CSTR_PTR, but uses -an array of strings instead of a single string. The array of strings is -terminated by an empty string (a single NUL character). - -GT_BIT: If you pass all your bits together in the format string, they will be -packed together to save space. So, the format string "zzzzzzzz" will only take -1 byte for the data (+2 bytes for the message type). -Note that if you have other types between the bits, the packing will NOT occur, -e.g.: "ziz" will use 6 bytes (2 for the bits, 4 for the int), whereas "zzi" would use -only 5 bytes (1 for the bits, 4 for the int) -The argument type for bits is char for Encode and char * for Decode - -If the char is 0, the bit will not be set, if it's non-zero, the bit will be set. -Note that in Decode, the set bit will always be returned as 1 (not the non-zero value -you set) -*/ - -#define GT_INT 'i' -#define GT_INT_ "i" -#define GT_INT_TYPE int -#define GT_UINT 'u' -#define GT_UINT_ "u" -#define GT_UINT_TYPE unsigned int -#define GT_SHORT 'o' -#define GT_SHORT_ "o" -#define GT_SHORT_TYPE short -#define GT_USHORT 'p' -#define GT_USHORT_ "p" -#define GT_USHORT_TYPE unsigned short -#define GT_CHAR 'c' -#define GT_CHAR_ "c" -#define GT_CHAR_TYPE signed char -#define GT_UCHAR 'b' -#define GT_UCHAR_ "b" -#define GT_UCHAR_TYPE unsigned char -#define GT_FLOAT 'f' -#define GT_FLOAT_ "f" -#define GT_FLOAT_TYPE float -#define GT_DOUBLE 'd' -#define GT_DOUBLE_ "d" -#define GT_DOUBLE_TYPE double -#define GT_CSTR 's' -#define GT_CSTR_ "s" -#define GT_CSTR_TYPE char * -#define GT_CSTR_PTR 'S' -#define GT_CSTR_PTR_ "S" -#define GT_CSTR_PTR_TYPE char ** -#define GT_DBSTR 'w' -#define GT_DBSTR_ "w" -#define GT_DBSTR_TYPE short * -#define GT_DBSTR_PTR 'W' -#define GT_DBSTR_PTR_ "W" -#define GT_DBSTR_PTR_TYPE short ** -#define GT_CSTR_ARRAY 'a' -#define GT_CSTR_ARRAY_ "a" -#define GT_CSTR_ARRAY_TYPE char * -#define GT_CSTR_ARRAY_PTR 'A' -#define GT_CSTR_ARRAY_PTR_ "A" -#define GT_CSTR_ARRAY_PTR_TYPE char ** -#define GT_RAW 'r' //two parameters! (data, then length) -#define GT_RAW_ "r" //two parameters! -#define GT_RAW_TYPE char * -#define GT_RAW_PTR 'R' -#define GT_RAW_PTR_ "R" -#define GT_RAW_PTR_TYPE char ** -#define GT_BIT 'z' -#define GT_BIT_ "z" -#define GT_BIT_TYPE unsigned char - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Filter.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Filter.c deleted file mode 100644 index 27195af7739..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Filter.c +++ /dev/null @@ -1,191 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Filter.h" -#include "gt2Callback.h" -#include "gt2Message.h" -#include "gt2Utility.h" - -static int GS_STATIC_CALLBACK gti2SendFiltersCompare -( - const void * elem1, - const void * elem2 -) -{ - gt2SendFilterCallback * callback1 = (gt2SendFilterCallback *)elem1; - gt2SendFilterCallback * callback2 = (gt2SendFilterCallback *)elem2; - - if(*callback1 == *callback2) - return 0; - - return 1; -} - -static int GS_STATIC_CALLBACK gti2ReceiveFiltersCompare -( - const void * elem1, - const void * elem2 -) -{ - gt2ReceiveFilterCallback * callback1 = (gt2ReceiveFilterCallback *)elem1; - gt2ReceiveFilterCallback * callback2 = (gt2ReceiveFilterCallback *)elem2; - - if(*callback1 == *callback2) - return 0; - - return 1; -} - -GT2Bool gti2AddSendFilter(GT2Connection connection, gt2SendFilterCallback callback) -{ - // Check if we have a send filters list. - if(!connection->sendFilters) - return GT2False; - - // Add this callback to the list. - ArrayAppend(connection->sendFilters, &callback); - - // Return GT2True if it was added. - return (ArraySearch(connection->sendFilters, &callback, gti2SendFiltersCompare, 0, 0) != NOT_FOUND); -} - -GT2Bool gti2AddReceiveFilter(GT2Connection connection, gt2ReceiveFilterCallback callback) -{ - // Check if we have a receive filters list. - if(!connection->receiveFilters) - return GT2False; - - // Add this callback to the list. - ArrayAppend(connection->receiveFilters, &callback); - - // Return GT2True if it was added. - return (ArraySearch(connection->receiveFilters, &callback, gti2ReceiveFiltersCompare, 0, 0) != NOT_FOUND); -} - -void gti2RemoveSendFilter(GT2Connection connection, gt2SendFilterCallback callback) -{ - int index; - - // Check for no filters. - if(!connection->sendFilters) - return; - - // check for removing all - if(!callback) - { - // Remove all the filters. - ArrayClear(connection->sendFilters); - return; - } - - // Find it. - index = ArraySearch(connection->sendFilters, &callback, gti2SendFiltersCompare, 0, 0); - if(index == NOT_FOUND) - return; - - // Remove it. - ArrayRemoveAt(connection->sendFilters, index); -} - -void gti2RemoveReceiveFilter(GT2Connection connection, gt2ReceiveFilterCallback callback) -{ - int index; - - // Check for no filters. - if(!connection->receiveFilters) - return; - - // check for removing all - if(!callback) - { - // Remove all the filters. - ArrayClear(connection->receiveFilters); - return; - } - - // Find it. - index = ArraySearch(connection->receiveFilters, &callback, gti2ReceiveFiltersCompare, 0, 0); - if(index == NOT_FOUND) - return; - - // Remove it. - ArrayRemoveAt(connection->receiveFilters, index); -} - -GT2Bool gti2FilteredSend(GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable) -{ - int num; - - // Make sure we're connected. - if(connection->state != GTI2Connected) - return GT2True; - - // check the message and len - gti2MessageCheck(&message, &len); - - // Get the number of filters. - num = ArrayLength(connection->sendFilters); - - // Check if its a valid ID. - if(filterID < 0) - return GT2True; - if(filterID >= num) - return GT2True; - - // Is it the last one? - if(filterID == (num - 1)) - { - // Do the actual send. - if(!gti2Send(connection, message, len, reliable)) - return GT2False; - } - else - { - // Filter it. - if(!gti2SendFilterCallback(connection, ++filterID, message, len, reliable)) - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2FilteredReceive(GT2Connection connection, int filterID, GT2Byte * message, int len, GT2Bool reliable) -{ - int num; - - // Make sure we're connected. - if(connection->state != GTI2Connected) - return GT2True; - - // Get the number of filters. - num = ArrayLength(connection->receiveFilters); - - // Check if its a valid ID. - if(filterID < 0) - return GT2True; - if(filterID >= num) - return GT2True; - - // Is it the last one? - if(filterID == (num - 1)) - { - // call the callback - if(!gti2ReceivedCallback(connection, message, len, reliable)) - return GT2False; - } - else - { - // Filter it. - if(!gti2ReceiveFilterCallback(connection, ++filterID, message, len, reliable)) - return GT2False; - } - - return GT2True; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Filter.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Filter.h deleted file mode 100644 index a3595d97228..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Filter.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_FILTER_H_ -#define _GT2_FILTER_H_ - -#include "gt2Main.h" - -GT2Bool gti2AddSendFilter(GT2Connection connection, gt2SendFilterCallback callback); -void gti2RemoveSendFilter(GT2Connection connection, gt2SendFilterCallback callback); -GT2Bool gti2FilteredSend(GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable); - -GT2Bool gti2AddReceiveFilter(GT2Connection connection, gt2ReceiveFilterCallback callback); -void gti2RemoveReceiveFilter(GT2Connection connection, gt2ReceiveFilterCallback callback); -GT2Bool gti2FilteredReceive(GT2Connection connection, int filterID, GT2Byte * message, int len, GT2Bool reliable); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Main.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Main.c deleted file mode 100644 index 9c688e2ee14..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Main.c +++ /dev/null @@ -1,477 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Main.h" -#include "gt2Socket.h" -#include "gt2Connection.h" -#include "gt2Message.h" -#include "gt2Callback.h" -#include "gt2Filter.h" -#include "gt2Utility.h" - -#define GTI2_INVALID_IP_MASK 0xE0000000 - -/********************* -** SOCKET FUNCTIONS ** -*********************/ - -// Xbox VDP socket function(s). -#ifdef _XBOX -GT2Result gt2CreateVDPSocket -( - GT2Socket * socket, - const char * localAddress, - int outgoingBufferSize, - int incomingBufferSize, - gt2SocketErrorCallback callback -) -{ - return gti2CreateSocket(socket, localAddress, outgoingBufferSize, incomingBufferSize, callback, GTI2VdpProtocol); -} -#endif - - -GT2Result gt2CreateSocket -( - GT2Socket * socket, - const char * localAddress, - int outgoingBufferSize, - int incomingBufferSize, - gt2SocketErrorCallback callback -) -{ - return gti2CreateSocket(socket, localAddress, outgoingBufferSize, incomingBufferSize, callback, GTI2UdpProtocol); -} - -GT2Result gt2CreateAdHocSocket -( - GT2Socket * socket, - const char * localAddress, - int outgoingBufferSize, - int incomingBufferSize, - gt2SocketErrorCallback callback -) -{ - return gti2CreateSocket(socket, localAddress, outgoingBufferSize, incomingBufferSize, callback, GTI2AdHocProtocol); -} - - -void gt2CloseSocket(GT2Socket socket) -{ - // hard close the connections - gt2CloseAllConnectionsHard(socket); - - // close the socket - gti2CloseSocket(socket); -} - -void gt2Think(GT2Socket socket) -{ - // check for incoming messages - if(!gti2ReceiveMessages(socket)) - return; - - // let the connections think - if(!gti2SocketConnectionsThink(socket)) - return; - - // free closed connections - gti2FreeClosedConnections(socket); -} - -GT2Result gt2SendRawUDP -( - GT2Socket socket, - const char * remoteAddress, - const GT2Byte * message, - int len -) -{ - unsigned int ip; - unsigned short port; - - // get the ip and port - if(!gt2StringToAddress(remoteAddress, &ip, &port) || !port) - return GT2AddressError; - - // check for invalid IP ranges - // class D (224-239.*, multicast) and class E (240-255.*, experimental) - if((ntohl(ip) & GTI2_INVALID_IP_MASK) == GTI2_INVALID_IP_MASK) - return GT2AddressError; - - // check if this is for broadcast - if(!ip) - { - // check if broadcast is enable - if(!socket->broadcastEnabled) - { - if(!SetSockBroadcast(socket->socket)) - return GT2NetworkError; - socket->broadcastEnabled = GT2True; - } - - // set the broadcast ip - ip = gsiGetBroadcastIP(); - } - - // send the datagram - gti2SocketSend(socket, ip, port, message, len); - - return GT2Success; -} - -/********************* -** LISTEN FUNCTIONS ** -*********************/ - -void gt2Listen(GT2Socket socket, gt2ConnectAttemptCallback callback) -{ - gti2Listen(socket, callback); -} - -GT2Bool gt2Accept(GT2Connection connection, GT2ConnectionCallbacks * callbacks) -{ - return gti2AcceptConnection(connection, callbacks); -} - -void gt2Reject(GT2Connection connection, const GT2Byte * message, int len) -{ - gti2RejectConnection(connection, message, len); -} - -/************************* -** CONNECTION FUNCTIONS ** -*************************/ - -GT2Result gt2Connect -( - GT2Socket socket, - GT2Connection * connection, - const char * remoteAddress, - const GT2Byte * message, - int len, - int timeout, - GT2ConnectionCallbacks * callbacks, - GT2Bool blocking -) -{ - GT2Connection connectionTemp; - GT2Result result; - GT2Bool done; - unsigned int ip; - unsigned short port; - - { - // get the ip and port - if(!gt2StringToAddress(remoteAddress, &ip, &port) || !ip || !port) - return GT2AddressError; - } - - // check for invalid IP ranges - // class D (224-239.*, multicast) and class E (240-255.*, experimental) - if((ntohl(ip) & GTI2_INVALID_IP_MASK) == GTI2_INVALID_IP_MASK) - return GT2AddressError; - - // create the connection object - result = gti2NewOutgoingConnection(socket, &connectionTemp, ip, port); - if(result) - return result; - - // save the timeout value - connectionTemp->timeout = (unsigned int)timeout; - - // initiate the connection attempt - result = gti2StartConnectionAttempt(connectionTemp, message, len, callbacks); - if(result) - { - gti2FreeSocketConnection(connectionTemp); - return result; - } - - // if not blocking, return now - if(!blocking) - { - if(connection) - *connection = connectionTemp; - return GT2Success; - } - - // we're not really in a callback, but this will prevent the connection - // from being freed before the loop finishes. - connectionTemp->callbackLevel++; - - // if blocking, loop until the connect attempt is done - do - { - // think - gt2Think(socket); - - // check if we're done - done = (connectionTemp->state >= GTI2Connected); - - // if we're not done, take a rest - if(!done) - msleep(1); - } while(!done); - - // bring the callback level back down - connectionTemp->callbackLevel--; - - // is it success? - if(connectionTemp->state == GTI2Connected) - *connection = connectionTemp; - - return connectionTemp->connectionResult; -} - -GT2Result gt2Send -( - GT2Connection connection, - const GT2Byte * message, - int len, - GT2Bool reliable -) -{ - // used to check for voice data in reliable messages - unsigned short vdpDataLength; - - // can't send a message if not connected - if(connection->state != GTI2Connected) - return GT2InvalidConnection; - - // check the message and len - gti2MessageCheck(&message, &len); - - if (reliable && connection->socket->protocolType == GTI2VdpProtocol) - { - memcpy(&vdpDataLength, message, sizeof(unsigned short)); - assert(vdpDataLength + connection->socket->protocolOffset == len); - if (vdpDataLength + connection->socket->protocolOffset != len) - return GT2InvalidMessage; - } - - // do we need to filter it? - if(ArrayLength(connection->sendFilters)) - { - gti2SendFilterCallback(connection, 0, message, len, reliable); - return GT2Success; - } - - if (gti2Send(connection, message, len, reliable)) - return GT2Success; - - return GT2SendFailed; -} - -void gt2Ping(GT2Connection connection) -{ - gti2SendPing(connection); -} - -void gt2CloseConnection(GT2Connection connection) -{ - gti2CloseConnection(connection, GT2False); -} - -void gt2CloseConnectionHard(GT2Connection connection) -{ - gti2CloseConnection(connection, GT2True); -} - -static void gti2CloseAllConnectionsMap(void * elem, void * clientData) -{ - gt2CloseConnection(*(GT2Connection *)elem); - - GSI_UNUSED(clientData); -} - -void gt2CloseAllConnections(GT2Socket socket) -{ - TableMapSafe(socket->connections, gti2CloseAllConnectionsMap, NULL); -} - -static void gti2CloseAllConnectionsHardMap(void * elem, void * clientData) -{ - gt2CloseConnectionHard(*(GT2Connection *)elem); - - GSI_UNUSED(clientData); -} - -void gt2CloseAllConnectionsHard(GT2Socket socket) -{ - TableMapSafe(socket->connections, gti2CloseAllConnectionsHardMap, NULL); -} - -/************************* -** MESSAGE CONFIRMATION ** -*************************/ -GT2MessageID gt2GetLastSentMessageID(GT2Connection connection) -{ - return (GT2MessageID)(connection->serialNumber - 1); -} - -GT2Bool gt2WasMessageIDConfirmed(GT2Connection connection, GT2MessageID messageID) -{ - return gti2WasMessageIDConfirmed(connection, messageID); -} - -/********************* -** FILTER FUNCTIONS ** -*********************/ - -GT2Bool gt2AddSendFilter(GT2Connection connection, gt2SendFilterCallback callback) -{ - return gti2AddSendFilter(connection, callback); -} - -void gt2RemoveSendFilter(GT2Connection connection, gt2SendFilterCallback callback) -{ - gti2RemoveSendFilter(connection, callback); -} - -void gt2FilteredSend(GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable) -{ - gti2FilteredSend(connection, filterID, message, len, reliable); -} - -GT2Bool gt2AddReceiveFilter(GT2Connection connection, gt2ReceiveFilterCallback callback) -{ - return gti2AddReceiveFilter(connection, callback); -} - -void gt2RemoveReceiveFilter(GT2Connection connection, gt2ReceiveFilterCallback callback) -{ - gti2RemoveReceiveFilter(connection, callback); -} - -void gt2FilteredReceive(GT2Connection connection, int filterID, GT2Byte * message, int len, GT2Bool reliable) -{ - gti2FilteredReceive(connection, filterID, message, len, reliable); -} - -/******************* -** INFO FUNCTIONS ** -*******************/ - -GT2Socket gt2GetConnectionSocket(GT2Connection connection) -{ - return connection->socket; -} - -GT2ConnectionState gt2GetConnectionState(GT2Connection connection) -{ - if(connection->state < GTI2Connected) - return GT2Connecting; - if(connection->state == GTI2Connected) - return GT2Connected; - if(connection->state == GTI2Closing) - return GT2Closing; - return GT2Closed; -} - -unsigned int gt2GetRemoteIP(GT2Connection connection) -{ - return connection->ip; -} - -unsigned short gt2GetRemotePort(GT2Connection connection) -{ - return connection->port; -} - -unsigned int gt2GetLocalIP(GT2Socket socket) -{ - return socket->ip; -} - -unsigned short gt2GetLocalPort(GT2Socket socket) -{ - return socket->port; -} - -int gt2GetIncomingBufferSize(GT2Connection connection) -{ - return connection->incomingBuffer.size; -} - -int gt2GetIncomingBufferFreeSpace(GT2Connection connection) -{ - return (connection->incomingBuffer.size - connection->incomingBuffer.len); -} - -int gt2GetOutgoingBufferSize(GT2Connection connection) -{ - return connection->outgoingBuffer.size; -} - -int gt2GetOutgoingBufferFreeSpace(GT2Connection connection) -{ - return (connection->outgoingBuffer.size - connection->outgoingBuffer.len); -} - -/***************************** -** SOCKET SHARING FUNCTIONS ** -*****************************/ - -SOCKET gt2GetSocketSOCKET(GT2Socket socket) -{ - return socket->socket; -} - -void gt2SetUnrecognizedMessageCallback(GT2Socket socket, gt2UnrecognizedMessageCallback callback) -{ - socket->unrecognizedMessageCallback = callback; -} - -/************************ -** USER DATA FUNCTIONS ** -************************/ - -void gt2SetSocketData(GT2Socket socket, void * data) -{ - assert(socket); - - socket->data = data; -} - -void * gt2GetSocketData(GT2Socket socket) -{ - assert(socket); - - return socket->data; -} - -void gt2SetConnectionData(GT2Connection connection, void * data) -{ - assert(connection); - - connection->data = data; -} - -void * gt2GetConnectionData(GT2Connection connection) -{ - assert(connection); - - return connection->data; -} - -/******************* -** DUMP FUNCTIONS ** -*******************/ - -void gt2SetSendDump(GT2Socket socket, gt2DumpCallback callback) -{ - socket->sendDumpCallback = callback; -} - -void gt2SetReceiveDump(GT2Socket socket, gt2DumpCallback callback) -{ - socket->receiveDumpCallback = callback; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Main.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Main.h deleted file mode 100644 index 0915f45a1a0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Main.h +++ /dev/null @@ -1,255 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_MAIN_H_ -#define _GT2_MAIN_H_ - -#include "gt2.h" -#include "../darray.h" -#include "../hashtable.h" -#include "gt2Auth.h" - -/************************* -** CONFIGURABLE DEFINES ** -*************************/ - -// these defines are internal to GT2 and are NOT guaranteed to persist from version to version. - - -// If set, this will convert all big endian vars to little endian before sending accross the net -// And on big endian machines, convert little endian to big endian on recv -//#define _GT2_ENDIAN_CONVERT_ENABLE // add this to your compiler pre-processor options - -#if defined GSI_BIG_ENDIAN && defined _GT2_ENDIAN_CONVERT_ENABLE - #define _GT2_ENDIAN_CONVERT -#endif - - - -// any unreliable application message that starts with this magic string will have extra overhead. -// the string can be changed to something that your application will not use, or not use frequently. -// the only impact of this change will be to make your application incomatible with other application's -// using either the original or another different magic string. -// the string can consist of any number of characters, as long as there's at least one character, and the -// length define matches the string's length. -#define GTI2_MAGIC_STRING "\xFE\xFE" -#define GTI2_MAGIC_STRING_LEN 2 - -// the size of the buffer into which GT2 directly receives messages. this buffer is declared on the stack, -// and so can be fairly large on most systems without having any impact. however, on some systems with small -// stacks, this size can overflow the stack, in which case it should be lowered. -// note, this buffer size only needs to be slighty larger than the largest message that will be sent ("slighty -// larger" due to overhead with reliable messages, and unreliable messages starting with the magic string). -#if defined(_PS2) && defined(INSOCK) - #define GTI2_STACK_RECV_BUFFER_SIZE NETBUFSIZE // Max for Insock. Otherwise SOCKET_ERROR -#elif defined(_NITRO) - #define GTI2_STACK_RECV_BUFFER_SIZE 1500 -#elif defined (_XBOX) // Xbox packets are 1304, - #define GTI2_STACK_RECV_BUFFER_SIZE 4096 // when using VDP sockets, 2 bytes are used for data length -#else - #define GTI2_STACK_RECV_BUFFER_SIZE 65535 -#endif - -// a server will disconnect a client that doesn't not successfully connect within this time (in milliseconds). -// if the connectAttemptCallback has been called, and GT2 is awaiting an accept/reject, the attempt will -// not be timed-out (although the client may abort the attempt at any time). -#define GTI2_SERVER_TIMEOUT (1 * 60 * 1000) -// the time (in milliseconds) GT2 waits between resending a message whose delivery has not yet been confirmed. -#define GTI2_RESEND_TIME 1000 -// the time (in milliseconds) GT2 waits after receiving a message it must acknowledge before it actually sends -// the ack. this allows it to combine acks, or include acks as part of other reliable messages it sends. -// if an ack is pending, a new incoming message does not reset this timer. -#define GTI2_PENDING_ACK_TIME 100 -// if GT2 does not send a message for this amount of time (in milliseconds), it sends a keep-alive message. -#define GTI2_KEEP_ALIVE_TIME (30 * 1000) -// if this is defined, it sets the percentage of sent datagrams to drop. this is good for simulating what will -// happen on a high packet loss connection. -//#define GTI2_DROP_SEND_RATE 30 -typedef enum -{ - GTI2UdpProtocol, // UDP socket type for standard sockets - GTI2VdpProtocol = 2, // VDP socket type only used for Xbox VDP sockets - GTI2AdHocProtocol = 3 // socket type only used for PSP Adhoc sockets -} GTI2ProtocolType; - -// The Maximum offset of eiter UDP or VDP -// measured in bytes -// used as a buffer offset -#define MAX_PROTOCOL_OFFSET 2 - -/********** -** TYPES ** -**********/ - -typedef enum -{ - // client-only states - GTI2AwaitingServerChallenge, // sent challenge, waiting for server's challenge - GTI2AwaitingAcceptance, // sent response, waiting for accept/reject from server - - // server-only states - GTI2AwaitingClientChallenge, // receiving challenge from a new client - GTI2AwaitingClientResponse, // sent challenge, waiting for client's response - GTI2AwaitingAcceptReject, // got client's response, waiting for app to accept/reject - - // post-negotiation states - GTI2Connected, // connected - GTI2Closing, // sent a close message (GTI2Close or GTI2Reject), waiting for confirmation - GTI2Closed // connection has been closed, free it as soon as possible -} GTI2ConnectionState; - -// message types -typedef enum -{ - // reliable messages - // all start with - // type is 1 bytes, SN and ESN are 2 bytes each - GTI2MsgAppReliable, // reliable application message - GTI2MsgClientChallenge, // client's challenge to the server (initial connection request) - GTI2MsgServerChallenge, // server's response to the client's challenge, and his challenge to the client - GTI2MsgClientResponse, // client's response to the server's challenge - GTI2MsgAccept, // server accepting client's connection attempt - GTI2MsgReject, // server rejecting client's connection attempt - GTI2MsgClose, // message indicating the connection is closing - GTI2MsgKeepAlive, // keep-alive used to help detect dropped connections - - GTI2NumReliableMessages, - - // unreliable messages - GTI2MsgAck = 100, // acknowledge receipt of reliable message(s) - GTI2MsgNack, // alert sender to missing reliable message(s) - GTI2MsgPing, // used to determine latency - GTI2MsgPong, // a reply to a ping - GTI2MsgClosed // confirmation of connection closure (GTI2MsgClose or GTI2MsgReject) - also sent in response to bad messages from unknown addresses - - // unreliable messages don't really have a message type, just the magic string repeated at the start -} GTI2MessageType; - -/*************** -** STRUCTURES ** -***************/ - -typedef struct GTI2Buffer -{ - GT2Byte * buffer; // The buffer's bytes. - int size; // Number of bytes in buffer. - int len; // Length of actual data in buffer. -} GTI2Buffer; - -typedef struct GTI2IncomingBufferMessage -{ - int start; // the start of the message - int len; // the length of the message - GTI2MessageType type; // the type - unsigned short serialNumber; // the serial number -} GTI2IncomingBufferMessage; - -typedef struct GTI2OutgoingBufferMessage -{ - int start; // the start of the message - int len; // the length of the message - unsigned short serialNumber; // the serial number - gsi_time lastSend; // last time this message was sent -} GTI2OutgoingBufferMessage; - -typedef struct GTI2Socket -{ - SOCKET socket; // the network socket used for all network communication - - unsigned int ip; // the ip this socket is bound to - unsigned short port; // the port this socket is bound to - - HashTable connections; // the connections that are using this socket - DArray closedConnections; // connections that are closed no longer get a spot in the hash table - - GT2Bool close; // if true, a close was attempted inside a callback, and it should be closed as soon as possible - GT2Bool error; // if true, there was a socket error using this socket - - int callbackLevel; // if >0, then we're inside a callback (or recursive callbacks) - gt2ConnectAttemptCallback connectAttemptCallback; // if set, callback used to handle incoming connection attempts - gt2SocketErrorCallback socketErrorCallback; // if set, call this in case of an error - gt2DumpCallback sendDumpCallback; // if set, gets called for every datagram sent - gt2DumpCallback receiveDumpCallback; // if set, gets called for every datagram and connection reset received - gt2UnrecognizedMessageCallback unrecognizedMessageCallback; // if set, gets called for all unrecognized messages - - void * data; // user data - - int outgoingBufferSize; // per-connection buffer sizes - int incomingBufferSize; - - GTI2ProtocolType protocolType; // set to UDP or VDP protocol depending on the call to create socket - // also used as an offset for VDP sockets - int protocolOffset; - GT2Bool broadcastEnabled; // set to true if the socket has already been broadcast enabled -} GTI2Socket; - -typedef struct GTI2Connection -{ - // ip and port uniquely identify this connection on this socket - unsigned int ip; // the ip on the other side of this connection (network byte order) - unsigned short port; // the port on the other side of this connection (host byte order) - - GTI2Socket * socket; // the parent socket - - GTI2ConnectionState state; // connection state - - GT2Bool initiated; // if true, the local side of the connection initiated the connection (client) - - GT2Bool freeAtAcceptReject; // if true, don't free the connection until accept/reject is called - - GT2Result connectionResult; // the result of the connect attempt - - gsi_time startTime; // the time the connection was created - gsi_time timeout; // the timeout value passed into gt2Connect - - int callbackLevel; // if >0, then we're inside a callback (or recursive callbacks) - GT2ConnectionCallbacks callbacks; // connection callbacks - - char * initialMessage; // this is the initial message for the client - int initialMessageLen; // the initial message length - - void * data; // user data - - GTI2Buffer incomingBuffer; // buffer for incoming data - GTI2Buffer outgoingBuffer; // buffer for outgoing data - DArray incomingBufferMessages; // identifies incoming messages stored in the buffer - DArray outgoingBufferMessages; // identifies outgoing messages stored in the buffer - - unsigned short serialNumber; // serial number of the next message to be sent out - unsigned short expectedSerialNumber; // the next serial number we're expecting from the remote side - - char response[GTI2_RESPONSE_LEN]; // after the challenge is sent during negotiation, this is the response we're expecting - - gsi_time lastSend; // the last time something was sent on this connection - gsi_time challengeTime; // the time the challenge was sent - - GT2Bool pendingAck; // if true, there is an ack waiting to go out, either on its own or as part of a reliable message - - gsi_time pendingAckTime; // the time at which the pending ack was first set - - DArray sendFilters; // filters that apply to outgoing data - DArray receiveFilters; // filters that apply to incoming data - -} GTI2Connection; - -// store last 32 ip's in a ring buffer -#define MAC_TABLE_SIZE 32 // must be power of 2 -typedef struct -{ - gsi_u32 ip; - char mac[6]; -} GTI2MacEntry; - -#ifdef GSI_ADHOC -static int lastmactableentry = 0; -static GTI2MacEntry MacTable[MAC_TABLE_SIZE]; -#endif // GSI_ADHOC - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Message.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Message.c deleted file mode 100644 index 2ae44d8b596..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Message.c +++ /dev/null @@ -1,1802 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Message.h" -#include "gt2Buffer.h" -#include "gt2Connection.h" -#include "gt2Socket.h" -#include "gt2Callback.h" -#include "gt2Utility.h" -#include - -static unsigned short gti2UShortFromBuffer(const GT2Byte * buffer, int pos) -{ - unsigned short s; - s = (unsigned short)((buffer[pos] << 8) & 0xFF00); - pos++; - s |= buffer[pos]; - - return s; -} - - -static void gti2UShortToBuffer(GT2Byte * buffer, int pos, unsigned short s) -{ - buffer[pos++] = (GT2Byte)((s >> 8) & 0xFF); - buffer[pos] = (GT2Byte)(s & 0xFF); -} - -static int gti2SNDiff(unsigned short SN1, unsigned short SN2) -{ - return (short)(SN1 - SN2); -} - -static GT2Bool gti2ConnectionError(GT2Connection connection, GT2Result result, GT2CloseReason reason) -{ - // first check if we're still connecting - if(connection->state < GTI2Connected) - { - // check if the local side is the initiator - if(connection->initiated) - { - // mark it as closed - gti2ConnectionClosed(connection); - - // call the callback - if(!gti2ConnectedCallback(connection, result, NULL, 0)) - return GT2False; - } - else - { - // are we waiting for accept/reject? - if(connection->state == GTI2AwaitingAcceptReject) - connection->freeAtAcceptReject = GT2True; - - // mark it as closed - gti2ConnectionClosed(connection); - } - } - // report the close, as long as we're not already closed - else if(connection->state != GTI2Closed) - { - // mark it as closed - gti2ConnectionClosed(connection); - - // call the callback - if(!gti2ClosedCallback(connection, reason)) - return GT2False; - } - - return GT2True; -} - -static GT2Bool gti2ConnectionCommunicationError(GT2Connection connection) -{ - return gti2ConnectionError(connection, GT2NegotiationError, GT2CommunicationError); -} - -static GT2Bool gti2ConnectionMemoryError(GT2Connection connection) -{ - // let the other side know - if(!gti2SendClosed(connection)) - return GT2False; - - return gti2ConnectionError(connection, GT2OutOfMemory, GT2NotEnoughMemory); -} - - - - - -static GT2Bool gti2HandleESN(GT2Connection connection, unsigned short ESN) -{ - int len; - int i; - GTI2OutgoingBufferMessage * message; - int shortenBy; - - // get the number of messages in the outgoing queue - len = ArrayLength(connection->outgoingBufferMessages); - if(!len) - return GT2True; - - // loop through until we hit one we can't remove - for(i = 0 ; i < len ; i++) - { - // get the message - message = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, i); - - // don't stop until we get to the ESN - if(gti2SNDiff(message->serialNumber, ESN) >= 0) - break; - } - - // check for not removing any - if(i == 0) - return GT2True; - - // remove the message info structs - while(i--) - ArrayDeleteAt(connection->outgoingBufferMessages, i); - - // check how many messages are left - len = ArrayLength(connection->outgoingBufferMessages); - if(!len) - { - // buffer is empty - connection->outgoingBuffer.len = 0; - return GT2True; - } - - // figure out how much to move everything forward - message = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, 0); - shortenBy = message->start; - - // do the move on the info structs - for(i = 0 ; i < len ; i++) - { - message = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, i); - message->start -= shortenBy; - } - - // move the actual data - gti2BufferShorten(&connection->outgoingBuffer, 0, shortenBy); - - return GT2True; -} - -static GT2Bool gti2HandleAppUnreliable(GT2Connection connection, GT2Byte * message, int len) -{ - // check the state - if((connection->state != GTI2Connected) && (connection->state != GTI2Closing)) - return GT2True; - - // do we need to filter it? - if(ArrayLength(connection->receiveFilters)) - { - if(!gti2ReceiveFilterCallback(connection, 0, message, len, GT2False)) - return GT2False; - return GT2True; - } - - // we received data, call the callback - if(!gti2ReceivedCallback(connection, message, len, GT2False)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleAppReliable(GT2Connection connection, GT2Byte * message, int len) -{ - // check the state - if((connection->state != GTI2Connected) && (connection->state != GTI2Closing)) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - } - else - { - // do we need to filter it? - if(ArrayLength(connection->receiveFilters)) - { - if(!gti2ReceiveFilterCallback(connection, 0, message, len, GT2True)) - return GT2False; - return GT2True; - } - - // we received data, call the callback - if(!gti2ReceivedCallback(connection, message, len, GT2True)) - return GT2False; - } - - return GT2True; -} - -static GT2Bool gti2HandleClientChallenge(GT2Connection connection, GT2Byte * message, int len) -{ - char response[GTI2_RESPONSE_LEN]; - char challenge[GTI2_CHALLENGE_LEN]; - - // check the state - if(connection->state != GTI2AwaitingClientChallenge) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // make sure the message is long enough - if(len < GTI2_CHALLENGE_LEN) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // generate a response to the challenge - gti2GetResponse((GT2Byte *)response, message); - - // generate our own challenge - gti2GetChallenge((GT2Byte *)challenge); - - // store what our response will be - gti2GetResponse((GT2Byte *)connection->response, (GT2Byte *)challenge); - - // send our own challenge - if(!gti2SendServerChallenge(connection, response, challenge)) - return GT2False; - - // new state - connection->state = GTI2AwaitingClientResponse; - - return GT2True; -} - - - -static GT2Bool gti2HandleServerChallenge(GT2Connection connection, GT2Byte * message, int len) -{ - char response[GTI2_RESPONSE_LEN]; - - // check the state - if(connection->state != GTI2AwaitingServerChallenge) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // make sure the message is long enough - if(len < (GTI2_RESPONSE_LEN + GTI2_CHALLENGE_LEN)) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // check the response - if(!gti2CheckResponse(message, (GT2Byte *)connection->response)) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // generate our response to the server's challenge - gti2GetResponse((GT2Byte *)response, message + GTI2_RESPONSE_LEN); - - // send the response, including our intial message - if(!gti2SendClientResponse(connection, response, connection->initialMessage, connection->initialMessageLen)) - return GT2False; - - // free the initial message - if(connection->initialMessage) - { - gsifree(connection->initialMessage); - connection->initialMessage = NULL; - } - - // new state - connection->state = GTI2AwaitingAcceptance; - - return GT2True; -} - -static GT2Bool gti2HandleClientResponse(GT2Connection connection, GT2Byte * message, int len) -{ - int latency; - - // check the state - if(connection->state != GTI2AwaitingClientResponse) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // make sure the message is long enough - if(len < (GTI2_RESPONSE_LEN)) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // check the response - if(!gti2CheckResponse(message, (GT2Byte *)connection->response)) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // need to make sure the connection didn't just stop listening - if(!connection->socket->connectAttemptCallback) - { - // send them a closed - if(!gti2SendClosed(connection)) - return GT2False; - - // mark it as closed - gti2ConnectionClosed(connection); - - return GT2True; - } - - // new state - connection->state = GTI2AwaitingAcceptReject; - - // calculate the approx. latency - latency = (int)(current_time() - connection->challengeTime); - - // it's up to the app now - if(!gti2ConnectAttemptCallback(connection->socket, connection, connection->ip, connection->port, latency, message + GTI2_RESPONSE_LEN, len - GTI2_RESPONSE_LEN)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleAccept(GT2Connection connection) -{ - // check the state - if(connection->state != GTI2AwaitingAcceptance) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // new state - connection->state = GTI2Connected; - - // call the callback - if(!gti2ConnectedCallback(connection, GT2Success, NULL, 0)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleReject(GT2Connection connection, GT2Byte * message, int len) -{ - // check the state - if(connection->state != GTI2AwaitingAcceptance) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // mark it as closed - gti2ConnectionClosed(connection); - - // send a closed reply - if(!gti2SendClosed(connection)) - return GT2False; - - // call the callback - if(!gti2ConnectedCallback(connection, GT2Rejected, message, len)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleClose(GT2Connection connection) -{ - GT2Bool localClose; - - // send a closed reply - if(!gti2SendClosed(connection)) - return GT2False; - - // were we attempting to close this connection? - localClose = (connection->state == GTI2Closing); - - // handle it as an error (so the right callbacks are called) - if(!gti2ConnectionError(connection, GT2Rejected, localClose?GT2LocalClose:GT2RemoteClose)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2DeliverReliableMessage(GT2Connection connection, GTI2MessageType type, GT2Byte * message, int len) -{ - // bump our ESN - connection->expectedSerialNumber++; - - if(type == GTI2MsgAppReliable) - { - if(!gti2HandleAppReliable(connection, message, len)) - return GT2False; - } - else if(type == GTI2MsgClientChallenge) - { - if(!gti2HandleClientChallenge(connection, message, len)) - return GT2False; - } - else if(type == GTI2MsgServerChallenge) - { - if(!gti2HandleServerChallenge(connection, message, len)) - return GT2False; - } - else if(type == GTI2MsgClientResponse) - { - if(!gti2HandleClientResponse(connection, message, len)) - return GT2False; - } - else if(type == GTI2MsgAccept) - { - if(!gti2HandleAccept(connection)) - return GT2False; - } - else if(type == GTI2MsgReject) - { - if(!gti2HandleReject(connection, message, len)) - return GT2False; - } - else if(type == GTI2MsgClose) - { - if(!gti2HandleClose(connection)) - return GT2False; - } - else if(type == GTI2MsgKeepAlive) - { - // ignore - } - - return GT2True; -} -#ifdef WIN32 -static int __cdecl gti2IncomingBufferMessageCompare(const void * elem1, const void * elem2) -#else -static int gti2IncomingBufferMessageCompare(const void * elem1, const void * elem2) -#endif -{ - const GTI2IncomingBufferMessage * message1 = (GTI2IncomingBufferMessage *)elem1; - const GTI2IncomingBufferMessage * message2 = (GTI2IncomingBufferMessage *)elem2; - - return gti2SNDiff(message1->serialNumber, message2->serialNumber); -} - -static GT2Bool gti2BufferIncomingMessage(GT2Connection connection, GTI2MessageType type, unsigned short SN, GT2Byte * message, int len, GT2Bool * overflow) -{ - GTI2IncomingBufferMessage messageInfo; - GTI2IncomingBufferMessage * bufferedMessage; - int num; - int i; - - // check the number of messages being held - num = ArrayLength(connection->incomingBufferMessages); - - // check if this message is already buffered - for(i = 0 ; i < num ; i++) - { - // get the message - bufferedMessage = (GTI2IncomingBufferMessage *)ArrayNth(connection->incomingBufferMessages, i); - - // check if this is the same message - if(bufferedMessage->serialNumber == SN) - { - *overflow = GT2False; - return GT2True; - } - - // check if we've already past the target SN - if(gti2SNDiff(bufferedMessage->serialNumber, SN) > 0) - break; - } - - // check that there's enough space to store the message - if(gti2GetBufferFreeSpace(&connection->incomingBuffer) < len) - { - *overflow = GT2True; - return GT2True; - } - - // setup the message info - messageInfo.start = connection->incomingBuffer.len; - messageInfo.len = len; - messageInfo.type = type; - messageInfo.serialNumber = SN; - - // add it to the list - ArrayInsertSorted(connection->incomingBufferMessages, &messageInfo, gti2IncomingBufferMessageCompare); - - // make sure the length is one more - if(ArrayLength(connection->incomingBufferMessages) != (num + 1)) - { - *overflow = GT2True; - return GT2True; - } - - // copy the message into the buffer - gti2BufferWriteData(&connection->incomingBuffer, message, len); - - // check for sending a nack - // we want to send one when we think a message or messages were probably dropped - if(num == 0) - { - // if we're the only message in the hold, send a nack - if(!gti2SendNack(connection, connection->expectedSerialNumber, (unsigned short)(SN - 1))) - return GT2False; - } - else - { - GTI2IncomingBufferMessage * msg; - - // are we the highest message? - msg = (GTI2IncomingBufferMessage *)ArrayNth(connection->incomingBufferMessages, num); - if(msg->serialNumber == SN) - { - GTI2IncomingBufferMessage * prev; - unsigned short diff; - - // if we're not right after the second-highest SN, the ones in between were probably dropped - prev = (GTI2IncomingBufferMessage *)ArrayNth(connection->incomingBufferMessages, num - 1); - diff = (unsigned short)gti2SNDiff(SN, prev->serialNumber); - if(diff > 1) - { - if(!gti2SendNack(connection, (unsigned short)(prev->serialNumber + 1), (unsigned short)(SN - 1))) - return GT2False; - } - } - } - - *overflow = GT2False; - return GT2True; -} - -static void gti2RemoveHoldMessage(GT2Connection connection, GTI2IncomingBufferMessage * message, int index) -{ - int moveAfter; - int shortenBy; - int moveEnd = 0; - int num; - int i; - - // save off info about it - moveAfter = message->start; - shortenBy = message->len; - - // delete it - ArrayDeleteAt(connection->incomingBufferMessages, index); - - // loop through and fix up message's stored after this one in the buffer - // also figure out exactly how much data we'll need to move - num = ArrayLength(connection->incomingBufferMessages); - for(i = 0 ; i < num ; i++) - { - // check if this message needs to be moved forward - message = (GTI2IncomingBufferMessage *)ArrayNth(connection->incomingBufferMessages, i); - if(message->start > moveAfter) - { - message->start -= shortenBy; - moveEnd = max(moveEnd, message->start + message->len); - } - } - - // fix up the buffer itself - gti2BufferShorten(&connection->incomingBuffer, moveAfter, shortenBy); -} - -static GT2Bool gti2DeliverHoldMessages(GT2Connection connection) -{ - GTI2IncomingBufferMessage * message; - int num; - int i; - -restart: - - // loop through the buffered messages, checking if there are any that can now be delivered - // loop through backwards to ease removal - num = ArrayLength(connection->incomingBufferMessages); - for(i = (num - 1) ; i >= 0 ; i--) - { - message = (GTI2IncomingBufferMessage *)ArrayNth(connection->incomingBufferMessages, i); - - // we should deliver this if it's what we're expecting - if(message->serialNumber == connection->expectedSerialNumber) - { - // deliver it - if(!gti2DeliverReliableMessage(connection, message->type, connection->incomingBuffer.buffer + message->start, message->len)) - return GT2False; - - // remove it - gti2RemoveHoldMessage(connection, message, i); - - // we need to go through this loop again. - // goto's are evil, but a little evil is good here - goto restart; - } - } - - return GT2True; -} - -static void gti2SetPendingAck(GT2Connection connection) -{ - // if there's not a pending ack, set one - if(!connection->pendingAck) - { - connection->pendingAck = GT2True; - connection->pendingAckTime = current_time(); - } -} - -static GT2Bool gti2HandleReliableMessage(GT2Connection connection, GTI2MessageType type, GT2Byte * message, int len) -{ - unsigned short SN; - unsigned short ESN; - const int headerLength = connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN + 1 + 2 + 2; - GT2Bool overflow; - - // check if it's long enough - if(len < (connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN + 1 + 2 + 2)) // magic string + type + SN + ESN - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // get the SN - SN = gti2UShortFromBuffer(message + connection->socket->protocolOffset, GTI2_MAGIC_STRING_LEN + 1); - - // get the ESN - ESN = gti2UShortFromBuffer(message + connection->socket->protocolOffset, GTI2_MAGIC_STRING_LEN + 3); - - // update the message and length to point to the actual message - if (connection->socket->protocolType == GTI2VdpProtocol && type == GTI2MsgAppReliable) - { - message[connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN + 3] = message[0]; - message[connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN + 4] = message[1]; - message += headerLength - connection->socket->protocolOffset; - len -= headerLength - connection->socket->protocolOffset; - } - else - { - message += headerLength; - len -= headerLength; - } - - // handle the ESN - if(!gti2HandleESN(connection, ESN)) - return GT2False; - - // check if it's the SN we expected - if(SN == connection->expectedSerialNumber) - { - // make sure we ack this message - // do this before delivering, because we might send an ack as part of a reliable reply - gti2SetPendingAck(connection); - - // deliver the message - if(!gti2DeliverReliableMessage(connection, type, message, len)) - return GT2False; - - // check if there are any messages in the hold that can now be delivered - if(!gti2DeliverHoldMessages(connection)) - return GT2False; - - return GT2True; - } - - // check if the message is a duplicate - if(gti2SNDiff(SN, connection->expectedSerialNumber) < 0) - { - // it's a duplicate, ack it again - gti2SetPendingAck(connection); - - // ignore it - return GT2True; - } - - // we can't deliver this yet, so put it in the hold - if(!gti2BufferIncomingMessage(connection, type, SN, message, len, &overflow)) - return GT2False; - - // check for a buffer overflow - if(overflow) - { - if(!gti2ConnectionMemoryError(connection)) - return GT2False; - } - - return GT2True; -} - -static GT2Bool gti2HandleAck(GT2Connection connection, const GT2Byte * message, int len) -{ - unsigned short ESN; - - // make sure it has enough space for the ESN - if(len != 2) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // get the ESN - ESN = gti2UShortFromBuffer(message, 0); - - // handle it - if(!gti2HandleESN(connection, ESN)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleNack(GT2Connection connection, const GT2Byte * message, int len) -{ - unsigned short SNMin; - unsigned short SNMax; - int num; - int i; - GTI2OutgoingBufferMessage * messageInfo; - - // read based on length. - SNMin = gti2UShortFromBuffer(message, 0); - if(len == 2) - { - SNMax = SNMin; - } - else if(len == 4) - { - SNMax = gti2UShortFromBuffer(message, 2); - } - else - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - } - - // loop through the messages, resending any specified ones - num = ArrayLength(connection->outgoingBufferMessages); - for(i = 0 ; i < num ; i++) - { - messageInfo = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, i); - if((gti2SNDiff(messageInfo->serialNumber, SNMin) >= 0) && (gti2SNDiff(messageInfo->serialNumber, SNMax) <= 0)) - { - if(!gti2ResendMessage(connection, messageInfo)) - return GT2False; - } - } - - return GT2True; -} - -static GT2Bool gti2HandlePing(GT2Connection connection, GT2Byte * message, int len) -{ - // send it right back - return gti2SendPong(connection, message, len); -} - -static GT2Bool gti2HandlePong(GT2Connection connection, const GT2Byte * message, int len) -{ - gsi_time startTime; - - // do we care about this? - if(!connection->callbacks.ping) - return GT2True; - - // is this a pong we're interested in? - // "time" + ping-sent-time - if(len != (4 + sizeof(gsi_time))) - return GT2True; - if(memcmp(message, "time", 4) != 0) - return GT2True; - - // get the start time - memcpy(&startTime, message + 4, sizeof(gsi_time)); - - // call the callback - if(!gti2PingCallback(connection, (int)(current_time() - startTime))) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleClosed(GT2Connection connection) -{ - GT2Bool localClose; - - // are we already closed? - if(connection->state == GTI2Closed) - return GT2True; - - // were we attempting to close this connection? - localClose = (connection->state == GTI2Closing); - - // handle it as an error (so the right callbacks are called) - if(!gti2ConnectionError(connection, GT2Rejected, localClose?GT2LocalClose:GT2RemoteClose)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2HandleUnreliableMessage(GT2Connection connection, GTI2MessageType type, GT2Byte * message, int len) -{ - int headerLength; - GT2Byte * dataStart; - int dataLen; - - // most unreliable messages don't need the header - headerLength = (connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN + 1); - dataStart = (message + headerLength); - dataLen = (len - headerLength); - - // handle unreliable messages based on type - if(type == GTI2MsgAck) - { - if(!gti2HandleAck(connection, dataStart, dataLen)) - return GT2False; - } - else if(type == GTI2MsgNack) - { - if(!gti2HandleNack(connection, dataStart, dataLen)) - return GT2False; - } - else if(type == GTI2MsgPing) - { - if(!gti2HandlePing(connection, message, len)) - return GT2False; - } - else if(type == GTI2MsgPong) - { - if(!gti2HandlePong(connection, dataStart, dataLen)) - return GT2False; - } - else if(type == GTI2MsgClosed) - { - if(!gti2HandleClosed(connection)) - return GT2False; - } - - return GT2True; -} - -// VDP sockets have data length which needs to be stripped off -static GT2Bool gti2HandleMessage(GT2Socket socket, GT2Byte * message, int len, unsigned int ip, unsigned short port) -{ - GT2Connection connection; - GT2Bool magicString; - GT2Result result; - GTI2MessageType type; - GT2Bool handled; - int actualLength = len - socket->protocolOffset; - - // VDP messages have 2 byte header which is removed based on protocol - GT2Byte *actualMessage = message + socket->protocolOffset; - - // find out if we have an existing connection for this address - connection = gti2SocketFindConnection(socket, ip, port); - - // let the dump handle this - if(socket->receiveDumpCallback) - { - if(!gti2DumpCallback(socket, connection, ip, port, GT2False, message, len, GT2False)) - return GT2False; - } - - // check if the message starts with the magic string - // use greater than for the len compare because it also must have a type - magicString = ((actualLength > GTI2_MAGIC_STRING_LEN) && (memcmp(actualMessage, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN) == 0)); - - // check if we don't have a connection - if(!connection) - { - // if we don't know who this is from, let the unrecognized message callback have first crack at it - if(!gti2UnrecognizedMessageCallback(socket, ip, port, message, len, &handled)) - return GT2False; - - // if they handled it, we don't care about it. - if(handled) - return GT2True; - - // if this isn't a connection request, tell them the connection is closed - if(!magicString || (actualMessage[GTI2_MAGIC_STRING_LEN] != GTI2MsgClientChallenge)) - { - // if this is a closed message, don't send one back (to avoid recursion) - if(!magicString || (actualMessage[GTI2_MAGIC_STRING_LEN] != GTI2MsgClosed)) - { - if(!gti2SendClosedOnSocket(socket, ip, port)) - return GT2False; - } - return GT2True; - } - - // if we're not listening, we just ignore this - if(!socket->connectAttemptCallback) - return GT2True; - - // create a connection - result = gti2NewIncomingConnection(socket, &connection, ip, port); - if(result != GT2Success) - { - // as long as this wasn't a duplicate address error, tell them we're closed - // in the case of duplicates, we don't want to close the existing connection - if(result != GT2DuplicateAddress) - { - if(!gti2SendClosedOnSocket(socket, ip, port)) - return GT2False; - } - return GT2True; - } - } - - // is the connection already closed? - if(connection->state == GTI2Closed) - { - // if this is a closed message, don't send one back (to avoid recursion) - if(!magicString || (actualMessage[GTI2_MAGIC_STRING_LEN] != GTI2MsgClosed)) - { - if(!gti2SendClosed(connection)) - return GT2False; - } - - return GT2True; - } - - // check if this is an unreliable app message with a magic string header - if(magicString && ((actualLength >= (GTI2_MAGIC_STRING_LEN * 2)) && (memcmp(actualMessage + GTI2_MAGIC_STRING_LEN, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN) == 0))) - { - message[3] = message[1]; - message[2] = message[0]; - message = actualMessage; - actualMessage += socket->protocolOffset; - actualLength -= socket->protocolOffset; - len -= GTI2_MAGIC_STRING_LEN; - magicString = GT2False; - } - - // if it doesn't have a magic string it's an app unreliable - if(!magicString) - { - // First determine if the connection found has gone throught the internal challenge response - if (connection->state < GTI2Connected) - { - // pass any message that doesn't have a magic string to - // the app so that the SDK doesn't drop them - if(!gti2UnrecognizedMessageCallback(socket, ip, port, message, len, &handled)) - return GT2False; - } - else - { - if(!gti2HandleAppUnreliable(connection, message, len)) - return GT2False; - } - - return GT2True; - } - - // get the message type - type = (GTI2MessageType)actualMessage[GTI2_MAGIC_STRING_LEN]; - // check for a bad type - /*if(type < 0) - { - if(!gti2ConnectionCommunicationError(connection)) - return GT2False; - - return GT2True; - }*/ - - - // check if it's reliable - if(type < GTI2NumReliableMessages) - { - // handle it - if(!gti2HandleReliableMessage(connection, type, message, len)) - return GT2False; - return GT2True; - } - - // handle unreliable messages - if(!gti2HandleUnreliableMessage(connection, type, message, len)) - return GT2False; - - return GT2True; -} - - -GT2Bool gti2HandleConnectionReset(GT2Socket socket, unsigned int ip, unsigned short port) -{ - GT2Connection connection; - - // find the connection for the reset - connection = gti2SocketFindConnection(socket, ip, port); - - // let the dump know about this - if(socket->receiveDumpCallback) - { - if(!gti2DumpCallback(socket, connection, ip, port, GT2True, NULL, 0, GT2False)) - return GT2False; - } - - // there's no connection, so ignore it - if(!connection) - return GT2True; - - // are we waiting for a response from the server? - if(connection->state == GTI2AwaitingServerChallenge) - { - // are we still within the timeout time? - if(!connection->timeout || ((current_time() - connection->startTime) < connection->timeout)) - return GT2True; - - // report this as a timeout - if(!gti2ConnectionError(connection, GT2TimedOut, GT2RemoteClose)) - return GT2False; - } - else - { - // report the error - if(!gti2ConnectionError(connection, GT2Rejected, GT2RemoteClose)) - return GT2False; - } - - return GT2True; -} - -GT2Bool gti2HandleHostUnreachable(GT2Socket socket, unsigned int ip, unsigned short port, GT2Bool send) -{ - GT2Connection connection; - - // find the connection for the reset - connection = gti2SocketFindConnection(socket, ip, port); - - // let the dump know about this - if(socket->receiveDumpCallback) - { - if(!gti2DumpCallback(socket, connection, ip, port, GT2True, NULL, 0, send)) - return GT2False; - } - - // there's no connection, so ignore it - if(!connection) - return GT2True; - - - // report the error - if(!gti2ConnectionError(connection, GT2TimedOut, GT2RemoteClose)) - return GT2False; - - return GT2True; -} - - -#ifdef GSI_ADHOC - - - -// return length if successful -// <=0 on error -gsi_bool _NetworkAdHocSocketRecv(int socket_id, - char *buf, - int bufferlen, - int flags, - char *saddr, //struct SceNetEtherAddr = char[6]; - gsi_u16 *sport); - - - - - - - - -// return 0 if no data, -1 if error, >0 if data to read -int _NetworkAdHocCanReceiveOnSocket(int socket_id); - -GT2Bool gti2ReceiveAdHocMessages(GT2Socket socket,char *buffer, int buffersize) -{ - int rcode; - SOCKADDR_IN address; - int addressLen;//, datasize; - - // check for messages - while (1) - { - int datasize = _NetworkAdHocCanReceiveOnSocket(socket->socket); - if (datasize < 0) // error - { - gti2SocketError(socket); - return GT2False; - } - - if (datasize == 0) - break; // no data - { - // We have data to recv - // receive the message - char mac[6]; - gsi_u16 port; - //gsi_u32 ip; - - addressLen = sizeof(address); - - rcode = _NetworkAdHocSocketRecv(socket->socket, buffer,buffersize , 0, mac,&port); - if(rcode < 0) // fatal socket error - { - #if(0) // notes - if(0)//rcode == WSAECONNRESET) - { - // handle the reset - if(!gti2HandleConnectionReset(socket, address.sin_addr.s_addr, ntohs(address.sin_port))) - return GT2False; - } - else - if (rcode == WSAEHOSTUNREACH) - { - if (!gti2HandleHostUnreachable(socket, address.sin_addr.s_addr, ntohs(address.sin_port), GT2False)) - return GT2False; - } - else - #endif - { - gti2SocketError(socket); - return GT2False; - } - } - if(rcode == 0) // no data - { - return GT2False; - } - - // at this point we have valid data - - // change ethernet to IP address - address.sin_addr.s_addr = gt2MacToIp(mac); - address.sin_port = port; - - #ifdef RECV_LOG - // log it - gti2LogMessage(address.sin_addr.s_addr, ntohs(address.sin_port), - socket->ip, socket->port, - buffer, rcode); - #endif - // handle the message - if(!gti2HandleMessage(socket, (GT2Byte *)buffer, rcode, address.sin_addr.s_addr, address.sin_port)) - return GT2False; - } - } - - return GT2True; -} -#endif - -GT2Bool gti2ReceiveMessages(GT2Socket socket) -{ - int rcode; - SOCKADDR_IN address; - int addressLen; - - - // avoid overflowing stack - #if (GTI2_STACK_RECV_BUFFER_SIZE > 1600) - static char buffer[GTI2_STACK_RECV_BUFFER_SIZE]; - #else - char buffer[GTI2_STACK_RECV_BUFFER_SIZE]; - #endif - - - #ifdef GSI_ADHOC - if(socket->protocolType == GTI2AdHocProtocol) - { - return gti2ReceiveAdHocMessages(socket,buffer,GTI2_STACK_RECV_BUFFER_SIZE); - } - #endif - - // check for messages - while (CanReceiveOnSocket(socket->socket)) - { - // mj todo: get this plat specific stuff out of here. Belongs in play specific layer. - // abstract recvfrom - - // receive the message - addressLen = sizeof(address); - - rcode = recvfrom(socket->socket, buffer, sizeof(buffer), 0, (SOCKADDR *)&address, &addressLen); - - if (gsiSocketIsError(rcode)) - { - rcode = GOAGetLastError(socket->socket); - if(rcode == WSAECONNRESET) - { - // handle the reset - if(!gti2HandleConnectionReset(socket, address.sin_addr.s_addr, ntohs(address.sin_port))) - return GT2False; - } - #ifndef SN_SYSTEMS - else if (rcode == WSAEHOSTUNREACH) - { - if (!gti2HandleHostUnreachable(socket, address.sin_addr.s_addr, ntohs(address.sin_port), GT2False)) - return GT2False; - } - #endif - else if(rcode != WSAEMSGSIZE) - { - // fatal socket error - gti2SocketError(socket); - return GT2False; - } - } - else - { - #ifdef RECV_LOG - // log it - gti2LogMessage(address.sin_addr.s_addr, ntohs(address.sin_port), - socket->ip, socket->port, - buffer, rcode); - #endif - // handle the message - if(!gti2HandleMessage(socket, (GT2Byte *)buffer, rcode, address.sin_addr.s_addr, ntohs(address.sin_port))) - return GT2False; - } - } - - return GT2True; -} - -static GT2Bool gti2StoreOutgoingReliableMessageInfo(GT2Connection connection, unsigned short SN, int len) -{ - GTI2OutgoingBufferMessage messageInfo; - int num; - - // setup the message info - memset(&messageInfo, 0, sizeof(messageInfo)); - messageInfo.start = connection->outgoingBuffer.len; - messageInfo.len = len; - messageInfo.serialNumber = SN; - messageInfo.lastSend = current_time(); - - // check the number of messages before we do the add - num = ArrayLength(connection->outgoingBufferMessages); - - // add it to the list - ArrayAppend(connection->outgoingBufferMessages, &messageInfo); - - // make sure the length is one more - if(ArrayLength(connection->outgoingBufferMessages) != (num + 1)) - return GT2False; - - return GT2True; -} - -static GT2Bool gti2BeginReliableMessage(GT2Connection connection, GTI2MessageType type, int len, GT2Bool * overflow) -{ - int freeSpace; - - // VDP data length needed in the front of every packet - unsigned short vdpDataLength = (unsigned short)(len - connection->socket->protocolOffset); - - // check how much free space is in the outgoing buffer - freeSpace = gti2GetBufferFreeSpace(&connection->outgoingBuffer); - - // do we have the space to hold it? - if(freeSpace < len) - { - if(!gti2ConnectionMemoryError(connection)) - return GT2False; - - *overflow = GT2True; - return GT2True; - } - - // store the message's info - if(!gti2StoreOutgoingReliableMessageInfo(connection, connection->serialNumber, len)) - { - if(!gti2ConnectionMemoryError(connection)) - return GT2False; - - *overflow = GT2True; - return GT2True; - } - - // setup the header - if (connection->socket->protocolType == GTI2VdpProtocol) - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)&vdpDataLength, connection->socket->protocolOffset); - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN); - gti2BufferWriteByte(&connection->outgoingBuffer, (GT2Byte)type); - gti2BufferWriteUShort(&connection->outgoingBuffer, connection->serialNumber++); - gti2BufferWriteUShort(&connection->outgoingBuffer, connection->expectedSerialNumber); - - *overflow = GT2False; - return GT2True; -} - -static GT2Bool gti2EndReliableMessage(GT2Connection connection) -{ - GTI2OutgoingBufferMessage * message; - int len; - - // the message we're sending is the last one - len = ArrayLength(connection->outgoingBufferMessages); - assert(len > 0); - message = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, len - 1); - - // send it - if(!gti2ConnectionSendData(connection, connection->outgoingBuffer.buffer + message->start, message->len)) - return GT2False; - - // we just did an ack (as part of the message) - connection->pendingAck = GT2False; - - return GT2True; -} - -GT2Bool gti2SendAppReliable(GT2Connection connection, const GT2Byte * message, int len) -{ - int totalLen; - GT2Bool overflow; - - // magic string + type + SN + ESN + message - totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2 + len); - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgAppReliable, totalLen, &overflow)) - return GT2False; - if(overflow) - return GT2True; - - // write the message - gti2BufferWriteData(&connection->outgoingBuffer, message, len); - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendClientChallenge(GT2Connection connection, const char challenge[GTI2_CHALLENGE_LEN]) -{ - // magic string + type + SN + ESN + challenge - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2 + GTI2_CHALLENGE_LEN); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgClientChallenge, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // write the challenge - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)challenge, GTI2_CHALLENGE_LEN); - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendServerChallenge(GT2Connection connection, const char response[GTI2_RESPONSE_LEN], const char challenge[GTI2_CHALLENGE_LEN]) -{ - // magic string + type + SN + ESN + response + challenge - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2 + GTI2_RESPONSE_LEN + GTI2_CHALLENGE_LEN); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgServerChallenge, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // write the response - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)response, GTI2_RESPONSE_LEN); - - // write the challenge - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)challenge, GTI2_CHALLENGE_LEN); - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - // save the time - connection->challengeTime = connection->lastSend; - - return GT2True; -} - -GT2Bool gti2SendClientResponse(GT2Connection connection, const char response[GTI2_RESPONSE_LEN], const char * message, int len) -{ - // magic string + type + SN + ESN + response + message - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2 + GTI2_RESPONSE_LEN + len); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgClientResponse, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // write the response - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)response, GTI2_RESPONSE_LEN); - - // write the message - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)message, len); - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendAccept(GT2Connection connection) -{ - // magic string + type + SN + ESN - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgAccept, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendReject(GT2Connection connection, const GT2Byte * message, int len) -{ - // magic string + type + SN + ESN + message - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2 + len); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgReject, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // write the message - gti2BufferWriteData(&connection->outgoingBuffer, message, len); - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendClose(GT2Connection connection) -{ - // magic string + type + SN + ESN - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgClose, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendKeepAlive(GT2Connection connection) -{ - // magic string + type + SN + ESN - int totalLen = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2); - GT2Bool overflow; - - // begin the message - if(!gti2BeginReliableMessage(connection, GTI2MsgKeepAlive, totalLen + connection->socket->protocolOffset, &overflow)) - return GT2False; - - if(overflow) - return GT2True; - - // end the message - if(!gti2EndReliableMessage(connection)) - return GT2False; - - return GT2True; -} - -GT2Bool gti2SendAppUnreliable(GT2Connection connection, const GT2Byte * message, int len) -{ - int freeSpace; - int totalLen; - GT2Byte * start; - - // check if we can send it right away (unreliable that doesn't start with the magic string) - if((len < GTI2_MAGIC_STRING_LEN) || - (memcmp(message + connection->socket->protocolOffset, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN) != 0)) - { - if(!gti2ConnectionSendData(connection, message, len)) - return GT2False; - - return GT2True; - } - - // magic string + message - totalLen = (GTI2_MAGIC_STRING_LEN + len); - - // check how much free space is in the outgoing buffer - freeSpace = gti2GetBufferFreeSpace(&connection->outgoingBuffer); - - // do we have the space to hold it? - if(freeSpace < totalLen) - { - // just drop it - return GT2True; - } - - // store the start of the actual message in the buffer - start = (connection->outgoingBuffer.buffer + connection->outgoingBuffer.len); - - // Copy the VDP data length if necessary - if (connection->socket->protocolType == GTI2VdpProtocol) - gti2BufferWriteData(&connection->outgoingBuffer, message, 2); - - // copy it in, repeating the magic string at the beginning - gti2BufferWriteData(&connection->outgoingBuffer, (const GT2Byte *)GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN); - - // copy the data at the starting position + offset based on the protocol - gti2BufferWriteData(&connection->outgoingBuffer, message + connection->socket->protocolOffset, - (int)(len - connection->socket->protocolOffset)); - - // do the send - if(!gti2ConnectionSendData(connection, start, totalLen)) - return GT2False; - - // we don't need to save the message - gti2BufferShorten(&connection->outgoingBuffer, -1, totalLen); - - return GT2True; -} - -GT2Bool gti2SendAck(GT2Connection connection) -{ - // always allocate data length + magic string + type + ESN - // part of the buffer may not be used but more efficience to be on stack - char buffer[MAX_PROTOCOL_OFFSET + GTI2_MAGIC_STRING_LEN + 1 + 2]; - int pos = 0; - - // write the VDP data length - if (connection->socket->protocolType == GTI2VdpProtocol) - { - short dataLength = (GTI2_MAGIC_STRING_LEN + 1 + 2); - memcpy(buffer, &dataLength, 2); - pos += 2; - } - - // write the magic string - memcpy(buffer + pos, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN); - pos += GTI2_MAGIC_STRING_LEN; - - // write the type - buffer[pos++] = GTI2MsgAck; - - // write the ESN - gti2UShortToBuffer((GT2Byte *)buffer, pos, connection->expectedSerialNumber); - pos += 2; - - // send it - if(!gti2ConnectionSendData(connection, (const GT2Byte *)buffer, pos)) - return GT2False; - - // we just did an ack - connection->pendingAck = GT2False; - - return GT2True; -} - - -GT2Bool gti2SendNack(GT2Connection connection, unsigned short SNMin, unsigned short SNMax) -{ - // data length + magic string + type + SNMin [+ SNMax] - // part of the buffer may not be used but more efficience to be on stack - char buffer[MAX_PROTOCOL_OFFSET + GTI2_MAGIC_STRING_LEN + 1 + 2 + 2]; - int pos = 0; - - // write the VDP data length - if (connection->socket->protocolType == GTI2VdpProtocol) - { - short dataLength = (GTI2_MAGIC_STRING_LEN + 1 + 2 + 2); - memcpy(buffer, &dataLength, 2); - pos += 2; - } - - // write the magic string - memcpy(buffer + pos, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN); - pos += GTI2_MAGIC_STRING_LEN; - - // write the type - buffer[pos++] = GTI2MsgNack; - - // write the SNMin - gti2UShortToBuffer((GT2Byte *)buffer, pos, SNMin); - pos += 2; - - // write the SNMax if it's different - if(SNMin != SNMax) - { - gti2UShortToBuffer((GT2Byte *)buffer, pos, SNMax); - pos += 2; - } - - // send it - if(!gti2ConnectionSendData(connection, (const GT2Byte *)buffer, pos)) - return GT2False; - - return GT2True; -} - - -GT2Bool gti2SendPing(GT2Connection connection) -{ - // data length + magic string + type + "time" + current time - // part of the buffer may not be used but more efficience to be on stack - char buffer[MAX_PROTOCOL_OFFSET + GTI2_MAGIC_STRING_LEN + 1 + 4 + sizeof(gsi_time)]; - int pos = 0; - gsi_time now; - - // write the VDP data length - if (connection->socket->protocolType == GTI2VdpProtocol) - { - short dataLength = (GTI2_MAGIC_STRING_LEN + 1 + 4 + sizeof(gsi_time)); - memcpy(buffer, &dataLength, 2); - pos += 2; - } - // write the magic string - memcpy(buffer + pos, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN); - pos += GTI2_MAGIC_STRING_LEN; - - // write the type - buffer[pos++] = GTI2MsgPing; - - // copy the time id - memcpy(buffer + pos, "time", 4); - pos += 4; - - // write the current time - now = current_time(); - memcpy(buffer + pos, &now, sizeof(gsi_time)); - - pos += (int)sizeof(gsi_time); - // send it - if(!gti2ConnectionSendData(connection, (const GT2Byte *)buffer, pos)) - return GT2False; - - return GT2True; -} - - -GT2Bool gti2SendPong(GT2Connection connection, GT2Byte * message, int len) -{ - // change the ping to a pong - message[GTI2_MAGIC_STRING_LEN] = GTI2MsgPong; - - // send it - return gti2ConnectionSendData(connection, message, len); -} - -GT2Bool gti2SendClosed(GT2Connection connection) -{ - // normal close - return gti2SendClosedOnSocket(connection->socket, connection->ip, connection->port); -} - - -GT2Bool gti2SendClosedOnSocket(GT2Socket socket, unsigned int ip, unsigned short port) -{ - // Vdp data length (not including voice) + magic string + type - // part of the buffer may not be used but more efficience to be on stack - char buffer[MAX_PROTOCOL_OFFSET + GTI2_MAGIC_STRING_LEN + 1]; - int pos = 0; - - // write the data length - if (socket->protocolType == GTI2VdpProtocol) - { - short dataLength = GTI2_MAGIC_STRING_LEN + 1; - memcpy(buffer, &dataLength, 2); - pos += 2; - } - - // write the magic string - memcpy(buffer + pos, GTI2_MAGIC_STRING, GTI2_MAGIC_STRING_LEN); - pos += GTI2_MAGIC_STRING_LEN; - - // write the type - buffer[pos++] = GTI2MsgClosed; - - // send it - if(!gti2SocketSend(socket, ip, port, (const GT2Byte *)buffer, pos)) - return GT2False; - - return GT2True; -} - - -GT2Bool gti2ResendMessage(GT2Connection connection, GTI2OutgoingBufferMessage * message) -{ - GTI2MessageType type; - int pos; - - // replace the ESN (it's after the magic string, the type, and the SN) - pos = (message->start + connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN + 1 + 2); - - gti2UShortToBuffer(connection->outgoingBuffer.buffer, pos, connection->expectedSerialNumber); - - // send the message - if(!gti2ConnectionSendData(connection, connection->outgoingBuffer.buffer + message->start, message->len)) - return GT2False; - - // update the last time sent - message->lastSend = connection->lastSend; - - // if it was a server challenge, update that time too - type = (GTI2MessageType)connection->outgoingBuffer.buffer[message->start + connection->socket->protocolOffset + GTI2_MAGIC_STRING_LEN]; - - if(type == GTI2MsgServerChallenge) - connection->challengeTime = connection->lastSend; - - return GT2True; -} - -GT2Bool gti2Send(GT2Connection connection, const GT2Byte * message, int len, GT2Bool reliable) -{ - if (reliable) - return gti2SendAppReliable(connection, message, len); - //send unreliable messages - return gti2SendAppUnreliable(connection, message, len); -} - -GT2Bool gti2WasMessageIDConfirmed(const GT2Connection connection, GT2MessageID messageID) -{ - GTI2OutgoingBufferMessage * message; - int len; - - // if there are no reliable messages waiting confirmation, then this has already been confirmed - len = ArrayLength(connection->outgoingBufferMessages); - if(!len) - return GT2True; - - // get the oldest message waiting confirmation - message = (GTI2OutgoingBufferMessage *)ArrayNth(connection->outgoingBufferMessages, 0); - - // if the message id we are looking for is older than the first one waiting confirmation, - // then it has already been confirmed - if(gti2SNDiff(messageID, message->serialNumber) < 0) - return GT2True; - - // the message hasn't been confirmed yet - return GT2False; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Message.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Message.h deleted file mode 100644 index 96336bb1bf0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Message.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_MESSAGE_H_ -#define _GT2_MESSAGE_H_ - -#include "gt2Main.h" - -GT2Bool gti2ReceiveMessages(GT2Socket socket); - -GT2Bool gti2Send(GT2Connection connection, const GT2Byte * message, int len, GT2Bool reliable); - -GT2Bool gti2SendAppReliable(GT2Connection connection, const GT2Byte * message, int len); -GT2Bool gti2SendAppUnreliable(GT2Connection connection, const GT2Byte * message, int len); -GT2Bool gti2SendClientChallenge(GT2Connection connection, const char challenge[GTI2_CHALLENGE_LEN]); -GT2Bool gti2SendServerChallenge(GT2Connection connection, const char response[GTI2_RESPONSE_LEN], const char challenge[GTI2_CHALLENGE_LEN]); -GT2Bool gti2SendClientResponse(GT2Connection connection, const char response[GTI2_RESPONSE_LEN], const char * message, int len); -GT2Bool gti2SendAccept(GT2Connection connection); -GT2Bool gti2SendReject(GT2Connection connection, const GT2Byte * message, int len); -GT2Bool gti2SendClose(GT2Connection connection); -GT2Bool gti2SendKeepAlive(GT2Connection connection); -GT2Bool gti2SendAck(GT2Connection connection); -GT2Bool gti2SendNack(GT2Connection connection, unsigned short SNMin, unsigned short SNMax); -GT2Bool gti2SendPing(GT2Connection connection); -GT2Bool gti2SendPong(GT2Connection connection, GT2Byte * message, int len); -GT2Bool gti2SendClosed(GT2Connection connection); -GT2Bool gti2SendClosedOnSocket(GT2Socket socket, unsigned int ip, unsigned short port); - -GT2Bool gti2ResendMessage(GT2Connection connection, GTI2OutgoingBufferMessage * message); - -GT2Bool gti2HandleConnectionReset(GT2Socket socket, unsigned int ip, unsigned short port); -GT2Bool gti2HandleHostUnreachable(GT2Socket socket, unsigned int ip, unsigned short port, GT2Bool send); -GT2Bool gti2WasMessageIDConfirmed(const GT2Connection connection, GT2MessageID messageID); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Socket.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Socket.c deleted file mode 100644 index 31ef7d58eee..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Socket.c +++ /dev/null @@ -1,528 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#include "gt2Socket.h" -#include "gt2Buffer.h" -#include "gt2Message.h" -#include "gt2Connection.h" -#include "gt2Utility.h" -#include "gt2Callback.h" -#include - -#ifdef GSI_ADHOC -// External functions defined at the platform specific level -// to be moved to nonport or socket.h -extern int _NetworkAdHocSocketCreate(gsi_u16 port); -extern void _NetworkAdHocSocketDestroy ( int adhoc_socket); -extern int _NetworkAdHocSocketSendTo ( int adhoc_socket, - const void *data, - int len, - int flags, - const char *dest_addr, - gsi_u16 dest_port - ); -extern void NetAdhocMacGet(char *mac); -#endif - -#define GTI2_DEFAULT_INCOMING_BUFFER_SIZE (64 * 1024) -#define GTI2_DEFAULT_OUTGOING_BUFFER_SIZE (64 * 1024) - -#define STARTING_SERIAL_NUMBER 0 - -static int gti2ConnectionHash(const void * elem, int numBuckets) -{ - GT2Connection connection = *(GT2Connection *)elem; - - return (int)(((connection->ip * connection->port)) % numBuckets); -} - -static int GS_STATIC_CALLBACK gti2ConnectionCompare(const void * elem1, const void * elem2) -{ - GT2Connection connection1 = *(GT2Connection *)elem1; - GT2Connection connection2 = *(GT2Connection *)elem2; - - if(connection1->ip != connection2->ip) - return (int)(connection1->ip - connection2->ip); - - return (int)(short)(connection1->port - connection2->port); -} - -static void gti2ConnectionFree(void * elem) -{ - gti2ConnectionCleanup(*(GT2Connection *)elem); -} - -GT2Connection gti2SocketFindConnection(GT2Socket socket, unsigned int ip, unsigned short port) -{ - GTI2Connection connection; - GT2Connection connectionPtr; - GT2Connection * connectionPtrPtr; - - connection.ip = ip; - connection.port = port; - - connectionPtr = &connection; - connectionPtrPtr = (GT2Connection *)TableLookup(socket->connections, &connectionPtr); - if(connectionPtrPtr) - return *connectionPtrPtr; - - return NULL; -} - -GT2Result gti2CreateSocket -( - GT2Socket * sock, - const char * localAddress, - int outgoingBufferSize, - int incomingBufferSize, - gt2SocketErrorCallback callback, - GTI2ProtocolType type -) -{ - SOCKADDR_IN address; - GT2Socket socketTemp; - int rcode; - unsigned int ip; - unsigned short port; - int len; - - // startup the sockets engine if needed - SocketStartUp(); - - // check for using defaults - if(!incomingBufferSize) - incomingBufferSize = GTI2_DEFAULT_INCOMING_BUFFER_SIZE; - if(!outgoingBufferSize) - outgoingBufferSize = GTI2_DEFAULT_OUTGOING_BUFFER_SIZE; - - // convert the address to an IP and port - if(!gt2StringToAddress(localAddress, &ip, &port)) - return GT2AddressError; - - // allocate the object - socketTemp = (GT2Socket)gsimalloc(sizeof(GTI2Socket)); - if(!socketTemp) - return GT2OutOfMemory; - - // set initial values - memset(socketTemp, 0, sizeof(GTI2Socket)); - socketTemp->socket = INVALID_SOCKET; - socketTemp->incomingBufferSize = incomingBufferSize; - socketTemp->outgoingBufferSize = outgoingBufferSize; - socketTemp->socketErrorCallback = callback; - - // create the connections table - socketTemp->connections = TableNew2(sizeof(GT2Connection), 32, 2, gti2ConnectionHash, gti2ConnectionCompare, NULL); - if(!socketTemp->connections) - { - gsifree(socketTemp); - return GT2OutOfMemory; - } - - // create the closed connections list - socketTemp->closedConnections = ArrayNew(sizeof(GT2Connection), 4, gti2ConnectionFree); - if(!socketTemp->closedConnections) - { - TableFree(socketTemp->connections); - gsifree(socketTemp); - return GT2OutOfMemory; - } - - // create the socket - -#ifdef _XBOX - if (type == GTI2VdpProtocol) - - socketTemp->socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_VDP); - else -#endif -#ifdef GSI_ADHOC - if (type == GTI2AdHocProtocol) - { - socketTemp->socket = _NetworkAdHocSocketCreate( port); - } - else -#endif - socketTemp->socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - - socketTemp->protocolType = type; - - if (type == GTI2AdHocProtocol) - { - socketTemp->protocolOffset = 0; - } - else - socketTemp->protocolOffset = type; - -#ifdef _XBOX - if (type == GTI2UdpProtocol) - { - SetSockBroadcast(socketTemp->socket); - socketTemp->protocolOffset = type; - } -#endif - - if(socketTemp->socket == INVALID_SOCKET) - { - TableFree(socketTemp->connections); - ArrayFree(socketTemp->closedConnections); - gsifree(socketTemp); - return GT2NetworkError; - } - - // bind it - memset(&address, 0, sizeof(SOCKADDR_IN)); - address.sin_family = AF_INET; - address.sin_addr.s_addr = ip; - address.sin_port = htons(port); - if (type != GTI2AdHocProtocol) - { - rcode = bind(socketTemp->socket, (SOCKADDR *)&address, sizeof(SOCKADDR_IN)); - if (gsiSocketIsError(rcode)) - { - closesocket(socketTemp->socket); - TableFree(socketTemp->connections); - ArrayFree(socketTemp->closedConnections); - gsifree(socketTemp); - return GT2NetworkError; - } - } - - // get the ip and port we're bound to - #ifdef GSI_ADHOC - if (type == GTI2AdHocProtocol) - { - char mac[6]; - NetAdhocMacGet(mac); - - socketTemp->ip = gt2MacToIp(mac); - socketTemp->port = ntohs(address.sin_port); - } - else - #endif - { - len = sizeof(SOCKADDR_IN); - getsockname(socketTemp->socket, (SOCKADDR *)&address, &len); - socketTemp->ip = address.sin_addr.s_addr; - socketTemp->port = ntohs(address.sin_port); - } - - *sock = socketTemp; - - return GT2Success; -} - -void gti2CloseSocket(GT2Socket socket) -{ - - if(socket->callbackLevel) - { - socket->close = GT2True; - return; - } - -#ifdef GSI_ADHOC - if (socket->protocolType == GTI2AdHocProtocol) - { - _NetworkAdHocSocketDestroy(socket->socket); - } - else -#endif - { - closesocket(socket->socket); - } - - TableFree(socket->connections); - ArrayFree(socket->closedConnections); - gsifree(socket); - - SocketShutDown(); -} - -void gti2Listen(GT2Socket socket, gt2ConnectAttemptCallback callback) -{ - socket->connectAttemptCallback = callback; -} - -static GT2Connection gti2CreateConnectionObject(void) -{ - // mj todo: give options of allocating this from a static pool for games with known number of connections. - return (GT2Connection)gsimalloc(sizeof(GTI2Connection)); -} - -GT2Result gti2NewSocketConnection(GT2Socket socket, GT2Connection * connection, unsigned int ip, unsigned short port) -{ - GT2Connection connectionPtr = NULL; - - // check if this ip and port already exists - if(gti2SocketFindConnection(socket, ip, port)) - return GT2DuplicateAddress; - - // allocate a connection object - connectionPtr = gti2CreateConnectionObject(); - if(!connectionPtr) - goto out_of_memory; - - // set some basics - memset(connectionPtr, 0, sizeof(GTI2Connection)); - connectionPtr->ip = ip; - connectionPtr->port = port; - connectionPtr->socket = socket; - connectionPtr->startTime = current_time(); - connectionPtr->lastSend = connectionPtr->startTime; - connectionPtr->serialNumber = STARTING_SERIAL_NUMBER; - connectionPtr->expectedSerialNumber = STARTING_SERIAL_NUMBER; - - // allocate the buffers - if(!gti2AllocateBuffer(&connectionPtr->incomingBuffer, socket->incomingBufferSize)) - goto out_of_memory; - if(!gti2AllocateBuffer(&connectionPtr->outgoingBuffer, socket->outgoingBufferSize)) - goto out_of_memory; - - // allocate the message arrays - connectionPtr->incomingBufferMessages = ArrayNew(sizeof(GTI2IncomingBufferMessage), 64, NULL); - if(!connectionPtr->incomingBufferMessages) - goto out_of_memory; - connectionPtr->outgoingBufferMessages = ArrayNew(sizeof(GTI2OutgoingBufferMessage), 64, NULL); - if(!connectionPtr->outgoingBufferMessages) - goto out_of_memory; - - // allocate the filter arrays - connectionPtr->sendFilters = ArrayNew(sizeof(gt2SendFilterCallback), 2, NULL); - if(!connectionPtr->sendFilters) - goto out_of_memory; - connectionPtr->receiveFilters = ArrayNew(sizeof(gt2ReceiveFilterCallback), 2, NULL); - if(!connectionPtr->receiveFilters) - goto out_of_memory; - - // add it to the table - TableEnter(socket->connections, &connectionPtr); - - // check that it's in the table (and get the address) - *connection = gti2SocketFindConnection(socket, ip, port); - if(!*connection) - goto out_of_memory; - - return GT2Success; - -out_of_memory: - - // there wasn't enough memory, free everything and return the error - if(connectionPtr) - { - gsifree(connectionPtr->incomingBuffer.buffer); - gsifree(connectionPtr->outgoingBuffer.buffer); - if(connectionPtr->incomingBufferMessages) - ArrayFree(connectionPtr->incomingBufferMessages); - if(connectionPtr->outgoingBufferMessages) - ArrayFree(connectionPtr->outgoingBufferMessages); - if(connectionPtr->sendFilters) - ArrayFree(connectionPtr->sendFilters); - if(connectionPtr->receiveFilters) - ArrayFree(connectionPtr->receiveFilters); - gsifree(connectionPtr); - } - - return GT2OutOfMemory; -} - -void gti2FreeSocketConnection(GT2Connection connection) -{ - // check if we can actually free it - if(connection->freeAtAcceptReject || connection->callbackLevel) - return; - - // remove it from the correct list depending on the connect state - if(connection->state == GTI2Closed) - { - int len; - int i; - - len = ArrayLength(connection->socket->closedConnections); - for(i = 0 ; i < len ; i++) - { - if(connection == *(GT2Connection *)ArrayNth(connection->socket->closedConnections, i)) - { - ArrayDeleteAt(connection->socket->closedConnections, i); - return; - } - } - } - else - { - TableRemove(connection->socket->connections, &connection); - } -} - -GT2Bool gti2SocketSend(GT2Socket socket, unsigned int ip, unsigned short port, const GT2Byte * message, int len) -{ - SOCKADDR_IN address; - int rcode; - -#ifdef GTI2_DROP_SEND_RATE - // drop some percentage of packets and see what happens - if((rand() % 100) < GTI2_DROP_SEND_RATE) - return GT2True; -#endif - - // check the message and len - gti2MessageCheck(&message, &len); - - if (socket->protocolType != GTI2AdHocProtocol) - { - #ifndef INSOCK // insock never sets write flag for UDP sockets - // check if we can't send - if(!CanSendOnSocket(socket->socket)) - return GT2True; - #endif - } - - // do the send - #ifdef GSI_ADHOC - if (socket->protocolType == GTI2AdHocProtocol) - { - char mac[6]; - // convert to mac - gt2IpToMac(ip,mac); - // change IP address to mac ethernet - rcode = _NetworkAdHocSocketSendTo(socket->socket, (const char *)message, len, 0, mac, port); - if(rcode <0) - { - gti2SocketError(socket); - return gsi_false; - } - - // let the dump handle this - if(socket->sendDumpCallback) - { - if(!gti2DumpCallback(socket, gti2SocketFindConnection(socket, ip, port), ip, port, GT2False, message, len, GT2True)) - return GT2False; - } - return gsi_true; - } - - #endif - - // fill the address structure - memset(&address, 0, sizeof(SOCKADDR_IN)); - address.sin_family = AF_INET; - address.sin_addr.s_addr = ip; - address.sin_port = htons(port); - rcode = sendto(socket->socket, (const char *)message, len, 0, (SOCKADDR *)&address, sizeof(SOCKADDR_IN)); - if (gsiSocketIsError(rcode)) - { - rcode = GOAGetLastError(socket->socket); - if(rcode == WSAECONNRESET) - { - // handle the reset - if(!gti2HandleConnectionReset(socket, ip, port)) - return GT2False; - } -#ifndef SN_SYSTEMS - else if (rcode == WSAEHOSTUNREACH) - { - if (!gti2HandleHostUnreachable(socket, ip, port, GT2True)) - return GT2False; - } -#endif - // some systems might return these errors - else if((rcode == WSAENOBUFS) || (rcode == WSAEWOULDBLOCK)) - { - return GT2True; - } -#if defined(SN_SYSTEMS) || defined(_NITRO) || defined(_REVOLUTION) - // for systems that don't support WSAEHOSTDOWN (EHOSTDOWN) - else if((rcode != WSAEMSGSIZE)) -#else - else if((rcode != WSAEMSGSIZE) && (rcode != WSAEHOSTDOWN)) -#endif - { - // fatal socket error - gti2SocketError(socket); - return GT2False; - } - } - else - { - // let the dump handle this - if(socket->sendDumpCallback) - { - if(!gti2DumpCallback(socket, gti2SocketFindConnection(socket, ip, port), ip, port, GT2False, message, len, GT2True)) - return GT2False; - } - } - - return GT2True; -} - -static int gti2SocketConnectionsThinkMap(void * elem, void * clientData) -{ - GT2Connection connection = *(GT2Connection *)elem; - gsi_time now = *(gsi_time *)clientData; - - // only think if we're not closed - if(connection->state != GTI2Closed) - { - // think - if(!gti2ConnectionThink(connection, now)) - return 0; - } - - // check for a closed connection - if((connection->state == GTI2Closed) && !connection->freeAtAcceptReject && !connection->callbackLevel) - gti2FreeSocketConnection(connection); - - return 1; -} - -GT2Bool gti2SocketConnectionsThink(GT2Socket socket) -{ - gsi_time now; - - // get the current time - now = current_time(); - - // go through the list of connections and let them think - if(TableMapSafe2(socket->connections, gti2SocketConnectionsThinkMap, &now)) - return GT2False; - - return GT2True; -} - -void gti2FreeClosedConnections(GT2Socket socket) -{ - int i; - int len; - - // loop through the closed connections, attempting to free them all - len = ArrayLength(socket->closedConnections); - for(i = (len - 1) ; i >= 0 ; i--) - gti2FreeSocketConnection(*(GT2Connection *)ArrayNth(socket->closedConnections, i)); -} - -void gti2SocketError(GT2Socket socket) -{ - // if there was already an error, don't go through this again - if(socket->error) - return; - - // flag the error - socket->error = GT2True; - - // first close all the socket's connections - gt2CloseAllConnectionsHard(socket); - - // call the error callback - if(!gti2SocketErrorCallback(socket)) - return; - - // close the socket - gti2CloseSocket(socket); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Socket.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Socket.h deleted file mode 100644 index 5975945e5d0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Socket.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_SOCKET_H_ -#define _GT2_SOCKET_H_ - -#include "gt2Main.h" - -GT2Result gti2CreateSocket -( - GT2Socket * socket, - const char * localAddress, - int outgoingBufferSize, - int incomingBufferSize, - gt2SocketErrorCallback callback, - GTI2ProtocolType type -); - -void gti2CloseSocket(GT2Socket socket); - -void gti2Listen(GT2Socket socket, gt2ConnectAttemptCallback callback); - -GT2Result gti2NewSocketConnection(GT2Socket socket, GT2Connection * connection, unsigned int ip, unsigned short port); -void gti2FreeSocketConnection(GT2Connection connection); - -GT2Connection gti2SocketFindConnection(GT2Socket socket, unsigned int ip, unsigned short port); - -// ip is network byte order, port is host byte order -// returns false if there was a fatal error -GT2Bool gti2SocketSend(GT2Socket socket, unsigned int ip, unsigned short port, const GT2Byte * message, int len); - -GT2Bool gti2SocketConnectionsThink(GT2Socket socket); - -void gti2FreeClosedConnections(GT2Socket socket); - -void gti2SocketError(GT2Socket socket); - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Utility.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Utility.c deleted file mode 100644 index 88224aea40b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Utility.c +++ /dev/null @@ -1,426 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifdef XRAY_DISABLE_GAMESPY_WARNINGS -#pragma warning(disable: 4244) //lines: 130 -#endif //#ifdef XRAY_DISABLE_GAMESPY_WARNINGS - - -#include "gt2Main.h" -#include "gt2Utility.h" -#include -#include -#ifdef WIN32 -#include -#include -#endif - -#define GTI2_STACK_HOSTLEN_MAX 256 - - -/************************* -** BYTE ORDER FUNCTIONS ** -*************************/ - -unsigned int gt2NetworkToHostInt(unsigned int i) -{ - return (unsigned int)ntohl(i); -} - -unsigned int gt2HostToNetworkInt(unsigned int i) -{ - return (unsigned int)htonl(i); -} - -unsigned short gt2NetworkToHostShort(unsigned short s) -{ - return ntohs(s); -} - -unsigned short gt2HostToNetworkShort(unsigned short s) -{ - return htons(s); -} - -/******************************* -** INTERNET ADDRESS FUNCTIONS ** -*******************************/ - -const char * gt2AddressToString(unsigned int ip, unsigned short port, char string[22]) -{ - static char strAddressArray[2][22]; - static int nIndex; - char * strAddress; - - if(string) - strAddress = string; - else - { - nIndex ^= 1; - strAddress = strAddressArray[nIndex]; - } - - if(ip) - { - IN_ADDR inAddr; - - inAddr.s_addr = ip; - - if(port) - sprintf(strAddress, "%s:%d", inet_ntoa(inAddr), port); - else - sprintf(strAddress, "%s", inet_ntoa(inAddr)); - } - else if(port) - sprintf(strAddress, ":%d", port); - else - strAddress[0] = '\0'; - - return strAddress; -} - -GT2Bool gt2StringToAddress(const char * string, unsigned int * ip, unsigned short * port) -{ - unsigned int srcIP = 0; // avoid use uninit condition - unsigned short srcPort = 0; - - if(!string || !string[0]) - { - srcIP = 0; - srcPort = 0; - } - else - { - char stackHost[GTI2_STACK_HOSTLEN_MAX + 1]; - const char * colon; - const char * host; - - // Is there a port? - colon = strchr(string, ':'); - if(!colon) - { - // The string is the host. - host = string; - - // No port. - srcPort = 0; - } - else - { - int len; - const char * check; - int temp; - - // Is it just a port? - if(colon == string) - { - host = NULL; - srcIP = 0; - } - else - { - // Copy the host portion into the array on the stack. - len = (colon - string); - assert(len < GTI2_STACK_HOSTLEN_MAX); - memcpy(stackHost, string, (unsigned int)len); - stackHost[len] = '\0'; - host = stackHost; - } - - // Check the port. - for(check = (colon + 1) ; *check ; check++) - if(!isdigit(*check)) - return GT2False; - - // Get the port. - temp = atoi(colon + 1); - if((temp < 0) || (temp > 0xFFFF)) - return GT2False; - srcPort = (unsigned short)temp; - } - - // Is there a host? - if(host) - { - // Try dotted IP. - ///////////////// - srcIP = inet_addr(host); - if(srcIP == INADDR_NONE) - { -#if defined(_XBOX) - return GT2False; -#else - HOSTENT * hostent; - - hostent = gethostbyname(host); - if(hostent == NULL) - return GT2False; - - srcIP = *(unsigned int *)hostent->h_addr_list[0]; -#endif - } - } - } - - if(ip) - *ip = srcIP; - if(port) - *port = srcPort; - - return GT2True; -} - -#ifdef GSI_ADHOC -gsi_u32 gti2MacToIp(const char *mac) -// change mac ethernet to IP address -{ - // Mac (48 bit)<---> IP (32 bit) convertion. - // horrible hack. But the chances of a conflict are less then getting struck by lightning - // but in order to translate back, we will need to keep a table - // stick real value in table. - GTI2MacEntry *entry; - int i; - gsi_u32 ip; - memcpy(&ip,mac,4); // store rest in table - - - // find match in table - for (i=0;i< MAC_TABLE_SIZE;i++) - { - if(MacTable[i].ip == ip) - { - return ip; // already there, don't add to the table. - } - } - - - // if not found match, add it, overwriting oldest entry - entry = &MacTable[lastmactableentry]; - lastmactableentry = (lastmactableentry +1 ) & (MAC_TABLE_SIZE-1); - entry->ip = ip; - memcpy(entry->mac,mac,6); - - return ip; -} - -void gti2IpToMac(gsi_u32 ip,char *mac) -// change IP address to mac ethernet -{ - int i; - // find match in table - for (i=0;i< MAC_TABLE_SIZE;i++) - { - if(MacTable[i].ip == ip) - { - memcpy(mac,MacTable[i].mac,6); - return; - } - } - // error, can not find mac address - memset(mac,0,6); - GS_FAIL(); -} -#endif - -#if defined(_XBOX) - -// XBox doesn't support the address functions -static const char * gti2HandleHostInfo(HOSTENT * host, char *** aliases, unsigned int *** ips) { return NULL; } -const char * gt2IPToHostInfo(unsigned int ip, char *** aliases, unsigned int *** ips) { return NULL; } -const char * gt2StringToHostInfo(const char * string, char *** aliases, unsigned int *** ips) { return NULL; } - -unsigned int gt2XnAddrToIP(XNADDR theAddr, XNKID theKeyId) -{ - // String to fit ip address + : + port - IN_ADDR anAddr; - if (XNetXnAddrToInAddr(&theAddr, &theKeyId, &anAddr)== 0) - return anAddr.s_addr; - return 0; -} - -GT2Bool gt2IPToXnAddr(int ip, XNADDR *theAddr, XNKID *theKeyId) -{ - IN_ADDR anAddr; - anAddr.s_addr = ip; - if (XNetInAddrToXnAddr(anAddr, theAddr, theKeyId) == 0) - return GT2True; - return GT2False; -} - -#else - -static const char * gti2HandleHostInfo(HOSTENT * host, char *** aliases, unsigned int *** ips) -{ - if(!host || (host->h_addrtype != AF_INET) || (host->h_length != 4)) - return NULL; - - if(aliases) - *aliases = host->h_aliases; - if(ips) - *ips = (unsigned int **)host->h_addr_list; - - return host->h_name; -} - - -const char * gt2IPToHostInfo(unsigned int ip, char *** aliases, unsigned int *** ips) -{ -#ifdef _PSP - return NULL; -#else - HOSTENT * host; - - host = gethostbyaddr((const char *)&ip, 4, AF_INET); - - GSI_UNUSED(ip); - return gti2HandleHostInfo(host, aliases, ips); -#endif -} - -const char * gt2StringToHostInfo(const char * string, char *** aliases, unsigned int *** ips) -{ - HOSTENT * host; - unsigned int ip; - - if(!string || !string[0]) - return NULL; - - // Is the string actually a dotted IP? - ip = inet_addr(string); - if(ip != INADDR_NONE) - return gt2IPToHostInfo(ip, aliases, ips); - - host = gethostbyname(string); - - return gti2HandleHostInfo(host, aliases, ips); -} - -#endif - -const char * gt2IPToHostname(unsigned int ip) -{ - return gt2IPToHostInfo(ip, NULL, NULL); -} - -const char * gt2StringToHostname(const char * string) -{ - return gt2StringToHostInfo(string, NULL, NULL); -} - -char ** gt2IPToAliases(unsigned int ip) -{ - char ** aliases; - - if(!gt2IPToHostInfo(ip, &aliases, NULL)) - return NULL; - - return aliases; -} - -char ** gt2StringToAliases(const char * string) -{ - char ** aliases; - - if(!gt2StringToHostInfo(string, &aliases, NULL)) - return NULL; - - return aliases; -} - -unsigned int ** gt2IPToIPs(unsigned int ip) -{ - unsigned int ** ips; - - if(!gt2IPToHostInfo(ip, NULL, &ips)) - return NULL; - - return ips; -} - -unsigned int ** gt2StringToIPs(const char * string) -{ - unsigned int ** ips; - - if(!gt2StringToHostInfo(string, NULL, &ips)) - return NULL; - - return ips; -} - -/*********************** -** INTERNAL FUNCTIONS ** -***********************/ - -#ifdef __MWERKS__ // CodeWarrior will warn if not prototyped -void gti2MessageCheck(const GT2Byte ** message, int * len); -#endif - -// Used from gt2main.c -void gti2MessageCheck(const GT2Byte ** message, int * len) -{ - // check for an empty message - if(!*message) - { - *message = (const GT2Byte *)""; - *len = 0; - } - // check for calculating the message length - else if(*len == -1) - { - *len = (int)(strlen((const char *)*message) + 1); - } -} - -#ifdef RECV_LOG -void gti2LogMessage -( - unsigned int fromIP, unsigned short fromPort, - unsigned int toIP, unsigned short toPort, - const GT2Byte * message, int len -) -{ - FILE * file; - IN_ADDR ip; - int i; -#ifdef WIN32 - struct _timeb utcTime; - struct tm * now; -#endif - - file = fopen("recv.log", "at"); - if(!file) - return; - - // date-time -#ifdef WIN32 - _ftime(&utcTime); - now = localtime(&utcTime.time); - fprintf(file, "%02d.%02d.%02d %02d:%02d:%02d.%03d\n", - now->tm_year - 100, now->tm_mon + 1, now->tm_mday, - now->tm_hour, now->tm_min, now->tm_sec, utcTime.millitm); -#endif - - // from - ip.s_addr = fromIP; - fprintf(file, "%s:%d -> ", inet_ntoa(ip), fromPort); - - // to - ip.s_addr = toIP; - fprintf(file, "%s:%d\n", inet_ntoa(ip), toPort); - - // data - fprintf(file, "%d: ", len); - for(i = 0 ; i < len ; i++) - fprintf(file, "%02X ", message[i]); - fprintf(file, "\n\n"); - - fclose(file); -} -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Utility.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Utility.h deleted file mode 100644 index 34a5e4399b9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2Utility.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -GameSpy GT2 SDK -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2002 GameSpy Industries, Inc - -devsupport@gamespy.com -*/ - -#ifndef _GT2_UTILITY_H_ -#define _GT2_UTILITY_H_ - -#include "gt2Main.h" - -void gti2MessageCheck(const GT2Byte ** message, int * len); - -#ifdef RECV_LOG -void gti2LogMessage -( - unsigned int fromIP, unsigned short fromPort, - unsigned int toIP, unsigned short toPort, - const GT2Byte * message, int len -); -#endif - - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2_vs2005.sln b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2_vs2005.sln deleted file mode 100644 index 6ac6b91a120..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2_vs2005.sln +++ /dev/null @@ -1,132 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2action_vs2005", "gt2action\gt2action_vs2005.vcproj", "{A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2hostmig_vs2005", "gt2hostmig\gt2hostmig_vs2005.vcproj", "{1CE7906B-6082-4042-B34F-9373D77DB425}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2nat_vs2005", "gt2nat\gt2nat_vs2005.vcproj", "{1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2proxy_vs2005", "gt2proxy\gt2proxy_vs2005.vcproj", "{48BE03E2-3540-4386-BC9E-7E4B9F35135F}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2test_vs2005", "gt2test\gt2test_vs2005.vcproj", "{666F1A4F-216F-40D3-900F-7BAA3FEC31A9}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2testc_vs2005", "gt2testc\gt2testc_vs2005.vcproj", "{40E74A60-8858-4463-BAF3-B4EC4E1962B1}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E7EB5AF1-6849-465B-BCEB-D21F2E882B7A}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection - ProjectSection(SolutionItems) = preProject - changelog.txt = changelog.txt - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 7 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gt2action\\gt2action_vs2005.vcproj - SccProjectName1 = gt2action - SccLocalPath1 = gt2action - SccProjectUniqueName2 = gt2hostmig\\gt2hostmig_vs2005.vcproj - SccProjectName2 = gt2hostmig - SccLocalPath2 = gt2hostmig - SccProjectUniqueName3 = gt2nat\\gt2nat_vs2005.vcproj - SccProjectName3 = gt2nat - SccLocalPath3 = gt2nat - SccProjectUniqueName4 = gt2proxy\\gt2proxy_vs2005.vcproj - SccProjectName4 = gt2proxy - SccLocalPath4 = gt2proxy - SccProjectUniqueName5 = gt2test\\gt2test_vs2005.vcproj - SccProjectName5 = gt2test - SccLocalPath5 = gt2test - SccProjectUniqueName6 = gt2testc\\gt2testc_vs2005.vcproj - SccProjectName6 = gt2testc - SccLocalPath6 = gt2testc - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release|Win32 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Debug|Win32.ActiveCfg = Debug|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Debug|Win32.Build.0 = Debug|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Release|Win32.ActiveCfg = Release|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Release|Win32.Build.0 = Release|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {A982C0BF-D9A9-4CB3-91EA-C4D95CD96361}.Unicode Release|Win32.Build.0 = Release|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Debug|Win32.ActiveCfg = Debug|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Debug|Win32.Build.0 = Debug|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Release|Win32.ActiveCfg = Release|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Release|Win32.Build.0 = Release|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {1CE7906B-6082-4042-B34F-9373D77DB425}.Unicode Release|Win32.Build.0 = Release|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Debug|Win32.ActiveCfg = Debug|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Debug|Win32.Build.0 = Debug|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Release|Win32.ActiveCfg = Release|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Release|Win32.Build.0 = Release|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {1DDD5585-F0E6-45F3-92D6-BC671A9BA4E6}.Unicode Release|Win32.Build.0 = Release|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Debug|Win32.ActiveCfg = Debug|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Debug|Win32.Build.0 = Debug|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Release|Win32.ActiveCfg = Release|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Release|Win32.Build.0 = Release|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {48BE03E2-3540-4386-BC9E-7E4B9F35135F}.Unicode Release|Win32.Build.0 = Release|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Debug|Win32.ActiveCfg = Debug|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Debug|Win32.Build.0 = Debug|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Release|Win32.ActiveCfg = Release|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Release|Win32.Build.0 = Release|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Unicode Debug|Win32.ActiveCfg = Debug|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Unicode Debug|Win32.Build.0 = Debug|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Unicode Release|Win32.ActiveCfg = Release|Win32 - {666F1A4F-216F-40D3-900F-7BAA3FEC31A9}.Unicode Release|Win32.Build.0 = Release|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Debug|Win32.ActiveCfg = Debug|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Debug|Win32.Build.0 = Debug|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Release|Win32.ActiveCfg = Release|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Release|Win32.Build.0 = Release|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 - {40E74A60-8858-4463-BAF3-B4EC4E1962B1}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2_vs2005.vssscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2_vs2005.vssscc deleted file mode 100644 index 6cb031bcf51..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2_vs2005.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/TGAFile.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/TGAFile.cpp deleted file mode 100644 index d65382e5023..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/TGAFile.cpp +++ /dev/null @@ -1,1574 +0,0 @@ -/* - - Modified by Chris Losinger for Smaller Animals Software's ImgLib/ImgDLL. - Esp. RGB->BGR and row order switches. 9/98 -*/ -#include -#include - -/* - TGADefs.h - Tye and Constant declaration file - This File defines the Types, and the Constant Values used by the - TGAFile Class. - - Created By: Timothy A. Bish - Created On: 08/18/98 -*/ - -#ifndef TGADEFSH -#define TGADEFSH - -#include - -#pragma pack(1) // Align the structure on byte boundries... - -// Possible Image Types -#define TGA_NOIMAGETYPE 0 // No Image Data Included in Image -#define TGA_MAPRGBTYPE 1 // Colormapped Image Data - No Compression -#define TGA_RAWRGBTYPE 2 // Truecolor Image Data - No Compression -#define TGA_RAWMONOTYPE 3 // Monochrome Image Data - No Compression -#define TGA_MAPENCODETYPE 9 // Colormapped Image Data - Compressed RLE -#define TGA_RAWENCODETYPE 10 // Truecolor Image Data - Compressed RLE -#define TGA_MONOENCODETYPE 11 // Monochrome Image Data - Compressed RLE -// Version Macro -#define TGA_VERSIONONE 1 // Version 1 File Format -#define TGA_VERSIONTWO 2 // Version 2 File Format -// File Read Write Modes -const int GREYSC = 0; // Image is Greyscale -const int COLOUR = 1; // Image is Color -const int MAPPED = 2; // Image has a Color Map -const int RLENCO = 4; // Image is RLE Encoded - -// 18 Byte Sturcture representin the basic definitions of -// the image -typedef struct _aTGAHEADER -{ - BYTE IDLength; // 00h Size of ID Field - BYTE ColorMapType; // 01h Color Map Type - BYTE ImageType; // 02h Image Type Code - WORD CMapStart; // 03h Color Map Origin - WORD CMapLength; // 05h Color Map Length - BYTE CMapDepth; // 07h Color Map Depth - WORD XOffset; // 08h X origin of Image - WORD YOffset; // 0Ah Y origin of Image - WORD Width; // 0Ch Width of Image - WORD Height; // 0Eh Height of Image - BYTE PixelDepth; // 10h Image Pixel Size - BYTE ImageDescriptor; // 11h Image Description Byte -} TGAHEADER; - -// The footer is 26 Bytes in length and is always at the end of a -// TGA v2.0 file. -typedef struct _aTGAFOOTER -{ - DWORD ExtensionOffset; // Extension Area Offset - DWORD DeveloperOffset; // Developer Directory Offset - CHAR Signature[18]; // TGA Signature -} TGAFOOTER; - -typedef struct _aTGATAG -{ - WORD TagNumber; // ID Number of the Tag - DWORD DataOffset; // Offset Location of the Tag - DWORD DataSize; // Size of the Tag Data in Bytes -} TGATAG; - -// The extension area is basically the second header in the TGA v2.0 -// file format. -typedef struct _aTGAEXTENSION -{ - WORD Size; // Extension Size - CHAR AuthorName[41]; // Author Name - CHAR AuthorComment[324]; // Author Comment - WORD StampMonth; // Date/Time Stamp: Month - WORD StampDay; // Date/Time Stamp: Day - WORD StampYear; // Date/Time Stamp: Year - WORD StampHour; // Date/Time Stamp: Hour - WORD StampMinute; // Date/Time Stamp: Minute - WORD StampSecond; // Date/Time Stamp: Second - CHAR JobName[41]; // Job Name/ID - WORD JobHour; // Job Time: Hours - WORD JobMinute; // Job Time: Minutes - WORD JobSecond; // Job Time: Seconds - CHAR SoftwareId[41]; // Software ID - WORD VersionNumber; // Version Number of Software - BYTE VersionLetter; // Version Letter of Software - DWORD KeyColor; // Key Color - WORD PixelNumerator; // Pixel Aspect Ratio - WORD PixelDenominator; // Pixel Aspect Ratio - WORD GammaNumerator; // Gamma Value - WORD GammaDenominator; // Gamma Value - DWORD ColorOffset; // Color Correction Offset - DWORD StampOffset; // Postage Stamp Offset - DWORD ScanOffset; // Scanline Table Offset - BYTE AttributesType; // Attributes Type -} TGAEXTENSION; - -// The Color Correction Table is an array of 2048 Bytes in length, which -// contians 256 entries used to store the values used for color remapping. -typedef struct _aTGACOLORCORRECTIONTABLE -{ - SHORT Alpha; // Alpha Channel Seldom Used - SHORT Red; // Red Value of Correction - SHORT Green; // Green Value of Correction - SHORT Blue; // Green Value of Correction -} TGACOLORCORRECTIONTABLE; - -#define TRIALVERSION -1 // LIB was not initialized with a registered key - -#define IMGOK 0 // no err -#define MEMERR 1 // out of mem -#define FILEOPENERR 2 // error on file open -#define FILEREADERR 3 // error on file read -#define FILEWRITEERR 4 // error on file write -#define BADPARAMERR 5 // bad user param -#define INVALIDBMPERR 6 // bad BMP file -#define BMPRLEERR 7 // we don't do compressed (RLE) BMP files -#define INVALIDGIFERR 8 // bad GIF file -#define INVALIDJPGERR 9 // bad JPG file -#define IMGDCERR 10 // error with device context -#define IMGDIBERR 11 // problem with a GetDIBits call -#define NOGIFERR 12 // GIF support disabled -#define IMGNORESOURCE 13 // resource not found -#define CALLBACKCANCEL 14 // callback returned FALSE - operation aborted -#define INVALIDPNGERR 15 // bad PNG file -#define PNGCREATEERR 16 // internal PNG lib behavior - contact smaller animals s.w. -#define IMGDLLINTERNAL 17 // misc unexpected behavior error - contact smaller animals s.w. -#define IMGFONTERR 18 // trouble creating a font object -#define INTTIFFERR 19 // misc internal TIFF error -#define INVALIDTIFFERR 20 // invalid TIFF file -#define TIFFLZWNOTSUPPORTED 21 // this will not read TIFF-LZW iamges -#define INVALIDPCXERR 22 // invalid PCX image -#define CREATEBMPERR 23 // a call to the fn CreateCompatibleBitmap failed -#define IMGNOLINES 24 // end of an image while using single-line de/compression -#define GETDIBERR 25 // error during a call to GetDIBits -#define DEVOPNOSUPPORT 26 // device does not support an operation required by this function -#define INVALIDWMF 27 // invalid windows metafile -#define DEPTHMISMATCHERR 28 // the file was not of the requested bit-depth -#define INVALIDTGAERR 35 // Invalid TGA File -#define NOTGATHUMBNAIL 36 // No TGA Thumbnail in the file - -#pragma pack() - -#endif - -class TGAFile -{ - -public: - - // parameters - __int32 m_error; - -public: - - // operations - - TGAFile(); - - BOOL IsFileTGA(const char * fileName); - - LPVOID LoadTGA( const char *fileName, // Name of file - UINT32 *width, // Width in Pixel - UINT32 *height); // Height - - HGLOBAL LoadTGA8Bit(const char *fileName, // Name of File - UINT32 *width, // Width in pixels - UINT32 *height, // Height - RGBQUAD *pal); // Palette of RGBQUADS - - BOOL GetTGADims(const char *fileName, - UINT32 *width, - UINT32 *height); - - BOOL SaveTGA32(const char * fileName, // output path - BYTE *inBuf, // RGB buffer - UINT32 width, // size - UINT32 height); - - BOOL Save8BitTGA(const char * fileName, // output path - BYTE *colormappedbuffer, // one BYTE per pixel colomapped image - UINT32 width, // Width of image - UINT32 height, // Height of image - __int32 colors, // number of colors (number of RGBQUADs) - RGBQUAD *colormap); // array of RGBQUADs - - HGLOBAL LoadTGAThumbnail(const char *fileName, // Name of file - UINT32 *width, // Width in Pixel - UINT32 *height); // Height - -private: - - // Parameters - - char TGA_ImageIDFeild[256];// Text in file - BYTE TGA_Attribute; // Number of attribute bytes per pixel - // i.e. 1 for T16 and 8 for T32 - UINT32 mode; // Mode of current Read or Write - - // RLE Decompression Variables - BYTE Red, // Stores pixel value for - Grn, // RLE series of oixels - Blu, - Alpha; - UINT32 l; // Used when 8 bit files use RLE - __int32 RLECount, RLEFlag; // Indicates whether the RLE series - // is still going or is finished - -private: - - // Operations - - __int32 TGA_GetFileVersion(FILE *fp); // Determines whether this is a V1.0 - // or V2.0 TGA File - BOOL TGA_GetMapEntry(BYTE *Red, // Get the Color Values out of the - BYTE *Green, // Color map in the TGA File - BYTE *Blue, // Return TRUE on Success - BYTE *Alpha, - FILE *fp, - UINT32 Depth); - - // version that takes a file ptr - BOOL TGA_GetPixelValue(BYTE *Red, // Get and parse a single pixel value - BYTE *Grn, // from the TGA file. Handles Unencoding - BYTE *Blu, // of RLE encoded files. - BYTE *Alp, // plus Alpha (08jan00/bgw) - FILE *fp, - UINT32 PixelDepth, - RGBQUAD *CMap); - - // version that takes a buffer ptr - BOOL TGA_GetPixelValue(BYTE *Red, // Get and parse a single pixel value - BYTE *Grn, // from the TGA file. Handles Unencoding - BYTE *Blu, // of RLE encoded files. - BYTE *Alp, // plus Alpha (08jan00/bgw) - BYTE ** ppTGAData, - UINT32 PixelDepth, - RGBQUAD *CMap); -}; - -//#define MAX_IMAGEREAD_BUFFER 65535 -//BYTE * gpImageReadBuffer = NULL; -//long glImageReadBufferSize = 0; -//BYTE * gpImageReadBufPos = NULL; -// -// -//typedef struct tagTGAColorComponents -// { -// BYTE red; -// BYTE green; -// BYTE blue; -// BYTE alpha; -// } TGAColorComponents; - -/* TGA File REader Classs Implementation File - This Implementation Allows the reading of TGA (Targa) Files - into an RGB buffer. Also the class allows an RGB Buffer to be - written to a TGA File. There is also a function to determine - the dimensions of a TGA file. - - Created By: Timothy A. Bish - Created On: 08/17/98 - -*/ -//////////////////////////////////////////////////////////////////////////// -// No Much going on here -TGAFile::TGAFile() - { - m_error = IMGOK; - } - - -//////////////////////////////////////////////////////////////////////////// -// GetTGADimns -// Find dims of the image in a TGA file -// Returns - TRUE on success -BOOL -TGAFile::GetTGADims(const char * fileName, UINT32 * width, UINT32 * height) - { - // for safety - *width = 0; - *height = 0; - FILE * fp; - TGAHEADER tgahd; - - // Init the file Header to all zeros - ZeroMemory(&tgahd, sizeof(tgahd)); - - // init - m_error = IMGOK; - fp = fopen(fileName, "rb"); - - if(fp == NULL) - { - m_error = FILEOPENERR; - return FALSE; - } - - // Get the Header - if(fread(&tgahd, 1, sizeof(TGAHEADER), fp) != sizeof(TGAHEADER)) - { - m_error = FILEREADERR; - fclose(fp); - return FALSE; - } - - // Check fo valid data in structure - if(tgahd.PixelDepth > 32) - { - // I don't do Pixel Depths Bigger than 32 - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Anything other than the standard TGA types - // and I quit - switch(tgahd.ImageType) - { - case TGA_MAPRGBTYPE: - case TGA_RAWRGBTYPE: - case TGA_RAWMONOTYPE: - case TGA_MAPENCODETYPE: - case TGA_RAWENCODETYPE: - case TGA_MONOENCODETYPE: - break; - - default: - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Grab the Image dimensions - *width = tgahd.Width; - *height = tgahd.Height; - fclose(fp); - return TRUE; - } - -/***************************************************************************** -* NAME: -* TGAFile::IsFileTGA -* -* DESCRIPTION: -* Description goes here... -* -*******************************************************************************/ -BOOL -TGAFile::IsFileTGA(const char * fileName) - { - TGAHEADER tgahd; - FILE * fp; - - ZeroMemory(&tgahd, sizeof(tgahd)); - fp = fopen(fileName, "rb"); - long rc = fread(&tgahd, 1, sizeof(TGAHEADER), fp); - fclose(fp); - - if( (rc == sizeof(TGAHEADER)) && // must be big enough for a header... - (tgahd.PixelDepth == 32) && // 32-bit TGAs only - (tgahd.ImageType == TGA_RAWRGBTYPE) ) // Raw RGBA format only - return(TRUE); - - return(FALSE); - } - -//////////////////////////////////////////////////////////////////////////// -// LoadTGA -// load a .TGA file - 1,4,8,24,32 bit -// allocates and returns an RGB buffer containing the image. -// modifies width and height accordingly - NULL, 0, 0 on error -LPVOID -TGAFile::LoadTGA(const char * fileName, UINT32 * width, UINT32 * height) - { - LPVOID pNew = NULL; - BYTE * pRGB = NULL; - BYTE Alpha; - - TGAHEADER tgahd; - - BYTE TGA_Origin = 0; - - RGBQUAD CColMap[256]; - - // for safety - *width = 0; - *height = 0; - - // init - m_error = IMGOK; - - // Init the file Header to all zeros - ZeroMemory(&tgahd, sizeof(tgahd)); - FILE * fp; - fp = fopen(fileName, "rb"); - - if(fp == NULL) - { - m_error = FILEOPENERR; - return FALSE; - } - - // Read the TGA Header - long rc = fread(&tgahd, 1, sizeof(TGAHEADER), fp); - - if(rc != sizeof(TGAHEADER)) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Check fo valid data in structure - if((tgahd.PixelDepth> 32) || (tgahd.PixelDepth<8)) - { - // I don't do Pixel Depths Bigger than 32 - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Anything other than the standard TGA types - // and I quit - switch(tgahd.ImageType) - { - case TGA_MAPRGBTYPE: - case TGA_RAWRGBTYPE: - case TGA_RAWMONOTYPE: - case TGA_MAPENCODETYPE: - case TGA_RAWENCODETYPE: - case TGA_MONOENCODETYPE: - break; - - default: - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Set the number of Color Planes - if(tgahd.ImageType == TGA_RAWMONOTYPE) - { - mode = GREYSC; - } - else - { - mode = COLOUR; - } - - // Read the ID Descriptor if present - if(tgahd.IDLength != 0) - { - // Read the TGA Comments - long rc = fread(&TGA_ImageIDFeild, 1, tgahd.IDLength, fp); - - if(rc != tgahd.IDLength) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - } - - // Parse the Image Descriptor - TGA_Attribute = (BYTE)(tgahd.ImageDescriptor & 0x0f); - TGA_Origin = (BYTE)((tgahd.ImageDescriptor & 0x20) / 32); - - // If present read the color map - if(tgahd.ColorMapType != 0) - { - // Get the color map - for(__int32 i = 0; i < (tgahd.CMapStart + tgahd.CMapLength); i++) - { - TGA_GetMapEntry(&CColMap[i].rgbRed, &CColMap[i].rgbGreen, &CColMap[i].rgbBlue, &Alpha, fp, tgahd.CMapDepth); - } - - // If the TGA file actually needs the color map - // Set the mode to show this - if((tgahd.ImageType != TGA_RAWRGBTYPE) && (tgahd.ImageType != TGA_RAWMONOTYPE) && (tgahd.ImageType != TGA_RAWENCODETYPE)) - mode = mode | MAPPED; - } - - // Check Run Length Encoding - if((tgahd.ImageType == TGA_MAPENCODETYPE) || (tgahd.ImageType == TGA_RAWENCODETYPE) || (tgahd.ImageType == TGA_MONOENCODETYPE)) - mode = mode | RLENCO; - - long lImgDataSize = (tgahd.Height * tgahd.Width) * (tgahd.PixelDepth / 8); - - // Allocate the memory buffers - pNew = malloc(lImgDataSize); -// pNew = (LPVOID) theApp.m_TGABuffer.GetBuffer((size_t)(tgahd.Width * tgahd.Height * 4)); - - if(pNew == NULL) - { - m_error = MEMERR; - fclose(fp); - return NULL; - } - else - pRGB = (BYTE *)pNew; - - // RGB from image Data - //DWORD destOffset = 0; - - RLECount = 0; - RLEFlag = 0; - -// // -// // (re-)alocate a local image buffer to read the TGA formatted -// // data into. this avoids the huge critical-section delays in -// // every call to getc(). -// // -// long lBufSize = lImgDataSize + 16; // slop -// if(lBufSize < MAX_IMAGEREAD_BUFFER) -// lBufSize = MAX_IMAGEREAD_BUFFER; -// if(glImageReadBufferSize < lBufSize) -// { -// if(gpImageReadBuffer) -// { -// free(gpImageReadBuffer); -// gpImageReadBuffer = NULL; // tidy -// gpImageReadBufPos = NULL; -// } -// -// glImageReadBufferSize = lBufSize; -// gpImageReadBuffer = (BYTE *) malloc(glImageReadBufferSize); -// -// if(!gpImageReadBuffer) -// { -// glImageReadBufferSize = 0; -// return NULL; // v. bad news. -// } -// TRACE("* (Re-)Allocated local TGA data buffer: %d bytes\n", glImageReadBufferSize); -// } - - // - // Read the TGA format data into the local buffer - // - long lTGABytesRead = fread(pRGB, 1, lImgDataSize, fp); - if(lTGABytesRead != lImgDataSize) - { -// ASSERT(0); - //free(pNew); - return NULL; - } - - // Grab the image dimensions - *width = tgahd.Width; - *height = tgahd.Height; - - // Clean Up - fclose(fp); - m_error = IMGOK; - return pNew; - -/////////////// -// all out...dorks didn't realize that TGA's memory format == DIBSections! -////////////// -#if 0 - // - // Read the TGA format data into the local buffer - // - long lTGABytesRead = fread(gpImageReadBuffer, 1, lImgDataSize, fp); - if(lTGABytesRead != lImgDataSize) - { - ASSERT(0); - return NULL; - } - - gpImageReadBufPos = gpImageReadBuffer; - - // copy DWORDs instead of bytes... - UINT32 * pPixel = (UINT32 *) pRGB; - UINT32 * pReadBufPixel = (UINT32 *) gpImageReadBufPos; - - for(UINT32 row = 0; row < tgahd.Height; row++) - { - for(UINT32 col = 0; col < tgahd.Width; col++) - { - - // Reset RLE Counters - BYTE Red, Grn, Blu, Alp; - TGA_GetPixelValue(&Red, &Grn, &Blu, &Alp, &gpImageReadBufPos, tgahd.PixelDepth, CColMap); - - // Invert if the image origin is in Bottom left - if(TGA_Origin != 0) - { // Bottom Left Origin - destOffset = ((tgahd.Height -1) -row) * tgahd.Width * 4 + col * 4; - *(pRGB + destOffset + 0) = Red; - *(pRGB + destOffset + 1) = Grn; - *(pRGB + destOffset + 2) = Blu; - *(pRGB + destOffset + 3) = Alp; - } - else - { // Top Left Origin - *(pRGB + destOffset + 0) = Red; - *(pRGB + destOffset + 1) = Grn; - *(pRGB + destOffset + 2) = Blu; - *(pRGB + destOffset + 3) = Alp; - destOffset += 4; - } - #if 0 // even faster! - // Red = *(gpImageReadBufPos++); - // Grn = *(gpImageReadBufPos++); - // Blu = *(gpImageReadBufPos++); - // Alp = *(gpImageReadBufPos++); - // - // *(pRGB + destOffset + 0) = Red; - // *(pRGB + destOffset + 1) = Grn; - // *(pRGB + destOffset + 2) = Blu; - // *(pRGB + destOffset + 3) = Alp; - // destOffset += 4; - - // TGAColorComponents rgbaPixel; - - *(pPixel++) = *(pReadBufPixel++); - - // BYTE * p = pRGB + destOffset; - // *(p++) = *(gpImageReadBufPos++); - // *(p++) = *(gpImageReadBufPos++); - // *(p++) = *(gpImageReadBufPos++); - // *(p++) = *(gpImageReadBufPos++); - // destOffset += 4; - #endif - } // loop col - } // loop row - - // Grab the image dimensions - *width = tgahd.Width; - *height = tgahd.Height; - - // Clean Up - fclose(fp); - m_error = IMGOK; - return pNew; -#endif - } - - -/////////////////////////////////////////////////////////////////////////////////// -// LoadTGA8Bit -// Loads in an 8 Bit buffer and the color palette that is -// associated with that buffer, if the image is 8 Bit, else -// it sets global error to DEPTHMISMATCHERR -HGLOBAL -TGAFile::LoadTGA8Bit(const char * fileName, // Name of File -UINT32 * width, // Width in pixels -UINT32 * height, // Height -RGBQUAD * pal) // Palette of RGBQUADS - { - HGLOBAL hNew = NULL; - BYTE * pRGB = NULL; - BYTE Alpha; - - TGAHEADER tgahd; - - BYTE TGA_Origin = 0; - - // for safety - *width = 0; - *height = 0; - - // init - m_error = IMGOK; - - // Init the file Header to all zeros - ZeroMemory(&tgahd, sizeof(tgahd)); - - // Init the Palette to all zeros - ZeroMemory(pal, sizeof(pal)); - FILE * fp; - fp = fopen(fileName, "rb"); - - if(fp == NULL) - { - m_error = FILEOPENERR; - return FALSE; - } - else - { - // Read the TGA Header - long rc = fread(&tgahd, 1, sizeof(TGAHEADER), fp); - - if(rc != sizeof(TGAHEADER)) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Check fo valid data in structure - if(tgahd.PixelDepth> 8) - { - // Not an 8bit Image - m_error = DEPTHMISMATCHERR; - fclose(fp); - return NULL; - } - - // Anything other than the standard TGA types - // and I quit - switch(tgahd.ImageType) - { - case TGA_MAPRGBTYPE: - case TGA_MAPENCODETYPE: - break; - - default: - m_error = DEPTHMISMATCHERR; - fclose(fp); - return NULL; - } - - // Set the Color Mode - if(tgahd.ImageType == TGA_RAWMONOTYPE) - { - mode = GREYSC; - } - else - { - mode = COLOUR; - } - - // Read the ID Descriptor if present - if(tgahd.IDLength != 0) - { - // Read the TGA Comments - long rc = fread(&TGA_ImageIDFeild, 1, tgahd.IDLength, fp); - - if(rc != tgahd.IDLength) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - } - - // Parse the Image Descriptor - TGA_Attribute = (BYTE)(tgahd.ImageDescriptor & 0x0f); - TGA_Origin = (BYTE)((tgahd.ImageDescriptor & 0x20) / 32); - - // If present read the color map - if(tgahd.ColorMapType != 0) - { - // Get the color map - for(__int32 i = 0; i < (tgahd.CMapStart + tgahd.CMapLength); i++) - { - TGA_GetMapEntry(&pal[i].rgbRed, &pal[i].rgbGreen, &pal[i].rgbBlue, &Alpha, fp, tgahd.CMapDepth); - } - } - else - { - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Check Run Length Encoding - if((tgahd.ImageType == TGA_MAPENCODETYPE) || (tgahd.ImageType == TGA_RAWENCODETYPE) || (tgahd.ImageType == TGA_MONOENCODETYPE)) - mode = mode | RLENCO; - - // Allocate the memory buffers - hNew = GlobalAlloc(GHND, tgahd.Width * tgahd.Height); - - if(hNew == NULL) - { - m_error = MEMERR; - fclose(fp); - return NULL; - } - else - { - pRGB = (BYTE *)GlobalLock(hNew); - - if(pRGB == NULL) - { - m_error = MEMERR; - fclose(fp); - return NULL; - } - } - - // RGB from image Data - DWORD destOffset = 0; - - RLECount = 0; - RLEFlag = 0; - - for(UINT32 row = 0; row < tgahd.Height; row++) - { - for(UINT32 col = 0; col < tgahd.Width; col++) - { - BYTE Red, Grn, Blu, Alp; - - // Reset RLE Counters - TGA_GetPixelValue(&Red, &Grn, &Blu, &Alp, fp, tgahd.PixelDepth, pal); - - // Invert if the image origin is in Bottom left - if(TGA_Origin == 0) - { // Bottom Left Origin - *(pRGB + destOffset) = Red; - destOffset = ((tgahd.Height -1) -row) * tgahd.Width + col; - } - else - { // Top Left Origin - *(pRGB + destOffset) = Red; - destOffset++; - } - } - } - } - - // Grab the image dimensions - *width = tgahd.Width; - *height = tgahd.Height; - - // Clean Up - GlobalUnlock(hNew); - fclose(fp); - m_error = IMGOK; - return hNew; - } - - -/////////////////////////////////////////////////////////////////////////////////// -// LoadTGAThumbNail -// Checks the TGA file for the existance of a thumbnail image -// Reads and returns it in a 24 Bit RGB Buffer if a thumbnail -// exists. Returns NULL if there isn't one sets TGANOTHUMBNAIL -HGLOBAL -TGAFile::LoadTGAThumbnail - ( - const char * fileName, // Name of file - UINT32 * width, // Width in Pixel - UINT32 * height // Height - ) - { - HGLOBAL hNew = NULL; - - TGAHEADER tgahd; - TGAFOOTER tgaft; - TGAEXTENSION tgaext; - - BYTE stampWidth = 0, stampHeight = 0; - long lResult; - - // for safety - *width = 0; - *height = 0; - - // init - m_error = IMGOK; - - // Init the file structs - ZeroMemory(&tgahd, sizeof(tgahd)); - ZeroMemory(&tgaft, sizeof(tgaft)); - ZeroMemory(&tgaext, sizeof(tgaext)); - FILE * fp; - fp = fopen(fileName, "rb"); - - if(fp == NULL) - { - m_error = FILEOPENERR; - return FALSE; - } - else - { - // Read the TGA Header - long rc = fread(&tgahd, 1, sizeof(TGAHEADER), fp); - - if(rc != sizeof(TGAHEADER)) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Check fo valid data in structure - if((tgahd.PixelDepth> 32) || (tgahd.PixelDepth<8)) - { - // I don't do Pixel Depths Bigger than 32 - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Anything other than the standard TGA types - // and I quit - switch(tgahd.ImageType) - { - case TGA_MAPRGBTYPE: - case TGA_RAWRGBTYPE: - case TGA_RAWMONOTYPE: - case TGA_MAPENCODETYPE: - case TGA_RAWENCODETYPE: - case TGA_MONOENCODETYPE: - break; - - default: - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - - // Set the number of Color Planes - if(tgahd.ImageType == TGA_RAWMONOTYPE) - { - mode = GREYSC; - } - else - { - mode = COLOUR; - } - - // Check for file Version - // Seek the last 26 bytes of the file - if(fseek(fp, -26, SEEK_END)) - { - // Error Quit - fclose(fp); - return NULL; - } - - // Read in the last 26 Bytes of the File - lResult = fread(&tgaft, 1, sizeof(TGAFOOTER), fp); - - if(lResult != sizeof(TGAFOOTER)) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Check for the Marker at the end of the file - lResult = strcmp(tgaft.Signature, "TRUEVISION-XFILE."); - - if(lResult != 0) - { - // Not V2.0 File no Thumbnail - m_error = NOTGATHUMBNAIL; - fclose(fp); - return NULL; - } - - // Check for the existance of an extension area - if(tgaft.ExtensionOffset == 0) - { - // No Thumbnail in this file - m_error = NOTGATHUMBNAIL; - fclose(fp); - return NULL; - } - - // Seek the extension area - if(fseek(fp, tgaft.ExtensionOffset, SEEK_SET)) - { - // Error Quit - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Read in the last 26 Bytes of the File - lResult = fread(&tgaext, 1, sizeof(TGAEXTENSION), fp); - - if(lResult != sizeof(TGAEXTENSION)) - { - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Seek the thumbnail image - if(fseek(fp, tgaext.StampOffset, SEEK_SET)) - { - // Error Quit - m_error = FILEREADERR; - fclose(fp); - return NULL; - } - - // Read the Width and Height from the first two bytes - // of the postage stamp data. - fread(&stampWidth, 1, 1, fp); - fread(&stampHeight, 1, 1, fp); - - if((stampWidth <= 0) || (stampWidth> 64) || (stampHeight <= 0) || (stampHeight> 64)) - { - m_error = INVALIDTGAERR; - fclose(fp); - return NULL; - } - } - - // Clean Up - *width = stampWidth; - *height = stampHeight; - fclose(fp); - - // Return Okay Image - return hNew; - } - - -/////////////////////////////////////////////////////////////////////////////////// -// SaveTGA32 -// Saves the buffer as a 32 bit True Color Image in TGA format -BOOL -TGAFile::SaveTGA32 - ( - const char * fileName, // output path - BYTE * inBuf, // BGR buffer - UINT32 width, // size in pixels - UINT32 height - ) - { - long lResult = 0; - - TGAHEADER tgahd; - m_error = IMGOK; - - // Init the file Header to all zeros - ZeroMemory(&tgahd, sizeof(tgahd)); - - if(inBuf == NULL) - { - m_error = BADPARAMERR; - return FALSE; - } - - if((width == 0) || (height == 0)) - { - m_error = BADPARAMERR; - return FALSE; - } - - // Initialize the Header for the File - tgahd.IDLength = 0; - tgahd.ColorMapType = 0; - tgahd.ImageType = TGA_RAWRGBTYPE; - tgahd.CMapStart = 0; - tgahd.CMapLength = 0; - tgahd.CMapDepth = 0; - tgahd.XOffset = 0; - tgahd.YOffset = 0; - tgahd.Width = (WORD)width; - tgahd.Height = (WORD)height; - tgahd.PixelDepth = 32; - tgahd.ImageDescriptor = 0; - - // Open a file to write - FILE * fp = fopen(fileName, "wb"); - - if(fp == NULL) - { - m_error = FILEOPENERR; - return FALSE; - } - - // Write the Header to File. - if((lResult = fwrite(&tgahd, 1, sizeof(TGAHEADER), fp)) != 18) - { - fclose(fp); - m_error = FILEWRITEERR; - return FALSE; - } - - // Wrte the Bytes to file - DWORD destOffset = 0; - BYTE temp = 0; - DWORD rowStride = tgahd.Width * 4; - - for(UINT32 row = 0; row < tgahd.Height; row++) - { - //DWORD rowOffset = rowStride * row; - DWORD rowOffset = rowStride *((tgahd.Height -1) -row); - - for(UINT32 col = 0; col < tgahd.Width; col++) - { - destOffset = rowOffset + 4 * col; - temp = *(inBuf + destOffset + 2); - - if(fwrite(&temp, 1, 1, fp) != 1) - { - m_error = FILEWRITEERR; - fclose(fp); - return FALSE; - } - temp = *(inBuf + destOffset + 1); - - if(fwrite(&temp, 1, 1, fp) != 1) - { - m_error = FILEWRITEERR; - fclose(fp); - return FALSE; - } - temp = *(inBuf + destOffset + 0); - - if(fwrite(&temp, 1, 1, fp) != 1) - { - m_error = FILEWRITEERR; - fclose(fp); - return FALSE; - } - - if(fwrite(&temp, 1, 1, fp) != 1) - { - m_error = FILEWRITEERR; - fclose(fp); - return FALSE; - } - } - } - - // Cleanup - fclose(fp); - m_error = IMGOK; - return TRUE; - } - - -/////////////////////////////////////////////////////////////////////////////////// -// Save8BitTGA -// Save's to an 8 Bit Color mapped file using the Palette -// passed in to the function. -BOOL -TGAFile::Save8BitTGA(const char * fileName, // output path -BYTE * inBuf, // one BYTE per pixel colomapped image -UINT32 width, // Width of Image -UINT32 height, // Height of Image -__int32 colors, // number of colors (number of RGBQUADs) -RGBQUAD * colormap) // array of RGBQUADs - { - long lResult = 0; - - TGAHEADER tgahd; - - // Init - m_error = IMGOK; - - // Init the file Header to all zeros - ZeroMemory(&tgahd, sizeof(tgahd)); - - if(inBuf == NULL) - { - m_error = BADPARAMERR; - return FALSE; - } - - if((width == 0) || (height == 0)) - { - m_error = BADPARAMERR; - return FALSE; - } - - if(colormap == NULL) - { - m_error = BADPARAMERR; - return FALSE; - } - - // Initialize the Header for the File - tgahd.IDLength = 0; - tgahd.ColorMapType = 1; - tgahd.ImageType = TGA_MAPRGBTYPE; - tgahd.CMapStart = 0; - tgahd.CMapLength = (SHORT)colors; - tgahd.CMapDepth = 24; - tgahd.XOffset = 0; - tgahd.YOffset = 0; - tgahd.Width = (WORD)width; - tgahd.Height = (WORD)height; - tgahd.PixelDepth = 8; - tgahd.ImageDescriptor = 0x28; - - // Open a file to write - FILE * fp = fopen(fileName, "wb"); - - if(fp == NULL) - { - m_error = FILEOPENERR; - return FALSE; - } - - // Write the Header to File. - if((lResult = fwrite(&tgahd, 1, sizeof(TGAHEADER), fp)) != 18) - { - m_error = FILEWRITEERR; - fclose(fp); - return FALSE; - } - - // Write out the Colormap - for(__int32 i = 0; i < colors; i++) - { - putc(colormap[i].rgbBlue, fp); - putc(colormap[i].rgbGreen, fp); - putc(colormap[i].rgbRed, fp); - } - - // Wrte the Bytes to file - DWORD destOffset = 0; - BYTE temp = 0; - - for(UINT32 row = 0; row < tgahd.Height; row++) - { - for(UINT32 col = 0; col < tgahd.Width; col++) - { - temp = *(inBuf + destOffset + 0); - - if(fwrite(&temp, 1, 1, fp) != 1) - { - m_error = FILEWRITEERR; - fclose(fp); - return FALSE; - } - destOffset += 1; - } - } - - // Cleanup - fclose(fp); - m_error = IMGOK; - return TRUE; - } - - -//////////////////////////////////////////////////////////////////////////////////// -// TGA_GetMapEntry -// Get the Color Values out of the -// Color map in the TGA File -// Return 0 on Success -BOOL -TGAFile::TGA_GetMapEntry(BYTE * Red, BYTE * Green, BYTE * Blue, BYTE * Alpha, FILE * fp, UINT32 Depth) - { - UINT32 j, k, l; - BYTE i, r, g, b, a = 0; - long lResult; - - switch(Depth) - { - case 8: // Greyscale Read and Triplicate - lResult = fread(&i, 1, 1, fp); - - // Check for error - if(lResult != 1) - { - m_error = FILEREADERR; - return FALSE; - } - - // Set RGB Values - r = i; - g = i; - b = i; - break; - - case 16: // 5 bits each of Red, Green, and Blue - - case 15: // Watch for the Byte order - lResult = fread(&j, 1, 1, fp); - lResult = lResult + fread(&k, 1, 1, fp); - - // Check for error - if(lResult != 2) - { - m_error = FILEREADERR; - return FALSE; - } - l = j + k * 256; - b = (BYTE)(((l >> 10) & 31) << 3); - g = (BYTE)(((l >> 5) & 31) << 3); - r = (BYTE)((l & 31) << 3); - break; - - case 32: // Read the Alpha bit a Throw it away - - case 24: // Eight bits for each Red, Green and Blue - lResult = fread(&i, 1, 1, fp); - r = i; - lResult = lResult + fread(&i, 1, 1, fp); - g = i; - lResult = lResult + fread(&i, 1, 1, fp); - b = i; - - // Check for error - if(lResult != 3) - { - m_error = FILEREADERR; - return FALSE; - } - - if(Depth == 32) - { - lResult = fread(&i, 1, 1, fp); - - if(lResult != 1) - { - m_error = FILEREADERR; - return FALSE; - } - - // Stroe Alpha bit - a = i; - } - break; - - default: - // Some Other Pixel Depth Which I don't support - return FALSE; - } - *Red = r; - *Green = g; - *Blue = b; - *Alpha = a; - - // Reutrn No Error - return TRUE; - } - - -//////////////////////////////////////////////////////////////////////////////////// -// TGA_GetFileVersion -// Retrieves the Version of the TGA File -// BYTES 8-23 of a Version 2.0 Footer will be equal -// to "TRUEVISION-XFILE" as ASCII -// Returns - Version number 1 or 2 -__int32 -TGAFile::TGA_GetFileVersion(FILE * fp) - { - long result; - fpos_t pos; - - TGAFOOTER tgaft; - - // Save the Current position of the File Stream - if(fgetpos(fp, &pos)) - { - // Error Quit - return FILEREADERR; - } - - // Seek the last 26 bytes of the file - if(fseek(fp, -26, SEEK_END)) - { - // Error Quit - return FILEREADERR; - } - - // Read in the last 26 Bytes of the File - result = fread(&tgaft, 1, sizeof(TGAFOOTER), fp); - - if(result != sizeof(TGAFOOTER)) - { - m_error = FILEREADERR; - return FILEREADERR; - } - - // Return the File Stream to its initial position - if(fsetpos(fp, &pos)) - { - // Error Quit - return FILEREADERR; - } - - // Check for the Marker at the end of the file - if(!strcspn(tgaft.Signature, "TRUEVISION-XFILE")) - { - // Marker found its V2.0 TGA - return TGA_VERSIONTWO; - } - - // No Marker was found Assume V1.0 TGA - return TGA_VERSIONONE; - } - - -//////////////////////////////////////////////////////////////////////////////////// -// TGA_getPixelValue -// Retreve a pixel value from the buffer and parse -// the value if its RLE encoded. Returns the RGB -// value of the pixel. -// Retruns - TRUE on success -BOOL -TGAFile::TGA_GetPixelValue - ( - BYTE * rRed, - BYTE * rGrn, - BYTE * rBlu, - BYTE * rAlp, - BYTE ** ppTGAData, - UINT32 PixelDepth, - RGBQUAD * CColMap - ) - { - // - // Buffered TGAs are always 32-bit, - // so go direct from file to RGBA - // - *rRed = *((*ppTGAData)++); - *rGrn = *((*ppTGAData)++); - *rBlu = *((*ppTGAData)++); - *rAlp = *((*ppTGAData)++); - - return TRUE; - } - -//////////////////////////////////////////////////////////////////////////////////// -// TGA_getPixelValue -// Retreve a pixel value from the file and parse -// the value if its RLE encoded. Returns the RGB -// value of the pixel. -// Retruns - TRUE on success -BOOL -TGAFile::TGA_GetPixelValue(BYTE * rRed, BYTE * rGrn, BYTE * rBlu, BYTE * rAlp, FILE * fp, UINT32 PixelDepth, RGBQUAD * CColMap) - { - BYTE i, j, k; - long lResult; - - // Check for Run Length Encoding - if((mode & RLENCO) != 0) - { - if(RLECount == 0) - { // Restrat the rum - lResult = fread(&i, 1, 1, fp); - - if(lResult != 1) - { - m_error = FILEREADERR; - return FALSE; - } - RLEFlag = (i & 0x80) >> 7; - - if(RLEFlag == 0) - { // Stream of unencoded pixels - RLECount = i + 1; - } - else - { // Single Pixel Replicated - RLECount = i-127; - } - RLECount--; // ecrement count and get pixel - } - else - { - // I have already read the count and at least the first pixel - RLECount--; - - if(RLEFlag != 0) - { - // Replicated Pixels - goto PixelEncode; - } - } - } - - // Rea the appropiate number of BYTES and break into RGB - switch(PixelDepth) - { - case 8: // Greyscale Read 1 Byte and Triplicate - lResult = fread(&i, 1, 1, fp); - - if(lResult != 1) - { - m_error = FILEREADERR; - return FALSE; - } - Red = i; - Grn = i; - Blu = i; - l = i; - break; - - case 16: // 1 Bit alpha not used - - case 15: // Five bits each for RGB watch byte ordering - lResult = fread(&j, 1, 1, fp); - lResult = lResult + fread(&k, 1, 1, fp); - - // Check for error - if(lResult != 2) - { - m_error = FILEREADERR; - return FALSE; - } - l = j + k * 256; - Blu = (BYTE)(((l >> 10) & 31) << 3); - Grn = (BYTE)(((l >> 5) & 31) << 3); - Red = (BYTE)((l & 31) << 3); - break; - - case 24: // Eight bits each for RGB - lResult = fread(&i, 1, 1, fp); - Red = i; - lResult = lResult + fread(&i, 1, 1, fp); - Grn = i; - lResult = lResult + fread(&i, 1, 1, fp); - Blu = i; - - // opaque alpha (08jan00/bgw) - Alpha = 0xFF; - - // Check for error - if(lResult != 3) - { - m_error = FILEREADERR; - return FALSE; - } - break; - - case 32: // With alpha (08jan00/bgw) - lResult = fread(&i, 1, 1, fp); - Red = i; - lResult = lResult + fread(&i, 1, 1, fp); - Grn = i; - lResult = lResult + fread(&i, 1, 1, fp); - Blu = i; - lResult = lResult + fread(&i, 1, 1, fp); - Alpha = i; - - // Check for error - if(lResult != 4) - { - m_error = FILEREADERR; - return FALSE; - } - break; - - default: // Unknown number of bis per pixel - m_error = INVALIDTGAERR; - return NULL; - } - -PixelEncode: // Set the actual pixel values - - if((mode & MAPPED) == MAPPED) - { - // Remap Color Mapped Pixels - *rRed = CColMap[l].rgbRed; - *rGrn = CColMap[l].rgbGreen; - *rBlu = CColMap[l].rgbBlue; - *rAlp = 0xFF; // opaque always (08jan00/bgw) - } - else - { - // Set Unmapped Values - *rRed = Red; - *rGrn = Grn; - *rBlu = Blu; - *rAlp = Alpha; - } - return TRUE; - } - -extern "C" unsigned char * LoadTGAFile -( - const char * filename, - int * width, - int * height -) -{ - TGAFile tgaFile; - return (unsigned char *)tgaFile.LoadTGA(filename, (UINT32 *)width, (UINT32 *)height); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/TGAFile.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/TGAFile.h deleted file mode 100644 index 1dfd7369bb6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/TGAFile.h +++ /dev/null @@ -1,22 +0,0 @@ -/* TGA File REader Classs Implementation File - This Implementation Allows the reading of TGA (Targa) Files - into an RGB buffer. Also the class allows an RGB Buffer to be - written to a TGA File. There is also a function to determine - the dimensions of a TGA file. - - Created By: Timothy A. Bish - Created On: 08/17/98 - -*/ - -#ifndef TGAFILEH -#define TGAFILEH - -unsigned char * LoadTGAFile -( - const char * filename, - int * width, - int * height -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aClient.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aClient.c deleted file mode 100644 index 9c8c94d75b0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aClient.c +++ /dev/null @@ -1,715 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include -#include -#include "gt2aMain.h" -#include "gt2aClient.h" -#include "gt2aParse.h" -#include "gt2aDisplay.h" -#include "gt2aSound.h" - -#define CLIENT_THINK_TIME 30 - -static GT2Socket Socket; // The socket used to connect to the server -static GT2Connection Connection; // The connection to the server. -float localRotation; // The local rotation, >=0, <360. -char serverAddress[128]; // Address of the server. -int localMotion; // STILL, FORWARD, BACKWARD. -int localTurning; // STILL, LEFT, RIGHT. -Player players[MAX_PLAYERS]; // The list of players. -GT2Bool connected; // True once we received the start message. -int localIndex = -1; // The local player's index into the players table. -unsigned long lastServerUpdate; // The last time we received an update from the server. -char localNick[MAX_NICK] = "Player"; // The local player's nick. -CObject cObjects[MAX_OBJECTS]; // The list of objects. -UpdateInfo updateHistory[UPDATE_HISTORY_LEN]; // Time diff for past updates -int updateHistoryStart; // The starting index of the history. -int ClientNumAsteroids; // The number of asteroids we're holding. -static unsigned short nextServerUpdateID; // The expected ID of the next update. -static unsigned short nextClientUpdateID; // The ID of our next update. - -// Stats. -///////// -int reliableBytesSentClient; -int reliableBytesReceivedClient; -int unreliableBytesSentClient; -int unreliableBytesReceivedClient; -int reliableMessagesSentClient; -int reliableMessagesReceivedClient; -int unreliableMessagesSentClient; -int unreliableMessagesReceivedClient; - -static void ClientSocketErrorCallback -( - GT2Socket socket -) -{ - printf("Server socket error\n"); - GSI_UNUSED(socket); -} - -static void ClientConnectedCallback -( - GT2Connection connection, - GT2Result result, - GT2Byte * message, - int len -) -{ - if(result != GT2Success) - { - printf("Connection failed (%d", result); - if(result == GT2Rejected) - printf(": %s)\n", message); - else - printf(")\n"); - exit(1); - } - GSI_UNUSED(len); - GSI_UNUSED(connection); -} - -static void ClientReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - char buffer[MAX_NICK + 16]; - GTMessageType type; - int rcode; - - // Check for no message. - //////////////////////// - if(!message) - return; - - // Get the message type. - //////////////////////// - type = gtEncodedMessageType((char *)message); - - // New client? - ////////////// - if(type == MSG_S_ADDCLIENT) - { - byte newPlayerIndex; - Player * newPlayer; - char nick[MAX_NICK]; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_S_ADDCLIENT_STR, (char *)message, len, - &newPlayerIndex, - nick); - if(rcode == -1) - return; - - // Check the index. - /////////////////// - assert((newPlayerIndex >= 0) && (newPlayerIndex < MAX_PLAYERS)); - if((newPlayerIndex < 0) || (newPlayerIndex >= MAX_PLAYERS)) - return; - assert(!players[newPlayerIndex].used); - - // Add the client. - ////////////////// - newPlayer = &players[newPlayerIndex]; - memset(newPlayer, 0, sizeof(Player)); - newPlayer->used = GT2True; - - // Set the nick. - //////////////// - strncpy(newPlayer->nick, nick, MAX_NICK); - newPlayer->nick[MAX_NICK - 1] = '\0'; - - // Display a join message. - ////////////////////////// - sprintf(buffer, "%s joined", newPlayer->nick); - DisplayChat(buffer); - } - // Delete client? - ///////////////// - else if(type == MSG_S_DELCLIENT) - { - byte delPlayerIndex; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_S_DELCLIENT_STR, (char *)message, len, - &delPlayerIndex); - if(rcode == -1) - return; - - // Check the index. - /////////////////// - assert((delPlayerIndex >= 0) && (delPlayerIndex < MAX_PLAYERS)); - if((delPlayerIndex < 0) || (delPlayerIndex >= MAX_PLAYERS)) - return; - assert(players[delPlayerIndex].used); - - // Display a part message. - ////////////////////////// - sprintf(buffer, "%s left", players[delPlayerIndex].nick); - DisplayChat(buffer); - - // Delete the client. - ///////////////////// - players[delPlayerIndex].used = GT2False; - } - // Connection attempt finished? - /////////////////////////////// - else if(type == MSG_S_START) - { - byte index; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_S_START_STR, (char *)message, len, - &index); - if(rcode == -1) - return; - - // Check the index. - /////////////////// - assert((index >= 0) && (index < MAX_PLAYERS)); - if((index < 0) || (index >= MAX_PLAYERS)) - return; - - // Set the local index. - /////////////////////// - localIndex = index; - - // We finished connecting. - ////////////////////////// - connected = GT2True; - } - // Server update? - ///////////////// - else if(type == MSG_S_UPDATE) - { - Player * player; - CObject * object; - byte updatedClients; - byte updatedObjects; - byte index; - unsigned short packedPosition[2]; - int score; - byte forward; - byte backward; - byte right; - byte left; - byte dead; - byte type; - int time; - int i; - unsigned long now; - unsigned long diff; - unsigned short updateID; - unsigned short packedRotation; - - // We got an update. - //////////////////// - now = current_time(); - diff = (now - lastServerUpdate); - lastServerUpdate = now; - - // Decode the header. - ///////////////////// - rcode = gtDecode(MSG_S_UPDATE_STR, (char *)message, len, - &updateID, - &updatedClients, - &updatedObjects); - if(rcode == -1) - return; - message += rcode; - len -= rcode; - - // Check for first update. - ////////////////////////// - if(updateHistoryStart == -1) - { - nextServerUpdateID = (updateID + 1); - updateHistoryStart = 0; - } - else - { - int numDropped; - UpdateInfo * info; - - // Check for out of order. - ////////////////////////// - if(updateID < nextServerUpdateID) - return; - - // Fill in the dropped updates. - /////////////////////////////// - numDropped = (updateID - nextServerUpdateID); - nextServerUpdateID = (updateID + 1); - - // Fill in the dropped updates. - /////////////////////////////// - while(numDropped--) - { - info = &updateHistory[updateHistoryStart++]; - updateHistoryStart %= UPDATE_HISTORY_LEN; - - info->diff = -1; - info->len = 0; - } - - // Fill in this update. - /////////////////////// - info = &updateHistory[updateHistoryStart++]; - updateHistoryStart %= UPDATE_HISTORY_LEN; - - info->diff = diff; - info->len = (len + rcode); - } - - // Go through each updated client. - ////////////////////////////////// - for(i = 0 ; i < updatedClients ; i++) - { - // Decode the update. - ///////////////////// - rcode = gtDecodeNoType(MSG_S_UPDATE_CLIENT_STR, (char *)message, len, - &index, - &packedPosition[0], - &packedPosition[1], - &packedRotation, - &score, - &forward, - &backward, - &right, - &left, - &dead); - if(rcode == -1) - return; - message += rcode; - len -= rcode; - - // Check the index. - /////////////////// - assert(index >= 0); - assert(index < MAX_PLAYERS); - if((index < 0) || (index >= MAX_PLAYERS)) - return; - - // Cache the player. - //////////////////// - player = &players[index]; - - // Copy the values in. - ////////////////////// - SetV2f( - player->position, - UnsignedShortToPosition(packedPosition[0]), - UnsignedShortToPosition(packedPosition[1])); - player->rotation = UnsignedShortToRotation(packedRotation); - player->score = score; - if(forward) - player->motion = FORWARD; - else if(backward) - player->motion = BACKWARD; - else - player->motion = STILL; - if(right) - player->turning = RIGHT; - else if(left) - player->turning = LEFT; - else - player->turning = STILL; - player->dead = dead; - - // Update the roll. - /////////////////// - if(player->dead) - { - player->roll = 0; - } - else if(left) - { - if(player->roll > -1) - { - player->roll -= (diff / 1000.0); - if(player->roll < -1) - player->roll = -1; - } - } - else if(right) - { - if(player->roll < 1) - { - player->roll += (diff / 1000.0); - if(player->roll > 1) - player->roll = 1; - } - } - else if(player->roll > 0) - { - player->roll -= (diff / 1000.0); - if(player->roll < 0) - player->roll = 0; - } - else if(player->roll < 0) - { - player->roll += (diff / 1000.0); - if(player->roll > 0) - player->roll = 0; - } - } - - // Go through the objects. - ////////////////////////// - for(i = 0 ; i < updatedObjects ; i++) - { - // Decode the object. - ///////////////////// - rcode = gtDecodeNoType(MSG_S_UPDATE_OBJECT_STR, (char *)message, len, - &type, - &packedPosition[0], - &packedPosition[1], - &packedRotation, - &time); - if(rcode == -1) - return; - message += rcode; - len -= rcode; - - // Cache the object. - //////////////////// - object = &cObjects[i]; - object->used = GT2True; - - // Copy in the values. - ////////////////////// - object->type = type; - SetV2f( - object->position, - UnsignedShortToPosition(packedPosition[0]), - UnsignedShortToPosition(packedPosition[1])); - object->rotation = UnsignedShortToRotation(packedRotation); - object->totalTime = time; - } - - // Mark the rest of the objects as unused. - ////////////////////////////////////////// - for( ; i < MAX_OBJECTS ; i++) - cObjects[i].used = GT2False; - } - // Chat? - //////// - else if(type == MSG_S_CHAT) - { - char buffer[256]; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_S_CHAT_STR, (char *)message, len, - &buffer); - if(rcode == -1) - return; - - // We got a chat message. - ///////////////////////// - DisplayChat(buffer); - } - // Sound? - ///////// - else if(type == MSG_S_SOUND) - { - byte sound; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_S_SOUND_STR, (char *)message, len, - &sound); - if(rcode == -1) - return; - - // We got a sound event. - //////////////////////// - PlaySoundEffect(sound); - } - // NumAsteroids? - //////////////// - else if(type == MSG_S_NUMASTEROIDS) - { - byte total; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_S_NUMASTEROIDS_STR, (char *)message, len, - &total); - if(rcode == -1) - return; - - // We got a new total. - ////////////////////// - ClientNumAsteroids = total; - } - GSI_UNUSED(reliable); - GSI_UNUSED(connection); -} - -static void ClientClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - printf("Connection closed (%d)\n", reason); - GSI_UNUSED(connection); -} - -void SendUpdate -( - void -) -{ - if(connected) - { - char buffer[64]; - int rcode; - - // Encode the messsage. - /////////////////////// - rcode = gtEncode(MSG_C_UPDATE, MSG_C_UPDATE_STR, buffer, sizeof(buffer), - nextClientUpdateID++, - RotationToUnsignedShort(localRotation), - localMotion == FORWARD ? 1 : 0, - localMotion == BACKWARD ? 1 : 0, - localTurning == RIGHT ? 1 : 0, - localTurning == LEFT ? 1 : 0); - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(Connection, (GT2Byte *)buffer, rcode, GT2False); - } - } -} - -void SendPress -( - const char * value -) -{ - if(connected) - { - char buffer[32]; - int rcode; - - // Encode the message. - ////////////////////// - rcode = gtEncode(MSG_C_PRESS, MSG_C_PRESS_STR, buffer, sizeof(buffer), - value); - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(Connection, (GT2Byte *)buffer, rcode, GT2True); - } - } -} - -void SendChat -( - const char * message -) -{ - if(connected) - { - char buffer[CHAT_MAX + 8]; - int rcode; - - // Encode the message. - ////////////////////// - rcode = gtEncode(MSG_C_CHAT, MSG_C_CHAT_STR, buffer, sizeof(buffer), - message); - - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(Connection, (GT2Byte *)buffer, rcode, GT2True); - } - } -} - -void ClientThink -( - unsigned long now -) -{ - static unsigned long lastUpdate; - static unsigned long lastTurn; - unsigned long diff; - - // Think. - ///////// - gt2Think(Socket); - - // Are we connected? - //////////////////// - if(!connected) - return; - - // For the first update, just set the time. - /////////////////////////////////////////// - if(!lastUpdate) - { - lastUpdate = now; - return; - } - - // How long since the last update? - ////////////////////////////////// - diff = (now - lastUpdate); - - // Check for an update. - /////////////////////// - if(diff >= CLIENT_THINK_TIME) - { - // Send an update. - ////////////////// - SendUpdate(); - - // Update the last send time. - ///////////////////////////// - lastUpdate = now; - } - - // How long since the last turn? - //////////////////////////////// - diff = (now - lastTurn); - - // Update our rotation. - /////////////////////// - if((localIndex != -1) && !players[localIndex].dead) - localRotation = ComputeNewRotation(localRotation, localTurning, diff, PLAYER_TURN_SPEED); - - // Update the last turn time. - ///////////////////////////// - lastTurn = now; -} - -static void ClientSendMonitor -( - GT2Connection connection, - int filterID, - const GT2Byte * message, - int len, - GT2Bool reliable -) -{ - // Update stats. - //////////////// - if(reliable) - { - reliableBytesSentClient += len; - reliableMessagesSentClient++; - } - else - { - unreliableBytesSentClient += len; - unreliableMessagesSentClient++; - } - - // We're done with the message. - /////////////////////////////// - gt2FilteredSend(connection, filterID, message, len, reliable); -} - -static void ClientReceiveMonitor -( - GT2Connection connection, - int filterID, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - // Update stats. - //////////////// - if(reliable) - { - reliableBytesReceivedClient += len; - reliableMessagesReceivedClient++; - } - else - { - unreliableBytesReceivedClient += len; - unreliableMessagesReceivedClient++; - } - - // We're done with the message. - /////////////////////////////// - gt2FilteredReceive(connection, filterID, message, len, reliable); -} - -GT2Bool InitializeClient -( - void -) -{ - GT2ConnectionCallbacks connectionCallbacks; - GT2Result result; - char buffer[256]; - int rcode; - - // Setup callback structs. - ////////////////////////// - memset(&connectionCallbacks, 0, sizeof(GT2ConnectionCallbacks)); - connectionCallbacks.connected = ClientConnectedCallback; - connectionCallbacks.received = ClientReceivedCallback; - connectionCallbacks.closed = ClientClosedCallback; - - // Init stuff. - ////////////// - lastServerUpdate = 0; - updateHistoryStart = -1; - nextServerUpdateID = 0; - nextClientUpdateID = 0; - - // If there was no server, we're connecting to ourselves. - ///////////////////////////////////////////////////////// - if(!serverAddress[0]) - strcpy(serverAddress, "127.0.0.1" PORT_STRING); - - // Create the socket. - ///////////////////// - result = gt2CreateSocket(&Socket, NULL, 0, 0, ClientSocketErrorCallback); - if(result != GT2Success) - return GT2False; - - // Setup the initial data. - ////////////////////////// - rcode = gtEncode(MSG_C_INITIAL, MSG_C_INITIAL_STR, buffer, sizeof(buffer), - localNick); - if(rcode == -1) - return GT2False; - - // Connect. - /////////// - result = gt2Connect(Socket, &Connection, serverAddress, (GT2Byte *)buffer, rcode, 0, &connectionCallbacks, GT2False); - if(result != GT2Success) - return GT2False; - - // Add our traffic monitors. - //////////////////////////// - gt2AddSendFilter(Connection, ClientSendMonitor); - gt2AddReceiveFilter(Connection, ClientReceiveMonitor); - - return (Connection != NULL); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aClient.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aClient.h deleted file mode 100644 index f6ef701e91d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aClient.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2ACLIENT_H_ -#define _GT2ACLIENT_H_ - -#include "gt2aMath.h" -#include "gt2aLogic.h" - -#define UPDATE_HISTORY_LEN 250 - -typedef struct Player -{ - GT2Bool used; // If this slot is in use or not. - V2f position; // The current position (0 <= x,y < MAP_MAX). - float rotation; // Client's view angle (0 <= rotation < 360). - int motion; // The client's current motion (STILL, FORWARD, BACKWARD). - int turning; // The client's current tunring direction (STILL, LEFT, RIGHT). - char nick[MAX_NICK]; // The client's nick. - int score; // The client's score. - GT2Bool dead; // True if this client is currently dead. - float roll; // How much to roll them (-1->0->1). -} Player; - -typedef struct CObject -{ - GT2Bool used; // If this slot is in use or not. - ObjectType type; // The type of object. - V2f position; // The object's position. - float rotation; // The object's rotation. - unsigned long totalTime; // The amount of time this object has existed. -} CObject; - -typedef struct UpdateInfo -{ - int diff; // Time since the last update was received. - int len; // Length of the update, in bytes. -} UpdateInfo; - -extern float localRotation; -extern char serverAddress[128]; -extern int localMotion; -extern int localTurning; -extern Player players[MAX_PLAYERS]; -extern GT2Bool connected; -extern int localIndex; -extern unsigned long lastServerUpdate; -extern char localNick[MAX_NICK]; -extern CObject cObjects[MAX_OBJECTS]; -extern UpdateInfo updateHistory[UPDATE_HISTORY_LEN]; -extern int updateHistoryStart; -extern int ClientNumAsteroids; - -// Stats. -///////// -extern int reliableBytesSentClient; -extern int reliableBytesReceivedClient; -extern int unreliableBytesSentClient; -extern int unreliableBytesReceivedClient; -extern int reliableMessagesSentClient; -extern int reliableMessagesReceivedClient; -extern int unreliableMessagesSentClient; -extern int unreliableMessagesReceivedClient; - -GT2Bool InitializeClient -( - void -); - -void ClientThink -( - unsigned long now -); - -void SendPress -( - const char * value -); - -void SendChat -( - const char * message -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aDisplay.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aDisplay.c deleted file mode 100644 index c8173f393d2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aDisplay.c +++ /dev/null @@ -1,1655 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include "gt2aMain.h" -#include "gt2aDisplay.h" -#include "gt2aClient.h" -#include "gt2aMath.h" -#include "gt2aInput.h" -#include "gt2aLogic.h" -#include "TGAFile.h" - -#define TITLE "GameSpy GT2Action by Dan 'Mr. Pants' Schoenblum" -#define FONT GLUT_STROKE_ROMAN -#define TEXT_SCALE 10 -#define CHAT_LINES 3 -#define CHAT_SCROLL_TIME (3.5 * 1000) -#define NUM_STARS 1000 -#define FRAME_HISTORY_LEN 250 -#define NUM_ROCKET_TEXTURES 4 -#define NUM_EXPLOSION_TEXTURES 2 -#define NUM_SHIP_TEXTURES 2 -#define NUM_ASTEROID_TEXTURES 3 -#define NUM_MINE_TEXTURES 3 -#define NUM_SPINNER_TEXTURES 3 -#define WINDOW_MIN 0 -#define WINDOW_MAX 10000 -#define POSITION_HISTORY_LEN 5 -#define MAX_FLICKER 50 -#define STARS_SCALE 4 -#define RADAR_SIZE 1500 -#define FULL_VIEW (20000.0 * Zoom) -#define HALF_VIEW (FULL_VIEW / 2.0) -#define ZOOM_IN_SPEED 0.4 -#define ZOOM_OUT_SPEED 0.4 -#define ZOOM_MIN 1.0 -#define ZOOM_MAX 1.5 - -typedef struct Star -{ - V2f position; - V3b color; - byte alpha; - byte flicker; -} Star; - -GT2Bool fullScreen; - -GT2Bool DrawGraphsOption; -GT2Bool DrawUpdateTimeOption = GT2True; -GT2Bool DrawUpdateLengthOption = GT2True; -GT2Bool DrawFrameTimeOption = GT2True; -GT2Bool DrawMarksOption = GT2True; -GT2Bool DrawFPSOption; -GT2Bool DrawWithPredictionOption = GT2True; -GT2Bool DrawBackgroundOption = GT2True; -GT2Bool DrawStarsOption = GT2True; -GT2Bool DrawBoundingCirclesOption = GT2False; -GT2Bool DrawRadarOption = GT2True; -float RadarScaleOption = 1; -float RadarPointScaleOption = 2; -GT2Bool ViewClippingOption = GT2True; - -int screenWidth = 500; -int screenHeight = 500; - -static char chatLines[CHAT_LINES][CHAT_MAX]; -static unsigned long lastChatScroll; - -static unsigned long Now; -static unsigned long Diff; - -static GLuint backgroundTexture; -static GLuint shipTextures[NUM_SHIP_TEXTURES]; -static GLuint explosionTextures[NUM_EXPLOSION_TEXTURES]; -static GLuint rocketTextures[NUM_ROCKET_TEXTURES]; -static GLuint asteroidTextures[NUM_ASTEROID_TEXTURES]; -static GLuint mineTextures[NUM_MINE_TEXTURES]; -static GLuint spinnerTextures[NUM_SPINNER_TEXTURES]; - -static Star stars[NUM_STARS]; - -static int FrameHistory[FRAME_HISTORY_LEN]; -static int FrameHistoryStart; - -static V2f localPosition; - -static float Zoom = 1.0; - -static void ScrollChat -( - void -) -{ - int i; - - // First find where to start the copying. - ///////////////////////////////////////// - for(i = 0 ; i < (CHAT_LINES - 1) ; i++) - if(!chatLines[i][0]) - break; - - // Move all lines 1 step towards the end of the array. - ////////////////////////////////////////////////////// - for( ; i > 0 ; i--) - strcpy(chatLines[i], chatLines[i - 1]); - - // Clear the first line. - //////////////////////// - chatLines[0][0] = '\0'; -} - -static void RemoveOldestChat -( - void -) -{ - int i; - - // No lines? - //////////// - if(!chatLines[0][0]) - return; - - // Find the oldest line. - //////////////////////// - for(i = (CHAT_LINES - 1) ; !chatLines[i][0] && (i > 0) ; i--); - - // Remove it. - ///////////// - chatLines[i][0] = '\0'; -} - -static void AddChatLine -( - const char * message -) -{ - // Do scrolling. - //////////////// - ScrollChat(); - - // Copy in the new line. - //////////////////////// - strncpy(chatLines[0], message, CHAT_MAX); - chatLines[0][CHAT_MAX - 1] = '\0'; - - // Update the scroll time. - ////////////////////////// - lastChatScroll = current_time(); -} - -static int GetStringWidth -( - const char * string -) -{ - int width = 0; - - if(!string) - return 0; - - while(*string) - width += glutStrokeWidth(FONT, *string++); - - return (width * TEXT_SCALE); -} - -static void DrawString -( - const char * string, - int x, - int y, - const V3b color, - float scale -) -{ - scale *= TEXT_SCALE; - glColor3ubv(color); - glPushMatrix(); - glTranslatef(x, y, 0); - glScalef(scale, scale, 1); - while(*string) - glutStrokeCharacter(FONT, *string++); - glPopMatrix(); -} - -static int GetCharacterWidth -( - char ch -) -{ - int width; - - width = glutStrokeWidth(FONT, ch); - width *= TEXT_SCALE; - - return width; -} - -static void DrawCharacter -( - char ch, - int x, - int y, - const V3b color -) -{ - glColor3ubv(color); - glPushMatrix(); - glTranslatef(x, y, 0); - glScalef(TEXT_SCALE, TEXT_SCALE, 1); - glutStrokeCharacter(FONT, ch); - glPopMatrix(); -} - -void DisplayChat -( - const char * message -) -{ - // Add this to the chat buffer. - /////////////////////////////// - AddChatLine(message); -} - -static void DrawChat -( - void -) -{ - const char * str; - int x; - int y; - int i; - float scale; - - // Settings. - //////////// - x = 100; - y = 200; - scale = 0.3; - - // Draw all the chat messages. - ////////////////////////////// - for(i = 0 ; (i < CHAT_LINES) && chatLines[i][0] ; i++) - { - DrawString(chatLines[i], x, y, White, scale); - y += 500; - } - - // Get the current chat buffer. - /////////////////////////////// - str = GetChatBuffer(); - if(str) - DrawString(str, x, WINDOW_MAX - 500, White, scale); -} - -static void DrawBoundingCircle -( - float radius -) -{ - // Check the bounding circles option. - ///////////////////////////////////// - if(DrawBoundingCirclesOption) - { - int i; - V2f point; - - // Draw in white. - ///////////////// - glColor3f(1, 1, 1); - - // Draw the circle (circle, sphere, whatever). - ////////////////////////////////////////////// -#if 1 - glBegin(GL_LINE_LOOP); - for(i = 0 ; i < 360 ; i += 30) - { - RotationToVector(point, i); - ScaleV2f(point, point, radius); - glVertex2fv(point); - } - glEnd(); -#else - glutWireSphere(radius, 16, 16); -#endif - - // Draw the forward line. - ///////////////////////// - glBegin(GL_LINES); - glVertex2f(0, 0); - glVertex2f(0, radius * 2); - glEnd(); - } -} - -static void DrawPlayer -( - Player * player, - const V2f position, - float rotation -) -{ - int width; - static const float textScale = 0.25; - V2f textPosition; - float diff; - static char text[MAX_NICK + 32]; - - // Get the text to show. - //////////////////////// - sprintf(text, "%s: %d", player->nick, player->score); - - glMatrixMode(GL_MODELVIEW); - - glPushMatrix(); - glTranslatef(position[0], position[1], 0); - - width = GetStringWidth(text); - width *= textScale; - textPosition[0] = -(width / 2); -#if 0 - textPosition[1] = 700; -#else - if((position[0] + textPosition[0]) < 20) - textPosition[0] = (20 - position[0]); - diff = (MAP_MAX - (position[0] + textPosition[0] + width)); - if(diff < 0) - textPosition[0] += diff; - if(position[1] < (MAP_MAX - 1000)) - textPosition[1] = 700; - else - textPosition[1] = -1000; -#endif - DrawString(text, textPosition[0], textPosition[1], White, textScale); - - if(!player->dead) - { - glRotatef(rotation, 0, 0, -1); - - glPushMatrix(); - if(player->roll) - { - glScalef(1, 1, .005); - glRotatef(35 * player->roll, 0, 1, 0); - } - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - if(player->motion) - glBindTexture(GL_TEXTURE_2D, shipTextures[1]); - else - glBindTexture(GL_TEXTURE_2D, shipTextures[0]); - - glColor4f(1, 1, 1, 1); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-500, -300); - glTexCoord2f(1, 0); - glVertex2f(500, -300); - glTexCoord2f(1, 1); - glVertex2f(500, 700); - glTexCoord2f(0, 1); - glVertex2f(-500, 700); - glEnd(); - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glPopMatrix(); - } - - DrawBoundingCircle(PLAYER_RADIUS); - glPopMatrix(); -} - -static void Predict -( - V2f newPosition, - float * rotation, - Player * player -) -{ - GT2Bool local; - - assert(newPosition); - assert(rotation); - assert(player); - - // Is this the local player? - //////////////////////////// - local = (player == &players[localIndex]); - - // Should we predict? - ///////////////////// - if(DrawWithPredictionOption && !player->dead && player->motion) - { - // Predict new position. - //////////////////////// - ComputeNewPosition( - newPosition, - player->position, - player->motion, - player->rotation, - Diff, - PLAYER_SPEED, - GT2True); - - // Predict rotation if not local. - ///////////////////////////////// - if(!local) - *rotation = ComputeNewRotation(player->rotation, player->turning, Diff, PLAYER_TURN_SPEED); - } - else - { - // Just use the actual position. - //////////////////////////////// - CopyV2f(newPosition, player->position); - - // Use the real rotation if not local. - ////////////////////////////////////// - if(!local) - *rotation = player->rotation; - } - - // If local, use our rotation. - ////////////////////////////// - if(local) - *rotation = localRotation; -} - -static void DrawPlayers -( - void -) -{ - int i; - Player * player; - V2f position; - float rotation; - float distance; - - // First draw the other players. - //////////////////////////////// - for(i = 0 ; i < MAX_PLAYERS ; i++) - { - player = &players[i]; - - // Check if we need to draw the player. - /////////////////////////////////////// - if(player->used && (i != localIndex)) - { - // Predict the new position. - //////////////////////////// - Predict(position, &rotation, player); - - // Check if the players are close enough. - ///////////////////////////////////////// - if(ViewClippingOption) - { - distance = DistanceV2f(localPosition, position); - if(distance >= FULL_VIEW) - continue; - } - - // Do the actual drawing. - ///////////////////////// - DrawPlayer(player, position, rotation); - } - } - - // Draw the local player. - ///////////////////////// - assert((localIndex >= 0) && (localIndex < MAX_PLAYERS)); - player = &players[localIndex]; - - // Do the actual drawing. - // The position was already set in SetMapView. - ////////////////////////////////////////////// - DrawPlayer(player, localPosition, localRotation); -} - -static void DrawRocket -( - CObject * rocket -) -{ - V2f position; - - // Are we using prediction? - /////////////////////////// - if(DrawWithPredictionOption) - { - // Predict new position. - //////////////////////// - ComputeNewPosition( - position, - rocket->position, - FORWARD, - rocket->rotation, - Diff, - ROCKET_SPEED, - GT2False); - } - else - { - // Just use the actual position. - //////////////////////////////// - CopyV2f(position, rocket->position); - } - - glMatrixMode(GL_MODELVIEW); - - glPushMatrix(); - glTranslatef(position[0], position[1], 0); - - glRotatef(rocket->rotation, 0, 0, -1); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glBindTexture(GL_TEXTURE_2D, rocketTextures[RandomInt(0, NUM_ROCKET_TEXTURES - 1)]); - - glColor4f(1, 1, 1, 1); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-350, -350); - glTexCoord2f(1, 0); - glVertex2f(350, -350); - glTexCoord2f(1, 1); - glVertex2f(350, 350); - glTexCoord2f(0, 1); - glVertex2f(-350, 350); - glEnd(); - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - - DrawBoundingCircle(ROCKET_RADIUS); - glPopMatrix(); -} - -static void DrawMine -( - CObject * mine -) -{ - glMatrixMode(GL_MODELVIEW); - - glPushMatrix(); - glTranslatef(mine->position[0], mine->position[1], 0); - - glRotatef(mine->rotation, 0, 0, -1); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glBindTexture(GL_TEXTURE_2D, mineTextures[(int)mine->position[0] % NUM_MINE_TEXTURES]); - - glColor4f(1, 1, 1, 1); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-800, -800); - glTexCoord2f(1, 0); - glVertex2f(800, -800); - glTexCoord2f(1, 1); - glVertex2f(800, 800); - glTexCoord2f(0, 1); - glVertex2f(-800, 800); - glEnd(); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - - DrawBoundingCircle(MINE_RADIUS); - glPopMatrix(); -} - -static void DrawAsteroid -( - CObject * asteroid -) -{ - glMatrixMode(GL_MODELVIEW); - - glPushMatrix(); - glTranslatef(asteroid->position[0], asteroid->position[1], 0); - - glRotatef(asteroid->rotation, 0, 0, -1); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - //glBindTexture(GL_TEXTURE_2D, asteroidTextures[(int)asteroid->position[0] % NUM_ASTEROID_TEXTURES]); - glBindTexture(GL_TEXTURE_2D, asteroidTextures[1]); - - glColor4f(1, 1, 1, 1); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-800, -800); - glTexCoord2f(1, 0); - glVertex2f(800, -800); - glTexCoord2f(1, 1); - glVertex2f(800, 800); - glTexCoord2f(0, 1); - glVertex2f(-800, 800); - glEnd(); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - - DrawBoundingCircle(ASTEROID_RADIUS); - glPopMatrix(); -} - -static void DrawExplosion -( - CObject * explosion -) -{ - unsigned long totalTime; - - totalTime = (explosion->totalTime + Diff); - - glMatrixMode(GL_MODELVIEW); - - glPushMatrix(); - glTranslatef(explosion->position[0], explosion->position[1], 0); - - glPushMatrix(); - glScalef(totalTime / 100.0, totalTime / 100.0, 1); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_2D, explosionTextures[1]); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-700, -700); - glTexCoord2f(1, 0); - glVertex2f(700, -700); - glTexCoord2f(1, 1); - glVertex2f(700, 700); - glTexCoord2f(0, 1); - glVertex2f(-700, 700); - glEnd(); - - glRotatef(totalTime, 0, 0, -1); - - glBindTexture(GL_TEXTURE_2D, explosionTextures[0]); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-700, -700); - glTexCoord2f(1, 0); - glVertex2f(700, -700); - glTexCoord2f(1, 1); - glVertex2f(700, 700); - glTexCoord2f(0, 1); - glVertex2f(-700, 700); - glEnd(); - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glPopMatrix(); - - DrawBoundingCircle(EXPLOSION_RADIUS); - glPopMatrix(); -} - -static void DrawObjects -( - void -) -{ - int i; - CObject * object; - float distance; - - // Draw all the objects. - //////////////////////// - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - object = &cObjects[i]; - - // Is the object in use? - //////////////////////// - if(object->used) - { - if(ViewClippingOption) - { - // Is the player close enough to see it? - //////////////////////////////////////// - distance = DistanceV2f(localPosition, object->position); - if(distance >= FULL_VIEW) - continue; - } - - // Draw it based on type. - ///////////////////////// - if(object->type == ObjectRocket) - DrawRocket(object); - else if(object->type == ObjectMine) - DrawMine(object); - else if(object->type == ObjectAsteroid) - DrawAsteroid(object); - else if(object->type == ObjectExplosion) - DrawExplosion(object); - } - } -} - -static void DrawConnecting -( - void -) -{ - static const char * text = "Connecting"; - static int width = -1; - static const V3b textColor = { 0, 204, 0}; - static unsigned long lastSpin; - static int spinnerIndex = -1; - static const char * spinnerText = "|/-\\"; - static const V3b spinnerColor = { 0, 204, 0 }; - char spinnerChar; - int spinnerX; - - // Get the width of the string if we don't already have it. - /////////////////////////////////////////////////////////// - if(width == -1) - width = GetStringWidth(text); - - // Draw the string. - /////////////////// - DrawString(text, (WINDOW_MAX - width) / 2, (WINDOW_MAX / 2), textColor, 1); - - // Init if its the first time. - ////////////////////////////// - if(spinnerIndex == -1) - { - spinnerIndex = 0; - lastSpin = Now; - } - // Check if its time to spin the spinner. - ///////////////////////////////////////// - else if((Now - lastSpin) >= 250) - { - spinnerIndex++; - spinnerIndex %= 4; - lastSpin = Now; - } - - // Get the char to show. - //////////////////////// - spinnerChar = spinnerText[spinnerIndex]; - - // Get the x position of the char. - ////////////////////////////////// - spinnerX = ((WINDOW_MAX - GetCharacterWidth(spinnerChar)) / 2); - - // Draw the spinner. - //////////////////// - DrawCharacter(spinnerChar, spinnerX, 3000, spinnerColor); -} - -static int ReadLittleInt -( - FILE * file -) -{ - byte bytes[4]; - int i; - - if(fread(bytes, 1, 4, file) != 4) - return -1; - - i = bytes[0]; - i |= (bytes[1] << 8); - i |= (bytes[2] << 16); - i |= (bytes[3] << 24); - - return i; -} - -static GT2Bool LoadTexture -( - const char * filename, - GLuint * texture, - GT2Bool useAlpha -) -{ - int width; - int height; - GLubyte * bytes; - int len; - int i; - GLubyte temp; - int format; - - // Load the file. - ///////////////// - bytes = LoadTGAFile(filename, &width, &height); - if(!bytes) - return GT2False; - - // Convert from BGRA to RGBA. - ///////////////////////////// - len = (width * height * 4); - for(i = 0 ; i < len ; i += 4) - { - temp = bytes[i]; - bytes[i] = bytes[i + 2]; - bytes[i + 2] = temp; - } - - // Generate and bind the texture. - ///////////////////////////////// - glGenTextures(1, texture); - glBindTexture(GL_TEXTURE_2D, *texture); - - // Load it from memory. - /////////////////////// - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - if(useAlpha) - format = 4; - else - format = 3; - glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, bytes); - - // Set to decal mode. - ///////////////////// - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - // Setup the min/mag filters. - ///////////////////////////// - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - free(bytes); - - return GT2True; -} - -static void DrawBackground -( - void -) -{ - if(!DrawBackgroundOption) - return; - - glEnable(GL_TEXTURE_2D); - - glBindTexture(GL_TEXTURE_2D, backgroundTexture); - - glColor4f(1, 1, 1, 1); - - glBegin(GL_QUADS); -#if 0 - glTexCoord2f(0, 0); - glVertex2f(MAP_MIN, MAP_MIN); - glTexCoord2f(1, 0); - glVertex2f(MAP_MAX, MAP_MIN); - glTexCoord2f(1, 1); - glVertex2f(MAP_MAX, MAP_MAX); - glTexCoord2f(0, 1); - glVertex2f(MAP_MIN, MAP_MAX); -#else - glTexCoord2f(0.01, 0.01); - glVertex2f(MAP_MIN, MAP_MIN); - glTexCoord2f(0.99, 0.01); - glVertex2f(MAP_MAX, MAP_MIN); - glTexCoord2f(0.99, 0.99); - glVertex2f(MAP_MAX, MAP_MAX); - glTexCoord2f(0.01, 0.99); - glVertex2f(MAP_MIN, MAP_MAX); -#endif - glEnd(); - - glDisable(GL_TEXTURE_2D); -} - -static void InitStar -( - unsigned long now, - Star * star -) -{ - int color; - - star->position[0] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - star->position[1] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - - color = RandomInt(0, 19); - if(color < 15) - CopyV3b(star->color, White); - else if(color < 17) - CopyV3b(star->color, Red); - else if(color < 19) - CopyV3b(star->color, Yellow); - else - CopyV3b(star->color, Blue); - star->alpha = RandomInt(0, 255); - star->flicker = RandomInt(1, MAX_FLICKER); -} - -static void DrawStars -( - void -) -{ - int i; - int alpha; - V2f position; - - if(!DrawStarsOption) - return; - - // Figure out the eye position. - /////////////////////////////// - CopyV2f(position, localPosition); - if(position[0] < HALF_VIEW) - position[0] = HALF_VIEW; - else if(position[0] > (MAP_MAX - HALF_VIEW)) - position[0] = (MAP_MAX - HALF_VIEW); - if(position[1] < HALF_VIEW) - position[1] = HALF_VIEW; - else if(position[1] > (MAP_MAX - HALF_VIEW)) - position[1] = (MAP_MAX - HALF_VIEW); - - // Draw the stars. - ////////////////// - glEnable(GL_BLEND); - glPushMatrix(); - glTranslatef(position[0] / STARS_SCALE, position[1] / STARS_SCALE, 0); - - glBegin(GL_POINTS); - for(i = 0 ; i < NUM_STARS ; i++) - { - alpha = stars[i].alpha; - alpha += RandomInt(-stars[i].flicker, stars[i].flicker); - alpha = ClampInt(alpha, 0, 255); - glColor4ub(stars[i].color[0], stars[i].color[1], stars[i].color[2], (byte)alpha); - glVertex2fv(stars[i].position); - } - glEnd(); - glPopMatrix(); - glDisable(GL_BLEND); -} - -static void DrawSpinner -( - void -) -{ - float rotation; - float scale; - - scale = (Now % 1001); - scale -= 50; - scale /= 50; - - glMatrixMode(GL_MODELVIEW); - - glPushMatrix(); - glTranslatef(MAP_HALF, MAP_HALF, 0); - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - -#if 1 - glPushMatrix(); - rotation = (Now % 360); - glRotatef(rotation, 0, 0, 1); - glBindTexture(GL_TEXTURE_2D, spinnerTextures[0]); - glColor4f(1, 1, 1, 1); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 0); - glVertex2f(SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 1); - glVertex2f(SPINNER_COORD, SPINNER_COORD); - glTexCoord2f(0, 1); - glVertex2f(-SPINNER_COORD, SPINNER_COORD); - glEnd(); - glPopMatrix(); -#endif - - glPushMatrix(); - rotation = (Now % (360 * 8)); - rotation /= 8; - glRotatef(rotation, 0, 0, 1); - glScalef(scale, -scale, 1); - glBindTexture(GL_TEXTURE_2D, spinnerTextures[2]); - glColor4f(1, 1, 1, 0.8); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 0); - glVertex2f(SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 1); - glVertex2f(SPINNER_COORD, SPINNER_COORD); - glTexCoord2f(0, 1); - glVertex2f(-SPINNER_COORD, SPINNER_COORD); - glEnd(); - glPopMatrix(); - - glPushMatrix(); - rotation = (Now % (360 * 7)); - rotation /= 7; - glRotatef(rotation, 0, 0, 1); - glScalef(scale, -scale, 1); - glBindTexture(GL_TEXTURE_2D, spinnerTextures[1]); - glColor4f(1, 1, 1, 0.8); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 0); - glVertex2f(SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 1); - glVertex2f(SPINNER_COORD, SPINNER_COORD); - glTexCoord2f(0, 1); - glVertex2f(-SPINNER_COORD, SPINNER_COORD); - glEnd(); - glPopMatrix(); - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - - DrawBoundingCircle(SPINNER_RADIUS); - glPopMatrix(); -} - -static void DrawGraphs -( - void -) -{ - int i; - int diff; - int len; - int maxDiff = 0; - int maxLen = 0; - - if(updateHistoryStart == -1) - return; - - if(!DrawGraphsOption) - return; - - glPushMatrix(); - glScalef(20, 20, 1); - if(DrawUpdateTimeOption) - { - glColor3ubv(Green); - glBegin(GL_LINE_STRIP); - for(i = 0 ; i < UPDATE_HISTORY_LEN ; i++) - { - diff = updateHistory[(updateHistoryStart + i) % UPDATE_HISTORY_LEN].diff; - - if(diff > maxDiff) - maxDiff = diff; - - if(diff == -1) - { - glColor3ubv(Red); - glVertex2f(i * 2, 50); - glColor3ubv(Green); - } - else - { - if(diff == -1) - diff = 0; - glVertex2f(i * 2, diff / 2); - } - } - glEnd(); - } - - if(DrawUpdateLengthOption) - { - glColor3ubv(Purple); - glBegin(GL_LINE_STRIP); - for(i = 0 ; i < UPDATE_HISTORY_LEN ; i++) - { - len = updateHistory[(updateHistoryStart + i) % UPDATE_HISTORY_LEN].len; - - if(len > maxLen) - maxLen = len; - - glVertex2f(i * 2, len / 8); - } - glEnd(); - } - - if(DrawFrameTimeOption) - { - glColor3ubv(Yellow); - glBegin(GL_LINE_STRIP); - for(i = 0 ; i < FRAME_HISTORY_LEN ; i++) - { - diff = FrameHistory[(FrameHistoryStart + i) % FRAME_HISTORY_LEN]; - glVertex2f(i * 2, diff / 2); - } - glEnd(); - } - - if(DrawMarksOption) - { - glColor3ubv(White); - glBegin(GL_LINES); - for(i = 0 ; i < screenHeight; i += 25) - { - glVertex2f(screenWidth - 10, i); - glVertex2f(screenWidth, i); - } - glEnd(); - } - - glPopMatrix(); -} - -static void DrawFPS -( - unsigned long diff -) -{ - if(DrawFPSOption && diff) - { - static int counter; - static char buf[64]; - if(++counter == 10) - { - counter = 0; - sprintf(buf, "FPS: %d", 1000 / diff); - } - DrawString(buf, WINDOW_MAX - 1500, 600, Grey, 0.2); - } - - { - char buf[64]; - sprintf(buf, "%d asteroid%s", ClientNumAsteroids, - (ClientNumAsteroids==1) ? "" : "s"); - DrawString(buf, WINDOW_MAX - 3500, 600, Grey, 0.2); - } -} - -static void DrawRadar -( - void -) -{ - int i; - Player * player; - CObject * object; - GLdouble plane0[4] = { 0, 1, 1, 0 }; - GLdouble plane1[4] = { 1, 0, 1, 0 }; - - if(!DrawRadarOption) - return; - - glPushMatrix(); - // Move to the upper-right corner. - ////////////////////////////////// - glTranslatef( - WINDOW_MAX - (RADAR_SIZE * RadarScaleOption), - WINDOW_MAX - (RADAR_SIZE * RadarScaleOption), - 0); - - // Scale so we can draw in map space. - ///////////////////////////////////// - glScalef( - RADAR_SIZE / MAP_MAX * RadarScaleOption, - RADAR_SIZE / MAP_MAX * RadarScaleOption, - 1); - -#if 1 - // Enable textures. - /////////////////// - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 0.5); - - // Draw a background. - ///////////////////// - glBindTexture(GL_TEXTURE_2D, backgroundTexture); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(0, 0); - glTexCoord2f(1, 0); - glVertex2f(MAP_MAX, 0); - glTexCoord2f(1, 1); - glVertex2f(MAP_MAX, MAP_MAX); - glTexCoord2f(0, 1); - glVertex2f(0, MAP_MAX); - glEnd(); - - // Draw the spinner. - //////////////////// - glPushMatrix(); - glTranslatef(MAP_HALF, MAP_HALF, 0); - glRotatef(Now % 3600, 0, 0, 1); - - glBindTexture(GL_TEXTURE_2D, spinnerTextures[0]); - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(-SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 0); - glVertex2f(SPINNER_COORD, -SPINNER_COORD); - glTexCoord2f(1, 1); - glVertex2f(SPINNER_COORD, SPINNER_COORD); - glTexCoord2f(0, 1); - glVertex2f(-SPINNER_COORD, SPINNER_COORD); - glEnd(); - glPopMatrix(); - - // Disable textures. - //////////////////// - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -#endif - - // Draw a box around the radar. - /////////////////////////////// - glColor3ubv(Yellow); - glBegin(GL_LINE_STRIP); - glVertex2f(0, MAP_MAX); - glVertex2f(0, 0); - glVertex2f(MAP_MAX, 0); - glEnd(); - - // Setup the clipping planes. - ///////////////////////////// - glEnable(GL_CLIP_PLANE0); - glEnable(GL_CLIP_PLANE1); - glClipPlane(GL_CLIP_PLANE0, plane0); - glClipPlane(GL_CLIP_PLANE1, plane1); - - // Scale points. - //////////////// - if(RadarPointScaleOption != 1) - glPointSize(RadarPointScaleOption); - - glBegin(GL_POINTS); - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - object = &cObjects[i]; - - if(!object->used) - continue; - - if(object->type == ObjectRocket) - glColor3ubv(Red); - else if(object->type == ObjectMine) - glColor3ubv(Yellow); - else if(object->type == ObjectAsteroid) - glColor3ubv(White); - else - continue; - - glVertex2fv(object->position); - } - - glColor3ubv(Orange); - for(i = 0 ; i < MAX_PLAYERS ; i++) - { - if(i == localIndex) - continue; - - player = &players[i]; - - if(!player->used) - continue; - - glVertex2fv(player->position); - } - - glColor3ubv(Green); - glVertex2fv(players[localIndex].position); - glEnd(); - - // Unscale points. - ////////////////// - if(RadarPointScaleOption != 1) - glPointSize(1); - glPopMatrix(); - - glDisable(GL_CLIP_PLANE0); - glDisable(GL_CLIP_PLANE1); -} - -static void SetMapView -( - void -) -{ - V2f corner; - Player * player; - float rotation; - static V2f positionHistory[POSITION_HISTORY_LEN]; - static int positionHistoryStart = -1; - int i; - - // Get the local player. - //////////////////////// - player = &players[localIndex]; - - // Predict the local player's position. - /////////////////////////////////////// - Predict(localPosition, &rotation, player); - - // Put this position in the history. - //////////////////////////////////// - if(positionHistoryStart == -1) - { - positionHistoryStart = 0; - for(i = 0 ; i < POSITION_HISTORY_LEN ; i++) - CopyV2f(positionHistory[i], localPosition); - } - else - { - CopyV2f(positionHistory[positionHistoryStart++], localPosition); - positionHistoryStart %= POSITION_HISTORY_LEN; - } - - // Average out the position history to get the display position. - //////////////////////////////////////////////////////////////// - SetV2f(localPosition, 0, 0); - for(i = 0 ; i < POSITION_HISTORY_LEN ; i++) - AddV2f(localPosition, localPosition, positionHistory[i]); - ScaleV2f(localPosition, localPosition, (1.0 / POSITION_HISTORY_LEN)); - - // Set the left and bottom of the view. - /////////////////////////////////////// - SubScalarV2f(corner, localPosition, HALF_VIEW); - - // Don't show anything outside the map. - /////////////////////////////////////// - ClampV2f(corner, corner, 0, MAP_MAX - FULL_VIEW); - - glLoadIdentity(); - glViewport(0, 0, screenWidth, screenHeight); - gluOrtho2D(corner[0], corner[0] + FULL_VIEW, corner[1], corner[1] + FULL_VIEW); -} - -static void SetWindowView -( - void -) -{ - glLoadIdentity(); - glViewport(0, 0, screenWidth, screenHeight); - gluOrtho2D(0, WINDOW_MAX, 0, WINDOW_MAX); -} - -static void Display -( - void -) -{ - static unsigned long lastDisplay; - unsigned long now; - unsigned long diff; - - // Get the current time. - //////////////////////// - now = current_time(); - - // Get the time difference. - /////////////////////////// - diff = (now - lastDisplay); - - // Update the history. - ////////////////////// - if(FrameHistoryStart == -1) - FrameHistoryStart = 0; - else - { - FrameHistory[FrameHistoryStart++] = diff; - FrameHistoryStart %= FRAME_HISTORY_LEN; - } - - // New last display. - //////////////////// - lastDisplay = now; - - // Set the zoom. - //////////////// - if(localMotion == STILL) - { - if(Zoom > ZOOM_MIN) - { - Zoom -= (ZOOM_IN_SPEED * diff / 1000); - if(Zoom < ZOOM_MIN) - Zoom = ZOOM_MIN; - } - } - else - { - if(Zoom < ZOOM_MAX) - { - Zoom += (ZOOM_OUT_SPEED * diff / 1000); - if(Zoom > ZOOM_MAX) - Zoom = ZOOM_MAX; - } - } - - // Clear the color buffer. - ////////////////////////// - glClear(GL_COLOR_BUFFER_BIT); - - // We want to know how long since the last server update. - ///////////////////////////////////////////////////////// - Now = now; - Diff = (now - lastServerUpdate); - - // Are we connected to the server? - ////////////////////////////////// - if(connected) - { - // Set the view for drawing in map space. - ///////////////////////////////////////// - SetMapView(); - - // Draw the ground. - /////////////////// - DrawBackground(); - - // Draw some stars. - /////////////////// - DrawStars(); - - // Draw the spinner. - //////////////////// - DrawSpinner(); - - // Draw all the objects. - //////////////////////// - DrawObjects(); - - // Draw all the players. - //////////////////////// - DrawPlayers(); - - // Set the view for drawing in window space. - //////////////////////////////////////////// - SetWindowView(); - - // Draw the radar. - ////////////////// - DrawRadar(); - - // Draw the chat. - ///////////////// - DrawChat(); - - // Draw graphs. - /////////////// - DrawGraphs(); - - // Show the framerate. - ////////////////////// - DrawFPS(diff); - } - else - { - // Set the view for drawing in window space. - //////////////////////////////////////////// - SetWindowView(); - - // Draw the connecting screen. - ////////////////////////////// - DrawConnecting(); - } - - // Saw the front and back buffers. - ////////////////////////////////// - glutSwapBuffers(); -} - -static void Reshape -( - int width, - int height -) -{ - screenWidth = width; - screenHeight = height; - - // Setup a simple 2D orthographic view. - /////////////////////////////////////// - glLoadIdentity(); - glViewport(0, 0, width, height); - gluOrtho2D(0, MAP_MAX, 0, MAP_MAX); -} - -void InitializeDisplay -( - void -) -{ - int i; - unsigned long now; - char buffer[32]; - - // Init glut window. - //////////////////// - - glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_ALPHA); - - if(fullScreen) - { - glutGameModeString("640x480:32"); - glutEnterGameMode(); - //glutFullScreen(); - glutSetCursor(GLUT_CURSOR_NONE); - } - else - { - glutInitWindowSize(screenWidth, screenHeight); - glutInitWindowPosition(200, 200); - glutCreateWindow(TITLE); - } - // Set display callbacks. - ///////////////////////// - glutDisplayFunc(Display); - glutReshapeFunc(Reshape); - - // Set the background color. - //////////////////////////// - glClearColor(0, 0, 0, 0); - - // Smooth points. - ///////////////// - glEnable(GL_POINT_SMOOTH); - glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); - - // Don't show the backs of polygons. - //////////////////////////////////// - glEnable(GL_CULL_FACE); - - // We always use the same blend. - //////////////////////////////// - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - // Load textures. - ///////////////// - printf("Loading textures..."); - LoadTexture("images/space.tga", &backgroundTexture, GT2False); - printf("."); - for(i = 0 ; i < NUM_SHIP_TEXTURES ; i++) - { - sprintf(buffer, "images/ship%d.tga", i); - LoadTexture(buffer, &shipTextures[i], GT2True); - printf("."); - } - for(i = 0 ; i < NUM_EXPLOSION_TEXTURES ; i++) - { - sprintf(buffer, "images/explosion%d.tga", i); - LoadTexture(buffer, &explosionTextures[i], GT2True); - printf("."); - } - for(i = 0 ; i < NUM_ROCKET_TEXTURES ; i++) - { - sprintf(buffer, "images/rocket%d.tga", i); - LoadTexture(buffer, &rocketTextures[i], GT2True); - printf("."); - } - for(i = 0 ; i < NUM_ASTEROID_TEXTURES ; i++) - { - sprintf(buffer, "images/asteroid%d.tga", i); - LoadTexture(buffer, &asteroidTextures[i], GT2True); - printf("."); - } - for(i = 0 ; i < NUM_MINE_TEXTURES ; i++) - { - sprintf(buffer, "images/mine%d.tga", i); - LoadTexture(buffer, &mineTextures[i], GT2True); - printf("."); - } - for(i = 0 ; i < NUM_MINE_TEXTURES ; i++) - { - sprintf(buffer, "images/spinner%d.tga", i); - LoadTexture(buffer, &spinnerTextures[i], GT2True); - printf("."); - } - printf("\n"); - - // Get the time. - //////////////// - now = current_time(); - - // Setup stars. - /////////////// - for(i = 0 ; i < NUM_STARS ; i++) - InitStar(now, &stars[i]); - - // Setup frame history. - /////////////////////// - FrameHistoryStart = -1; -} - -void ShutdownDisplay -( - void -) -{ - if(fullScreen) - { - glutLeaveGameMode(); - } -} - -void DisplayThink -( - unsigned long now -) -{ - static unsigned long last; - unsigned long diff; - - // Get the frame time. - ////////////////////// - now = current_time(); - diff = (now - last); - if(diff < 5) - return; - last = now; - - // Is it time to scroll the chat? - ///////////////////////////////// - if((now - lastChatScroll) > CHAT_SCROLL_TIME) - { - RemoveOldestChat(); - lastChatScroll = now; - } - - // Update the frame. - //////////////////// - glutPostRedisplay(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aDisplay.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aDisplay.h deleted file mode 100644 index 885a989b729..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aDisplay.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2ADISPLAY_H_ -#define _GT2ADISPLAY_H_ - -extern GT2Bool fullScreen; - -extern GT2Bool DrawGraphsOption; -extern GT2Bool DrawUpdateTimeOption; -extern GT2Bool DrawUpdateLengthOption; -extern GT2Bool DrawFrameTimeOption; -extern GT2Bool DrawMarksOption; -extern GT2Bool DrawFPSOption; -extern GT2Bool DrawWithPredictionOption; -extern GT2Bool DrawBackgroundOption; -extern GT2Bool DrawStarsOption; -extern GT2Bool DrawBoundingCirclesOption; -extern GT2Bool DrawRadarOption; -extern float RadarScaleOption; -extern float RadarPointScaleOption; -extern GT2Bool ViewClippingOption; - -extern int screenWidth; -extern int screenHeight; - -void InitializeDisplay -( - void -); - -void ShutdownDisplay -( - void -); - -void DisplayThink -( - unsigned long now -); - -void DisplayChat -( - const char * message -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aInput.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aInput.c deleted file mode 100644 index b2a68bd5466..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aInput.c +++ /dev/null @@ -1,634 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include -#include "gt2aMain.h" -#include "gt2aInput.h" -#include "gt2aClient.h" -#include "gt2aDisplay.h" -#include "gt2aSound.h" - -#define TOGGLE(b) { ((b) = !(b)); printf( #b " = %s\n", (b)?"ON":"OFF"); } - -GT2Bool upPressed; -GT2Bool downPressed; -GT2Bool leftPressed; -GT2Bool rightPressed; - -GT2Bool UseJoystick = GT2False; - -void SetKeyboardNormal(void); -void SetKeyboardChat(void); - -static char chatBuffer[CHAT_MAX]; -static int nChatChars; -static GT2Bool chatting; - -static void KeyboardPress -( - unsigned char key, - int x, - int y -) -{ - // Lowercase it. - //////////////// - key = tolower(key); - - switch(key) - { - case 0x1B: // esc - ShutdownDisplay(); - exit(1); - - case 't': - SetKeyboardChat(); - break; - - case 'p': - TOGGLE(DrawWithPredictionOption); - break; - - case 'c': - TOGGLE(ViewClippingOption); - break; - - case 'w': - if(localIndex != -1) - { - char buffer[32]; - Player * player; - - player = &players[localIndex]; - sprintf(buffer, "%.0f %.0f %.0f", player->position[0], player->position[1], player->rotation); - DisplayChat(buffer); - } - break; - - case 'j': - TOGGLE(UseJoystick); - break; - - case 'g': - TOGGLE(DrawGraphsOption); - break; - - case 'r': - TOGGLE(DrawBoundingCirclesOption); - break; - } -} - -static void KeyboardRelease -( - unsigned char key, - int x, - int y -) -{ - // Lowercase it. - //////////////// - key = tolower(key); - - switch(key) - { - case 'b': - SendPress("mine"); - break; - - case ' ': - SendPress("rocket"); - break; - } -} - -static void SpecialKeyboardPress -( - int key, - int dummyx, - int dummyy -) -{ - switch(key) - { - case GLUT_KEY_UP: - upPressed = GT2True; - localMotion = FORWARD; - break; - - case GLUT_KEY_DOWN: - downPressed = GT2True; - localMotion = BACKWARD; - break; - - case GLUT_KEY_LEFT: - leftPressed = GT2True; - localTurning = LEFT; - break; - - case GLUT_KEY_RIGHT: - rightPressed = GT2True; - localTurning = RIGHT; - break; - } -} - -static void SpecialKeyboardRelease -( - int key, - int dummyx, - int dummyy -) -{ - switch(key) - { - case GLUT_KEY_UP: - upPressed = GT2False; - if(downPressed) - localMotion = BACKWARD; - else - localMotion = STILL; - break; - - case GLUT_KEY_DOWN: - downPressed = GT2False; - if(upPressed) - localMotion = FORWARD; - else - localMotion = STILL; - break; - - case GLUT_KEY_LEFT: - leftPressed = GT2False; - if(rightPressed) - localTurning = RIGHT; - else - localTurning = STILL; - break; - - case GLUT_KEY_RIGHT: - rightPressed = GT2False; - if(leftPressed) - localTurning = LEFT; - else - localTurning = STILL; - break; - } -} - -const char * GetChatBuffer -( - void -) -{ - if(chatting) - return (const char *)chatBuffer; - - return NULL; -} - -static void ChatAddChar -( - char c -) -{ - if(nChatChars < (CHAT_MAX - 1)) - { - chatBuffer[nChatChars++] = c; - chatBuffer[nChatChars] = '\0'; - } -} - -static void ChatBackspace -( - void -) -{ - if(nChatChars) - chatBuffer[--nChatChars] = '\0'; -} - -static void ChatClear -( - void -) -{ - chatBuffer[0] = '\0'; - nChatChars = 0; -} - -static void ChatSend -( - void -) -{ - assert(nChatChars < CHAT_MAX); - - // Send it. - /////////// - if(nChatChars > 0) - SendChat(chatBuffer); -} - -static void ChatKeyboardPress -( - unsigned char key, - int x, - int y -) -{ - switch(key) - { - case 0x1B: // esc - // Back to normal keyboard handling. - //////////////////////////////////// - SetKeyboardNormal(); - - return; - - case 0x0D: // enter - // Send the current chat message. - ///////////////////////////////// - ChatSend(); - - // Back to normal keyboard handling. - //////////////////////////////////// - SetKeyboardNormal(); - - return; - - case 0x08: // backspace - case 0x7F: // delete - ChatBackspace(); - break; - } - - // Is it printable? - /////////////////// - if(isprint(key)) - { - // Add it to the buffer. - //////////////////////// - ChatAddChar(key); - } -} - -static void ChatKeyboardRelease -( - unsigned char key, - int x, - int y -) -{ - switch(key) - { - } -} - -void SetKeyboardNormal -( - void -) -{ - // Ignore key repeats. - ////////////////////// - glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); - - // Set glut callbacks. - ////////////////////// - glutKeyboardFunc(KeyboardPress); - glutKeyboardUpFunc(KeyboardRelease); - - // We're not chatting. - ////////////////////// - chatting = GT2False; -} - -void SetKeyboardChat -( - void -) -{ - // We don't care about key repeats now. - /////////////////////////////////////// - glutSetKeyRepeat(GLUT_KEY_REPEAT_DEFAULT); - - // Set glut callbacks. - ////////////////////// - glutKeyboardFunc(ChatKeyboardPress); - glutKeyboardUpFunc(ChatKeyboardRelease); - - // Clear the chat buffer. - ///////////////////////// - ChatClear(); - - // We're chatting. - ////////////////// - chatting = GT2True; -} -static void MouseMotionPassive(int x, int y) -{ - static int x_hold = 0; - static int y_hold = 0; - - if(x_hold) - { - localRotation += -(x_hold - x); - - } - - if( (x <= 0) || (x >= 639) ) - glutWarpPointer(320,240); - - x_hold = x; - y_hold = y; -} - -static void MouseButton(int button, int state, int x, int y) -{ - switch(button) - { - case GLUT_LEFT_BUTTON: - if(state == GLUT_DOWN) - SendPress("rocket"); - break; - case GLUT_RIGHT_BUTTON: - switch(state) - { - case GLUT_DOWN: - upPressed = GT2True; - localMotion = FORWARD; - break; - case GLUT_UP: - upPressed = GT2False; - localMotion = STILL; - break; - } - break; - case GLUT_MIDDLE_BUTTON: - switch(state) - { - case GLUT_DOWN: - upPressed = GT2True; - localMotion = BACKWARD; - break; - case GLUT_UP: - upPressed = GT2False; - localMotion = STILL; - break; - } - break; - } -} - - -static void JoystickProcess(unsigned int buttonMask, int x, int y, int z) -{ - static BYTE buttonA = GT2False; - - - if(!UseJoystick) - return; - - if(buttonMask & GLUT_JOYSTICK_BUTTON_A) - { - if(buttonA == GT2False) - { - SendPress("rocket"); - buttonA = GT2True; - } - } - else - buttonA = GT2False; - - if (x < -50) - localTurning = LEFT; - else if(x > 50) - localTurning = RIGHT; - else - localTurning = STILL; - - if(z < -300) - localMotion = FORWARD; - else if(z > 300) - localMotion = BACKWARD; - else - localMotion = STILL; - -} - -static int MainMenu; -enum -{ - MainToggleSound, - MainToggleViewClipping -}; -static void MainMenuCallback -( - int item -) -{ - switch(item) - { - case MainToggleSound: - ToggleSound(); - break; - case MainToggleViewClipping: - TOGGLE(ViewClippingOption); - break; - } -} - -static int GraphMenu; -enum -{ - GraphToggleGraphs, - GraphToggleUpdateTime, - GraphToggleUpdateLength, - GraphToggleFrameTime, - GraphToggleMarks -}; -static void GraphMenuCallback -( - int item -) -{ - switch(item) - { - case GraphToggleGraphs: - TOGGLE(DrawGraphsOption); - break; - case GraphToggleUpdateTime: - TOGGLE(DrawUpdateTimeOption); - break; - case GraphToggleUpdateLength: - TOGGLE(DrawUpdateLengthOption); - break; - case GraphToggleFrameTime: - TOGGLE(DrawFrameTimeOption); - break; - case GraphToggleMarks: - TOGGLE(DrawMarksOption); - break; - } -} - -static int DrawMenu; -enum -{ - DrawToggleFPS, - DrawTogglePrediction, - DrawToggleBackground, - DrawToggleStars, - DrawToggleBoundingCircles -}; -static void DrawMenuCallback -( - int item -) -{ - switch(item) - { - case DrawToggleFPS: - TOGGLE(DrawFPSOption); - break; - case DrawTogglePrediction: - TOGGLE(DrawWithPredictionOption); - break; - case DrawToggleBackground: - TOGGLE(DrawBackgroundOption); - break; - case DrawToggleStars: - TOGGLE(DrawStarsOption); - break; - case DrawToggleBoundingCircles: - TOGGLE(DrawBoundingCirclesOption); - break; - } -} - -static int RadarMenu; -enum -{ - RadarDrawRadar, - RadarSmallRadar, - RadarMediumRadar, - RadarLargeRadar, - RadarSmallPoints, - RadarMediumPoints, - RadarLargePoints -}; -static void RadarMenuCallback -( - int item -) -{ - switch(item) - { - case RadarDrawRadar: - TOGGLE(DrawRadarOption); - break; - case RadarSmallRadar: - RadarScaleOption = 0.5; - break; - case RadarMediumRadar: - RadarScaleOption = 1; - break; - case RadarLargeRadar: - RadarScaleOption = 2; - break; - case RadarSmallPoints: - RadarPointScaleOption = 1; - break; - case RadarMediumPoints: - RadarPointScaleOption = 2; - break; - case RadarLargePoints: - RadarPointScaleOption = 3; - break; - } -} - -void InitializeInput -( - void -) -{ - // Set the keyboard to normal. - ////////////////////////////// - SetKeyboardNormal(); - - // The glut handlers for "special" keys don't change. - ///////////////////////////////////////////////////// - glutSpecialFunc(SpecialKeyboardPress); - glutSpecialUpFunc(SpecialKeyboardRelease); - - - // The glut handlers for mouse input - //////////////////////////////////// - glutPassiveMotionFunc(MouseMotionPassive); - glutMotionFunc(MouseMotionPassive); - glutMouseFunc (MouseButton); - - // The glut handler for joystick input - ////////////////////////////////////// - glutJoystickFunc(JoystickProcess, 1); - - // Setup the menu. - ////////////////// - MainMenu = glutCreateMenu(MainMenuCallback); - - // Graph sub-menu. - ////////////////// - GraphMenu = glutCreateMenu(GraphMenuCallback); - glutSetMenu(GraphMenu); - glutAddMenuEntry("Toggle Graphs", GraphToggleGraphs); - glutAddMenuEntry("Toggle Update Time", GraphToggleUpdateTime); - glutAddMenuEntry("Toggle Update Length", GraphToggleUpdateLength); - glutAddMenuEntry("Toggle Frame Time", GraphToggleFrameTime); - glutAddMenuEntry("Toggle Marks", GraphToggleMarks); - glutSetMenu(MainMenu); - glutAddSubMenu("Graph", GraphMenu); - - // Draw sub-menu. - ///////////////// - DrawMenu = glutCreateMenu(DrawMenuCallback); - glutSetMenu(DrawMenu); - glutAddMenuEntry("Toggle FPS", DrawToggleFPS); - glutAddMenuEntry("Toggle Prediction", DrawTogglePrediction); - glutAddMenuEntry("Toggle Background", DrawToggleBackground); - glutAddMenuEntry("Toggle Stars", DrawToggleStars); - glutAddMenuEntry("Toggle Bounding Circles", DrawToggleBoundingCircles); - glutSetMenu(MainMenu); - glutAddSubMenu("Draw", DrawMenu); - - // Radar sub-menu. - ////////////////// - RadarMenu = glutCreateMenu(RadarMenuCallback); - glutSetMenu(RadarMenu); - glutAddMenuEntry("Draw Radar", RadarDrawRadar); - glutAddMenuEntry("Small Radar", RadarSmallRadar); - glutAddMenuEntry("Medium Radar", RadarMediumRadar); - glutAddMenuEntry("Large Radar", RadarLargeRadar); - glutAddMenuEntry("Small Points", RadarSmallPoints); - glutAddMenuEntry("Medium Points", RadarMediumPoints); - glutAddMenuEntry("Large Points", RadarLargePoints); - glutSetMenu(MainMenu); - glutAddSubMenu("Radar", RadarMenu); - - // Main menu. - ///////////// - glutAddMenuEntry("Toggle Sound", MainToggleSound); - glutAddMenuEntry("Toggle View Clipping", MainToggleViewClipping); - - // Attach the menu. - /////////////////// - glutAttachMenu(GLUT_RIGHT_BUTTON); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aInput.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aInput.h deleted file mode 100644 index cadafa0c223..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aInput.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2AINPUT_H_ -#define _GT2AINPUT_H_ - -void InitializeInput -( - void -); - -const char * GetChatBuffer -( - void -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aLogic.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aLogic.c deleted file mode 100644 index 14603fa7424..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aLogic.c +++ /dev/null @@ -1,860 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include "gt2aMain.h" -#include "gt2aLogic.h" -#include "gt2aMath.h" -#include "gt2aSound.h" -#include "gt2aServer.h" - -#define DEATH_MESSAGES 0 - -SObject sObjects[MAX_OBJECTS]; -int numObjects; -static unsigned long Now; -static unsigned long Diff; -static int NumAsteroids; - -static void ExplodeObject(SObject * object); -static void InitAsteroid(SObject * asteroid); - -static SObject * AddObject -( - ObjectType type -) -{ - int i; - SObject * object; - - // Find an open slot. - ///////////////////// - for(i = 0 ; i < MAX_OBJECTS ; i++) - if(!sObjects[i].used) - break; - - // Nothing open? - //////////////// - if(i == MAX_OBJECTS) - return NULL; - - // Clear it. - //////////// - object = &sObjects[i]; - memset(object, 0, sizeof(SObject)); - object->used = GT2True; - object->type = type; - object->owner = -1; - - // Set the start time. - ////////////////////// - object->startTime = Now; - - // One more object. - /////////////////// - numObjects++; - assert(numObjects <= MAX_OBJECTS); - - return &sObjects[i]; -} - -static void RemoveObject -( - SObject * object -) -{ - assert(object); - if(!object) - return; - - // Mark this object for removal. - //////////////////////////////// - object->remove = GT2True; -} - -static void ClientKilled -( - Client * killed, - Client * killer -) -{ -#if DEATH_MESSAGES - char buffer[MAX_NICK + MAX_NICK + 32]; -#endif - - assert(killed); - - // Is there a killer? - ///////////////////// - if(killer) - { - // Self kill? - ///////////// - if(killer == killed) - { - // Subtract a point. - //////////////////// - killer->score--; - } - else - { - // Give the killer a point. - /////////////////////////// - killer->score++; - } - } - - // Kill the killed. - /////////////////// - killed->dead = GT2True; - killed->spawnTime = (Now + DEATH_TIME); - - // Play the death sound. - //////////////////////// - SendSound(SOUND_DIE, -1); - -#if DEATH_MESSAGES - // Let everyone know. - ///////////////////// - if(killer == killed) - sprintf(buffer, "%s killed himself", killed->nick); - else if(killer) - sprintf(buffer, "%s killed %s", killer->nick, killed->nick); - else - sprintf(buffer, "%s was killed", killed->nick); - BroadcastText(buffer, -1, GT2True); -#endif -} - -/////////// -//ROCKET // -/////////// - -static void RocketThink -( - SObject * rocket -) -{ - assert(rocket); - - // Move the rocket. - /////////////////// - ComputeNewPosition( - rocket->position, - rocket->position, - FORWARD, - rocket->rotation, - Diff, - ROCKET_SPEED, - GT2False); - - // Check if we should disappear. - //////////////////////////////// - if((rocket->position[0] < (MAP_MIN - MAP_EXTRA)) || - (rocket->position[0] > (MAP_MAX + MAP_EXTRA)) || - (rocket->position[1] < (MAP_MIN - MAP_EXTRA)) || - (rocket->position[1] > (MAP_MAX + MAP_EXTRA))) - { - RemoveObject(rocket); - } -} - -static void RocketTouchObject -( - SObject * rocket, - SObject * object -) -{ - // Don't explode if its another rocket with the same owner. - /////////////////////////////////////////////////////////// - if((object->type == ObjectRocket) && (object->owner == rocket->owner)) - return; - - // We pass through explosions. - ////////////////////////////// - if(object->type == ObjectExplosion) - return; - - // Explode the object. - ////////////////////// - ExplodeObject(object); - - // Remove the rocket. - ///////////////////// - RemoveObject(rocket); -} - -static void RocketTouchClient -( - SObject * rocket, - Client * client -) -{ - // Check for death. - /////////////////// - if(client->dead) - return; - - // Check for self. - ////////////////// - if(rocket->owner == client->index) - return; - - // Kill the client. - /////////////////// - if(rocket->owner == -1) - ClientKilled(client, NULL); - else - ClientKilled(client, &clients[rocket->owner]); - - // Explode the rocket. - ////////////////////// - ExplodeObject(rocket); -} - -////////// -// MINE // -////////// - -static void MineThink -( - SObject * mine -) -{ - // Check for detonate. - ////////////////////// - if((Now - mine->startTime) > MINE_TIME) - { - // Explode the mine. - //////////////////// - ExplodeObject(mine); - } - else - { - // Rotate the mine. - /////////////////// - mine->rotation = ComputeNewRotation(mine->rotation, RIGHT, Diff, MINE_TURN_SPEED); - - // Check if a second has passed. - //////////////////////////////// - if((int)((Now - mine->startTime) / 1000) > mine->count) - { - // One more full second. - //////////////////////// - mine->count++; - - // Make a sound during the last 3 seconds. - ////////////////////////////////////////// - if(mine->count >= ((MINE_TIME / 1000) - 3)) - SendSound(SOUND_MINE, -1); - } - } -} - -static void MineTouchObject -( - SObject * mine, - SObject * object -) -{ - // Ignore explosions. - ///////////////////// - if(object->type == ObjectExplosion) - return; - - // Blow up the object. - ////////////////////// - ExplodeObject(object); - - // Remove the mine. - /////////////////// - RemoveObject(mine); -} - -static void MineTouchClient -( - SObject * mine, - Client * client -) -{ - // Check if its armed itself. - ///////////////////////////// - if((Now - mine->startTime) < MINE_ARM_TIME) - return; - - // Check for death. - /////////////////// - if(client->dead) - return; - - // Kill the client. - /////////////////// - if(mine->owner == -1) - ClientKilled(client, NULL); - else - ClientKilled(client, &clients[mine->owner]); - - // Explode the mine. - //////////////////// - ExplodeObject(mine); -} - -////////////// -// ASTEROID // -////////////// - -static void AsteroidThink -( - SObject * asteroid -) -{ - // Rotate the asteroid. - /////////////////////// - asteroid->rotation = ComputeNewRotation(asteroid->rotation, LEFT, Diff, ASTEROID_TURN_SPEED); - - // Move the asteroid. - ///////////////////// - ComputeNewPosition(asteroid->position, asteroid->position, FORWARD, asteroid->heading, Diff, asteroid->speed, GT2False); - - // If it goes past the edge, loop it around. - //////////////////////////////////////////// - if(asteroid->position[0] > MAP_MAX + (2*asteroid->radius)) - asteroid->position[0] = MAP_MIN - (2*asteroid->radius); - if(asteroid->position[0] < MAP_MIN - (2*asteroid->radius)) - asteroid->position[0] = MAP_MAX + (2*asteroid->radius); - - if(asteroid->position[1] > MAP_MAX + (2*asteroid->radius)) - asteroid->position[1] = MAP_MIN - (2*asteroid->radius); - if(asteroid->position[1] < MAP_MIN - (2*asteroid->radius)) - asteroid->position[1] = MAP_MAX + (2*asteroid->radius); - -} - -static void AsteroidTouchObject -( - SObject * asteroid, - SObject * object -) -{ - // Explode on asteroid impact. - ////////////////////////////// - if(object->type == ObjectAsteroid) - { - ExplodeObject(asteroid); - ExplodeObject(object); - } -} - -static void AsteroidTouchClient -( - SObject * asteroid, - Client * client -) -{ - // Check for death. - /////////////////// - if(client->dead) - return; - - // Kill the client. - /////////////////// - ClientKilled(client, NULL); - - // Explode the asteroid. - //////////////////////// - ExplodeObject(asteroid); -} - -static void SpawnAsteroids -( - void -) -{ - SObject * asteroid; - int i; - - NumAsteroids = 0; - for(i = 0 ; i < NUM_ASTEROIDS ; i++) - { - asteroid = AddObject(ObjectAsteroid); - if(asteroid) - InitAsteroid(asteroid); - } -} - -static void AsteroidDie -( - SObject * asteroid -) -{ - // One less asteroid. - ///////////////////// - NumAsteroids--; - - // If they're all gone, make new ones. - ////////////////////////////////////// - if(!NumAsteroids) - SpawnAsteroids(); -} - -static void InitAsteroid -( - SObject * asteroid -) -{ - asteroid->position[0] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - asteroid->position[1] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - asteroid->rotation = RandomFloat(0, 360, GT2False); - asteroid->think = AsteroidThink; - asteroid->touchObject = AsteroidTouchObject; - asteroid->touchClient = AsteroidTouchClient; - asteroid->die = AsteroidDie; - asteroid->radius = ASTEROID_RADIUS; - asteroid->speed = RandomFloat(ASTEROID_SPEED_MIN, ASTEROID_SPEED_MAX, GT2False); - asteroid->heading = asteroid->rotation; - - NumAsteroids++; -} - -/////////////// -// EXPLOSION // -/////////////// - -static void ExplosionThink -( - SObject * explosion -) -{ - // Check for done. - ////////////////// - if((Now - explosion->startTime) > EXPLOSION_TIME) - { - // Delete the explosion. - //////////////////////// - RemoveObject(explosion); - } -} - -static void ExplosionTouchObject -( - SObject * explosion, - SObject * object -) -{ -} - -static void ExplosionTouchClient -( - SObject * explosion, - Client * client -) -{ - // Check if we're still dangerous. - ////////////////////////////////// - if((Now - explosion->startTime) > EXPLOSION_DANGER_TIME) - return; - - // Check for death. - /////////////////// - if(client->dead) - return; - - // Kill the client. - /////////////////// - if(explosion->owner == -1) - ClientKilled(client, NULL); - else - ClientKilled(client, &clients[explosion->owner]); -} - -static SObject * AddExplosion -( - V2f position, - int owner -) -{ - SObject * explosion; - - // Add an explosion. - //////////////////// - explosion = AddObject(ObjectExplosion); - if(!explosion) - return NULL; - - // Setup the explosion. - /////////////////////// - explosion->owner = owner; - CopyV2f(explosion->position, position); - explosion->rotation = RandomFloat(0, 360, GT2False); - explosion->think = ExplosionThink; - explosion->touchObject = ExplosionTouchObject; - explosion->touchClient = ExplosionTouchClient; - explosion->radius = EXPLOSION_RADIUS; - - // Send a sound effect. - /////////////////////// - SendSound(SOUND_EXPLOSION, -1); - - return explosion; -} - -static void ExplodeObject -( - SObject * object -) -{ - // Don't explode explosions. - //////////////////////////// - if(object->type == ObjectExplosion) - return; - - // Mark this object for explosion. - ////////////////////////////////// - object->explode = GT2True; - - if(object->type != ObjectAsteroid) - { - // Mark for removal. - //////////////////// - RemoveObject(object); - } -} - -static void ClientThink -( - Client * client -) -{ - // Dead? - //////// - if(client->dead) - { - // Time to spawn? - ///////////////// - if(Now > client->spawnTime) - ClientSpawn(client); - } - else if(client->numAsteroids) - { - static V2f spinnerPosition = { MAP_HALF, MAP_HALF }; - float distance; - - // Check for the spinner. - ///////////////////////// - distance = DistanceV2f(spinnerPosition, client->position); - if(distance < (PLAYER_RADIUS + SPINNER_RADIUS)) - { - // Drop off our asteroids. - ////////////////////////// - client->score += client->numAsteroids; - client->numAsteroids = 0; - SendNumAsteroids(client->numAsteroids, client->index); - SendSound(SOUND_PICKUP, client->index); - } - } -} - -void ClientPress -( - int clientIndex, - const char * button -) -{ - SObject * object; - Client * client; - V2f forward; - - assert(clientIndex >= 0); - assert(clientIndex < MAX_CLIENTS); - assert(clients[clientIndex].used); - - // Set the Now time. - //////////////////// - Now = current_time(); - - client = &clients[clientIndex]; - - // Check the button. - //////////////////// - if(strcasecmp(button, "mine") == 0) - { - // Add a mine object. - ///////////////////// - object = AddObject(ObjectMine); - if(object) - { - // Set its properties. - ////////////////////// - object->owner = clientIndex; - CopyV2f(object->position, client->position); - object->rotation = client->rotation; - object->think = MineThink; - object->touchObject = MineTouchObject; - object->touchClient = MineTouchClient; - object->radius = MINE_RADIUS; - - // Move it so its behind the client. - ////////////////////////////////////// - RotationToVector(forward, object->rotation); - ScaleV2f(forward, forward, -500); - AddV2f(object->position, object->position, forward); - - // Play the mine sound. - /////////////////////// - SendSound(SOUND_MINE, -1); - } - } - else if(strcasecmp(button, "rocket") == 0) - { - // Add a rocket object. - /////////////////////// - object = AddObject(ObjectRocket); - if(object) - { - // Set its properties. - ////////////////////// - object->owner = clientIndex; - CopyV2f(object->position, client->position); - object->rotation = client->rotation; - object->think = RocketThink; - object->touchObject = RocketTouchObject; - object->touchClient = RocketTouchClient; - object->radius = ROCKET_RADIUS; - - // Move it so its ahead of the client. - ////////////////////////////////////// - RotationToVector(forward, object->rotation); - ScaleV2f(forward, forward, 300); - AddV2f(object->position, object->position, forward); - - // Play the rocket sound. - ///////////////////////// - SendSound(SOUND_ROCKET, -1); - } - } -} - -void ObjectThink -( - SObject * object -) -{ - int i; - SObject * other; - Client * client; - - // Think. - ///////// - object->think(object); - - // Check for client touches. - //////////////////////////// - if(object->touchClient) - { - float range; - - range = (object->radius + PLAYER_RADIUS); - - for(i = 0 ; i < MAX_CLIENTS ; i++) - { - client = &clients[i]; - - // Check for in use. - //////////////////// - if(!client->used) - continue; - - // Check for a touch. - ///////////////////// - if(DistanceV2f(object->position, client->position) <= range) - { - // Touched. - /////////// - object->touchClient(object, client); - } - } - } - - // Check for object touches. - //////////////////////////// - if(object->touchObject) - { - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - other = &sObjects[i]; - - // Check for in use. - //////////////////// - if(!other->used) - continue; - - // Check for self. - ////////////////// - if(other == object) - continue; - - // Check for a touch. - ///////////////////// - if(DistanceV2f(object->position, other->position) <= (object->radius + other->radius)) - { - // Touched. - /////////// - object->touchObject(object, other); - } - } - } -} - -void ObjectsThink -( - unsigned long now, - unsigned long diff -) -{ - Client * client; - SObject * object; - int i; - - Now = now; - Diff = diff; - - // Go through the list of clients. - ////////////////////////////////// - for(i = 0 ; i < MAX_CLIENTS ; i++) - { - client = &clients[i]; - - // Is it a real client? - /////////////////////// - if(client->used) - { - // Think. - ///////// - ClientThink(client); - } - } - - // Think for all the objects. - ///////////////////////////// - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - object = &sObjects[i]; - - // Is the object in use? - //////////////////////// - if(object->used) - { - // Think. - ///////// - ObjectThink(object); - } - } - - // Check for exploding or removed objects. - ////////////////////////////////////////// - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - object = &sObjects[i]; - - // Is the object in use? - //////////////////////// - if(object->used) - { - // Explode the object? - ////////////////////// - if(object->explode) - { - // Create an explosion. - /////////////////////// - AddExplosion(object->position, object->owner); - - // It exploded. - /////////////// - object->explode = GT2False; - - - // If it is an asteroid, then move it to the edge - ///////////////////////////////////////////////// - if(object->type == ObjectAsteroid) - { - object->position[0] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - object->position[1] = MAP_MIN - object->radius; - } - - - } - - // Remove the object? - ///////////////////// - if(object->remove) - { - // Call its die function. - ///////////////////////// - if(object->die) - object->die(object); - - if(object->used) - { - // We're not using this object anymore. - /////////////////////////////////////// - object->used = GT2False; - - // One less object. - /////////////////// - numObjects--; - assert(numObjects >= 0); - } - } - } - } -} - -void ClientSpawn -( - Client * client -) -{ - SObject * asteroid; - - // Throw away his asteroids. - //////////////////////////// - for( ; client->numAsteroids ; client->numAsteroids--) - { - asteroid = AddObject(ObjectAsteroid); - if(asteroid) - { - InitAsteroid(asteroid); - asteroid->position[0] = client->position[0]; - asteroid->position[0] += RandomFloat(-5000, 5000, GT2True); - asteroid->position[1] = client->position[1]; - asteroid->position[1] += RandomFloat(-5000, 5000, GT2True); - ClampV2f(asteroid->position, asteroid->position, MAP_MIN, MAP_MAX); - } - } - SendNumAsteroids(client->numAsteroids, client->index); - - // Pick a random starting point. - //////////////////////////////// - client->position[0] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - client->position[1] = RandomFloat(MAP_MIN, MAP_MAX, GT2True); - - // Not dead. - //////////// - client->dead = GT2False; -} - -void InitializeLogic -( - void -) -{ - // Add a bunch of asteroids. - //////////////////////////// - SpawnAsteroids(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aLogic.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aLogic.h deleted file mode 100644 index b389d682146..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aLogic.h +++ /dev/null @@ -1,119 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2ALOGIC_H_ -#define _GT2ALOGIC_H_ - -#include "gt2aServer.h" - -#define PLAYER_SPEED 7000 // units/second -#define PLAYER_TURN_SPEED 0.14 // degrees/millisecond -#define PLAYER_RADIUS 200 -#define PLAYER_MAX_ASTEROIDS 50 -#define DEATH_TIME 1000 -#define PRESS_TIME 100 // time between presses - -#define MAX_OBJECTS 256 -#define ROCKET_RADIUS 250 -#define ROCKET_SPEED 10500 -#define MINE_TIME 30000 -#define MINE_ARM_TIME 1000 -#define MINE_TURN_SPEED 0.36 // degrees/millisecond -#define MINE_RADIUS 200//141 -#define NUM_ASTEROIDS 50 -#define ASTEROID_TURN_SPEED 0.18 -#define ASTEROID_TURN_RANGE 0.24 -#define ASTEROID_RADIUS 350 -#define ASTEROID_SPEED_MIN 0 -#define ASTEROID_SPEED_MAX 5000 -#define EXPLOSION_RADIUS 900 -#define EXPLOSION_TIME 350 -#define EXPLOSION_DANGER_TIME 250 -#define SPINNER_RADIUS 5000 -#define SPINNER_COORD (SPINNER_RADIUS * 1.414) - -typedef enum -{ - ObjectRocket, - ObjectMine, - ObjectAsteroid, - ObjectExplosion, - NumObjects -} ObjectType; - -typedef void (* Think) -( - struct SObject * self -); - -typedef void (* TouchObject) -( - struct SObject * self, - struct SObject * object -); - -typedef void (* Die) -( - struct SObject * self -); - -typedef void (* TouchClient) -( - struct SObject * self, - struct Client * client -); - -typedef struct SObject -{ - GT2Bool used; // If this slot is in use or not. - ObjectType type; // The type of object. - int owner; // The client that owns this object, or -1. - V2f position; // The object's position. - float rotation; // The object's rotation. - unsigned long startTime; // The time this object was created. - Think think; // This object's think function. - TouchObject touchObject; // Called when touching another object. - TouchClient touchClient; // Called when touching a client. - Die die; // Called when the object dies. - int count; // Generic counter. - float radius; // This object's radius (for collision). - GT2Bool explode; // Explode this object when done thinking. - GT2Bool remove; // Remove this object when done thinking. - - float heading; // The direction the object is moving - float speed; // The speed of the object -} SObject; - -extern SObject sObjects[MAX_OBJECTS]; -extern int numObjects; - -void ObjectsThink -( - unsigned long now, - unsigned long diff -); - -void ClientPress -( - int clientIndex, - const char * button -); - -void ClientSpawn -( - Client * client -); - -void InitializeLogic -( - void -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMain.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMain.c deleted file mode 100644 index 9584ee616e4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMain.c +++ /dev/null @@ -1,276 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include -#include -#include -#include "gt2aMain.h" -#include "gt2aDisplay.h" -#include "gt2aClient.h" -#include "gt2aServer.h" -#include "gt2aInput.h" -#include "gt2aSound.h" -#include "../../ghttp/ghttp.h" - -const V3b Red = { 255, 0, 0 }; -const V3b Green = { 0, 255, 0 }; -const V3b Blue = { 0, 0, 255 }; -const V3b Yellow = { 255, 255, 0 }; -const V3b Orange = { 255, 128, 0 }; -const V3b Purple = { 255, 0, 255 }; -const V3b Black = { 0, 0, 0 }; -const V3b White = { 255, 255, 255 }; -const V3b Grey = { 128, 128, 128 }; - -static GT2Bool host = GT2True; -static GT2Bool dedicated; - -void Log -( - const char * format, - ... -) -{ -#if 1 - FILE * fp; - va_list args; - - va_start(args, format); - - fp = fopen("gt2a.log", "at"); - if(fp) - { - fprintf(fp, "%08d: ", (current_time() % 100000000)); - vfprintf(fp, format, args); - fclose(fp); - } - - va_end(args); -#endif -} - -static void Idle -( - void -) -{ - msleep(1); - glutPostRedisplay(); -} - -static void Timer -( - int value -) -{ - unsigned long now; - - // Reset the timer. - /////////////////// - glutTimerFunc(10, Timer, 0); - - // Get the current time. - //////////////////////// - now = current_time(); - - // Let the subsystems think. - //////////////////////////// - if(host) - ServerThink(now); - if(!dedicated) - ClientThink(now); - DisplayThink(now); -} - -static GHTTPBool NaminatorCallback -( - GHTTPRequest request, - GHTTPResult result, - char * buffer, - GHTTPByteCount bufferLen, - void * param -) -{ - if(result == GHTTPSuccess) - { - char * str; - - // Set the nick. - //////////////// - strncpy(localNick, buffer, MAX_NICK); - localNick[MAX_NICK - 1] = '\0'; - - // Cap off the newline. - /////////////////////// - str = strchr(localNick, '\n'); - if(str) - *str = '\0'; - - // Strip out stuff that'll mess up our - // key\value message passing. - ////////////////////////////////////// - while(str = strchr(localNick, '\\')) - *str = '/'; - - printf("%s\n", localNick); - } - else - { - printf("Error\n"); - } - - return GHTTPTrue; -} - -static void ParseArgs -( - int argc, - char ** argv -) -{ - GT2Bool gotNick = GT2False; - int i; - - for(i = 1 ; i < argc ; i++) - { - // Connect. - /////////// - if(strncasecmp(argv[i], "-c", 2) == 0) - { - if(++i < argc) - { - // Get the address to connect to. - ///////////////////////////////// - strcpy(serverAddress, argv[i]); - if(!strchr(serverAddress, ':')) - strcat(serverAddress, PORT_STRING); - host = GT2False; - } - } - // Fullscreen. - ////////////// - else if(strcasecmp(argv[i], "-full") == 0) - { - fullScreen = GT2True; - } - // Nick. - //////// - else if((strcasecmp(argv[i], "-nick") == 0) || - (strcasecmp(argv[i], "-name") == 0)) - { - if(++i < argc) - { - char * str; - - // Set the nick. - //////////////// - strncpy(localNick, argv[i], MAX_NICK); - localNick[MAX_NICK - 1] = '\0'; - - // Strip out stuff that'll mess up our - // key\value message passing. - ////////////////////////////////////// - while(str = strchr(localNick, '\\')) - *str = '/'; - - // We got a nick. - ///////////////// - gotNick = GT2True; - } - } - // Dedicated server. - //////////////////// - else if(strcasecmp(argv[i], "-dedicated") == 0) - { - dedicated = GT2True; - } - // Width. - ///////// - else if(strcasecmp(argv[i], "-width") == 0) - { - if(++i < argc) - screenWidth = atoi(argv[i]); - } - // Height. - ////////// - else if(strcasecmp(argv[i], "-height") == 0) - { - if(++i < argc) - screenHeight = atoi(argv[i]); - } - } - - // If we didn't get a nick, get a naminator nick. - ///////////////////////////////////////////////// - if(!gotNick) - { - printf("Getting naminator name..."); - ghttpGetFile("http://www.planetquake.com/excessive/name.asp", GHTTPTrue, NaminatorCallback, NULL); - } -} - -static GT2Bool Initialize -( - void -) -{ - // Init the display. - //////////////////// - InitializeDisplay(); - - // Init input handling. - /////////////////////// - InitializeInput(); - - // Init sound. - ////////////// - InitializeSound(); - - // Start the server if we're hosting. - ///////////////////////////////////// - if(host) - { - if(!InitializeServer()) - { - printf("Failed to initialize server!\n"); - return GT2False; - } - } - - // Start the client if not dedicated. - ///////////////////////////////////// - if(!dedicated) - { - if(!InitializeClient()) - { - printf("Failed to initialize client!\n"); - return GT2False; - } - } - - return GT2True; -} - -int main -( - int argc, - char ** argv -) -{ - srand(time(NULL)); - glutInit(&argc, argv); - ParseArgs(argc, argv); - glutTimerFunc(10, Timer, 0); - glutIdleFunc(Idle); - if(!Initialize()) - return 1; - glutMainLoop(); - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMain.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMain.h deleted file mode 100644 index 555928a2bd2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMain.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2AMAIN_H_ -#define _GT2AMAIN_H_ - -#include -#include -#include "../../nonport.h" -#include "../gt2.h" -#include "../gt2Encode.h" - -#define PORT_STRING ":12345" - -#define MAX_PLAYERS 64 - -#define BACKWARD -1 -#define STILL 0 -#define FORWARD 1 - -#define LEFT -1 -#define RIGHT 1 - -#define MAP_MIN 0 -#define MAP_MAX 100000.0 -#define MAP_HALF (MAP_MAX / 2) -#define MAP_EXTRA (MAP_MAX / 10) - -#define MAX_NICK 32 - -#define CHAT_MAX 64 - -#define MSG_C_INITIAL 1 -#define MSG_C_INITIAL_STR "s" -#define MSG_C_UPDATE 2 -#define MSG_C_UPDATE_STR "ppzzzz" -#define MSG_C_PRESS 3 -#define MSG_C_PRESS_STR "s" -#define MSG_C_CHAT 4 -#define MSG_C_CHAT_STR "s" -#define MSG_S_ADDCLIENT 1001 -#define MSG_S_ADDCLIENT_STR "bs" -#define MSG_S_DELCLIENT 1002 -#define MSG_S_DELCLIENT_STR "b" -#define MSG_S_START 1003 -#define MSG_S_START_STR "b" -#define MSG_S_UPDATE 1004 -#define MSG_S_UPDATE_STR "pbb" -#define MSG_S_UPDATE_CLIENT_STR "bpppizzzzz" -#define MSG_S_UPDATE_OBJECT_STR "bpppi" -#define MSG_S_CHAT 1005 -#define MSG_S_CHAT_STR "s" -#define MSG_S_SOUND 1006 -#define MSG_S_SOUND_STR "b" -#define MSG_S_NUMASTEROIDS 1007 -#define MSG_S_NUMASTEROIDS_STR "b" - -typedef unsigned char byte; -typedef float V2f[2]; -typedef byte V3b[3]; - -extern const V3b Red; -extern const V3b Green; -extern const V3b Blue; -extern const V3b Yellow; -extern const V3b Orange; -extern const V3b Purple; -extern const V3b Black; -extern const V3b White; -extern const V3b Grey; - -void Log -( - const char * format, - ... -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMath.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMath.c deleted file mode 100644 index 0ea17969cb9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMath.c +++ /dev/null @@ -1,364 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include -#include -#include -#include "gt2aMain.h" -#include "gt2aMath.h" - -#define PI 3.1415926535897932384626433832795 -#define PI_DIV_180 (PI / 180) - -byte * CopyV3b -( - V3b dest, - const V3b src -) -{ - dest[0] = src[0]; - dest[1] = src[1]; - dest[2] = src[2]; - - return dest; -} - -byte * SetV3b -( - V3b dest, - byte src0, - byte src1, - byte src2 -) -{ - dest[0] = src0; - dest[1] = src1; - dest[2] = src2; - - return dest; -} - -float * CopyV2f -( - V2f dest, - const V2f src -) -{ - dest[0] = src[0]; - dest[1] = src[1]; - - return dest; -} - -float * SetV2f -( - V2f dest, - float src0, - float src1 -) -{ - dest[0] = src0; - dest[1] = src1; - - return dest; -} - -float * ScaleV2f -( - V2f dest, - const V2f src, - float scale -) -{ - dest[0] = (src[0] * scale); - dest[1] = (src[1] * scale); - - return dest; -} - -float * AddV2f -( - V2f dest, - const V2f src0, - const V2f src1 -) -{ - dest[0] = (src0[0] + src1[0]); - dest[1] = (src0[1] + src1[1]); - - return dest; -} - -float * SubV2f -( - V2f dest, - const V2f src0, - const V2f src1 -) -{ - dest[0] = (src0[0] - src1[0]); - dest[1] = (src0[1] - src1[1]); - - return dest; -} - -float * SubScalarV2f -( - V2f dest, - const V2f src, - float scalar -) -{ - dest[0] = (src[0] - scalar); - dest[1] = (src[1] - scalar); - - return dest; -} - -float LenV2f -( - const V2f src -) -{ - return (float)sqrt((src[0] * src[0]) + (src[1] * src[1])); -} - -float DistanceV2f -( - const V2f src0, - const V2f src1 -) -{ - V2f temp; - - SubV2f(temp, src0, src1); - - return LenV2f(temp); -} - -float * ClampV2f -( - V2f dest, - const V2f src, - float min, - float max -) -{ - float temp; - int i; - - for(i = 0 ; i < 2 ; i++) - { - temp = src[i]; - if(temp > max) - dest[i] = max; - else if(temp < min) - dest[i] = min; - else - dest[i] = temp; - } - - return dest; -} - -float ClampRotation -( - float rotation -) -{ - while(rotation >= 360) - rotation -= 360; - while(rotation < 0) - rotation += 360; - return rotation; -} - -int ClampInt -( - int num, - int min, - int max -) -{ - if(num < min) - num = min; - else if(num > max) - num = max; - return num; -} - -float * RotationToVector -( - V2f dest, - float rotation -) -{ - // Convert to radians. - ////////////////////// - rotation = (float)(rotation * PI_DIV_180); - - dest[0] = (float)sin(rotation); - dest[1] = (float)cos(rotation); - - return dest; -} - -float * ComputeNewPosition -( - V2f dest, - const V2f position, - int motion, - float rotation, - unsigned long diff, - int unitsPerSec, - GT2Bool clamp -) -{ - V2f forward; - float scale; - - // Check for no motion. - /////////////////////// - if(!motion) - { - CopyV2f(dest, position); - return dest; - } - - // Get the direction we're facing. - ////////////////////////////////// - RotationToVector(forward, rotation); - - // Scale it based on the amount of time. - //////////////////////////////////////// - scale = (float)(diff * unitsPerSec / 1000); - if(motion == BACKWARD) - scale = -scale; - ScaleV2f(forward, forward, scale); - - // Update the position. - /////////////////////// - AddV2f(dest, position, forward); - - // Clamp it. - //////////// - if(clamp) - ClampV2f(dest, dest, 0, MAP_MAX); - - return dest; -} - -float ComputeNewRotation -( - float rotation, - int turning, - unsigned long diff, - float degreesPerMilliSec -) -{ - // Turn. - //////// - rotation += (turning * (diff * degreesPerMilliSec)); - - // Clamp it to between 0 and 360. - ///////////////////////////////// - while(rotation >= 360) - rotation -= 360; - while(rotation < 0) - rotation += 360; - - return rotation; -} - -float RandomFloat -( - float minFloat, - float maxFloat, - GT2Bool maxInclusive -) -{ - float num; - - num = rand(); - num *= (maxFloat - minFloat); - num /= (RAND_MAX + (maxInclusive?0:1)); - num += minFloat; - - return num; -} - -int RandomInt -( - int minInt, - int maxInt -) -{ - return (minInt + ((rand() * (maxInt - minInt + 1)) / (RAND_MAX + 1))); -} - -unsigned short RotationToUnsignedShort -( - float rotation -) -{ - rotation *= 0xFFFF; - rotation /= 360; - if(rotation < 0) - rotation = 0; - if(rotation > 0xFFFF) - rotation = 0xFFFF; - - return (unsigned short)rotation; -} - -float UnsignedShortToRotation -( - unsigned short packedRotation -) -{ - float rotation; - - rotation = packedRotation; - rotation *= 360; - rotation /= 0xFFFF; - - return ClampRotation(rotation); -} - -unsigned short PositionToUnsignedShort -( - float position -) -{ - position += (MAP_EXTRA / 2); - position *= 0xFFFF; - position /= (MAP_MAX + MAP_EXTRA); - if(position < 0) - position = 0; - else if(position > USHRT_MAX) - position = USHRT_MAX; - - return (unsigned short)position; -} - -float UnsignedShortToPosition -( - unsigned short packedPosition -) -{ - float position; - - position = packedPosition; - position *= (MAP_MAX + MAP_EXTRA); - position /= 0xFFFF; - position -= (MAP_EXTRA / 2); - - return position; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMath.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMath.h deleted file mode 100644 index 04e0a3fb82a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aMath.h +++ /dev/null @@ -1,161 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2AMATH_H_ -#define _GT2AMATH_H_ - -#include -#include "gt2aMain.h" - -byte * CopyV3b -( - V3b dest, - const V3b src -); - -byte * SetV3b -( - V3b dest, - byte src0, - byte src1, - byte src2 -); - -float * CopyV2f -( - V2f dest, - const V2f src -); - -float * SetV2f -( - V2f dest, - float src0, - float src1 -); - -float * ScaleV2f -( - V2f dest, - const V2f src, - float scale -); - -float * AddV2f -( - V2f dest, - const V2f src0, - const V2f src1 -); - -float * SubV2f -( - V2f dest, - const V2f src0, - const V2f src1 -); - -float * SubScalarV2f -( - V2f dest, - const V2f src, - float scalar -); - -float LenV2f -( - const V2f src -); - -float DistanceV2f -( - const V2f src0, - const V2f src1 -); - -float * ClampV2f -( - V2f dest, - const V2f src, - float min, - float max -); - -float ClampRotation -( - float rotation -); - -int ClampInt -( - int num, - int min, - int max -); - -float * RotationToVector -( - V2f dest, - float rotation -); - -float * ComputeNewPosition -( - V2f dest, - const V2f position, - int motion, - float rotation, - unsigned long diff, - int unitsPerMilliSec, - GT2Bool clamp -); - -float ComputeNewRotation -( - float rotation, - int turning, - unsigned long diff, - float degreesPerMilliSec -); - -float RandomFloat -( - float minFloat, - float maxFloat, - GT2Bool maxInclusive -); - -int RandomInt -( - int minInt, - int maxInt -); - -unsigned short RotationToUnsignedShort -( - float rotation -); - -float UnsignedShortToRotation -( - unsigned short packedRotation -); - -unsigned short PositionToUnsignedShort -( - float position -); - -float UnsignedShortToPosition -( - unsigned short packedPosition -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aParse.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aParse.c deleted file mode 100644 index 472ade22d0f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aParse.c +++ /dev/null @@ -1,79 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include -#include "gt2aParse.h" - -static char buffer[256]; - -static char * StripKeyValue -( - char * input -) -{ - int i; - int c; - - // Get the key. - /////////////// - for(i = 0 ; i < (sizeof(buffer) - 1) ; i++) - { - c = *input++; - if((c == '\\') || (c == '\0')) - break; - buffer[i] = (char)c; - } - buffer[i] = '\0'; - - return buffer; -} - -char * ParseKeyValue -( - char * input, - const char * key -) -{ - char * str; - int len; - - if(!input) - return NULL; - - // Are we looking for the first key? - //////////////////////////////////// - if(!key) - { - // Does it start with a '\'? - //////////////////////////// - if(*input++ != '\\') - return NULL; - - // Get the key. - /////////////// - return StripKeyValue(input); - } - - // Find the key. - //////////////// - buffer[0] = '\\'; - len = strlen(key); - memcpy(buffer + 1, key, len); - buffer[++len] = '\\'; - buffer[++len] = '\0'; - str = strstr(input, buffer); - if(!str) - return NULL; - str += strlen(buffer); - - // Get the key. - /////////////// - return StripKeyValue(str); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aParse.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aParse.h deleted file mode 100644 index 9ae3b12a9a2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aParse.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2APARSE_H_ -#define _GT2APARSE_H_ - -// Search the input for "\key\". -// Returns the value following the key, -// or NULL if the key wasn't found. -// If key is NULL, returns the first key -// in input, or NULL if there's an error. -///////////////////////////////////////// -char * ParseKeyValue -( - char * input, - const char * key -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aServer.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aServer.c deleted file mode 100644 index e0b2eff87fb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aServer.c +++ /dev/null @@ -1,746 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include "gt2aMain.h" -#include "gt2aServer.h" -#include "gt2aParse.h" -#include "gt2aMath.h" -#include "gt2aSound.h" -#include "gt2aLogic.h" - -#define SERVER_THINK_TIME 30 - -static GT2Socket Socket; -Client clients[MAX_CLIENTS]; -static int numClients; -static GT2ConnectionCallbacks connectionCallbacks; -static unsigned short nextServerUpdateID; - -static void Broadcast -( - const char * message, - int len, - int exceptIndex, - GT2Bool reliable -) -{ - int i; - - for(i = 0 ; i < MAX_CLIENTS ; i++) - if(clients[i].used && (i != exceptIndex)) - gt2Send(clients[i].connection, (const GT2Byte *)message, len, reliable); -} - -void BroadcastText -( - const char * message, - int exceptIndex, - GT2Bool reliable -) -{ - static char messageCopy[CHAT_MAX]; - static char buffer[256]; - char * slash; - int rcode; - - // Copy off the chat message. - ///////////////////////////// - strncpy(messageCopy, message, CHAT_MAX); - messageCopy[CHAT_MAX - 1] = '\0'; - - // Because of the way gt2a is sending messages - // we need to change \ to /. - ////////////////////////////////////////////// - while(slash = strchr(messageCopy, '\\')) - *slash = '/'; - - // Encode the message. - ////////////////////// - rcode = gtEncode(MSG_S_CHAT, MSG_S_CHAT_STR, buffer, sizeof(buffer), - messageCopy); - if(rcode != -1) - { - // Send this chat message out to everyone. - ////////////////////////////////////////// - Broadcast(buffer, rcode, -1, reliable); - } -} - -static int AddClient -( - void -) -{ - int i; - - // Find an open slot. - ///////////////////// - for(i = 0 ; i < MAX_CLIENTS ; i++) - if(!clients[i].used) - break; - - // Nothing open? - //////////////// - if(i == MAX_CLIENTS) - return -1; - - // Clear it. - //////////// - memset(&clients[i], 0, sizeof(Client)); - clients[i].index = i; - clients[i].used = GT2True; - - // One more client. - /////////////////// - numClients++; - assert(numClients <= MAX_CLIENTS); - - return i; -} - -static void RemoveClient -( - int clientIndex -) -{ - // Not in use anymore. - ////////////////////// - clients[clientIndex].used = GT2False; - - // One less client. - /////////////////// - numClients--; - assert(numClients >= 0); -} - -static void SendAddClient -( - int sendClientIndex, - int newClientIndex -) -{ - char buffer[256]; - Client * sendClient; - Client * newClient; - int rcode; - - assert((sendClientIndex >= 0) && (sendClientIndex < MAX_CLIENTS)); - sendClient = &clients[sendClientIndex]; - assert(sendClient->used); - assert(sendClient->connection); - - assert((newClientIndex >= 0) && (newClientIndex < MAX_CLIENTS)); - newClient = &clients[newClientIndex]; - assert(newClient->used); - assert(newClient->connection); - - // Encode the message. - ///////////////////// - rcode = gtEncode(MSG_S_ADDCLIENT, MSG_S_ADDCLIENT_STR, buffer, sizeof(buffer), - newClientIndex, - newClient->nick); - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(sendClient->connection, (const GT2Byte *)buffer, rcode, GT2True); - } -} - -static void SendDelClient -( - int sendClient, - int delClient -) -{ - char buffer[32]; - int rcode; - - assert((sendClient >= 0) && (sendClient < MAX_CLIENTS)); - assert(clients[sendClient].used); - assert(clients[sendClient].connection); - assert((delClient >= 0) && (delClient < MAX_CLIENTS)); - - // Encode the message. - ///////////////////// - rcode = gtEncode(MSG_S_DELCLIENT, MSG_S_DELCLIENT_STR, buffer, sizeof(buffer), - delClient); - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(clients[sendClient].connection, (const GT2Byte *)buffer, rcode, GT2True); - } -} - -static void SendStart -( - int sendClient -) -{ - char buffer[32]; - int rcode; - - assert((sendClient >= 0) && (sendClient < MAX_CLIENTS)); - assert(clients[sendClient].used); - assert(clients[sendClient].connection); - - // Encode the message. - ///////////////////// - rcode = gtEncode(MSG_S_START, MSG_S_START_STR, buffer, sizeof(buffer), - sendClient); - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(clients[sendClient].connection, (const GT2Byte *)buffer, rcode, GT2True); - } -} - -void SendSound -( - int sound, - int sendClient -) -{ - char buffer[32]; - int rcode; - - assert(sendClient >= -1); - assert(sendClient < MAX_CLIENTS); -#ifdef _DEBUG - if(sendClient != -1) - { - assert(clients[sendClient].used); - assert(clients[sendClient].connection); - } -#endif - - // Encode the message. - ///////////////////// - rcode = gtEncode(MSG_S_SOUND, MSG_S_SOUND_STR, buffer, sizeof(buffer), - sound); - if(rcode != -1) - { - // Send the message. - //////////////////// - if(sendClient == -1) - Broadcast(buffer, rcode, -1, GT2False); - else - gt2Send(clients[sendClient].connection, (const GT2Byte *)buffer, rcode, GT2False); - } -} - -void SendNumAsteroids -( - int total, - int sendClient -) -{ - char buffer[32]; - int rcode; - - assert(sendClient >= -1); - assert(sendClient < MAX_CLIENTS); - assert(clients[sendClient].used); - assert(clients[sendClient].connection); - assert(total >= 0); - assert(total <= PLAYER_MAX_ASTEROIDS); - - // Encode the message. - ///////////////////// - rcode = gtEncode(MSG_S_NUMASTEROIDS, MSG_S_NUMASTEROIDS_STR, buffer, sizeof(buffer), - (byte)total);; - if(rcode != -1) - { - // Send the message. - //////////////////// - gt2Send(clients[sendClient].connection, (const GT2Byte *)buffer, rcode, GT2True); - } -} - -static void SendUpdates -( - void -) -{ - int i; - char * buffer; - int len; - static char update[1024 * 8]; - Client * client; - SObject * object; - unsigned long now; - int rcode; - - // Get the current time. - //////////////////////// - now = current_time(); - - // Setup the encoding parameters. - ///////////////////////////////// - buffer = update; - len = sizeof(update); - - // First encode the header. - /////////////////////////// - rcode = gtEncode(MSG_S_UPDATE, MSG_S_UPDATE_STR, buffer, len, - nextServerUpdateID++, - numClients, - numObjects); - if(rcode == -1) - return; - buffer += rcode; - len -= rcode; - - // Encode each client. - ////////////////////// - for(i = 0 ; i < MAX_CLIENTS ; i++) - { - if(clients[i].used) - { - client = &clients[i]; - - rcode = gtEncodeNoType(MSG_S_UPDATE_CLIENT_STR, buffer, len, - i, - PositionToUnsignedShort(client->position[0]), - PositionToUnsignedShort(client->position[1]), - RotationToUnsignedShort(client->rotation), - client->score, - client->motion == FORWARD ? 1 : 0, - client->motion == BACKWARD ? 1 : 0, - client->turning == RIGHT ? 1 : 0, - client->turning == LEFT ? 1 : 0, - client->dead); - if(rcode == -1) - return; - buffer += rcode; - len -= rcode; - } - } - - // Encode each object. - ////////////////////// - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - if(sObjects[i].used) - { - object = &sObjects[i]; - - rcode = gtEncodeNoType(MSG_S_UPDATE_OBJECT_STR, buffer, len, - object->type, - PositionToUnsignedShort(object->position[0]), - PositionToUnsignedShort(object->position[1]), - RotationToUnsignedShort(object->rotation), - (now - object->startTime)); - if(rcode == -1) - return; - buffer += rcode; - len -= rcode; - } - } - - // Send the update. - /////////////////// - Broadcast(update, sizeof(update) - len, -1, GT2False); -} - -static void ServerReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - int clientIndex; - Client * client; - GTMessageType type; - int rcode; - - // Check for no message. - //////////////////////// - if(!message) - return; - - // Which client was this? - ///////////////////////// - clientIndex = (int)gt2GetConnectionData(connection); - assert((clientIndex >= 0) && (clientIndex < MAX_CLIENTS)); - if((clientIndex < 0) || (clientIndex >= MAX_CLIENTS)) - return; - assert(clients[clientIndex].used); - if(!clients[clientIndex].used) - return; - client = &clients[clientIndex]; - - // Get the message type. - //////////////////////// - type = gtEncodedMessageType((char *)message); - - // Update? - ////////// - if(type == MSG_C_UPDATE) - { - unsigned short updateID; - unsigned long now; - byte forward; - byte backward; - byte right; - byte left; - unsigned short packedRotation; - - // Get the time we received it. - /////////////////////////////// - now = current_time(); - - // Decode it. - ///////////// - rcode = gtDecode(MSG_C_UPDATE_STR, (char *)message, len, - &updateID, - &packedRotation, - &forward, - &backward, - &right, - &left); - if(rcode == -1) - return; - - // Set the rotation. - //////////////////// - client->rotation = UnsignedShortToRotation(packedRotation); - - // Interpret the motion & turning bits. - /////////////////////////////////////// - if(forward) - client->motion = FORWARD; - else if(backward) - client->motion = BACKWARD; - else - client->motion = STILL; - if(right) - client->turning = RIGHT; - else if(left) - client->turning = LEFT; - else - client->turning = STILL; - - // Check if we should move the client. - ////////////////////////////////////// - if(client->lastUpdate && !client->dead && client->motion) - { - unsigned long diff; - - // Get how long since the last update. - ////////////////////////////////////// - diff = (now - client->lastUpdate); - - // Compute the new position. - //////////////////////////// - ComputeNewPosition( - client->position, - client->position, - client->motion, - client->rotation, - diff, - PLAYER_SPEED, - GT2True); - } - - // Set the last update time. - //////////////////////////// - client->lastUpdate = now; - } - // Press? - ///////// - else if(type == MSG_C_PRESS) - { - unsigned long now; - char press[64]; - - // A dead client can't fire. - //////////////////////////// - if(client->dead) - return; - - // Get the current time. - //////////////////////// - now = current_time(); - - // Is this too soon? - //////////////////// - if((now - client->lastPress) < PRESS_TIME) - return; - - // Decode it. - ///////////// - rcode = gtDecode(MSG_C_PRESS_STR, (char *)message, len, - press); - if(rcode == -1) - return; - - // The last press. - ////////////////// - client->lastPress = now; - - // Do the press. - //////////////// - ClientPress(clientIndex, press); - } - // Chat? - //////// - else if(type == MSG_C_CHAT) - { - char buffer[MAX_NICK + CHAT_MAX + 16]; - - // Start forming the outgoing chat message. - /////////////////////////////////////////// - sprintf(buffer, "%s: ", client->nick); - - // Decode the incoming message. - /////////////////////////////// - rcode = gtDecode(MSG_C_CHAT_STR, (char *)message, len, - buffer + strlen(buffer)); - if(rcode == -1) - return; - - // Send this chat message out to everyone. - ////////////////////////////////////////// - BroadcastText(buffer, -1, GT2True); - } -} - -static void ServerClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - int clientIndex; - int i; - SObject * object; - - // Which client was this? - ///////////////////////// - clientIndex = (int)gt2GetConnectionData(connection); - assert((clientIndex >= 0) && (clientIndex < MAX_CLIENTS)); - if((clientIndex < 0) || (clientIndex >= MAX_CLIENTS)) - return; - assert(clients[clientIndex].used); - if(!clients[clientIndex].used) - return; - - // Remove this client. - ////////////////////// - RemoveClient(clientIndex); - - // Send the remove client message. - ////////////////////////////////// - for(i = 0 ; i < MAX_CLIENTS ; i++) - if(clients[i].used) - SendDelClient(i, clientIndex); - - // Mark all owned objects as not owned. - /////////////////////////////////////// - for(i = 0 ; i < MAX_OBJECTS ; i++) - { - object = &sObjects[i]; - if(object->used && (object->owner == clientIndex)) - object->owner = -1; - } -} - -static void ServerConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -) -{ - int newClientIndex; - Client * newClient; - int i; - char nick[MAX_NICK]; - int rcode; - - // Make sure we got a message. - ////////////////////////////// - if(!message) - { - gt2Reject(connection, (const GT2Byte *)"No initial data received", -1); - return; - } - - // Check the message type. - ////////////////////////// - if(gtEncodedMessageType((char *)message) != MSG_C_INITIAL) - { - gt2Reject(connection, (const GT2Byte *)"Bad message type", -1); - return; - } - - // Decode the data. - /////////////////// - rcode = gtDecode(MSG_C_INITIAL_STR, (char *)message, len, - nick); - if(rcode == -1) - { - gt2Reject(connection, (const GT2Byte *)"Bad message data", -1); - return; - } - - // Add the client to the list. - ////////////////////////////// - newClientIndex = AddClient(); - if(newClientIndex == -1) - { - gt2Reject(connection, (const GT2Byte *)"Server full", -1); - return; - } - newClient = &clients[newClientIndex]; - - // Accept the connection. - ///////////////////////// - if(!gt2Accept(connection, &connectionCallbacks)) - { - // Remove the client. - ///////////////////// - RemoveClient(newClientIndex); - return; - } - - // Set the connection's data to its index. - ////////////////////////////////////////// - gt2SetConnectionData(connection, (void *)newClientIndex); - - // Set some properties for the new client. - ////////////////////////////////////////// - newClient->connection = connection; - strncpy(newClient->nick, nick, MAX_NICK); - newClient->nick[MAX_NICK - 1] = '\0'; - - // Spawn the client. - //////////////////// - ClientSpawn(newClient); - - // Send new client message for the clients already connected. - // Also send new client messages for new client to other clients. - ///////////////////////////////////////////////////////////////// - for(i = 0 ; i < MAX_CLIENTS ; i++) - { - if(clients[i].used) - { - SendAddClient(i, newClientIndex); - if(i != newClientIndex) - SendAddClient(newClientIndex, i); - } - } - - // It has no asteroids. - /////////////////////// - SendNumAsteroids(0, newClientIndex); - - // Tell the new client it can start. - //////////////////////////////////// - SendStart(newClientIndex); -} - -static void ServerSocketErrorCallback -( - GT2Socket socket -) -{ - printf("Server socket error\n"); -} - -GT2Bool InitializeServer -( - void -) -{ - GT2Result result; - int i; - - // Setup callback structs. - ////////////////////////// - memset(&connectionCallbacks, 0, sizeof(GT2ConnectionCallbacks)); - connectionCallbacks.received = ServerReceivedCallback; - connectionCallbacks.closed = ServerClosedCallback; - - // Set client indices. - ////////////////////// - for(i = 0 ; i < MAX_CLIENTS ; i++) - clients[i].index = i; - - // Create the socket. - ///////////////////// - result = gt2CreateSocket(&Socket, PORT_STRING, 0, 0, ServerSocketErrorCallback); - if(result != GT2Success) - return GT2False; - - // Listen. - ////////// - gt2Listen(Socket, ServerConnectAttemptCallback); - - // Initialize the logic. - //////////////////////// - InitializeLogic(); - - return GT2True; -} - -void ServerThink -( - unsigned long now -) -{ - static GT2Bool firstTime = GT2True; - static unsigned long last; - unsigned long diff; - - // Think. - ///////// - gt2Think(Socket); - - // The first time through just store the time. - // This is so diff is accurate the second time through. - /////////////////////////////////////////////////////// - if(firstTime) - { - firstTime = GT2False; - last = now; - return; - } - - // How long since the last update? - ////////////////////////////////// - diff = (now - last); - - // Check for an update. - /////////////////////// - if(diff < SERVER_THINK_TIME) - return; - - // New last update. - /////////////////// - last = now; - - // Process objects. - /////////////////// - ObjectsThink(now, diff); - - // Send updates. - //////////////// - SendUpdates(); -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aServer.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aServer.h deleted file mode 100644 index d02b7a0cd20..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aServer.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2ASERVER_H_ -#define _GT2ASERVER_H_ - -#define MAX_CLIENTS MAX_PLAYERS - -typedef struct Client -{ - GT2Bool used; // If this slot is in use or not. - int index; // This client's clientIndex. - GT2Connection connection; // The GT2Connection for this client. - V2f position; // The current position (0 <= x,y < MAP_MAX). - float rotation; // Client's view angle (0 <= rotation < 360). - int motion; // Client's current motion (STILL, FORWARD, BACKWARD). - int turning; // Client's current turning direction (STILL, LEFT, RIGHT). - unsigned long lastUpdate; // Last update received from this client. - char nick[MAX_NICK]; // The client's nick. - int score; // The client's score. - GT2Bool dead; // True if this client was killed and not respawned. - unsigned long spawnTime; // If dead, spawn at this time. - unsigned long lastPress; // When the last press event was received. - int numAsteroids; // The number of asteroids being held by this player. -} Client; - -extern Client clients[MAX_CLIENTS]; - -GT2Bool InitializeServer -( - void -); - -void ServerThink -( - unsigned long now -); - -void SendSound -( - int sound, - int sendClient -); - -void SendNumAsteroids -( - int total, - int sendClient -); - -void BroadcastText -( - const char * message, - int exceptIndex, - GT2Bool reliable -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aSound.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aSound.c deleted file mode 100644 index 8a68fbceece..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aSound.c +++ /dev/null @@ -1,543 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#include -#include -#include "gt2aMain.h" -#include "gt2aSound.h" -#include "gt2aMath.h" -#include "../../darray.h" - -#define MAX_DUPLICATES 8 - -static GT2Bool playSounds; -static LPDIRECTSOUND DirectSound; -static DArray SoundList; - -typedef struct SoundEffect -{ - LPDIRECTSOUNDBUFFER SoundBuffers[MAX_DUPLICATES]; - int numDuplicates; -} SoundEffect; - -// The order of this list must match up with the order -// of the SOUND_* enums in gt2aSound.h -////////////////////////////////////////////////////// -const char * soundFiles[] = -{ - "sounds\\explosion.wav", - "sounds\\mine.wav", - "sounds\\die.wav", - "sounds\\rocket.wav", - "sounds\\pickup.wav", - NULL -}; - -// Adapted from a Microsoft DirectSound sample. -/////////////////////////////////////////////// -static HRESULT ReadMMIO -( - HMMIO hmmioIn, - MMCKINFO * pckInRIFF, - WAVEFORMATEX ** ppwfxInfo -) -{ - MMCKINFO ckIn; // chunk info. for general use. - PCMWAVEFORMAT pcmWaveFormat; // Temp PCM structure to load in. - - *ppwfxInfo = NULL; - - if( ( 0 != mmioDescend( hmmioIn, pckInRIFF, NULL, 0 ) ) ) - return E_FAIL; - - if( (pckInRIFF->ckid != FOURCC_RIFF) || - (pckInRIFF->fccType != mmioFOURCC('W', 'A', 'V', 'E') ) ) - return E_FAIL; - - // Search the input file for for the 'fmt ' chunk. - ckIn.ckid = mmioFOURCC('f', 'm', 't', ' '); - if( 0 != mmioDescend(hmmioIn, &ckIn, pckInRIFF, MMIO_FINDCHUNK) ) - return E_FAIL; - - // Expect the 'fmt' chunk to be at least as large as ; - // if there are extra parameters at the end, we'll ignore them - if( ckIn.cksize < (LONG) sizeof(PCMWAVEFORMAT) ) - return E_FAIL; - - // Read the 'fmt ' chunk into . - if( mmioRead( hmmioIn, (HPSTR) &pcmWaveFormat, - sizeof(pcmWaveFormat)) != sizeof(pcmWaveFormat) ) - return E_FAIL; - - // Allocate the waveformatex, but if its not pcm format, read the next - // word, and thats how many extra bytes to allocate. - if( pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM ) - { - if( NULL == ( *ppwfxInfo = (WAVEFORMATEX *)malloc(sizeof(WAVEFORMATEX)))) - return E_FAIL; - - // Copy the bytes from the pcm structure to the waveformatex structure - memcpy( *ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat) ); - (*ppwfxInfo)->cbSize = 0; - } - else - { - // Read in length of extra bytes. - WORD cbExtraBytes = 0L; - if( mmioRead( hmmioIn, (CHAR*)&cbExtraBytes, sizeof(WORD)) != sizeof(WORD) ) - return E_FAIL; - - *ppwfxInfo = (WAVEFORMATEX*)malloc(sizeof(WAVEFORMATEX) + cbExtraBytes); - if( NULL == *ppwfxInfo ) - return E_FAIL; - - // Copy the bytes from the pcm structure to the waveformatex structure - memcpy( *ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat) ); - (*ppwfxInfo)->cbSize = cbExtraBytes; - - // Now, read those extra bytes into the structure, if cbExtraAlloc != 0. - if( mmioRead( hmmioIn, (CHAR*)(((BYTE*)&((*ppwfxInfo)->cbSize))+sizeof(WORD)), - cbExtraBytes ) != cbExtraBytes ) - { - free(*ppwfxInfo); - *ppwfxInfo = NULL; - return E_FAIL; - } - } - - // Ascend the input file out of the 'fmt ' chunk. - if( 0 != mmioAscend( hmmioIn, &ckIn, 0 ) ) - { - free(*ppwfxInfo); - *ppwfxInfo = NULL; - return E_FAIL; - } - - return S_OK; -} - -// Adapted from a Microsoft DirectSound sample. -/////////////////////////////////////////////// -static HRESULT WaveOpenFile -( - CHAR * strFileName, - HMMIO * phmmioIn, - WAVEFORMATEX ** ppwfxInfo, - MMCKINFO * pckInRIFF -) -{ - HRESULT hr; - HMMIO hmmioIn = NULL; - - if( NULL == ( hmmioIn = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF|MMIO_READ ) ) ) - return E_FAIL; - - if( FAILED( hr = ReadMMIO( hmmioIn, pckInRIFF, ppwfxInfo ) ) ) - { - mmioClose( hmmioIn, 0 ); - return hr; - } - - *phmmioIn = hmmioIn; - - return S_OK; -} - -// Adapted from a Microsoft DirectSound sample. -/////////////////////////////////////////////// -static HRESULT WaveStartDataRead -( - HMMIO * phmmioIn, - MMCKINFO * pckIn, - MMCKINFO * pckInRIFF -) -{ - // Seek to the data - if( -1 == mmioSeek( *phmmioIn, pckInRIFF->dwDataOffset + sizeof(FOURCC), - SEEK_SET ) ) - return E_FAIL; - - // Search the input file for for the 'data' chunk. - pckIn->ckid = mmioFOURCC('d', 'a', 't', 'a'); - if( 0 != mmioDescend( *phmmioIn, pckIn, pckInRIFF, MMIO_FINDCHUNK ) ) - return E_FAIL; - - return S_OK; -} - -// Adapted from a Microsoft DirectSound sample. -/////////////////////////////////////////////// -static HRESULT WaveReadFile -( - HMMIO hmmioIn, - UINT cbRead, - BYTE * pbDest, - MMCKINFO * pckIn, - UINT * cbActualRead -) -{ - MMIOINFO mmioinfoIn; // current status of - UINT cbDataIn; - DWORD cT; - - *cbActualRead = 0; - - if( 0 != mmioGetInfo( hmmioIn, &mmioinfoIn, 0 ) ) - return E_FAIL; - - cbDataIn = cbRead; - if( cbDataIn > pckIn->cksize ) - cbDataIn = pckIn->cksize; - - pckIn->cksize -= cbDataIn; - - for(cT = 0; cT < cbDataIn; cT++ ) - { - // Copy the bytes from the io to the buffer. - if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead ) - { - if( 0 != mmioAdvance( hmmioIn, &mmioinfoIn, MMIO_READ ) ) - return E_FAIL; - - if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead ) - return E_FAIL; - } - - // Actual copy. - *((BYTE*)pbDest+cT) = *((BYTE*)mmioinfoIn.pchNext); - mmioinfoIn.pchNext++; - } - - if( 0 != mmioSetInfo( hmmioIn, &mmioinfoIn, 0 ) ) - return E_FAIL; - - *cbActualRead = cbDataIn; - return S_OK; -} - -// If restoreBuffer is not NULL, restore it! -//////////////////////////////////////////// -static GT2Bool LoadSound -( - int sound, - const char * filename, - LPDIRECTSOUNDBUFFER restoreBuffer -) -{ - int rcode; - HRESULT result; - LPWAVEFORMATEX waveFormat; - HMMIO IOHandle; - MMCKINFO dataChunkInfo; - MMCKINFO parentChunkInfo; - DSBUFFERDESC bufferDescriptor; - SoundEffect soundEffect; - LPVOID lockedBuffer; - DWORD lockedBufferLen; - UINT numBytes; - LPDIRECTSOUNDBUFFER soundBuffer; - - // Open the file. - ///////////////// - rcode = WaveOpenFile((char *)filename, &IOHandle, &waveFormat, &parentChunkInfo); - if(rcode) - return GT2False; - - // Prepare to read the data chunk. - ////////////////////////////////// - rcode = WaveStartDataRead(&IOHandle, &dataChunkInfo, &parentChunkInfo); - if(rcode) - return GT2False; - - // If we're not restoring, create the buffer. - ///////////////////////////////////////////// - if(!restoreBuffer) - { - // Clear our sound object. - ////////////////////////// - memset(&soundEffect, 0, sizeof(SoundEffect)); - soundEffect.numDuplicates = 1; - - // Describe the desired buffer. - /////////////////////////////// - memset(&bufferDescriptor, 0, sizeof(DSBUFFERDESC)); - bufferDescriptor.dwSize = sizeof(DSBUFFERDESC); - bufferDescriptor.dwFlags = DSBCAPS_STATIC; - bufferDescriptor.dwBufferBytes = dataChunkInfo.cksize; - bufferDescriptor.lpwfxFormat = waveFormat; - - // Create the buffer. - ///////////////////// - result = IDirectSound_CreateSoundBuffer( - DirectSound, - &bufferDescriptor, - &soundEffect.SoundBuffers[0], - NULL); - if(FAILED(result)) - { - mmioClose(IOHandle, 0); - return GT2False; - } - - // Set the sound buffer pointer. - //////////////////////////////// - soundBuffer = soundEffect.SoundBuffers[0]; - } - else - { - // Set the sound buffer pointer. - //////////////////////////////// - soundBuffer = restoreBuffer; - } - - // Lock the buffer. - /////////////////// - result = IDirectSoundBuffer_Lock( - soundBuffer, - 0, - 0, - &lockedBuffer, - &lockedBufferLen, - NULL, - NULL, - DSBLOCK_ENTIREBUFFER); - if(FAILED(result)) - { - mmioClose(IOHandle, 0); - return GT2False; - } - - // Read the data into the buffer. - ///////////////////////////////// - rcode = WaveReadFile( - IOHandle, - lockedBufferLen, - (BYTE *)lockedBuffer, - &dataChunkInfo, - &numBytes); - if(rcode) - { - mmioClose(IOHandle, 0); - return GT2False; - } - - // Unlock the buffer. - ///////////////////// - IDirectSoundBuffer_Unlock( - soundBuffer, - lockedBuffer, - lockedBufferLen, - NULL, - 0); - - // Close the file. - ////////////////// - mmioClose(IOHandle, 0); - - // Add this sound to the list if its new. - ///////////////////////////////////////// - if(!restoreBuffer) - ArrayAppend(SoundList, &soundEffect); - - return GT2True; -} - -GT2Bool InitializeSound -( - void -) -{ - HRESULT result; - HWND hWnd; - int i; - - // Init the sound list. - /////////////////////// - SoundList = ArrayNew(sizeof(SoundEffect), 0, NULL); - if(!SoundList) - return GT2False; - - // Init direct sound. - ///////////////////// - result = DirectSoundCreate(NULL, &DirectSound, NULL); - if(FAILED(result)) - return GT2False; - - // Get the window handle. - ///////////////////////// - hWnd = GetForegroundWindow(); - if(!hWnd) - hWnd = GetDesktopWindow(); - - // Set the cooperative level. - ///////////////////////////// - result = IDirectSound_SetCooperativeLevel(DirectSound, hWnd, DSSCL_PRIORITY); - if(FAILED(result)) - return GT2False; - - // Load the sounds. - /////////////////// - for(i = 0 ; i < NUM_SOUNDS ; i++) - { - assert(soundFiles[i]); - if(!soundFiles[i]) - return GT2False; - LoadSound(i, soundFiles[i], NULL); - } - assert(!soundFiles[i]); - - // Turn on sound. - ///////////////// - playSounds = GT2True; - - return GT2True; -} - -void CleanupSound -( - void -) -{ - // Cleanup the sound list. - ////////////////////////// - ArrayFree(SoundList); - - // Cleanup DirectSound. - /////////////////////// - if(DirectSound) - { - IDirectSound_Release(DirectSound); - DirectSound = NULL; - } - - // COM crap. - //////////// - CoUninitialize(); -} - -void ToggleSound -( - void -) -{ - playSounds = !playSounds; -} - -void PlaySoundEffect -( - int sound -) -{ - SoundEffect * soundEffect; - HRESULT result; - DWORD status; - int i; - - // Make sure we're playing sounds. - ////////////////////////////////// - if(!playSounds) - return; - - // Get the correct sound. - ///////////////////////// - soundEffect = (SoundEffect *)ArrayNth(SoundList, sound); - assert(soundEffect); - if(!soundEffect) - return; - - // Find a free buffer. - ////////////////////// - for(i = 0 ; i < soundEffect->numDuplicates ; i++) - { - // Get the current status. - ////////////////////////// - result = IDirectSoundBuffer_GetStatus(soundEffect->SoundBuffers[i], &status); - if(FAILED(result)) - return; - - // Did it lose its buffer? - ////////////////////////// - if(status & DSBSTATUS_BUFFERLOST) - { - // Restore the buffer. - ////////////////////// - result = IDirectSoundBuffer_Restore(soundEffect->SoundBuffers[i]); - if(FAILED(result)) - continue; - - // Fill the sound data back in. - /////////////////////////////// - if(!LoadSound(sound, soundFiles[sound], soundEffect->SoundBuffers[i])) - continue; - } - - // Is it free? - ////////////// - if(!(status & DSBSTATUS_PLAYING)) - break; - } - - // Did we not find anything? - //////////////////////////// - if(i == soundEffect->numDuplicates) - { - // Are we at max duplicates? - //////////////////////////// - if(i == MAX_DUPLICATES) - { - // Just use a random buffer. - //////////////////////////// - i = RandomInt(0, MAX_DUPLICATES - 1); - } - else - { - // Make a new duplicate. - //////////////////////// - result = IDirectSound_DuplicateSoundBuffer( - DirectSound, - soundEffect->SoundBuffers[0], - &soundEffect->SoundBuffers[i]); - if(FAILED(result)) - return; - - // One more duplicate. - ////////////////////// - soundEffect->numDuplicates++; - } - } - - // Make sure the buffer is rewound. - /////////////////////////////////// - IDirectSoundBuffer_SetCurrentPosition(soundEffect->SoundBuffers[i], 0); - - // Play it. - /////////// - result = IDirectSoundBuffer_Play(soundEffect->SoundBuffers[i], 0, 0, 0); - - // Check for a lost buffer. - /////////////////////////// - if(result == DSERR_BUFFERLOST) - { - // Restore the buffer. - ////////////////////// - result = IDirectSoundBuffer_Restore(soundEffect->SoundBuffers[i]); - if(FAILED(result)) - return; - - // Fill the sound data back in. - /////////////////////////////// - if(!LoadSound(sound, soundFiles[sound], soundEffect->SoundBuffers[i])) - return; - - // Try playing again. - ///////////////////// - IDirectSoundBuffer_Play(soundEffect->SoundBuffers[i], 0, 0, 0); - } -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aSound.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aSound.h deleted file mode 100644 index f5d3ca6cc33..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2aSound.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -GameSpy GT2 SDK -GT2Action - sample app -Dan "Mr. Pants" Schoenblum -dan@gamespy.com - -Copyright 2000 GameSpy Industries, Inc - -*/ - -#ifndef _GT2ASOUND_H_ -#define _GT2ASOUND_H_ - -enum -{ - SOUND_EXPLOSION, - SOUND_MINE, - SOUND_DIE, - SOUND_ROCKET, - SOUND_PICKUP, - NUM_SOUNDS -}; - -GT2Bool InitializeSound -( - void -); - -void CleanupSound -( - void -); - -void ToggleSound -( - void -); - -void PlaySoundEffect -( - int sound -); - -#endif \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action.dsp deleted file mode 100644 index 74c5e35b5f5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action.dsp +++ /dev/null @@ -1,591 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2action" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gt2action - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2action.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2action.mak" CFG="gt2action - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2action - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2action - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2action", DQOCAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2action - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 dsound.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"gt2action.exe" /ignore:4089 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "gt2action - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 dsound.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"gt2action.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gt2action - Win32 Release" -# Name "gt2action - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2aClient.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aDisplay.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aInput.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aLogic.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aMain.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aMath.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aParse.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aServer.c -# End Source File -# Begin Source File - -SOURCE=.\gt2aSound.c -# End Source File -# Begin Source File - -SOURCE=.\TGAFile.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\gt2aClient.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aDisplay.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aInput.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aLogic.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aMain.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aMath.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aParse.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aServer.h -# End Source File -# Begin Source File - -SOURCE=.\gt2aSound.h -# End Source File -# Begin Source File - -SOURCE=.\TGAFile.h -# End Source File -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.h -# End Source File -# End Group -# Begin Group "HttpSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\ghttp\ghttp.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpASCII.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCallbacks.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCallbacks.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCommon.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpConnection.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpConnection.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpEncryption.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpEncryption.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpMain.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpMain.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpPost.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpPost.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpProcess.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpProcess.h -# End Source File -# End Group -# Begin Group "Images" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\images\asteroid0.tga -# End Source File -# Begin Source File - -SOURCE=.\images\asteroid1.tga -# End Source File -# Begin Source File - -SOURCE=.\images\asteroid2.tga -# End Source File -# Begin Source File - -SOURCE=.\images\explosion0.tga -# End Source File -# Begin Source File - -SOURCE=.\images\explosion1.tga -# End Source File -# Begin Source File - -SOURCE=.\images\mine0.tga -# End Source File -# Begin Source File - -SOURCE=.\images\mine1.tga -# End Source File -# Begin Source File - -SOURCE=.\images\mine2.tga -# End Source File -# Begin Source File - -SOURCE=.\images\rocket0.tga -# End Source File -# Begin Source File - -SOURCE=.\images\rocket1.tga -# End Source File -# Begin Source File - -SOURCE=.\images\rocket2.tga -# End Source File -# Begin Source File - -SOURCE=.\images\rocket3.tga -# End Source File -# Begin Source File - -SOURCE=.\images\ship0.tga -# End Source File -# Begin Source File - -SOURCE=.\images\ship1.tga -# End Source File -# Begin Source File - -SOURCE=.\images\space.tga -# End Source File -# Begin Source File - -SOURCE=.\images\spinner0.tga -# End Source File -# Begin Source File - -SOURCE=.\images\spinner1.tga -# End Source File -# Begin Source File - -SOURCE=.\images\spinner2.tga -# End Source File -# End Group -# Begin Group "Sounds" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\sounds\die.wav -# End Source File -# Begin Source File - -SOURCE=.\sounds\explosion.wav -# End Source File -# Begin Source File - -SOURCE=.\sounds\mine.wav -# End Source File -# Begin Source File - -SOURCE=.\sounds\pickup.wav -# End Source File -# Begin Source File - -SOURCE=.\sounds\rocket.wav -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# End Group -# Begin Source File - -SOURCE=.\messages.txt -# End Source File -# Begin Source File - -SOURCE=.\todo.txt -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action_vs2005.vcproj deleted file mode 100644 index 3c63e2c434f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action_vs2005.vcproj +++ /dev/null @@ -1,1259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/gt2action_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid0.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid0.tga deleted file mode 100644 index 4bb42e95e58..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid0.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid1.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid1.tga deleted file mode 100644 index f9a3dee83cf..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid1.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid2.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid2.tga deleted file mode 100644 index a3164341de5..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/asteroid2.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/explosion0.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/explosion0.tga deleted file mode 100644 index a47afbb690a..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/explosion0.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/explosion1.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/explosion1.tga deleted file mode 100644 index f857cd2e342..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/explosion1.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine0.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine0.tga deleted file mode 100644 index 62f0fc078ce..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine0.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine1.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine1.tga deleted file mode 100644 index ecde8f6b07c..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine1.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine2.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine2.tga deleted file mode 100644 index 3469a023fd0..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/mine2.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket0.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket0.tga deleted file mode 100644 index 3f29b44eabb..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket0.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket1.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket1.tga deleted file mode 100644 index 0c3841ac9af..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket1.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket2.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket2.tga deleted file mode 100644 index 835dc2ca2b8..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket2.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket3.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket3.tga deleted file mode 100644 index 65350bbb2ba..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/rocket3.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/ship0.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/ship0.tga deleted file mode 100644 index f8948dcf6c3..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/ship0.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/ship1.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/ship1.tga deleted file mode 100644 index 7581e35633a..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/ship1.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/space.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/space.tga deleted file mode 100644 index 9ae59d86578..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/space.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner0.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner0.tga deleted file mode 100644 index 50018bed0b2..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner0.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner1.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner1.tga deleted file mode 100644 index 424da03a9e6..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner1.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner2.tga b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner2.tga deleted file mode 100644 index 550b672b861..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/images/spinner2.tga and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/messages.txt b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/messages.txt deleted file mode 100644 index 5f1122aa5cd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/messages.txt +++ /dev/null @@ -1,49 +0,0 @@ -CLIENT-to-server messages: -=initial-data - byte[3] color - string nick -=update - unsigned short id - unsigned short packedRotation - bit forward - bit backward - bit right - bit left -=press - string button -=chat - string message - -SERVER-to-client messages: -=addclient - byte index - string nick -=delclient - byte index -=start - byte index -=update - unsigned short id - byte numclients - byte numobjects - for each client - byte index - unsigned short[2] packedPosition - unsigned short packedRotation - int score - bit forward - bit backward - bit right - bit left - bit dead - for each object - byte type - unsigned short[2] packedPosition - unsigned short packedRotation - int time -=chat - string message -=sound - byte index -=numasteroids - byte total diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/die.wav b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/die.wav deleted file mode 100644 index 68fcdda1e04..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/die.wav and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/explosion.wav b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/explosion.wav deleted file mode 100644 index d36b4a8d2d5..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/explosion.wav and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/mine.wav b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/mine.wav deleted file mode 100644 index ea0f6645ca7..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/mine.wav and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/pickup.wav b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/pickup.wav deleted file mode 100644 index a00a969f797..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/pickup.wav and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/rocket.wav b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/rocket.wav deleted file mode 100644 index dd3102fdb5c..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/sounds/rocket.wav and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/todo.txt b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/todo.txt deleted file mode 100644 index 56c11da22de..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2action/todo.txt +++ /dev/null @@ -1,23 +0,0 @@ -- add S->C event support ("\event\explosion\pos\280 640") -- save settings (nick, color, prediction, etc.) -- improve comments -- slow bouncy lasers -- map/walls -- safe spawns -- better feedback for dedicated server (not just "connecting") -- sound doesn't worked when launched from debugger but not debugging (Ctrl-F5) -- add bytes/sec to net graph -- write filter to analyze byte frequencies -- show message on server shutdown -- only send changed values for players/objects -- assert, darray.c, line 120 -- do prediction at start of frame, then use that for drawing and radar -- do adjustments based on when a server update should have arrived? -- second background moving at different speed? -- position smoothing causes weirdness when respawning -- cleaner menu setup system? -- random number and positions for spinner -- AddRocket, AddMine, etc. -- smarter server updates - - for each object, determine what values are dynamic - - pre-determine what values will be sent for each object-type diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig.c deleted file mode 100644 index 0b4e6cf4997..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig.c +++ /dev/null @@ -1,674 +0,0 @@ -/****** -gt2hostmig.c -GameSpy Transport 2 SDK -GameSpy Query & Reporting 2 SDK - -Copyright 2000 GameSpy Industries, Inc - -****** - - This sample demonstrates the use of the Transport 2 SDK to do host migration. - It also uses the Query & Reporting 2 SDK to report the host to the - Master Server. - - Please see the GameSpy Transport 2 SDK documentation for more - information - -******/ - - -/************* -** INCLUDES ** -*************/ -#include -#include "../gt2.h" -// Needed for the QR2 portion of code -#include "../../qr2/qr2.h" - -/************ -** DEFINES ** -************/ -#define PORT 12345 -#define MAX_CLIENTS 8 -#define TIMEOUT (30 * 1000) -#define SEND_TIME 500// (10 * 1000) - -#define REPORT - -/************ -** GLOBALS ** -************/ -GT2Bool hosting; -GT2Bool quit; -GT2ConnectionCallbacks connectionCallbacks; -char messageKey[128]; -char messageValue[128]; -unsigned int backupHost; -int backupHostIndex; -GT2Bool gotBackupHost; - -#ifdef REPORT -//////////////////////////////////////////////////// -//////////////////////////////////////////////////// -// Defines for QR2 -#define QR2_GAME_VERSION _T("2.00") -#define QR2_GAME_NAME _T("gmtest") -#define QR2_MAX_PLAYERS MAX_CLIENTS -#define QR2_BASE_PORT 11111 -#define QR2_HOSTNAME _T("My Host") -// end defines -#endif - -GT2Connection clients[MAX_CLIENTS]; -int numClients; - -/********************** -** UTILITY FUNCTIONS ** -**********************/ -GT2Bool ParseMessage -( - const char * message, - int len -) -{ - const char * keyStart; - const char * valueStart; - int copyLen; - int i; - - // Validate the message. - for(i = 0 ; i < (len - 1) ; i++) - { - if(!message[i]) - return GT2False; - } - if(message[i]) - return GT2False; - if(message[0] != '\\') - return GT2False; - - // Find the key/value starts. - keyStart = &message[1]; - valueStart = strchr(keyStart, '\\'); - if(!valueStart) - return GT2False; - valueStart++; - - // Copy in the key. - copyLen = (valueStart - keyStart - 1); - if(copyLen >= sizeof(messageKey)) - return GT2False; - memcpy(messageKey, keyStart, copyLen); - messageKey[copyLen] = '\0'; - - // Copy in the value. - if(strlen(valueStart) >= sizeof(messageValue)) - return GT2False; - strcpy(messageValue, valueStart); - - return GT2True; -} - -const char * GetConnectionName -( - GT2Connection connection -) -{ - return gt2AddressToString(gt2GetRemoteIP(connection), 0, NULL); -} - -void TellBackupHost -( - int index -) -{ - char buffer[32]; - GT2Connection connection = clients[index]; - - // Let him know who the backup host is. - sprintf(buffer, "\\backuphost\\%s", gt2AddressToString(backupHost, 0, NULL)); - gt2Send(connection, (const GT2Byte *)buffer, -1, GT2True); -} - -void NewBackupHost -( - int index -) -{ - int i; - GT2Connection connection = clients[index]; - - // Let him know. - gt2Send(connection, (const GT2Byte *)("\\backuphost\\"), -1, GT2True); - backupHost = gt2GetRemoteIP(connection); - backupHostIndex = index; - - // Let others know. - for(i = 0 ; i < MAX_CLIENTS ; i++) - { - if(clients[i] && (i != index)) - TellBackupHost(i); - } -} - -/****************** -** QR2 CALLBACKS ** -******************/ -#ifdef REPORT - -void server_key_callback(int keyid, qr2_buffer_t outbuf, void *userdata) -{ - switch (keyid) - { - case HOSTNAME_KEY: - qr2_buffer_add(outbuf, QR2_HOSTNAME); - break; - case GAMEVER_KEY: - qr2_buffer_add(outbuf, QR2_GAME_VERSION); - break; - case HOSTPORT_KEY: - qr2_buffer_add_int(outbuf, PORT); - break; - case NUMPLAYERS_KEY: - qr2_buffer_add_int(outbuf, numClients); - break; - case MAXPLAYERS_KEY: - qr2_buffer_add_int(outbuf, QR2_MAX_PLAYERS); - break; - - default: - qr2_buffer_add(outbuf, _T("")); - } - - GSI_UNUSED(userdata); -} - -// Called when a player key needs to be reported -void playerkey_callback(int keyid, int index, qr2_buffer_t outbuf, void *userdata) -{ - //check for valid index - if (index >= numClients) - { - qr2_buffer_add(outbuf, _T("")); - return; - } - switch (keyid) - { - case PLAYER__KEY: - qr2_buffer_add(outbuf, GetConnectionName(clients[index])); - break; - default: - qr2_buffer_add(outbuf, _T("")); - break; - } - - GSI_UNUSED(userdata); -} - -// Called when a team key needs to be reported -void teamkey_callback(int keyid, int index, qr2_buffer_t outbuf, void *userdata) -{ - qr2_buffer_add(outbuf, _T("")); - - GSI_UNUSED(userdata); - GSI_UNUSED(index); - GSI_UNUSED(keyid); -} - -// Called when we need to report the list of keys we report values for -void keylist_callback(qr2_key_type keytype, qr2_keybuffer_t keybuffer, void *userdata) -{ - //need to add all the keys we support - switch (keytype) - { - case key_server: - qr2_keybuffer_add(keybuffer, HOSTNAME_KEY); - qr2_keybuffer_add(keybuffer, GAMEVER_KEY); - qr2_keybuffer_add(keybuffer, HOSTPORT_KEY); - qr2_keybuffer_add(keybuffer, NUMPLAYERS_KEY); - qr2_keybuffer_add(keybuffer, MAXPLAYERS_KEY); - break; - case key_player: - qr2_keybuffer_add(keybuffer, PLAYER__KEY); - break; - // no team keys are added since there is no team play in this game - case key_team: - break; - } - - GSI_UNUSED(userdata); -} - -// Called when we need to report the number of players and teams -int count_callback(qr2_key_type keytype, void *userdata) -{ - if (keytype == key_player) - return numClients; - else if (keytype == key_team) - // 0 = Zero teams - return 0; - else - return 0; - - GSI_UNUSED(userdata); -} - -// Called if our registration with the GameSpy master server failed -void adderror_callback(qr2_error_t error, gsi_char *errmsg, void *userdata) -{ - _tprintf(_T("Error adding server: %d, %s\n"), error, errmsg); - - GSI_UNUSED(userdata); -} - -#endif - -/********************* -** SOCKET CALLBACKS ** -*********************/ -void ConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -) -{ - int i; - - // Do we have a spot open? - for(i = 0 ; i < MAX_CLIENTS ; i++) - { - if(!clients[i]) - break; - } - if(i == MAX_CLIENTS) - { - // Nothing open, reject. - gt2Reject(connection, (const GT2Byte *)("Server full"), -1); - printf("Rejected client, server full\n"); - return; - } - - // We have a spot. - if(!gt2Accept(connection, &connectionCallbacks)) - return; - - // Add him to the list. - clients[i] = connection; - numClients++; - - // Store the index in the connection data. - gt2SetConnectionData(connection, (void *)i); - - printf("Connection accepted from %s\n", GetConnectionName(connection)); - - // Is this the only client? - if(numClients == 1) - { - // He's the backup host. - NewBackupHost(i); - } - else - { - // Let him know who the backup host is. - TellBackupHost(i); - } - - GSI_UNUSED(len); - GSI_UNUSED(message); - GSI_UNUSED(latency); - GSI_UNUSED(port); - GSI_UNUSED(ip); - GSI_UNUSED(socket); -} - -void SocketErrorCallback -( - GT2Socket socket -) -{ - printf("socket error!\n"); - quit = GT2True; - - GSI_UNUSED(socket); -} - -/************************* -** CONNECTION CALLBACKS ** -*************************/ -void ConnectedCallback -( - GT2Connection connection, - GT2Result result, - GT2Byte * message, - int len -) -{ - if(result != GT2Success) - { - printf("Connection failed: "); - if(result == GT2OutOfMemory) - printf("OutOfMemory\n"); - else if(result == GT2Rejected) - printf("Rejected: %s\n", message); - else if(result == GT2NetworkError) - printf("NetworkError\n"); - else if(result == GT2AddressError) - printf("AddressError\n"); - else if(result == GT2DuplicateAddress) - printf("DuplicateAddress\n"); - else if(result == GT2TimedOut) - printf("TimedOut\n"); - else if(result == GT2NegotiationError) - printf("NegotiationError\n"); - else - printf("Unknown error\n"); - - quit = GT2True; - return; - } - - printf("Connection accepted\n"); - - GSI_UNUSED(len); - GSI_UNUSED(connection); -} - -void ReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - if(!ParseMessage((const char *)message, len)) - { - printf("Error parsing incoming message from %s\n", GetConnectionName(connection)); - return; - } - - // Check for quit. - if(strcasecmp(messageKey, "quit") == 0) - { - printf("Got remote quit: %s\n", messageValue); - quit = GT2True; - return; - } - - // Are we the host? - if(hosting) - { - // Check for echo. - if(strcasecmp(messageKey, "echo") == 0) - { - // Send back the same. - gt2Send(connection, message, len, reliable); - return; - } - } - else - { - // Check for echo reply. - if(strcasecmp(messageKey, "echo") == 0) - return; - - // Check for a backup-host. - if(strcasecmp(messageKey, "backuphost") == 0) - { - printf("New backup host: %s\n", messageValue); - - // Get the backup IP. - gt2StringToAddress(messageValue, &backupHost, NULL); - gotBackupHost = GT2True; - return; - } - } - - // This is an unknown message type. - printf("Unknown message key: %s = %s\n", messageKey, messageValue); -} - -void ClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - // Are we the host? - if(hosting) - { - int i; - - // Get the index. - i = (int)gt2GetConnectionData(connection); - - // Clear it from the list. - clients[i] = NULL; - numClients--; - - // Was this the backup host? - if(i == backupHostIndex) - { - // Pick a new backup host. - if(numClients) - { - for(i = 0 ; i < MAX_CLIENTS ; i++) - if(clients[i]) - { - NewBackupHost(i); - break; - } - } - } - - printf("Client connection with %s closed: %d\n", GetConnectionName(connection), reason); - } - else - { - printf("Connection closed\n"); - - // Quit out of here, we'll check for a backup host in main(). - quit = GT2True; - } -} - -/************** -** FUNCTIONS ** -**************/ -GT2Bool StartHosting -( - void -) -{ - qr2_error_t rcode; - GT2Socket socket; - GT2Result result; - - // Clear. - quit = GT2False; - hosting = GT2True; - numClients = 0; - memset(clients, 0, sizeof(GT2Connection) * MAX_CLIENTS); - - - // create the socket - result = gt2CreateSocket(&socket, gt2AddressToString(0, PORT, NULL), 0, 0, SocketErrorCallback); - if(result != GT2Success) - { - printf("Failed to create socket (%d)\n", result); - return GT2False; - } - - // start listening - printf("Starting to listen...\n"); - gt2Listen(socket, ConnectAttemptCallback); - -#ifdef REPORT - // Start reporting. - printf("Starting reporting...\n"); - - rcode = qr2_init(NULL, NULL, QR2_BASE_PORT, "gmtest", "HA6zkS", 1, 1, server_key_callback, playerkey_callback, - teamkey_callback, keylist_callback, count_callback, adderror_callback, NULL); - - if(rcode != e_qrnoerror) - return GT2False; -#endif - - // Think. - while(!quit) - { - gt2Think(socket); - -#ifdef REPORT - qr2_think(NULL); -#endif - msleep(10); - } - -#ifdef REPORT - qr2_shutdown(NULL); -#endif - - return GT2True; -} - -GT2Bool StartConnecting -( - const char * server -) -{ - GT2Connection connection; - GT2Socket socket; - GT2Result result; - char address[256]; - unsigned long lastSendTime = 0; - unsigned long now; - - // Clear. - quit = GT2False; - hosting = GT2False; - gotBackupHost = GT2False; - - // Setup the address with the port. - sprintf(address, "%s:%d", server, PORT); - - // create the socket - result = gt2CreateSocket(&socket, NULL, 0, 0, SocketErrorCallback); - if(result != GT2Success) - { - printf("Error creating the socket! (%d)\n", result); - return GT2False; - } - - // Connect to the host. - printf("Connecting to %s (timeout after %d seconds)...\n", address, TIMEOUT / 1000); - result = gt2Connect(socket, &connection, address, NULL, 0, TIMEOUT, &connectionCallbacks, GT2True); - if(result != GT2Success) - { - printf("Error creating the connection! (%d)\n", result); - return GT2False; - } - - // Think. - while(!quit) - { - // Check for sending a new message. - now = current_time(); - if((now - lastSendTime) > SEND_TIME) - { - // Send an echo message. - gt2Send(connection, (const GT2Byte *)("\\echo\\Hello."), -1, GT2False); - - // New last send time. - lastSendTime = now; - } - - // Think. - gt2Think(socket); - - // Yield. - msleep(10); - } - - return GT2True; -} - -int main -( - int argc, - char ** argv -) -{ - // Set the callbacks. - memset(&connectionCallbacks, 0, sizeof(GT2ConnectionCallbacks)); - connectionCallbacks.connected = ConnectedCallback; - connectionCallbacks.received = ReceivedCallback; - connectionCallbacks.closed = ClosedCallback; - - // Host if no args. - if(argc < 2) - { - if(!StartHosting()) - printf("Failed to start hosting\n"); - } - else - { - // Do the initial connect. - if(!StartConnecting(argv[1])) - { - printf("Failed to connect\n"); - } - else - { - // Do host migration stuff. - GT2Bool done = GT2False; - do - { - // Do we have a backup host? - if(gotBackupHost) - { - // Are we the backup host? - if(!backupHost) - { - printf("Starting up backup host...\n"); - - // Start hosting. - if(!StartHosting()) - { - printf("Failed to start backup host.\n"); - done = GT2True; - } - } - else - { - const char * address = gt2AddressToString(backupHost, 0, NULL); - - printf("Connecting to backup host %s...\n", address); - - // Start connecting to the new host. - if(!StartConnecting(address)) - { - printf("Failed to connect to backup host.\n"); - done = GT2True; - } - } - } - else - { - printf("No backup host, quitting\n"); - done = GT2True; - } - } - while(!done); - } - } - - getchar(); - - return 0; -} \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig.dsp deleted file mode 100644 index 53593d273f9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig.dsp +++ /dev/null @@ -1,312 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2hostmig" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gt2hostmig - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2hostmig.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2hostmig.mak" CFG="gt2hostmig - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2hostmig - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2hostmig - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2hostmig", AQOCAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2hostmig - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gt2hostmig - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gt2hostmig - Win32 Release" -# Name "gt2hostmig - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2hostmig.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.h -# End Source File -# End Group -# Begin Group "QueryReporting2SDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\qr2\qr2.c -# End Source File -# Begin Source File - -SOURCE=..\..\qr2\qr2.h -# End Source File -# Begin Source File - -SOURCE=..\..\qr2\qr2regkeys.c -# End Source File -# Begin Source File - -SOURCE=..\..\qr2\qr2regkeys.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# End Group -# Begin Group "NatNegSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\natneg\NATify.c -# End Source File -# Begin Source File - -SOURCE=..\..\natneg\natneg.c -# End Source File -# Begin Source File - -SOURCE=..\..\natneg\nninternal.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig_vs2005.vcproj deleted file mode 100644 index 47f3085c246..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig_vs2005.vcproj +++ /dev/null @@ -1,756 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2hostmig/gt2hostmig_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat.c deleted file mode 100644 index b5473537891..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat.c +++ /dev/null @@ -1,408 +0,0 @@ -/****** -gt2nat.c -GameSpy Transport 2 SDK - -Copyright 2000 GameSpy Industries, Inc - -****** - - This sample demonstrates sharing a UDP socket with the Query & Reporting 2 SDK - to enable developers to create games that can be hosted behind a NAT. - - Please see the GameSpy Query & Reporting 2 SDK documentation for more - information - -******/ - - -/******** -INCLUDES -********/ -#include "../gt2.h" -#include "../../qr2/qr2.h" - -#include -#include -#include - -#if defined(_WIN32) && !defined(UNDER_CE) -#include -#endif - -/******** -DEFINES -********/ -#define QR2_GAME_VERSION "2.00" -#define QR2_GAME_NAME "gmtest" -#define QR2_MAX_PLAYERS 32 -#define QR2_BASE_PORT 26900 -#define QR2_RANKINGSON_KEY 100 - -#ifdef _WIN32_WCE -void RetailOutputA(CHAR *tszErr, ...); -#define printf RetailOutputA -#endif - -/******** -TYPDEFS -********/ -//representative of a game player structure -typedef struct -{ - char pname[80]; - int pfrags; - int pdeaths; - int pskill; - int pping; - char pteam[80]; -} player_t; - -//representative of a game data structure -typedef struct -{ - player_t players[QR2_MAX_PLAYERS]; - char mapname[20]; - char hostname[120]; - char gamemode[200]; - char gametype[30]; - int locationid; - int numplayers; - int maxplayers; - int fraglimit; - int timelimit; - int teamplay; - int rankingson; - int hostport; -} gamedata_t; - -/******** -GLOBAL VARS -********/ - -//just to give us bogus data -char *constnames[QR2_MAX_PLAYERS]={"Joe Player","L33t 0n3","Raptor","Gr81","Flubber","Sarge","Void","runaway","Ph3ar","wh00t","gr1nder","Mace","stacy","lamby","Thrush"}; -gamedata_t gamedata; - -// Called when a server key needs to be reported -void serverkey_callback(int keyid, qr2_buffer_t outbuf, void *userdata) -{ - switch (keyid) - { - case HOSTNAME_KEY: - qr2_buffer_add(outbuf, gamedata.hostname); - break; - case GAMEVER_KEY: - qr2_buffer_add(outbuf, QR2_GAME_VERSION); - break; - case HOSTPORT_KEY: - qr2_buffer_add_int(outbuf, gamedata.hostport); - break; - case MAPNAME_KEY: - qr2_buffer_add(outbuf, gamedata.mapname); - break; - case GAMETYPE_KEY: - qr2_buffer_add(outbuf, gamedata.gametype); - break; - case NUMPLAYERS_KEY: - qr2_buffer_add_int(outbuf, gamedata.numplayers); - break; - case MAXPLAYERS_KEY: - qr2_buffer_add_int(outbuf, gamedata.maxplayers); - break; - case GAMEMODE_KEY: - qr2_buffer_add(outbuf, gamedata.gamemode); - break; - case TEAMPLAY_KEY: - qr2_buffer_add_int(outbuf, gamedata.teamplay); - break; - case FRAGLIMIT_KEY: - qr2_buffer_add_int(outbuf, gamedata.fraglimit); - break; - case TIMELIMIT_KEY: - qr2_buffer_add_int(outbuf, gamedata.timelimit); - break; - case QR2_RANKINGSON_KEY: - qr2_buffer_add_int(outbuf, gamedata.rankingson); - break; - default: - qr2_buffer_add(outbuf, _T("")); - } - - GSI_UNUSED(userdata); -} - -// Called when a player key needs to be reported -void playerkey_callback(int keyid, int index, qr2_buffer_t outbuf, void *userdata) -{ - //check for valid index - if (index >= gamedata.numplayers) - { - qr2_buffer_add(outbuf, _T("")); - return; - } - switch (keyid) - { - case PLAYER__KEY: - qr2_buffer_add(outbuf, gamedata.players[index].pname); - break; - case SKILL__KEY: - qr2_buffer_add_int(outbuf, gamedata.players[index].pskill); - break; - case SCORE__KEY: - qr2_buffer_add_int(outbuf, gamedata.players[index].pfrags); - break; - case DEATHS__KEY: - qr2_buffer_add_int(outbuf, gamedata.players[index].pdeaths); - break; - case PING__KEY: - qr2_buffer_add_int(outbuf, gamedata.players[index].pping); - break; - case TEAM__KEY: - qr2_buffer_add(outbuf, gamedata.players[index].pteam); - break; - default: - qr2_buffer_add(outbuf, _T("")); - break; - } - - GSI_UNUSED(userdata); -} - -// Called when a team key needs to be reported -void teamkey_callback(int keyid, int index, qr2_buffer_t outbuf, void *userdata) -{ - qr2_buffer_add(outbuf, _T("")); - - GSI_UNUSED(userdata); - GSI_UNUSED(index); - GSI_UNUSED(keyid); -} - -// Called when we need to report the list of keys we report values for -void keylist_callback(qr2_key_type keytype, qr2_keybuffer_t keybuffer, void *userdata) -{ - //need to add all the keys we support - switch (keytype) - { - case key_server: - qr2_keybuffer_add(keybuffer, HOSTNAME_KEY); - qr2_keybuffer_add(keybuffer, GAMEVER_KEY); - qr2_keybuffer_add(keybuffer, HOSTPORT_KEY); - qr2_keybuffer_add(keybuffer, MAPNAME_KEY); - qr2_keybuffer_add(keybuffer, GAMETYPE_KEY); - qr2_keybuffer_add(keybuffer, NUMPLAYERS_KEY); - qr2_keybuffer_add(keybuffer, NUMTEAMS_KEY); - qr2_keybuffer_add(keybuffer, MAXPLAYERS_KEY); - qr2_keybuffer_add(keybuffer, GAMEMODE_KEY); - qr2_keybuffer_add(keybuffer, TEAMPLAY_KEY); - qr2_keybuffer_add(keybuffer, FRAGLIMIT_KEY); - qr2_keybuffer_add(keybuffer, TIMELIMIT_KEY); - break; - case key_player: - qr2_keybuffer_add(keybuffer, PLAYER__KEY); - qr2_keybuffer_add(keybuffer, SCORE__KEY); - qr2_keybuffer_add(keybuffer, SKILL__KEY); - qr2_keybuffer_add(keybuffer, DEATHS__KEY); - qr2_keybuffer_add(keybuffer, PING__KEY); - qr2_keybuffer_add(keybuffer, TEAM__KEY); - break; - case key_team: - break; - } - - GSI_UNUSED(userdata); -} - -// Called when we need to report the number of players and teams -int count_callback(qr2_key_type keytype, void *userdata) -{ - if (keytype == key_player) - return gamedata.numplayers; - else if (keytype == key_team) - return 0; - else - return 0; - - GSI_UNUSED(userdata); -} - -// Called if our registration with the GameSpy master server failed -void adderror_callback(qr2_error_t error, gsi_char *errmsg, void *userdata) -{ - _tprintf(_T("Error adding server: %d, %s\n"), error, errmsg); - - GSI_UNUSED(userdata); -} - -/*********** -init_game -Initialize the sample data structures with bogus data -************/ -static void init_game(void) -{ - int i; - int team; - - srand((unsigned int) current_time() ); - gamedata.numplayers = rand() % 15; - gamedata.maxplayers = QR2_MAX_PLAYERS; - for (i = 0 ; i < gamedata.numplayers ; i++) - { - strcpy(gamedata.players[i].pname, constnames[i]); - gamedata.players[i].pfrags = rand() % 32; - gamedata.players[i].pdeaths = rand() % 32; - gamedata.players[i].pskill = rand() % 1000; - gamedata.players[i].pping = rand() % 500; - team = rand() % 3; - if (team == 0) - strcpy(gamedata.players[i].pteam,"Red"); - else if (team == 1) - strcpy(gamedata.players[i].pteam,"Blue"); - else if (team == 2) - strcpy(gamedata.players[i].pteam,""); - } - strcpy(gamedata.mapname,"gmtmap1"); - strcpy(gamedata.gametype,"arena"); - strcpy(gamedata.hostname,"GameMaster Arena Server"); - strcpy(gamedata.gamemode,"openplaying"); - gamedata.fraglimit = 0; - gamedata.timelimit = 40; - gamedata.teamplay = 1; - gamedata.locationid = 1; - gamedata.rankingson = 1; - gamedata.hostport = 25000; -} - -/******* - DoGameStuff -Simulate whatever else a game server does -********/ -void DoGameStuff(void) -{ - msleep(10); -} - -GT2Bool UnrecognizedMessageCallback(GT2Socket socket, unsigned int ip, unsigned short port, GT2Byte * message, int len) -{ - static char buffer[8 * 1024]; - struct sockaddr_in saddr; - - if(!len || !message || ((message[0] != QR_MAGIC_1) && (message[1] != QR_MAGIC_2) && (message[0] != '\\'))) - return GT2False; - - // we want to make sure it is NUL-terminated - len = min(len, (sizeof(buffer) - 1)); - memcpy(buffer, message, len); - buffer[len] = '\0'; - - memset(&saddr, 0, sizeof(saddr)); - saddr.sin_family = AF_INET; - saddr.sin_addr.s_addr = ip; - saddr.sin_port = htons(port); - //qr_parse_query(NULL, buffer, len, (struct sockaddr *)&saddr); - qr2_parse_query(NULL, buffer, len, (struct sockaddr *)&saddr); - return GT2True; - - GSI_UNUSED(socket); -} - -void ConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -) -{ - printf("Connection attempt from %s (%d ping)\n", gt2AddressToString(ip, port, NULL), latency); - - gt2Reject(connection, NULL, 0); - - GSI_UNUSED(len); - GSI_UNUSED(message); - GSI_UNUSED(socket); -} - -/******************* - main -Simulates a main program loop -First, initializes the Q&R items, then enters a main loop -*****************/ -#if defined(_PS2) -int test_main(int argc, char **argp) -#else -int main(int argc, char **argp) -#endif -{ - char secret_key[9]; - GT2Socket socket; - GT2Result result; - int natNegotiate = 1; - result = gt2CreateSocket(&socket, gt2AddressToString(0, QR2_BASE_PORT, NULL), 0, 0, NULL); - if(result != GT2Success) - return -1; - - gt2Listen(socket, ConnectAttemptCallback); - - //set the secret key, in a semi-obfuscated manner - secret_key[0] = 'H'; - secret_key[1] = 'A'; - secret_key[2] = '6'; - secret_key[3] = 'z'; - secret_key[4] = 'k'; - secret_key[5] = 'S'; - secret_key[6] = '\0'; - - qr2_register_key(QR2_RANKINGSON_KEY, _T("rankingson")); - /* - //call qr_init_socket with the socket and gamename - if (qr_init_socket(NULL,gt2GetSocketSOCKET(socket), QR2_GAME_NAME, secret_key, basic_callback, - info_callback, rules_callback, players_callback, NULL) != 0) - { - printf("Error starting Q&R SDK\n"); - return -1; - } - */ - - // call the qr2_init_socket with the socket and gamename - if (qr2_init_socket(NULL, gt2GetSocketSOCKET(socket), QR2_BASE_PORT, QR2_GAME_NAME, secret_key, 1, natNegotiate, - serverkey_callback, playerkey_callback, teamkey_callback, keylist_callback, count_callback, - adderror_callback, NULL) != e_qrnoerror) - - { - printf("Error starting QR2 SDK\n"); - return -1; - } - // set the unrecognized message callback - gt2SetUnrecognizedMessageCallback(socket, UnrecognizedMessageCallback); - - init_game(); - - printf("Press any key to quit\n"); -#if defined(_WIN32) && !defined(UNDER_CE) - while (!_kbhit()) -#else - while (1) -#endif - { - DoGameStuff(); - //process our game networking - gt2Think(socket); - //check for / process incoming queries - //qr_process_queries(NULL); - qr2_think(NULL); - } - //let gamemaster know we are shutting down - strcpy(gamedata.gamemode,"exiting"); - //qr_send_exiting(NULL); - //qr_shutdown(NULL); - qr2_shutdown(NULL); - gt2CloseSocket(socket); - return 0; - - GSI_UNUSED(argp); - GSI_UNUSED(argc); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat.dsp deleted file mode 100644 index 99ad8a8a5a9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat.dsp +++ /dev/null @@ -1,320 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2nat" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gt2nat - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2nat.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2nat.mak" CFG="gt2nat - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2nat - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2nat - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2nat", TTOCAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2nat - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gt2nat - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gt2nat - Win32 Release" -# Name "gt2nat - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2nat.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.h -# End Source File -# End Group -# Begin Group "QueryReporting2SDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\qr2\qr2.c -# End Source File -# Begin Source File - -SOURCE=..\..\qr2\qr2.h -# End Source File -# Begin Source File - -SOURCE=..\..\qr2\qr2regkeys.c -# End Source File -# Begin Source File - -SOURCE=..\..\qr2\qr2regkeys.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# End Group -# Begin Group "NatNegSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\natneg\NATify.c -# End Source File -# Begin Source File - -SOURCE=..\..\natneg\NATify.h -# End Source File -# Begin Source File - -SOURCE=..\..\natneg\natneg.c -# End Source File -# Begin Source File - -SOURCE=..\..\natneg\natneg.h -# End Source File -# Begin Source File - -SOURCE=..\..\natneg\nninternal.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat_vs2005.vcproj deleted file mode 100644 index 7be11229e6b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat_vs2005.vcproj +++ /dev/null @@ -1,765 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2nat/gt2nat_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy.c deleted file mode 100644 index 85903e4a176..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy.c +++ /dev/null @@ -1,534 +0,0 @@ - -#include "../gt2.h" -#include "../../darray.h" -#include - - -#define STATS 1 - -GT2Socket Socket; -char RemoteAddress[256]; -char LocalAddress[256]; -GT2Bool Quit; -DArray ServerSockets; - -#if STATS -time_t startTime; -int numConnectAttempts; -int connectResults[8]; -int clientReliableMessagesSent; -int serverReliableMessagesSent; -int clientUnreliableMessagesSent; -int serverUnreliableMessagesSent; -int clientReliableBytesSent; -int serverReliableBytesSent; -int clientUnreliableBytesSent; -int serverUnreliableBytesSent; -int clientCloses; -int serverCloses; -#endif - -void FreeServerSocket(void * elem) -{ - GT2Socket socket = *(GT2Socket *)elem; - - gt2CloseSocket(socket); -} - -int ServerSocketCompare(const void * elem1, const void * elem2) -{ - GT2Socket socket1 = *(GT2Socket *)elem1; - GT2Socket socket2 = *(GT2Socket *)elem2; - - if(socket1 == socket2) - return 0; - return 1; -} - -void RemoveServerSocket(GT2Socket socket) -{ - int index; - - // find it first - index = ArraySearch(ServerSockets, &socket, ServerSocketCompare, 0, 0); - if(index != NOT_FOUND) - ArrayDeleteAt(ServerSockets, index); -} - -/* CLIENT CONNECTIONS */ - -void ClientReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - GT2Connection serverConnection; - - // The server connection for this client connection. - //////////////////////////////////////////////////// - serverConnection = (GT2Connection)gt2GetConnectionData(connection); - - // Pass the data along. - /////////////////////// - gt2Send(serverConnection, message, len, reliable); - -#if STATS - // Update stats. - //////////////// - if(reliable) - { - clientReliableMessagesSent++; - clientReliableBytesSent += len; - } - else - { - clientUnreliableMessagesSent++; - clientUnreliableBytesSent += len; - } -#endif -} - -void ClientClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - GT2Connection serverConnection; - - // The server connection for this client connection. - //////////////////////////////////////////////////// - serverConnection = (GT2Connection)gt2GetConnectionData(connection); - if(serverConnection) - { - // We don't want them to try closing us.... - /////////////////////////////////////////// - gt2SetConnectionData(serverConnection, NULL); - - // Close the connection to the server. - ////////////////////////////////////// - gt2CloseConnection(serverConnection); - } - -#if STATS - // Update stats. - //////////////// - if(reason == GT2LocalClose) - clientCloses++; -#endif -} - -GT2ConnectionCallbacks ClientConnectionCallbacks = -{ - NULL, - ClientReceivedCallback, - ClientClosedCallback -}; - -/* SERVER CONNECTIONS */ - -void ServerSocketErrorCallback -( - GT2Socket socket -) -{ - printf("Server socket error\n"); - Quit = GT2True; - - GSI_UNUSED(socket); -} - -void ServerConnectedCallback -( - GT2Connection connection, - GT2Result result, - GT2Byte * message, - int len -) -{ - GT2Connection clientConnection; - - // The client connection for this server connection. - //////////////////////////////////////////////////// - clientConnection = (GT2Connection)gt2GetConnectionData(connection); - - // Check the result. - //////////////////// - if(result == GT2Success) - { - // Accept it. - ///////////// - if(!gt2Accept(clientConnection, &ClientConnectionCallbacks)) - gt2CloseConnection(connection); - } - else - { - if(result == GT2Rejected) - gt2Reject(clientConnection, message, len); - else - gt2Reject(clientConnection, (const GT2Byte *)("Proxy failed to connect to server."), -1); - - // Close the socket. - //////////////////// - RemoveServerSocket(gt2GetConnectionSocket(connection)); - } - -#if STATS - // Update stats. - //////////////// - connectResults[result]++; -#endif -} - -void ServerReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - GT2Connection clientConnection; - - // The client connection for this server connection. - //////////////////////////////////////////////////// - clientConnection = (GT2Connection)gt2GetConnectionData(connection); - - // Send it the data. - //////////////////// - gt2Send(clientConnection, message, len, reliable); - -#if STATS - // Update stats. - //////////////// - if(reliable) - { - serverReliableMessagesSent++; - serverReliableBytesSent += len; - } - else - { - serverUnreliableMessagesSent++; - serverUnreliableBytesSent += len; - } -#endif -} - -void ServerClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - GT2Connection clientConnection; - - // The client connection for this server connection. - //////////////////////////////////////////////////// - clientConnection = (GT2Connection)gt2GetConnectionData(connection); - if(clientConnection) - { - // We don't want them to try closing us.... - /////////////////////////////////////////// - gt2SetConnectionData(clientConnection, NULL); - - // Close the connection. - //////////////////////// - gt2CloseConnection(clientConnection); - } - - // Close the socket. - //////////////////// - RemoveServerSocket(gt2GetConnectionSocket(connection)); - -#if STATS - // Update stats. - //////////////// - if(reason == GT2LocalClose) - serverCloses++; -#endif -} - -GT2ConnectionCallbacks ServerConnectionCallbacks = -{ - ServerConnectedCallback, - ServerReceivedCallback, - ServerClosedCallback -}; - -/* LISTENER */ - -void SocketErrorCallback -( - GT2Socket socket -) -{ - printf("Socket error (incoming connections socket)\n"); - Quit = GT2True; - - GSI_UNUSED(socket); -} - -void ConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -) -{ - GT2Socket serverSocket; - GT2Connection serverConnection; - GT2Result result; - - // Create a socket for this connection. - /////////////////////////////////////// - result = gt2CreateSocket(&serverSocket, NULL, 0, 0, NULL); - if(result != GT2Success) - { - gt2Reject(connection, (const GT2Byte *)("Proxy failed to create a new socket."), -1); - return; - } - - // Connect to the real server. - ////////////////////////////// - result = gt2Connect(serverSocket, &serverConnection, RemoteAddress, message, len, 0, &ServerConnectionCallbacks, GT2False); - if(result != GT2Success) - { - gt2Reject(connection, (const GT2Byte *)("Proxy failed to connect to server."), -1); - gt2CloseSocket(serverSocket); - return; - } - - // Add the socket to the array. - /////////////////////////////// - ArrayAppend(ServerSockets, &serverSocket); - - // The user data for each connection is the other. - ////////////////////////////////////////////////// - gt2SetConnectionData(serverConnection, connection); - gt2SetConnectionData(connection, serverConnection); - -#if STATS - // Update stats. - //////////////// - numConnectAttempts++; -#endif - - GSI_UNUSED(latency); - GSI_UNUSED(port); - GSI_UNUSED(ip); - GSI_UNUSED(socket); -} - -#ifdef WIN32 -BOOL WINAPI CtrlHandler -( - DWORD type -) -{ - // Quit. - //////// - Quit = GT2True; - - // We handled it. - ///////////////// - return TRUE; - - GSI_UNUSED(type); -} -#endif - -#if STATS -void DisplayStats(void) -{ - time_t runTime; - time_t days; - time_t hours; - time_t minutes; - time_t seconds; - time_t ctimeTime; - int numAccepted; - int numRejected; - int total; - - // Do the time stuff. - ///////////////////// - ctimeTime = startTime; - runTime = (time(NULL) - startTime); - seconds = (runTime % 60); - runTime /= 60; - minutes = (runTime % 60); - runTime /= 60; - hours = (runTime % 24); - runTime /= 24; - days = runTime; - - // Do some other stuff. - /////////////////////// - numAccepted = connectResults[GT2Success]; - numRejected = connectResults[GT2Rejected]; - - // Print stats. - /////////////// - printf("Proxying since %s", gsiSecondsToString(&ctimeTime)); - printf("(%d days, %d hours, %d minutes, %d seconds)\n", - days, - hours, - minutes, - seconds); - printf("%d connect attempts, %d (%d%%) accepted, %d (%d%%) rejected\n", - numConnectAttempts, - numAccepted, - (numConnectAttempts)?(numAccepted * 100) / numConnectAttempts:0, - numRejected, - (numConnectAttempts)?(numRejected * 100) / numConnectAttempts:0); - total = (clientReliableMessagesSent + clientUnreliableMessagesSent); - printf("client: %d messages, %d (%d%%) reliable, %d (%d%%) unreliable\n", - total, - clientReliableMessagesSent, - (total)?(clientReliableMessagesSent * 100) / total:0, - clientUnreliableMessagesSent, - (total)?(clientUnreliableMessagesSent * 100) / total:0); - total = (serverReliableMessagesSent + serverUnreliableMessagesSent); - printf("server: %d messages, %d (%d%%) reliable, %d (%d%%) unreliable\n", - total, - serverReliableMessagesSent, - (total)?(serverReliableMessagesSent * 100) / total:0, - serverUnreliableMessagesSent, - (total)?(serverUnreliableMessagesSent * 100) / total:0); - total = (clientReliableBytesSent + clientUnreliableBytesSent); - printf("client: %d bytes, %d (%d%%) reliable, %d (%d%%) unreliable\n", - total, - clientReliableBytesSent, - (total)?(clientReliableBytesSent * 100) / total:0, - clientUnreliableBytesSent, - (total)?(clientUnreliableBytesSent * 100) / total:0); - total = (serverReliableBytesSent + serverUnreliableBytesSent); - printf("server: %d bytes, %d (%d%%) reliable, %d (%d%%) unreliable\n", - total, - serverReliableBytesSent, - (total)?(serverReliableBytesSent * 100) / total:0, - serverUnreliableBytesSent, - (total)?(serverUnreliableBytesSent * 100) / total:0); - total = (clientCloses + serverCloses); - printf("%d closes, %d (%d%%) client, %d (%d%%) server\n", - total, - clientCloses, - (total)?(clientCloses * 100) / total:0, - serverCloses, - (total)?(serverCloses * 100) / total:0); -} -#endif - -int main -( - int argc, - char ** argv -) -{ - GT2Result result; - int num; - int i; -#if STATS - unsigned int lastStatsTime = 0; - unsigned int now; -#endif - - // Check args. - ////////////// - if((argc < 2) || (argc > 3)) - { - printf("%s [localhost][:port]\n", argv[0]); - return 1; - } - - // First is the remote address. - /////////////////////////////// - strcpy(RemoteAddress, argv[1]); - - // Second is the local address. - /////////////////////////////// - if(argc >= 3) - strcpy(LocalAddress, argv[2]); - - // Create the array of server sockets. - ////////////////////////////////////// - ServerSockets = ArrayNew(sizeof(GT2Socket), 10, FreeServerSocket); - if(!ServerSockets) - { - printf("Failed to create the array of server sockets\n"); - return 1; - } - - // Create the socket. - ///////////////////// - result = gt2CreateSocket(&Socket, LocalAddress, 0, 0, SocketErrorCallback); - if(result != GT2Success) - { - printf("Error creating the socket (%d)\n", result); - return 1; - } - - // Start listening. - /////////////////// - gt2Listen(Socket, ConnectAttemptCallback); - - // Show the port. - ///////////////// - printf("Listening on port %d\n", gt2GetLocalPort(Socket)); - - // For win32, setup a ctrl-c handler. - ///////////////////////////////////// - SetConsoleCtrlHandler(CtrlHandler, TRUE); - - // We're starting. - ////////////////// - startTime = time(NULL); - - // Loop until we quit. - ////////////////////// - while(!Quit) - { -#if STATS - // Get the current time. - //////////////////////// - now = current_time(); - - // Display stats? - ///////////////// - if((now - lastStatsTime) >= 30000) - { - DisplayStats(); - lastStatsTime = now; - } -#endif - - // Yield. - ///////// - msleep(1); - - // Think. - ///////// - gt2Think(Socket); - - // Let the server sockets think. - //////////////////////////////// - num = ArrayLength(ServerSockets); - for(i = (num - 1) ; i >= 0 ; i--) - gt2Think(*(GT2Socket *)ArrayNth(ServerSockets, i)); - } - -#if STATS - // Display some final stats. - //////////////////////////// - DisplayStats(); -#endif - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy.dsp deleted file mode 100644 index 2ce83d01d62..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy.dsp +++ /dev/null @@ -1,268 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2proxy" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gt2proxy - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2proxy.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2proxy.mak" CFG="gt2proxy - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2proxy - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2proxy - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2proxy", RSOCAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2proxy - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gt2proxy - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gt2proxy - Win32 Release" -# Name "gt2proxy - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2proxy.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy_vs2005.vcproj deleted file mode 100644 index a487a7aa484..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy_vs2005.vcproj +++ /dev/null @@ -1,651 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2proxy/gt2proxy_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/StdAfx.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/StdAfx.cpp deleted file mode 100644 index 18d56e2bf69..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/StdAfx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// gt2test.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/StdAfx.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/StdAfx.h deleted file mode 100644 index 7c8da714f4d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/StdAfx.h +++ /dev/null @@ -1,29 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__7F1931C4_E9E9_49E1_A6DC_8ACC78E87145__INCLUDED_) -#define AFX_STDAFX_H__7F1931C4_E9E9_49E1_A6DC_8ACC78E87145__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -#include // MFC core and standard components -#include // MFC extensions -#include // MFC Automation classes -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -#include "../gt2.h" -#include "../../darray.h" - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__7F1931C4_E9E9_49E1_A6DC_8ACC78E87145__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.cpp deleted file mode 100644 index 926f0ef6ea5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// gt2test.cpp : Defines the class behaviors for the application. -// - -#include "stdafx.h" -#include "gt2test.h" -#include "gt2testDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -///////////////////////////////////////////////////////////////////////////// -// CGt2testApp - -BEGIN_MESSAGE_MAP(CGt2testApp, CWinApp) - //{{AFX_MSG_MAP(CGt2testApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG - ON_COMMAND(ID_HELP, CWinApp::OnHelp) -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CGt2testApp construction - -CGt2testApp::CGt2testApp() -{ - // TODO: add construction code here, - // Place all significant initialization in InitInstance -} - -///////////////////////////////////////////////////////////////////////////// -// The one and only CGt2testApp object - -CGt2testApp theApp; - -///////////////////////////////////////////////////////////////////////////// -// CGt2testApp initialization - -BOOL CGt2testApp::InitInstance() -{ - AfxEnableControlContainer(); - - // Standard initialization - // If you are not using these features and wish to reduce the size - // of your final executable, you should remove from the following - // the specific initialization routines you do not need. -/* -#ifdef _AFXDLL - Enable3dControls(); // Call this when using MFC in a shared DLL -#else - Enable3dControlsStatic(); // Call this when linking to MFC statically -#endif -*/ - CGt2testDlg dlg; - m_pMainWnd = &dlg; - int nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: Place code here to handle when the dialog is - // dismissed with OK - } - else if (nResponse == IDCANCEL) - { - // TODO: Place code here to handle when the dialog is - // dismissed with Cancel - } - - // Since the dialog has been closed, return FALSE so that we exit the - // application, rather than start the application's message pump. - return FALSE; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.dsp deleted file mode 100644 index 9e63ff1ae1a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.dsp +++ /dev/null @@ -1,336 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2test" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=gt2test - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2test.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2test.mak" CFG="gt2test - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2test - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "gt2test - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2test", IBOCAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2test - Win32 Release" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 -# ADD LINK32 /nologo /subsystem:windows /machine:I386 - -!ELSEIF "$(CFG)" == "gt2test - Win32 Debug" - -# PROP BASE Use_MFC 6 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 6 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gt2test - Win32 Release" -# Name "gt2test - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2test.cpp -# End Source File -# Begin Source File - -SOURCE=.\gt2test.rc -# End Source File -# Begin Source File - -SOURCE=.\gt2testDlg.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\gt2test.h -# End Source File -# Begin Source File - -SOURCE=.\gt2testDlg.h -# End Source File -# Begin Source File - -SOURCE=.\Resource.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\res\gt2test.ico -# End Source File -# Begin Source File - -SOURCE=.\res\gt2test.rc2 -# End Source File -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# SUBTRACT CPP /YX /Yc /Yu -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.h deleted file mode 100644 index 5da28ae5110..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.h +++ /dev/null @@ -1,49 +0,0 @@ -// gt2test.h : main header file for the GT2TEST application -// - -#if !defined(AFX_GT2TEST_H__BDC522B0_AA93_4D1B_8271_A3CFD716E950__INCLUDED_) -#define AFX_GT2TEST_H__BDC522B0_AA93_4D1B_8271_A3CFD716E950__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "resource.h" // main symbols - -///////////////////////////////////////////////////////////////////////////// -// CGt2testApp: -// See gt2test.cpp for the implementation of this class -// - -class CGt2testApp : public CWinApp -{ -public: - CGt2testApp(); - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CGt2testApp) - public: - virtual BOOL InitInstance(); - //}}AFX_VIRTUAL - -// Implementation - - //{{AFX_MSG(CGt2testApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_GT2TEST_H__BDC522B0_AA93_4D1B_8271_A3CFD716E950__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.rc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.rc deleted file mode 100644 index 88a765df29c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test.rc +++ /dev/null @@ -1,283 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\gt2test.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\gt2test.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_GT2TEST_DIALOG DIALOGEX 0, 0, 347, 331 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "GameSpy Transport SDK 2 MFC Test" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Create",IDC_CREATE_SOCKET,15,20,35,14 - PUSHBUTTON "Close",IDC_CLOSE_SOCKET,15,35,35,14 - EDITTEXT IDC_LOCAL_ADDRESS,109,18,86,12,ES_AUTOHSCROLL - EDITTEXT IDC_IN_BUFFER_SIZE,109,29,86,12,ES_AUTOHSCROLL - EDITTEXT IDC_OUT_BUFFER_SIZE,109,40,86,12,ES_AUTOHSCROLL - PUSHBUTTON "Connect",IDC_CONNECT,15,60,35,14 - EDITTEXT IDC_REMOTE_ADDRESS,55,60,95,13,ES_AUTOHSCROLL - CONTROL "Blocking",IDC_BLOCKING,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,154,62,41,10 - PUSHBUTTON "Close All Connections",IDC_CLOSE_ALL_CONNECTIONS,155,89, - 77,14 - PUSHBUTTON "Close All Connections Hard", - IDC_CLOSE_ALL_CONNECTIONS_HARD,235,89,97,14 - PUSHBUTTON "Think",IDC_THINK,213,18,35,14 - CONTROL "Always Think",IDC_ALWAYS_THINK,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,260,20,58,10 - CONTROL "Listen",IDC_LISTEN,"Button",BS_AUTOCHECKBOX | - BS_PUSHLIKE | WS_TABSTOP,213,37,35,14 - CONTROL "Accept All",IDC_ACCEPT_ALL,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,259,37,48,10 - CONTROL "Reject All",IDC_REJECT_ALL,"Button",BS_AUTORADIOBUTTON, - 259,50,46,10 - CONTROL "Prompt",IDC_PROMPT,"Button",BS_AUTORADIOBUTTON,259,62, - 38,10 - EDITTEXT IDC_REJECT_REASON,259,73,73,13,ES_AUTOHSCROLL | WS_GROUP - COMBOBOX IDC_CONNECTIONS,15,123,127,97,CBS_DROPDOWNLIST | - CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - CONTROL "Connecting",IDC_CONNECTING,"Button",BS_AUTORADIOBUTTON | - WS_GROUP,149,125,52,10 - CONTROL "Connected",IDC_CONNECTED,"Button",BS_AUTORADIOBUTTON, - 204,125,51,10 - CONTROL "Closing",IDC_CLOSING,"Button",BS_AUTORADIOBUTTON,258, - 125,39,10 - CONTROL "Closed",IDC_CLOSED,"Button",BS_AUTORADIOBUTTON,300,125, - 37,10 - PUSHBUTTON "Send",IDC_SEND,15,151,35,14,WS_GROUP - EDITTEXT IDC_MESSAGE,55,151,95,13,ES_AUTOHSCROLL - CONTROL "Reliable",IDC_RELIABLE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,155,153,41,10 - PUSHBUTTON "Ping",IDC_PING,201,151,35,14 - PUSHBUTTON "Close",IDC_CLOSE_CONNECTION,240,151,35,14 - PUSHBUTTON "Close Hard",IDC_CLOSE_CONNECTION_HARD,279,151,45,14 - EDITTEXT IDC_MESSAGES,15,167,180,81,ES_MULTILINE | ES_READONLY | - WS_VSCROLL | WS_HSCROLL - EDITTEXT IDC_SEND_DROP_VALUE,220,221,25,12,ES_AUTOHSCROLL - EDITTEXT IDC_SEND_DELAY_VALUE,220,235,25,12,ES_AUTOHSCROLL - EDITTEXT IDC_RECEIVE_DROP_VALUE,290,221,25,12,ES_AUTOHSCROLL - EDITTEXT IDC_RECEIVE_DELAY_VALUE,290,235,25,12,ES_AUTOHSCROLL - CONTROL "IPAddress1",IDC_ADDRESS_IP,"SysIPAddress32",WS_TABSTOP, - 15,269,100,12 - EDITTEXT IDC_ADDRESS_PORT,117,269,40,12,ES_AUTOHSCROLL - PUSHBUTTON "--->",IDC_ADDRESS_TO,164,269,20,12 - PUSHBUTTON "<---",IDC_ADDRESS_FROM,187,269,20,12 - EDITTEXT IDC_ADDRESS_STRING,213,269,119,12,ES_AUTOHSCROLL - PUSHBUTTON "Get IP Host Info",IDC_GET_IP_HOST_INFO,15,286,38,29, - BS_MULTILINE - EDITTEXT IDC_ADDRESS_HOSTNAME,95,283,194,12,ES_AUTOHSCROLL | - ES_READONLY - EDITTEXT IDC_ADDRESS_ALIASES,95,294,194,12,ES_AUTOHSCROLL | - ES_READONLY - EDITTEXT IDC_ADDRESS_IPS,95,305,194,12,ES_AUTOHSCROLL | - ES_READONLY - PUSHBUTTON "Get String Host Info",IDC_GET_STRING_HOST_INFO,294,286, - 38,29,BS_MULTILINE - GROUPBOX "Socket",IDC_STATIC,7,7,333,102 - GROUPBOX "Connection",IDC_STATIC,7,112,333,141 - GROUPBOX "Address",IDC_STATIC,7,256,333,68 - LTEXT "Hostname:",IDC_STATIC,58,286,35,8 - LTEXT "Aliases:",IDC_STATIC,58,296,25,8 - LTEXT "IPs:",IDC_STATIC,58,307,13,8 - LTEXT "Local Address:",IDC_STATIC,55,20,48,8 - LTEXT "In Buffer Size:",IDC_STATIC,55,31,45,8 - LTEXT "Out Buffer Size:",IDC_STATIC,55,42,50,8 - LTEXT "Reject Reason:",IDC_STATIC,206,75,50,8 - LTEXT "Send Filters:",IDC_STATIC,200,168,40,8 - LTEXT "Receive Filters:",IDC_STATIC,270,168,50,8 - LTEXT "drop",IDC_STATIC,200,224,15,8 - LTEXT "delay",IDC_STATIC,200,238,18,8 - LTEXT "%",IDC_STATIC,247,222,8,8 - LTEXT "ms",IDC_STATIC,247,238,10,8 - LTEXT "drop",IDC_STATIC,270,224,15,8 - LTEXT "delay",IDC_STATIC,270,238,18,8 - LTEXT "%",IDC_STATIC,317,222,8,8 - LTEXT "ms",IDC_STATIC,317,238,10,8 - CONTROL "ROT13",IDC_SEND_ROT13,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,200,182,39,10 - CONTROL "Drop",IDC_SEND_DROP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,200,193,31,10 - CONTROL "Delay",IDC_SEND_DELAY,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,200,206,34,10 - CONTROL "ROT13",IDC_RECEIVE_ROT13,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,270,182,39,10 - CONTROL "Drop",IDC_RECEIVE_DROP,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,270,193,31,10 - CONTROL "Delay",IDC_RECEIVE_DELAY,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,270,206,34,10 - EDITTEXT IDC_CONNECT_MESSAGE,55,80,95,12,ES_AUTOHSCROLL - EDITTEXT IDC_TIMEOUT,55,91,95,12,ES_AUTOHSCROLL - LTEXT "Message:",IDC_STATIC,15,82,32,8 - LTEXT "Timeout:",IDC_STATIC,15,93,28,8 - LTEXT "Incoming:",IDC_STATIC,97,139,32,8 - CONTROL "Progress1",IDC_INCOMING_BUFFER_PROGRESS, - "msctls_progress32",PBS_SMOOTH | WS_BORDER,129,140,50,7 - LTEXT "Space Used in Buffers:",IDC_STATIC,15,139,74,8 - LTEXT "55555555",IDC_INCOMING_BUFFER_SIZE,179,139,33,8 - LTEXT "Outgoing:",IDC_STATIC,217,139,32,8 - CONTROL "Progress1",IDC_OUTGOING_BUFFER_PROGRESS, - "msctls_progress32",PBS_SMOOTH | WS_BORDER,249,140,50,7 - LTEXT "55555555",IDC_OUTGOING_BUFFER_SIZE,299,139,33,8 -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "gt2test MFC Application\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "gt2test\0" - VALUE "LegalCopyright", "Copyright (C) 2002\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "gt2test.EXE\0" - VALUE "ProductName", "gt2test Application\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_GT2TEST_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 340 - VERTGUIDE, 15 - VERTGUIDE, 332 - TOPMARGIN, 7 - BOTTOMMARGIN, 324 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\gt2test.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2testDlg.cpp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2testDlg.cpp deleted file mode 100644 index 3106f6b4114..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2testDlg.cpp +++ /dev/null @@ -1,1430 +0,0 @@ -// gt2testDlg.cpp : implementation file -// - -#include "stdafx.h" -#include "gt2test.h" -#include "gt2testDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -CGt2testDlg * dlg; - -///////////////////////////////////////////////////////////////////////////// -// CGt2testDlg dialog - -CGt2testDlg::CGt2testDlg(CWnd* pParent /*=NULL*/) - : CDialog(CGt2testDlg::IDD, pParent) -{ - m_delayedSends = NULL; - m_delayedReceives = NULL; - - //{{AFX_DATA_INIT(CGt2testDlg) - m_addressAliases = _T(""); - m_addressHostname = _T(""); - m_addressIPs = _T(""); - m_addressPort = _T(""); - m_addressString = _T(""); - m_outBufferSize = _T(""); - m_rejectReason = _T(""); - m_acceptMode = 0; - m_alwaysThink = TRUE; - m_blocking = FALSE; - m_localAddress = _T(""); - m_remoteAddress = _T(""); - m_inBufferSize = _T(""); - m_listen = FALSE; - m_connectionState = -1; - m_reliable = FALSE; - m_message = _T(""); - m_messages = _T(""); - m_receiveDelay = FALSE; - m_receiveDelayValue = _T("0"); - m_receiveDrop = FALSE; - m_receiveDropValue = _T("0"); - m_receiveROT13 = FALSE; - m_sendDelay = FALSE; - m_sendDelayValue = _T("0"); - m_sendDrop = FALSE; - m_sendDropValue = _T("0"); - m_sendROT13 = FALSE; - m_connectMessage = _T(""); - m_timeout = _T("5000"); - //}}AFX_DATA_INIT - - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CGt2testDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - //{{AFX_DATA_MAP(CGt2testDlg) - DDX_Control(pDX, IDC_OUTGOING_BUFFER_SIZE, m_outgoingBufferSize); - DDX_Control(pDX, IDC_OUTGOING_BUFFER_PROGRESS, m_outgoingBufferProgress); - DDX_Control(pDX, IDC_INCOMING_BUFFER_SIZE, m_incomingBufferSize); - DDX_Control(pDX, IDC_INCOMING_BUFFER_PROGRESS, m_incomingBufferProgress); - DDX_Control(pDX, IDC_CONNECTIONS, m_connections); - DDX_Control(pDX, IDC_ADDRESS_IP, m_addressIP); - DDX_Text(pDX, IDC_ADDRESS_ALIASES, m_addressAliases); - DDX_Text(pDX, IDC_ADDRESS_HOSTNAME, m_addressHostname); - DDX_Text(pDX, IDC_ADDRESS_IPS, m_addressIPs); - DDX_Text(pDX, IDC_ADDRESS_PORT, m_addressPort); - DDX_Text(pDX, IDC_ADDRESS_STRING, m_addressString); - DDX_Text(pDX, IDC_OUT_BUFFER_SIZE, m_outBufferSize); - DDX_Text(pDX, IDC_REJECT_REASON, m_rejectReason); - DDX_Radio(pDX, IDC_ACCEPT_ALL, m_acceptMode); - DDX_Check(pDX, IDC_ALWAYS_THINK, m_alwaysThink); - DDX_Check(pDX, IDC_BLOCKING, m_blocking); - DDX_Text(pDX, IDC_LOCAL_ADDRESS, m_localAddress); - DDX_Text(pDX, IDC_REMOTE_ADDRESS, m_remoteAddress); - DDX_Text(pDX, IDC_IN_BUFFER_SIZE, m_inBufferSize); - DDX_Check(pDX, IDC_LISTEN, m_listen); - DDX_Radio(pDX, IDC_CONNECTING, m_connectionState); - DDX_Check(pDX, IDC_RELIABLE, m_reliable); - DDX_Text(pDX, IDC_MESSAGE, m_message); - DDX_Text(pDX, IDC_MESSAGES, m_messages); - DDX_Check(pDX, IDC_RECEIVE_DELAY, m_receiveDelay); - DDX_Text(pDX, IDC_RECEIVE_DELAY_VALUE, m_receiveDelayValue); - DDX_Check(pDX, IDC_RECEIVE_DROP, m_receiveDrop); - DDX_Text(pDX, IDC_RECEIVE_DROP_VALUE, m_receiveDropValue); - DDX_Check(pDX, IDC_RECEIVE_ROT13, m_receiveROT13); - DDX_Check(pDX, IDC_SEND_DELAY, m_sendDelay); - DDX_Text(pDX, IDC_SEND_DELAY_VALUE, m_sendDelayValue); - DDX_Check(pDX, IDC_SEND_DROP, m_sendDrop); - DDX_Text(pDX, IDC_SEND_DROP_VALUE, m_sendDropValue); - DDX_Check(pDX, IDC_SEND_ROT13, m_sendROT13); - DDX_Text(pDX, IDC_CONNECT_MESSAGE, m_connectMessage); - DDX_Text(pDX, IDC_TIMEOUT, m_timeout); - //}}AFX_DATA_MAP -} - -BEGIN_MESSAGE_MAP(CGt2testDlg, CDialog) - //{{AFX_MSG_MAP(CGt2testDlg) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_BN_CLICKED(IDC_ADDRESS_TO, OnAddressTo) - ON_BN_CLICKED(IDC_ADDRESS_FROM, OnAddressFrom) - ON_BN_CLICKED(IDC_GET_IP_HOST_INFO, OnGetIpHostInfo) - ON_BN_CLICKED(IDC_GET_STRING_HOST_INFO, OnGetStringHostInfo) - ON_BN_CLICKED(IDC_CLOSE_SOCKET, OnCloseSocket) - ON_BN_CLICKED(IDC_CREATE_SOCKET, OnCreateSocket) - ON_BN_CLICKED(IDC_CONNECT, OnConnect) - ON_BN_CLICKED(IDC_THINK, OnThink) - ON_BN_CLICKED(IDC_LISTEN, OnListen) - ON_BN_CLICKED(IDC_CLOSE_ALL_CONNECTIONS, OnCloseAllConnections) - ON_BN_CLICKED(IDC_CLOSE_ALL_CONNECTIONS_HARD, OnCloseAllConnectionsHard) - ON_WM_TIMER() - ON_BN_CLICKED(IDC_SEND, OnSend) - ON_BN_CLICKED(IDC_PING, OnPing) - ON_BN_CLICKED(IDC_CLOSE_CONNECTION, OnCloseConnection) - ON_BN_CLICKED(IDC_CLOSE_CONNECTION_HARD, OnCloseConnectionHard) - ON_CBN_SELCHANGE(IDC_CONNECTIONS, OnSelchangeConnections) - ON_BN_CLICKED(IDC_SEND_ROT13, OnSendRot13) - ON_BN_CLICKED(IDC_RECEIVE_ROT13, OnReceiveRot13) - ON_BN_CLICKED(IDC_SEND_DROP, OnSendDrop) - ON_BN_CLICKED(IDC_RECEIVE_DROP, OnReceiveDrop) - ON_BN_CLICKED(IDC_SEND_DELAY, OnSendDelay) - ON_BN_CLICKED(IDC_RECEIVE_DELAY, OnReceiveDelay) - ON_WM_DESTROY() - ON_EN_CHANGE(IDC_SEND_DROP_VALUE, OnChangeSendDropValue) - ON_EN_CHANGE(IDC_SEND_DELAY_VALUE, OnChangeSendDelayValue) - ON_EN_CHANGE(IDC_RECEIVE_DROP_VALUE, OnChangeReceiveDropValue) - ON_EN_CHANGE(IDC_RECEIVE_DELAY_VALUE, OnChangeReceiveDelayValue) - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CGt2testDlg message handlers - -static void DelayedMessageFree(void * elem) -{ - DelayedMessage * message = (DelayedMessage *)elem; - - free(message->message); -} - -BOOL CGt2testDlg::OnInitDialog() -{ - // MFC stuff - CDialog::OnInitDialog(); - SetIcon(m_hIcon, TRUE); - SetIcon(m_hIcon, FALSE); - - // so we can reference members from callbacks - dlg = this; - - // disable the socket controls - EnableSocketControls(FALSE); - - // we initialize sockets ourself because it might be needed for the address functions - // this function is declared in nonport.h - SocketStartUp(); - - // setup the think timer - SetTimer(100, 20, NULL); - - // not thinking yet - m_thinking = GT2False; - - // create the delay arrays - m_delayedSends = ArrayNew(sizeof(DelayedMessage), 10, DelayedMessageFree); - m_delayedReceives = ArrayNew(sizeof(DelayedMessage), 10, DelayedMessageFree); - - return TRUE; -} - -void CGt2testDlg::OnDestroy() -{ - CDialog::OnDestroy(); - - // free our arrays of delayed messages - if(m_delayedSends) - { - ArrayFree(m_delayedSends); - m_delayedSends = NULL; - } - if(m_delayedReceives) - { - ArrayFree(m_delayedReceives); - m_delayedReceives = NULL; - } -} - -// MFC stuff -void CGt2testDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); - - SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); - - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -// MFC stuff -HCURSOR CGt2testDlg::OnQueryDragIcon() -{ - return (HCURSOR) m_hIcon; -} - -/************ -** GENERAL ** -************/ - -// enable or disable a control based on it's control ID -#define ENABLE(control, enable) GetDlgItem(control)->EnableWindow(enable) - -// check if a delayed message should be passed on to it's filter function -static void DelayCheck(DArray delayedMessages, unsigned long now, BOOL send) -{ - DelayedMessage * message; - int num; - int i; - - num = ArrayLength(delayedMessages); - - // loop through the list backwards to allow for safe removals - for(i = (num - 1) ; i >= 0 ; i--) - { - message = (DelayedMessage *)ArrayNth(delayedMessages, i); - - // check if the time passed since the start time is greater than the delay time - if((now - message->startTime) > message->delayTime) - { - if(send) - gt2FilteredSend(message->connection, message->filterID, message->message, message->len, message->reliable); - else - gt2FilteredReceive(message->connection, message->filterID, message->message, message->len, message->reliable); - ArrayDeleteAt(delayedMessages, i); - } - } -} - -static void RemoveDelayedMessages(DArray delayedMessages, GT2Connection connection) -{ - DelayedMessage * message; - int num; - int i; - - num = ArrayLength(delayedMessages); - - // loop through the list backwards to allow for safe removals - for(i = (num - 1) ; i >= 0 ; i--) - { - message = (DelayedMessage *)ArrayNth(delayedMessages, i); - - // remove it if the connection matches - if(message->connection == connection) - ArrayDeleteAt(delayedMessages, i); - } -} - -void CGt2testDlg::OnTimer(UINT nIDEvent) -{ - // check for our timer - if(nIDEvent == 100) - { - // we have a socket, "always think" is checked, and we're not already thinking, think - // the check for already thinking is because this can get called from inside a dialog box brought up - // inside a callback - this would be bad (recursive thinking). - m_alwaysThink = (((CButton *)GetDlgItem(IDC_ALWAYS_THINK))->GetCheck() == BST_CHECKED); - if(m_socket && m_alwaysThink && !m_thinking) - { - m_thinking = GT2True; - gt2Think(m_socket); - m_thinking = GT2False; - } - - // find the active connection, and check what the connection's state should be - GT2Connection connection = GetActiveConnection(); - int newState; - if(connection) - newState = gt2GetConnectionState(connection); - else - newState = -1; - - // if this differs from the previous connection state, make the change - if(newState != m_connectionState) - { - // if there's a state, check it - if(newState != -1) - ((CButton *)GetDlgItem(IDC_CONNECTING + newState))->SetCheck(BST_CHECKED); - - // if there's a previous state, uncheck it - if(m_connectionState != -1) - ((CButton *)GetDlgItem(IDC_CONNECTING + m_connectionState))->SetCheck(BST_UNCHECKED); - - // save the new state - m_connectionState = newState; - } - - // update the buffer display - if(connection) - { - int freeSpace; - int size; - CString text; - - freeSpace = gt2GetIncomingBufferFreeSpace(connection); - size = gt2GetIncomingBufferSize(connection); - text.Format("%d", size); - m_incomingBufferSize.SetWindowText(text); - m_incomingBufferProgress.SetRange32(0, size); - m_incomingBufferProgress.SetPos(size - freeSpace); - - freeSpace = gt2GetOutgoingBufferFreeSpace(connection); - size = gt2GetOutgoingBufferSize(connection); - text.Format("%d", size); - m_outgoingBufferSize.SetWindowText(text); - m_outgoingBufferProgress.SetRange32(0, size); - m_outgoingBufferProgress.SetPos(size - freeSpace); - } - else - { - m_incomingBufferSize.SetWindowText(""); - m_incomingBufferProgress.SetPos(0); - m_outgoingBufferSize.SetWindowText(""); - m_outgoingBufferProgress.SetPos(0); - } - - // check for delayed messages - unsigned long now = current_time(); - DelayCheck(m_delayedSends, now, TRUE); - DelayCheck(m_delayedReceives, now, FALSE); - } - - // MFC stuff - CDialog::OnTimer(nIDEvent); -} - -BOOL CGt2testDlg::PreTranslateMessage(MSG* pMsg) -{ - // Redirect enter. - ////////////////// - if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == 0x0D)) - { - CWnd * pWnd = GetFocus(); - if(pWnd) - { - int id = pWnd->GetDlgCtrlID(); - - if(id == IDC_LOCAL_ADDRESS) - { - OnCreateSocket(); - return TRUE; - } - if(id == IDC_REMOTE_ADDRESS) - { - OnConnect(); - return TRUE; - } - if(id == IDC_CONNECT_MESSAGE) - { - OnConnect(); - return TRUE; - } - if(id == IDC_MESSAGE) - { - OnSend(); - return TRUE; - } - if(id == IDC_ADDRESS_IP) - { - OnAddressTo(); - return TRUE; - } - if(id == IDC_ADDRESS_PORT) - { - OnAddressTo(); - return TRUE; - } - if(id == IDC_ADDRESS_STRING) - { - OnAddressFrom(); - return TRUE; - } - } - } - - // MFC stuff - return CDialog::PreTranslateMessage(pMsg); -} - -static const char * ResultToString(GT2Result result) -{ - switch(result) - { - case GT2Success: - return "GT2Success"; - case GT2OutOfMemory: - return "GT2OutOfMemory"; - case GT2Rejected: - return "GT2Rejected"; - case GT2NetworkError: - return "GT2NetworkError"; - case GT2AddressError: - return "GT2AddressError"; - case GT2DuplicateAddress: - return "GT2DuplicateAddress"; - case GT2TimedOut: - return "GT2TimedOut"; - case GT2NegotiationError: - return "GT2NegotiationError"; - } - - return "Unknown result"; -} - -// used to enable or disable socket controls when a socket is created or destroyed -void CGt2testDlg::EnableSocketControls(BOOL enable) -{ - if(!enable) - m_socket = NULL; - - ENABLE(IDC_CREATE_SOCKET, !enable); - ENABLE(IDC_CLOSE_SOCKET, enable); - ENABLE(IDC_LOCAL_ADDRESS, !enable); - ENABLE(IDC_IN_BUFFER_SIZE, !enable); - ENABLE(IDC_OUT_BUFFER_SIZE, !enable); - ENABLE(IDC_CONNECT, enable); - ENABLE(IDC_REMOTE_ADDRESS, enable); - ENABLE(IDC_BLOCKING, enable); - ENABLE(IDC_CLOSE_ALL_CONNECTIONS, enable); - ENABLE(IDC_CLOSE_ALL_CONNECTIONS_HARD, enable); - ENABLE(IDC_THINK, enable); - ENABLE(IDC_ALWAYS_THINK, enable); - ENABLE(IDC_LISTEN, enable); - ENABLE(IDC_CONNECT_MESSAGE, enable); - ENABLE(IDC_TIMEOUT, enable); - - EnableListenControls(FALSE); - EnableConnectionControls(FALSE); -} - -// used to enable or disable the listen controls, depending on if the socket is listening or not -void CGt2testDlg::EnableListenControls(BOOL enable) -{ - ENABLE(IDC_ACCEPT_ALL, enable); - ENABLE(IDC_REJECT_ALL, enable); - ENABLE(IDC_PROMPT, enable); - ENABLE(IDC_REJECT_REASON, enable); -} - -// used to enable or disable the connection controls, depending on if there's a connection or not -void CGt2testDlg::EnableConnectionControls(BOOL enable) -{ - ENABLE(IDC_CONNECTIONS, enable); - ENABLE(IDC_CONNECTING, enable); - ENABLE(IDC_CONNECTED, enable); - ENABLE(IDC_CLOSING, enable); - ENABLE(IDC_CLOSED, enable); - ENABLE(IDC_SEND, enable); - ENABLE(IDC_MESSAGE, enable); - ENABLE(IDC_RELIABLE, enable); - ENABLE(IDC_PING, enable); - ENABLE(IDC_CLOSE_CONNECTION, enable); - ENABLE(IDC_CLOSE_CONNECTION_HARD, enable); - ENABLE(IDC_SEND_ROT13, enable); - ENABLE(IDC_RECEIVE_ROT13, enable); - ENABLE(IDC_SEND_DROP, enable); - ENABLE(IDC_RECEIVE_DROP, enable); - ENABLE(IDC_SEND_DROP_VALUE, enable); - ENABLE(IDC_RECEIVE_DROP_VALUE, enable); - ENABLE(IDC_SEND_DELAY, enable); - ENABLE(IDC_RECEIVE_DELAY, enable); - ENABLE(IDC_SEND_DELAY_VALUE, enable); - ENABLE(IDC_RECEIVE_DELAY_VALUE, enable); -} - -// get's the list index for a connection object -int CGt2testDlg::GetConnectionIndex(GT2Connection connection) -{ - int nIndex; - int num = m_connections.GetCount(); - - for(nIndex = 0 ; nIndex < num ; nIndex++) - { - if(((ConnectionInfo *)m_connections.GetItemDataPtr(nIndex))->connection == connection) - return nIndex; - } - - return -1; -} - -// get's the connection for a given list index -GT2Connection CGt2testDlg::GetConnection(int nIndex) -{ - if(nIndex == -1) - return NULL; - - ConnectionInfo * info = (ConnectionInfo *)m_connections.GetItemDataPtr(nIndex); - if(!info) - return NULL; - - return info->connection; -} - -// get's the connection info for a given list index -ConnectionInfo * CGt2testDlg::GetConnectionInfo(int nIndex) -{ - if(nIndex == -1) - return NULL; - - return (ConnectionInfo *)m_connections.GetItemDataPtr(nIndex); -} - -ConnectionInfo * CGt2testDlg::GetConnectionInfo(GT2Connection connection) -{ - return GetConnectionInfo(GetConnectionIndex(connection)); -} - -// adds a connection to the connection list -void CGt2testDlg::AddConnection(GT2Connection connection) -{ - // the string to show in the list is it's IP and port - CString address = gt2AddressToString(gt2GetRemoteIP(connection), gt2GetRemotePort(connection), NULL); - - // add the string to the list - int nIndex = m_connections.AddString(address); - if(nIndex == -1) - { - MessageBox("Error adding address to list!"); - return; - } - - // allocation the connection's info - ConnectionInfo * info = new ConnectionInfo; - info->connection = connection; - info->messages.Empty(); - info->sendROT13 = FALSE; - info->receiveROT13 = FALSE; - info->sendDrop = FALSE; - info->receiveDrop = FALSE; - info->sendDelay = FALSE; - info->receiveDelay = FALSE; - - // set the string's data pointer to point to it's info - m_connections.SetItemDataPtr(nIndex, info); - - // we have a connection, so enable the controls - EnableConnectionControls(); - - // set this connection as the active connection - SetActiveConnection(connection); -} - -// sets a connection as active (or, if connection is NULL and nIndex is -1, sets the list to no active connectoin) -void CGt2testDlg::SetActiveConnection(GT2Connection connection, int nIndex) -{ - // make sure this connection is selected - m_connections.SetCurSel(nIndex); - - // enable the connection controls depending on if this is a connection or not - EnableConnectionControls(connection != NULL); - - // make sure the controls reflect the proper connection (or lack thereof) - if(connection) - { - // update the connection values with the saved values for this connection - ConnectionInfo * info = GetConnectionInfo(connection); - m_messages = info->messages; - m_sendROT13 = info->sendROT13; - m_receiveROT13 = info->receiveROT13; - m_sendDrop = info->sendDrop; - m_receiveDrop = info->receiveDrop; - m_sendDropValue = info->sendDropValue; - m_receiveDropValue = info->receiveDropValue; - m_sendDelay = info->sendDelay; - m_receiveDelay = info->receiveDelay; - m_sendDelayValue = info->sendDelayValue; - m_receiveDelayValue = info->receiveDelayValue; - } - else - { - // blank out all the connection values - m_messages = ""; - m_sendROT13 = FALSE; - m_receiveROT13 = FALSE; - m_sendDrop = FALSE; - m_receiveDrop = FALSE; - m_sendDropValue = ""; - m_receiveDropValue = ""; - m_sendDelay = FALSE; - m_receiveDelay = FALSE; - m_sendDelayValue = ""; - m_receiveDelayValue = ""; - } -} - -// set the active connection using a connection object -void CGt2testDlg::SetActiveConnection(GT2Connection connection) -{ - int nIndex = GetConnectionIndex(connection); - ASSERT(nIndex != -1); // tried to activate a bad connection - if(nIndex == -1) - return; - - SetActiveConnection(connection, nIndex); -} - -// set the active connection using a list index -void CGt2testDlg::SetActiveConnection(int nIndex) -{ - if(nIndex != -1) - SetActiveConnection(GetConnection(nIndex), nIndex); - else - SetActiveConnection(NULL, nIndex); -} - -// get the selected connection, or NULL if there is none -GT2Connection CGt2testDlg::GetActiveConnection() -{ - if(!m_connections.IsWindowEnabled()) - return NULL; - - int nIndex = m_connections.GetCurSel(); - if(nIndex == -1) - return NULL; - - return GetConnection(nIndex); -} - -// remove a connection from the list -void CGt2testDlg::RemoveConnection(GT2Connection connection) -{ - // check for any delayed messages that are supposed to use this connection - RemoveDelayedMessages(m_delayedSends, connection); - RemoveDelayedMessages(m_delayedReceives, connection); - - // get this connection's index - int nIndex = GetConnectionIndex(connection); - if(nIndex == -1) - return; - - // check if this is the current selection - BOOL selected = (m_connections.GetCurSel() == nIndex); - - // free it's info - delete GetConnectionInfo(nIndex); - - // delete it - m_connections.DeleteString(nIndex); - - UpdateData(); - - // if it was selected, select something else - if(selected) - { - int count = m_connections.GetCount(); - if(count) - { - // if it was last, select the previous, otherwise select the next - if(nIndex == count) - SetActiveConnection(nIndex - 1); - else - SetActiveConnection(nIndex); - } - else - { - // it was the only one, set to no selection - SetActiveConnection(-1); - } - } - - UpdateData(FALSE); -} - -// adds a string to a connection's message list, and updates the displayed messages list if this is -// the active connection -void CGt2testDlg::AddMessageString(GT2Connection connection, const char *string) -{ - // add this to the connection's info - ConnectionInfo * info = GetConnectionInfo(connection); - if(info) - info->messages += string; - - // is this the active connection? - if(GetActiveConnection() == connection) - { - // update the messages list - UpdateData(); - m_messages += string; - UpdateData(FALSE); - - // scroll the messages to the bottom - CEdit * messagesCtrl = (CEdit *)GetDlgItem(IDC_MESSAGES); - messagesCtrl->SetSel(m_messages.GetLength(), m_messages.GetLength()); - } -} - -/*********** -** SOCKET ** -***********/ - -static void SocketErrorCallback(GT2Socket socket) -{ - dlg->EnableSocketControls(FALSE); - - dlg->MessageBox("Socket error"); - - GSI_UNUSED(socket); -} - -static void SendDumpCallback(GT2Socket socket, GT2Connection connection, unsigned int ip, unsigned short port, GT2Bool reset, const GT2Byte * message, int len) -{ - CString str; - str.Format("SEND %p %p %s %d\n", socket, connection, gt2AddressToString(ip, port, NULL), len); - OutputDebugString(str); - - GSI_UNUSED(message); - GSI_UNUSED(reset); -} - -static void ReceiveDumpCallback(GT2Socket socket, GT2Connection connection, unsigned int ip, unsigned short port, GT2Bool reset, const GT2Byte * message, int len) -{ - CString str; - if(reset) - str.Format("RECV %p %p %s RESET\n", socket, connection, gt2AddressToString(ip, port, NULL)); - else - str.Format("RECV %p %p %s %d\n", socket, connection, gt2AddressToString(ip, port, NULL), len); - OutputDebugString(str); - - GSI_UNUSED(message); -} - -void CGt2testDlg::OnCreateSocket() -{ - UpdateData(); - - // create the socket, using the info provided - GT2Result result = gt2CreateSocket(&m_socket, m_localAddress, atoi(m_outBufferSize), atoi(m_inBufferSize), SocketErrorCallback); - if(result != GT2Success) - { - CString str; - str.Format("gt2CreateSocket failed: %s", ResultToString(result)); - MessageBox(str); - return; - } - - // set the dump callbacks - gt2SetSendDump(m_socket, SendDumpCallback); - gt2SetReceiveDump(m_socket, ReceiveDumpCallback); - - // set the config settings to their actual values - m_localAddress = gt2AddressToString(gt2GetLocalIP(m_socket), gt2GetLocalPort(m_socket), NULL); - m_outBufferSize.Format("%d", atoi(m_outBufferSize)); - m_inBufferSize.Format("%d", atoi(m_inBufferSize)); - - // enable the socket controls - EnableSocketControls(); - - UpdateData(FALSE); -} - -void CGt2testDlg::OnCloseSocket() -{ - // close the socket - gt2CloseSocket(m_socket); - - // disable the socket controls - EnableSocketControls(FALSE); -} - -void CGt2testDlg::OnThink() -{ - // let the socket think, if it's not already thinking - if(m_thinking) - return; - m_thinking = GT2True; - gt2Think(m_socket); - m_thinking = GT2False; -} - -static void ConnectAttemptCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - int latency, - GT2Byte * message, - int len -) -{ - GT2Bool accept; - - dlg->UpdateData(); - - // check for an empty message - if(!message) - message = (GT2Byte *)""; - - // get a string address for the connector - CString address = gt2AddressToString(ip, port, NULL); - - // check if we should accept, reject, or prompt - if(dlg->m_acceptMode == 0) - accept = GT2True; - else if(dlg->m_acceptMode == 1) - accept = GT2False; - else - { - // ask the user, and set accept/reject based on their answer - CString str; - str.Format("Accept a connection from %s (latency: %dms)?\n%s", (LPCSTR)address, latency, message); - accept = (dlg->MessageBox(str, "Accept/Reject", MB_YESNO) == IDYES); - } - - // accept the connection? - if(accept) - { - // setup the connection callbacks - GT2ConnectionCallbacks callbacks; - dlg->SetupConnectionCallbacks(callbacks); - - // do the accept - if(gt2Accept(connection, &callbacks)) - { - // add the connection to our list - dlg->AddConnection(connection); - } - else - { - // the other side has terminated the connection attempt before we accepted - // only warn about this if they specifically accepted it - if(dlg->m_acceptMode == 2) - dlg->MessageBox("Connection already closed"); - } - } - else - { - // reject them - gt2Reject(connection, (GT2Byte *)(LPCSTR)dlg->m_rejectReason, -1); - } - - dlg->UpdateData(FALSE); - - GSI_UNUSED(len); - GSI_UNUSED(socket); -} - -void CGt2testDlg::OnListen() -{ - UpdateData(); - - // check if we're supposed to start or stop listening - if(m_listen) - { - // start listening - gt2Listen(m_socket, ConnectAttemptCallback); - - // enable the listening controls - EnableListenControls(); - } - else - { - // stop listening - gt2Listen(m_socket, NULL); - - // disable the listening controls - EnableListenControls(FALSE); - } -} - -void CGt2testDlg::OnConnect() -{ - UpdateData(); - - // check the timout, and show what value we're actually using - int timeout = atoi(m_timeout); - if(timeout < 0) - timeout = 0; - m_timeout.Format("%d", timeout); - - // setup the connection callbacks - GT2ConnectionCallbacks callbacks; - dlg->SetupConnectionCallbacks(callbacks); - - // start the connection attempt, using the provided values - GT2Connection connection; - GT2Result result = gt2Connect(m_socket, &connection, m_remoteAddress, (GT2Byte *)(LPCSTR)m_connectMessage, -1, timeout, &callbacks, m_blocking); - if(result != GT2Success) - { - CString str; - str.Format("gt2Connect failed: %s", ResultToString(result)); - MessageBox(str); - return; - } - - // add the connection to our list - AddConnection(connection); - - UpdateData(FALSE); -} - -void CGt2testDlg::OnCloseAllConnections() -{ - // close all the connections - gt2CloseAllConnections(m_socket); -} - -void CGt2testDlg::OnCloseAllConnectionsHard() -{ - // close all the connections without waiting for a response - gt2CloseAllConnectionsHard(m_socket); -} - -/*************** -** CONNECTION ** -***************/ - -void ConnectedCallback -( - GT2Connection connection, - GT2Result result, - GT2Byte * message, - int len -) -{ - // check if the attempt failed - if(result != GT2Success) - { - // let the user know - CString str; - str.Format("Failed to connect to server: %s", ResultToString(result)); - if(message && len) - { - str += "\n"; - str += (char *)message; - } - dlg->MessageBox(str); - - // remove the connection from our list - dlg->RemoveConnection(connection); - } -} - -void ReceivedCallback -( - GT2Connection connection, - GT2Byte * message, - int len, - GT2Bool reliable -) -{ - // empty messages are NULL - if(!message) - message = (GT2Byte *)""; - - // add the message to the messages list - CString str; - str.Format("IN(%c): %s\xD\xA", reliable?'r':'u', (char *)message); - dlg->AddMessageString(connection, str); - - GSI_UNUSED(len); -} - -void ClosedCallback -( - GT2Connection connection, - GT2CloseReason reason -) -{ - // show a message if it's an error - if(reason == GT2CommunicationError) - dlg->MessageBox("Connection closed: Communication Error"); - else if(reason == GT2SocketError) - dlg->MessageBox("Connection closed: Socket Error"); - else if(reason == GT2NotEnoughMemory) - dlg->MessageBox("Connection closed: Not Enough Memory"); - - // the connection is closed, so remove it from the list - dlg->RemoveConnection(connection); -} - -void PingCallback -( - GT2Connection connection, - int latency -) -{ - // add the ping to the messages list - CString str; - str.Format("PING: %d\xD\xA", latency); - dlg->AddMessageString(connection, str); -} - -void CGt2testDlg::SetupConnectionCallbacks(GT2ConnectionCallbacks &callbacks) -{ - memset(&callbacks, 0, sizeof(GT2ConnectionCallbacks)); - callbacks.connected = ConnectedCallback; - callbacks.received = ReceivedCallback; - callbacks.closed = ClosedCallback; - callbacks.ping = PingCallback; -} - -void CGt2testDlg::OnSend() -{ - GT2Connection connection = GetActiveConnection(); - - UpdateData(); - - // print this out before the send because filtering could change it - CString str; - str.Format("OUT(%c): %s\xD\xA", m_reliable?'r':'u', (LPCSTR)m_message); - AddMessageString(connection, str); - - // do the send - gt2Send(connection, (const GT2Byte *)(LPCSTR)m_message, -1, m_reliable); -} - -void CGt2testDlg::OnPing() -{ - // send the ping - gt2Ping(GetActiveConnection()); -} - -void CGt2testDlg::OnCloseConnection() -{ - // start closing the connection - gt2CloseConnection(GetActiveConnection()); -} - -void CGt2testDlg::OnCloseConnectionHard() -{ - // close the ocnnection without waiting for a response - gt2CloseConnectionHard(GetActiveConnection()); -} - -void CGt2testDlg::OnSelchangeConnections() -{ - // make sure the newly selected connection is activated - UpdateData(); - SetActiveConnection(m_connections.GetCurSel()); - UpdateData(FALSE); -} - -// does a ROT13 transformation on a string -// ROT13 changes every letter to it's "opposite" in the alphabet by adding 13 to it. -// a->m, b->n, c->o, d->p, m->a, n->b, o->c, p->d, etc. -// performing ROT13 twice results in the original string, allowing the same filter to be applied to both -// sending and receiving to end up with the original string. cheap encryption. -static void ROT13(char * buffer, int len) -{ - int i; - int c; - int c2; - - for(i = 0 ; i < len ; i++) - { - c = buffer[i]; - - // only change letters - if(isalpha(c)) - { - // shift it by 13 - c2 = c + 13; - - // if it went past the end of the alphabet, mod it. - if((c2 - (isupper(c)?'A':'a')) >= 26) - c2 -= 26; - - // put it back in the string - buffer[i] = (char)c2; - } - } -} - -static void SendFilterCallbackROT13(GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable) -{ - char * msg; - - // we can override the const because we know we're the only filter, - // it's our data we're sending, and we're not changing the length - msg = (char *)message; - - // ROT13 the string - ROT13(msg, len); - - // pass it back to GT2 - gt2FilteredSend(connection, filterID, (GT2Byte *)msg, len, reliable); -} - -static void ReceiveFilterCallbackROT13(GT2Connection connection, int filterID, GT2Byte * message, int len, GT2Bool reliable) -{ - // ROT13 the string - ROT13((char *)message, len); - - // pass it back to GT2 - gt2FilteredReceive(connection, filterID, message, len, reliable); -} - -// returns true if a message should be dropped, based on the drop value -static BOOL CheckDrop(int dropValue) -{ - return ((rand() % 100) < dropValue); -} - -static void SendFilterCallbackDrop(GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable) -{ - // if it's unreliable, check if it should be dropped - if(!reliable && CheckDrop(atoi(dlg->m_sendDropValue))) - return; - - // pass it back to GT2 - gt2FilteredSend(connection, filterID, message, len, reliable); -} - -static void ReceiveFilterCallbackDrop(GT2Connection connection, int filterID, GT2Byte * message, int len, GT2Bool reliable) -{ - // if it's unreliable, check if it should be dropped - if(!reliable && CheckDrop(atoi(dlg->m_receiveDropValue))) - return; - - // pass it back to GT2 - gt2FilteredReceive(connection, filterID, message, len, reliable); -} - -static void AddDelayedMessage(DArray array, int delayValue, GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable) -{ - // don't allow negative delays! - if(delayValue < 0) - delayValue = 0; - - // save off everything we need to remember about the message - DelayedMessage msg; - memset(&msg, 0, sizeof(msg)); - msg.connection = connection; - msg.filterID = filterID; - msg.message = (GT2Byte *)malloc(len); - ASSERT(msg.message); - memcpy(msg.message, message, len); - msg.len = len; - msg.reliable = reliable; - msg.startTime = current_time(); - msg.delayTime = delayValue; - - // add it to the delay list - ArrayInsertAt(array, &msg, 0); -} - -static void SendFilterCallbackDelay(GT2Connection connection, int filterID, const GT2Byte * message, int len, GT2Bool reliable) -{ - // add it to the delayed sends list - AddDelayedMessage(dlg->m_delayedSends, atoi(dlg->m_sendDelayValue), connection, filterID, message, len, reliable); -} - -static void ReceiveFilterCallbackDelay(GT2Connection connection, int filterID, GT2Byte * message, int len, GT2Bool reliable) -{ - // add it to the delayed receives list - AddDelayedMessage(dlg->m_delayedReceives, atoi(dlg->m_receiveDelayValue), connection, filterID, message, len, reliable); -} - -void CGt2testDlg::OnSendRot13() -{ - UpdateData(); - - GT2Connection connection = GetActiveConnection(); - - // add or remove the filter based on the check box - if(m_sendROT13) - gt2AddSendFilter(connection, SendFilterCallbackROT13); - else - gt2RemoveSendFilter(connection, SendFilterCallbackROT13); - - // save the setting with the connection's info - GetConnectionInfo(connection)->sendROT13 = m_sendROT13; -} - -void CGt2testDlg::OnReceiveRot13() -{ - UpdateData(); - - GT2Connection connection = GetActiveConnection(); - - // add or remove the filter based on the check box - if(m_receiveROT13) - gt2AddReceiveFilter(connection, ReceiveFilterCallbackROT13); - else - gt2RemoveReceiveFilter(connection, ReceiveFilterCallbackROT13); - - // save the setting with the connection's info - GetConnectionInfo(connection)->receiveROT13 = m_receiveROT13; -} - -void CGt2testDlg::OnSendDrop() -{ - UpdateData(); - - GT2Connection connection = GetActiveConnection(); - - // add or remove the filter based on the check box - if(m_sendDrop) - gt2AddSendFilter(connection, SendFilterCallbackDrop); - else - gt2RemoveSendFilter(connection, SendFilterCallbackDrop); - - // save the setting with the connection's info - GetConnectionInfo(connection)->sendDrop = m_sendDrop; -} - -void CGt2testDlg::OnReceiveDrop() -{ - UpdateData(); - - GT2Connection connection = GetActiveConnection(); - - // add or remove the filter based on the check box - if(m_receiveDrop) - gt2AddReceiveFilter(connection, ReceiveFilterCallbackDrop); - else - gt2RemoveReceiveFilter(connection, ReceiveFilterCallbackDrop); - - // save the setting with the connection's info - GetConnectionInfo(connection)->receiveDrop = m_receiveDrop; -} - -void CGt2testDlg::OnSendDelay() -{ - UpdateData(); - - GT2Connection connection = GetActiveConnection(); - - // add or remove the filter based on the check box - if(m_sendDelay) - gt2AddSendFilter(connection, SendFilterCallbackDelay); - else - gt2RemoveSendFilter(connection, SendFilterCallbackDelay); - - // save the setting with the connection's info - GetConnectionInfo(connection)->sendDelay = m_sendDelay; -} - -void CGt2testDlg::OnReceiveDelay() -{ - UpdateData(); - - GT2Connection connection = GetActiveConnection(); - - // add or remove the filter based on the check box - if(m_receiveDelay) - gt2AddReceiveFilter(connection, ReceiveFilterCallbackDelay); - else - gt2RemoveReceiveFilter(connection, ReceiveFilterCallbackDelay); - - // save the setting with the connection's info - GetConnectionInfo(connection)->receiveDelay = m_receiveDelay; -} - -void CGt2testDlg::OnChangeSendDropValue() -{ - UpdateData(); - - // save the setting with the connection's info - GetConnectionInfo(GetActiveConnection())->sendDropValue = m_sendDropValue; -} - -void CGt2testDlg::OnChangeReceiveDropValue() -{ - UpdateData(); - - // save the setting with the connection's info - GetConnectionInfo(GetActiveConnection())->receiveDropValue = m_receiveDropValue; -} - -void CGt2testDlg::OnChangeSendDelayValue() -{ - UpdateData(); - - // save the setting with the connection's info - GetConnectionInfo(GetActiveConnection())->sendDelayValue = m_sendDelayValue; -} - -void CGt2testDlg::OnChangeReceiveDelayValue() -{ - UpdateData(); - - // save the setting with the connection's info - GetConnectionInfo(GetActiveConnection())->receiveDelayValue = m_receiveDelayValue; -} - -/************ -** ADDRESS ** -************/ - -void CGt2testDlg::OnAddressTo() -{ - UpdateData(); - - // get the IP and port - DWORD IP; - unsigned int port; - if(m_addressIP.GetAddress(IP) != 4) - { - MessageBox("No IP address"); - return; - } - IP = gt2HostToNetworkInt(IP); - port = atoi(m_addressPort); - - // convert the ip and port to a string - m_addressString = gt2AddressToString(IP, (unsigned short)port, NULL); - - UpdateData(FALSE); -} - -void CGt2testDlg::OnAddressFrom() -{ - UpdateData(); - - // convert the string to an ip and port - unsigned int IP; - unsigned short port; - if(!gt2StringToAddress(m_addressString, &IP, &port)) - { - MessageBox("Unable to convert the string to an address"); - return; - } - - // set the ip and port - m_addressIP.SetAddress((DWORD)gt2NetworkToHostInt(IP)); - m_addressPort.Format("%d", port); - - UpdateData(FALSE); -} - -// updates dialog based on returned host info -void CGt2testDlg::HandleHostInfo(const char * hostname, char ** aliases, unsigned int ** ips) -{ - int count; - - // set the hostname - m_addressHostname = hostname; - - // fill in the aliases - m_addressAliases.Empty(); - for(count = 0 ; aliases[count] ; count++) - { - m_addressAliases += aliases[count]; - m_addressAliases += " "; - } - - // fill in the ips - m_addressIPs.Empty(); - for(count = 0 ; ips[count] ; count++) - { - m_addressIPs += gt2AddressToString(*(ips[count]), 0, NULL); - m_addressIPs += " "; - } -} - -void CGt2testDlg::OnGetIpHostInfo() -{ - UpdateData(); - - // get the ip - DWORD IP; - if(m_addressIP.GetAddress(IP) != 4) - { - MessageBox("No IP address"); - return; - } - IP = gt2HostToNetworkInt(IP); - - // get the info for the ip - const char * hostname; - char ** aliases; - unsigned int ** ips; - hostname = gt2IPToHostInfo(IP, &aliases, &ips); - if(!hostname) - { - MessageBox("Unable to convert the IP to host info"); - return; - } - - // handle the info - HandleHostInfo(hostname, aliases, ips); - - UpdateData(FALSE); -} - -void CGt2testDlg::OnGetStringHostInfo() -{ - UpdateData(); - - // get the info for the string - const char * hostname; - char ** aliases; - unsigned int ** ips; - hostname = gt2StringToHostInfo(m_addressString, &aliases, &ips); - if(!hostname) - { - CString str = "Unable to convert the string to host info"; - if(strchr(m_addressString, ':')) - str += "\n(Remove the port number)"; - MessageBox(str); - return; - } - - // handle the info - HandleHostInfo(hostname, aliases, ips); - - UpdateData(FALSE); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2testDlg.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2testDlg.h deleted file mode 100644 index 628a3f7ca6f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2testDlg.h +++ /dev/null @@ -1,162 +0,0 @@ -// gt2testDlg.h : header file -// - -#if !defined(AFX_GT2TESTDLG_H__0E64F324_FFA4_4A94_A87D_75652134DC2D__INCLUDED_) -#define AFX_GT2TESTDLG_H__0E64F324_FFA4_4A94_A87D_75652134DC2D__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -///////////////////////////////////////////////////////////////////////////// -// CGt2testDlg dialog - -struct ConnectionInfo -{ - GT2Connection connection; - CString messages; - BOOL sendROT13; - BOOL receiveROT13; - BOOL sendDrop; - BOOL receiveDrop; - CString sendDropValue; - CString receiveDropValue; - BOOL sendDelay; - BOOL receiveDelay; - CString sendDelayValue; - CString receiveDelayValue; -}; - -struct DelayedMessage -{ - GT2Connection connection; - int filterID; - GT2Byte * message; - int len; - GT2Bool reliable; - unsigned long startTime; - unsigned long delayTime; -}; - -class CGt2testDlg : public CDialog -{ -// Construction -public: - void AddMessageString(GT2Connection connection, const char * string); - void RemoveConnection(GT2Connection connection); - GT2Connection GetActiveConnection(); - int GetConnectionIndex(GT2Connection connection); - GT2Connection GetConnection(int nIndex); - ConnectionInfo * GetConnectionInfo(int nIndex); - ConnectionInfo * GetConnectionInfo(GT2Connection connection); - void SetActiveConnection(GT2Connection connection, int nIndex); - void SetActiveConnection(GT2Connection connection); - void SetActiveConnection(int nIndex); - void SetupConnectionCallbacks(GT2ConnectionCallbacks & callbacks); - void AddConnection(GT2Connection connection); - void EnableSocketControls(BOOL enable = TRUE); - void EnableListenControls(BOOL enable = TRUE); - void EnableConnectionControls(BOOL enable = TRUE); - CGt2testDlg(CWnd* pParent = NULL); // standard constructor - - DArray m_delayedSends; - DArray m_delayedReceives; - -// Dialog Data - //{{AFX_DATA(CGt2testDlg) - enum { IDD = IDD_GT2TEST_DIALOG }; - CStatic m_outgoingBufferSize; - CProgressCtrl m_outgoingBufferProgress; - CStatic m_incomingBufferSize; - CProgressCtrl m_incomingBufferProgress; - CComboBox m_connections; - CIPAddressCtrl m_addressIP; - CString m_addressAliases; - CString m_addressHostname; - CString m_addressIPs; - CString m_addressPort; - CString m_addressString; - CString m_outBufferSize; - CString m_rejectReason; - int m_acceptMode; - BOOL m_alwaysThink; - BOOL m_blocking; - CString m_localAddress; - CString m_remoteAddress; - CString m_inBufferSize; - BOOL m_listen; - int m_connectionState; - BOOL m_reliable; - CString m_message; - CString m_messages; - BOOL m_receiveDelay; - CString m_receiveDelayValue; - BOOL m_receiveDrop; - CString m_receiveDropValue; - BOOL m_receiveROT13; - BOOL m_sendDelay; - CString m_sendDelayValue; - BOOL m_sendDrop; - CString m_sendDropValue; - BOOL m_sendROT13; - CString m_connectMessage; - CString m_timeout; - //}}AFX_DATA - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CGt2testDlg) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support - //}}AFX_VIRTUAL - -// Implementation -protected: - void HandleHostInfo(const char * hostname, char ** aliases, unsigned int ** ips); - HICON m_hIcon; - - GT2Socket m_socket; - BOOL m_thinking; - - // Generated message map functions - //{{AFX_MSG(CGt2testDlg) - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnAddressTo(); - afx_msg void OnAddressFrom(); - afx_msg void OnGetIpHostInfo(); - afx_msg void OnGetStringHostInfo(); - afx_msg void OnCloseSocket(); - afx_msg void OnCreateSocket(); - afx_msg void OnConnect(); - afx_msg void OnThink(); - afx_msg void OnListen(); - afx_msg void OnCloseAllConnections(); - afx_msg void OnCloseAllConnectionsHard(); - afx_msg void OnTimer(UINT nIDEvent); - afx_msg void OnSend(); - afx_msg void OnPing(); - afx_msg void OnCloseConnection(); - afx_msg void OnCloseConnectionHard(); - afx_msg void OnSelchangeConnections(); - afx_msg void OnSendRot13(); - afx_msg void OnReceiveRot13(); - afx_msg void OnSendDrop(); - afx_msg void OnReceiveDrop(); - afx_msg void OnSendDelay(); - afx_msg void OnReceiveDelay(); - afx_msg void OnDestroy(); - afx_msg void OnChangeSendDropValue(); - afx_msg void OnChangeSendDelayValue(); - afx_msg void OnChangeReceiveDropValue(); - afx_msg void OnChangeReceiveDelayValue(); - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_GT2TESTDLG_H__0E64F324_FFA4_4A94_A87D_75652134DC2D__INCLUDED_) diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test_vs2005.vcproj deleted file mode 100644 index 6e308e85884..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test_vs2005.vcproj +++ /dev/null @@ -1,767 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/gt2test_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/res/gt2test.ico b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/res/gt2test.ico deleted file mode 100644 index 7eef0bcbe65..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/res/gt2test.ico and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/res/gt2test.rc2 b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/res/gt2test.rc2 deleted file mode 100644 index e79bcfd7233..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/res/gt2test.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// GT2TEST.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/resource.h b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/resource.h deleted file mode 100644 index 69de22af997..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2test/resource.h +++ /dev/null @@ -1,73 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by gt2test.rc -// -#define IDD_GT2TEST_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_ADDRESS_IP 1000 -#define IDC_ADDRESS_PORT 1001 -#define IDC_ADDRESS_TO 1002 -#define IDC_ADDRESS_FROM 1003 -#define IDC_ADDRESS_STRING 1004 -#define IDC_GET_IP_HOST_INFO 1005 -#define IDC_GET_STRING_HOST_INFO 1006 -#define IDC_ADDRESS_HOSTNAME 1007 -#define IDC_CREATE_SOCKET 1008 -#define IDC_LOCAL_ADDRESS 1009 -#define IDC_ADDRESS_ALIASES 1010 -#define IDC_ADDRESS_IPS 1011 -#define IDC_IN_BUFFER_SIZE 1012 -#define IDC_OUT_BUFFER_SIZE 1013 -#define IDC_CLOSE_SOCKET 1014 -#define IDC_THINK 1015 -#define IDC_ALWAYS_THINK 1016 -#define IDC_CONNECT 1017 -#define IDC_REMOTE_ADDRESS 1018 -#define IDC_BLOCKING 1019 -#define IDC_CLOSE_ALL_CONNECTIONS 1020 -#define IDC_CLOSE_ALL_CONNECTIONS_HARD 1021 -#define IDC_LISTEN 1022 -#define IDC_ACCEPT_ALL 1023 -#define IDC_REJECT_ALL 1024 -#define IDC_PROMPT 1025 -#define IDC_REJECT_REASON 1026 -#define IDC_CONNECTIONS 1027 -#define IDC_CONNECTING 1028 -#define IDC_CONNECTED 1029 -#define IDC_CLOSING 1030 -#define IDC_CLOSED 1031 -#define IDC_MESSAGES 1032 -#define IDC_RELIABLE 1033 -#define IDC_SEND 1034 -#define IDC_MESSAGE 1035 -#define IDC_PING 1036 -#define IDC_CLOSE_CONNECTION_HARD 1037 -#define IDC_CONNECT_MESSAGE 1038 -#define IDC_SEND_DROP_VALUE 1039 -#define IDC_CLOSE_CONNECTION 1040 -#define IDC_SEND_ROT13 1041 -#define IDC_SEND_DELAY_VALUE 1042 -#define IDC_RECEIVE_DROP_VALUE 1043 -#define IDC_RECEIVE_DELAY_VALUE 1044 -#define IDC_SEND_DROP 1045 -#define IDC_SEND_DELAY 1046 -#define IDC_RECEIVE_ROT13 1047 -#define IDC_RECEIVE_DROP 1048 -#define IDC_RECEIVE_DELAY 1049 -#define IDC_TIMEOUT 1050 -#define IDC_LIST1 1051 -#define IDC_INCOMING_BUFFER_PROGRESS 1054 -#define IDC_INCOMING_BUFFER_SIZE 1055 -#define IDC_OUTGOING_BUFFER_PROGRESS 1056 -#define IDC_OUTGOING_BUFFER_SIZE 1057 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 133 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1058 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2linux/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2linux/Makefile deleted file mode 100644 index 9efd38b2d80..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2linux/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -# GameSpy Transport 2 SDK Makefile -# Copyright 2004 GameSpy Industries - -TARGET=gt2testc - -CC=gcc -BASE_CFLAGS=-D_LINUX - -#use these cflags to optimize it -CFLAGS=$(BASE_CFLAGS) -m486 -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -falign-loops=2 \ - -falign-jumps=2 -falign-functions=2 -lpthread -#use these when debugging -#CFLAGS=$(BASE_CFLAGS) -g - -PROG_OBJS = \ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsDebug.o\ - ../../../common/gsMemory.o\ - ../../../common/linux/LinuxCommon.o\ - ../../gt2Auth.o\ - ../../gt2Buffer.o\ - ../../gt2Callback.o\ - ../../gt2Connection.o\ - ../../gt2Filter.o\ - ../../gt2Main.o\ - ../../gt2Message.o\ - ../../gt2Socket.o\ - ../../gt2Encode.o\ - ../../gt2Utility.o\ - ../$(TARGET).o - -############################################################################# -# SETUP AND BUILD -############################################################################# - -$(TARGET): $(PROG_OBJS) - $(CC) $(CFLAGS) -o $@ $(PROG_OBJS) - -############################################################################# -# MISC -############################################################################# - -clean: - rm -f $(PROG_OBJS) - -depend: - gcc -MM $(PROG_OBJS:.o=.c) - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2macosx/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2macosx/Makefile deleted file mode 100644 index ae863a65505..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2macosx/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# GameSpy Transport 2 SDK Makefile - Mac OSX -# Copyright 2006 GameSpy Industries - -PROJECT=gt2testc - -PROG_OBJS = \ - ../../../hashtable.o\ - ../../../darray.o\ - ../../../md5c.o\ - ../../../common/gsMemory.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsDebug.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/macosx/MacOSXCommon.o\ - ../../gt2Auth.o\ - ../../gt2Buffer.o\ - ../../gt2Callback.o\ - ../../gt2Connection.o\ - ../../gt2Filter.o\ - ../../gt2Main.o\ - ../../gt2Message.o\ - ../../gt2Socket.o\ - ../../gt2Encode.o\ - ../../gt2Utility.o\ - ../gt2testc.o - - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/macosx/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/Nitro.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/Nitro.lcf deleted file mode 100644 index 998f6b00259..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/Nitro.lcf +++ /dev/null @@ -1,493 +0,0 @@ -#--------------------------------------------------------------------------- -# Project: NitroSDK - tools - makelcf -# File: ARM9-TS.lcf.template -# -# Copyright 2003-2006 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ARM9-TS.lcf.template,v $ -# Revision 1.34 04/06/2006 09:02:36 kitase_hirotake -# support for .itcm.bss and .dtcm.bss -# -# Revision 1.33 03/30/2006 23:59:22 AM yasu -# changed creation year -# -# Revision 1.32 03/29/2006 13:14:22 AM yasu -# support for overlays in CWVER 2.x -# -# Revision 1.31 11/24/2005 01:16:47 yada -# change start address of mainEX arena from 0x2400000 to 0x23e0000 -# -# Revision 1.30 09/02/2005 04:14:22 AM yasu -# Old symbols were redefined so they can be used even under SDK2.2 -# -# Revision 1.29 08/31/2005 09:34:57 AM yasu -# Corrected a problem where code would not function normally when using section names such as section_BSS -# -# Revision 1.28 08/26/2005 11:22:16 AM yasu -# overlay support for ITCM/DTCM -# -# Revision 1.27 06/20/2005 12:29:20 AM yasu -# Changed Surffix to Suffix -# -# Revision 1.26 06/14/2005 09:03:42 yada -# fix around minus value of SDK_STACKSIZE -# -# Revision 1.25 04/13/2005 12:51:00 terui -# Change SDK_AUTOLOAD.DTCM.START 0x027c0000 -> 0x027e0000 -# -# Revision 1.24 03/30/2005 00:02:14 yosizaki -# fix copyright header. -# -# Revision 1.23 03/25/2005 12:54:59 AM yasu -# Include .version section -# -# Revision 1.22 10/03/2004 02:00:56 AM yasu -# Output component file list for compstatic tool -# -# Revision 1.21 09/27/2004 05:28:21 AM yasu -# Support .sinit -# -# Revision 1.20 09/09/2004 11:49:20 AM yasu -# Support compstatic in default -# -# Revision 1.19 09/06/2004 06:40:00 AM yasu -# Add labels for digest -# -# Revision 1.18 08/20/2004 06:19:59 AM yasu -# DTCM moves to 0x027c0000 at default -# -# Revision 1.17 08/02/2004 10:38:53 AM yasu -# Add autoload-done callback address in overlaydefs -# -# Revision 1.16 07/26/2004 02:22:32 AM yasu -# Change DTCM address to 0x023c0000 -# -# Revision 1.15 07/26/2004 00:08:27 AM yasu -# Fix label of exception table -# -# Revision 1.14 07/24/2004 05:42:25 AM yasu -# Set default values for SDK_AUTOGEN_xTCM_START -# -# Revision 1.13 07/23/2004 11:32:14 AM yasu -# Define labels for __exception_table_start__ and _end__ -# -# Revision 1.12 07/12/2004 12:21:08 AM yasu -# Check size of ITCM/DTCM -# -# Revision 1.11 07/10/2004 04:10:26 AM yasu -# Support command 'Library' -# -# Revision 1.10 07/02/2004 08:13:02 AM yasu -# Support OBJECT( ) -# -# Revision 1.9 07/01/2004 12:54:38 yasu -# support ITCM/DTCM/WRAM autoload -# -# Revision 1.8 07/01/2004 10:41:46 yasu -# support autoload -# -# Revision 1.7 06/02/2004 07:35:37 yasu -# Set libsyscall.a in FORCE_ACTIVE -# Put NitroMain at the top of ROM image -# -# Revision 1.6 06/02/2004 04:56:28 yasu -# Change to fit to new ROM map of TS -# -# Revision 1.5 2004/06/01 06:12:00 miya -# add padding at top of ROM image. -# -# Revision 1.4 04/26/2004 12:16:48 yasu -# add KEEP_SECTIONS -# -# Revision 1.3 04/20/2004 07:41:32 yasu -# Set STATICINIT instead of .ctor temporarily -# -# Revision 1.2 04/14/2004 07:16:42 yasu -# add ALIGN(32) for convenience to handle cache line -# -# Revision 1.1 04/06/2004 01:59:54 yasu -# newly added -# -# $NoKeywords: $ -#--------------------------------------------------------------------------- -MEMORY -{ - main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin - ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin - DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - - main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin - main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin - dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 - arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 - arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0 - arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0 - arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0 - binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files - check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check - check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check -} - -FORCE_ACTIVE -{ - SVC_SoftReset -} - -KEEP_SECTION -{ - .sinit -} - -SECTIONS -{ - ############################ STATIC ################################# - .main: - { - ALIGNALL(4); . = ALIGN(32); # Fit to cache line - - # - # TEXT BLOCK: READ ONLY - # - SDK_STATIC_START =.; - SDK_STATIC_TEXT_START =.; - #:::::::::: text/rodata - libsyscall.a (.text) - crt0.o (.text) - crt0.o (.rodata) - * (.version) - OBJECT(NitroMain,*) - GROUP(ROOT) (.text) - . = ALIGN(4); - * (.exception) - . = ALIGN(4); - SDK_STATIC_ETABLE_START =.; - EXCEPTION - SDK_STATIC_ETABLE_END =.; - . = ALIGN(4); - GROUP(ROOT) (.init) - . = ALIGN(4); - GROUP(ROOT) (.rodata) - . = ALIGN(4); - - SDK_STATIC_SINIT_START =.; - #:::::::::: ctor - GROUP(ROOT) (.ctor) - GROUP(ROOT) (.sinit) - WRITEW 0; - #:::::::::: ctor - SDK_STATIC_SINIT_END =.; - - #:::::::::: text/rodata - . = ALIGN(32); - SDK_STATIC_TEXT_END =.; - - # - # DATA BLOCK: READ WRITE - # - SDK_STATIC_DATA_START =.; - #:::::::::: data - GROUP(ROOT) (.sdata) - . = ALIGN(4); - GROUP(ROOT) (.data) - . = ALIGN(4); - SDK_OVERLAY_DIGEST =.; - # NO DIGEST - SDK_OVERLAY_DIGEST_END =.; - #:::::::::: data - . = ALIGN(32); - SDK_STATIC_DATA_END =.; - SDK_STATIC_END =.; - - SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; - SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; - SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; - __sinit__ = SDK_STATIC_SINIT_START; # for static initializer - __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table - __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table - } > main - - .main.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_STATIC_BSS_START =.; - #:::::::::: bss - GROUP(ROOT) (.sbss) - . = ALIGN(4); - GROUP(ROOT) (.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_STATIC_BSS_END = .; - SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; - - } >> main - - - ############################ AUTOLOADS ############################## - SDK_AUTOLOAD.ITCM.START = 0x01ff8000; - SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.SIZE = 0; - SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; - SDK_AUTOLOAD.DTCM.START = 0x027e0000; - SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.SIZE = 0; - SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; - SDK_AUTOLOAD_START = SDK_STATIC_END; - SDK_AUTOLOAD_SIZE = 0; - SDK_AUTOLOAD_NUMBER = 2; - - .ITCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_ITCM_ID =0; - SDK_AUTOLOAD.ITCM.ID =0; - SDK_AUTOLOAD.ITCM.START =.; - SDK_AUTOLOAD.ITCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - * (.itcm) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.ITCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.ITCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.DATA_END =.; - SDK_AUTOLOAD.ITCM.END =.; - - SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START; - SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START; - SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE; - - } > ITCM - - .ITCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.ITCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - * (.itcm.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.BSS_END = .; - - SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START; - - } >> ITCM - - .DTCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_DTCM_ID =1; - SDK_AUTOLOAD.DTCM.ID =1; - SDK_AUTOLOAD.DTCM.START =.; - SDK_AUTOLOAD.DTCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.DTCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.DTCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm) - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.DATA_END =.; - SDK_AUTOLOAD.DTCM.END =.; - - SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START; - SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START; - SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE; - - } > DTCM - - .DTCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.DTCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm.bss) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.BSS_END = .; - - SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START; - - } >> DTCM - - - SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; - SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; - SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; - SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; - SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; - SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; - SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; - SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; - - ############################ AUTOLOAD_INFO ########################## - .binary.AUTOLOAD_INFO: - { - WRITEW ADDR(.ITCM); - WRITEW SDK_AUTOLOAD.ITCM.SIZE; - WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE; - WRITEW ADDR(.DTCM); - WRITEW SDK_AUTOLOAD.DTCM.SIZE; - WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE; - } > binary.AUTOLOAD_INFO - - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - - ############################ STATIC_FOOTER ########################## - .binary.STATIC_FOOTER: - { - WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE - WRITEW _start_ModuleParams - ADDR(.main); - WRITEW 0; # NO DIGEST - } > binary.STATIC_FOOTER - - ############################ OVERLAYS ############################### - SDK_OVERLAY_NUMBER = 0; - - - ############################ MAIN EX ################################## - # MAIN EX Area - .dummy.MAIN_EX: - { - . = ALIGN(32); - } > dummy.MAIN_EX - - ############################ ARENA ################################## - .arena.MAIN: - { - . = ALIGN(32); - SDK_SECTION_ARENA_START =.; - } > arena.MAIN - - .arena.MAIN_EX: - { - . = ALIGN(32); - SDK_SECTION_ARENA_EX_START =.; - } > arena.MAIN_EX - - .arena.ITCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_ITCM_START =.; - } > arena.ITCM - - .arena.DTCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_DTCM_START =.; - } > arena.DTCM - - ############################ OVERLAYDEFS ############################ - .main_defs: - { - ### main module information - WRITEW ADDR(.main); # load address - WRITEW _start; # entry address - WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module - WRITEW _start_AutoloadDoneCallback; # callback autoload done - - ### overlay filename - - } > main_defs - - - ############################ OVERLAYTABLE ########################### - .main_table: - { - - } > main_table - - - ############################ OTHERS ################################# - SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; - SDK_IRQ_STACKSIZE = 4096; # allocated in DTCM - SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM - - # Module filelist - .binary.MODULE_FILES: - { - WRITES ("main.sbin"); - WRITES ("main_defs.sbin"); - WRITES ("main_table.sbin"); - } > binary.MODULE_FILES - - # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM - .check.ITCM: - { - . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; - } > check.ITCM - - SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; - .check.DTCM: - { - . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; - . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; - } > check.DTCM - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/ROM-TS.rsf b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/ROM-TS.rsf deleted file mode 100644 index cec9e1dbf9a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/ROM-TS.rsf +++ /dev/null @@ -1,116 +0,0 @@ -#---------------------------------------------------------------------------- -# Project: NitroSDK - include -# File: ROM-TS.lsf -# -# Copyright 2003-2005 Nintendo. All rights reserved. -# -# These coded insructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ROM-TS.rsf,v $ -# Revision 1.6 2005/04/05 23:52:58 yosizaki -# fix copyright date. -# -# Revision 1.5 2005/04/05 12:16:10 yosizaki -# support RomSpeedType parameter. -# -# Revision 1.4 2004/09/21 02:18:49 yasu -# Add default banner -# -# Revision 1.3 2004/09/09 11:39:09 yasu -# Unified ROM-TS and ROM-TS-C, also ROM-TEG and ROM-TEG-C -# -# Revision 1.2 2004/05/26 12:03:38 yasu -# add :r option to get basename for supporting IDE with makerom -# -# Revision 1.1 2004/04/06 01:59:59 yasu -# newly added -# -# $NoKeywords: $ -#---------------------------------------------------------------------------- -# -# Nitro ROM SPEC FILE -# - -Arm9 -{ - Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" - OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" - OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" - Elf "$(MAKEROM_ARM9:r).nef" -} - -Arm7 -{ - Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" - OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" - OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" - Elf "$(MAKEROM_ARM7:r).nef" -} - -Property -{ - ### - ### Settings for FinalROM - ### - #### BEGIN - # - # TITLE NAME: Your product name within 12bytes - # - #TitleName "YourAppName" - - # - # MAKER CODE: Your company ID# in 2 ascii words - # issued by NINTENDO - # - #MakerCode "00" - - # - # REMASTER VERSION: Mastering version - # - #RomVersion 0 - - # - # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] - # - RomSpeedType $(MAKEROM_ROMSPEED) - - # - # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] - # - #RomSize 128M - #RomSize 256M - - # - # ROM PADDING: TRUE if finalrom - # - #RomFootPadding TRUE - - # - # ROM HEADER TEMPLATE: Provided to every product by NINTENDO - # - #RomHeaderTemplate ./etc/rom_header.template.sbin - - # - # BANNER FILE: generated from Banner Spec File - # - #BannerFile ./etc/myGameBanner.bnr - BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr - - ### - ### - ### - #### END -} - -RomSpec -{ - Offset 0x00000000 - Segment ALL - HostRoot $(MAKEROM_ROMROOT) - Root / - File $(MAKEROM_ROMFILES) -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/gt2nitrocw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/gt2nitrocw.mcp deleted file mode 100644 index bdf4d77eb42..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2nitrocw/gt2nitrocw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2/Makefile deleted file mode 100644 index 01cef12f38b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -#GameSpy.net PS2 Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CLFAGS = - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -SDK_LIBS = - -#Name of the SDK sample -TARGET = gt2testc - -#All the object files needed for this SDK -OBJS = ../../../ps2common/ps2common.o \ - ../../../nonport.o \ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../stringutil.o \ - ../../gt2Auth.o\ - ../../gt2Buffer.o\ - ../../gt2Callback.o\ - ../../gt2Connection.o\ - ../../gt2Encode.o\ - ../../gt2Filter.o\ - ../../gt2Main.o\ - ../../gt2Message.o\ - ../../gt2Socket.o\ - ../../gt2Utility.o\ - crt0.o \ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../ps2common/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2cw/gt2ps2cw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2cw/gt2ps2cw.mcp deleted file mode 100644 index 05a238ea443..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2cw/gt2ps2cw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.dsp deleted file mode 100644 index 198bb33065c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.dsp +++ /dev/null @@ -1,400 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2ps2prodg" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gt2ps2prodg - Win32 Debug_Insock -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2ps2prodg.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2ps2prodg.mak" CFG="gt2ps2prodg - Win32 Debug_Insock" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2ps2prodg - Win32 Debug_EENet" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2ps2prodg - Win32 Debug_Insock" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2ps2prodg - Win32 Debug_SNSystems" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2ps2prodg - Win32 Release_EENet" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2ps2prodg - Win32 Release_Insock" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2ps2prodg - Win32 Release_SNSystems" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2testc/gt2ps2prodg", XREDAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2ps2prodg - Win32 Debug_EENet" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug_EENet" -# PROP BASE Intermediate_Dir "Debug_EENet" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_EENet" -# PROP Intermediate_Dir "Debug_EENet" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Debug/" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "C:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "EENET" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"PS2_EE_Debug\gt2ps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 eenetctl.a ent_smap.a ent_eth.a ent_ppp.a libeenet.a libscf.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_EENet\gt2ps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gt2ps2prodg - Win32 Debug_Insock" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gt2ps2prodg___Win32_Debug_Insock" -# PROP BASE Intermediate_Dir "gt2ps2prodg___Win32_Debug_Insock" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_Insock" -# PROP Intermediate_Dir "Debug_Insock" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "EENET" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "C:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "INSOCK" /D "SN_TARGET_PS2" /D "_DEBUG" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 eenetctl.a ent_smap.a ent_eth.a ent_ppp.a libeenet.a libscf.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_EENet\gt2ps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_Insock\gt2ps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gt2ps2prodg - Win32 Debug_SNSystems" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug_SNSystems" -# PROP BASE Intermediate_Dir "Debug_SNSystems" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug_SNSystems" -# PROP Intermediate_Dir "Debug_SNSystems" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Debug/" /FD /debug /c -# ADD CPP /nologo /W4 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "_DEBUG" /D "SN_TARGET_PS2" /D "SN_SYSTEMS" /FD /debug /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"PS2_EE_Debug\gt2ps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 sneetcp.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /debug /machine:IX86 /out:"Debug_SNSystems\gt2ps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gt2ps2prodg - Win32 Release_EENet" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Release_EENet" -# PROP BASE Intermediate_Dir "Release_EENet" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_EENet" -# PROP Intermediate_Dir "Release_EENet" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Release/" /FD /c -# ADD CPP /nologo /W4 /WX /Od /I "C:\usr\local\sce\ee\include\libeenet" /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "EENET" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"PS2_EE_Release\gt2ps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 eenetctl.a ent_smap.a ent_eth.a ent_ppp.a libeenet.a libscf.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_EENet\gt2ps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gt2ps2prodg - Win32 Release_Insock" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gt2ps2prodg___Win32_Release_Insock" -# PROP BASE Intermediate_Dir "gt2ps2prodg___Win32_Release_Insock" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_Insock" -# PROP Intermediate_Dir "Release_Insock" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "SN_SYSTEMS" /FD /c -# ADD CPP /nologo /W4 /WX /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "INSOCK" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 sneetcp.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_SNSystems\gt2ps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 libinsck.a libnet.a libmrpc.a libkernl.a libcdvd.a libnetif.a netcnfif.a /nologo /pdb:none /machine:IX86 /out:"Release_Insock\gt2ps2prodg.elf" /D:SN_TARGET_PS2 - -!ELSEIF "$(CFG)" == "gt2ps2prodg - Win32 Release_SNSystems" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Release_SNSystems" -# PROP BASE Intermediate_Dir "Release_SNSystems" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Release_SNSystems" -# PROP Intermediate_Dir "Release_SNSystems" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /w /W0 /O2 /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /Fo"PS2_EE_Release/" /FD /c -# ADD CPP /nologo /W4 /WX /Od /I "C:\usr\local\sce\ee\include" /I "C:\usr\local\sce\common\include" /D "SN_TARGET_PS2" /D "SN_SYSTEMS" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"PS2_EE_Release\gt2ps2prodg.elf" /D:SN_TARGET_PS2 -# ADD LINK32 sneetcp.a libcdvd.a libsn.a libgraph.a libdma.a libdev.a libpad.a libpkt.a libvu0.a /nologo /pdb:none /machine:IX86 /out:"Release_SNSystems\gt2ps2prodg.elf" /D:SN_TARGET_PS2 - -!ENDIF - -# Begin Target - -# Name "gt2ps2prodg - Win32 Debug_EENet" -# Name "gt2ps2prodg - Win32 Debug_Insock" -# Name "gt2ps2prodg - Win32 Debug_SNSystems" -# Name "gt2ps2prodg - Win32 Release_EENet" -# Name "gt2ps2prodg - Win32 Release_Insock" -# Name "gt2ps2prodg - Win32 Release_SNSystems" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\gt2testc.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\ps2\ps2common.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\..\common\ps2\prodg\PS2_in_VC.h -# End Source File -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2Utility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\..\hashtable.h -# End Source File -# End Group -# Begin Source File - -SOURCE=c:\usr\local\sce\ee\lib\app.cmd -# End Source File -# Begin Source File - -SOURCE=c:\usr\local\sce\ee\lib\crt0.s -# End Source File -# Begin Source File - -SOURCE=..\..\..\ps2common\prodg\ps2.lk -# End Source File -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.dsw deleted file mode 100644 index 86bed9ad8dc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.dsw +++ /dev/null @@ -1,37 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "gt2ps2prodg"=.\gt2ps2prodg.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - "$/Gamespy/GOA/gt2/gt2testc/gt2ps2prodg", XREDAAAA - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - "$/gamespy/goa/gt2/gt2testc/gt2ps2prodg", XREDAAAA - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.sln deleted file mode 100644 index 3cac2d268fe..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.sln +++ /dev/null @@ -1,45 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2ps2prodg", "gt2ps2prodg.vcproj", "{CC62E025-D4AD-43F7-BE17-F7021434FE2C}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 1 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfsapp1:8080/ - SccProjectUniqueName0 = gt2ps2prodg.vcproj - SccProjectName0 = . - SccAuxPath0 = http://tfsapp1:8080 - SccLocalPath0 = . - SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS2 EENET Debug|Win32 = PS2 EENET Debug|Win32 - PS2 EENET Release|Win32 = PS2 EENET Release|Win32 - PS2 INET Debug|Win32 = PS2 INET Debug|Win32 - PS2 INET Release|Win32 = PS2 INET Release|Win32 - PS2 SN Systems Debug|Win32 = PS2 SN Systems Debug|Win32 - PS2 SN Systems Release|Win32 = PS2 SN Systems Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 EENET Debug|Win32.ActiveCfg = PS2 EENET Debug|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 EENET Debug|Win32.Build.0 = PS2 EENET Debug|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 EENET Release|Win32.ActiveCfg = PS2 EENET Release|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 EENET Release|Win32.Build.0 = PS2 EENET Release|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 INET Debug|Win32.ActiveCfg = PS2 INET Debug|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 INET Debug|Win32.Build.0 = PS2 INET Debug|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 INET Release|Win32.ActiveCfg = PS2 INET Release|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 INET Release|Win32.Build.0 = PS2 INET Release|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 SN Systems Debug|Win32.ActiveCfg = PS2 SN Systems Debug|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 SN Systems Debug|Win32.Build.0 = PS2 SN Systems Debug|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 SN Systems Release|Win32.ActiveCfg = PS2 EENET Release|Win32 - {CC62E025-D4AD-43F7-BE17-F7021434FE2C}.PS2 SN Systems Release|Win32.Build.0 = PS2 EENET Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.vcproj deleted file mode 100644 index 1cfdedd2905..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps2prodg/gt2ps2prodg.vcproj +++ /dev/null @@ -1,700 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3/Makefile deleted file mode 100644 index 5fac27a9a91..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -#GameSpy.net PS3 Makefile - -#SDK-specific compiler flags -#If the SDK uses Unique IDs, add "-DUNIQUEID" -SDK_CFLAGS = -DGSI_COMMON_DEBUG - -#SDK-specific libraries -#If the SDK needs Logitech audio libraries, add "$(LIBDIR)/liblgaud.a" -SDK_LIBS = - -#Name of the SDK sample -TARGET = gt2testc - -#All the object files needed for this SDK -OBJS = ../../../common/ps3/ps3common.o \ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o \ - ../../../common/gsPlatformThread.o \ - ../../../common/gsPlatformUtil.o \ - ../../../common/gsAvailable.o \ - ../../../common/gsMemory.o \ - ../../../common/gsDebug.o \ - ../../../common/gsStringUtil.o \ - ../../../darray.o\ - ../../../hashtable.o\ - ../../gt2Auth.o\ - ../../gt2Buffer.o\ - ../../gt2Callback.o\ - ../../gt2Connection.o\ - ../../gt2Encode.o\ - ../../gt2Filter.o\ - ../../gt2Main.o\ - ../../gt2Message.o\ - ../../gt2Socket.o\ - ../../gt2Utility.o\ - ../$(TARGET).o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/ps3/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3prodg/gt2ps3prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3prodg/gt2ps3prodg.sln deleted file mode 100644 index 4869c9d367f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3prodg/gt2ps3prodg.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2ps3prodg", "gt2ps3prodg.vcproj", "{A089D0F3-E861-4309-89A4-A47A61401A3D}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gt2ps3prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS3 Debug|Win32 = PS3 Debug|Win32 - PS3 Release|Win32 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.ActiveCfg = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.Build.0 = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.ActiveCfg = PS3 Release|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.Build.0 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3prodg/gt2ps3prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3prodg/gt2ps3prodg.vcproj deleted file mode 100644 index 7df1c42a776..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2ps3prodg/gt2ps3prodg.vcproj +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2pspprodg/gt2pspprodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2pspprodg/gt2pspprodg.sln deleted file mode 100644 index 5cfc8a66752..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2pspprodg/gt2pspprodg.sln +++ /dev/null @@ -1,34 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2pspprodg", "gt2pspprodg.vcproj", "{1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = gt2pspprodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PSP Debug Opt|Win32 = PSP Debug Opt|Win32 - PSP Debug|Win32 = PSP Debug|Win32 - PSP Release|Win32 = PSP Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}.PSP Debug Opt|Win32.ActiveCfg = PSP Debug Opt|Win32 - {1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}.PSP Debug Opt|Win32.Build.0 = PSP Debug Opt|Win32 - {1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}.PSP Debug|Win32.ActiveCfg = PSP Debug|Win32 - {1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}.PSP Debug|Win32.Build.0 = PSP Debug|Win32 - {1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}.PSP Release|Win32.ActiveCfg = PSP Release|Win32 - {1B0F9B5E-A560-4194-9C31-2A70CD3BABB1}.PSP Release|Win32.Build.0 = PSP Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2pspprodg/gt2pspprodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2pspprodg/gt2pspprodg.vcproj deleted file mode 100644 index b6ea2988bb7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2pspprodg/gt2pspprodg.vcproj +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2revolutioncw/gt2revolutioncw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2revolutioncw/gt2revolutioncw.mcp deleted file mode 100644 index e82890dfd63..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2revolutioncw/gt2revolutioncw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc.c b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc.c deleted file mode 100644 index 0efe8b08efc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc.c +++ /dev/null @@ -1,513 +0,0 @@ -#include -#include -#include -#include "../gt2.h" -#include "../gt2Encode.h" - -#define TEST_ENCODE_DECODE - -#ifdef UNDER_CE - void RetailOutputA(CHAR *tszErr, ...); - #define printf RetailOutputA -#elif defined(_NITRO) - #include "../../common/nitro/screen.h" - #define printf Printf - #define vprintf VPrintf -#endif - -#define FILL_IN "fill me in" - -typedef struct Message -{ - GT2Bool valid; - char * data; - int len; - GT2Bool reliable; -} Message; - -GT2ConnectionCallbacks connectionCallbacks; -GT2Bool server; -GT2Bool quit; -GT2Bool hardcore; -int messageCount; -unsigned long sendTime; -GT2Connection Connection; - -Message initialMessage = { GT2True, "123456789012345", -1 }; - -Message messageList[] = -{ - { GT2True, NULL, 0, GT2True }, // empty - { GT2True, "1", 1, GT2True }, // 1 byte XXX - { GT2True, "1234567", 7, GT2True }, // 7 bytes XXX - { GT2True, "12345678901234567890123456789012345678901234567890", 50, GT2True }, // 50 bytes - { GT2True, FILL_IN, 128, GT2True }, - { GT2True, FILL_IN, 256, GT2True }, - { GT2True, FILL_IN, 512, GT2True }, - { GT2True, FILL_IN, 768, GT2True }, - { GT2True, FILL_IN, 1024, GT2True }, - { GT2True, FILL_IN, 1400, GT2True }, -#if !defined(_NITRO) - { GT2True, FILL_IN, 2047, GT2True }, - { GT2True, FILL_IN, (3 * 1024) - 1, GT2True }, -#if !defined(_REVOLUTION) - { GT2True, FILL_IN, (5 * 1024) - 1, GT2True }, - { GT2True, FILL_IN, (7 * 1024) - 1, GT2True }, -#if !defined(_PS2) && !defined(_PSP) - { GT2True, FILL_IN, (8 * 1024) + 1017, GT2True }, -#if !defined(_MACOSX) && !defined(_PS3) // Maximum send size for PS3 is 9216 - { GT2True, FILL_IN, (9 * 1024) - 1, GT2True }, - { GT2True, FILL_IN, (32 * 1024) - 1, GT2True }, -#endif -#endif -#endif -#endif -#if !defined(_NITRO) && !defined(_REVOLUTION) - { GT2True, NULL, 0, GT2False }, // empty -#endif - { GT2True, "1", 1, GT2False }, // 1 byte XXX - { GT2True, "1234567", 7, GT2False }, // 7 bytes XXX - { GT2True, "12345678901234567890123456789012345678901234567890", 50, GT2False }, // 50 bytes - { GT2True, FILL_IN, 128, GT2False }, - { GT2True, FILL_IN, 256, GT2False }, - { GT2True, FILL_IN, 512, GT2False }, - { GT2True, FILL_IN, 768, GT2False }, - { GT2True, FILL_IN, 1024, GT2False }, - { GT2True, FILL_IN, 1400, GT2False }, -#if !defined(_NITRO) - { GT2True, FILL_IN, 2047, GT2False }, -#if !defined(_REVOLUTION) - { GT2True, FILL_IN, (5 * 1024) - 1, GT2False }, - { GT2True, FILL_IN, (7 * 1024) - 1, GT2False }, -#if !defined(_PS2) && !defined(_PSP) - { GT2True, FILL_IN, (9 * 1024), GT2False }, -#if !defined (_MACOSX) && !defined(_PS3) // Maximum send size for PS3 is 9216 - { GT2True, FILL_IN, (9 * 1024) + 1, GT2False }, -#endif -#endif -#endif -#endif - - { GT2False } -}; - -Message hardcoreMessage = { GT2True, "12345678901234567890123456789012345678901234567890", 50, GT2True }; - -static void ConnectedCallback(GT2Connection connection, GT2Result result, GT2Byte * message, int len) -{ - if(result != GT2Success) - { - if (!message) - message = (GT2Byte *)""; - printf("Connect failed (%d): %s\n", result, message); - quit = GT2True; - return; - } - - printf("Connected\n"); - - GSI_UNUSED(connection); - GSI_UNUSED(len); -} - -static void ReceivedCallback( GT2Connection connection, GT2Byte * message, int len, GT2Bool reliable) -{ - Message * pcurr; - - // Server echo. - if(server) - { - messageCount++; - - if(!hardcore || !(messageCount % 100)) - printf("Got message %d (%d bytes, %s)\n", messageCount, len, reliable ? "reliable" : "unreliable"); - - gt2Send(connection, message, len, reliable); - } - else - { - if(hardcore) - { - pcurr = &hardcoreMessage; - messageCount++; - } - else - { - pcurr = &messageList[messageCount]; - } - - // Check this against the message list. - if((pcurr->reliable != reliable) || (pcurr->len != len) || (memcmp(pcurr->data, message, (size_t)len) != 0)) - { - printf("Message check failed (%d, %d)\n",pcurr->len, len); - } - else - { - if(!hardcore || !(messageCount % 100)) - { - printf("Message %d validated (%d bytes, %s)", messageCount + 1, len, reliable ? "reliable" : "unreliable"); - if(server) - printf("\n"); - else - printf(": %lu ms\n", current_time() - sendTime); - } - } - sendTime = 0; - } -} - -static void ClosedCallback(GT2Connection connection, GT2CloseReason reason) -{ - // Print out the reason. - printf("Connection closed: "); - if(reason == GT2LocalClose) - printf("Local Close\n"); - else if(reason == GT2RemoteClose) - printf("Remote Close\n"); - else if(reason == GT2CommunicationError) - printf("Communication Error\n"); - else if(reason == GT2SocketError) - printf("Socket Error\n"); - else if(reason == GT2NotEnoughMemory) - printf("Not Enough Memory\n"); - - quit = GT2True; - Connection = NULL; - - GSI_UNUSED(connection); -} - -static void PingCallback(GT2Connection connection, int latency) -{ - printf("Ping: %dms\n", latency); - - GSI_UNUSED(connection); -} - -static void SocketErrorCallback(GT2Socket socket) -{ - printf("SOCKET ERROR!!\n"); - - GSI_UNUSED(socket); -} - -static void ConnectAttemptCallback(GT2Socket socket, GT2Connection connection, unsigned int ip, unsigned short port, int latency, GT2Byte * message, int len) -{ - if((len == ((int)strlen(initialMessage.data) + 1)) && (memcmp(message, initialMessage.data, (size_t)len) == 0)) - { - gt2Accept(connection, &connectionCallbacks); - printf("Accepted connection from %s\n",gt2AddressToString(ip,port,NULL)); - } - else - { - gt2Reject(connection, (const GT2Byte *)"Invalid intial message.", -1); - printf("Rejected connection\n"); - } - - GSI_UNUSED(socket); - GSI_UNUSED(latency); -} - -static void SendDumpCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - GT2Bool reset, - const GT2Byte * message, - int len -) -{ - char buffer[128]; - sprintf(buffer, "SEND %p %p %s %d\n", socket, connection, gt2AddressToString(ip, port, NULL), len); -#ifdef WIN32 - OutputDebugString(buffer); -#endif - - GSI_UNUSED(reset); - GSI_UNUSED(message); -} - -static void ReceiveDumpCallback -( - GT2Socket socket, - GT2Connection connection, - unsigned int ip, - unsigned short port, - GT2Bool reset, - const GT2Byte * message, - int len -) -{ - char buffer[128]; - if(reset) - sprintf(buffer, "RECV %p %p %s RESET\n", socket, connection, gt2AddressToString(ip, port, NULL)); - else - sprintf(buffer, "RECV %p %p %s %d\n", socket, connection, gt2AddressToString(ip, port, NULL), len); -#ifdef WIN32 - OutputDebugString(buffer); -#endif - - GSI_UNUSED(message); -} - -#ifdef TEST_ENCODE_DECODE - -static void EncodeTest() -{ - const char encodestr[] = {GT_INT,GT_UINT,GT_SHORT,GT_USHORT,GT_CHAR,GT_UCHAR, - GT_FLOAT,GT_DOUBLE,GT_CSTR,GT_DBSTR,GT_RAW,0}; - const char encodestr2[] = {GT_CSTR_PTR,GT_DBSTR_PTR,GT_RAW_PTR,0}; - const char bitstr[] = {GT_BIT,GT_BIT,GT_BIT,GT_BIT,GT_BIT,GT_BIT,GT_BIT,GT_BIT,GT_BIT,GT_BIT,0}; - int i = -30, i2; - unsigned int uint = 300, uint2; - short sh = 10000, sh2; - unsigned short ush = 23500, ush2; - char ch = 23, ch2; - unsigned char uch = 129, uch2; - float f = 10.0f, f2; - double d = 1.12312312, d2; - char mystr[] = "this is a test string, this is only a test", mystr2[255], *mystr3; - short dbstr[] = {1234,5678,9012,1010,3210,1341,0}, dbstr2[255], *dbstr3; - char rawstr[] = "raw\001\000\001data", rawstr2[255], *rawstr3; - int rawdatalen = 10, rawdatalen2 = 10; - char bits[]={1,0,1,0,1,0,1,1,0,1},bits2[20]; - char outBuff[1024]; - int retlen, retlen2; - int temp; - - //retlen = gtEncode(0,"fs",outBuff,100,10.0f,mystr); - retlen = gtEncode(0,encodestr,outBuff,1024,i,uint,sh,ush,ch,uch,f,d,mystr,dbstr,rawstr,rawdatalen); - retlen2 = gtDecode(encodestr,outBuff, retlen,&i2,&uint2,&sh2,&ush2,&ch2,&uch2,&f2,&d2,mystr2,dbstr2, - rawstr2,&rawdatalen2); - printf("i=%d,i2=%d\nuint=%u,uint2=%u\nsh=%d,sh2=%d\nush=%u,ush2=%u\nch=%d,ch2=%d\nuch=%u,uch2=%u\nf=%f,f2=%f\nd=%f,d2=%f\n", - i,i2,uint,uint2,sh,sh2,ush,ush2,ch,ch2,uch,uch2,f,f2,d,d2); - printf("mystr =%s\nmystr2=%s\n",mystr,mystr2); - for (temp = 0; dbstr[temp] != 0; temp++) - printf("dbstr[%d]=%d,dbstr2[%d]=%d ",temp,dbstr[temp],temp,dbstr2[temp]); - printf("\nrawdatalen=%d,rawdatalen2=%d\n",rawdatalen,rawdatalen2); - for (temp = 0 ; temp < rawdatalen ; temp++) - printf("rawstr[%d]=%d,rawstr2[%d]=%d ",temp,rawstr[temp],temp,rawstr2[temp]); - printf("\nretlen=%d,retlen2=%d\n",retlen,retlen2); - retlen = gtEncode(0,bitstr,outBuff,1024,bits[0],bits[1],bits[2],bits[3],bits[4],bits[5],bits[6], - bits[7],bits[8],bits[9]); - retlen2 = gtDecode(bitstr,outBuff,retlen,bits2,bits2+1,bits2+2,bits2+3,bits2+4,bits2+5,bits2+6,bits2+7, - bits2+8,bits2+9); - for (temp = 0 ; temp < 10 ; temp++) - printf("bits[%d]=%d,bits2[%d]=%d ",temp,bits[temp],temp,bits2[temp]); - printf("\nretlen=%d,retlen2=%d\n",retlen,retlen2); - retlen = gtEncode(0,encodestr2,outBuff,1024,mystr,dbstr,rawstr,rawdatalen); - retlen2 = gtDecode(encodestr2,outBuff,retlen,&mystr3,&dbstr3,&rawstr3,&rawdatalen2); - printf("mystr =%s\nmystr3=%s\n",mystr,mystr3); - #ifdef ALIGNED_COPY - for (temp = 0; dbstr[temp] != 0; temp++) - { - memcpy(&sh,&dbstr[temp],sizeof(sh)); - memcpy(&sh2,&dbstr3[temp],sizeof(sh2)); - printf("dbstr[%d]=%d,dbstr3[%d]=%d ",temp,sh, temp,sh2); - } - #else - for (temp = 0; dbstr[temp] != 0; temp++) - printf("dbstr[%d]=%d,dbstr3[%d]=%d ",temp,dbstr[temp],temp,dbstr3[temp]); - #endif - printf("\nrawdatalen=%d,rawdatalen2=%d\n",rawdatalen,rawdatalen2); - for (temp = 0 ; temp < rawdatalen ; temp++) - printf("rawstr[%d]=%d,rawstr3[%d]=%d ",temp,rawstr[temp],temp,rawstr3[temp]); - printf("\nretlen=%d,retlen2=%d\n",retlen,retlen2); - - -} -#endif - -#ifdef __MWERKS__ // CodeWarrior will warn if function not prototyped - int test_main(int argc, char **argv); -#endif - -int test_main(int argc, char **argv) -{ - GT2Socket socket = NULL; - char localAddress[128] = ""; - char remoteAddress[128] = ""; - GT2Bool gotIt = GT2False; - Message * message; - int count = 0; - int msgloopcount = 0; - GT2Result result; - int i; - -#ifdef TEST_ENCODE_DECODE - EncodeTest(); -#endif - - // Set the callbacks. - memset(&connectionCallbacks, 0, sizeof(GT2ConnectionCallbacks)); - connectionCallbacks.connected = ConnectedCallback; - connectionCallbacks.received = ReceivedCallback; - connectionCallbacks.closed = ClosedCallback; - connectionCallbacks.ping = PingCallback; - - // Fill in long messages. - for(message = messageList ; message->valid ; message++) - { - if(message->data && (strcmp(message->data, FILL_IN) == 0)) - { - message->data = (char *)malloc((size_t)message->len); - for(i = 0 ; i < message->len ; i++) - message->data[i] = (char)('0' + (i % 10)); - } - } - - // Check the args. - if(argc > 1) - { - argc = 1; - if(strncmp(argv[argc], "-h", 2) == 0) - { - hardcore = GT2True; - argc++; - } - - // Check for listen. - if(strncmp(argv[argc], "-l", 2) == 0) - { - gotIt = GT2True; - server = GT2True; - argc++; - - if(argv[argc]) - strcpy(localAddress, argv[argc++]); - } - // Check for connect. - else if(strncmp(argv[argc], "-c", 2) == 0) - { - gotIt = GT2True; - server = GT2False; - argc++; - - if(argv[argc]) - strcpy(remoteAddress, argv[argc++]); - if(argv[argc]) - strcpy(localAddress, argv[argc++]); - } - } - - // Check if we haven't decided yet. - if(!gotIt) - { -#if 1 - server = GT2True; - strcpy(localAddress, ":12345"); -#else - server = GT2False; - strcpy(localAddress, ""); - strcpy(remoteAddress, "192.168.0.3:12345"); -#endif - } - - do - { - // create the socket - result = gt2CreateSocket(&socket, localAddress, 0, 0, SocketErrorCallback); - if(result != GT2Success) - { - printf("Failed to create socket! (%d)\n", result); - return 1; - } - - // set the dump callbacks - gt2SetSendDump(socket, SendDumpCallback); - gt2SetReceiveDump(socket, ReceiveDumpCallback); - - // listen if we're the server - if(server) - { - gt2Listen(socket, ConnectAttemptCallback); - - printf("Listening for incoming connections [%s]...\n", localAddress); - while(gsi_true) ///now we just think forever! - { - gt2Think(socket); - if(hardcore) - msleep(5); - else - msleep(20); - } - } - - //the rest is for client only - quit = GT2False; - printf("Attemping to connect to %s (max 10 sec)...\n", remoteAddress); - result = gt2Connect(socket, &Connection, remoteAddress, (GT2Byte *)initialMessage.data, initialMessage.len, 10000, &connectionCallbacks, GT2True); - if(result != GT2Success) - { - printf("gt2Connect failed! (%d)\n", result); - return 1; - } - - gt2Ping(Connection); - - if(quit) - return 1; - - messageCount = 0; - msgloopcount = 0; - quit = GT2False; - while(!quit && msgloopcount < 2) - { - unsigned long maxWait; - if(messageCount == 100000) - { - messageCount = 0; - msgloopcount++; - } - if(hardcore) - { - message = &hardcoreMessage; - } - else - { - message = &messageList[messageCount]; - if(!message->valid) - { - msgloopcount++; - continue; - } - } - - gt2Send(Connection, (GT2Byte *)message->data, message->len, message->reliable); - if(hardcore) - { - do - { - gt2Think(socket); - msleep(5); - } - while(gt2GetOutgoingBufferFreeSpace(Connection) < 100); - } - else - { - sendTime = current_time(); - maxWait = (unsigned long)((message->reliable) ? 120000 : 20000); - while (sendTime != 0 && current_time() - sendTime < maxWait && !quit) //wait a max of 20 sec for the reply - { - gt2Think(socket); - msleep(5); - } - if (sendTime != 0) - { - printf("Sending %d bytes %s failed!!\n",message->len, message->reliable ? "reliable" : "unreliable"); - } - messageCount++; - } - - } - if(Connection) - gt2CloseConnection(Connection); - } - while(!server && (++count < 3)); //if client do the sequence 3 times - - gt2CloseSocket(socket); - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc.dsp deleted file mode 100644 index ed5eb9778b1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc.dsp +++ /dev/null @@ -1,326 +0,0 @@ -# Microsoft Developer Studio Project File - Name="gt2testc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=gt2testc - Win32 Unicode Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "gt2testc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "gt2testc.mak" CFG="gt2testc - Win32 Unicode Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "gt2testc - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2testc - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2testc - Win32 Unicode Release" (based on "Win32 (x86) Console Application") -!MESSAGE "gt2testc - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/Gamespy/GOA/gt2/gt2testc", LPOCAAAA" -# PROP Scc_LocalPath "." -CPP=snCl.exe -RSC=rc.exe - -!IF "$(CFG)" == "gt2testc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gt2testc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "gt2testc - Win32 Unicode Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "gt2testc___Win32_Unicode_Release" -# PROP BASE Intermediate_Dir "gt2testc___Win32_Unicode_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "UnicodeRelease" -# PROP Intermediate_Dir "UnicodeRelease" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_UNICODE" /YX /FD /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "gt2testc - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "gt2testc___Win32_Unicode_Debug" -# PROP BASE Intermediate_Dir "gt2testc___Win32_Unicode_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "UnicodeDebug" -# PROP Intermediate_Dir "UnicodeDebug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_UNICODE" /YX /FD /GZ /c -# SUBTRACT CPP /Fr -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=snBsc.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=snLink.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "gt2testc - Win32 Release" -# Name "gt2testc - Win32 Debug" -# Name "gt2testc - Win32 Unicode Release" -# Name "gt2testc - Win32 Unicode Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\gt2testc.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "TransportSDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\gt2Utility.h -# End Source File -# End Group -# Begin Group "GsCommon" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\win32\Win32Common.c -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc_vs2005.vcproj deleted file mode 100644 index 751d1e11384..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc_vs2005.vcproj +++ /dev/null @@ -1,1086 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2testc_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2x360/gt2x360.sln b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2x360/gt2x360.sln deleted file mode 100644 index 97d5a197d8c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2x360/gt2x360.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gt2x360", "gt2x360.vcproj", "{6B1308C6-305D-4242-8819-DDE653878833}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Xbox 360 = Debug|Xbox 360 - Profile_FastCap|Xbox 360 = Profile_FastCap|Xbox 360 - Profile|Xbox 360 = Profile|Xbox 360 - Release_LTCG|Xbox 360 = Release_LTCG|Xbox 360 - Release|Xbox 360 = Release|Xbox 360 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6B1308C6-305D-4242-8819-DDE653878833}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Profile_FastCap|Xbox 360.ActiveCfg = Profile_FastCap|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Profile_FastCap|Xbox 360.Build.0 = Profile_FastCap|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Profile|Xbox 360.ActiveCfg = Profile|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Profile|Xbox 360.Build.0 = Profile|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Release_LTCG|Xbox 360.ActiveCfg = Release_LTCG|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Release_LTCG|Xbox 360.Build.0 = Release_LTCG|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 - {6B1308C6-305D-4242-8819-DDE653878833}.Release|Xbox 360.Build.0 = Release|Xbox 360 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2x360/gt2x360.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2x360/gt2x360.vcproj deleted file mode 100644 index 5c580ace2e8..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/gt2/gt2testc/gt2x360/gt2x360.vcproj +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/hashtable.c b/src/utils/mp_gpprof_server/libraries/gamespy/hashtable.c deleted file mode 100644 index 9313e5031e5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/hashtable.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * - * File: hashtable.c - * --------------- - * David Wright - * 10/8/98 - * - * See hashtable.h for function comments - * Implmentation is straight-forward, using a fixed dynamically allocated - * array for the buckets, and a DArray for each individual bucket - */ - -#include -#include -#include "darray.h" -#include "hashtable.h" - -#ifdef _MFC_MEM_DEBUG -#define _CRTDBG_MAP_ALLOC 1 -#include -#endif - - -#ifdef _NO_NOPORT_H_ - #define gsimalloc malloc - #define gsifree free - #define gsirealloc realloc - #include -#else - #include "nonport.h" //for gsimalloc/realloc/free/assert -#endif - - -struct HashImplementation -{ - DArray *buckets; - int nbuckets; - TableElementFreeFn freefn; - TableHashFn hashfn; - TableCompareFn compfn; -}; - -HashTable TableNew(int elemSize, int nBuckets, - TableHashFn hashFn, TableCompareFn compFn, - TableElementFreeFn freeFn) -{ - return TableNew2(elemSize, nBuckets, 4, hashFn, compFn, freeFn); -} -HashTable TableNew2(int elemSize, int nBuckets, int nChains, - TableHashFn hashFn, TableCompareFn compFn, - TableElementFreeFn freeFn) -{ - HashTable table; - int i; - - assert(hashFn); - assert(compFn); - assert(elemSize); - assert(nBuckets); - - table = (HashTable)gsimalloc(sizeof(struct HashImplementation)); - assert(table); - - table->buckets = (DArray *)gsimalloc(nBuckets * sizeof(DArray)); - assert(table->buckets); - for (i = 0; i < nBuckets; i++) //ArrayNew will assert if allocation fails - table->buckets[i] = ArrayNew(elemSize, nChains, freeFn); - table->nbuckets = nBuckets; - table->freefn = freeFn; - table->compfn = compFn; - table->hashfn = hashFn; - - return table; -} - - -void TableFree(HashTable table) -{ - int i; - - assert(table); - - if (NULL == table ) - return; - - for (i = 0 ; i < table->nbuckets ; i++) - ArrayFree(table->buckets[i]); - gsifree(table->buckets); - gsifree(table); -} - - -int TableCount(HashTable table) -{ - int i, count = 0; - - assert(table); - - if (NULL == table ) - return count; - - for (i = 0 ; i < table->nbuckets ; i++) - count += ArrayLength(table->buckets[i]); - - return count; -} - - -void TableEnter(HashTable table, const void *newElem) -{ - int hash, itempos; - - assert(table); - - if (NULL == table ) - return; - - hash = table->hashfn(newElem, table->nbuckets); - itempos = ArraySearch(table->buckets[hash], newElem, table->compfn, 0,0); - if (itempos == NOT_FOUND) - ArrayAppend(table->buckets[hash], newElem); - else - ArrayReplaceAt(table->buckets[hash], newElem, itempos); -} - -int TableRemove(HashTable table, const void *delElem) -{ - int hash, itempos; - - assert(table); - - if (NULL == table ) - return 0; - - hash = table->hashfn(delElem, table->nbuckets); - itempos = ArraySearch(table->buckets[hash], delElem, table->compfn, 0,0); - if (itempos == NOT_FOUND) - return 0; - else - ArrayDeleteAt(table->buckets[hash], itempos); - return 1; -} - -void *TableLookup(HashTable table, const void *elemKey) -{ - int hash, itempos; - - assert(table); - - if (NULL == table ) - return NULL; - - hash = table->hashfn(elemKey, table->nbuckets); - itempos = ArraySearch(table->buckets[hash], elemKey, table->compfn, 0, - 0); - if (itempos == NOT_FOUND) - return NULL; - else - return ArrayNth(table->buckets[hash], itempos); -} - - -void TableMap(HashTable table, TableMapFn fn, void *clientData) -{ - int i; - - assert(table); - assert(fn); - - if (NULL == table || NULL == fn) - return; - - for (i = 0 ; i < table->nbuckets ; i++) - ArrayMap(table->buckets[i], fn, clientData); - -} - -void TableMapSafe(HashTable table, TableMapFn fn, void *clientData) -{ - int i; - - assert(fn); - - for (i = 0 ; i < table->nbuckets ; i++) - ArrayMapBackwards(table->buckets[i], fn, clientData); - -} - -void * TableMap2(HashTable table, TableMapFn2 fn, void *clientData) -{ - int i; - void * pcurr; - - assert(fn); - - for (i = 0 ; i < table->nbuckets ; i++) - { - pcurr = ArrayMap2(table->buckets[i], fn, clientData); - if(pcurr) - return pcurr; - } - - return NULL; -} - -void * TableMapSafe2(HashTable table, TableMapFn2 fn, void *clientData) -{ - int i; - void * pcurr; - - assert(fn); - - for (i = 0 ; i < table->nbuckets ; i++) - { - pcurr = ArrayMapBackwards2(table->buckets[i], fn, clientData); - if(pcurr) - return pcurr; - } - - return NULL; -} - -void TableClear(HashTable table) -{ - int i; - - for (i = 0 ; i < table->nbuckets ; i++) - ArrayClear(table->buckets[i]); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/hashtable.h b/src/utils/mp_gpprof_server/libraries/gamespy/hashtable.h deleted file mode 100644 index d6c8a4a3c2f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/hashtable.h +++ /dev/null @@ -1,231 +0,0 @@ - #ifndef _HASHTABLE_H -#define _HASHTABLE_H - -/* File: hashtable.h - * ------------------ - * Defines the interface for the HashTable ADT. - * The HashTable allows the client to store any number of elements of any - * type in a hash table for fast storage and retrieval. The client specifies - * the size (in bytes) of the elements that will be stored in the table when - * it is created. Thereafter the client and the HashTable refer to elements - * via (void*) ptrs. The HashTable imposes no upper bound on the number of - * elements and deals with all its own memory management. - * - * The client-supplied information (in the form of the number of buckets - * to use and the hashing function to be applied to each element) is employed - * to divide elements in buckets with hopefully only few collisions, resulting - * in Enter & Lookup performance in constant-time. The HashTable also supports - * iterating over all elements by use of mapping function. - */ - -/* Type: HashTable - * ---------------- - * Defines the HashTable type itself. The client can declare variables of type - * HashTable, but these variables must be initialized with the result of - * TableNew. The HashTable is implemented with pointers, so all client - * copies in variables or parameters will be "shallow" -- they will all - * actually point to the same HashTable structure. Only calls to TableNew - * create new tables. The struct declaration below is "incomplete"- the - * implementation details are literally not visible in the client .h file. - */ -typedef struct HashImplementation *HashTable; - - -/* TableHashFn - * ----------- - * TableHashFn is a pointer to a client-supplied function which the - * HashTable uses to hash elements. The hash function takes a (const void*) - * pointer to an element and the number of buckets and returns an int, - * which represents the hash code for this element. The returned hash code - * should be within the range 0 to numBuckets-1 and should be stable (i.e. - * an element's hash code should not change over time). - * For best performance, the hash function should be designed to - * uniformly distribute elements over the available number of buckets. - */ -typedef int (*TableHashFn)(const void *elem, int numBuckets); - - -/* TableCompareFn - * -------------- - * TableCompareFn is a pointer to a client-supplied function which the - * HashTable uses to compare elements. The comparator takes two - * (const void*) pointers (these will point to elements) and returns an int. - * The comparator should indicate the ordering of the two elements - * using the same convention as the strcmp library function: - * If elem1 is "less than" elem2, return a negative number. - * If elem1 is "greater than" elem2, return a positive number. - * If the two elements are "equal", return 0. - */ -#if defined(WIN32) -// explicitly set __cdecl so that Win devs can change default calling convention -typedef int (__cdecl *TableCompareFn)(const void *elem1, const void *elem2); -#else -typedef int (*TableCompareFn)(const void *elem1, const void *elem2); -#endif - - /* TableMapFn - * ---------- - * TableMapFn defines the space of functions that can be used to map over - * the elements in a HashTable. A map function is called with a pointer to - * the element and a client data pointer passed in from the original caller. - */ -typedef void (*TableMapFn)(void *elem, void *clientData); - - /* TableMapFn2 - * ---------- - * Same as TableMapFn, but can return 0 to stop the mapping. - * Used by TableMap2. - */ -typedef int (*TableMapFn2)(void *elem, void *clientData); - - -/* TableElementFreeFn - * ------------------ - * TableElementFreeFn defines the space of functions that can be used as the - * clean-up function for each element as it is deleted from the array - * or when the entire array of elements is freed. The cleanup function is - * called with a pointer to an element about to be deleted. - */ -typedef void (*TableElementFreeFn)(void *elem); - -#ifdef __cplusplus -extern "C" { -#endif - -/* TableNew - * -------- - * Creates a new HashTable with no entries and returns it. The elemSize - * parameter specifies the number of bytes that a single element of the - * table should take up. For example, if you want to store elements of type - * Binky, you would pass sizeof(Binky) as this parameter. An assert is - * raised if this size is not greater than 0. - * - * The nBuckets parameter specifies the number of buckets that the elements - * will be partitioned into. Once a HashTable is created, this number does - * not change. The nBuckets parameter must be in synch with the behavior of - * the hashFn, which must return a hash code between 0 and nBuckets-1. - * The hashFn parameter specifies the function that is called to retrieve the - * hash code for a given element. See the type declaration of TableHashFn - * above for more information. An assert is raised if nBuckets is not - * greater than 0. - * - * The compFn is used for testing equality between elements. See the - * type declaration for TableCompareFn above for more information. - * - * The elemFreeFn is the function that will be called on an element that is - * about to be overwritten (by a new entry in TableEnter) or on each element - * in the table when the entire table is being freed (using TableFree). This - * function is your chance to do any deallocation/cleanup required, - * (such as freeing any pointers contained in the element). The client can pass - * NULL for the cleanupFn if the elements don't require any handling on free. - * An assert is raised if either the hash or compare functions are NULL. - * - * nChains is the number of chains to allocate initially in each bucket - * - */ - -HashTable TableNew(int elemSize, int nBuckets, - TableHashFn hashFn, TableCompareFn compFn, - TableElementFreeFn freeFn); - -HashTable TableNew2(int elemSize, int nBuckets, int nChains, - TableHashFn hashFn, TableCompareFn compFn, - TableElementFreeFn freeFn); - - - /* TableFree - * ---------- - * Frees up all the memory for the table and its elements. It DOES NOT - * automatically free memory owned by pointers embedded in the elements. This - * would require knowledge of the structure of the elements which the HashTable - * does not have. However, it will iterate over the elements calling - * the elementFreeFn earlier supplied to TableNew and therefore, the client, - * who knows what the elements are,can do the appropriate deallocation of any - * embedded pointers through that function. - * After calling this, the value of what table points to is undefined. - */ -void TableFree(HashTable table); - - -/* TableCount - * ---------- - * Returns the number of elements currently in the table. - */ -int TableCount(HashTable table); - - - -/* TableEnter - * ---------- - * Enters a new element into the table. Uses the hash function to determine - * which bucket to place the new element. Its contents are copied from the - * memory pointed to by newElem. If there is already an element in the table - * which is determined to be equal (using the comparison function) this will - * use the contents of the new element to replace the previous element, - * calling the free function on the replaced element. - */ -void TableEnter(HashTable table, const void *newElem); - -/* TableRemove - * ---------- - * Remove a element frin the table. If the element does not exist - * the function returns 0. If it exists, it returns 1 and calls the - * free function on the removed element. - */ -int TableRemove(HashTable table, const void *delElem); - - -/* TableLookup - * ---------- - * Returns a pointer to the table element which matches the elemKey parameter - * (equality is determined by the comparison function). If there is no - * matching element, returns NULL. Calling this function does not - * re-arrange or change contents of the table or modify elemKey in any way. - */ -void *TableLookup(HashTable table, const void *elemKey); - - - -/* TableMap - * ----------- - * Iterates through each element in the table (in any order) and calls the - * function fn for that element. The function is called with the address of - * the table element and the clientData pointer. The clientData value allows - * the client to pass extra state information to the client-supplied function, - * if necessary. If no client data is required, this argument should be NULL. - * An assert is raised if the map function is NULL. - */ -void TableMap(HashTable table, TableMapFn fn, void *clientData); - -/* TableMapSafe - * ----------- - * Same as TableMap, but allows elements to be freed during the mapping. - */ -void TableMapSafe(HashTable table, TableMapFn fn, void *clientData); - -/* TableMap2 - * ----------- - * Same as TableMap, but allows the mapping to be stopped by returning 0 - * from the mapping function. If the mapping was stopped, the element - * it was stopped at will be returned. If it wasn't stopped, then NULL - * will be returned. - */ -void * TableMap2(HashTable table, TableMapFn2 fn, void *clientData); - -/* TableMapSafe2 - * ----------- - * Same as TableMap2, but allows elements to be freed during the mapping. - */ -void * TableMapSafe2(HashTable table, TableMapFn2 fn, void *clientData); - -/* TableClear - * ----------- - * Clears all the elements in the table without freeing it - */ -void TableClear(HashTable table); - -#ifdef __cplusplus -} -#endif - -#endif //_HASHTABLE_H diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/md5.h b/src/utils/mp_gpprof_server/libraries/gamespy/md5.h deleted file mode 100644 index 0fccee0c12a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/md5.h +++ /dev/null @@ -1,81 +0,0 @@ -/* MD5.H - header file for MD5C.C - */ - -/* Copyright (C) 1991, RSA Data Security, Inc. All rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -/* GLOBAL.H - RSAREF types and constants - */ - -/* PROTOTYPES should be set to one if and only if the compiler supports - function argument prototyping. -The following makes PROTOTYPES default to 0 if it has not already - - been defined with C compiler flags. - */ - -#ifndef _MD5_H_ -#define _MD5_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef PROTOTYPES -#define PROTOTYPES 1 -#endif - -/* POINTER defines a generic pointer type */ -typedef unsigned char *POINTER; - -/* UINT2 defines a two byte word */ -typedef unsigned short int UINT2; - -/* UINT4 defines a four byte word */ -typedef unsigned int UINT4; - -/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. -If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it - returns an empty list. - */ -#if PROTOTYPES -#define PROTO_LIST(list) list -#else -#define PROTO_LIST(list) () -#endif - -/* MD5 context. */ -typedef struct { - UINT4 state[4]; /* state (ABCD) */ - UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ - unsigned char buffer[64]; /* input buffer */ -} MD5_CTX; - -void MD5Init PROTO_LIST ((MD5_CTX *)); -void MD5Update PROTO_LIST ((MD5_CTX *, unsigned char *, unsigned int)); -void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); -void MD5Print PROTO_LIST ((unsigned char [16], char[33])); -void MD5Digest PROTO_LIST ((unsigned char *, unsigned int, char[33])); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/md5c.c b/src/utils/mp_gpprof_server/libraries/gamespy/md5c.c deleted file mode 100644 index de31fc6afc4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/md5c.c +++ /dev/null @@ -1,354 +0,0 @@ -/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm - */ - -/* Copyright (C) 1991, RSA Data Security, Inc. All rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -//#include "global.h" -#include "md5.h" -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(_NITRO) - -/* Constants for MD5Transform routine. - */ -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64])); -static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int)); -static void Decode PROTO_LIST ((UINT4 *, unsigned char *, unsigned int)); -static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int)); -static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int)); - -static unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. - Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - -/* MD5 initialization. Begins an MD5 operation, writing a new context. - */ -void MD5Init (MD5_CTX *context) -{ - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. - */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* MD5 block update operation. Continues an MD5 message-digest operation, - processing another message block, and updating the context. - */ -void MD5Update ( - MD5_CTX *context, /* context */ - unsigned char *input, /* input block */ - unsigned int inputLen /* length of input block */ -) -{ - unsigned int i, index, partLen; - - /* Compute number of bytes mod 64 */ - index = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); - - partLen = 64 - index; - - /* Transform as many times as possible. - */ - if (inputLen >= partLen) { - MD5_memcpy ((POINTER)&context->buffer[index], (POINTER)input, partLen); - MD5Transform (context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform (context->state, &input[i]); - - index = 0; - } - else - i = 0; - - /* Buffer remaining input */ - MD5_memcpy - ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i); -} - -/* MD5 finalization. Ends an MD5 message-digest operation, writing the - the message digest and zeroizing the context. - */ -void MD5Final ( - unsigned char digest[16], /* message digest */ - MD5_CTX *context /* context */ - ) -{ - unsigned char bits[8]; - unsigned int index, padLen; - - /* Save number of bits */ - Encode (bits, context->count, 8); - - /* Pad out to 56 mod 64. - */ - index = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - MD5Update (context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update (context, bits, 8); - - /* Store state in digest */ - Encode (digest, context->state, 16); - - /* Zeroize sensitive information. - */ - MD5_memset ((POINTER)context, 0, sizeof (*context)); -} - -/* MD5 basic transformation. Transforms state based on block. - */ -static void MD5Transform (UINT4 state[4], unsigned char block[64]) -{ - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode (x, block, 64); - - /* Round 1 */ - FF ( a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF ( d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF ( c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF ( b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF ( a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF ( d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF ( c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF ( b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF ( a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF ( d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF ( c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF ( b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF ( a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF ( d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF ( c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF ( b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG ( a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG ( d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG ( c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG ( b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG ( a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG ( d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG ( c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG ( b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG ( a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG ( d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG ( c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - GG ( b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG ( a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG ( d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG ( c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG ( b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH ( a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH ( d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH ( c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH ( b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH ( a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH ( d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH ( c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH ( b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH ( a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH ( d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH ( c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH ( b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH ( a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH ( d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH ( c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH ( b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II ( a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II ( d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II ( c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II ( b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II ( a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II ( d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II ( c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II ( b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II ( a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II ( d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II ( c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II ( b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II ( a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II ( d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II ( c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II ( b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. - */ - MD5_memset ((POINTER)x, 0, sizeof (x)); -} - -/* Encodes input (UINT4) into output (unsigned char). Assumes len is - a multiple of 4. - */ -static void Encode (unsigned char *output, UINT4 *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/* Decodes input (unsigned char) into output (UINT4). Assumes len is - a multiple of 4. - */ -static void Decode (UINT4 *output, unsigned char *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); -} - -/* Note: Replace "for loop" with standard memcpy if possible. - */ -static void MD5_memcpy (POINTER output, POINTER input, unsigned int len) -{ - memcpy(output, input, len); -/* unsigned int i; - - for (i = 0; i < len; i++) - output[i] = input[i];*/ -} - -/* Note: Replace "for loop" with standard memset if possible. - */ -static void MD5_memset (POINTER output, int value, unsigned int len) -{ - memset(output, value, len); - /* unsigned int i; - - for (i = 0; i < len; i++) - ((char *)output)[i] = (char)value; */ -} - -#endif - -void MD5Print (unsigned char digest[16], char output[33]) -{ - static const char hex_digits[] = "0123456789abcdef"; - unsigned int i; - - for (i = 0; i < 16; i++) - { - output[i*2 ] = hex_digits[digest[i] / 16]; - output[i*2+1] = hex_digits[digest[i] % 16]; - } - output[32] = '\0'; -} - -void MD5Digest (unsigned char *input, unsigned int len, char output[33]) -{ - MD5_CTX ctx; - unsigned char digest[16]; - - MD5Init(&ctx); - MD5Update(&ctx, input, len); - MD5Final(digest, &ctx); - MD5Print(digest, output); - -} -#ifdef __cplusplus -} -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/nonport.c b/src/utils/mp_gpprof_server/libraries/gamespy/nonport.c deleted file mode 100644 index 54b0a96c6d9..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/nonport.c +++ /dev/null @@ -1,18 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Deprecated. Stubbed here for backwards compatability - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "common/gsPlatform.c" -#include "common/gsPlatformSocket.c" -#include "common/gsPlatformThread.c" -#include "common/gsPlatformUtil.c" -#include "common/gsDebug.c" -#include "common/gsAssert.c" -#include "common/gsMemory.c" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/nonport.h b/src/utils/mp_gpprof_server/libraries/gamespy/nonport.h deleted file mode 100644 index 36b6fcb37bd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/nonport.h +++ /dev/null @@ -1,17 +0,0 @@ -/****** -nonport.h -GameSpy Common Code - -Copyright 1999-2007 GameSpy Industries, Inc - -devsupport@gamespy.com -******/ - -#ifndef _NONPORT_H_ -#define _NONPORT_H_ - - -#include "common/gsCommon.h" - - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/changelog.txt b/src/utils/mp_gpprof_server/libraries/gamespy/sake/changelog.txt deleted file mode 100644 index cc0be7b4a68..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/changelog.txt +++ /dev/null @@ -1,57 +0,0 @@ -Changelog for: GameSpy SAKE SDK --------------------------------------------------------- - -DATE VERSION BY TYPE DESCRIPTION ----------- ------- --- ------- --------------------------------------------------------- -12-12-2007 1.04.00 RMV RELEASE Released to Developer Site -12-11-2007 1.03.03 SN FIX Removed a check due to compiler warning -11-16-2007 1.03.02 SAH FIX Fixed mem leak in saketest.c from invalid gsCore shutdown, added memleak check -10-09-2007 1.03.01 SAH FIX Fixed mFilter and mTargetFilter to support unicode strings - SAH OTHER Added Win32 Unicode Debug & Unicode Release projects to VS2005 solution -08-06-2007 1.03.00 RMV RELEASE Released to Developer Site -08-03-2007 1.02.08 SAH FEATURE Added mCacheFlag for searchForRecords and getRowCount -07-19-2007 1.02.07 SAH FIX Fixed projects to work with new GP changes -07-03-2007 1.02.06 SAH FIX Fixed memory leak in GetRandomRecord -06-29-2007 1.02.05 SAH OTHER Added SAKEFileResult_SERVER_ERROR to error code list -06-20-2007 1.02.04 SAH FEATURE Added sakeGetRecordCount - SAH FEATURE Added new input data for sakeSearchForRecords for initial leaderboard support -06-13-2007 1.02.03 SAH FIX Fixed memory leak from not freeing BinaryData fields or UnicodeStrings -05-29-2007 1.02.02 DES FEATURE Updated saketest to include GetRandomRecord test -03-22-2007 1.02.01 DES FIX Allow NULL for mFilter and mSort with SearchForRecords - DES FEATURE Added GetRandomRecord - DES FEATURE Added special field "my_rating" - DES FEATURE Added special filter tags "@rated" and "@unrated" -03-05-2007 1.02.00 SAH RELEASE Released to Developer Site -01-22-2007 1.01.02 SAH FIX Fixed unicode for upload/download URLs and setGameName, added unicode config -01-17-2007 1.01.01 DES RELEASE Limited Release -01-16-2007 1.01.01 DES FEATURE Added X360 support -12-15-2006 1.01.00 MJW RELEASE Released to Developer Site -12-14-2006 1.00.20 MJW FIX Removed tabs from Makefile for linux (was causing it to break) -11-10-2006 1.00.19 JR RELEASE Limited Release -11-02-2006 1.00.19 SAH FIX Fixed bug where all booleans values returned "false", even when true -10-23-2006 1.00.18 DES RELEASE Limited release -10-12-2006 1.00.18 DES FIX Added explicit cast for gsimalloc -10-11-2006 1.00.17 DES FIX Fixed Unicode issue with upload/download URLs -10-05-2006 1.00.16 SAH FIX Updated Mac OSX Makefile - SAH FIX Fixed saketest to get rid of compiler warning errors for Mac -09-29-2006 1.00.15 SAH FIX Updated all sake projects to compile with GP (for saketest change) -09-28-2006 1.00.14 SAH FIX Updated saketest application to login to GP and retrieve a loginticket to authenticate sake. -09-28-2006 1.00.13 SAH FIX Fixed PS3 project to work with PS3 095.00x SDK; changed included libaries in linker input. -09-27-2006 1.00.13 SN OTHER Removed function below until development backend is available -09-20-2006 1.00.12 SN FEATURE Added an interface function allow usage of the development environment -08-04-2006 1.00.11 SN FIX Fixed Sake Read requestion function for date and time to use time_t -08-04-2006 1.00.10 SAH FIX Changed DateTime read call to gsXmlReadChildAsDateTimeElement to parse correctly -08-02-2006 1.00.09 SAH RELEASE Releasing to developer site -08-01-2006 1.00.09 SAH FIX Fixed saketest.c so that it won't crash when a specific record does not exist - SAH OTHER Added sakelinux makefile - *NOTE: unsupported in current version due to pthreads -07-31-2006 1.00.08 SAH FIX Fixed PS3 project file - added post-build step to create *.SELF for execution -07-25-2006 1.00.07 SAH FIX Fixed NITRO project, include for crt0.o now above others so it add correct file -07-06-2006 1.00.06 SAH FIX Fixed PSP project file to not explicitly include the PSP linker file -07-06-2006 1.00.05 SAH FIX Fixed NITRO project & linker command file (to work with CW 2.0/NitroSDK 3.1) -07-05-2006 1.00.04 SAH OTHER Updated saketest.c to have a larger size upload test (5K by default) -06-21-2006 1.00.03 DES FEATURE sakeSetGame now requires the game's secret key -05-31-2006 1.00.02 SAH RELEASE Releasing to developer site -05-30-2006 1.00.01 SAH FIX #ifdef PS2 Unicode hack to get rid of PS2 Unicode warnings - SAH FIX Added GSI_UNUSED calls, newline at end of files -05-18-2006 1.00.00 DES RELEASE Initial limited release - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.dsp deleted file mode 100644 index aa51e24009e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="sake" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=sake - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "sake.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "sake.mak" CFG="sake - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "sake - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "sake - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "$/Gamespy/GOA/sake" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "sake - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../" /I "../gsoap" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "sake - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /I "../gsoap" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "sake - Win32 Release" -# Name "sake - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\sakeMain.c -# End Source File -# Begin Source File - -SOURCE=.\sakeRequest.c -# End Source File -# Begin Source File - -SOURCE=.\sakeRequestMisc.c -# End Source File -# Begin Source File - -SOURCE=.\sakeRequestModify.c -# End Source File -# Begin Source File - -SOURCE=.\sakeRequestRead.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\sake.h -# End Source File -# Begin Source File - -SOURCE=.\sakeMain.h -# End Source File -# Begin Source File - -SOURCE=.\sakeRequest.h -# End Source File -# Begin Source File - -SOURCE=.\sakeRequestInternal.h -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.dsw b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.dsw deleted file mode 100644 index 715f2342e0c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.dsw +++ /dev/null @@ -1,53 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "sake"=.\sake.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/sake - . - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "saketest"=.\saketest\saketest.dsp - Package Owner=<4> - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/sake/saketest - .\saketest - end source code control -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ - begin source code control - $/Gamespy/GOA/sake - . - end source code control -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.h b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.h deleted file mode 100644 index 8a4d0a3d478..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake.h +++ /dev/null @@ -1,352 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __SAKE_H__ -#define __SAKE_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "../common/gsCommon.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef SAKE_CALL - #define SAKE_CALL -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// URL for sake webservice -#define SAKE_MAX_URL_LENGTH 128 -extern char sakeiSoapUrl[SAKE_MAX_URL_LENGTH]; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// General -typedef struct SAKEInternal *SAKE; - -typedef enum -{ - SAKEStartupResult_SUCCESS, - SAKEStartupResult_NOT_AVAILABLE, - SAKEStartupResult_CORE_SHUTDOWN, - SAKEStartupResult_OUT_OF_MEMORY -} SAKEStartupResult; - -SAKEStartupResult SAKE_CALL sakeStartup(SAKE *sakePtr); -void SAKE_CALL sakeShutdown(SAKE sake); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Authentication -void SAKE_CALL sakeSetGame(SAKE sake, const gsi_char *gameName, int gameId, const gsi_char *secretKey); -void SAKE_CALL sakeSetProfile(SAKE sake, int profileId, const char *loginTicket); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Fields -typedef enum -{ - SAKEFieldType_BYTE, - SAKEFieldType_SHORT, - SAKEFieldType_INT, - SAKEFieldType_FLOAT, - SAKEFieldType_ASCII_STRING, - SAKEFieldType_UNICODE_STRING, - SAKEFieldType_BOOLEAN, - SAKEFieldType_DATE_AND_TIME, - SAKEFieldType_BINARY_DATA, - SAKEFieldType_INT64, - SAKEFieldType_NUM_FIELD_TYPES -} SAKEFieldType; - -typedef struct -{ - gsi_u8 *mValue; - int mLength; -} SAKEBinaryData; - -typedef union -{ - gsi_u8 mByte; - gsi_i16 mShort; - gsi_i32 mInt; - float mFloat; - char *mAsciiString; - gsi_u16 *mUnicodeString; - gsi_bool mBoolean; - time_t mDateAndTime; - SAKEBinaryData mBinaryData; - gsi_i64 mInt64; -} SAKEValue; - -typedef struct -{ - char *mName; - SAKEFieldType mType; - SAKEValue mValue; -} SAKEField; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Requests -typedef struct SAKERequestInternal *SAKERequest; - -typedef enum -{ - SAKEStartRequestResult_SUCCESS, - SAKEStartRequestResult_NOT_AUTHENTICATED, - SAKEStartRequestResult_OUT_OF_MEMORY, - SAKEStartRequestResult_BAD_INPUT, - SAKEStartRequestResult_BAD_TABLEID, - SAKEStartRequestResult_BAD_FIELDS, - SAKEStartRequestResult_BAD_NUM_FIELDS, - SAKEStartRequestResult_BAD_FIELD_NAME, - SAKEStartRequestResult_BAD_FIELD_TYPE, - SAKEStartRequestResult_BAD_FIELD_VALUE, - SAKEStartRequestResult_BAD_OFFSET, - SAKEStartRequestResult_BAD_MAX, - SAKEStartRequestResult_BAD_RECORDIDS, - SAKEStartRequestResult_BAD_NUM_RECORDIDS, - SAKEStartRequestResult_UNKNOWN_ERROR -} SAKEStartRequestResult; - -typedef enum -{ - SAKERequestResult_SUCCESS, - SAKERequestResult_SECRET_KEY_INVALID, - SAKERequestResult_SERVICE_DISABLED, - SAKERequestResult_CONNECTION_TIMEOUT, - SAKERequestResult_CONNECTION_ERROR, - SAKERequestResult_MALFORMED_RESPONSE, - SAKERequestResult_OUT_OF_MEMORY, - SAKERequestResult_DATABASE_UNAVAILABLE, - SAKERequestResult_LOGIN_TICKET_INVALID, - SAKERequestResult_LOGIN_TICKET_EXPIRED, - SAKERequestResult_TABLE_NOT_FOUND, - SAKERequestResult_RECORD_NOT_FOUND, - SAKERequestResult_FIELD_NOT_FOUND, - SAKERequestResult_FIELD_TYPE_INVALID, - SAKERequestResult_NO_PERMISSION, - SAKERequestResult_RECORD_LIMIT_REACHED, - SAKERequestResult_ALREADY_RATED, - SAKERequestResult_NOT_RATEABLE, - SAKERequestResult_NOT_OWNED, - SAKERequestResult_FILTER_INVALID, - SAKERequestResult_SORT_INVALID, - SAKERequestResult_TARGET_FILTER_INVALID, - SAKERequestResult_UNKNOWN_ERROR -} SAKERequestResult; - -typedef void (*SAKERequestCallback)(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// get start request result -SAKEStartRequestResult SAKE_CALL sakeGetStartRequestResult(SAKE sake); - -/////////////////////////////////////////////////////////////////////////////// -// create record -typedef struct -{ - char *mTableId; - SAKEField *mFields; - int mNumFields; -} SAKECreateRecordInput; -typedef struct -{ - int mRecordId; -} SAKECreateRecordOutput; -SAKERequest SAKE_CALL sakeCreateRecord(SAKE sake, SAKECreateRecordInput *input, SAKERequestCallback callback, void *userData); - -//////////////////////////// /////////////////////////////////////////////////// -// update record -typedef struct -{ - char *mTableId; - int mRecordId; - SAKEField *mFields; - int mNumFields; -} SAKEUpdateRecordInput; -SAKERequest SAKE_CALL sakeUpdateRecord(SAKE sake, SAKEUpdateRecordInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// delete record -typedef struct -{ - char *mTableId; - int mRecordId; -} SAKEDeleteRecordInput; -SAKERequest SAKE_CALL sakeDeleteRecord(SAKE sake, SAKEDeleteRecordInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// search for records -typedef struct -{ - char *mTableId; - char **mFieldNames; - int mNumFields; - gsi_char *mFilter; - char *mSort; - int mOffset; - int mMaxRecords; - gsi_char *mTargetRecordFilter; - int mSurroundingRecordsCount; - int *mOwnerIds; - int mNumOwnerIds; - gsi_bool mCacheFlag; -} SAKESearchForRecordsInput; -typedef struct -{ - int mNumRecords; - SAKEField **mRecords; -} SAKESearchForRecordsOutput; -SAKERequest SAKE_CALL sakeSearchForRecords(SAKE sake, SAKESearchForRecordsInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// get my records -typedef struct -{ - char *mTableId; - char **mFieldNames; - int mNumFields; -} SAKEGetMyRecordsInput; -typedef struct -{ - int mNumRecords; - SAKEField **mRecords; -} SAKEGetMyRecordsOutput; -SAKERequest SAKE_CALL sakeGetMyRecords(SAKE sake, SAKEGetMyRecordsInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// get specific records -typedef struct -{ - char *mTableId; - int *mRecordIds; - int mNumRecordIds; - char **mFieldNames; - int mNumFields; -} SAKEGetSpecificRecordsInput; -typedef struct -{ - int mNumRecords; - SAKEField **mRecords; -} SAKEGetSpecificRecordsOutput; -SAKERequest SAKE_CALL sakeGetSpecificRecords(SAKE sake, SAKEGetSpecificRecordsInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// get random record -typedef struct -{ - char *mTableId; - char **mFieldNames; - int mNumFields; - gsi_char *mFilter; -} SAKEGetRandomRecordInput; -typedef struct -{ - SAKEField *mRecord; -} SAKEGetRandomRecordOutput; -SAKERequest SAKE_CALL sakeGetRandomRecord(SAKE sake, SAKEGetRandomRecordInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// rate record -typedef struct -{ - char *mTableId; - int mRecordId; - gsi_u8 mRating; -} SAKERateRecordInput; -typedef struct -{ - int mNumRatings; - float mAverageRating; -} SAKERateRecordOutput; -SAKERequest SAKE_CALL sakeRateRecord(SAKE sake, SAKERateRecordInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// get record limit -typedef struct -{ - char *mTableId; -} SAKEGetRecordLimitInput; -typedef struct -{ - int mLimitPerOwner; - int mNumOwned; -} SAKEGetRecordLimitOutput; -SAKERequest SAKE_CALL sakeGetRecordLimit(SAKE sake, SAKEGetRecordLimitInput *input, SAKERequestCallback callback, void *userData); - -/////////////////////////////////////////////////////////////////////////////// -// get record count -typedef struct -{ - char *mTableId; - gsi_char *mFilter; - gsi_bool mCacheFlag; -} SAKEGetRecordCountInput; -typedef struct -{ - int mCount; -} SAKEGetRecordCountOutput; -SAKERequest SAKE_CALL sakeGetRecordCount(SAKE sake, SAKEGetRecordCountInput *input, SAKERequestCallback callback, void *userData); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// read request utility -SAKEField * SAKE_CALL sakeGetFieldByName(const char *name, SAKEField *fields, int numFields); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Files - -#define SAKE_FILE_RESULT_HEADER "Sake-File-Result:" -#define SAKE_FILE_ID_HEADER "Sake-File-Id:" - -// Sake-File-Result from the HTTP response header -typedef enum -{ - SAKEFileResult_SUCCESS = 0, - SAKEFileResult_BAD_HTTP_METHOD = 1, - SAKEFileResult_BAD_FILE_COUNT = 2, - SAKEFileResult_MISSING_PARAMETER = 3, - SAKEFileResult_FILE_NOT_FOUND = 4, - SAKEFileResult_FILE_TOO_LARGE = 5, - SAKEFileResult_SERVER_ERROR = 6, - SAKEFileResult_UNKNOWN_ERROR -} SAKEFileResult; - -gsi_bool SAKE_CALL sakeSetFileDownloadURL(SAKE sake, gsi_char url[SAKE_MAX_URL_LENGTH]); -gsi_bool SAKE_CALL sakeSetFileUploadURL(SAKE sake, gsi_char url[SAKE_MAX_URL_LENGTH]); - -gsi_bool SAKE_CALL sakeGetFileDownloadURL(SAKE sake, int fileId, gsi_char url[SAKE_MAX_URL_LENGTH]); -gsi_bool SAKE_CALL sakeGetFileUploadURL(SAKE sake, gsi_char url[SAKE_MAX_URL_LENGTH]); - -gsi_bool SAKE_CALL sakeGetFileResultFromHeaders(const char *headers, SAKEFileResult *result); -gsi_bool SAKE_CALL sakeGetFileIdFromHeaders(const char *headers, int *fileId); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} // extern "C" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __SAKE_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeMain.c b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeMain.c deleted file mode 100644 index b59e2b09827..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeMain.c +++ /dev/null @@ -1,428 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeMain.h" -#include "sakeRequest.h" -#include "../common/gsAvailable.h" -#include "../common/gsCore.h" - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// General - -gsi_char gSakeUploadUrlOverride[SAKE_MAX_URL_LENGTH]; -gsi_char gSakeDownloadUrlOverride[SAKE_MAX_URL_LENGTH]; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKEStartupResult SAKE_CALL sakeStartup(SAKE * sakePtr) -{ - SAKE sake; - - GS_ASSERT(sakePtr); - - // check for availability - if(__GSIACResult != GSIACAvailable) - return SAKEStartupResult_NOT_AVAILABLE; - - // check that the core is initialized - if(gsCoreIsShutdown()) - return SAKEStartupResult_CORE_SHUTDOWN; - - // allocate the sake object - sake = (SAKE)gsimalloc(sizeof(SAKEInternal)); - if(sake == NULL) - return SAKEStartupResult_OUT_OF_MEMORY; - - // init the sake object - memset(sake, 0, sizeof(SAKEInternal)); - - // store the object in the user pointer - *sakePtr = sake; - - return SAKEStartupResult_SUCCESS; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void SAKE_CALL sakeShutdown(SAKE sake) -{ - GS_ASSERT(sake); - - //TODO: ensure that there are no pending operations - // that might reference this object - - // free the struct - gsifree(sake); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Authentication - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void SAKE_CALL sakeSetGame(SAKE sake, const gsi_char * gameName, int gameId, const gsi_char *secretKey) -{ - GS_ASSERT(sake); - GS_ASSERT(gameName && (_tcslen(gameName) <= SAKEI_GAME_NAME_LENGTH)); - GS_ASSERT(gameId >= 0); - GS_ASSERT(secretKey && (_tcslen(secretKey) <= SAKEI_SECRET_KEY_LENGTH)); - -#ifdef GSI_UNICODE - // convert gamename and secretkey to ascii for executing requests - UCS2ToAsciiString(gameName, sake->mGameName); - UCS2ToAsciiString(secretKey, sake->mSecretKey); -#else - strcpy(sake->mGameName, gameName); - strcpy(sake->mSecretKey, secretKey); -#endif - - sake->mGameId = gameId; - sake->mIsGameAuthenticated = gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void SAKE_CALL sakeSetProfile(SAKE sake, int profileId, const char *loginTicket) -{ - GS_ASSERT(sake); - GS_ASSERT(loginTicket); - GS_ASSERT(strlen(loginTicket) == SAKEI_LOGIN_TICKET_LENGTH); - - sake->mProfileId = profileId; - memcpy(sake->mLoginTicket, loginTicket, SAKEI_LOGIN_TICKET_LENGTH + 1); - sake->mIsProfileAuthenticated = gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Requests - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKEStartRequestResult SAKE_CALL sakeGetStartRequestResult(SAKE sake) -{ - GS_ASSERT(sake); - - return sake->mStartRequestResult; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKERequest SAKE_CALL sakeiRunRequest(SAKE sake, void *input, - SAKERequestCallback callback, void *userData, - SAKEIRequestType type, - SAKEStartRequestResult (*startRequestFunc)(SAKERequest request)) -{ - SAKERequest request; - - GS_ASSERT(sake); - - request = sakeiInitRequest(sake, type, input, callback, userData); - if(!request) - return NULL; - - sake->mStartRequestResult = startRequestFunc(request); - if(sake->mStartRequestResult != SAKEStartRequestResult_SUCCESS) - { - sakeiFreeRequest(request); - return NULL; - } - - return request; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeCreateRecord(SAKE sake, SAKECreateRecordInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_CREATE_RECORD, sakeiStartCreateRecordRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeUpdateRecord(SAKE sake, SAKEUpdateRecordInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_UPDATE_RECORD, sakeiStartUpdateRecordRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeDeleteRecord(SAKE sake, SAKEDeleteRecordInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_DELETE_RECORD, sakeiStartDeleteRecordRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeSearchForRecords(SAKE sake, SAKESearchForRecordsInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_SEARCH_FOR_RECORDS, sakeiStartSearchForRecordsRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeGetMyRecords(SAKE sake, SAKEGetMyRecordsInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_GET_MY_RECORDS, sakeiStartGetMyRecordsRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeGetSpecificRecords(SAKE sake, SAKEGetSpecificRecordsInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_GET_SPECIFIC_RECORDS, sakeiStartGetSpecificRecordsRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeGetRandomRecord(SAKE sake, SAKEGetRandomRecordInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_GET_RANDOM_RECORD, sakeiStartGetRandomRecordRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeRateRecord(SAKE sake, SAKERateRecordInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_RATE_RECORD, sakeiStartRateRecordRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeGetRecordLimit(SAKE sake, SAKEGetRecordLimitInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_GET_RECORD_LIMIT, sakeiStartGetRecordLimitRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeGetRecordCount(SAKE sake, SAKEGetRecordCountInput *input, SAKERequestCallback callback, void *userData) -{ - return sakeiRunRequest(sake, input, callback, userData, SAKEIRequestType_GET_RECORD_COUNT, sakeiStartGetRecordCountRequest); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// read request utility -SAKEField * SAKE_CALL sakeGetFieldByName(const char *name, SAKEField *fields, int numFields) -{ - int i; - - GS_ASSERT(name); - GS_ASSERT(fields); - GS_ASSERT(numFields >= 0); - - for(i = 0 ; i < numFields ; i++) - { - if(strcmp(fields[i].mName, name) == 0) - return &fields[i]; - } - - return NULL; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Files - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Set the URL format to be used by sakeGetFileDownloadUrl -gsi_bool SAKE_CALL sakeSetFileDownloadURL(SAKE sake, gsi_char url[SAKE_MAX_URL_LENGTH]) -{ - GS_ASSERT(sake); - GS_ASSERT(url); - - if(!sake || !url) - return gsi_false; - - _tcscpy(gSakeDownloadUrlOverride, url); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool SAKE_CALL sakeGetFileDownloadURL(SAKE sake, int fileId, gsi_char url[SAKE_MAX_URL_LENGTH]) -{ - int rcode; - - GS_ASSERT(sake); - GS_ASSERT(fileId != 0); - GS_ASSERT(url); - GS_ASSERT(sake->mIsGameAuthenticated); - GS_ASSERT(sake->mIsProfileAuthenticated); - - if(!sake || !url || !sake->mIsGameAuthenticated || !sake->mIsProfileAuthenticated) - return gsi_false; - - if (gSakeDownloadUrlOverride[0] != '\0') - { - rcode = _tsnprintf(url, SAKE_MAX_URL_LENGTH, _T("%s?gameid=%d&pid=%d"), - gSakeDownloadUrlOverride, sake->mGameId, sake->mProfileId); - } - else - { - #ifdef GSI_UNICODE - { - // use capital %S to convert the gamename to a wide string - rcode = _tsnprintf(url, SAKE_MAX_URL_LENGTH, _T("http://%S.sake.%S/SakeFileServer/download.aspx?fileid=%d&gameid=%d&pid=%d"), - sake->mGameName, GSI_DOMAIN_NAME, fileId, sake->mGameId, sake->mProfileId); - } - #else - { - rcode = _tsnprintf(url, SAKE_MAX_URL_LENGTH, _T("http://%s.sake.%s/SakeFileServer/download.aspx?fileid=%d&gameid=%d&pid=%d"), - sake->mGameName, GSI_DOMAIN_NAME, fileId, sake->mGameId, sake->mProfileId); - } - #endif - } - - if(rcode < 0) - return gsi_false; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool SAKE_CALL sakeSetFileUploadURL(SAKE sake, gsi_char url[SAKE_MAX_URL_LENGTH]) -{ - GS_ASSERT(sake); - GS_ASSERT(url); - - if(!sake || !url) - return gsi_false; - - _tcscpy(gSakeUploadUrlOverride, url); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool SAKE_CALL sakeGetFileUploadURL(SAKE sake, gsi_char url[SAKE_MAX_URL_LENGTH]) -{ - int rcode; - - GS_ASSERT(sake); - GS_ASSERT(url); - GS_ASSERT(sake->mIsGameAuthenticated); - GS_ASSERT(sake->mIsProfileAuthenticated); - - if(!sake || !url || !sake->mIsGameAuthenticated || !sake->mIsProfileAuthenticated) - return gsi_false; - - if (gSakeUploadUrlOverride[0] != '\0') - { - rcode = _tsnprintf(url, SAKE_MAX_URL_LENGTH, _T("%s?gameid=%d&pid=%d"), - gSakeUploadUrlOverride, sake->mGameId, sake->mProfileId); - } - else - { - #ifdef GSI_UNICODE - { - // use capital %S to convert the gamename to a wide string - rcode = _tsnprintf(url, SAKE_MAX_URL_LENGTH, _T("http://%S.sake.%S/SakeFileServer/upload.aspx?gameid=%d&pid=%d"), - sake->mGameName, GSI_DOMAIN_NAME, sake->mGameId, sake->mProfileId); - } - #else - { - rcode = _tsnprintf(url, SAKE_MAX_URL_LENGTH, _T("http://%s.sake.%s/SakeFileServer/upload.aspx?gameid=%d&pid=%d"), - sake->mGameName, GSI_DOMAIN_NAME, sake->mGameId, sake->mProfileId); - } - #endif - } - - if(rcode < 0) - return gsi_false; - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKEFileResult SAKE_CALL sakeiParseFileResult(int resultCode) -{ - if(resultCode >= SAKEFileResult_UNKNOWN_ERROR) - return SAKEFileResult_UNKNOWN_ERROR; - return (SAKEFileResult)resultCode; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static gsi_bool SAKE_CALL sakeiGetHeaderValueInt(const char *headers, const char *headerName, int *value) -{ - const char * header; - int rcode; - - GS_ASSERT(headers); - GS_ASSERT(headerName); - GS_ASSERT(value); -#ifdef _DEBUG - // headerName must include the trailing colon - GS_ASSERT(headerName[strlen(headerName) - 1] == ':'); -#endif - - // find this header in the list of headers - header = strstr(headers, headerName); - if(header) - { - // skip the header name - header += strlen(headerName); - - // scan in the result - rcode = sscanf(header, " %d", value); - if(rcode == 1) - return gsi_true; - } - - return gsi_false; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool SAKE_CALL sakeGetFileResultFromHeaders(const char *headers, SAKEFileResult *result) -{ - int resultCode; - gsi_bool foundResultCode; - - foundResultCode = sakeiGetHeaderValueInt(headers, SAKE_FILE_RESULT_HEADER, &resultCode); - - if(gsi_is_false(foundResultCode)) - return gsi_false; - - *result = sakeiParseFileResult(resultCode); - return gsi_true; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -gsi_bool SAKE_CALL sakeGetFileIdFromHeaders(const char *headers, int *fileId) -{ - return sakeiGetHeaderValueInt(headers, SAKE_FILE_ID_HEADER, fileId); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeMain.h b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeMain.h deleted file mode 100644 index a0fa250d240..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeMain.h +++ /dev/null @@ -1,51 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __SAKEMAIN_H__ -#define __SAKEMAIN_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sake.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define SAKEI_GAME_NAME_LENGTH 15 -#define SAKEI_SECRET_KEY_LENGTH 8 -#define SAKEI_LOGIN_TICKET_LENGTH 24 - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct SAKEInternal -{ - gsi_bool mIsGameAuthenticated; - char mGameName[SAKEI_GAME_NAME_LENGTH + 1]; - int mGameId; - char mSecretKey[SAKEI_SECRET_KEY_LENGTH + 1]; - - gsi_bool mIsProfileAuthenticated; - int mProfileId; - char mLoginTicket[SAKEI_LOGIN_TICKET_LENGTH + 1]; - - SAKEStartRequestResult mStartRequestResult; -} SAKEInternal; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} // extern "C" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __SAKEMAIN_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequest.c b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequest.c deleted file mode 100644 index 9e30820a32c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequest.c +++ /dev/null @@ -1,287 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeRequest.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -const char * GSI_SAKE_SERVICE_NAMESPACES[GSI_SAKE_SERVICE_NAMESPACE_COUNT] = -{ - "ns1=\"http://gamespy.net/sake\"" -}; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define SAKEI_SOAP_URL_FORMAT "http://%s.sake." GSI_DOMAIN_NAME "/SakeStorageServer/StorageServer.asmx" -char sakeiSoapUrl[SAKE_MAX_URL_LENGTH] = ""; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeiInitRequest(SAKE sake, SAKEIRequestType type, void *input, SAKERequestCallback callback, void *userData) -{ - SAKERequest request; - - GS_ASSERT(sake); - - // init the request init result to success - sake->mStartRequestResult = SAKEStartRequestResult_SUCCESS; - - // check for input - if(!input) - { - sake->mStartRequestResult = SAKEStartRequestResult_BAD_INPUT; - return NULL; - } - - // check for authentication - if(gsi_is_false(sake->mIsGameAuthenticated) || gsi_is_false(sake->mIsProfileAuthenticated)) - { - sake->mStartRequestResult = SAKEStartRequestResult_NOT_AUTHENTICATED; - return NULL; - } - - // allocate memory for the request object - request = (SAKERequest)gsimalloc(sizeof(SAKERequestInternal)); - if(!request) - { - sake->mStartRequestResult = SAKEStartRequestResult_OUT_OF_MEMORY; - return NULL; - } - - // init the request object - memset(request, 0, sizeof(SAKERequestInternal)); - request->mSake = sake; - request->mType = type; - request->mInput = input; - request->mCallback = callback; - request->mUserData = userData; - - return request; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void SAKE_CALL sakeiFreeRequest(SAKERequest request) -{ - GS_ASSERT(request); - - // this should already be freed by the time we get here - GS_ASSERT(request->mOutput == NULL); - - // free the request - gsifree(request); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKERequestResult SAKE_CALL sakeiCheckHttpResult(GHTTPResult httpResult) -{ - switch(httpResult) - { - case GHTTPSuccess: - return SAKERequestResult_SUCCESS; - case GHTTPOutOfMemory: - return SAKERequestResult_OUT_OF_MEMORY; - default: - return SAKERequestResult_CONNECTION_ERROR; - } -} - -static SAKERequestResult SAKE_CALL sakeiCheckSakeResult(const char * sakeResult) -{ - if(strcmp(sakeResult, "Success") == 0) - return SAKERequestResult_SUCCESS; - else if(strcmp(sakeResult, "SecretKeyInvalid") == 0) - return SAKERequestResult_SECRET_KEY_INVALID; - else if(strcmp(sakeResult, "ServiceDisabled") == 0) - return SAKERequestResult_SERVICE_DISABLED; - else if(strcmp(sakeResult, "DatabaseUnavailable") == 0) - return SAKERequestResult_DATABASE_UNAVAILABLE; - else if(strcmp(sakeResult, "LoginTicketInvalid") == 0) - return SAKERequestResult_LOGIN_TICKET_INVALID; - else if(strcmp(sakeResult, "LoginTicketExpired") == 0) - return SAKERequestResult_LOGIN_TICKET_EXPIRED; - else if(strcmp(sakeResult, "TableNotFound") == 0) - return SAKERequestResult_TABLE_NOT_FOUND; - else if(strcmp(sakeResult, "RecordNotFound") == 0) - return SAKERequestResult_RECORD_NOT_FOUND; - else if(strcmp(sakeResult, "FieldNotFound") == 0) - return SAKERequestResult_FIELD_NOT_FOUND; - else if(strcmp(sakeResult, "FieldTypeInvalid") == 0) - return SAKERequestResult_FIELD_TYPE_INVALID; - else if(strcmp(sakeResult, "NoPermission") == 0) - return SAKERequestResult_NO_PERMISSION; - else if(strcmp(sakeResult, "RecordLimitReached") == 0) - return SAKERequestResult_RECORD_LIMIT_REACHED; - else if(strcmp(sakeResult, "AlreadyRated") == 0) - return SAKERequestResult_ALREADY_RATED; - else if(strcmp(sakeResult, "NotRateable") == 0) - return SAKERequestResult_NOT_RATEABLE; - else if(strcmp(sakeResult, "NotOwned") == 0) - return SAKERequestResult_NOT_OWNED; - else if(strcmp(sakeResult, "FilterInvalid") == 0) - return SAKERequestResult_FILTER_INVALID; - else if(strcmp(sakeResult, "SortInvalid") == 0) - return SAKERequestResult_SORT_INVALID; - else if(strcmp(sakeResult, "TargetFilterInvalid") == 0) - return SAKERequestResult_TARGET_FILTER_INVALID; - else - return SAKERequestResult_UNKNOWN_ERROR; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiSoapCallback(GHTTPResult httpResult, GSXmlStreamWriter requestData, GSXmlStreamReader responseData, void *userData) -{ - SAKERequest request = (SAKERequest)userData; - void *output = NULL; - SAKERequestResult result; - char resultString[32]; - - // sanity check - GS_ASSERT(request); - GS_ASSERT(request->mSake); - GS_ASSERT(request->mInfo); - if(!request || !request->mSake || !request->mInfo) - return; - - result = sakeiCheckHttpResult(httpResult); - if(result == SAKERequestResult_SUCCESS) - { - if(gsi_is_false(gsXmlMoveToStart(responseData)) || - gsi_is_false(gsXmlMoveToNext(responseData, request->mInfo->mResponseTag)) || - gsi_is_false(gsXmlReadChildAsStringNT(responseData, request->mInfo->mResultTag, resultString, sizeof(resultString)))) - { - result = SAKERequestResult_MALFORMED_RESPONSE; - } - else - { - result = sakeiCheckSakeResult(resultString); - - // fill in the output - if(result == SAKERequestResult_SUCCESS) - { - if(request->mInfo->mSakeOutputSize != 0) - { - request->mOutput = gsimalloc(request->mInfo->mSakeOutputSize); - if(request->mOutput) - { - request->mSoapResponse = responseData; - result = request->mInfo->mProcessSoapResponseFunc(request); - if(result == SAKERequestResult_SUCCESS) - output = request->mOutput; - } - else - { - result = SAKERequestResult_OUT_OF_MEMORY; - } - } - } - } - } - - // call the callback - if(request->mCallback) - request->mCallback(request->mSake, request, result, request->mInput, output, request->mUserData); - - // free data - if(request->mInfo->mFreeDataFunc) - request->mInfo->mFreeDataFunc(request); - - // free the output data - gsifree(request->mOutput); - request->mOutput = NULL; - - // free the sake request - sakeiFreeRequest(request); - - GSI_UNUSED(requestData); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKEStartRequestResult SAKE_CALL sakeiSetupRequest(SAKERequest request) -{ - SAKEStartRequestResult result; - SAKEIRequestInfo * info; - - GS_ASSERT(request); - GS_ASSERT(request->mSake); - GS_ASSERT(request->mInfo); - - // store a utility pointer to the info - info = request->mInfo; - - // check the input - result = info->mValidateInputFunc(request); - if(result != SAKEStartRequestResult_SUCCESS) - return result; - - // create the xml request stream - request->mSoapRequest = gsXmlCreateStreamWriter(GSI_SAKE_SERVICE_NAMESPACES, GSI_SAKE_SERVICE_NAMESPACE_COUNT); - if(request->mSoapRequest == NULL) - return SAKEStartRequestResult_OUT_OF_MEMORY; - - // open the stream - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, request->mInfo->mFuncName); - - // this info is included with every request - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "gameid", (gsi_u32)request->mSake->mGameId); - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "secretKey", request->mSake->mSecretKey); - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "loginTicket", request->mSake->mLoginTicket); - - // fill in the request data - result = info->mFillSoapRequestFunc(request); - if(result != SAKEStartRequestResult_SUCCESS) - { - gsXmlFreeWriter(request->mSoapRequest); - request->mSoapRequest = NULL; - if(info->mFreeDataFunc) - info->mFreeDataFunc(request); - return result; - } - - // close the stream and writer - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, request->mInfo->mFuncName); - gsXmlCloseWriter(request->mSoapRequest); - - return SAKEStartRequestResult_SUCCESS; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiExecuteRequest(SAKERequest request) -{ - if(sakeiSoapUrl[0] == '\0') - { - int rcode; - rcode = snprintf(sakeiSoapUrl, SAKE_MAX_URL_LENGTH, SAKEI_SOAP_URL_FORMAT, request->mSake->mGameName); - GS_ASSERT(rcode >= 0); - GSI_UNUSED(rcode); - } - gsiExecuteSoap(sakeiSoapUrl, request->mInfo->mSoapAction, request->mSoapRequest, sakeiSoapCallback, request); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKEStartRequestResult SAKE_CALL sakeiStartRequest(SAKERequest request, SAKEIRequestInfo * info) -{ - SAKEStartRequestResult result; - - request->mInfo = info; - - result = sakeiSetupRequest(request); - if(result != SAKEStartRequestResult_SUCCESS) - return result; - - sakeiExecuteRequest(request); - - return SAKEStartRequestResult_SUCCESS; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequest.h b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequest.h deleted file mode 100644 index d2016e26632..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequest.h +++ /dev/null @@ -1,91 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __SAKEREQUEST_H__ -#define __SAKEREQUEST_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeMain.h" -#include "sakeRequestInternal.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define GSI_SAKE_SERVICE_NAMESPACE_COUNT 1 -#define GSI_SAKE_SERVICE_NAMESPACE "ns1" -#define GSI_SAKE_SERVICE_NAMESPACE_URL "http://gamespy.net/sake" -extern const char * GSI_SAKE_SERVICE_NAMESPACES[GSI_SAKE_SERVICE_NAMESPACE_COUNT]; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef enum -{ - SAKEIRequestType_CREATE_RECORD, - SAKEIRequestType_UPDATE_RECORD, - SAKEIRequestType_DELETE_RECORD, - SAKEIRequestType_SEARCH_FOR_RECORDS, - SAKEIRequestType_GET_MY_RECORDS, - SAKEIRequestType_GET_SPECIFIC_RECORDS, - SAKEIRequestType_GET_RANDOM_RECORD, - SAKEIRequestType_RATE_RECORD, - SAKEIRequestType_GET_RECORD_LIMIT, - SAKEIRequestType_GET_RECORD_COUNT -} SAKEIRequestType; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct SAKERequestInternal -{ - SAKE mSake; - SAKEIRequestType mType; - void *mInput; - void *mOutput; - SAKERequestCallback mCallback; - void *mUserData; - GSXmlStreamWriter mSoapRequest; - GSXmlStreamWriter mSoapResponse; - SAKEIRequestInfo *mInfo; -} SAKERequestInternal; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKERequest SAKE_CALL sakeiInitRequest(SAKE sake, SAKEIRequestType type, void *input, SAKERequestCallback callback, void *userData); -void SAKE_CALL sakeiFreeRequest(SAKERequest request); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKEStartRequestResult SAKE_CALL sakeiStartCreateRecordRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartUpdateRecordRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartDeleteRecordRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartSearchForRecordsRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartGetMyRecordsRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartGetSpecificRecordsRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartGetRandomRecordRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartRateRecordRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartGetRecordLimitRequest(SAKERequest request); -SAKEStartRequestResult SAKE_CALL sakeiStartGetRecordCountRequest(SAKERequest request); - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} // extern "C" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __SAKEREQUEST_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestInternal.h b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestInternal.h deleted file mode 100644 index bd797bdebb3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestInternal.h +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#ifndef __SAKEREQUESTINTERNAL_H__ -#define __SAKEREQUESTINTERNAL_H__ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeMain.h" -#include "../common/gsSoap.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -extern "C" { -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#define SAKEI_REQUEST_SAFE_MALLOC(dest, type) SAKEI_REQUEST_SAFE_MALLOC_ARRAY(dest, type, 1) -#define SAKEI_REQUEST_SAFE_MALLOC_ARRAY(dest, type, num) {\ - dest = (type*)gsimalloc(sizeof(type)*num); /*malloc*/ \ - if(!dest) goto out_of_mem_cleanup; /*check*/ \ - memset(dest, 0, sizeof(type)*num); } /*zero*/ - -#define SAKEI_FUNC_NAME_STRINGS(func) func,\ - "SOAPAction: \"http://gamespy.net/sake/" func "\"",\ - func "Response",\ - func "Result" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -typedef struct -{ - size_t mSakeOutputSize; - const char *mFuncName; - const char *mSoapAction; - const char *mResponseTag; - const char *mResultTag; - - SAKEStartRequestResult (*mValidateInputFunc)(SAKERequest request); - SAKEStartRequestResult (*mFillSoapRequestFunc)(SAKERequest request); - SAKERequestResult (*mProcessSoapResponseFunc)(SAKERequest request); - void (*mFreeDataFunc)(SAKERequest request); -} SAKEIRequestInfo; - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -SAKEStartRequestResult SAKE_CALL sakeiStartRequest(SAKERequest request, SAKEIRequestInfo * info); - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) -} // extern "C" -#endif - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#endif // __SAKEREQUESTINTERNAL_H__ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestMisc.c b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestMisc.c deleted file mode 100644 index a264a87193e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestMisc.c +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeRequestInternal.h" -#include "sakeRequest.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Rate Record - -static SAKEStartRequestResult SAKE_CALL sakeiRateRecordValidateInput(SAKERequest request) -{ - SAKERateRecordInput *input = (SAKERateRecordInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKEStartRequestResult SAKE_CALL sakeiRateRecordFillSoapRequest(SAKERequest request) -{ - SAKERateRecordInput *input = (SAKERateRecordInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // write the recordid - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "recordid", (gsi_u32)input->mRecordId); - - // write the rating - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "rating", (gsi_u32)input->mRating); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiRateRecordProcessSoapResponse(SAKERequest request) -{ - SAKERateRecordOutput *output = (SAKERateRecordOutput *)request->mOutput; - - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "numRatings", &output->mNumRatings)) || - gsi_is_false(gsXmlReadChildAsFloat(request->mSoapResponse, "averageRating", &output->mAverageRating))) - { - return SAKERequestResult_MALFORMED_RESPONSE; - } - - return SAKERequestResult_SUCCESS; -} - -SAKEStartRequestResult SAKE_CALL sakeiStartRateRecordRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKERateRecordOutput), - SAKEI_FUNC_NAME_STRINGS("RateRecord"), - sakeiRateRecordValidateInput, - sakeiRateRecordFillSoapRequest, - sakeiRateRecordProcessSoapResponse - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Get Record Limit - -static SAKEStartRequestResult SAKE_CALL sakeiGetRecordLimitValidateInput(SAKERequest request) -{ - SAKEGetRecordLimitInput *input = (SAKEGetRecordLimitInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKEStartRequestResult SAKE_CALL sakeiGetRecordLimitFillSoapRequest(SAKERequest request) -{ - SAKEGetRecordLimitInput *input = (SAKEGetRecordLimitInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiGetRecordLimitProcessSoapResponse(SAKERequest request) -{ - SAKEGetRecordLimitOutput *output = (SAKEGetRecordLimitOutput *)request->mOutput; - - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "limitPerOwner", &output->mLimitPerOwner)) || - gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "numOwned", &output->mNumOwned))) - { - return SAKERequestResult_MALFORMED_RESPONSE; - } - - return SAKERequestResult_SUCCESS; -} - -SAKEStartRequestResult SAKE_CALL sakeiStartGetRecordLimitRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKEGetRecordLimitOutput), - SAKEI_FUNC_NAME_STRINGS("GetRecordLimit"), - sakeiGetRecordLimitValidateInput, - sakeiGetRecordLimitFillSoapRequest, - sakeiGetRecordLimitProcessSoapResponse - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Get Record Count - -static SAKEStartRequestResult SAKE_CALL sakeiGetRecordCountValidateInput(SAKERequest request) -{ - SAKEGetRecordCountInput *input = (SAKEGetRecordCountInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKEStartRequestResult SAKE_CALL sakeiGetRecordCountFillSoapRequest(SAKERequest request) -{ - SAKEGetRecordCountInput *input = (SAKEGetRecordCountInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // write the filter - if(input->mFilter != NULL) - gsXmlWriteTStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "filter", input->mFilter); - - // write the cache flag - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "cacheFlag", (gsi_u32)input->mCacheFlag); - - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiGetRecordCountProcessSoapResponse(SAKERequest request) -{ - SAKEGetRecordCountOutput *output = (SAKEGetRecordCountOutput *)request->mOutput; - - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "count", &output->mCount))) - { - return SAKERequestResult_MALFORMED_RESPONSE; - } - - return SAKERequestResult_SUCCESS; -} - - -SAKEStartRequestResult SAKE_CALL sakeiStartGetRecordCountRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKEGetRandomRecordOutput), - SAKEI_FUNC_NAME_STRINGS("GetRecordCount"), - sakeiGetRecordCountValidateInput, - sakeiGetRecordCountFillSoapRequest, - sakeiGetRecordCountProcessSoapResponse - }; - - return sakeiStartRequest(request, &info); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestModify.c b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestModify.c deleted file mode 100644 index 839e47b7f3b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestModify.c +++ /dev/null @@ -1,290 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeRequestInternal.h" -#include "sakeRequest.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKEStartRequestResult SAKE_CALL sakeiValidateRequestFields(SAKEField *fields, int numFields) -{ - int i; - - for(i = 0 ; i < numFields ; i++) - { - if(!fields[i].mName || !fields[i].mName[0]) - return SAKEStartRequestResult_BAD_FIELD_NAME; - if((fields[i].mType >= SAKEFieldType_NUM_FIELD_TYPES)) - return SAKEStartRequestResult_BAD_FIELD_TYPE; - if(fields[i].mType == SAKEFieldType_ASCII_STRING) - { - if(!fields[i].mValue.mAsciiString) - return SAKEStartRequestResult_BAD_FIELD_VALUE; - } - if(fields[i].mType == SAKEFieldType_UNICODE_STRING) - { - if(!fields[i].mValue.mUnicodeString) - return SAKEStartRequestResult_BAD_FIELD_VALUE; - } - if(fields[i].mType == SAKEFieldType_BINARY_DATA) - { - if(fields[i].mValue.mBinaryData.mLength < 0) - return SAKEStartRequestResult_BAD_FIELD_VALUE; - if(!fields[i].mValue.mBinaryData.mValue && (fields[i].mValue.mBinaryData.mLength > 0)) - return SAKEStartRequestResult_BAD_FIELD_VALUE; - } - } - - return SAKEStartRequestResult_SUCCESS; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiFillSoapRequestFieldValues(SAKERequest request, SAKEField *fields, int numFields) -{ - int i; - - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "values"); - - for(i = 0 ; i < numFields ; i++) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "RecordField"); - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "name", fields[i].mName); - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value"); - - // fill-in the type-specific value struct based on the type - if(fields[i].mType == SAKEFieldType_BYTE) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "byteValue"); - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mByte); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "byteValue"); - } - else if(fields[i].mType == SAKEFieldType_SHORT) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "shortValue"); - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mShort); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "shortValue"); - } - else if(fields[i].mType == SAKEFieldType_INT) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "intValue"); - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", (gsi_u32)fields[i].mValue.mInt); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "intValue"); - } - else if (fields[i].mType == SAKEFieldType_INT64) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "int64Value"); - gsXmlWriteInt64Element(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mInt64); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "int64Value"); - } - else if(fields[i].mType == SAKEFieldType_FLOAT) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "floatValue"); - gsXmlWriteFloatElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mFloat); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "floatValue"); - } - else if(fields[i].mType == SAKEFieldType_ASCII_STRING) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "asciiStringValue"); - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mAsciiString); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "asciiStringValue"); - } - else if(fields[i].mType == SAKEFieldType_UNICODE_STRING) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "unicodeStringValue"); - gsXmlWriteUnicodeStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mUnicodeString); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "unicodeStringValue"); - } - else if(fields[i].mType == SAKEFieldType_BOOLEAN) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "booleanValue"); - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", (gsi_u32)(gsi_is_false(fields[i].mValue.mBoolean)?0:1)); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "booleanValue"); - } - else if(fields[i].mType == SAKEFieldType_DATE_AND_TIME) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "dateAndTimeValue"); - gsXmlWriteDateTimeElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", fields[i].mValue.mDateAndTime); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "dateAndTimeValue"); - } - else if(fields[i].mType == SAKEFieldType_BINARY_DATA) - { - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "binaryDataValue"); - gsXmlWriteBase64BinaryElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value", - fields[i].mValue.mBinaryData.mValue, fields[i].mValue.mBinaryData.mLength); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "binaryDataValue"); - } - else - { - // a type isn't being handled - GS_FAIL_STR("Unhandled field type"); - } - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "value"); - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "RecordField"); - } - - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "values"); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Create Record - -static SAKEStartRequestResult SAKE_CALL sakeiCreateRecordValidateInput(SAKERequest request) -{ - SAKECreateRecordInput *input = (SAKECreateRecordInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - // check the num fields - if(input->mNumFields < 0) - return SAKEStartRequestResult_BAD_NUM_FIELDS; - - // check for NULL fields - if(!input->mFields && (input->mNumFields > 0)) - return SAKEStartRequestResult_BAD_FIELDS; - - // check the fields - return sakeiValidateRequestFields(input->mFields, input->mNumFields); -} - -static SAKEStartRequestResult SAKE_CALL sakeiCreateRecordFillSoapRequest(SAKERequest request) -{ - SAKECreateRecordInput *input = (SAKECreateRecordInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // fill in the field values - sakeiFillSoapRequestFieldValues(request, input->mFields, input->mNumFields); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiCreateRecordProcessSoapResponse(SAKERequest request) -{ - SAKECreateRecordOutput *output = (SAKECreateRecordOutput *)request->mOutput; - - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "recordid", &output->mRecordId))) - { - return SAKERequestResult_MALFORMED_RESPONSE; - } - - return SAKERequestResult_SUCCESS; -} - -SAKEStartRequestResult SAKE_CALL sakeiStartCreateRecordRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKECreateRecordOutput), - SAKEI_FUNC_NAME_STRINGS("CreateRecord"), - sakeiCreateRecordValidateInput, - sakeiCreateRecordFillSoapRequest, - sakeiCreateRecordProcessSoapResponse - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Update Record - -static SAKEStartRequestResult SAKE_CALL sakeiUpdateRecordValidateInput(SAKERequest request) -{ - SAKEUpdateRecordInput *input = (SAKEUpdateRecordInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - // check the num fields - if(input->mNumFields <= 0) - return SAKEStartRequestResult_BAD_NUM_FIELDS; - - // check for NULL fields - if(!input->mFields) - return SAKEStartRequestResult_BAD_FIELDS; - - // check the fields - return sakeiValidateRequestFields(input->mFields, input->mNumFields); -} - -static SAKEStartRequestResult SAKE_CALL sakeiUpdateRecordFillSoapRequest(SAKERequest request) -{ - SAKEUpdateRecordInput *input = (SAKEUpdateRecordInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // write the recordid - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "recordid", (gsi_u32)input->mRecordId); - - // fill in the field values - sakeiFillSoapRequestFieldValues(request, input->mFields, input->mNumFields); - - return SAKEStartRequestResult_SUCCESS; -} - -SAKEStartRequestResult SAKE_CALL sakeiStartUpdateRecordRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - 0, - SAKEI_FUNC_NAME_STRINGS("UpdateRecord"), - sakeiUpdateRecordValidateInput, - sakeiUpdateRecordFillSoapRequest, - NULL - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Delete Record - -static SAKEStartRequestResult SAKE_CALL sakeiDeleteRecordValidateInput(SAKERequest request) -{ - SAKEDeleteRecordInput *input = (SAKEDeleteRecordInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKEStartRequestResult SAKE_CALL sakeiDeleteRecordFillSoapRequest(SAKERequest request) -{ - SAKEDeleteRecordInput *input = (SAKEDeleteRecordInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // write the recordid - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "recordid", (gsi_u32)input->mRecordId); - - return SAKEStartRequestResult_SUCCESS; -} - -SAKEStartRequestResult SAKE_CALL sakeiStartDeleteRecordRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - 0, - SAKEI_FUNC_NAME_STRINGS("DeleteRecord"), - sakeiDeleteRecordValidateInput, - sakeiDeleteRecordFillSoapRequest, - NULL - }; - - return sakeiStartRequest(request, &info); -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestRead.c b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestRead.c deleted file mode 100644 index 15772be3016..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sakeRequestRead.c +++ /dev/null @@ -1,674 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -#include "sakeRequestInternal.h" -#include "sakeRequest.h" - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKEStartRequestResult SAKE_CALL sakeiValidateRequestFieldNames(char **fields, int numFields) -{ - int i; - - for(i = 0 ; i < numFields ; i++) - { - if(!fields[i] || !fields[i][0]) - return SAKEStartRequestResult_BAD_FIELD_NAME; - } - - return SAKEStartRequestResult_SUCCESS; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiFillSoapRequestFieldNames(SAKERequest request, char **names, int numFields) -{ - int i; - - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "fields"); - - for(i = 0 ; i < numFields ; i++) - { - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "string", names[i]); - } - - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "fields"); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiFillSoapRequestRecordIds(SAKERequest request, int *recordIds, int numRecordIds) -{ - int i; - - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "recordids"); - - for(i = 0 ; i < numRecordIds ; i++) - { - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "int", (gsi_u32)recordIds[i]); - } - - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "recordids"); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiFillSoapRequestOwnerIds(SAKERequest request, int *ownerIds, int numOwnerIds) -{ - int i; - - gsXmlWriteOpenTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "ownerids"); - - for(i = 0 ; i < numOwnerIds ; i++) - { - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "int", (gsi_u32)ownerIds[i]); - } - - gsXmlWriteCloseTag(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "ownerids"); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static SAKERequestResult SAKE_CALL sakeiReadOutputRecords(SAKERequest request, SAKEField ***outputRecordsPtr, int *numRecords, - int numFields, char ** fieldNames) - -{ - SAKEField **outputRecords; - SAKEField *outputRecord; - SAKEField *outputField; - int recordIndex; - int fieldIndex; - size_t size; - - // get to the start of the values - if(gsi_is_false(gsXmlMoveToChild(request->mSoapResponse, "values"))) - return SAKERequestResult_MALFORMED_RESPONSE; - - // count the number of records - *numRecords = gsXmlCountChildren(request->mSoapResponse, "ArrayOfRecordValue"); - - // check for no records - if(*numRecords == 0) - { - *outputRecordsPtr = NULL; - return SAKERequestResult_SUCCESS; - } - - // allocate the array of records - size = (sizeof(SAKEField*) * *numRecords); - outputRecords = (SAKEField**)gsimalloc(size); - if(!outputRecords) - return SAKERequestResult_OUT_OF_MEMORY; - memset(outputRecords, 0, size); - *outputRecordsPtr = outputRecords; - - // loop through the records - for(recordIndex = 0 ; recordIndex < *numRecords ; recordIndex++) - { - // advance to this record - if(gsi_is_false(gsXmlMoveToNext(request->mSoapResponse, "ArrayOfRecordValue"))) - return SAKERequestResult_MALFORMED_RESPONSE; - - // allocate the array of record fields - size = (sizeof(SAKEField) * numFields); - outputRecord = (SAKEField*)gsimalloc(size); - if(!outputRecord) - return SAKERequestResult_OUT_OF_MEMORY; - memset(outputRecord, 0, size); - outputRecords[recordIndex] = outputRecord; - - // check for the wrong number of fields in the response - if(gsXmlCountChildren(request->mSoapResponse, "RecordValue") != numFields) - return SAKERequestResult_MALFORMED_RESPONSE; - - // fill in the array of fields for this record - for(fieldIndex = 0 ; fieldIndex < numFields ; fieldIndex++) - { - // utility pointer - outputField = &outputRecord[fieldIndex]; - - // set the name for this field - outputField->mName = fieldNames[fieldIndex]; - - // move to this field - if(gsi_is_false(gsXmlMoveToNext(request->mSoapResponse, "RecordValue"))) - return SAKERequestResult_MALFORMED_RESPONSE; - - // set the type and value based on the response field - if(gsXmlMoveToChild(request->mSoapResponse, "byteValue")) - { - int value; - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "value", &value))) - return SAKERequestResult_MALFORMED_RESPONSE; - outputField->mType = SAKEFieldType_BYTE; - outputField->mValue.mByte = (gsi_u8)value; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "shortValue")) - { - int value; - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "value", &value))) - return SAKERequestResult_MALFORMED_RESPONSE; - outputField->mType = SAKEFieldType_SHORT; - outputField->mValue.mShort = (gsi_i16)value; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "intValue")) - { - int value; - if(gsi_is_false(gsXmlReadChildAsInt(request->mSoapResponse, "value", &value))) - return SAKERequestResult_MALFORMED_RESPONSE; - outputField->mType = SAKEFieldType_INT; - outputField->mValue.mInt = (gsi_i32)value; - } - else if (gsXmlMoveToChild(request->mSoapResponse, "int64Value")) - { - gsi_i64 value; - if (gsi_is_false(gsXmlReadChildAsInt64(request->mSoapResponse, "value", &value))) - return SAKERequestResult_MALFORMED_RESPONSE; - outputField->mType = SAKEFieldType_INT64; - outputField->mValue.mInt64 = value; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "floatValue")) - { - float value; - if(gsi_is_false(gsXmlReadChildAsFloat(request->mSoapResponse, "value", &value))) - return SAKERequestResult_MALFORMED_RESPONSE; - outputField->mType = SAKEFieldType_FLOAT; - outputField->mValue.mFloat = value; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "asciiStringValue")) - { - char *value; - int len; - if(gsi_is_false(gsXmlReadChildAsString(request->mSoapResponse, "value", (const char**)&value, &len))) - return SAKERequestResult_MALFORMED_RESPONSE; - if(value) - value[len] = '\0'; - else - value = ""; - outputField->mType = SAKEFieldType_ASCII_STRING; - outputField->mValue.mAsciiString = value; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "unicodeStringValue")) - { - char *value; - gsi_u16 *valueUnicode; - int len; - if(gsi_is_false(gsXmlReadChildAsString(request->mSoapResponse, "value", (const char**)&value, &len))) - return SAKERequestResult_MALFORMED_RESPONSE; - if(value) - value[len] = '\0'; - else - value = ""; - valueUnicode = UTF8ToUCS2StringAlloc(value); - if(!valueUnicode) - return SAKERequestResult_OUT_OF_MEMORY; - outputField->mType = SAKEFieldType_UNICODE_STRING; - outputField->mValue.mUnicodeString = valueUnicode; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "booleanValue")) - { - char *value; - int len; - gsi_bool boolval; - if(gsi_is_false(gsXmlReadChildAsString(request->mSoapResponse, "value", (const char**)&value, &len))) - return SAKERequestResult_MALFORMED_RESPONSE; - if(value) - { - value[len] = '\0'; - boolval = (strcmp(value,"true") == 0)?gsi_true:gsi_false; - } - else - boolval = gsi_false; //if returned a NULL value, set bool to false - outputField->mType = SAKEFieldType_BOOLEAN; - outputField->mValue.mBoolean = boolval; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "dateAndTimeValue")) - { - time_t value; - if(gsi_is_false(gsXmlReadChildAsDateTimeElement(request->mSoapResponse, "value", &value))) - return SAKERequestResult_MALFORMED_RESPONSE; - outputField->mType = SAKEFieldType_DATE_AND_TIME; - outputField->mValue.mDateAndTime = value; - } - else if(gsXmlMoveToChild(request->mSoapResponse, "binaryDataValue")) - { - gsi_u8 *value; - int len; - if(gsi_is_false(gsXmlReadChildAsBase64Binary(request->mSoapResponse, "value", NULL, &len))) - return SAKERequestResult_MALFORMED_RESPONSE; - if(len > 0) - { - value = (gsi_u8*)gsimalloc((size_t)len); - if(!value) - return SAKERequestResult_OUT_OF_MEMORY; - if(gsi_is_false(gsXmlReadChildAsBase64Binary(request->mSoapResponse, "value", value, &len))) - { - gsifree(value); - return SAKERequestResult_MALFORMED_RESPONSE; - } - } - else - { - value = NULL; - len = 0; - } - outputField->mType = SAKEFieldType_BINARY_DATA; - outputField->mValue.mBinaryData.mLength = len; - outputField->mValue.mBinaryData.mValue = value; - } - else - { - GS_FAIL_STR("No recognized field type found in RecordValue"); - return SAKERequestResult_UNKNOWN_ERROR; - } - } - } - - return SAKERequestResult_SUCCESS; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiFreeOutputRecord(int numFields, SAKEField *record) -{ - int i; - - if(!record) - return; - - - //Check for binary data or unicode strings and free it if necessary - for (i = 0; i < numFields; i++) - { - if (record[i].mType == SAKEFieldType_BINARY_DATA && record[i].mValue.mBinaryData.mValue != NULL) - gsifree(record[i].mValue.mBinaryData.mValue); - if (record[i].mType == SAKEFieldType_UNICODE_STRING) - gsifree(record[i].mValue.mUnicodeString); - } - gsifree(record); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void SAKE_CALL sakeiFreeOutputRecords(int numFields, int numRecords, SAKEField **records) -{ - int i,j; - - if(!records) - return; - - for(i = 0 ; i < numRecords ; i++) - { - //Check for binary data or unicode strings and free it if necessary - for (j = 0; j < numFields; j++) - { - if (records[i][j].mType == SAKEFieldType_BINARY_DATA && records[i][j].mValue.mBinaryData.mValue != NULL) - gsifree(records[i][j].mValue.mBinaryData.mValue); - if (records[i][j].mType == SAKEFieldType_UNICODE_STRING) - gsifree(records[i][j].mValue.mUnicodeString); - } - - gsifree(records[i]); - } - gsifree(records); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Search For Records - -static SAKEStartRequestResult SAKE_CALL sakeiSearchForRecordsValidateInput(SAKERequest request) -{ - SAKESearchForRecordsInput *input = (SAKESearchForRecordsInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - // check the num fields - if(input->mNumFields <= 0) - return SAKEStartRequestResult_BAD_NUM_FIELDS; - - // check for NULL field names - if(!input->mFieldNames) - return SAKEStartRequestResult_BAD_FIELDS; - - // check the offset - if(input->mOffset < 0) - return SAKEStartRequestResult_BAD_OFFSET; - - // check the max - if(input->mMaxRecords <= 0) - return SAKEStartRequestResult_BAD_MAX; - - // check the field names - return sakeiValidateRequestFieldNames(input->mFieldNames, input->mNumFields); -} - -static SAKEStartRequestResult SAKE_CALL sakeiSearchForRecordsFillSoapRequest(SAKERequest request) -{ - SAKESearchForRecordsInput *input = (SAKESearchForRecordsInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // write the filter - if(input->mFilter != NULL) - gsXmlWriteTStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "filter", input->mFilter); - - // write the sort - if(input->mSort != NULL) - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "sort", input->mSort); - - // write the offset - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "offset", (gsi_u32)input->mOffset); - - // write the max - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "max", (gsi_u32)input->mMaxRecords); - - // write the target record filter - if(input->mTargetRecordFilter != NULL) - gsXmlWriteTStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "targetfilter", input->mTargetRecordFilter); - - // write the surrounding record count - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "surrounding", (gsi_u32)input->mSurroundingRecordsCount); - - // fill in the ownerids - sakeiFillSoapRequestOwnerIds(request, input->mOwnerIds, input->mNumOwnerIds); - - // write the cache flag - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "cacheFlag", (gsi_u32)input->mCacheFlag); - - - // fill in the field names - sakeiFillSoapRequestFieldNames(request, input->mFieldNames, input->mNumFields); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiSearchForRecordsProcessSoapResponse(SAKERequest request) -{ - SAKESearchForRecordsInput *input = (SAKESearchForRecordsInput *)request->mInput; - SAKESearchForRecordsOutput *output = (SAKESearchForRecordsOutput *)request->mOutput; - - // fill the output records - return sakeiReadOutputRecords(request, &output->mRecords, &output->mNumRecords, input->mNumFields, input->mFieldNames); -} - -static void sakeiSearchForRecordsFreeData(SAKERequest request) -{ - SAKESearchForRecordsInput *input = (SAKESearchForRecordsInput *)request->mInput; - SAKESearchForRecordsOutput *output = (SAKESearchForRecordsOutput *)request->mOutput; - - if(output) - sakeiFreeOutputRecords(input->mNumFields, output->mNumRecords, output->mRecords); -} - -SAKEStartRequestResult SAKE_CALL sakeiStartSearchForRecordsRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKESearchForRecordsOutput), - SAKEI_FUNC_NAME_STRINGS("SearchForRecords"), - sakeiSearchForRecordsValidateInput, - sakeiSearchForRecordsFillSoapRequest, - sakeiSearchForRecordsProcessSoapResponse, - sakeiSearchForRecordsFreeData - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Get My Records - -static SAKEStartRequestResult SAKE_CALL sakeiGetMyRecordsValidateInput(SAKERequest request) -{ - SAKEGetMyRecordsInput *input = (SAKEGetMyRecordsInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - // check the num fields - if(input->mNumFields <= 0) - return SAKEStartRequestResult_BAD_NUM_FIELDS; - - // check for NULL field names - if(!input->mFieldNames) - return SAKEStartRequestResult_BAD_FIELDS; - - // check the field names - return sakeiValidateRequestFieldNames(input->mFieldNames, input->mNumFields); -} - -static SAKEStartRequestResult SAKE_CALL sakeiGetMyRecordsFillSoapRequest(SAKERequest request) -{ - SAKEGetMyRecordsInput *input = (SAKEGetMyRecordsInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // fill in the field names - sakeiFillSoapRequestFieldNames(request, input->mFieldNames, input->mNumFields); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiGetMyRecordsProcessSoapResponse(SAKERequest request) -{ - SAKEGetMyRecordsInput *input = (SAKEGetMyRecordsInput *)request->mInput; - SAKEGetMyRecordsOutput *output = (SAKEGetMyRecordsOutput *)request->mOutput; - - // fill the output records - return sakeiReadOutputRecords(request, &output->mRecords, &output->mNumRecords, input->mNumFields, input->mFieldNames); -} - -static void sakeiGetMyRecordsFreeData(SAKERequest request) -{ - SAKEGetMyRecordsInput *input = (SAKEGetMyRecordsInput *)request->mInput; - SAKEGetMyRecordsOutput *output = (SAKEGetMyRecordsOutput *)request->mOutput; - - if(output) - sakeiFreeOutputRecords(input->mNumFields, output->mNumRecords, output->mRecords); -} - -SAKEStartRequestResult SAKE_CALL sakeiStartGetMyRecordsRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKEGetMyRecordsOutput), - SAKEI_FUNC_NAME_STRINGS("GetMyRecords"), - sakeiGetMyRecordsValidateInput, - sakeiGetMyRecordsFillSoapRequest, - sakeiGetMyRecordsProcessSoapResponse, - sakeiGetMyRecordsFreeData - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Get Specific Records - -static SAKEStartRequestResult SAKE_CALL sakeiGetSpecificRecordsValidateInput(SAKERequest request) -{ - SAKEGetSpecificRecordsInput *input = (SAKEGetSpecificRecordsInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - // check the num recordids - if(input->mNumRecordIds <= 0) - return SAKEStartRequestResult_BAD_NUM_RECORDIDS; - - // check the recordids - if(!input->mRecordIds) - return SAKEStartRequestResult_BAD_RECORDIDS; - - // check the num fields - if(input->mNumFields <= 0) - return SAKEStartRequestResult_BAD_NUM_FIELDS; - - // check for NULL field names - if(!input->mFieldNames) - return SAKEStartRequestResult_BAD_FIELDS; - - // check the field names - return sakeiValidateRequestFieldNames(input->mFieldNames, input->mNumFields); -} - -static SAKEStartRequestResult SAKE_CALL sakeiGetSpecificRecordsFillSoapRequest(SAKERequest request) -{ - SAKEGetSpecificRecordsInput *input = (SAKEGetSpecificRecordsInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // fill in the recordids - sakeiFillSoapRequestRecordIds(request, input->mRecordIds, input->mNumRecordIds); - - // fill in the field names - sakeiFillSoapRequestFieldNames(request, input->mFieldNames, input->mNumFields); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiGetSpecificRecordsProcessSoapResponse(SAKERequest request) -{ - SAKEGetSpecificRecordsInput *input = (SAKEGetSpecificRecordsInput *)request->mInput; - SAKEGetSpecificRecordsOutput *output = (SAKEGetSpecificRecordsOutput *)request->mOutput; - - // fill the output records - return sakeiReadOutputRecords(request, &output->mRecords, &output->mNumRecords, input->mNumFields, input->mFieldNames); -} - -static void sakeiGetSpecificRecordsFreeData(SAKERequest request) -{ - SAKEGetSpecificRecordsInput *input = (SAKEGetSpecificRecordsInput *)request->mInput; - SAKEGetSpecificRecordsOutput *output = (SAKEGetSpecificRecordsOutput *)request->mOutput; - - if(output) - sakeiFreeOutputRecords(input->mNumFields, output->mNumRecords, output->mRecords); -} - -SAKEStartRequestResult SAKE_CALL sakeiStartGetSpecificRecordsRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKEGetSpecificRecordsOutput), - SAKEI_FUNC_NAME_STRINGS("GetSpecificRecords"), - sakeiGetSpecificRecordsValidateInput, - sakeiGetSpecificRecordsFillSoapRequest, - sakeiGetSpecificRecordsProcessSoapResponse, - sakeiGetSpecificRecordsFreeData - }; - - return sakeiStartRequest(request, &info); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// Get Random Record - -static SAKEStartRequestResult SAKE_CALL sakeiGetRandomRecordValidateInput(SAKERequest request) -{ - SAKEGetRandomRecordInput *input = (SAKEGetRandomRecordInput *)request->mInput; - - // check the tableid - if(!input->mTableId) - return SAKEStartRequestResult_BAD_TABLEID; - - // check the num fields - if(input->mNumFields <= 0) - return SAKEStartRequestResult_BAD_NUM_FIELDS; - - // check for NULL field names - if(!input->mFieldNames) - return SAKEStartRequestResult_BAD_FIELDS; - - // check the field names - return sakeiValidateRequestFieldNames(input->mFieldNames, input->mNumFields); -} - -static SAKEStartRequestResult SAKE_CALL sakeiGetRandomRecordFillSoapRequest(SAKERequest request) -{ - SAKEGetRandomRecordInput *input = (SAKEGetRandomRecordInput *)request->mInput; - - // write the table id - gsXmlWriteStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "tableid", input->mTableId); - - // write the filter - if(input->mFilter != NULL) - gsXmlWriteTStringElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "filter", input->mFilter); - - // write the max - gsXmlWriteIntElement(request->mSoapRequest, GSI_SAKE_SERVICE_NAMESPACE, "max", 1); - - // fill in the field names - sakeiFillSoapRequestFieldNames(request, input->mFieldNames, input->mNumFields); - - return SAKEStartRequestResult_SUCCESS; -} - -static SAKERequestResult sakeiGetRandomRecordProcessSoapResponse(SAKERequest request) -{ - SAKEGetRandomRecordInput *input = (SAKEGetRandomRecordInput *)request->mInput; - SAKEGetRandomRecordOutput *output = (SAKEGetRandomRecordOutput *)request->mOutput; - SAKEField **records; - int numRecords; - - // fill the output record - SAKERequestResult result = sakeiReadOutputRecords(request, &records, &numRecords, input->mNumFields, input->mFieldNames); - if(result == SAKERequestResult_SUCCESS) - { - if((records != NULL) && (numRecords > 0)) - output->mRecord = records[0]; - else - output->mRecord = NULL; - } - //free up the outer record pointer - gsifree(records); - - return result; -} - -static void sakeiGetRandomRecordFreeData(SAKERequest request) -{ - SAKEGetRandomRecordInput *input = (SAKEGetRandomRecordInput *)request->mInput; - SAKEGetRandomRecordOutput *output = (SAKEGetRandomRecordOutput *)request->mOutput; - - if(output) - sakeiFreeOutputRecord(input->mNumFields, output->mRecord); - -} - -SAKEStartRequestResult SAKE_CALL sakeiStartGetRandomRecordRequest(SAKERequest request) -{ - static SAKEIRequestInfo info = - { - sizeof(SAKEGetRandomRecordOutput), - SAKEI_FUNC_NAME_STRINGS("GetRandomRecords"), - sakeiGetRandomRecordValidateInput, - sakeiGetRandomRecordFillSoapRequest, - sakeiGetRandomRecordProcessSoapResponse, - sakeiGetRandomRecordFreeData - }; - - return sakeiStartRequest(request, &info); -} - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake_vs2005.sln b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake_vs2005.sln deleted file mode 100644 index f6ae0319ebe..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake_vs2005.sln +++ /dev/null @@ -1,34 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "saketest_vs2005", "saketest\saketest_vs2005.vcproj", "{3134EE04-96C9-417C-808D-60D34FC8DE34}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfsapp1:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = saketest\\saketest_vs2005.vcproj - SccProjectName1 = saketest - SccLocalPath1 = saketest - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Unicode Debug|Win32 = Unicode Debug|Win32 - Unicode Release|Win32 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Debug|Win32.ActiveCfg = Debug|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Debug|Win32.Build.0 = Debug|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Release|Win32.ActiveCfg = Release|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Release|Win32.Build.0 = Release|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32 - {3134EE04-96C9-417C-808D-60D34FC8DE34}.Unicode Release|Win32.Build.0 = Unicode Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake_vs2005.vssscc b/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake_vs2005.vssscc deleted file mode 100644 index 6cb031bcf51..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/sake_vs2005.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakelinux/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakelinux/Makefile deleted file mode 100644 index 19f0ee83b3b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakelinux/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# SAKE SDK Makefile -# Copyright 2004 GameSpy Industries - -PROJECT=sakelinux - -CC=gcc -BASE_CFLAGS=-D_LINUX -DGSI_COMMON_DEBUG -D_DEBUG -DGSI_NO_THREADS - -#use these cflags to optimize it -CFLAGS=$(BASE_CFLAGS) -march=i486 -O6 -ffast-math -funroll-loops \ - -fomit-frame-pointer -fexpensive-optimizations -falign-loops=2 \ - -falign-jumps=2 -falign-functions=2 - -#use these when debugging -DEBUG_CFLAGS=$(BASE_CFLAGS) -g -lpthread -march=i486 -O6 - -PROG_OBJS = \ - ../../../md5c.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/linux/LinuxCommon.o\ - ../../../common/gsAssert.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsCore.o\ - ../../../common/gsDebug.o\ - ../../../common/gsCrypt.o\ - ../../../common/gsLargeInt.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsXML.o\ - ../../../common/gsSHA1.o\ - ../../../common/gsRC4.o\ - ../../../common/gsSSL.o\ - ../../../common/gsSoap.o\ - ../../../common/gsUdpEngine.o\ - ../../../gp/gp.o\ - ../../../gp/gpi.o\ - ../../../gp/gpiBuddy.o\ - ../../../gp/gpiBuffer.o\ - ../../../gp/gpiCallback.o\ - ../../../gp/gpiConnect.o\ - ../../../gp/gpiInfo.o\ - ../../../gp/gpiKeys.o\ - ../../../gp/gpiOperation.o\ - ../../../gp/gpiPeer.o\ - ../../../gp/gpiProfile.o\ - ../../../gp/gpiSearch.o\ - ../../../gp/gpiUnique.o\ - ../../../gp/gpiUtility.o\ - ../../../gp/gpiTransfer.o\ - ../../../ghttp/ghttpBuffer.o\ - ../../../ghttp/ghttpCallbacks.o\ - ../../../ghttp/ghttpConnection.o\ - ../../../ghttp/ghttpEncryption.o\ - ../../../ghttp/ghttpMain.o\ - ../../../ghttp/ghttpProcess.o\ - ../../../ghttp/ghttpCommon.o\ - ../../../ghttp/ghttpPost.o\ - ../../../gt2/gt2Auth.o\ - ../../../gt2/gt2Buffer.o\ - ../../../gt2/gt2Callback.o\ - ../../../gt2/gt2Connection.o\ - ../../../gt2/gt2Filter.o\ - ../../../gt2/gt2Main.o\ - ../../../gt2/gt2Message.o\ - ../../../gt2/gt2Socket.o\ - ../../../gt2/gt2Encode.o\ - ../../../gt2/gt2Utility.o\ - ../../sakeMain.o\ - ../../sakeRequest.o\ - ../../sakeRequestMisc.o\ - ../../sakeRequestModify.o\ - ../../sakeRequestRead.o\ - ../saketest.o - - -############################################################################# -# SETUP AND BUILD -############################################################################# - -$(PROJECT): $(PROG_OBJS) - $(CC) $(DEBUG_CFLAGS) -o $@ $(PROG_OBJS) - -############################################################################# -# MISC -############################################################################# -ghttp_debug: $(PROG_OBJS) - $(CC) $(DEBUG_CFLAGS) -o $@ $(PROG_OBJS) - -clean: - rm -f $(PROG_OBJS) - -depend: - gcc -MM $(PROG_OBJS:.o=.c) - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakemacosx/Makefile b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakemacosx/Makefile deleted file mode 100644 index e76b9936dc3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakemacosx/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Sake SDK Makefile - Mac OSX -# Copyright 2006 GameSpy Industries - -PROJECT=saketest - -DEFINES=-D_MACOSX -DGSI_NO_THREADS - -PROG_OBJS = \ - ../../../md5c.o\ - ../../../darray.o\ - ../../../hashtable.o\ - ../../../common/gsAssert.o\ - ../../../common/gsAvailable.o\ - ../../../common/gsCore.o\ - ../../../common/gsDebug.o\ - ../../../common/gsCrypt.o\ - ../../../common/gsLargeInt.o\ - ../../../common/gsStringUtil.o\ - ../../../common/gsPlatform.o\ - ../../../common/gsPlatformSocket.o\ - ../../../common/gsPlatformThread.o\ - ../../../common/gsPlatformUtil.o\ - ../../../common/gsMemory.o\ - ../../../common/gsXML.o\ - ../../../common/gsSHA1.o\ - ../../../common/gsRC4.o\ - ../../../common/gsSSL.o\ - ../../../common/gsSoap.o\ - ../../../common/gsUdpEngine.o\ - ../../../common/macosx/MacOSXCommon.o\ - ../../../gp/gp.o\ - ../../../gp/gpi.o\ - ../../../gp/gpiBuddy.o\ - ../../../gp/gpiBuffer.o\ - ../../../gp/gpiCallback.o\ - ../../../gp/gpiConnect.o\ - ../../../gp/gpiInfo.o\ - ../../../gp/gpiKeys.o\ - ../../../gp/gpiOperation.o\ - ../../../gp/gpiPeer.o\ - ../../../gp/gpiProfile.o\ - ../../../gp/gpiSearch.o\ - ../../../gp/gpiUnique.o\ - ../../../gp/gpiUtility.o\ - ../../../gp/gpiTransfer.o\ - ../../../ghttp/ghttpBuffer.o\ - ../../../ghttp/ghttpCallbacks.o\ - ../../../ghttp/ghttpConnection.o\ - ../../../ghttp/ghttpEncryption.o\ - ../../../ghttp/ghttpMain.o\ - ../../../ghttp/ghttpProcess.o\ - ../../../ghttp/ghttpCommon.o\ - ../../../ghttp/ghttpPost.o\ - ../../../gt2/gt2Auth.o\ - ../../../gt2/gt2Buffer.o\ - ../../../gt2/gt2Callback.o\ - ../../../gt2/gt2Connection.o\ - ../../../gt2/gt2Filter.o\ - ../../../gt2/gt2Main.o\ - ../../../gt2/gt2Message.o\ - ../../../gt2/gt2Socket.o\ - ../../../gt2/gt2Encode.o\ - ../../../gt2/gt2Utility.o\ - ../../sakeMain.o\ - ../../sakeRequest.o\ - ../../sakeRequestMisc.o\ - ../../sakeRequestModify.o\ - ../../sakeRequestRead.o\ - ../saketest.o - -#Include the stuff common to the GameSpy.net SDKs -include ../../../common/macosx/Makefile.common diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/Nitro.lcf b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/Nitro.lcf deleted file mode 100644 index 998f6b00259..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/Nitro.lcf +++ /dev/null @@ -1,493 +0,0 @@ -#--------------------------------------------------------------------------- -# Project: NitroSDK - tools - makelcf -# File: ARM9-TS.lcf.template -# -# Copyright 2003-2006 Nintendo. All rights reserved. -# -# These coded instructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ARM9-TS.lcf.template,v $ -# Revision 1.34 04/06/2006 09:02:36 kitase_hirotake -# support for .itcm.bss and .dtcm.bss -# -# Revision 1.33 03/30/2006 23:59:22 AM yasu -# changed creation year -# -# Revision 1.32 03/29/2006 13:14:22 AM yasu -# support for overlays in CWVER 2.x -# -# Revision 1.31 11/24/2005 01:16:47 yada -# change start address of mainEX arena from 0x2400000 to 0x23e0000 -# -# Revision 1.30 09/02/2005 04:14:22 AM yasu -# Old symbols were redefined so they can be used even under SDK2.2 -# -# Revision 1.29 08/31/2005 09:34:57 AM yasu -# Corrected a problem where code would not function normally when using section names such as section_BSS -# -# Revision 1.28 08/26/2005 11:22:16 AM yasu -# overlay support for ITCM/DTCM -# -# Revision 1.27 06/20/2005 12:29:20 AM yasu -# Changed Surffix to Suffix -# -# Revision 1.26 06/14/2005 09:03:42 yada -# fix around minus value of SDK_STACKSIZE -# -# Revision 1.25 04/13/2005 12:51:00 terui -# Change SDK_AUTOLOAD.DTCM.START 0x027c0000 -> 0x027e0000 -# -# Revision 1.24 03/30/2005 00:02:14 yosizaki -# fix copyright header. -# -# Revision 1.23 03/25/2005 12:54:59 AM yasu -# Include .version section -# -# Revision 1.22 10/03/2004 02:00:56 AM yasu -# Output component file list for compstatic tool -# -# Revision 1.21 09/27/2004 05:28:21 AM yasu -# Support .sinit -# -# Revision 1.20 09/09/2004 11:49:20 AM yasu -# Support compstatic in default -# -# Revision 1.19 09/06/2004 06:40:00 AM yasu -# Add labels for digest -# -# Revision 1.18 08/20/2004 06:19:59 AM yasu -# DTCM moves to 0x027c0000 at default -# -# Revision 1.17 08/02/2004 10:38:53 AM yasu -# Add autoload-done callback address in overlaydefs -# -# Revision 1.16 07/26/2004 02:22:32 AM yasu -# Change DTCM address to 0x023c0000 -# -# Revision 1.15 07/26/2004 00:08:27 AM yasu -# Fix label of exception table -# -# Revision 1.14 07/24/2004 05:42:25 AM yasu -# Set default values for SDK_AUTOGEN_xTCM_START -# -# Revision 1.13 07/23/2004 11:32:14 AM yasu -# Define labels for __exception_table_start__ and _end__ -# -# Revision 1.12 07/12/2004 12:21:08 AM yasu -# Check size of ITCM/DTCM -# -# Revision 1.11 07/10/2004 04:10:26 AM yasu -# Support command 'Library' -# -# Revision 1.10 07/02/2004 08:13:02 AM yasu -# Support OBJECT( ) -# -# Revision 1.9 07/01/2004 12:54:38 yasu -# support ITCM/DTCM/WRAM autoload -# -# Revision 1.8 07/01/2004 10:41:46 yasu -# support autoload -# -# Revision 1.7 06/02/2004 07:35:37 yasu -# Set libsyscall.a in FORCE_ACTIVE -# Put NitroMain at the top of ROM image -# -# Revision 1.6 06/02/2004 04:56:28 yasu -# Change to fit to new ROM map of TS -# -# Revision 1.5 2004/06/01 06:12:00 miya -# add padding at top of ROM image. -# -# Revision 1.4 04/26/2004 12:16:48 yasu -# add KEEP_SECTIONS -# -# Revision 1.3 04/20/2004 07:41:32 yasu -# Set STATICINIT instead of .ctor temporarily -# -# Revision 1.2 04/14/2004 07:16:42 yasu -# add ALIGN(32) for convenience to handle cache line -# -# Revision 1.1 04/06/2004 01:59:54 yasu -# newly added -# -# $NoKeywords: $ -#--------------------------------------------------------------------------- -MEMORY -{ - main (RWX) : ORIGIN = 0x02000000, LENGTH = 0x0 > main.sbin - ITCM (RWX) : ORIGIN = 0x01ff8000, LENGTH = 0x0 >> main.sbin - DTCM (RWX) : ORIGIN = 0x027e0000, LENGTH = 0x0 >> main.sbin - binary.AUTOLOAD_INFO (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - binary.STATIC_FOOTER (RWX) : ORIGIN = 0, LENGTH = 0x0 >> main.sbin - - main_defs (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_defs.sbin - main_table (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 > main_table.sbin - dummy.MAIN_EX (RW) : ORIGIN = 0x023e0000, LENGTH = 0x0 - arena.MAIN (RW) : ORIGIN = AFTER(main), LENGTH = 0x0 - arena.MAIN_EX (RW) : ORIGIN = AFTER(dummy.MAIN_EX), LENGTH = 0x0 - arena.ITCM (RW) : ORIGIN = AFTER(ITCM), LENGTH = 0x0 - arena.DTCM (RW) : ORIGIN = AFTER(DTCM), LENGTH = 0x0 - binary.MODULE_FILES (RW) : ORIGIN = 0x0, LENGTH = 0x0 > component.files - check.ITCM (RWX) : ORIGIN = 0x0, LENGTH = 0x08000 > itcm.check - check.DTCM (RW) : ORIGIN = 0x0, LENGTH = 0x04000 > dtcm.check -} - -FORCE_ACTIVE -{ - SVC_SoftReset -} - -KEEP_SECTION -{ - .sinit -} - -SECTIONS -{ - ############################ STATIC ################################# - .main: - { - ALIGNALL(4); . = ALIGN(32); # Fit to cache line - - # - # TEXT BLOCK: READ ONLY - # - SDK_STATIC_START =.; - SDK_STATIC_TEXT_START =.; - #:::::::::: text/rodata - libsyscall.a (.text) - crt0.o (.text) - crt0.o (.rodata) - * (.version) - OBJECT(NitroMain,*) - GROUP(ROOT) (.text) - . = ALIGN(4); - * (.exception) - . = ALIGN(4); - SDK_STATIC_ETABLE_START =.; - EXCEPTION - SDK_STATIC_ETABLE_END =.; - . = ALIGN(4); - GROUP(ROOT) (.init) - . = ALIGN(4); - GROUP(ROOT) (.rodata) - . = ALIGN(4); - - SDK_STATIC_SINIT_START =.; - #:::::::::: ctor - GROUP(ROOT) (.ctor) - GROUP(ROOT) (.sinit) - WRITEW 0; - #:::::::::: ctor - SDK_STATIC_SINIT_END =.; - - #:::::::::: text/rodata - . = ALIGN(32); - SDK_STATIC_TEXT_END =.; - - # - # DATA BLOCK: READ WRITE - # - SDK_STATIC_DATA_START =.; - #:::::::::: data - GROUP(ROOT) (.sdata) - . = ALIGN(4); - GROUP(ROOT) (.data) - . = ALIGN(4); - SDK_OVERLAY_DIGEST =.; - # NO DIGEST - SDK_OVERLAY_DIGEST_END =.; - #:::::::::: data - . = ALIGN(32); - SDK_STATIC_DATA_END =.; - SDK_STATIC_END =.; - - SDK_STATIC_TEXT_SIZE = SDK_STATIC_TEXT_END - SDK_STATIC_TEXT_START; - SDK_STATIC_DATA_SIZE = SDK_STATIC_DATA_END - SDK_STATIC_DATA_START; - SDK_STATIC_SIZE = SDK_STATIC_END - SDK_STATIC_START; - __sinit__ = SDK_STATIC_SINIT_START; # for static initializer - __exception_table_start__ = SDK_STATIC_ETABLE_START; # for exception table - __exception_table_end__ = SDK_STATIC_ETABLE_END; # for exception table - } > main - - .main.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_STATIC_BSS_START =.; - #:::::::::: bss - GROUP(ROOT) (.sbss) - . = ALIGN(4); - GROUP(ROOT) (.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_STATIC_BSS_END = .; - SDK_STATIC_BSS_SIZE = SDK_STATIC_BSS_END - SDK_STATIC_BSS_START; - - } >> main - - - ############################ AUTOLOADS ############################## - SDK_AUTOLOAD.ITCM.START = 0x01ff8000; - SDK_AUTOLOAD.ITCM.END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.BSS_END = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD.ITCM.SIZE = 0; - SDK_AUTOLOAD.ITCM.BSS_SIZE = 0; - SDK_AUTOLOAD.DTCM.START = 0x027e0000; - SDK_AUTOLOAD.DTCM.END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.BSS_END = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD.DTCM.SIZE = 0; - SDK_AUTOLOAD.DTCM.BSS_SIZE = 0; - SDK_AUTOLOAD_START = SDK_STATIC_END; - SDK_AUTOLOAD_SIZE = 0; - SDK_AUTOLOAD_NUMBER = 2; - - .ITCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_ITCM_ID =0; - SDK_AUTOLOAD.ITCM.ID =0; - SDK_AUTOLOAD.ITCM.START =.; - SDK_AUTOLOAD.ITCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - * (.itcm) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.ITCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.ITCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.DATA_END =.; - SDK_AUTOLOAD.ITCM.END =.; - - SDK_AUTOLOAD.ITCM.TEXT_SIZE = SDK_AUTOLOAD.ITCM.TEXT_END - SDK_AUTOLOAD.ITCM.TEXT_START; - SDK_AUTOLOAD.ITCM.DATA_SIZE = SDK_AUTOLOAD.ITCM.DATA_END - SDK_AUTOLOAD.ITCM.DATA_START; - SDK_AUTOLOAD.ITCM.SIZE = SDK_AUTOLOAD.ITCM.END - SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.ITCM.SIZE; - - } > ITCM - - .ITCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.ITCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - * (.itcm.bss) - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.ITCM.BSS_END = .; - - SDK_AUTOLOAD.ITCM.BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_END - SDK_AUTOLOAD.ITCM.BSS_START; - - } >> ITCM - - .DTCM: - { - ALIGNALL(4); . = ALIGN(32); - - # - # TEXT BLOCK: READ ONLY - # - SDK_AUTOLOAD_DTCM_ID =1; - SDK_AUTOLOAD.DTCM.ID =1; - SDK_AUTOLOAD.DTCM.START =.; - SDK_AUTOLOAD.DTCM.TEXT_START =.; - #:::::::::: text/rodata - . = ALIGN(4); - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: text/rodata - SDK_AUTOLOAD.DTCM.TEXT_END =.; - - # - # DATA BLOCK: READ WRITE BLOCK - # - SDK_AUTOLOAD.DTCM.DATA_START =.; - #:::::::::: data - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm) - . = ALIGN(4); - #:::::::::: data - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.DATA_END =.; - SDK_AUTOLOAD.DTCM.END =.; - - SDK_AUTOLOAD.DTCM.TEXT_SIZE = SDK_AUTOLOAD.DTCM.TEXT_END - SDK_AUTOLOAD.DTCM.TEXT_START; - SDK_AUTOLOAD.DTCM.DATA_SIZE = SDK_AUTOLOAD.DTCM.DATA_END - SDK_AUTOLOAD.DTCM.DATA_START; - SDK_AUTOLOAD.DTCM.SIZE = SDK_AUTOLOAD.DTCM.END - SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SDK_AUTOLOAD.DTCM.SIZE; - - } > DTCM - - .DTCM.bss: - { - ALIGNALL(4); . = ALIGN(32); - - # - # BSS BLOCK - # - SDK_AUTOLOAD.DTCM.BSS_START = .; - #:::::::::: bss - . = ALIGN(4); - . = ALIGN(4); - * (.dtcm.bss) - . = ALIGN(4); - . = ALIGN(4); - #:::::::::: bss - . = ALIGN(32); - SDK_AUTOLOAD.DTCM.BSS_END = .; - - SDK_AUTOLOAD.DTCM.BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_END - SDK_AUTOLOAD.DTCM.BSS_START; - - } >> DTCM - - - SDK_AUTOLOAD_ITCM_START = SDK_AUTOLOAD.ITCM.START; - SDK_AUTOLOAD_ITCM_END = SDK_AUTOLOAD.ITCM.END; - SDK_AUTOLOAD_ITCM_BSS_END = SDK_AUTOLOAD.ITCM.BSS_END; - SDK_AUTOLOAD_ITCM_SIZE = SDK_AUTOLOAD.ITCM.SIZE; - SDK_AUTOLOAD_ITCM_BSS_SIZE = SDK_AUTOLOAD.ITCM.BSS_SIZE; - SDK_AUTOLOAD_DTCM_START = SDK_AUTOLOAD.DTCM.START; - SDK_AUTOLOAD_DTCM_END = SDK_AUTOLOAD.DTCM.END; - SDK_AUTOLOAD_DTCM_BSS_END = SDK_AUTOLOAD.DTCM.BSS_END; - SDK_AUTOLOAD_DTCM_SIZE = SDK_AUTOLOAD.DTCM.SIZE; - SDK_AUTOLOAD_DTCM_BSS_SIZE = SDK_AUTOLOAD.DTCM.BSS_SIZE; - - ############################ AUTOLOAD_INFO ########################## - .binary.AUTOLOAD_INFO: - { - WRITEW ADDR(.ITCM); - WRITEW SDK_AUTOLOAD.ITCM.SIZE; - WRITEW SDK_AUTOLOAD.ITCM.BSS_SIZE; - WRITEW ADDR(.DTCM); - WRITEW SDK_AUTOLOAD.DTCM.SIZE; - WRITEW SDK_AUTOLOAD.DTCM.BSS_SIZE; - } > binary.AUTOLOAD_INFO - - SDK_AUTOLOAD_LIST = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE; - SDK_AUTOLOAD_LIST_END = SDK_AUTOLOAD_START + SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - SDK_AUTOLOAD_SIZE = SDK_AUTOLOAD_SIZE + SIZEOF(.binary.AUTOLOAD_INFO); - - ############################ STATIC_FOOTER ########################## - .binary.STATIC_FOOTER: - { - WRITEW 0xdec00621; # LE(0x2106C0DE) = NITRO CODE - WRITEW _start_ModuleParams - ADDR(.main); - WRITEW 0; # NO DIGEST - } > binary.STATIC_FOOTER - - ############################ OVERLAYS ############################### - SDK_OVERLAY_NUMBER = 0; - - - ############################ MAIN EX ################################## - # MAIN EX Area - .dummy.MAIN_EX: - { - . = ALIGN(32); - } > dummy.MAIN_EX - - ############################ ARENA ################################## - .arena.MAIN: - { - . = ALIGN(32); - SDK_SECTION_ARENA_START =.; - } > arena.MAIN - - .arena.MAIN_EX: - { - . = ALIGN(32); - SDK_SECTION_ARENA_EX_START =.; - } > arena.MAIN_EX - - .arena.ITCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_ITCM_START =.; - } > arena.ITCM - - .arena.DTCM: - { - . = ALIGN(32); - SDK_SECTION_ARENA_DTCM_START =.; - } > arena.DTCM - - ############################ OVERLAYDEFS ############################ - .main_defs: - { - ### main module information - WRITEW ADDR(.main); # load address - WRITEW _start; # entry address - WRITEW SDK_STATIC_SIZE + SDK_AUTOLOAD_SIZE; # size of module - WRITEW _start_AutoloadDoneCallback; # callback autoload done - - ### overlay filename - - } > main_defs - - - ############################ OVERLAYTABLE ########################### - .main_table: - { - - } > main_table - - - ############################ OTHERS ################################# - SDK_MAIN_ARENA_LO = SDK_SECTION_ARENA_START; - SDK_IRQ_STACKSIZE = 4096; # allocated in DTCM - SDK_SYS_STACKSIZE = 0; # when 0 means all remains of DTCM - - # Module filelist - .binary.MODULE_FILES: - { - WRITES ("main.sbin"); - WRITES ("main_defs.sbin"); - WRITES ("main_table.sbin"); - } > binary.MODULE_FILES - - # ITCM/DTCM size checker => check AUTOLOAD_ITCM/DTCM - .check.ITCM: - { - . = . + SDK_AUTOLOAD_ITCM_SIZE + SDK_AUTOLOAD_ITCM_BSS_SIZE; - } > check.ITCM - - SDK_SYS_STACKSIZE_SIGN = (SDK_SYS_STACKSIZE < 0x80000000) * 2 - 1; - .check.DTCM: - { - . = . + SDK_AUTOLOAD_DTCM_SIZE + SDK_AUTOLOAD_DTCM_BSS_SIZE; - . = . + SDK_IRQ_STACKSIZE + SDK_SYS_STACKSIZE * SDK_SYS_STACKSIZE_SIGN; - } > check.DTCM - -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/ROM-TS.rsf b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/ROM-TS.rsf deleted file mode 100644 index cec9e1dbf9a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/ROM-TS.rsf +++ /dev/null @@ -1,116 +0,0 @@ -#---------------------------------------------------------------------------- -# Project: NitroSDK - include -# File: ROM-TS.lsf -# -# Copyright 2003-2005 Nintendo. All rights reserved. -# -# These coded insructions, statements, and computer programs contain -# proprietary information of Nintendo of America Inc. and/or Nintendo -# Company Ltd., and are protected by Federal copyright law. They may -# not be disclosed to third parties or copied or duplicated in any form, -# in whole or in part, without the prior written consent of Nintendo. -# -# $Log: ROM-TS.rsf,v $ -# Revision 1.6 2005/04/05 23:52:58 yosizaki -# fix copyright date. -# -# Revision 1.5 2005/04/05 12:16:10 yosizaki -# support RomSpeedType parameter. -# -# Revision 1.4 2004/09/21 02:18:49 yasu -# Add default banner -# -# Revision 1.3 2004/09/09 11:39:09 yasu -# Unified ROM-TS and ROM-TS-C, also ROM-TEG and ROM-TEG-C -# -# Revision 1.2 2004/05/26 12:03:38 yasu -# add :r option to get basename for supporting IDE with makerom -# -# Revision 1.1 2004/04/06 01:59:59 yasu -# newly added -# -# $NoKeywords: $ -#---------------------------------------------------------------------------- -# -# Nitro ROM SPEC FILE -# - -Arm9 -{ - Static "$(MAKEROM_ARM9:r).sbin$(COMPSUFFIX9)" - OverlayDefs "$(MAKEROM_ARM9:r)_defs.sbin$(COMPSUFFIX9)" - OverlayTable "$(MAKEROM_ARM9:r)_table.sbin$(COMPSUFFIX9)" - Elf "$(MAKEROM_ARM9:r).nef" -} - -Arm7 -{ - Static "$(MAKEROM_ARM7:r).sbin$(COMPSUFFIX7)" - OverlayDefs "$(MAKEROM_ARM7:r)_defs.sbin$(COMPSUFFIX7)" - OverlayTable "$(MAKEROM_ARM7:r)_table.sbin$(COMPSUFFIX7)" - Elf "$(MAKEROM_ARM7:r).nef" -} - -Property -{ - ### - ### Settings for FinalROM - ### - #### BEGIN - # - # TITLE NAME: Your product name within 12bytes - # - #TitleName "YourAppName" - - # - # MAKER CODE: Your company ID# in 2 ascii words - # issued by NINTENDO - # - #MakerCode "00" - - # - # REMASTER VERSION: Mastering version - # - #RomVersion 0 - - # - # ROM SPEED TYPE: [MROM/1TROM/UNDEFINED] - # - RomSpeedType $(MAKEROM_ROMSPEED) - - # - # ROM SIZE: in bit [64M/128M/256M/512M/1G/2G] - # - #RomSize 128M - #RomSize 256M - - # - # ROM PADDING: TRUE if finalrom - # - #RomFootPadding TRUE - - # - # ROM HEADER TEMPLATE: Provided to every product by NINTENDO - # - #RomHeaderTemplate ./etc/rom_header.template.sbin - - # - # BANNER FILE: generated from Banner Spec File - # - #BannerFile ./etc/myGameBanner.bnr - BannerFile $(NITROSDK_ROOT)/include/nitro/specfiles/default.bnr - - ### - ### - ### - #### END -} - -RomSpec -{ - Offset 0x00000000 - Segment ALL - HostRoot $(MAKEROM_ROMROOT) - Root / - File $(MAKEROM_ROMFILES) -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/sakenitrocw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/sakenitrocw.mcp deleted file mode 100644 index 3fc748cdcf9..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakenitrocw/sakenitrocw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps2prodg/sakeps2prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps2prodg/sakeps2prodg.sln deleted file mode 100644 index 78390efe00f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps2prodg/sakeps2prodg.sln +++ /dev/null @@ -1,43 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sakeps2prodg", "sakeps2prodg.vcproj", "{190F63A1-557A-4CAF-B92F-0C98884B422B}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfsapp1:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = sakeps2prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS2 EE Debug|Win32 = PS2 EE Debug|Win32 - PS2 EE Release|Win32 = PS2 EE Release|Win32 - PS2_INET_Debug|Win32 = PS2_INET_Debug|Win32 - PS2_INET_Release|Win32 = PS2_INET_Release|Win32 - PS2_SNSystems_Debug|Win32 = PS2_SNSystems_Debug|Win32 - PS2_SNSystems_Release|Win32 = PS2_SNSystems_Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2 EE Debug|Win32.ActiveCfg = PS2 EE Debug|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2 EE Debug|Win32.Build.0 = PS2 EE Debug|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2 EE Release|Win32.ActiveCfg = PS2 EE Release|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2 EE Release|Win32.Build.0 = PS2 EE Release|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_INET_Debug|Win32.ActiveCfg = PS2_INET_Debug|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_INET_Debug|Win32.Build.0 = PS2_INET_Debug|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_INET_Release|Win32.ActiveCfg = PS2_INET_Release|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_INET_Release|Win32.Build.0 = PS2_INET_Release|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_SNSystems_Debug|Win32.ActiveCfg = PS2_SNSystems_Debug|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_SNSystems_Debug|Win32.Build.0 = PS2_SNSystems_Debug|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_SNSystems_Release|Win32.ActiveCfg = PS2_SNSystems_Release|Win32 - {190F63A1-557A-4CAF-B92F-0C98884B422B}.PS2_SNSystems_Release|Win32.Build.0 = PS2_SNSystems_Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps2prodg/sakeps2prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps2prodg/sakeps2prodg.vcproj deleted file mode 100644 index 7743444be35..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps2prodg/sakeps2prodg.vcproj +++ /dev/null @@ -1,1019 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.sln deleted file mode 100644 index f4426418b99..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.sln +++ /dev/null @@ -1,27 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sakeps3prodg", "sakeps3prodg.vcproj", "{A089D0F3-E861-4309-89A4-A47A61401A3D}" -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = sakeps3prodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PS3 Debug|Win32 = PS3 Debug|Win32 - PS3 Release|Win32 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.ActiveCfg = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Debug|Win32.Build.0 = PS3 Debug|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.ActiveCfg = PS3 Release|Win32 - {A089D0F3-E861-4309-89A4-A47A61401A3D}.PS3 Release|Win32.Build.0 = PS3 Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vcproj deleted file mode 100644 index bb9c0411d50..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vcproj +++ /dev/null @@ -1,751 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vssscc b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vssscc deleted file mode 100644 index 6cb031bcf51..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakeps3prodg/sakeps3prodg.vssscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROJECT" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakepspprodg/sakepspprodg.sln b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakepspprodg/sakepspprodg.sln deleted file mode 100644 index ee9e692a8d0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakepspprodg/sakepspprodg.sln +++ /dev/null @@ -1,34 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sakepspprodg", "sakepspprodg.vcproj", "{962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}" - ProjectSection(WebsiteProperties) = preProject - Debug.AspNetCompiler.Debug = "True" - Release.AspNetCompiler.Debug = "False" - EndProjectSection -EndProject -Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 2 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = http://tfs.ign.com:8080/ - SccLocalPath0 = . - SccProjectUniqueName1 = sakepspprodg.vcproj - SccLocalPath1 = . - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - PSP Debug Opt|Win32 = PSP Debug Opt|Win32 - PSP Debug|Win32 = PSP Debug|Win32 - PSP Release|Win32 = PSP Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}.PSP Debug Opt|Win32.ActiveCfg = PSP Debug Opt|Win32 - {962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}.PSP Debug Opt|Win32.Build.0 = PSP Debug Opt|Win32 - {962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}.PSP Debug|Win32.ActiveCfg = PSP Debug|Win32 - {962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}.PSP Debug|Win32.Build.0 = PSP Debug|Win32 - {962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}.PSP Release|Win32.ActiveCfg = PSP Release|Win32 - {962BDE0F-6BDA-4C68-AAB6-9B35F7F9A4E0}.PSP Release|Win32.Build.0 = PSP Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakepspprodg/sakepspprodg.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakepspprodg/sakepspprodg.vcproj deleted file mode 100644 index 30662206fad..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakepspprodg/sakepspprodg.vcproj +++ /dev/null @@ -1,825 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakerevolutioncw/sakerevolutioncw.mcp b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakerevolutioncw/sakerevolutioncw.mcp deleted file mode 100644 index 3b5f93ab704..00000000000 Binary files a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakerevolutioncw/sakerevolutioncw.mcp and /dev/null differ diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest.c b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest.c deleted file mode 100644 index d082b6a7e7d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest.c +++ /dev/null @@ -1,1154 +0,0 @@ -#include "../../common/gsCommon.h" -#include "../../common/gsAvailable.h" -#include "../../common/gsCore.h" -#include "../../common/gsSoap.h" -#include "../sake.h" -#include "../../ghttp/ghttp.h" -#include "../../gp/gp.h" - -#if defined(_NITRO) - #include "../../common/nitro/screen.h" - #define printf Printf - #define vprintf VPrintf -#endif - -#define URL NULL - -#define GAMENAME _T("gmtest") -#define SECRET_KEY _T("HA6zkS") -#define GAMEID 0 - -#define PRODUCTID 0 -#define NAMESPACEID 0 -#define NICKNAME _T("gptestc1") -#define EMAIL _T("gptestc@gptestc.com") -#define PASSWORD _T("gptestc") - - -#define CHECK_GP_RESULT(func, errString) if(func != GP_NO_ERROR) { printf("%s\n", errString); exit(0); } - -#define SAKE_UPLOAD_AMOUNT 5028 - - -typedef struct DataStruct -{ - char pData[SAKE_UPLOAD_AMOUNT]; -} DataStruct; - -int NumOperations = 0; -GPConnection * pconn; -GPProfile profileid; - -#ifdef GSI_COMMON_DEBUG - static void DebugCallback(GSIDebugCategory theCat, GSIDebugType theType, - GSIDebugLevel theLevel, const char * theTokenStr, - va_list theParamList) - { - GSI_UNUSED(theLevel); - - printf("[%s][%s] ", - gGSIDebugCatStrings[theCat], - gGSIDebugTypeStrings[theType]); - - vprintf(theTokenStr, theParamList); - } -#endif - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static GSIACResult CheckServices(void) -{ - GSIACResult aResult; - GSIStartAvailableCheck(GAMENAME); - - // Continue processing while the check is in progress - do - { - aResult = GSIAvailableCheckThink(); - msleep(10); - } - while(aResult == GSIACWaiting); - - // Check the result - switch(aResult) - { - case GSIACAvailable: - printf("Online Services are available\r\n"); - break; - case GSIACUnavailable: - printf("Online services are unavailable\r\n"); - printf("Please visit www.mygame.com for more information.\r\n"); - break; - case GSIACTemporarilyUnavailable: - printf("Online services are temporarily unavailable.\r\n"); - printf("Please visit www.mygame.com for more information.\r\n"); - break; - default: - break; - }; - - return aResult; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void ConnectResponse(GPConnection * pconnection, GPConnectResponseArg * arg, void * param) -{ - if(arg->result == GP_NO_ERROR) - printf("Connected to GP\n"); - else - printf("GP Connection Attempt Failed\n"); - - profileid = arg->profile; - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -//GP callbacks, everything is a noop except for the error callback -static void Error(GPConnection * pconnection, GPErrorArg * arg, void * param) -{ - gsi_char * errorCodeString; - gsi_char * resultString; - -#define RESULT(x) case x: resultString = _T(#x); break; - switch(arg->result) - { - RESULT(GP_NO_ERROR) - RESULT(GP_MEMORY_ERROR) - RESULT(GP_PARAMETER_ERROR) - RESULT(GP_NETWORK_ERROR) - RESULT(GP_SERVER_ERROR) - default: - resultString = _T("Unknown result!\n"); - } - -#define ERRORCODE(x) case x: errorCodeString = _T(#x); break; - switch(arg->errorCode) - { - ERRORCODE(GP_GENERAL) - ERRORCODE(GP_PARSE) - ERRORCODE(GP_NOT_LOGGED_IN) - ERRORCODE(GP_BAD_SESSKEY) - ERRORCODE(GP_DATABASE) - ERRORCODE(GP_NETWORK) - ERRORCODE(GP_FORCED_DISCONNECT) - ERRORCODE(GP_CONNECTION_CLOSED) - ERRORCODE(GP_LOGIN) - ERRORCODE(GP_LOGIN_TIMEOUT) - ERRORCODE(GP_LOGIN_BAD_NICK) - ERRORCODE(GP_LOGIN_BAD_EMAIL) - ERRORCODE(GP_LOGIN_BAD_PASSWORD) - ERRORCODE(GP_LOGIN_BAD_PROFILE) - ERRORCODE(GP_LOGIN_PROFILE_DELETED) - ERRORCODE(GP_LOGIN_CONNECTION_FAILED) - ERRORCODE(GP_LOGIN_SERVER_AUTH_FAILED) - ERRORCODE(GP_NEWUSER) - ERRORCODE(GP_NEWUSER_BAD_NICK) - ERRORCODE(GP_NEWUSER_BAD_PASSWORD) - ERRORCODE(GP_UPDATEUI) - ERRORCODE(GP_UPDATEUI_BAD_EMAIL) - ERRORCODE(GP_NEWPROFILE) - ERRORCODE(GP_NEWPROFILE_BAD_NICK) - ERRORCODE(GP_NEWPROFILE_BAD_OLD_NICK) - ERRORCODE(GP_UPDATEPRO) - ERRORCODE(GP_UPDATEPRO_BAD_NICK) - ERRORCODE(GP_ADDBUDDY) - ERRORCODE(GP_ADDBUDDY_BAD_FROM) - ERRORCODE(GP_ADDBUDDY_BAD_NEW) - ERRORCODE(GP_ADDBUDDY_ALREADY_BUDDY) - ERRORCODE(GP_AUTHADD) - ERRORCODE(GP_AUTHADD_BAD_FROM) - ERRORCODE(GP_AUTHADD_BAD_SIG) - ERRORCODE(GP_STATUS) - ERRORCODE(GP_BM) - ERRORCODE(GP_BM_NOT_BUDDY) - ERRORCODE(GP_GETPROFILE) - ERRORCODE(GP_GETPROFILE_BAD_PROFILE) - ERRORCODE(GP_DELBUDDY) - ERRORCODE(GP_DELBUDDY_NOT_BUDDY) - ERRORCODE(GP_DELPROFILE) - ERRORCODE(GP_DELPROFILE_LAST_PROFILE) - ERRORCODE(GP_SEARCH) - ERRORCODE(GP_SEARCH_CONNECTION_FAILED) - default: - errorCodeString = _T("Unknown error code!\n"); - } - - if(arg->fatal) - { - printf( "-----------\n"); - printf( "GP FATAL ERROR\n"); - printf( "-----------\n"); - } - else - { - printf( "-----\n"); - printf( "GP ERROR\n"); - printf( "-----\n"); - } - _tprintf( _T("RESULT: %s (%d)\n"), resultString, arg->result); - _tprintf( _T("ERROR CODE: %s (0x%X)\n"), errorCodeString, arg->errorCode); - _tprintf( _T("ERROR STRING: %s\n"), arg->errorString); - - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void RecvBuddyRequest(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - - -static void RecvBuddyStatus(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void RecvBuddyMessage(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void RecvGameInvite(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - - -static void TransferCallback(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void RecvBuddyAuth(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - -static void RecvBuddyRevoke(GPConnection * pconnection, GPRecvBuddyMessageArg * arg, void * param) -{ - GSI_UNUSED(arg); - GSI_UNUSED(pconnection); - GSI_UNUSED(param); -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static int UnicodeStringLen(const unsigned short * str) -{ - const unsigned short * end = str; - while(*end++) - {} - return (end - str - 1); -} - -static void PrintSeperator(void) -{ - printf("*******************\n"); -} - -static const char * FieldTypeToString(SAKEField * field) -{ - static char buffer[32]; - SAKEFieldType type = field->mType; - - if(type == SAKEFieldType_BYTE) - return "byte"; - if(type == SAKEFieldType_SHORT) - return "short"; - if(type == SAKEFieldType_INT) - return "int"; - if(type == SAKEFieldType_FLOAT) - return "float"; - if(type == SAKEFieldType_ASCII_STRING) - return "asciiString"; - if(type == SAKEFieldType_UNICODE_STRING) - return "unicodeString"; - if(type == SAKEFieldType_BOOLEAN) - return "boolean"; - if(type == SAKEFieldType_DATE_AND_TIME) - return "dateAndTime"; - if(type == SAKEFieldType_BINARY_DATA) - { - sprintf(buffer, "binaryData-%d", field->mValue.mBinaryData.mLength); - return buffer; - } - if (type == SAKEFieldType_INT64) - { - return "int64"; - } - return "ERROR!! Invalid value type set"; -} - -static const char * FieldValueToString(SAKEField * field) -{ - static char buffer[64]; - SAKEFieldType type = field->mType; - SAKEValue * value = &field->mValue; - - if(type == SAKEFieldType_BYTE) - sprintf(buffer, "%d", (int)value->mByte); - else if(type == SAKEFieldType_SHORT) - sprintf(buffer, "%d", (int)value->mShort); - else if(type == SAKEFieldType_INT) - sprintf(buffer, "%d", value->mInt); - else if(type == SAKEFieldType_FLOAT) - sprintf(buffer, "%0.3f", value->mFloat); - else if(type == SAKEFieldType_ASCII_STRING) - return value->mAsciiString; - else if(type == SAKEFieldType_UNICODE_STRING) - { - // cap the value if it is too long (note, this is destructive) - if(UnicodeStringLen(value->mUnicodeString) > 20) - value->mUnicodeString[20] = 0; - UCS2ToAsciiString(value->mUnicodeString, buffer); - } - else if(type == SAKEFieldType_BOOLEAN) - return (value->mBoolean)?"true":"false"; - else if(type == SAKEFieldType_DATE_AND_TIME) - { - char * str = gsiSecondsToString(&value->mDateAndTime); - str[strlen(str) - 1] = '\0'; - return str; - } - else if(type == SAKEFieldType_BINARY_DATA) - { - int i; - int len = min(value->mBinaryData.mLength, 8); - for(i = 0 ; i < len ; i++) - sprintf(buffer + (len*2), "%0X", value->mBinaryData.mValue[i]); - buffer[len*2] = '\0'; - } - else if(type == SAKEFieldType_INT64) - { - gsiInt64ToString(buffer, value->mInt64); - } - else - return "ERROR!! Invalid value type set"; - - return buffer; -} - -static const char * RequestResultToString(SAKERequestResult requestResult) -{ - switch(requestResult) - { - case SAKERequestResult_SUCCESS: - return "SUCCESS"; - case SAKERequestResult_CONNECTION_TIMEOUT: - return "CONNECTION_TIMEOUT"; - case SAKERequestResult_CONNECTION_ERROR: - return "CONNECTION_ERROR"; - case SAKERequestResult_MALFORMED_RESPONSE: - return "MALFORMED_RESPONSE"; - case SAKERequestResult_OUT_OF_MEMORY: - return "OUT_OF_MEMORY"; - case SAKERequestResult_DATABASE_UNAVAILABLE: - return "DATABASE_UNAVAILABLE"; - case SAKERequestResult_LOGIN_TICKET_INVALID: - return "LOGIN_TICKET_INVALID"; - case SAKERequestResult_LOGIN_TICKET_EXPIRED: - return "LOGIN_TICKET_EXPIRED"; - case SAKERequestResult_TABLE_NOT_FOUND: - return "TABLE_NOT_FOUND"; - case SAKERequestResult_RECORD_NOT_FOUND: - return "RECORD_NOT_FOUND"; - case SAKERequestResult_FIELD_NOT_FOUND: - return "FIELD_NOT_FOUND"; - case SAKERequestResult_FIELD_TYPE_INVALID: - return "FIELD_TYPE_INVALID"; - case SAKERequestResult_NO_PERMISSION: - return "NO_PERMISSION"; - case SAKERequestResult_RECORD_LIMIT_REACHED: - return "RECORD_LIMIT_REACHED"; - case SAKERequestResult_ALREADY_RATED: - return "ALREADY_RATED"; - case SAKERequestResult_NOT_RATEABLE: - return "NOT_RATEABLE"; - case SAKERequestResult_NOT_OWNED: - return "NOT_OWNED"; - case SAKERequestResult_FILTER_INVALID: - return "FILTER_INVALID"; - case SAKERequestResult_SORT_INVALID: - return "SORT_INVALID"; - case SAKERequestResult_UNKNOWN_ERROR: - return "UNKNOWN_ERROR"; - default: - break; - } - - return "Unrecognized error"; -} - -// prints request result, returns gsi_false for errors -static gsi_bool HandleRequestResult(SAKERequestResult requestResult, const char * requestType) -{ - if(requestResult != SAKERequestResult_SUCCESS) - { - printf("%s - Error - %s\n", requestType, RequestResultToString(requestResult)); - return gsi_false; - } - - printf("%s - Success\n", requestType); - return gsi_true; -} - -static void DisplayReadResults(SAKEField ** records, int numRecords, int numFields) -{ - SAKEField * field; - int recordIndex; - int fieldIndex; - - PrintSeperator(); - printf("Num Records: %d\n", numRecords); - PrintSeperator(); - - for(recordIndex = 0 ; recordIndex < numRecords ; recordIndex++) - { - for(fieldIndex = 0 ; fieldIndex < numFields ; fieldIndex++) - { - field = &records[recordIndex][fieldIndex]; - printf("%s[%s]=%s\n", field->mName, FieldTypeToString(field), FieldValueToString(field)); - } - - PrintSeperator(); - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void CreateRecordCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKECreateRecordOutput * output = (SAKECreateRecordOutput *)outputData; - - NumOperations--; - - if(HandleRequestResult(result, "CreateRecord") == gsi_false) - return; - - printf("Created recordid %d\n", output->mRecordId); - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(inputData); - GSI_UNUSED(userData); -} - -static void UpdateRecordCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(inputData); - GSI_UNUSED(outputData); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "UpdateRecord") == gsi_false) - return; -} - -static void DeleteRecordCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(inputData); - GSI_UNUSED(outputData); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "DeleteRecord") == gsi_false) - return; -} - -static void SearchForRecordsCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKESearchForRecordsInput * input = (SAKESearchForRecordsInput *)inputData; - SAKESearchForRecordsOutput * output = (SAKESearchForRecordsOutput *)outputData; - - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "SearchForRecords") == gsi_false) - return; - - DisplayReadResults(output->mRecords, output->mNumRecords, input->mNumFields); -} - -static void GetMyRecordsCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKEGetMyRecordsInput * input = (SAKEGetMyRecordsInput *)inputData; - SAKEGetMyRecordsOutput * output = (SAKEGetMyRecordsOutput *)outputData; - - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "GetMyRecords") == gsi_false) - return; - - DisplayReadResults(output->mRecords, output->mNumRecords, input->mNumFields); -} - -static void GetSpecificRecordsCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKEGetSpecificRecordsInput * input = (SAKEGetSpecificRecordsInput *)inputData; - SAKEGetSpecificRecordsOutput * output = (SAKEGetSpecificRecordsOutput *)outputData; - - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "GetSpecificRecords") == gsi_false) - return; - - if(output->mNumRecords > 0) - { - SAKEField * field; - field = sakeGetFieldByName("score", output->mRecords[0], input->mNumFields); - GSI_UNUSED(field); - } - else - { - printf("No record found\n"); - } - - DisplayReadResults(output->mRecords, output->mNumRecords, input->mNumFields); -} - -static void GetRandomRecordCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKEGetRandomRecordInput * input = (SAKEGetRandomRecordInput *)inputData; - SAKEGetRandomRecordOutput * output = (SAKEGetRandomRecordOutput *)outputData; - SAKEField *records[1]; - int numRecords; - - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "GetRandomRecord") == gsi_false) - return; - - records[0] = output->mRecord; - if(records[0] != NULL) - numRecords = 1; - else - numRecords = 0; - - DisplayReadResults(records, numRecords, input->mNumFields); -} - -static void RateRecordCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKERateRecordOutput * output = (SAKERateRecordOutput *)outputData; - - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(inputData); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "RateRecord") == gsi_false) - return; - - printf("NumRatings: %d\n", output->mNumRatings); - printf("AverageRating: %0.3f\n", output->mAverageRating); -} - -static void GetRecordLimitCallback(SAKE sake, SAKERequest request, SAKERequestResult result, void *inputData, void *outputData, void *userData) -{ - SAKEGetRecordLimitOutput * output = (SAKEGetRecordLimitOutput *)outputData; - - NumOperations--; - - GSI_UNUSED(sake); - GSI_UNUSED(request); - GSI_UNUSED(inputData); - GSI_UNUSED(userData); - - if(HandleRequestResult(result, "GetRecordLimit") == gsi_false) - return; - - printf("LimitPerOwner: %d\n", output->mLimitPerOwner); - printf("NumOwned: %d\n", output->mNumOwned); -} - -static gsi_bool gUploadResult; -static int gUploadedFileId; -static GHTTPBool UploadCompletedCallback(GHTTPRequest request, GHTTPResult result, char * buffer, GHTTPByteCount bufferLen, void * param) -{ - SAKEFileResult fileResult; - - gUploadResult = gsi_false; - NumOperations--; - - GSI_UNUSED(param); - GSI_UNUSED(bufferLen); - GSI_UNUSED(buffer); - - if(result != GHTTPSuccess) - { - printf("File Upload: GHTTP Error: %d\n", result); - return GHTTPTrue; - } - - if(!sakeGetFileResultFromHeaders(ghttpGetHeaders(request), &fileResult)) - { - printf("File Upload: Failed to find Sake-File-Result header\n"); - return GHTTPTrue; - } - - if(fileResult != SAKEFileResult_SUCCESS) - { - printf("File Upload: SakeFileResult != success: %d\n", fileResult); - return GHTTPTrue; - } - - if(!sakeGetFileIdFromHeaders(ghttpGetHeaders(request), &gUploadedFileId)) - { - printf("File Upload: Unable to parse Sake-File-Id header\n"); - return GHTTPTrue; - } - - printf("File Upload: Uploaded fileId: %d\n", gUploadedFileId); - gUploadResult = gsi_true; - - return GHTTPTrue; -} - -static GHTTPBool DownloadCompletedCallback(GHTTPRequest request, GHTTPResult result, char * buffer, GHTTPByteCount bufferLen, void * param) -{ - SAKEFileResult fileResult; - - NumOperations--; - - GSI_UNUSED(param); - GSI_UNUSED(buffer); - - if(result != GHTTPSuccess) - { - printf("File Download: GHTTP Error: %d\n", result); - return GHTTPTrue; - } - - if(!sakeGetFileResultFromHeaders(ghttpGetHeaders(request), &fileResult)) - { - printf("File Download: Failed to find Sake-File-Result header\n"); - return GHTTPTrue; - } - - if(fileResult != SAKEFileResult_SUCCESS) - { - printf("File Download: SakeFileResult != success: %d\n", fileResult); - return GHTTPTrue; - } - - printf("File Download: Downloaded %d byte file\n", bufferLen); - - return GHTTPTrue; -} - -static void postCallback(GHTTPRequest request, int bytesPosted, int totalBytes, int objectsPosted, int totalObjects, void * param) -{ - printf("==============================\n"); - printf("* bytesPosted: %7d\n", bytesPosted); - printf("* totalBytes: %7d\n", totalBytes); - printf("* objectsPosted: %7d\n", objectsPosted); - printf("* totalObjects: %7d\n", totalObjects); - GSI_UNUSED(request); - GSI_UNUSED(param); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static void RunTests(SAKE sake) -{ -#if 1 - { - static SAKECreateRecordInput input; - static SAKEField field; - SAKERequest request; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "test"; - field.mName = "MyAsciiString"; - field.mType = SAKEFieldType_ASCII_STRING; - field.mValue.mAsciiString = "this is a record"; - input.mFields = &field; - input.mNumFields = 1; - - request = sakeCreateRecord(sake, &input, CreateRecordCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKEUpdateRecordInput input; - static SAKEField fields[16]; - static char binaryData[] = "\x12\x34\x56\xAB\xCD"; -#if defined(_PS2) || defined(_MACOSX) - static gsi_u16 unicodeString[] = {'u','n','i','c','o','d','e','\0'}; -#else - static gsi_u16 *unicodeString = L"unicode"; -#endif - int index = 0; - SAKERequest request; - SAKEStartRequestResult startRequestResult; - - - input.mTableId = "test"; - input.mRecordId = 158; - fields[index].mName = "MyByte"; - fields[index].mType = SAKEFieldType_BYTE; - fields[index].mValue.mByte = 123; - index++; - fields[index].mName = "MyShort"; - fields[index].mType = SAKEFieldType_SHORT; - fields[index].mValue.mShort = 12345; - index++; - fields[index].mName = "MyInt"; - fields[index].mType = SAKEFieldType_INT; - fields[index].mValue.mInt = 123456789; - index++; - fields[index].mName = "MyFloat"; - fields[index].mType = SAKEFieldType_FLOAT; - fields[index].mValue.mFloat = 3.14159265f; - index++; - fields[index].mName = "MyAsciiString"; - fields[index].mType = SAKEFieldType_ASCII_STRING; - fields[index].mValue.mAsciiString = "ascii"; - index++; - fields[index].mName = "MyUnicodeString"; - fields[index].mType = SAKEFieldType_UNICODE_STRING; - fields[index].mValue.mUnicodeString = unicodeString; - index++; - fields[index].mName = "MyBoolean"; - fields[index].mType = SAKEFieldType_BOOLEAN; - fields[index].mValue.mBoolean = gsi_true; - index++; - fields[index].mName = "MyDateAndTime"; - fields[index].mType = SAKEFieldType_DATE_AND_TIME; - fields[index].mValue.mDateAndTime = time(NULL); - index++; - fields[index].mName = "MyBinaryData"; - fields[index].mType = SAKEFieldType_BINARY_DATA; - fields[index].mValue.mBinaryData.mValue = (gsi_u8*) binaryData; - fields[index].mValue.mBinaryData.mLength = (int)strlen(binaryData); - index++; - input.mFields = fields; - input.mNumFields = index; - - request = sakeUpdateRecord(sake, &input, UpdateRecordCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKEDeleteRecordInput input; - SAKERequest request; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "test"; - input.mRecordId = 150; - - request = sakeDeleteRecord(sake, &input, DeleteRecordCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKESearchForRecordsInput input; - static SAKERequest request; - static char *fieldNames[] = { "score", "recordid" }; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "scores"; - input.mFieldNames = fieldNames; - input.mNumFields = (sizeof(fieldNames) / sizeof(fieldNames[0])); - input.mFilter = _T("score < 50"); - input.mSort = "score desc"; - input.mOffset = 0; - input.mMaxRecords = 3; - - request = sakeSearchForRecords(sake, &input, SearchForRecordsCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKEGetMyRecordsInput input; - static SAKERequest request; - static char *fieldNames[] = { "recordid", "ownerid", "MyByte", "MyShort", - "MyInt", "MyFloat", "MyAsciiString", - "MyUnicodeString", "MyBoolean", "MyDateAndTime", - "MyBinaryData", "MyFileID", "num_ratings", - "average_rating" }; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "test"; - input.mFieldNames = fieldNames; - input.mNumFields = (sizeof(fieldNames) / sizeof(fieldNames[0])); - - request = sakeGetMyRecords(sake, &input, GetMyRecordsCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKEGetSpecificRecordsInput input; - static SAKERequest request; - static int recordIds[] = { 1, 2, 4, 5 }; - static char *fieldNames[] = { "recordid", "ownerid", "score" }; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "scores"; - input.mRecordIds = recordIds; - input.mNumRecordIds = (sizeof(recordIds) / sizeof(recordIds[0])); - input.mFieldNames = fieldNames; - input.mNumFields = (sizeof(fieldNames) / sizeof(fieldNames[0])); - - request = sakeGetSpecificRecords(sake, &input, GetSpecificRecordsCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKEGetRandomRecordInput input; - static SAKERequest request; - //static char *fieldNames[] = { "recordid", "matchname" }; - static char *fieldNames[] = { "recordid", "score" }; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "levels"; - //input.mTableId = "archive"; - input.mFieldNames = fieldNames; - input.mNumFields = (sizeof(fieldNames) / sizeof(fieldNames[0])); - input.mFilter = NULL; - //input.mFilter = "my_rating > 100"; - request = sakeGetRandomRecord(sake, &input, GetRandomRecordCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKERateRecordInput input; - static SAKERequest request; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "test"; - input.mRecordId = 158; - input.mRating = 200; - - request = sakeRateRecord(sake, &input, RateRecordCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - static SAKEGetRecordLimitInput input; - static SAKERequest request; - SAKEStartRequestResult startRequestResult; - - input.mTableId = "nicks"; - - request = sakeGetRecordLimit(sake, &input, GetRecordLimitCallback, NULL); - if(!request) - { - startRequestResult = sakeGetStartRequestResult(sake); - printf("Failed to start request: %d\n", startRequestResult); - } - else - { - NumOperations++; - } - } -#endif -#if 1 - { - GHTTPPost post; - GHTTPRequest request; - //const char *memFile = "This is a test file"; - gsi_char url[SAKE_MAX_URL_LENGTH]; - - int i; - DataStruct data; - - for (i=0; i -#endif - -int test_main(int argc, char* argv[]); // CW needs this prototyped - -int test_main(int argc, char* argv[]) -{ - SAKEStartupResult startupResult; - SAKE sake; - - GSI_UNUSED(argc); - GSI_UNUSED(argv); - - // setup the common debugging -#ifdef GSI_COMMON_DEBUG - gsSetDebugCallback(DebugCallback); - gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Hardcore); -#endif - - // enable Win32 C Runtime debugging -#if defined(_WIN32) && !defined(_XBOX) && defined(_DEBUG) - { - int tempFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - _CrtSetDbgFlag(tempFlag | _CRTDBG_LEAK_CHECK_DF); - } -#endif - - // availability check - printf("Checking availability\n"); - if(CheckServices() != GSIACAvailable) - return 0; - - // Init the GameSpy SDK Core (required by SOAP SDKs) - printf("Initializing the GameSpy Core\n"); - gsCoreInitialize(); - - // startup sake - printf("Starting up Sake\n"); - startupResult = sakeStartup(&sake); - if(startupResult != SAKEStartupResult_SUCCESS) - { - printf("Startup failed: %d\n", startupResult); - return 0; - } - - // login to GP and use data to authenticate Sake - LoginAndAuthenticate(sake); - - // run the tests - RunTests(sake); - - // keep thinking - printf("Entering think loop\n"); - while(NumOperations > 0) - { - msleep(5); - gsCoreThink(0); - } - - // shutdown sake - printf("Shutting down Sake\n"); - sakeShutdown(sake); - - // shutdown the core - printf("Shutting down the GameSpy Core\n"); - gsCoreShutdown(); - - // Wait for core shutdown - // (should be instantaneous unless you have multiple cores) - while(gsCoreIsShutdown() == GSCore_SHUTDOWN_PENDING) - { - gsCoreThink(0); - msleep(5); - } - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest.dsp b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest.dsp deleted file mode 100644 index 84af79c3d94..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest.dsp +++ /dev/null @@ -1,657 +0,0 @@ -# Microsoft Developer Studio Project File - Name="saketest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=saketest - Win32 Unicode Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "saketest.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "saketest.mak" CFG="saketest - Win32 Unicode Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "saketest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "saketest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "saketest - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "saketest - Win32 Unicode Release" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "$/Gamespy/GOA/sake/saketest" -# PROP Scc_LocalPath "." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "saketest - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../" /I "../../" /I "../../gsoap" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "saketest - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /I "../../" /I "../../gsoap" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_MEM_MANAGED" /D "GSI_COMMON_DEBUG" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "saketest - Win32 Unicode Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "saketest___Win32_Unicode_Debug1" -# PROP BASE Intermediate_Dir "saketest___Win32_Unicode_Debug1" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "saketest___Win32_Unicode_Debug1" -# PROP Intermediate_Dir "saketest___Win32_Unicode_Debug1" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /I "../../" /I "../../gsoap" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_MEM_MANAGED" /D "GSI_COMMON_DEBUG" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /I "../../" /I "../../gsoap" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_MEM_MANAGED" /D "GSI_COMMON_DEBUG" /D "GSI_UNICODE" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "saketest - Win32 Unicode Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "saketest___Win32_Unicode_Release" -# PROP BASE Intermediate_Dir "saketest___Win32_Unicode_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "saketest___Win32_Unicode_Release" -# PROP Intermediate_Dir "saketest___Win32_Unicode_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /I "../" /I "../../" /I "../../gsoap" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "../" /I "../../" /I "../../gsoap" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GSI_UNICODE" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ENDIF - -# Begin Target - -# Name "saketest - Win32 Release" -# Name "saketest - Win32 Debug" -# Name "saketest - Win32 Unicode Debug" -# Name "saketest - Win32 Unicode Release" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\saketest.c -# End Source File -# End Group -# Begin Group "GOA" - -# PROP Default_Filter "" -# Begin Group "sake" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\sake.h -# End Source File -# Begin Source File - -SOURCE=..\sakeMain.c -# End Source File -# Begin Source File - -SOURCE=..\sakeMain.h -# End Source File -# Begin Source File - -SOURCE=..\sakeRequest.c -# End Source File -# Begin Source File - -SOURCE=..\sakeRequest.h -# End Source File -# Begin Source File - -SOURCE=..\sakeRequestInternal.h -# End Source File -# Begin Source File - -SOURCE=..\sakeRequestMisc.c -# End Source File -# Begin Source File - -SOURCE=..\sakeRequestModify.c -# End Source File -# Begin Source File - -SOURCE=..\sakeRequestRead.c -# End Source File -# End Group -# Begin Group "Common" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\darray.c -# End Source File -# Begin Source File - -SOURCE=..\..\darray.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAssert.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsAvailable.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCore.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCore.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsCrypt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsDebug.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsLargeInt.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsMemory.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatform.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformSocket.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformThread.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsPlatformUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsRC4.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSHA1.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSoap.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSoap.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsSSL.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsStringUtil.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsUdpEngine.h -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\gsXML.h -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.c -# End Source File -# Begin Source File - -SOURCE=..\..\hashtable.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5.h -# End Source File -# Begin Source File - -SOURCE=..\..\md5c.c -# End Source File -# Begin Source File - -SOURCE=..\..\common\win32\Win32Common.c -# End Source File -# End Group -# Begin Group "ghttp" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\ghttp\ghttp.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpASCII.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCallbacks.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCallbacks.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCommon.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpCommon.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpConnection.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpConnection.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpEncryption.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpEncryption.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpMain.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpMain.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpPost.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpPost.h -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpProcess.c -# End Source File -# Begin Source File - -SOURCE=..\..\ghttp\ghttpProcess.h -# End Source File -# End Group -# Begin Group "gp" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\GP\gp.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gp.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpi.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpi.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiBuddy.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiBuddy.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiBuffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiBuffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiCallback.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiCallback.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiConnect.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiConnect.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiInfo.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiInfo.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiKeys.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiKeys.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiOperation.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiOperation.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiPeer.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiPeer.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiProfile.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiProfile.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiSearch.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiSearch.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiTransfer.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiTransfer.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiUnique.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiUnique.h -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiUtility.c -# End Source File -# Begin Source File - -SOURCE=..\..\GP\gpiUtility.h -# End Source File -# End Group -# Begin Group "gt2" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\gt2\gt2.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Auth.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Buffer.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Callback.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Connection.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Encode.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Filter.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Main.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Message.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Socket.h -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.c -# End Source File -# Begin Source File - -SOURCE=..\..\gt2\gt2Utility.h -# End Source File -# End Group -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest_vs2005.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest_vs2005.vcproj deleted file mode 100644 index 3acbb6edf2c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest_vs2005.vcproj +++ /dev/null @@ -1,2669 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest_vs2005.vcproj.vspscc b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest_vs2005.vcproj.vspscc deleted file mode 100644 index b6d32892fd6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/saketest_vs2005.vcproj.vspscc +++ /dev/null @@ -1,10 +0,0 @@ -"" -{ -"FILE_VERSION" = "9237" -"ENLISTMENT_CHOICE" = "NEVER" -"PROJECT_FILE_RELATIVE_PATH" = "" -"NUMBER_OF_EXCLUDED_FILES" = "0" -"ORIGINAL_PROJECT_FILE_PATH" = "" -"NUMBER_OF_NESTED_PROJECTS" = "0" -"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" -} diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakex360/sakex360.sln b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakex360/sakex360.sln deleted file mode 100644 index 5aa45f55989..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakex360/sakex360.sln +++ /dev/null @@ -1,29 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sakex360", "sakex360.vcproj", "{8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Xbox 360 = Debug|Xbox 360 - Profile_FastCap|Xbox 360 = Profile_FastCap|Xbox 360 - Profile|Xbox 360 = Profile|Xbox 360 - Release_LTCG|Xbox 360 = Release_LTCG|Xbox 360 - Release|Xbox 360 = Release|Xbox 360 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Profile_FastCap|Xbox 360.ActiveCfg = Profile_FastCap|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Profile_FastCap|Xbox 360.Build.0 = Profile_FastCap|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Profile|Xbox 360.ActiveCfg = Profile|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Profile|Xbox 360.Build.0 = Profile|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Release_LTCG|Xbox 360.ActiveCfg = Release_LTCG|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Release_LTCG|Xbox 360.Build.0 = Release_LTCG|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 - {8D6111DA-2950-4B83-BB7D-E3F9FAE9B8DA}.Release|Xbox 360.Build.0 = Release|Xbox 360 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakex360/sakex360.vcproj b/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakex360/sakex360.vcproj deleted file mode 100644 index 00431ba57c3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/gamespy/sake/saketest/sakex360/sakex360.vcproj +++ /dev/null @@ -1,812 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ANNOUNCE b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ANNOUNCE deleted file mode 100644 index 97d94e7026a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ANNOUNCE +++ /dev/null @@ -1,476 +0,0 @@ - PTHREADS-WIN32 RELEASE 2.8.0 (2006-12-22) - ----------------------------------------- - Web Site: http://sources.redhat.com/pthreads-win32/ - FTP Site: ftp://sources.redhat.com/pub/pthreads-win32 - Maintainer: Ross Johnson - - -We are pleased to announce the availability of a new release of -Pthreads-win32, an Open Source Software implementation of the -Threads component of the POSIX 1003.1 2001 Standard for Microsoft's -Win32 environment. Some functions from other sections of POSIX -1003.1 2001 are also supported including semaphores and scheduling -functions. - -Some common non-portable functions are also implemented for -additional compatibility, as are a few functions specific -to pthreads-win32 for easier integration with Win32 applications. - -Pthreads-win32 is free software, distributed under the GNU Lesser -General Public License (LGPL). - - -Acknowledgements ----------------- -This library is based originally on a Win32 pthreads -implementation contributed by John Bossom . - -The implementation of Condition Variables uses algorithms developed -by Alexander Terekhov and Louis Thomas. - -The implementation of POSIX mutexes has been improved by Thomas Pfaff -and later by Alexander Terekhov. - -The implementation of Spinlocks and Barriers was contributed -by Ross Johnson. - -The implementation of read/write locks was contributed by -Aurelio Medina and improved by Alexander Terekhov. - -Many others have contributed significant time and effort to solve crutial -problems in order to make the library workable, robust and reliable. - -Thanks to Xavier Leroy for granting permission to use and modify his -LinuxThreads manual pages. - -Thanks to The Open Group for making the Single Unix Specification -publicly available - many of the manual pages included in the package -were extracted from it. - -There is also a separate CONTRIBUTORS file. This file and others are -on the web site: - - http://sources.redhat.com/pthreads-win32 - -As much as possible, the ChangeLog file acknowledges contributions to the -code base in more detail. - - -Changes since the last release ------------------------------- -These are now documented in the NEWS file. -See the ChangeLog file also. - - -Known Bugs ----------- -These are now documented in the BUGS file. - - -Level of standards conformance ------------------------------- - -The following POSIX 1003.1 2001 options are defined and set to 200112L: - - _POSIX_THREADS - _POSIX_THREAD_SAFE_FUNCTIONS - _POSIX_THREAD_ATTR_STACKSIZE - _POSIX_THREAD_PRIORITY_SCHEDULING - _POSIX_SEMAPHORES - _POSIX_READER_WRITER_LOCKS - _POSIX_SPIN_LOCKS - _POSIX_BARRIERS - - -The following POSIX 1003.1 2001 options are defined and set to -1: - - _POSIX_THREAD_ATTR_STACKADDR - _POSIX_THREAD_PRIO_INHERIT - _POSIX_THREAD_PRIO_PROTECT - _POSIX_THREAD_PROCESS_SHARED - - -The following POSIX 1003.1 2001 limits are defined and set: - - _POSIX_THREAD_THREADS_MAX - _POSIX_SEM_VALUE_MAX - _POSIX_SEM_NSEMS_MAX - _POSIX_THREAD_KEYS_MAX - _POSIX_THREAD_DESTRUCTOR_ITERATIONS - PTHREAD_STACK_MIN - PTHREAD_THREADS_MAX - SEM_VALUE_MAX - SEM_NSEMS_MAX - PTHREAD_KEYS_MAX - PTHREAD_DESTRUCTOR_ITERATIONS - - -The following functions are implemented: - - --------------------------- - PThreads - --------------------------- - pthread_attr_init - pthread_attr_destroy - pthread_attr_getdetachstate - pthread_attr_getstackaddr - pthread_attr_getstacksize - pthread_attr_setdetachstate - pthread_attr_setstackaddr - pthread_attr_setstacksize - - pthread_create - pthread_detach - pthread_equal - pthread_exit - pthread_join - pthread_once - pthread_self - - pthread_cancel - pthread_cleanup_pop - pthread_cleanup_push - pthread_setcancelstate - pthread_setcanceltype - pthread_testcancel - - --------------------------- - Thread Specific Data - --------------------------- - pthread_key_create - pthread_key_delete - pthread_setspecific - pthread_getspecific - - --------------------------- - Mutexes - --------------------------- - pthread_mutexattr_init - pthread_mutexattr_destroy - pthread_mutexattr_getpshared - pthread_mutexattr_setpshared - pthread_mutexattr_gettype - pthread_mutexattr_settype (types: PTHREAD_MUTEX_DEFAULT - PTHREAD_MUTEX_NORMAL - PTHREAD_MUTEX_ERRORCHECK - PTHREAD_MUTEX_RECURSIVE ) - pthread_mutex_init - pthread_mutex_destroy - pthread_mutex_lock - pthread_mutex_trylock - pthread_mutex_timedlock - pthread_mutex_unlock - - --------------------------- - Condition Variables - --------------------------- - pthread_condattr_init - pthread_condattr_destroy - pthread_condattr_getpshared - pthread_condattr_setpshared - - pthread_cond_init - pthread_cond_destroy - pthread_cond_wait - pthread_cond_timedwait - pthread_cond_signal - pthread_cond_broadcast - - --------------------------- - Read/Write Locks - --------------------------- - pthread_rwlock_init - pthread_rwlock_destroy - pthread_rwlock_tryrdlock - pthread_rwlock_trywrlock - pthread_rwlock_rdlock - pthread_rwlock_timedrdlock - pthread_rwlock_rwlock - pthread_rwlock_timedwrlock - pthread_rwlock_unlock - pthread_rwlockattr_init - pthread_rwlockattr_destroy - pthread_rwlockattr_getpshared - pthread_rwlockattr_setpshared - - --------------------------- - Spin Locks - --------------------------- - pthread_spin_init - pthread_spin_destroy - pthread_spin_lock - pthread_spin_unlock - pthread_spin_trylock - - --------------------------- - Barriers - --------------------------- - pthread_barrier_init - pthread_barrier_destroy - pthread_barrier_wait - pthread_barrierattr_init - pthread_barrierattr_destroy - pthread_barrierattr_getpshared - pthread_barrierattr_setpshared - - --------------------------- - Semaphores - --------------------------- - sem_init - sem_destroy - sem_post - sem_wait - sem_trywait - sem_timedwait - sem_getvalue (# free if +ve, # of waiters if -ve) - sem_open (returns an error ENOSYS) - sem_close (returns an error ENOSYS) - sem_unlink (returns an error ENOSYS) - - --------------------------- - RealTime Scheduling - --------------------------- - pthread_attr_getschedparam - pthread_attr_setschedparam - pthread_attr_getinheritsched - pthread_attr_setinheritsched - pthread_attr_getschedpolicy (only supports SCHED_OTHER) - pthread_attr_setschedpolicy (only supports SCHED_OTHER) - pthread_getschedparam - pthread_setschedparam - pthread_getconcurrency - pthread_setconcurrency - pthread_attr_getscope - pthread_attr_setscope (only supports PTHREAD_SCOPE_SYSTEM) - sched_get_priority_max - sched_get_priority_min - sched_rr_get_interval (returns an error ENOTSUP) - sched_setscheduler (only supports SCHED_OTHER) - sched_getscheduler (only supports SCHED_OTHER) - sched_yield - - --------------------------- - Signals - --------------------------- - pthread_sigmask - pthread_kill (only supports zero sig value, - for thread validity checking) - - --------------------------- - Non-portable routines (see the README.NONPORTABLE file for usage) - --------------------------- - pthread_getw32threadhandle_np - pthread_timechange_handler_np - pthread_delay_np - pthread_mutexattr_getkind_np - pthread_mutexattr_setkind_np (types: PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ADAPTIVE_NP, - PTHREAD_MUTEX_TIMED_NP) - pthread_num_processors_np - pthread_win32_process_attach_np (Required when statically linking - the library) - pthread_win32_process_detach_np (Required when statically linking - the library) - pthread_win32_thread_attach_np (Required when statically linking - the library) - pthread_win32_thread_detach_np (Required when statically linking - the library) - - --------------------------- - Static Initializers - --------------------------- - PTHREAD_ONCE_INIT - PTHREAD_MUTEX_INITIALIZER - PTHREAD_RECURSIVE_MUTEX_INITIALIZER - PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP - PTHREAD_ERRORCHECK_MUTEX_INITIALIZER - PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - PTHREAD_COND_INITIALIZER - PTHREAD_RWLOCK_INITIALIZER - PTHREAD_SPINLOCK_INITIALIZER - - --------------------------- - Thread-Safe C Runtime Library (macros) - --------------------------- - strtok_r - asctime_r - ctime_r - gmtime_r - localtime_r - rand_r - - -The following functions are not implemented: - - --------------------------- - RealTime Scheduling - --------------------------- - pthread_mutex_getprioceiling - pthread_mutex_setprioceiling - pthread_mutex_attr_getprioceiling - pthread_mutex_attr_getprotocol - pthread_mutex_attr_setprioceiling - pthread_mutex_attr_setprotocol - - --------------------------- - Fork Handlers - --------------------------- - pthread_atfork - - --------------------------- - Stdio - --------------------------- - flockfile - ftrylockfile - funlockfile - getc_unlocked - getchar_unlocked - putc_unlocked - putchar_unlocked - - --------------------------- - Thread-Safe C Runtime Library - --------------------------- - readdir_r - getgrgid_r - getgrnam_r - getpwuid_r - getpwnam_r - - --------------------------- - Signals - --------------------------- - sigtimedwait - sigwait - sigwaitinfo - - --------------------------- - General - --------------------------- - sysconf - -The library includes two non-API functions for creating cancellation -points in applications and libraries: - - pthreadCancelableWait - pthreadCancelableTimedWait - - -Availability ------------- - -The prebuilt DLL, export libs (for both MSVC and Mingw32), and the header -files (pthread.h, semaphore.h, sched.h) are available along with the -complete source code. - -The source code can be found at: - - ftp://sources.redhat.com/pub/pthreads-win32 - -and as individual source code files at - - ftp://sources.redhat.com/pub/pthreads-win32/source - -The pre-built DLL, export libraries and include files can be found at: - - ftp://sources.redhat.com/pub/pthreads-win32/dll-latest - - - -Mailing List ------------- - -There is a mailing list for discussing pthreads on Win32. To join, -send email to: - - pthreads-win32-subscribe@sourceware.cygnus.com - - -Application Development Environments ------------------------------------- - -See the README file for more information. - -MSVC: -MSVC using SEH works. Distribute pthreadVSE.dll with your application. -MSVC using C++ EH works. Distribute pthreadVCE.dll with your application. -MSVC using C setjmp/longjmp works. Distribute pthreadVC.dll with your application. - - -Mingw32: -See the FAQ, Questions 6 and 10. - -Mingw using C++ EH works. Distribute pthreadGCE.dll with your application. -Mingw using C setjmp/longjmp works. Distribute pthreadGC.dll with your application. - - -Cygwin: (http://sourceware.cygnus.com/cygwin/) -Developers using Cygwin will not need pthreads-win32 since it has POSIX threads -support. Refer to its documentation for details and extent. - - -UWIN: -UWIN is a complete Unix-like environment for Windows from AT&T. Pthreads-win32 -doesn't currently support UWIN (and vice versa), but that may change in the -future. - -Generally: -For convenience, the following pre-built files are available on the FTP site -(see Availability above): - - pthread.h - for POSIX 1c threads - semaphore.h - for POSIX 1b semaphores - sched.h - for POSIX 1b scheduling - pthreadVCE.dll - built with MSVC++ compiler using C++ EH - pthreadVCE.lib - pthreadVC.dll - built with MSVC compiler using C setjmp/longjmp - pthreadVC.lib - pthreadVSE.dll - built with MSVC compiler using SEH - pthreadVSE.lib - pthreadGCE.dll - built with Mingw32 G++ 2.95.2-1 - pthreadGC.dll - built with Mingw32 GCC 2.95.2-1 using setjmp/longjmp - libpthreadGCE.a - derived from pthreadGCE.dll - libpthreadGC.a - derived from pthreadGC.dll - gcc.dll - needed if distributing applications that use - pthreadGCE.dll (but see the FAQ Q 10 for the latest - related information) - -These are the only files you need in order to build POSIX threads -applications for Win32 using either MSVC or Mingw32. - -See the FAQ file in the source tree for additional information. - - -Documentation -------------- - -For the authoritative reference, see the online POSIX -standard reference at: - - http://www.OpenGroup.org - -For POSIX Thread API programming, several reference books are -available: - - Programming with POSIX Threads - David R. Butenhof - Addison-Wesley (pub) - - Pthreads Programming - By Bradford Nichols, Dick Buttlar & Jacqueline Proulx Farrell - O'Reilly (pub) - -On the web: see the links at the bottom of the pthreads-win32 site: - - http://sources.redhat.com/pthreads-win32/ - - Currently, there is no documentation included in the package apart - from the copious comments in the source code. - - - -Enjoy! - -Ross Johnson diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/BUGS b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/BUGS deleted file mode 100644 index 29cee0033e2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/BUGS +++ /dev/null @@ -1,133 +0,0 @@ ----------- -Known bugs ----------- - -1. Not strictly a bug, more of a gotcha. - - Under MS VC++ (only tested with version 6.0), a term_func - set via the standard C++ set_terminate() function causes the - application to abort. - - Notes from the MSVC++ manual: - 1) A term_func() should call exit(), otherwise - abort() will be called on return to the caller. - A call to abort() raises SIGABRT and the default signal handler - for all signals terminates the calling program with - exit code 3. - 2) A term_func() must not throw an exception. Therefore - term_func() should not call pthread_exit(), which - works by throwing an exception (pthreadVCE or pthreadVSE) - or by calling longjmp (pthreadVC). - - Workaround: avoid using pthread_exit() in C++ applications. Exit - threads by dropping through the end of the thread routine. - -2. Cancellation problems in optimised code - - Milan Gardian - - This is suspected to be a compiler bug in VC6.0, and also seen in - VC7.0 and VS .NET 2003. The GNU C++ compiler does not have a problem - with this, and it has been reported that the Intel C++ 8.1 compiler - and Visual C++ 2005 Express Edition Beta2 pass tests\semaphore4.c - (which exposes the bug). - - Workaround [rpj - 2 Feb 2002] - ----------------------------- - [Please note: this workaround did not solve a similar problem in - snapshot-2004-11-03 or later, even though similar symptoms were seen. - tests\semaphore4.c fails in that snapshot for the VCE version of the - DLL.] - - The problem disappears when /Ob0 is used, i.e. /O2 /Ob0 works OK, - but if you want to use inlining optimisation you can be much more - specific about where it's switched off and on by using a pragma. - - So the inlining optimisation is interfering with the way that cleanup - handlers are run. It appears to relate to auto-inlining of class methods - since this is the only auto inlining that is performed at /O1 optimisation - (functions with the "inline" qualifier are also inlined, but the problem - doesn't appear to involve any such functions in the library or testsuite). - - In order to confirm the inlining culprit, the following use of pragmas - eliminate the problem but I don't know how to make it transparent, putting - it in, say, pthread.h where pthread_cleanup_push defined as a macro. - - #pragma inline_depth(0) - pthread_cleanup_push(handlerFunc, (void *) &arg); - - /* ... */ - - pthread_cleanup_pop(0); - #pragma inline_depth() - - Note the empty () pragma value after the pop macro. This resets depth to the - default. Or you can specify a non-zero depth here. - - The pragma is also needed (and now used) within the library itself wherever - cleanup handlers are used (condvar.c and rwlock.c). - - Use of these pragmas allows compiler optimisations /O1 and /O2 to be - used for either or both the library and applications. - - Experimenting further, I found that wrapping the actual cleanup handler - function with #pragma auto_inline(off|on) does NOT work. - - MSVC6.0 doesn't appear to support the C99 standard's _Pragma directive, - however, later versions may. This form is embeddable inside #define - macros, which would be ideal because it would mean that it could be added - to the push/pop macro definitions in pthread.h and hidden from the - application programmer. - - [/rpj] - - Original problem description - ---------------------------- - - The cancellation (actually, cleanup-after-cancel) tests fail when using VC - (professional) optimisation switches (/O1 or /O2) in pthreads library. I - have not investigated which concrete optimisation technique causes this - problem (/Og, /Oi, /Ot, /Oy, /Ob1, /Gs, /Gf, /Gy, etc.), but here is a - summary of builds and corresponding failures: - - * pthreads VSE (optimised tests): OK - * pthreads VCE (optimised tests): Failed "cleanup1" test (runtime) - - * pthreads VSE (DLL in CRT, optimised tests): OK - * pthreads VCE (DLL in CRT, optimised tests): Failed "cleanup1" test - (runtime) - - Please note that while in VSE version of the pthreads library the - optimisation does not really have any impact on the tests (they pass OK), in - VCE version addition of optimisation (/O2 in this case) causes the tests to - fail uniformly - either in "cleanup0" or "cleanup1" test cases. - - Please note that all the tests above use default pthreads DLL (no - optimisations, linked with either static or DLL CRT, based on test type). - Therefore the problem lies not within the pthreads DLL but within the - compiled client code (the application using pthreads -> involvement of - "pthread.h"). - - I think the message of this section is that usage of VCE version of pthreads - in applications relying on cancellation/cleanup AND using optimisations for - creation of production code is highly unreliable for the current version of - the pthreads library. - -3. The Borland Builder 5.5 version of the library produces memory read exceptions -in some tests. - -4. pthread_barrier_wait() can deadlock if the number of potential calling -threads for a particular barrier is greater than the barrier count parameter -given to pthread_barrier_init() for that barrier. - -This is due to the very lightweight implementation of pthread-win32 barriers. -To cope with more than "count" possible waiters, barriers must effectively -implement all the same safeguards as condition variables, making them much -"heavier" than at present. - -The workaround is to ensure that no more than "count" threads attempt to wait -at the barrier. - -5. Canceling a thread blocked on pthread_once appears not to work in the MSVC++ -version of the library "pthreadVCE.dll". The test case "once3.c" hangs. I have no -clues on this at present. All other versions pass this test ok - pthreadsVC.dll, -pthreadsVSE.dll, pthreadsGC.dll and pthreadsGCE.dll. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Bmakefile b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Bmakefile deleted file mode 100644 index 66707bf4c63..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Bmakefile +++ /dev/null @@ -1,266 +0,0 @@ -# This makefile is compatible with BCB make. Use "make -fBMakefile" to compile. -# -# The variables $DLLDEST and $LIBDEST hold the destination directories for the -# dll and the lib, respectively. Probably all that needs to change is $DEVROOT. -# -# Currently only the recommended pthreadBC.dll is built by this makefile. -# - - -DLL_VER = 2 - -DEVROOT = . - -DLLDEST = $(DEVROOT)\DLL -LIBDEST = $(DEVROOT)\DLL - -DLLS = pthreadBC$(DLL_VER).dll - -OPTIM = /O2 - -RC = brcc32 -RCFLAGS = -i. - -CFLAGS = /q /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H=1 /4 /tWD /tWM \ - /w-aus /w-asc /w-par - -#C cleanup code -BCFLAGS = $(PTW32_FLAGS) $(CFLAGS) - -# Agregate modules for inlinability -DLL_OBJS = \ - attr.obj \ - barrier.obj \ - cancel.obj \ - cleanup.obj \ - condvar.obj \ - create.obj \ - dll.obj \ - errno.obj \ - exit.obj \ - fork.obj \ - global.obj \ - misc.obj \ - mutex.obj \ - nonportable.obj \ - private.obj \ - rwlock.obj \ - sched.obj \ - semaphore.obj \ - signal.obj \ - spin.obj \ - sync.obj \ - tsd.obj - -INCL = config.h implement.h semaphore.h pthread.h need_errno.h - -ATTR_SRCS = \ - pthread_attr_init.c \ - pthread_attr_destroy.c \ - pthread_attr_getdetachstate.c \ - pthread_attr_setdetachstate.c \ - pthread_attr_getstackaddr.c \ - pthread_attr_setstackaddr.c \ - pthread_attr_getstacksize.c \ - pthread_attr_setstacksize.c \ - pthread_attr_getscope.c \ - pthread_attr_setscope.c - -BARRIER_SRCS = \ - pthread_barrier_init.c \ - pthread_barrier_destroy.c \ - pthread_barrier_wait.c \ - pthread_barrierattr_init.c \ - pthread_barrierattr_destroy.c \ - pthread_barrierattr_setpshared.c \ - pthread_barrierattr_getpshared.c - -CANCEL_SRCS = \ - pthread_setcancelstate.c \ - pthread_setcanceltype.c \ - pthread_testcancel.c \ - pthread_cancel.c - -CONDVAR_SRCS = \ - ptw32_cond_check_need_init.c \ - pthread_condattr_destroy.c \ - pthread_condattr_getpshared.c \ - pthread_condattr_init.c \ - pthread_condattr_setpshared.c \ - pthread_cond_destroy.c \ - pthread_cond_init.c \ - pthread_cond_signal.c \ - pthread_cond_wait.c - -EXIT_SRCS = \ - pthread_exit.c - -MISC_SRCS = \ - pthread_equal.c \ - pthread_getconcurrency.c \ - pthread_once.c \ - pthread_self.c \ - pthread_setconcurrency.c \ - ptw32_calloc.c \ - ptw32_MCS_lock.c \ - ptw32_new.c \ - w32_CancelableWait.c - -MUTEX_SRCS = \ - ptw32_mutex_check_need_init.c \ - pthread_mutex_init.c \ - pthread_mutex_destroy.c \ - pthread_mutexattr_init.c \ - pthread_mutexattr_destroy.c \ - pthread_mutexattr_getpshared.c \ - pthread_mutexattr_setpshared.c \ - pthread_mutexattr_settype.c \ - pthread_mutexattr_gettype.c \ - pthread_mutex_lock.c \ - pthread_mutex_timedlock.c \ - pthread_mutex_unlock.c \ - pthread_mutex_trylock.c - -NONPORTABLE_SRCS = \ - pthread_mutexattr_setkind_np.c \ - pthread_mutexattr_getkind_np.c \ - pthread_getw32threadhandle_np.c \ - pthread_delay_np.c \ - pthread_num_processors_np.c \ - pthread_win32_attach_detach_np.c \ - pthread_timechange_handler_np.c - -PRIVATE_SRCS = \ - ptw32_is_attr.c \ - ptw32_processInitialize.c \ - ptw32_processTerminate.c \ - ptw32_threadStart.c \ - ptw32_threadDestroy.c \ - ptw32_tkAssocCreate.c \ - ptw32_tkAssocDestroy.c \ - ptw32_callUserDestroyRoutines.c \ - ptw32_timespec.c \ - ptw32_relmillisecs.c \ - ptw32_throw.c \ - ptw32_InterlockedCompareExchange.c \ - ptw32_getprocessors.c - -RWLOCK_SRCS = \ - ptw32_rwlock_check_need_init.c \ - ptw32_rwlock_cancelwrwait.c \ - pthread_rwlock_init.c \ - pthread_rwlock_destroy.c \ - pthread_rwlockattr_init.c \ - pthread_rwlockattr_destroy.c \ - pthread_rwlockattr_getpshared.c \ - pthread_rwlockattr_setpshared.c \ - pthread_rwlock_rdlock.c \ - pthread_rwlock_timedrdlock.c \ - pthread_rwlock_wrlock.c \ - pthread_rwlock_timedwrlock.c \ - pthread_rwlock_unlock.c \ - pthread_rwlock_tryrdlock.c \ - pthread_rwlock_trywrlock.c - -SCHED_SRCS = \ - pthread_attr_setschedpolicy.c \ - pthread_attr_getschedpolicy.c \ - pthread_attr_setschedparam.c \ - pthread_attr_getschedparam.c \ - pthread_attr_setinheritsched.c \ - pthread_attr_getinheritsched.c \ - pthread_setschedparam.c \ - pthread_getschedparam.c \ - sched_get_priority_max.c \ - sched_get_priority_min.c \ - sched_setscheduler.c \ - sched_getscheduler.c \ - sched_yield.c - -SEMAPHORE_SRCS = \ - sem_init.c \ - sem_destroy.c \ - sem_trywait.c \ - sem_timedwait.c \ - sem_wait.c \ - sem_post.c \ - sem_post_multiple.c \ - sem_getvalue.c \ - sem_open.c \ - sem_close.c \ - sem_unlink.c - -SPIN_SRCS = \ - ptw32_spinlock_check_need_init.c \ - pthread_spin_init.c \ - pthread_spin_destroy.c \ - pthread_spin_lock.c \ - pthread_spin_unlock.c \ - pthread_spin_trylock.c - -SYNC_SRCS = \ - pthread_detach.c \ - pthread_join.c - -TSD_SRCS = \ - pthread_key_create.c \ - pthread_key_delete.c \ - pthread_setspecific.c \ - pthread_getspecific.c - - -all: clean $(DLLS) - -realclean: clean - if exist pthread*.dll del pthread*.dll - if exist pthread*.lib del pthread*.lib - if exist *.stamp del *.stamp - -clean: - if exist *.obj del *.obj - if exist *.ilk del *.ilk - if exist *.ilc del *.ilc - if exist *.ild del *.ild - if exist *.ilf del *.ilf - if exist *.ils del *.ils - if exist *.tds del *.tds - if exist *.pdb del *.pdb - if exist *.exp del *.exp - if exist *.map del *.map - if exist *.o del *.o - if exist *.i del *.i - if exist *.res del *.res - - -install: $(DLLS) - copy pthread*.dll $(DLLDEST) - copy pthread*.lib $(LIBDEST) - -$(DLLS): $(DLL_OBJS) version.res - ilink32 /Tpd /Gi c0d32x.obj $(DLL_OBJS), \ - $@, ,\ - cw32mti.lib import32.lib, ,\ - version.res - -.c.obj: - $(CC) $(OPTIM) $(BCFLAGS) -c $< - -.rc.res: - $(RC) $(RCFLAGS) $< - -attr.obj: attr.c $(ATTR_SRCS) $(INCL) -barrier.obj: barrier.c $(BARRIER_SRCS) $(INCL) -cancel.obj: cancel.c $(CANCEL_SRCS) $(INCL) -condvar.obj: condvar.c $(CONDVAR_SRCS) $(INCL) -exit.obj: exit.c $(EXIT_SRCS) $(INCL) -misc.obj: misc.c $(MISC_SRCS) $(INCL) -mutex.obj: mutex.c $(MUTEX_SRCS) $(INCL) -nonportable.obj: nonportable.c $(NONPORTABLE_SRCS) $(INCL) -private.obj: private.c $(PRIVATE_SRCS) $(INCL) -rwlock.obj: rwlock.c $(RWLOCK_SRCS) $(INCL) -sched.obj: sched.c $(SCHED_SRCS) $(INCL) -semaphore.obj: semaphore.c $(SEMAPHORE_SRCS) $(INCL) -spin.obj: spin.c $(SPIN_SRCS) $(INCL) -sync.obj: sync.c $(SYNC_SRCS) $(INCL) -tsd.obj: tsd.c $(TSD_SRCS) $(INCL) -version.res: version.rc $(INCL) diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/CONTRIBUTORS b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/CONTRIBUTORS deleted file mode 100644 index e5b7325d16c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/CONTRIBUTORS +++ /dev/null @@ -1,129 +0,0 @@ -Contributors (in approximate order of appearance) - -[See also the ChangeLog file where individuals are -attributed in log entries. Likewise in the FAQ file.] - -Ben Elliston bje at cygnus dot com - Initiated the project; - setup the project infrastructure (CVS, web page, etc.); - early prototype routines. -Ross Johnson rpj at callisto dot canberra dot edu dot au - early prototype routines; - ongoing project coordination/maintenance; - implementation of spin locks and barriers; - various enhancements; - bug fixes; - documentation; - testsuite. -Robert Colquhoun rjc at trump dot net dot au - Early bug fixes. -John E. Bossom John dot Bossom at cognos dot com - Contributed substantial original working implementation; - bug fixes; - ongoing guidance and standards interpretation. -Anders Norlander anorland at hem2 dot passagen dot se - Early enhancements and runtime checking for supported - Win32 routines. -Tor Lillqvist tml at iki dot fi - General enhancements; - early bug fixes to condition variables. -Scott Lightner scott at curriculum dot com - Bug fix. -Kevin Ruland Kevin dot Ruland at anheuser-busch dot com - Various bug fixes. -Mike Russo miker at eai dot com - Bug fix. -Mark E. Armstrong avail at pacbell dot net - Bug fixes. -Lorin Hochstein lmh at xiphos dot ca - general bug fixes; bug fixes to condition variables. -Peter Slacik Peter dot Slacik at tatramed dot sk - Bug fixes. -Mumit Khan khan at xraylith dot wisc dot edu - Fixes to work with Mingw32. -Milan Gardian mg at tatramed dot sk - Bug fixes and reports/analyses of obscure problems. -Aurelio Medina aureliom at crt dot com - First implementation of read-write locks. -Graham Dumpleton Graham dot Dumpleton at ra dot pad dot otc dot telstra dot com dot au - Bug fix in condition variables. -Tristan Savatier tristan at mpegtv dot com - WinCE port. -Erik Hensema erik at hensema dot xs4all dot nl - Bug fixes. -Rich Peters rpeters at micro-magic dot com -Todd Owen towen at lucidcalm dot dropbear dot id dot au - Bug fixes to dll loading. -Jason Nye jnye at nbnet dot nb dot ca - Implementation of async cancelation. -Fred Forester fforest at eticomm dot net -Kevin D. Clark kclark at cabletron dot com -David Baggett dmb at itasoftware dot com - Bug fixes. -Paul Redondo paul at matchvision dot com -Scott McCaskill scott at 3dfx dot com - Bug fixes. -Jef Gearhart jgearhart at tpssys dot com - Bug fix. -Arthur Kantor akantor at bexusa dot com - Mutex enhancements. -Steven Reddie smr at essemer dot com dot au - Bug fix. -Alexander Terekhov TEREKHOV at de dot ibm dot com - Re-implemented and improved read-write locks; - (with Louis Thomas) re-implemented and improved - condition variables; - enhancements to semaphores; - enhancements to mutexes; - new mutex implementation in 'futex' style; - suggested a robust implementation of pthread_once - similar to that implemented by V.Kliathcko; - system clock change handling re CV timeouts; - bug fixes. -Thomas Pfaff tpfaff at gmx dot net - Changes to make C version usable with C++ applications; - re-implemented mutex routines to avoid Win32 mutexes - and TryEnterCriticalSection; - procedure to fix Mingw32 thread-safety issues. -Franco Bez franco dot bez at gmx dot de - procedure to fix Mingw32 thread-safety issues. -Louis Thomas lthomas at arbitrade dot com - (with Alexander Terekhov) re-implemented and improved - condition variables. -David Korn dgk at research dot att dot com - Ported to UWIN. -Phil Frisbie, Jr. phil at hawksoft dot com - Bug fix. -Ralf Brese Ralf dot Brese at pdb4 dot siemens dot de - Bug fix. -prionx at juno dot com prionx at juno dot com - Bug fixes. -Max Woodbury mtew at cds dot duke dot edu - POSIX versioning conditionals; - reduced namespace pollution; - idea to separate routines to reduce statically - linked image sizes. -Rob Fanner rfanner at stonethree dot com - Bug fix. -Michael Johnson michaelj at maine dot rr dot com - Bug fix. -Nicolas Barry boozai at yahoo dot com - Bug fixes. -Piet van Bruggen pietvb at newbridges dot nl - Bug fix. -Makoto Kato raven at oldskool dot jp - AMD64 port. -Panagiotis E. Hadjidoukas peh at hpclab dot ceid dot upatras dot gr - Contributed the QueueUserAPCEx package which - makes preemptive async cancelation possible. -Will Bryant will dot bryant at ecosm dot com - Borland compiler patch and makefile. -Anuj Goyal anuj dot goyal at gmail dot com - Port to Digital Mars compiler. -Gottlob Frege gottlobfrege at gmail dot com - re-implemented pthread_once (version 2) - (pthread_once cancellation added by rpj). -Vladimir Kliatchko vladimir at kliatchko dot com - reimplemented pthread_once with the same form - as described by A.Terekhov (later version 2); - implementation of MCS (Mellor-Crummey/Scott) locks. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/COPYING b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/COPYING deleted file mode 100644 index 5cfea0d0ed4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/COPYING +++ /dev/null @@ -1,150 +0,0 @@ - pthreads-win32 - a POSIX threads library for Microsoft Windows - - -This file is Copyrighted ------------------------- - - This file is covered under the following Copyright: - - Copyright (C) 2001,2006 Ross P. Johnson - All rights reserved. - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Pthreads-win32 is covered by the GNU Lesser General Public License ------------------------------------------------------------------- - - Pthreads-win32 is open software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public License - as published by the Free Software Foundation version 2.1 of the - License. - - Pthreads-win32 is several binary link libraries, several modules, - associated interface definition files and scripts used to control - its compilation and installation. - - Pthreads-win32 is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - A copy of the GNU Lesser General Public License is distributed with - pthreads-win32 under the filename: - - COPYING.LIB - - You should have received a copy of the version 2.1 GNU Lesser General - Public License with pthreads-win32; if not, write to: - - Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307 - USA - - The contact addresses for pthreads-win32 is as follows: - - Web: http://sources.redhat.com/pthreads-win32 - Email: Ross Johnson - Please use: Firstname.Lastname@homemail.com.au - - - -Pthreads-win32 copyrights and exception files ---------------------------------------------- - - With the exception of the files listed below, Pthreads-win32 - is covered under the following GNU Lesser General Public License - Copyrights: - - Pthreads-win32 - POSIX Threads Library for Win32 - Copyright(C) 1998 John E. Bossom - Copyright(C) 1999,2006 Pthreads-win32 contributors - - The current list of contributors is contained - in the file CONTRIBUTORS included with the source - code distribution. The current list of CONTRIBUTORS - can also be seen at the following WWW location: - http://sources.redhat.com/pthreads-win32/contributors.html - - Contact Email: Ross Johnson - Please use: Firstname.Lastname@homemail.com.au - - These files are not covered under one of the Copyrights listed above: - - COPYING - COPYING.LIB - tests/rwlock7.c - - This file, COPYING, is distributed under the Copyright found at the - top of this file. It is important to note that you may distribute - verbatim copies of this file but you may not modify this file. - - The file COPYING.LIB, which contains a copy of the version 2.1 - GNU Lesser General Public License, is itself copyrighted by the - Free Software Foundation, Inc. Please note that the Free Software - Foundation, Inc. does NOT have a copyright over Pthreads-win32, - only the COPYING.LIB that is supplied with pthreads-win32. - - The file tests/rwlock7.c is derived from code written by - Dave Butenhof for his book 'Programming With POSIX(R) Threads'. - The original code was obtained by free download from his website - http://home.earthlink.net/~anneart/family/Threads/source.html - and did not contain a copyright or author notice. It is assumed to - be freely distributable. - - In all cases one may use and distribute these exception files freely. - And because one may freely distribute the LGPL covered files, the - entire pthreads-win32 source may be freely used and distributed. - - - -General Copyleft and License info ---------------------------------- - - For general information on Copylefts, see: - - http://www.gnu.org/copyleft/ - - For information on GNU Lesser General Public Licenses, see: - - http://www.gnu.org/copyleft/lesser.html - http://www.gnu.org/copyleft/lesser.txt - - -Why pthreads-win32 did not use the GNU General Public License -------------------------------------------------------------- - - The goal of the pthreads-win32 project has been to - provide a quality and complete implementation of the POSIX - threads API for Microsoft Windows within the limits imposed - by virtue of it being a stand-alone library and not - linked directly to other POSIX compliant libraries. For - example, some functions and features, such as those based - on POSIX signals, are missing. - - Pthreads-win32 is a library, available in several different - versions depending on supported compilers, and may be used - as a dynamically linked module or a statically linked set of - binary modules. It is not an application on it's own. - - It was fully intended that pthreads-win32 be usable with - commercial software not covered by either the GPL or the LGPL - licenses. Pthreads-win32 has many contributors to it's - code base, many of whom have done so because they have - used the library in commercial or proprietry software - projects. - - Releasing pthreads-win32 under the LGPL ensures that the - library can be used widely, while at the same time ensures - that bug fixes and improvements to the pthreads-win32 code - itself is returned to benefit all current and future users - of the library. - - Although pthreads-win32 makes it possible for applications - that use POSIX threads to be ported to Win32 platforms, the - broader goal of the project is to encourage the use of open - standards, and in particular, to make it just a little easier - for developers writing Win32 applications to consider - widening the potential market for their products. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/COPYING.LIB b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/COPYING.LIB deleted file mode 100644 index b1e3f5a2638..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/COPYING.LIB +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ChangeLog b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ChangeLog deleted file mode 100644 index b85d9f9b83b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ChangeLog +++ /dev/null @@ -1,4821 +0,0 @@ -2006-12-20 Ross Johnson - - * sem_destroy.c: Fix the race involving invalidation of the sema; - fix incorrect return of EBUSY resulting from the mutex trylock - on the private mutex guard. - * sem_wait.c: Add check for invalid sem_t after acquiring the - sem_t state guard mutex and before affecting changes to sema state. - * sem_trywait.c: Likewise. - * sem_timedwait.c: Likewise. - * sem_getvalue.c: Likewise. - * sem_post.c: Similar. - * sem_post_multiple.c: Likewise. - * sem_init.c: Set max Win32 semaphore count to SEM_VALUE_MAX (was - _POSIX_SEM_VALUE_MAX, which is a lower value - the minimum). - - * pthread_win32_attach_detach_np.c (pthread_win32_process_attach_np): - Load COREDLL.DLL under WINCE to check existence of - InterlockedCompareExchange() routine. This used to be done to test - for TryEnterCriticalSection() but was removed when this was no - longer needed. - -2006-01-25 Prashant Thakre - - * pthread_cancel.c: Added _M_IA64 register context support. - -2005-05-13 Ross Johnson - - * pthread_kill.c (pthread_kill): Remove check for Win32 thread - priority (to confirm HANDLE validity). Useless since thread HANDLEs - a not recycle-unique. - -2005-05-30 Vladimir Kliatchko - - * pthread_once.c: Re-implement using an MCS queue-based lock. The form - of pthread_once is as proposed by Alexander Terekhov (see entry of - 2005-03-13). The MCS lock implementation does not require a unique - 'name' to identify the lock between threads. Attempts to get the Event - or Semaphore based versions of pthread_once to a satisfactory level - of robustness have thus far failed. The last problem (avoiding races - involving non recycle-unique Win32 HANDLEs) was giving everyone - grey hair trying to solve it. - - * ptw32_MCS_lock.c: New MCS queue-based lock implementation. These - locks are efficient: they have very low overhead in the uncontended case; - are efficient in contention and minimise cache-coherence updates in - managing the user level FIFO queue; do not require an ABI change in the - library. - -2005-05-27 Alexander Gottwald - - * pthread.h: Some things, like HANDLE, were only defined if - PTW32_LEVEL was >= 3. They should always be defined. - -2005-05-25 Vladimir Kliatchko - - * pthread_once.c: Eliminate all priority operations and other - complexity by replacing the event with a semaphore. The advantage - of the change is the ability to release just one waiter if the - init_routine thread is cancelled yet still release all waiters when - done. Simplify once_control state checks to improve efficiency - further. - -2005-05-24 Mikael Magnusson - - * GNUmakefile: Patched to allow cross-compile with mingw32 on Linux. - It uses macros instead of referencing dlltool, gcc and g++ directly; - added a call to ranlib. For example the GC static library can be - built with: - make CC=i586-mingw32msvc-gcc RC=i586-mingw32msvc-windres \ - RANLIB=i586-mingw32msvc-ranlib clean GC-static - -2005-05-13 Ross Johnson - - * pthread_win32_attach_detach_np.c (pthread_win32_thread_detach_np): - Move on-exit-only stuff from ptw32_threadDestroy() to here. - * ptw32_threadDestroy.c: It's purpose is now only to reclaim thread - resources for detached threads, or via pthread_join() or - pthread_detach() on joinable threads. - * ptw32_threadStart.c: Calling user destruct routines has moved to - pthread_win32_thread_detach_np(); call pthread_win32_thread_detach_np() - directly if statically linking, otherwise do so via dllMain; store - thread return value in thread struct for all cases, including - cancellation and exception exits; thread abnormal exits go via - pthread_win32_thread_detach_np. - * pthread_join.c (pthread_join): Don't try to get return code from - Win32 thread - always get it from he thread struct. - * pthread_detach.c (pthread_detach): reduce extent of the thread - existence check since we now don't care if the Win32 thread HANDLE has - been closed; reclaim thread resources if the thread has exited already. - * ptw32_throw.c (ptw32_throw): For Win32 threads that are not implicit, - only Call thread cleanup if statically linking, otherwise leave it to - dllMain. - * sem_post.c (_POSIX_SEM_VALUE_MAX): Change to SEM_VALUE_MAX. - * sem_post_multiple.c: Likewise. - * sem_init.c: Likewise. - -2005-05-10 Ross Johnson - - * pthread_join.c (pthread_join): Add missing check for thread ID - reference count in thread existence test; reduce extent of the - existence test since we don't care if the Win32 thread HANDLE has - been closed. - -2005-05-09 Ross Johnson - - * ptw32_callUserDestroyRoutines.c: Run destructor process (i.e. - loop over all keys calling destructors) up to - PTHREAD_DESTRUCTOR_ITERATIONS times if TSD value isn't NULL yet; - modify assoc management. - * pthread_key_delete.c: Modify assoc management. - * ptw32_tkAssocDestroy.c: Fix error in assoc removal from chains. - * pthread.h - (_POSIX_THREAD_DESTRUCTOR_ITERATIONS): Define to value specified by - POSIX. - (_POSIX_THREAD_KEYS_MAX): Define to value specified by POSIX. - (PTHREAD_KEYS_MAX): Redefine [upward] to minimum required by POSIX. - (SEM_NSEMS_MAX): Define to implementation value. - (SEM_VALUE_MAX): Define to implementation value. - (_POSIX_SEM_NSEMS_MAX): Redefine to value specified by POSIX. - (_POSIX_SEM_VALUE_MAX): Redefine to value specified by POSIX. - -2005-05-06 Ross Johnson - - * signal.c (sigwait): Add a cancellation point to this otherwise - no-op. - * sem_init.c (sem_init): Check for and return ERANGE error. - * sem_post.c (sem_post): Likewise. - * sem_post_multiple.c (sem_post_multiple): Likewise. - * manual (directory): Added; see ChangeLog inside. - -2005-05-02 Ross Johnson - - * implement.h (struct pthread_key_t_): Change threadsLock to keyLock - so as not to be confused with the per thread lock 'threadlock'; - change all references to it. - * implement.h (struct ThreadKeyAssoc): Remove lock; add prevKey - and prevThread pointers; re-implemented all routines that use this - struct. The effect of this is to save one handle per association, - which could potentially equal the number of keys multiplied by the - number of threads, accumulating over time - and to free the - association memory as soon as it is no longer referenced by either - the key or the thread. Previously, the handle and memory were - released only after BOTH key and thread no longer referenced the - association. That is, often no association resources were released - until the process itself exited. In addition, at least one race - condition has been removed - where two threads could attempt to - release the association resources simultaneously - one via - ptw32_callUserDestroyRoutines and the other via - pthread_key_delete. - - thanks to Richard Hughes at Aculab for discovering the problem. - * pthread_key_create.c: See above. - * pthread_key_delete.c: See above. - * pthread_setspecific.c: See above. - * ptw32_callUserDestroyRoutines.c: See above. - * ptw32_tkAssocCreate.c: See above. - * ptw32_tkAssocDestroy.c: See above. - -2005-04-27 Ross Johnson - - * sem_wait.c (ptw32_sem_wait_cleanup): after cancellation re-attempt - to acquire the semaphore to avoid a race with a late sem_post. - * sem_timedwait.c: Modify comments. - -2005-04-25 Ross Johnson - - * ptw32_relmillisecs.c: New module; converts future abstime to - milliseconds relative to 'now'. - * pthread_mutex_timedlock.c: Use new ptw32_relmillisecs routine in - place of internal code; remove the NEED_SEM code - this routine is now - implemented for builds that define NEED_SEM (WinCE etc) - * sem_timedwait.c: Likewise; after timeout or cancellation, - re-attempt to acquire the semaphore in case one has been posted since - the timeout/cancel occurred. Thanks to Stefan Mueller. - * Makefile: Add ptw32_relmillisecs.c module; remove - ptw32_{in,de}crease_semaphore.c modules. - * GNUmakefile: Likewise. - * Bmakefile: Likewise. - - * sem_init.c: Re-write the NEED_SEM code to be consistent with the - non-NEED_SEM code, but retaining use of an event in place of the w32 sema - for w32 systems that don't include semaphores (WinCE); - the NEED_SEM versions of semaphores has been broken for a long time but is - now fixed and supports all of the same routines as the non-NEED_SEM case. - * sem_destroy.c: Likewise. - * sem_wait.c: Likewise. - * sem_post.c: Likewise. - * sem_post_multple.c: Likewise. - * implement.h: Likewise. - * sem_timedwait.c: Likewise; this routine is now - implemented for builds that define NEED_SEM (WinCE etc). - * sem_trywait.c: Likewise. - * sem_getvalue.c: Likewise. - - * pthread_once.c: Yet more changes, reverting closer to Gottlob Frege's - first design, but retaining cancellation, priority boosting, and adding - preservation of W32 error codes to make pthread_once transparent to - GetLastError. - -2005-04-11 Ross Johnson - - * pthread_once.c (pthread_once): Added priority boosting to - solve starvation problem after once_routine cancellation. - See notes in file. - -2005-04-06 Kevin Lussier - - * Makefile: Added debug targets for all versions of the library. - -2005-04-01 Ross Johnson - - * GNUmakefile: Add target to build libpthreadGC1.a as a static link - library. - * Makefile: Likewise for pthreadGC1.lib. - -2005-04-01 Kevin Lussier - - * sem_timedwait.c (sem_timedwait): Increase size of temp variables to - avoid int overflows for large timeout values. - * implement.h (int64_t): Include or define. - -2005-03-31 Dimitar Panayotov ^M - - * pthread.h: Fix conditional defines for static linking. - * sched.h: Liekwise. - * semaphore.h: Likewise. - * dll.c (PTW32_STATIC_LIB): Module is conditionally included - in the build. - -2005-03-16 Ross Johnson ^M - - * pthread_setcancelstate.c: Undo the last change. - -2005-03-16 Ross Johnson ^M - - * pthread_setcancelstate.c: Don't check for an async cancel event - if the library is using alertable async cancel.. - -2005-03-14 Ross Johnson - - * pthread_once.c (pthread_once): Downgrade interlocked operations to simple - memory operations where these are protected by the critical section; edit - comments. - -2005-03-13 Ross Johnson - - * pthread_once.c (pthread_once): Completely redesigned; a change was - required to the ABI (pthread_once_t_), and resulting in a version - compatibility index increment. - - NOTES: - The design (based on pseudo code contributed by Gottlob Frege) avoids - creating a kernel object if there is no contention. See URL for details:- - http://sources.redhat.com/ml/pthreads-win32/2005/msg00029.html - This uses late initialisation similar to the technique already used for - pthreads-win32 mutexes and semaphores (from Alexander Terekhov). - - The subsequent cancelation cleanup additions (by rpj) could not be implemented - without sacrificing some of the efficiency in Gottlob's design. In particular, - although each once_control uses it's own event to block on, a global CS is - required to manage it - since the event must be either re-usable or - re-creatable under cancelation. This is not needed in the non-cancelable - design because it is able to mark the event as closed (forever). - - When uncontested, a CS operation is equivalent to an Interlocked operation - in speed. So, in the final design with cancelability, an uncontested - once_control operation involves a minimum of five interlocked operations - (including the LeaveCS operation). - - ALTERNATIVES: - An alternative design from Alexander Terekhov proposed using a named mutex, - as sketched below:- - - if (!once_control) { // May be in TLS - named_mutex::guard guard(&once_control2); - if (!once_control2) { - - once_control2 = true; - } - once_control = true; - } - - A more detailed description of this can be found here:- - http://groups.yahoo.com/group/boost/message/15442 - - [Although the definition of a suitable PTHREAD_ONCE_INIT precludes use of the - TLS located flag, this is not critical.] - - There are three primary concerns though:- - 1) The [named] mutex is 'created' even in the uncontended case. - 2) A system wide unique name must be generated. - 3) Win32 mutexes are VERY slow even in the uncontended case. An uncontested - Win32 mutex lock operation can be 50 (or more) times slower than an - uncontested EnterCS operation. - - Ultimately, the named mutex trick is making use of the global locks maintained - by the kernel. - - * pthread.h (pthread_once_t_): One flag and an event HANDLE added. - (PTHREAD_ONCE_INIT): Additional values included. - -2005-03-08 Ross Johnson - - * pthread_once.c (pthread_once): Redesigned to elliminate potential - starvation problem. - - reported by Gottlob Frege - - * ptw32_threadDestroy.c (ptw32_threadDestroy): Implicit threads were - not closing their Win32 thread duplicate handle. - - reported by Dmitrii Semii - -2005-01-25 Ralf Kubis - - * Attempted acquisition of recursive mutex was causing waiting - threads to not be woken when the mutex is released. - - * GNUmakefile (GCE): Generate correct version resource comments. - -2005-01-01 Konstantin Voronkov - - * pthread_mutex_lock.c (pthread_mutex_lock): The new atomic exchange - mutex algorithm is known to allow a thread to steal the lock off - FIFO waiting threads. The next waiting FIFO thread gets a spurious - wake-up and must attempt to re-acquire the lock. The woken thread - was setting itself as the mutex's owner before the re-acquisition. - -2004-11-22 Ross Johnson - - * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Undo change - from 2004-11-02. - * Makefile (DLL_VER): Added for DLL naming suffix - see README. - * GNUmakefile (DLL_VER): Likewise. - * Wmakefile (DLL_VER): Likewise. - * Bmakefile (DLL_VER): Likewise. - * pthread.dsw (version.rc): Added to MSVS workspace. - -2004-11-20 Boudewijn Dekker - - * pthread_getspecific.c (pthread_getspecific): Check for - invalid (NULL) key argument. - -2004-11-19 Ross Johnson - - * config.h (PTW32_THREAD_ID_REUSE_INCREMENT): Added to allow - building the library for either unique thread IDs like Solaris - or non-unique thread IDs like Linux; allows application developers - to override the library's default insensitivity to some apps - that may not be strictly POSIX compliant. - * version.rc: New resource module to encode version information - within the DLL. - * pthread.h: Added PTW32_VERSION* defines and grouped sections - required by resource compiler together; bulk of file is skipped - if RC_INVOKED. Defined some error numbers and other names for - Borland compiler. - -2004-11-02 Ross Johnson - - * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Lock CV mutex at - start of cleanup handler rather than at the end. - * implement.h (PTW32_THREAD_REUSE_EMPTY): Renamed from *_BOTTOM. - (ptw32_threadReuseBottom): New global variable. - * global.c (ptw32_threadReuseBottom): Declare new variable. - * ptw32_reuse.c (ptw32_reuse): Change reuse LIFO stack to LILO queue - to more evenly distribute use of reusable thread IDs; use renamed - PTW32_THREAD_REUSE_EMPTY. - * ptw32_processTerminate.c (ptw2_processTerminate): Use renamed - PTW32_THREAD_REUSE_EMPTY. - -2004-10-31 Ross Johnson - - * implement.h (PThreadState): Add new state value - 'PThreadStateCancelPending'. - * pthread_testcancel.c (pthread_testcancel): Use new thread - 'PThreadStateCancelPending' state as short cut to avoid entering - kernel space via WaitForSingleObject() call. This was obviated - by user space sema acquisition in sem_wait() and sem_timedwait(), - which are also cancelation points. A call to pthread_testcancel() - was required, which introduced a kernel call, effectively nullifying - any gains made by the user space sem acquisition checks. - * pthread_cancel.c (pthread_cancel): Set new thread - 'PThreadStateCancelPending' state. - -2004-10-29 Ross Johnson - - * implement.h (pthread_t): Renamed to ptw32_thread_t; struct contains - all thread state. - * pthread.h (ptw32_handle_t): New general purpose struct to serve - as a handle for various reusable object IDs - currently only used - by pthread_t; contains a pointer to ptw32_thread_t (thread state) - and a general purpose uint for use as a reuse counter or flags etc. - (pthread_t): typedef'ed to ptw32_handle_t; the uint is the reuse - counter that allows the library to maintain unique POSIX thread IDs. - When the pthread struct reuse stack was introduced, threads would - often acquire an identical ID to a previously destroyed thread. The - same was true for the pre-reuse stack library, by virtue of pthread_t - being the address of the thread struct. The new pthread_t retains - the reuse stack but provides virtually unique thread IDs. - * sem_wait.c (ptw32_sem_wait_cleanup): New routine used for - cancelation cleanup. - * sem_timedwait.c (ptw32_sem_timedwait_cleanup): Likewise. - -2004-10-22 Ross Johnson - - * sem_init.c (sem_init): Introduce a 'lock' element in order to - replace the interlocked operations with conventional serialisation. - This is needed in order to be able to atomically modify the sema - value and perform Win32 sema release operations. Win32 semaphores are - used instead of events in order to support efficient multiple posting. - If the whole modify/release isn't atomic, a race between - sem_timedwait() and sem_post() could result in a release when there is - no waiting semaphore, which would cause too many threads to proceed. - * sem_wait.c (sem_wait): Use new 'lock'element. - * sem_timedwait.c (sem_timedwait): Likewise. - * sem_trywait.c (sem_trywait): Likewise. - * sem_post.c (sem_post): Likewise. - * sem_post_multiple.c (sem_post_multiple): Likewise. - * sem_getvalue.c (sem_getvalue): Likewise. - * ptw32_semwait.c (ptw32_semwait): Likewise. - * sem_destroy.c (sem_destroy): Likewise; also tightened the conditions - for semaphore destruction; in particular, a semaphore will not be - destroyed if it has waiters. - * sem_timedwait.c (sem_timedwait): Added cancel cleanup handler to - restore sema value when cancelled. - * sem_wait.c (sem_wait): Likewise. - -2004-10-21 Ross Johnson - - * pthread_mutex_unlock.c (pthread_mutex_unlock): Must use PulseEvent() - rather than SetEvent() to reset the event if there are no waiters. - -2004-10-19 Ross Johnson - - * sem_init.c (sem_init): New semaphore model based on the same idea - as mutexes, i.e. user space interlocked check to avoid - unnecessarily entering kernel space. Wraps the Win32 semaphore and - keeps it's own counter. Although the motivation to do this has existed - for a long time, credit goes to Alexander Terekhov for providing - the logic. I have deviated slightly from AT's logic to add the waiters - count, which has made the code more complicated by adding cancelation - cleanup. This also appears to have broken the VCE (C++ EH) version of - the library (the same problem as previously reported - see BUGS #2), - only apparently not fixable using the usual workaround, nor by turning - all optimisation off. The GCE version works fine, so it is presumed to - be a bug in MSVC++ 6.0. The cancelation exception is thrown and caught - correctly, but the cleanup class destructor is never called. The failing - test is tests\semaphore4.c. - * sem_wait.c (sem_wait): Implemented user space check model. - * sem_post.c (sem_post): Likewise. - * sem_trywait.c (sem_trywait): Likewise. - * sem_timedwait.c (sem_timedwait): Likewise. - * sem_post_multiple.c (sem_post_multiple): Likewise. - * sem_getvalue.c (sem_getvalue): Likewise. - * ptw32_semwait.c (ptw32_semwait): Likewise. - * implement.h (sem_t_): Add counter element. - -2004-10-15 Ross Johnson - - * implement.h (pthread_mutex_t_): Use an event in place of - the POSIX semaphore. - * pthread_mutex_init.c: Create the event; remove semaphore init. - * pthread_mutex_destroy.c: Delete the event. - * pthread_mutex_lock.c: Replace the semaphore wait with the event wait. - * pthread_mutex_trylock.c: Likewise. - * pthread_mutex_timedlock.c: Likewise. - * pthread_mutex_unlock.c: Set the event. - -2004-10-14 Ross Johnson - - * pthread_mutex_lock.c (pthread_mutex_lock): New algorithm using - Terekhov's xchg based variation of Drepper's cmpxchg model. - Theoretically, xchg uses fewer clock cycles than cmpxchg (using IA-32 - as a reference), however, in my opinion bus locking dominates the - equation on smp systems, so the model with the least number of bus - lock operations in the execution path should win, which is Terekhov's - variant. On IA-32 uni-processor systems, it's faster to use the - CMPXCHG instruction without locking the bus than to use the XCHG - instruction, which always locks the bus. This makes the two variants - equal for the non-contended lock (fast lane) execution path on up - IA-32. Testing shows that the xchg variant is faster on up IA-32 as - well if the test forces higher lock contention frequency, even though - kernel calls should be dominating the times (on up IA-32, both - variants used CMPXCHG instructions and neither locked the bus). - * pthread_mutex_timedlock.c pthread_mutex_timedlock(): Similarly. - * pthread_mutex_trylock.c (pthread_mutex_trylock): Similarly. - * pthread_mutex_unlock.c (pthread_mutex_unlock): Similarly. - * ptw32_InterlockedCompareExchange.c (ptw32_InterlockExchange): New - function. - (PTW32_INTERLOCKED_EXCHANGE): Sets up macro to use inlined - ptw32_InterlockedExchange. - * implement.h (PTW32_INTERLOCKED_EXCHANGE): Set default to - InterlockedExchange(). - * Makefile: Building using /Ob2 so that asm sections within inline - functions are inlined. - -2004-10-08 Ross Johnson - - * pthread_mutex_destroy.c (pthread_mutex_destroy): Critical Section - element is no longer required. - * pthread_mutex_init.c (pthread_mutex_init): Likewise. - * pthread_mutex_lock.c (pthread_mutex_lock): New algorithm following - Drepper's paper at http://people.redhat.com/drepper/futex.pdf, but - using the existing semaphore in place of the futex described in the - paper. Idea suggested by Alexander Terekhov - see: - http://sources.redhat.com/ml/pthreads-win32/2003/msg00108.html - * pthread_mutex_timedlock.c pthread_mutex_timedlock(): Similarly. - * pthread_mutex_trylock.c (pthread_mutex_trylock): Similarly. - * pthread_mutex_unlock.c (pthread_mutex_unlock): Similarly. - * pthread_barrier_wait.c (pthread_barrier_wait): Use inlined version - of InterlockedCompareExchange() if possible - determined at - build-time. - * pthread_spin_destroy.c pthread_spin_destroy(): Likewise. - * pthread_spin_lock.c pthread_spin_lock():Likewise. - * pthread_spin_trylock.c (pthread_spin_trylock):Likewise. - * pthread_spin_unlock.c (pthread_spin_unlock):Likewise. - * ptw32_InterlockedCompareExchange.c: Sets up macro for inlined use. - * implement.h (pthread_mutex_t_): Remove Critical Section element. - (PTW32_INTERLOCKED_COMPARE_EXCHANGE): Set to default non-inlined - version of InterlockedCompareExchange(). - * private.c: Include ptw32_InterlockedCompareExchange.c first for - inlining. - * GNUmakefile: Add commandline option to use inlined - InterlockedCompareExchange(). - * Makefile: Likewise. - -2004-09-27 Ross Johnson - - * pthread_mutex_lock.c (pthread_mutex_lock): Separate - PTHREAD_MUTEX_NORMAL logic since we do not need to keep or check some - state required by other mutex types; do not check mutex pointer arg - for validity - leave this to the system since we are only checking - for NULL pointers. This should improve speed of NORMAL mutexes and - marginally improve speed of other type. - * pthread_mutex_trylock.c (pthread_mutex_trylock): Likewise. - * pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise; also avoid - entering the critical section for the no-waiters case, with approx. - 30% reduction in lock/unlock overhead for this case. - * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise; also - no longer keeps mutex if post-timeout second attempt succeeds - this - will assist applications that wish to impose strict lock deadlines, - rather than simply to escape from frozen locks. - -2004-09-09 Tristan Savatier - * pthread.h (struct pthread_once_t_): Qualify the 'done' element - as 'volatile'. - * pthread_once.c: Concerned about possible race condition, - specifically on MPU systems re concurrent access to multibyte types. - [Maintainer's note: the race condition is harmless on SPU systems - and only a problem on MPU systems if concurrent access results in an - exception (presumably generated by a hardware interrupt). There are - other instances of similar harmless race conditions that have not - been identified as issues.] - -2004-09-09 Ross Johnson - - * pthread.h: Declare additional types as volatile. - -2004-08-27 Ross Johnson - - * pthread_barrier_wait.c (pthread_barrier_wait): Remove excessive code - by substituting the internal non-cancelable version of sem_wait - (ptw32_semwait). - -2004-08-25 Ross Johnson - - * pthread_join.c (pthread_join): Rewrite and re-order the conditional - tests in an attempt to improve efficiency and remove a race - condition. - -2004-08-23 Ross Johnson - - * create.c (pthread_create): Don't create a thread if the thread - id pointer location (first arg) is inaccessible. A memory - protection fault will result if the thread id arg isn't an accessible - location. This is consistent with GNU/Linux but different to - Solaris or MKS (and possibly others), which accept NULL as meaning - 'don't return the created thread's ID'. Applications that run - using pthreads-win32 will run on all other POSIX threads - implementations, at least w.r.t. this feature. - - It was decided not to copy the Solaris et al behaviour because, - although it would have simplified some application porting (but only - from Solaris to Windows), the feature is not technically necessary, - and the alternative segfault behaviour helps avoid buggy application - code. - -2004-07-01 Anuj Goyal - - * builddmc.bat: New; Windows bat file to build the library. - * config.h (__DMC__): Support for Digital Mars compiler. - * create.c (__DMC__): Likewise. - * pthread_exit.c (__DMC__): Likewise. - * pthread_join.c (__DMC__): Likewise. - * ptw32_threadDestroy.c (__DMC__): Likewise. - * ptw32_threadStart.c (__DMC__): Likewise. - * ptw32_throw.c (__DMC__): Likewise. - -2004-06-29 Anuj Goyal - - * pthread.h (__DMC__): Initial support for Digital Mars compiler. - -2004-06-29 Will Bryant - - * README.Borland: New; description of Borland changes. - * Bmakefile: New makefile for the Borland make utility. - * ptw32_InterlockedCompareExchange.c: - Add Borland compatible asm code. - -2004-06-26 Jason Bard - - * pthread.h (HAVE_STRUCT_TIMESPEC): If undefined, define it - to avoid timespec struct redefined errors elsewhere in an - application. - -2004-06-21 Ross Johnson - - * pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Mutex - initialiser added for compatibility with Linux threads and - others; currently not included in SUSV3. - * pthread.h (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER): Likewise. - * pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP): Likewise. - * pthread.h (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): Likewise. - - * ptw32_mutex_check_need_init.c (ptw32_mutex_check_need_init): - Add new initialisers. - - * pthread_mutex_lock.c (pthread_mutex_lock): Check for new - initialisers. - * pthread_mutex_trylock.c (pthread_mutex_trylock): Likewise. - * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise. - * pthread_mutex_unlock.c (pthread_mutex_unlock): Likewise. - * pthread_mutex_destroy.c (pthread_mutex_destroy): Likewise. - -2004-05-20 Ross Johnson - - * README.NONPORTABLE: Document pthread_win32_test_features_np(). - * FAQ: Update various answers. - -2004-05-19 Ross Johnson - - * Makefile: Don't define _WIN32_WINNT on compiler command line. - * GNUmakefile: Likewise. - -2004-05-16 Ross Johnson - - * pthread_cancel.c (pthread_cancel): Adapted to use auto-detected - QueueUserAPCEx features at run-time. - (ptw32_RegisterCancelation): Drop in replacement for QueueUserAPCEx() - if it can't be used. Provides older style non-preemptive async - cancelation. - * pthread_win32_attach_detach_np.c (pthread_win32_attach_np): - Auto-detect quserex.dll and the availability of alertdrv.sys; - initialise and close on process attach/detach. - * global.c (ptw32_register_cancelation): Pointer to either - QueueUserAPCEx() or ptw32_RegisterCancelation() depending on - availability. QueueUserAPCEx makes pre-emptive async cancelation - possible. - * implement.h: Add definitions and prototypes related to QueueUserAPC. - -2004-05-16 Panagiotis E. Hadjidoukas - - * QueueUserAPCEx (separate contributed package): Provides preemptive - APC feature. - * pthread_cancel.c (pthread_cancel): Initial integration of - QueueUserAPCEx into pthreads-win32 to provide true pre-emptive - async cancelation of threads, including blocked threads. - -2004-05-06 Makoto Kato - - * pthread.h (DWORD_PTR): Define typedef for older MSVC. - * pthread_cancel.c (AMD64): Add architecture specific Context register. - * ptw32_getprocessors.c: Use correct types (DWORD_PTR) for mask - variables. - -2004-04-06 P. van Bruggen - - * ptw32_threadDestroy.c: Destroy threadLock mutex to - close a memory leak. - -2004-02-13 Gustav Hallberg - - * pthread_equal.c: Remove redundant equality logic. - -2003-12-10 Philippe Di Cristo - - * sem_timedwait.c (sem_timedwait): Fix timeout calculations. - -2003-10-20 Alexander Terekhov - - * pthread_mutex_timedlock.c (ptw32_semwait): Move to individual module. - * ptw32_semwait.c: New module. - * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Replace cancelable - sem_wait() call with non-cancelable ptw32_semwait() call. - * pthread.c (private.c): Re-order for inlining. GNU C warned that - function ptw32_semwait() was defined 'inline' after it was called. - * pthread_cond_signal.c (ptw32_cond_unblock): Likewise. - * pthread_delay_np.c: Disable Watcom warning with comment. - * *.c (process.h): Remove include from .c files. This is conditionally - included by the common project include files. - -2003-10-20 James Ewing - - * ptw32_getprocessors.c: Some Win32 environments don't have - GetProcessAffinityMask(), so always return CPU count = 1 for them. - * config.h (NEED_PROCESSOR_AFFINITY_MASK): Define for WinCE. - -2003-10-15 Ross Johnson - - * Re-indented all .c files using default GNU style to remove assorted - editor ugliness (used GNU indent utility in default style). - -2003-10-15 Alex Blanco - - * sem_init.c (sem_init): Would call CreateSemaphore even if the sema - struct calloc failed; was not freeing calloced memory if either - CreateSemaphore or CreateEvent failed. - -2003-10-14 Ross Johnson - - * pthread.h: Add Watcom compiler compatibility. Esssentially just add - the cdecl attribute to all exposed function prototypes so that Watcom - generates function call code compatible with non-Watcom built libraries. - By default, Watcom uses registers to pass function args if possible rather - than pushing to stack. - * semaphore.h: Likewise. - * sched.h: Likewise. - * pthread_cond_wait.c (ptw32_cond_wait_cleanup): Define with cdecl attribute - for Watcom compatibility. This routine is called via pthread_cleanup_push so - it had to match function arg definition. - * Wmakefile: New makefile for Watcom builds. - -2003-09-14 Ross Johnson - - * pthread_setschedparam.c (pthread_setschedparam): Attempt to map - all priority levels between max and min (as returned by - sched_get_priority_min/max) to reasonable Win32 priority levels - i.e. - levels between THREAD_PRIORITY_LOWEST/IDLE to THREAD_PRIORITY_LOWEST and - between THREAD_PRIORITY_HIGHEST/TIME_CRITICAL to THREAD_PRIORITY_HIGHEST - while others remain unchanged; record specified thread priority level - for return by pthread_getschedparam. - - Note that, previously, specified levels not matching Win32 priority levels - would silently leave the current thread priority unaltered. - - * pthread_getschedparam.c (pthread_getschedparam): Return the priority - level specified by the latest pthread_setschedparam or pthread_create rather - than the actual running thread priority as returned by GetThreadPriority - as - required by POSIX. I.e. temporary or adjusted actual priority levels are not - returned by this routine. - - * pthread_create.c (pthread_create): For priority levels specified via - pthread attributes, attempt to map all priority levels between max and - min (as returned by sched_get_priority_min/max) to reasonable Win32 - priority levels; record priority level given via attributes, or - inherited from parent thread, for later return by pthread_getschedparam. - - * ptw32_new.c (ptw32_new): Initialise pthread_t_ sched_priority element. - - * pthread_self.c (pthread_self): Set newly created implicit POSIX thread - sched_priority to Win32 thread's current actual priority. Temporarily - altered priorities can't be avoided in this case. - - * implement.h (struct pthread_t_): Add new sched_priority element. - -2003-09-12 Ross Johnson - - * sched_get_priority_min.c (sched_get_priority_min): On error should return -1 - with errno set. - * sched_get_priority_max.c (sched_get_priority_max): Likewise. - -2003-09-03 Ross Johnson - - * w32_cancelableWait.c (ptw32_cancelable_wait): Allow cancelation - of implicit POSIX threads as well. - -2003-09-02 Ross Johnson - - * pthread_win32_attach_detach_np.c (pthread_win32_thread_detach_np): - Add comment. - - * pthread_exit.c (pthread_exit): Fix to recycle the POSIX thread handle in - addition to calling user TSD destructors. Move the implicit POSIX thread exit - handling to ptw32_throw to centralise the logic. - - * ptw32_throw.c (ptw32_throw): Implicit POSIX threads have no point - to jump or throw to, so cleanup and exit the thread here in this case. For - processes using the C runtime, the exit code will be set to the POSIX - reason for the throw (i.e. PTHREAD_CANCEL or the value given to pthread_exit). - Note that pthread_exit() already had similar logic, which has been moved to - here. - - * ptw32_threadDestroy.c (ptw32_threadDestroy): Don't close the Win32 handle - of implicit POSIX threads - expect this to be done by Win32? - -2003-09-01 Ross Johnson - - * pthread_self.c (pthread_self): The newly aquired pthread_t must be - assigned to the reuse stack, not freed, if the routine fails somehow. - -2003-08-13 Ross Johnson - - * pthread_getschedparam.c (pthread_getschedparam): An invalid thread ID - parameter was returning an incorrect error value; now uses a more exhaustive - check for validity. - - * pthread_setschedparam.c (pthread_setschedparam): Likewise. - - * pthread_join.c (pthread_join): Now uses a more exhaustive - check for validity. - - * pthread_detach.c (pthread_detach): Likewise. - - * pthread_cancel.c (pthread_cancel): Likewise. - - * ptw32_threadDestroy.c (ptw32_threadDestroy): pthread_t structs are - never freed - push them onto a stack for reuse. - - * ptw32_new.c (ptw32_new): Check for reusable pthread_t before dynamically - allocating new memory for the struct. - - * pthread_kill.c (pthread_kill): New file; new routine; takes only a zero - signal arg so that applications can check the thread arg for validity; checks - that the underlying Win32 thread HANDLE is valid. - - * pthread.h (pthread_kill): Add prototype. - - * ptw32_reuse.c (ptw32_threadReusePop): New file; new routine; pop a - pthread_t off the reuse stack. pthread_t_ structs that have been destroyed, i.e. - have exited detached or have been joined, are cleaned up and put onto a reuse - stack. Consequently, thread IDs are no longer freed once calloced. The library - will attempt to get a struct off this stack before asking the system to alloc - new memory when creating threads. The stack is guarded by a global mutex. - (ptw32_threadReusePush): New routine; push a pthread_t onto the reuse stack. - - * implement.h (ptw32_threadReusePush): Add new prototype. - (ptw32_threadReusePop): Likewise. - (pthread_t): Add new element. - - * ptw32_processTerminate.c (ptw32_processTerminate): Delete the thread - reuse lock; free all thread ID structs on the thread reuse stack. - - * ptw32_processInitialize.c (ptw32_processInitialize): Initialise the - thread reuse lock. - -2003-07-19 Ross Johnson - - * GNUmakefile: modified to work under MsysDTK environment. - * pthread_spin_lock.c (pthread_spin_lock): Check for NULL arg. - * pthread_spin_unlock.c (pthread_spin_unlock): Likewise. - * pthread_spin_trylock.c (pthread_spin_trylock): Likewise; - fix incorrect pointer value if lock is dynamically initialised by - this function. - * sem_init.c (sem_init): Initialise sem_t value to quell compiler warning. - * sem_destroy.c (sem_destroy): Likewise. - * ptw32_threadStart.c (non-MSVC code sections): Include rather - than old-style ; fix all std:: namespace entities such as - std::terminate_handler instances and associated methods. - * ptw32_callUserDestroyRoutines.c (non-MSVC code sections): Likewise. - -2003-06-24 Piet van Bruggen - - * pthread_spin_destroy.c (pthread_spin_destroy): Was not freeing the - spinlock struct. - -2003-06-22 Nicolas Barry - - * pthread_mutex_destroy.c (pthread_mutex_destroy): When called - with a recursive mutex that was locked by the current thread, the - function was failing with a success return code. - -2003-05-15 Steven Reddie - - * pthread_win32_attach_detach_np.c (pthread_win32_process_detach_np): - NULLify ptw32_selfThreadKey after the thread is destroyed, otherwise - destructors calling pthreads routines might resurrect it again, creating - memory leaks. Call the underlying Win32 Tls routine directly rather than - pthread_setspecific(). - (pthread_win32_thread_detach_np): Likewise. - -2003-05-14 Viv - - * pthread.dsp: Change /MT compile flag to /MD. - -2003-03-04 Alexander Terekhov - - * pthread_mutex_timedlock.c (pthread_mutex_timedlock): Fix failure to - set ownership of mutex on second grab after abstime timeout. - - bug reported by Robert Strycek - -2002-12-17 Thomas Pfaff - - * pthread_mutex_lock.c (ptw32_semwait): New static routine to provide - a non-cancelable sem_wait() function. This is consistent with the - way that pthread_mutex_timedlock.c does it. - (pthread_mutex_lock): Use ptw32_semwait() instead of sem_wait(). - -2002-12-11 Thomas Pfaff - - * pthread_mutex_trylock.c: Should return EBUSY rather than EDEADLK. - * pthread_mutex_destroy.c: Remove redundant ownership test (the - trylock call does this for us); do not destroy a recursively locked - mutex. - -2002-09-20 Michael Johnson - - * pthread_cond_destroy.c (pthread_cond_destroy): - When two different threads exist, and one is attempting to - destroy a condition variable while the other is attempting to - initialize a condition variable that was created with - PTHREAD_COND_INITIALIZER, a deadlock can occur. Shrink - the ptw32_cond_list_lock critical section to fix it. - -2002-07-31 Ross Johnson - - * ptw32_threadStart.c (ptw32_threadStart): Thread cancelLock - destruction moved to ptw32_threadDestroy(). - - * ptw32_threadDestroy.c (ptw32_threadDestroy): Destroy - the thread's cancelLock. Moved here from ptw32_threadStart.c - to cleanup implicit threads as well. - -2002-07-30 Alexander Terekhov - - * pthread_cond_wait.c (ptw32_cond_wait_cleanup): - Remove code designed to avoid/prevent spurious wakeup - problems. It is believed that the sem_timedwait() call - is consuming a CV signal that it shouldn't and this is - breaking the avoidance logic. - -2002-07-30 Ross Johnson - - * sem_timedwait.c (sem_timedwait): Tighten checks for - unreasonable abstime values - that would result in - unexpected timeout values. - - * w32_CancelableWait.c (ptw32_cancelable_wait): - Tighten up return value checking and add comments. - - -2002-06-08 Ross Johnson - - * sem_getvalue.c (sem_getvalue): Now returns a value for the - NEED_SEM version (i.e. earlier versions of WinCE). - - -2002-06-04 Rob Fanner - - * sem_getvalue.c (sem_getvalue): The Johnson M. Hart - approach didn't work - we are forced to take an - intrusive approach. We try to decrement the sema - and then immediately release it again to get the - value. There is a small probability that this may - block other threads, but only momentarily. - -2002-06-03 Ross Johnson - - * sem_init.c (sem_init): Initialise Win32 semaphores - to _POSIX_SEM_VALUE_MAX (which this implementation - defines in pthread.h) so that sem_getvalue() can use - the trick described in the comments in sem_getvalue(). - * pthread.h (_POSIX_SEM_VALUE_MAX): Defined. - (_POSIX_SEM_NSEMS_MAX): Defined - not used but may be - useful for source code portability. - -2002-06-03 Rob Fanner - - * sem_getvalue.c (sem_getvalue): Did not work on NT. - Use approach suggested by Johnson M. Hart in his book - "Win32 System Programming". - -2002-02-28 Ross Johnson - - * errno.c: Compiler directive was incorrectly including code. - * pthread.h: Conditionally added some #defines from config.h - needed when not building the library. e.g. NEED_ERRNO, NEED_SEM. - (PTW32_DLLPORT): Now only defined if _DLL defined. - (_errno): Compiler directive was incorrectly including prototype. - * sched.h: Conditionally added some #defines from config.h - needed when not building the library. - * semaphore.h: Replace an instance of NEED_SEM that should - have been NEED_ERRNO. This change currently has nil effect. - - * GNUmakefile: Correct some recent changes. - - * Makefile: Add rule to generate pre-processor output. - -2002-02-23 Ross Johnson - - * pthread_rwlock_timedrdlock.c: New - untested. - * pthread_rwlock_timedwrlock.c: New - untested. - - * Testsuite passed (except known MSVC++ problems) - - * pthread_cond_destroy.c: Expand the time change - critical section to solve deadlock problem. - - * pthread.c: Add all remaining C modules. - * pthread.h: Use dllexport/dllimport attributes on functions - to avoid using pthread.def. - * sched.h: Likewise. - * semaphore.h: Likewise. - * GNUmakefile: Add new targets for single translation - unit build to maximise inlining potential; generate - pthread.def automatically. - * Makefile: Likewise, but no longer uses pthread.def. - -2002-02-20 Ross Johnson - - * pthread_cond_destroy.c (pthread_cond_destroy): - Enter the time change critical section earlier. - -2002-02-17 Ross Johnson - - * nonportable.c (pthread_delay_np): Make a true - cancelation point. Deferred cancels will interrupt the - wait. - -2002-02-07 Ross Johnson - - Reduced name space pollution. - ----------------------------- - When the appropriate symbols are defined, the headers - will restrict the definitions of new names. In particular, - it must be possible to NOT include the - header and related definitions with some combination - of symbol definitions. Secondly, it should be possible - that additional definitions should be limited to POSIX - compliant symbols by the definition of appropriate symbols. - - * pthread.h: POSIX conditionals. - * sched.h: POSIX conditionals. - * semaphore.h: POSIX conditionals. - - * semaphore.c: Included . - (sem_init): Changed magic 0x7FFFFFFFL to INT_MAX. - (sem_getvalue): Trial version. - - Reduce executable size. - ----------------------- - When linking with the static library, only those - routines actually called, either directly or indirectly - should be included. - - [Gcc has the -ffunction-segments option to do this but MSVC - doesn't have this feature as far as I can determine. Other - compilers are undetermined as well. - rpj] - - * semaphore.c: All routines are now in separate compilation units; - This file is used to congregate the separate modules for - potential inline optimisation and backward build compatibility. - * sem_close.c: Separated routine from semaphore.c. - * ptw32_decrease_semaphore.c: Likewise. - * sem_destroy.c: Likewise. - * sem_getvalue.c: Likewise. - * ptw32_increase_semaphore.c: Likewise. - * sem_init.c: Likewise. - * sem_open.c: Likewise. - * sem_post.c: Likewise. - * sem_post_multiple.c: Likewise. - * sem_timedwait.c: Likewise. - * sem_trywait.c: Likewise. - * sem_unlink.c: Likewise. - * sem_wait.c: Likewise. - -2002-02-04 Ross Johnson - - The following extends the idea above to the rest of pthreads-win32 - rpj - - * attr.c: All routines are now in separate compilation units; - This file is used to congregate the separate modules for - potential inline optimisation and backward build compatibility. - * pthread_attr_destroy.c: Separated routine from attr.c. - * pthread_attr_getdetachstate.c: Likewise. - * pthread_attr_getscope.c: Likewise. - * pthread_attr_getstackaddr.c: Likewise. - * pthread_attr_getstacksize.c: Likewise. - * pthread_attr_init.c: Likewise. - * pthread_attr_is_attr.c: Likewise. - * pthread_attr_setdetachstate.c: Likewise. - * pthread_attr_setscope.c: Likewise. - * pthread_attr_setstackaddr.c: Likewise. - * pthread_attr_setstacksize.c: Likewise. - - * pthread.c: Agregation of agregate modules for super-inlineability. - -2002-02-02 Ross Johnson - - * cancel.c: Rearranged some code and introduced checks - to disable cancelation at the start of a thread's cancelation - run to prevent double cancelation. The main problem - arises if a thread is canceling and then receives a subsequent - async cancel request. - * private.c: Likewise. - * condvar.c: Place pragmas around cleanup_push/pop to turn - off inline optimisation (/Obn where n>0 - MSVC only). Various - optimisation switches in MSVC turn this on, which interferes with - the way that cleanup handlers are run in C++ EH and SEH - code. Application code compiled with inline optimisation must - also wrap cleanup_push/pop blocks with the pragmas, e.g. - #pragma inline_depth(0) - pthread_cleanup_push(...) - ... - pthread_cleanup_pop(...) - #pragma inline_depth(8) - * rwlock.c: Likewise. - * mutex.c: Remove attempts to inline some functions. - * signal.c: Modify misleading comment. - -2002-02-01 Ross Johnson - - * semaphore.c (sem_trywait): Fix missing errno return - for systems that define NEED_SEM (e.g. early WinCE). - * mutex.c (pthread_mutex_timedlock): Return ENOTSUP - for systems that define NEED_SEM since they don't - have sem_trywait(). - -2002-01-27 Ross Johnson - - * mutex.c (pthread_mutex_timedlock): New function suggested by - Alexander Terekhov. The logic required to implement this - properly came from Alexander, with some collaboration - with Thomas Pfaff. - (pthread_mutex_unlock): Wrap the waiters check and sema - post in a critical section to prevent a race with - pthread_mutex_timedlock. - (ptw32_timed_semwait): New function; - returns a special result if the absolute timeout parameter - represents a time already passed when called; used by - pthread_mutex_timedwait(). Have deliberately not reused - the name "ptw32_sem_timedwait" because they are not the same - routine. - * condvar.c (ptw32_cond_timedwait): Use the new sem_timedwait() - instead of ptw32_sem_timedwait(), which now has a different - function. See previous. - * implement.h: Remove prototype for ptw32_sem_timedwait. - See next. - (pthread_mutex_t_): Add critical section element for access - to lock_idx during mutex post-timeout processing. - * semaphore.h (sem_timedwait): See next. - * semaphore.c (sem_timedwait): See next. - * private.c (ptw32_sem_timedwait): Move to semaphore.c - and rename as sem_timedwait(). - -2002-01-18 Ross Johnson - - * sync.c (pthread_join): Was getting the exit code from the - calling thread rather than the joined thread if - defined(__MINGW32__) && !defined(__MSVCRT__). - -2002-01-15 Ross Johnson - - * pthread.h: Unless the build explicitly defines __CLEANUP_SEH, - __CLEANUP_CXX, or __CLEANUP_C, then the build defaults to - __CLEANUP_C style cleanup. This style uses setjmp/longjmp - in the cancelation and thread exit implementations and therefore - won't do stack unwinding if linked to applications that have it - (e.g. C++ apps). This is currently consistent with most/all - commercial Unix POSIX threads implementations. - - * spin.c (pthread_spin_init): Edit renamed function call. - * nonportable.c (pthread_num_processors_np): New. - (pthread_getprocessors_np): Renamed to ptw32_getprocessors - and moved to private.c. - * private.c (pthread_getprocessors): Moved here from - nonportable.c. - * pthread.def (pthread_getprocessors_np): Removed - from export list. - - * rwlock.c (pthread_rwlockattr_init): New. - (pthread_rwlockattr_destroy): New. - (pthread_rwlockattr_getpshared): New. - (pthread_rwlockattr_setpshared): New. - -2002-01-14 Ross Johnson - - * attr.c (pthread_attr_setscope): Fix struct pointer - indirection error introduced 2002-01-04. - (pthread_attr_getscope): Likewise. - -2002-01-12 Ross Johnson - - * pthread.dsp (SOURCE): Add missing source files. - -2002-01-08 Ross Johnson - - * mutex.c (pthread_mutex_trylock): use - ptw32_interlocked_compare_exchange function pointer - rather than ptw32_InterlockedCompareExchange() directly - to retain portability to non-iX86 processors, - e.g. WinCE etc. The pointer will point to the native - OS version of InterlockedCompareExchange() if the - OS supports it (see ChangeLog entry of 2001-10-17). - -2002-01-07 Thomas Pfaff , Alexander Terekhov - - * mutex.c (pthread_mutex_init): Remove critical - section calls. - (pthread_mutex_destroy): Likewise. - (pthread_mutex_unlock): Likewise. - (pthread_mutex_trylock): Likewise; uses - ptw32_InterlockedCompareExchange() to avoid need for - critical section; library is no longer i386 compatible; - recursive mutexes now increment the lock count rather - than return EBUSY; errorcheck mutexes return EDEADLCK - rather than EBUSY. This behaviour is consistent with the - Solaris pthreads implementation. - * implement.h (pthread_mutex_t_): Remove critical - section element - no longer needed. - - -2002-01-04 Ross Johnson - - * attr.c (pthread_attr_setscope): Add more error - checking and actually store the scope value even - though it's not really necessary. - (pthread_attr_getscope): Return stored value. - * implement.h (pthread_attr_t_): Add new scope element. - * ANNOUNCE: Fix out of date comment next to - pthread_attr_setscope in conformance section. - -2001-12-21 Alexander Terekhov - - * mutex.c (pthread_mutex_lock): Decrementing lock_idx was - not thread-safe. - (pthread_mutex_trylock): Likewise. - -2001-10-26 prionx@juno.com - - * semaphore.c (sem_init): Fix typo and missing bracket - in conditionally compiled code. Only older versions of - WinCE require this code, hence it doesn't normally get - tested; somehow when sem_t reverted to an opaque struct - the calloc NULL check was left in the conditionally included - section. - (sem_destroy): Likewise, the calloced sem_t wasn't being freed. - -2001-10-25 Ross Johnson - - * GNUmakefile (libwsock32): Add to linker flags for - WSAGetLastError() and WSASetLastError(). - * Makefile (wsock32.lib): Likewise. - * create.c: Minor mostly inert changes. - * implement.h (PTW32_MAX): Move into here and renamed - from sched.h. - (PTW32_MIN): Likewise. - * GNUmakefile (TEST_ICE): Define if testing internal - implementation of InterlockedCompareExchange. - * Makefile (TEST_ICE): Likewise. - * private.c (TEST_ICE): Likewise. - -2001-10-24 Ross Johnson - - * attr.c (pthread_attr_setstacksize): Quell warning - from LCC by conditionally compiling the stacksize - validity check. LCC correctly warns that the condition - (stacksize < PTHREAD_STACK_MIN) is suspicious - because STACK_MIN is 0 and stacksize is of type - size_t (or unsigned int). - -2001-10-17 Ross Johnson - - * barrier.c: Move _LONG and _LPLONG defines into - implement.h; rename to PTW32_INTERLOCKED_LONG and - PTW32_INTERLOCKED_LPLONG respectively. - * spin.c: Likewise; ptw32_interlocked_compare_exchange used - in place of InterlockedCompareExchange directly. - * global.c (ptw32_interlocked_compare_exchange): Add - prototype for this new routine pointer to be used when - InterlockedCompareExchange isn't supported by Windows. - * nonportable.c (pthread_win32_process_attach_np): Check for - support of InterlockedCompareExchange in kernel32 and assign its - address to ptw32_interlocked_compare_exchange if it exists, or - our own ix86 specific implementation ptw32_InterlockedCompareExchange. - *private.c (ptw32_InterlockedCompareExchange): An - implementation of InterlockedCompareExchange() which is - specific to ix86; written directly in assembler for either - MSVC or GNU C; needed because Windows 95 doesn't support - InterlockedCompareExchange(). - - * sched.c (sched_get_priority_min): Extend to return - THREAD_PRIORITY_IDLE. - (sched_get_priority_max): Extend to return - THREAD_PRIORITY_CRITICAL. - -2001-10-15 Ross Johnson - - * spin.c (pthread_spin_lock): PTHREAD_SPINLOCK_INITIALIZER - was causing a program fault. - (pthread_spin_init): Could have alloced memory - without freeing under some error conditions. - - * mutex.c (pthread_mutex_init): Move memory - allocation of mutex struct after checking for - PROCESS_SHARED. - -2001-10-12 Ross Johnson - - * spin.c (pthread_spin_unlock): Was not returning - EPERM if the spinlock was not locked, for multi CPU - machines. - -2001-10-08 Ross Johnson - - * spin.c (pthread_spin_trylock): Was not returning - EBUSY for multi CPU machines. - -2001-08-24 Ross Johnson - - * condvar.c (pthread_cond_destroy): Remove cv element - that is no longer used. - * implement.h: Likewise. - -2001-08-23 Alexander Terekhov - - * condvar.c (pthread_cond_destroy): fix bug with - respect to deadlock in the case of concurrent - _destroy/_unblock; a condition variable can be destroyed - immediately after all the threads that are blocked on - it are awakened. - -2001-08-23 Phil Frisbie, Jr. - - * tsd.c (pthread_getspecific): Preserve the last - winsock error [from WSAGetLastError()]. - -2001-07-18 Scott McCaskill - - * mutex.c (pthread_mutexattr_init): Return ENOMEM - immediately and don't dereference the NULL pointer - if calloc fails. - (pthread_mutexattr_getpshared): Don't dereference - a pointer that is possibly NULL. - * barrier.c (pthread_barrierattr_init): Likewise - (pthread_barrierattr_getpshared): Don't dereference - a pointer that is possibly NULL. - * condvar.c (pthread_condattr_getpshared): Don't dereference - a pointer that is possibly NULL. - -2001-07-15 Ross Johnson - - * rwlock.c (pthread_rwlock_wrlock): Is allowed to be - a cancelation point; re-enable deferred cancelability - around the CV call. - -2001-07-10 Ross Johnson - - * barrier.c: Still more revamping. The exclusive access - mutex isn't really needed so it has been removed and replaced - by an InterlockedDecrement(). nSerial has been removed. - iStep is now dual-purpose. The process shared attribute - is now stored in the barrier struct. - * implement.h (pthread_barrier_t_): Lost some/gained one - elements. - * private.c (ptw32_threadStart): Removed some comments. - -2001-07-10 Ross Johnson - - * barrier.c: Revamped to fix the race condition. Two alternating - semaphores are used instead of the PulseEvent. Also improved - overall throughput by returning PTHREAD_BARRIER_SERIAL_THREAD - to the first waking thread. - * implement.h (pthread_barrier_t_): Revamped. - -2001-07-09 Ross Johnson - - * barrier.c: Fix several bugs in all routines. Now passes - tests/barrier5.c which is fairly rigorous. There is still - a non-optimal work-around for a race condition between - the barrier breeched event signal and event wait. Basically - the last (signalling) thread to hit the barrier yields - to allow any other threads, which may have lost the race, - to complete. - -2001-07-07 Ross Johnson - - * barrier.c: Changed synchronisation mechanism to a - Win32 manual reset Event and use PulseEvent to signal - waiting threads. If the implementation continued to use - a semaphore it would require a second semaphore and - some management to use them alternately as barriers. A - single semaphore allows threads to cascade from one barrier - through the next, leaving some threads blocked at the first. - * implement.h (pthread_barrier_t_): As per above. - * general: Made a number of other routines inlinable. - -2001-07-07 Ross Johnson - - * spin.c: Revamped and working; included static initialiser. - Now beta level. - * barrier.c: Likewise. - * condvar.c: Macro constant change; inline auto init routine. - * mutex.c: Likewise. - * rwlock.c: Likewise. - * private.c: Add support for spinlock initialiser. - * global.c: Likewise. - * implement.h: Likewise. - * pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Fix typo. - -2001-07-05 Ross Johnson - - * barrier.c: Remove static initialisation - irrelevent - for this object. - * pthread.h (PTHREAD_BARRIER_INITIALIZER): Removed. - * rwlock.c (pthread_rwlock_wrlock): This routine is - not a cancelation point - disable deferred - cancelation around call to pthread_cond_wait(). - -2001-07-05 Ross Johnson - - * spin.c: New module implementing spin locks. - * barrier.c: New module implementing barriers. - * pthread.h (_POSIX_SPIN_LOCKS): defined. - (_POSIX_BARRIERS): Defined. - (pthread_spin_*): Defined. - (pthread_barrier*): Defined. - (PTHREAD_BARRIER_SERIAL_THREAD): Defined. - * implement.h (pthread_spinlock_t_): Defined. - (pthread_barrier_t_): Defined. - (pthread_barrierattr_t_): Defined. - - * mutex.c (pthread_mutex_lock): Return with the error - if an auto-initialiser initialisation fails. - - * nonportable.c (pthread_getprocessors_np): New; gets the - number of available processors for the current process. - -2001-07-03 Ross Johnson - - * pthread.h (_POSIX_READER_WRITER_LOCKS): Define it - if not already defined. - -2001-07-01 Alexander Terekhov - - * condvar.c: Fixed lost signal bug reported by Timur Aydin - (taydin@snet.net). - [RPJ (me) didn't translate the original algorithm - correctly.] - * semaphore.c: Added sem_post_multiple; this is a useful - routine, but it doesn't appear to be standard. For now it's - not an exported function. - -2001-06-25 Ross Johnson - - * create.c (pthread_create): Add priority inheritance - attributes. - * mutex.c (pthread_mutex_lock): Remove some overhead for - PTHREAD_MUTEX_NORMAL mutex types. Specifically, avoid - calling pthread_self() and pthread_equal() to check/set - the mutex owner. Introduce a new pseudo owner for this - type. Test results suggest increases in speed of up to - 90% for non-blocking locks. - This is the default type of mutex used internally by other - synchronising objects, ie. condition variables and - read-write locks. The test rwlock7.c shows about a - 30-35% speed increase over snapshot 2001-06-06. The - price of this is that the application developer - must ensure correct behaviour, or explicitly set the - mutex to a safer type such as PTHREAD_MUTEX_ERRORCHECK. - For example, PTHREAD_MUTEX_NORMAL (or PTHREAD_MUTEX_DEFAULT) - type mutexes will not return an error if a thread which is not - the owner calls pthread_mutex_unlock. The call will succeed - in unlocking the mutex if it is currently locked, but a - subsequent unlock by the true owner will then fail with EPERM. - This is however consistent with some other implementations. - (pthread_mutex_unlock): Likewise. - (pthread_mutex_trylock): Likewise. - (pthread_mutex_destroy): Likewise. - * attr.c (pthread_attr_init): PTHREAD_EXPLICIT_SCHED is the - default inheritance attribute; THREAD_PRIORITY_NORMAL is - the default priority for new threads. - * sched.c (pthread_attr_setschedpolicy): Added routine. - (pthread_attr_getschedpolicy): Added routine. - (pthread_attr_setinheritsched): Added routine. - (pthread_attr_getinheritsched): Added routine. - * pthread.h (sched_rr_set_interval): Added as a macro; - returns -1 with errno set to ENOSYS. - -2001-06-23 Ross Johnson - - *sched.c (pthread_attr_setschedparam): Add priority range - check. - (sched_setscheduler): New function; checks for a valid - pid and policy; checks for permission to set information - in the target process; expects pid to be a Win32 process ID, - not a process handle; the only scheduler policy allowed is - SCHED_OTHER. - (sched_getscheduler): Likewise, but checks for permission - to query. - * pthread.h (SCHED_*): Moved to sched.h as defined in the - POSIX standard. - * sched.h (SCHED_*): Moved from pthread.h. - (pid_t): Defined if necessary. - (sched_setscheduler): Defined. - (sched_getscheduler): Defined. - * pthread.def (sched_setscheduler): Exported. - (sched_getscheduler): Likewise. - -2001-06-23 Ralf Brese - - * create.c (pthread_create): Set thread priority from - thread attributes. - -2001-06-18 Ross Johnson - - * Made organisational-only changes to UWIN additions. - * dll.c (dllMain): Moved UWIN process attach code - to pthread_win32_process_attach_np(); moved - instance of pthread_count to global.c. - * global.c (pthread_count): Moved from dll.c. - * nonportable.c (pthread_win32_process_attach_np): - Moved _UWIN code to here from dll.c. - * implement.h (pthread_count): Define extern int. - * create.c (pthread_count): Remove extern int. - * private.c (pthread_count): Likewise. - * exit.c (pthread_count): Likewise. - -2001-06-18 David Korn - - * dll.c: Added changes necessary to work with UWIN. - * create.c: Likewise. - * pthread.h: Likewise. - * misc.c: Likewise. - * exit.c: Likewise. - * private.c: Likewise. - * implement.h: Likewise. - There is some room at the start of struct pthread_t_ - to implement the signal semantics in UWIN's posix.dll - although this is not yet complete. - * Nmakefile: Compatible with UWIN's Nmake utility. - * Nmakefile.tests: Likewise - for running the tests. - -2001-06-08 Ross Johnson - - * semaphore.h (sem_t): Fixed for compile and test. - * implement.h (sem_t_): Likewise. - * semaphore.c: Likewise. - * private.c (ptw32_sem_timedwait): Updated to use new - opaque sem_t. - -2001-06-06 Ross Johnson - - * semaphore.h (sem_t): Is now an opaque pointer; - moved actual definition to implement.h. - * implement.h (sem_t_): Move here from semaphore.h; - was the definition of sem_t. - * semaphore.c: Wherever necessary, changed use of sem - from that of a pointer to a pointer-pointer; added - extra checks for a valid sem_t; NULL sem_t when - it is destroyed; added extra checks when creating - and destroying sem_t elements in the NEED_SEM - code branches; changed from using a pthread_mutex_t - ((*sem)->mutex) to CRITICAL_SECTION ((*sem)->sem_lock_cs) - in NEED_SEM branches for access serialisation. - -2001-06-06 Ross Johnson - - * mutex.c (pthread_mutexattr_init): Remove - ptw32_mutex_default_kind. - -2001-06-05 Ross Johnson - - * nonportable.c (pthread_mutex_setdefaultkind_np): - Remove - should not have been included in the first place. - (pthread_mutex_getdefaultkind_np): Likewise. - * global.c (ptw32_mutex_default_kind): Likewise. - * mutex.c (pthread_mutex_init): Remove use of - ptw32_mutex_default_kind. - * pthread.h (pthread_mutex_setdefaultkind_np): Likewise. - (pthread_mutex_getdefaultkind_np): Likewise. - * pthread.def (pthread_mutexattr_setkind_np): Added. - (pthread_mutexattr_getkind_np): Likewise. - - * README: Many changes that should have gone in before - the last snapshot. - * README.NONPORTABLE: New - referred to by ANNOUNCE - but never created; documents the non-portable routines - included in the library - moved from README with new - routines added. - * ANNOUNCE (pthread_mutexattr_setkind_np): Added to - compliance list. - (pthread_mutexattr_getkind_np): Likewise. - -2001-06-04 Ross Johnson - - * condvar.c: Add original description of the algorithm as - developed by Terekhov and Thomas, plus reference to - README.CV. - -2001-06-03 Alexander Terekhov , Louis Thomas - - * condvar.c (pthread_cond_init): Completely revamped. - (pthread_cond_destroy): Likewise. - (ptw32_cond_wait_cleanup): Likewise. - (ptw32_cond_timedwait): Likewise. - (ptw32_cond_unblock): New general signaling routine. - (pthread_cond_signal): Now calls ptw32_cond_unblock. - (pthread_cond_broadcast): Likewise. - * implement.h (pthread_cond_t_): Revamped. - * README.CV: New; explanation of the above changes. - -2001-05-30 Ross Johnson - - * pthread.h (rand_r): Fake using _seed argument to quell - compiler warning (compiler should optimise this away later). - - * GNUmakefile (OPT): Leave symbolic information out of the library - and increase optimisation level - for smaller faster prebuilt - dlls. - -2001-05-29 Milan Gardian - - * Makefile: fix typo. - * pthreads.h: Fix problems with stdcall/cdecl conventions, in particular - remove the need for PT_STDCALL everywhere; remove warning supression. - * (errno): Fix the longstanding "inconsistent dll linkage" problem - with errno; now also works with /MD debugging libs - - warnings emerged when compiling pthreads library with /MD (or /MDd) - compiler switch, instead of /MT (or /MTd) (i.e. when compiling pthreads - using Multithreaded DLL CRT instead of Multithreaded statically linked - CRT). - * create.c (pthread_create): Likewise; fix typo. - * private.c (ptw32_threadStart): Eliminate use of terminate() which doesn't - throw exceptions. - * Remove unnecessary #includes from a number of modules - - [I had to #include malloc.h in implement.h for gcc - rpj]. - -2001-05-29 Thomas Pfaff - - * pthread.h (PTHREAD_MUTEX_DEFAULT): New; equivalent to - PTHREAD_MUTEX_DEFAULT_NP. - * (PTHREAD_MUTEX_NORMAL): Similarly. - * (PTHREAD_MUTEX_ERRORCHECK): Similarly. - * (PTHREAD_MUTEX_RECURSIVE): Similarly. - * (pthread_mutex_setdefaultkind_np): New; Linux compatibility stub - for pthread_mutexattr_settype. - * (pthread_mutexattr_getkind_np): New; Linux compatibility stub - for pthread_mutexattr_gettype. - * mutex.c (pthread_mutexattr_settype): New; allow - the following types of mutex: - PTHREAD_MUTEX_DEFAULT_NP - PTHREAD_MUTEX_NORMAL_NP - PTHREAD_MUTEX_ERRORCHECK_NP - PTHREAD_MUTEX_RECURSIVE_NP - * Note that PTHREAD_MUTEX_DEFAULT is equivalent to - PTHREAD_MUTEX_NORMAL - ie. mutexes should no longer - be recursive by default, and a thread will deadlock if it - tries to relock a mutex it already owns. This is inline with - other pthreads implementations. - * (pthread_mutex_lock): Process the lock request - according to the mutex type. - * (pthread_mutex_init): Eliminate use of Win32 mutexes as the - basis of POSIX mutexes - instead, a combination of one critical section - and one semaphore are used in conjunction with Win32 Interlocked* routines. - * (pthread_mutex_destroy): Likewise. - * (pthread_mutex_lock): Likewise. - * (pthread_mutex_trylock): Likewise. - * (pthread_mutex_unlock): Likewise. - * Use longjmp/setjmp to implement cancelation when building the library - using a C compiler which doesn't support exceptions, e.g. gcc -x c (note - that gcc -x c++ uses exceptions). - * Also fixed some of the same typos and eliminated PT_STDCALL as - Milan Gardian's patches above. - -2001-02-07 Alexander Terekhov - - * rwlock.c: Revamped. - * implement.h (pthread_rwlock_t_): Redefined. - This implementation does not have reader/writer starvation problem. - Rwlock attempts to behave more like a normal mutex with - races and scheduling policy determining who is more important; - It also supports recursive locking, - has less synchronization overhead (no broadcasts at all, - readers are not blocked on any condition variable) and seem to - be faster than the current implementation [W98 appears to be - approximately 15 percent faster at least - on top of speed increase - from Thomas Pfaff's changes to mutex.c - rpj]. - -2000-12-29 Ross Johnson - - * Makefile: Back-out "for" loops which don't work. - - * GNUmakefile: Remove the fake.a target; add the "realclean" - target; don't remove built libs under the "clean" target. - - * config.h: Add a guard against multiple inclusion. - - * semaphore.h: Add some defines from config.h to make - semaphore.h independent of config.h when building apps. - - * pthread.h (_errno): Back-out previous fix until we know how to - fix it properly. - - * implement.h (lockCount): Add missing element to pthread_mutex_t_. - - * sync.c (pthread_join): Spelling fix in comment. - - * private.c (ptw32_threadStart): Reset original termination - function (C++). - (ptw32_threadStart): Cleanup detached threads early in case - the library is statically linked. - (ptw32_callUserDestroyRoutines): Remove [SEH] __try block from - destructor call so that unhandled exceptions will be passed through - to the system; call terminate() from [C++] try block for the same - reason. - - * tsd.c (pthread_getspecific): Add comment. - - * mutex.c (pthread_mutex_init): Initialise new elements in - pthread_mutex_t. - (pthread_mutex_unlock): Invert "pthread_equal()" test. - -2000-12-28 Ross Johnson - - * semaphore.c (mode_t): Use ifndef HAVE_MODE_T to include definition. - - * config.h.in (HAVE_MODE_T): Added. - (_UWIN): Start adding defines for the UWIN package. - - * private.c (ptw32_threadStart): Unhandled exceptions are - now passed through to the system to deal with. This is consistent - with normal Windows behaviour. C++ applications may use - set_terminate() to override the default behaviour which is - to call ptw32_terminate(). Ptw32_terminate() cleans up some - POSIX thread stuff before calling the system default function - which calls abort(). The users termination function should conform - to standard C++ semantics which is to not return. It should - exit the thread (call pthread_exit()) or exit the application. - * private.c (ptw32_terminate): Added as the default set_terminate() - function. It calls the system default function after cleaning up - some POSIX thread stuff. - - * implement.h (ptw32_try_enter_critical_section): Move - declaration. - * global.c (ptw32_try_enter_critical_section): Moved - from dll.c. - * dll.c: Move process and thread attach/detach code into - functions in nonportable.c. - * nonportable.c (pthread_win32_process_attach_np): Process - attach code from dll.c is now available to static linked - applications. - * nonportable.c (pthread_win32_process_detach_np): Likewise. - * nonportable.c (pthread_win32_thread_attach_np): Likewise. - * nonportable.c (pthread_win32_thread_detach_np): Likewise. - - * pthread.h: Add new non-portable prototypes for static - linked applications. - - * GNUmakefile (OPT): Increase optimisation flag and remove - debug info flag. - - * pthread.def: Add new non-portable exports for static - linked applications. - -2000-12-11 Ross Johnson - - * FAQ: Update Answer 6 re getting a fully working - Mingw32 built library. - -2000-10-10 Steven Reddie - - * misc.c (pthread_self): Restore Win32 "last error" - cleared by TlsGetValue() call in - pthread_getspecific() - -2000-09-20 Arthur Kantor - - * mutex.c (pthread_mutex_lock): Record the owner - of the mutex. This requires also keeping count of - recursive locks ourselves rather than leaving it - to Win32 since we need to know when to NULL the - thread owner when the mutex is unlocked. - (pthread_mutex_trylock): Likewise. - (pthread_mutex_unlock): Check that the calling - thread owns the mutex, decrement the recursive - lock count, and NULL the owner if zero. Return - EPERM if the mutex is owned by another thread. - * implement.h (pthread_mutex_t_): Add ownerThread - and lockCount members. - -2000-09-13 Jef Gearhart - - * mutex.c (pthread_mutex_init): Call - TryEnterCriticalSection through the pointer - rather than directly so that the dll can load - on Windows versions that can't resolve the - function, eg. Windows 95 - -2000-09-09 Ross Johnson - - * pthread.h (ctime_r): Fix arg. - -2000-09-08 Ross Johnson - - * GNUmakefile(_WIN32_WINNT=0x400): Define in CFLAGS; - doesn't seem to be needed though. - - * cancel.c (pthread_cancel): Must get "self" through - calling pthread_self() which will ensure a POSIX thread - struct is built for non-POSIX threads; return an error - if this fails - - Ollie Leahy - (pthread_setcancelstate): Likewise. - (pthread_setcanceltype): Likewise. - * misc.c (ptw32_cancelable_wait): Likewise. - - * private.c (ptw32_tkAssocCreate): Remove unused #if 0 - wrapped code. - - * pthread.h (ptw32_get_exception_services_code): - Needed to be forward declared unconditionally. - -2000-09-06 Ross Johnson - - * cancel.c (pthread_cancel): If called from the main - thread "self" would be NULL; get "self" via pthread_self() - instead of directly from TLS so that an implicit - pthread object is created. - - * misc.c (pthread_equal): Strengthen test for NULLs. - -2000-09-02 Ross Johnson - - * condvar.c (ptw32_cond_wait_cleanup): Ensure that all - waking threads check if they are the last, and notify - the broadcaster if so - even if an error occurs in the - waiter. - - * semaphore.c (_decrease_semaphore): Should be - a call to ptw32_decrease_semaphore. - (_increase_semaphore): Should be a call to - ptw32_increase_semaphore. - - * misc.c (ptw32_cancelable_wait): Renamed from - CancelableWait. - * rwlock.c (_rwlock_check*): Renamed to - ptw32_rwlock_check*. - * mutex.c (_mutex_check*): Renamed to ptw32_mutex_check*. - * condvar.c (cond_timed*): Renamed to ptw32_cond_timed*. - (_cond_check*): Renamed to ptw32_cond_check*. - (cond_wait_cleanup*): Rename to ptw32_cond_wait_cleanup*. - (ptw32_cond_timedwait): Add comments. - -2000-08-22 Ross Johnson - - * private.c (ptw32_throw): Fix exception test; - move exceptionInformation declaration. - - * tsd.c (pthread_key_create): newkey wrongly declared. - - * pthread.h: Fix comment block. - -2000-08-18 Ross Johnson - - * mutex.c (pthread_mutex_destroy): Check that the mutex isn't - held; invalidate the mutex as early as possible to avoid - contention; not perfect - FIXME! - - * rwlock.c (pthread_rwlock_init): Remove redundant assignment - to "rw". - (pthread_rwlock_destroy): Invalidate the rwlock before - freeing up any of it's resources - to avoid contention. - - * private.c (ptw32_tkAssocCreate): Change assoc->lock - to use a dynamically initialised mutex - only consumes - a W32 mutex or critical section when first used, - not before. - - * mutex.c (pthread_mutex_init): Remove redundant assignment - to "mx". - (pthread_mutexattr_destroy): Set attribute to NULL - before freeing it's memory - to avoid contention. - - * implement.h (PTW32_EPS_CANCEL/PTW32_EPS_EXIT): - Must be defined for all compilers - used as generic - exception selectors by ptw32_throw(). - - * Several: Fix typos from scripted edit session - yesterday. - - * nonportable.c (pthread_mutexattr_setforcecs_np): - Moved this function from mutex.c. - (pthread_getw32threadhandle_np): New function to - return the win32 thread handle that the POSIX - thread is using. - * mutex.c (pthread_mutexattr_setforcecs_np): - Moved to new file "nonportable.c". - - * pthread.h (PTW32_BUILD): Only redefine __except - and catch compiler keywords if we aren't building - the library (ie. PTW32_BUILD is not defined) - - this is safer than defining and then undefining - if not building the library. - * implement.h: Remove __except and catch undefines. - * Makefile (CFLAGS): Define PTW32_BUILD. - * GNUmakefile (CFLAGS): Define PTW32_BUILD. - - * All appropriate: Change Pthread_exception* to - ptw32_exception* to be consistent with internal - identifier naming. - - * private.c (ptw32_throw): New function to provide - a generic exception throw for all internal - exceptions and EH schemes. - (ptw32_threadStart): pthread_exit() value is now - returned via the thread structure exitStatus - element. - * exit.c (pthread_exit): pthread_exit() value is now - returned via the thread structure exitStatus - element. - * cancel.c (ptw32_cancel_self): Now uses ptw32_throw. - (pthread_setcancelstate): Ditto. - (pthread_setcanceltype): Ditto. - (pthread_testcancel): Ditto. - (pthread_cancel): Ditto. - * misc.c (CancelableWait): Ditto. - * exit.c (pthread_exit): Ditto. - * All applicable: Change PTW32_ prefix to - PTW32_ prefix to remove leading underscores - from private library identifiers. - -2000-08-17 Ross Johnson - - * All applicable: Change _pthread_ prefix to - ptw32_ prefix to remove leading underscores - from private library identifiers (single - and double leading underscores are reserved in the - ANSI C standard for compiler implementations). - - * tsd.c (pthread_create_key): Initialise temporary - key before returning it's address to avoid race - conditions. - -2000-08-13 Ross Johnson - - * errno.c: Add _MD precompile condition; thus far - had no effect when using /MD compile option but I - thnk it should be there. - - * exit.c: Add __cplusplus to various #if lines; - was compiling SEH code even when VC++ had - C++ compile options. - - * private.c: ditto. - - * create.c (pthread_create): Add PT_STDCALL macro to - function pointer arg in _beginthread(). - - * pthread.h: PT_STDCALL really does need to be defined - in both this and impliment.h; don't set it to __cdecl - - this macro is only used to extend function pointer - casting for functions that will be passed as parameters. - (~PThreadCleanup): add cast and group expression. - (_errno): Add _MD compile conditional. - (PtW32NoCatchWarn): Change pragma message. - - * implement.h: Move and change PT_STDCALL define. - - * need_errno.h: Add _MD to compilation conditional. - - * GNUmakefile: Substantial rewrite for new naming - convention; set for nil optimisation (turn it up - when we have a working library build; add target - "fake.a" to build a libpthreadw32.a from the VC++ - built DLL pthreadVCE.dll. - - * pthread.def (LIBRARY): Don't specify in the .def - file - it is specified on the linker command line - since we now use the same .def file for variously - named .dlls. - - * Makefile: Substantial rewrite for new naming - convention; default nmake target only issues a - help message; run nmake with specific target - corresponding to the EH scheme being used. - - * README: Update information; add naming convention - explanation. - - * ANNOUNCE: Update information. - -2000-08-12 Ross Johnson - - * pthread.h: Add compile-time message when using - MSC_VER compiler and C++ EH to warn application - programmers to use PtW32Catch instead of catch(...) - if they want cancelation and pthread_exit to work. - - * implement.h: Remove #include ; we - use our own local semaphore.h. - -2000-08-10 Ross Johnson - - * cleanup.c (pthread_pop_cleanup): Remove _pthread - prefix from __except and catch keywords; implement.h - now simply undefines ptw32__except and - ptw32_catch if defined; VC++ was not textually - substituting ptw32_catch etc back to catch as - it was redefined; the reason for using the prefixed - version was to make it clear that it was not using - the pthread.h redefined catch keyword. - - * private.c (ptw32_threadStart): Ditto. - (ptw32_callUserDestroyRoutines): Ditto. - - * implement.h (ptw32__except): Remove #define. - (ptw32_catch): Remove #define. - - * GNUmakefile (pthread.a): New target to build - libpthread32.a from pthread.dll using dlltool. - - * buildlib.bat: Duplicate cl commands with args to - build C++ EH version of pthread.dll; use of .bat - files is redundant now that nmake compatible - Makefile is included; used as a kludge only now. - - * Makefile: Localise some macros and fix up the clean: - target to extend it and work properly. - - * CONTRIBUTORS: Add contributors. - - * ANNOUNCE: Updated. - - * README: Updated. - -2000-08-06 Ross Johnson - - * pthread.h: Remove #warning - VC++ doesn't accept it. - -2000-08-05 Ross Johnson - - * pthread.h (PtW32CatchAll): Add macro. When compiling - applications using VC++ with C++ EH rather than SEH - 'PtW32CatchAll' must be used in place of any 'catch( ... )' - if the application wants pthread cancelation or - pthread_exit() to work. - -2000-08-03 Ross Johnson - - * pthread.h: Add a base class ptw32_exception for - library internal exceptions and change the "catch" - re-define macro to use it. - -2000-08-02 Ross Johnson - - * GNUmakefile (CFLAGS): Add -mthreads. - Add new targets to generate cpp and asm output. - - * sync.c (pthread_join): Remove dead code. - -2000-07-25 Tristan Savatier - - * sched.c (sched_get_priority_max): Handle different WinCE and - Win32 priority values together. - (sched_get_priority_min): Ditto. - -2000-07-25 Ross Johnson - - * create.c (pthread_create): Force new threads to wait until - pthread_create has the new thread's handle; we also retain - a local copy of the handle for internal use until - pthread_create returns. - - * private.c (ptw32_threadStart): Initialise ei[]. - (ptw32_threadStart): When beginthread is used to start the - thread, force waiting until the creator thread had the - thread handle. - - * cancel.c (ptw32_cancel_thread): Include context switch - code for defined(_X86_) environments in addition to _M_IX86. - - * rwlock.c (pthread_rwlock_destroy): Assignment changed - to avoid compiler warning. - - * private.c (ptw32_get_exception_services_code): Cast - NULL return value to avoid compiler warning. - - * cleanup.c (pthread_pop_cleanup): Initialise "cleanup" variable - to avoid compiler warnings. - - * misc.c (ptw32_new): Change "new" variable to "t" to avoid - confusion with the C++ keyword of the same name. - - * condvar.c (cond_wait_cleanup): Initialise lastWaiter variable. - (cond_timedwait): Remove unused local variables. to avoid - compiler warnings. - - * dll.c (dllMain): Remove 2000-07-21 change - problem - appears to be in pthread_create(). - -2000-07-22 Ross Johnson - - * tsd.c (pthread_key_create): If a destructor was given - and the pthread_mutex_init failed, then would try to - reference a NULL pointer (*key); eliminate this section of - code by using a dynamically initialised mutex - (PTHREAD_MUTEX_INITIALIZER). - - * tsd.c (pthread_setspecific): Return an error if - unable to set the value; simplify cryptic conditional. - - * tsd.c (pthread_key_delete): Locking threadsLock relied - on mutex_lock returning an error if the key has no destructor. - ThreadsLock is only initialised if the key has a destructor. - Making this mutex a static could reduce the number of mutexes - used by an application since it is actually created only at - first use and it's often destroyed soon after. - -2000-07-22 Ross Johnson - - * FAQ: Added Q5 and Q6. - -2000-07-21 David Baggett - - * dll.c: Include resource leakage work-around. This is a - partial FIXME which doesn't stop all leakage. The real - problem needs to be found and fixed. - -2000-07-21 Ross Johnson - - * create.c (pthread_create): Set threadH to 0 (zero) - everywhere. Some assignments were using NULL. Maybe - it should be NULL everywhere - need to check. (I know - they are nearly always the same thing - but not by - definition.) - - * misc.c (pthread_self): Try to catch NULL thread handles - at the point where they might be generated, even though - they should always be valid at this point. - - * tsd.c (pthread_setspecific): return an error value if - pthread_self() returns NULL. - - * sync.c (pthread_join): return an error value if - pthread_self() returns NULL. - - * signal.c (pthread_sigmask): return an error value if - pthread_self() returns NULL. - -2000-03-02 Ross Johnson - - * attr.c (pthread_attr_init): Set default stacksize to zero (0) - rather than PTHREAD_STACK_MIN even though these are now the same. - - * pthread.h (PTHREAD_STACK_MIN): Lowered to 0. - -2000-01-28 Ross Johnson - - * mutex.c (pthread_mutex_init): Free mutex if it has been alloced; - if critical sections can be used instead of Win32 mutexes, test - that the critical section works and return an error if not. - -2000-01-07 Ross Johnson - - * cleanup.c (pthread_pop_cleanup): Include SEH code only if MSC is not - compiling as C++. - (pthread_push_cleanup): Include SEH code only if MSC is not - compiling as C++. - - * pthread.h: Include SEH code only if MSC is not - compiling as C++. - - * implement.h: Include SEH code only if MSC is not - compiling as C++. - - * cancel.c (ptw32_cancel_thread): Add _M_IX86 check. - (pthread_testcancel): Include SEH code only if MSC is not - compiling as C++. - (ptw32_cancel_self): Include SEH code only if MSC is not - compiling as C++. - -2000-01-06 Erik Hensema - - * Makefile: Remove inconsistencies in 'cl' args - -2000-01-04 Ross Johnson - - * private.c (ptw32_get_exception_services_code): New; returns - value of EXCEPTION_PTW32_SERVICES. - (ptw32_processInitialize): Remove initialisation of - ptw32_exception_services which is no longer needed. - - * pthread.h (ptw32_exception_services): Remove extern. - (ptw32_get_exception_services_code): Add function prototype; - use this to return EXCEPTION_PTW32_SERVICES value instead of - using the ptw32_exception_services variable which I had - trouble exporting through pthread.def. - - * global.c (ptw32_exception_services): Remove declaration. - -1999-11-22 Ross Johnson - - * implement.h: Forward declare ptw32_new(); - - * misc.c (ptw32_new): New; alloc and initialise a new pthread_t. - (pthread_self): New thread struct is generated by new routine - ptw32_new(). - - * create.c (pthread_create): New thread struct is generated - by new routine ptw32_new(). - -1999-11-21 Ross Johnson - - * global.c (ptw32_exception_services): Declare new variable. - - * private.c (ptw32_threadStart): Destroy thread's - cancelLock mutex; make 'catch' and '__except' usageimmune to - redfinitions in pthread.h. - (ptw32_processInitialize): Init new constant ptw32_exception_services. - - * create.c (pthread_create): Initialise thread's cancelLock - mutex. - - * cleanup.c (pthread_pop_cleanup): Make 'catch' and '__except' - usage immune to redfinition s in pthread.h. - - * private.c: Ditto. - - * pthread.h (catch): Redefine 'catch' so that C++ applications - won't catch our internal exceptions. - (__except): ditto for __except. - - * implement.h (ptw32_catch): Define internal version - of 'catch' because 'catch' is redefined by pthread.h. - (__except): ditto for __except. - (struct pthread_t_): Add cancelLock mutex for async cancel - safety. - -1999-11-21 Jason Nye , Erik Hensema - - * cancel.c (ptw32_cancel_self): New; part of the async - cancellation implementation. - (ptw32_cancel_thread): Ditto; this function is X86 - processor specific. - (pthread_setcancelstate): Add check for pending async - cancel request and cancel the calling thread if - required; add async-cancel safety lock. - (pthread_setcanceltype): Ditto. - -1999-11-13 Erik Hensema - - * configure.in (AC_OUTPUT): Put generated output into GNUmakefile - rather than Makefile. Makefile will become the MSC nmake compatible - version - -1999-11-13 John Bossom (John.Bossom@cognos.com> - - * misc.c (pthread_self): Add a note about GetCurrentThread - returning a pseudo-handle - -1999-11-10 Todd Owen - - * dll.c (dllMain): Free kernel32 ASAP. - If TryEnterCriticalSection is not being used, then free - the kernel32.dll handle now, rather than leaving it until - DLL_PROCESS_DETACH. - - Note: this is not a pedantic exercise in freeing unused - resources! It is a work-around for a bug in Windows 95 - (see microsoft knowledge base article, Q187684) which - does Bad Things when FreeLibrary is called within - the DLL_PROCESS_DETACH code, in certain situations. - Since w95 just happens to be a platform which does not - provide TryEnterCriticalSection, the bug will be - effortlessly avoided. - -1999-11-10 Ross Johnson - - * sync.c (pthread_join): Make it a deferred cancelation point. - - * misc.c (pthread_self): Explicitly initialise implicitly - created thread state to default values. - -1999-11-05 Tristan Savatier - - * pthread.h (winsock.h): Include unconditionally. - (ETIMEDOUT): Change fallback value to that defined by winsock.h. - - * general: Patched for portability to WinCE. The details are - described in the file WinCE-PORT. Follow the instructions - in README.WinCE to make the appropriate changes in config.h. - -1999-10-30 Erik Hensema - - * create.c (pthread_create): Explicitly initialise thread state to - default values. - - * cancel.c (pthread_setcancelstate): Check for NULL 'oldstate' - for compatibility with Solaris pthreads; - (pthread_setcanceltype): ditto: - -1999-10-23 Erik Hensema - - * pthread.h (ctime_r): Fix incorrect argument "_tm" - -1999-10-21 Aurelio Medina - - * pthread.h (_POSIX_THREADS): Only define it if it isn't - already defined. Projects may need to define this on - the CC command line under Win32 as it doesn't have unistd.h - -1999-10-17 Ross Johnson - - * rwlock.c (pthread_rwlock_destroy): Add cast to remove compile - warning. - - * condvar.c (pthread_cond_broadcast): Only release semaphores - if there are waiting threads. - -1999-10-15 Lorin Hochstein , Peter Slacik - - * condvar.c (cond_wait_cleanup): New static cleanup handler for - cond_timedwait; - (cond_timedwait): pthread_cleanup_push args changed; - canceling a thread while it's in pthread_cond_wait - will now decrement the waiters count and cleanup if it's the - last waiter. - -1999-10-15 Graham Dumpleton - - * condvar.c (cond_wait_cleanup): the last waiter will now reset the CV's - wasBroadcast flag - -Thu Sep 16 1999 Ross Johnson - - * rwlock.c (pthread_rwlock_destroy): Add serialisation. - (_rwlock_check_need_init): Check for detroyed rwlock. - * rwlock.c: Check return codes from _rwlock_check_need_init(); - modify comments; serialise access to rwlock objects during - operations; rename rw_mutex to rw_lock. - * implement.h: Rename rw_mutex to rw_lock. - * mutex.c (pthread_mutex_destroy): Add serialisation. - (_mutex_check_need_init): Check for detroyed mutex. - * condvar.c (pthread_cond_destroy): Add serialisation. - (_cond_check_need_init): Check for detroyed condvar. - * mutex.c: Modify comments. - * condvar.c: Modify comments. - -1999-08-10 Aurelio Medina - - * implement.h (pthread_rwlock_t_): Add. - * pthread.h (pthread_rwlock_t): Add. - (PTHREAD_RWLOCK_INITIALIZER): Add. - Add rwlock function prototypes. - * rwlock.c: New module. - * pthread.def: Add new rwlock functions. - * private.c (ptw32_processInitialize): initialise - ptw32_rwlock_test_init_lock critical section. - * global.c (ptw32_rwlock_test_init_lock): Add. - - * mutex.c (pthread_mutex_destroy): Don't free mutex memory - if mutex is PTHREAD_MUTEX_INITIALIZER and has not been - initialised yet. - -1999-08-08 Milan Gardian - - * mutex.c (pthread_mutex_destroy): Free mutex memory. - -1999-08-22 Ross Johnson - - * exit.c (pthread_exit): Fix reference to potentially - uninitialised pointer. - -1999-08-21 Ross Johnson - - * private.c (ptw32_threadStart): Apply fix of 1999-08-19 - this time to C++ and non-trapped C versions. Ommitted to - do this the first time through. - -1999-08-19 Ross Johnson - - * private.c (ptw32_threadStart): Return exit status from - the application thread startup routine. - - Milan Gardian - -1999-08-18 John Bossom - - * exit.c (pthread_exit): Put status into pthread_t->exitStatus - * private.c (ptw32_threadStart): Set pthread->exitStatus - on exit of try{} block. - * sync.c (pthread_join): use pthread_exitStatus value if the - thread exit doesn't return a value (for Mingw32 CRTDLL - which uses endthread instead of _endthreadex). - -Tue Aug 17 20:17:58 CDT 1999 Mumit Khan - - * create.c (pthread_create): Add CRTDLL suppport. - * exit.c (pthread_exit): Likewise. - * private.c (ptw32_threadStart): Likewise. - (ptw32_threadDestroy): Likewise. - * sync.c (pthread_join): Likewise. - * tests/join1.c (main): Warn about partial support for CRTDLL. - -Tue Aug 17 20:00:08 1999 Mumit Khan - - * Makefile.in (LD): Delete entry point. - * acconfig.h (STDCALL): Delete unused macro. - * configure.in: Remove test for STDCALL. - * config.h.in: Regenerate. - * errno.c (_errno): Fix self type. - * pthread.h (PT_STDCALL): Move from here to - * implement.h (PT_STDCALL): here. - (ptw32_threadStart): Fix prototype. - * private.c (ptw32_threadStart): Likewise. - -1999-08-14 Ross Johnson - - * exit.c (pthread_exit): Don't call pthread_self() but - get thread handle directly from TSD for efficiency. - -1999-08-12 Ross Johnson - - * private.c (ptw32_threadStart): ei[] only declared if _MSC_VER. - - * exit.c (pthread_exit): Check for implicitly created threads - to avoid raising an unhandled exception. - -1999-07-12 Peter Slacik - - * condvar.c (pthread_cond_destroy): Add critical section. - (cond_timedwait): Add critical section; check for timeout - waiting on semaphore. - (pthread_cond_broadcast): Add critical section. - -1999-07-09 Lorin Hochstein , John Bossom - - The problem was that cleanup handlers were not executed when - pthread_exit() was called. - - * implement.h (pthread_t_): Add exceptionInformation element for - C++ per-thread exception information. - (general): Define and rename exceptions. - -1999-07-09 Ross Johnson - - * misc.c (CancelableWait): PTW32_EPS_CANCEL (SEH) and - ptw32_exception_cancel (C++) used to identify the exception. - - * cancel.c (pthread_testcancel): PTW32_EPS_CANCEL (SEH) and - ptw32_exception_cancel (C++) used to identify the exception. - - * exit.c (pthread_exit): throw/raise an exception to return to - ptw32_threadStart() to exit the thread. PTW32_EPS_EXIT (SEH) - and ptw32_exception_exit (C++) used to identify the exception. - - * private.c (ptw32_threadStart): Add pthread_exit exception trap; - clean up and exit the thread directly rather than via pthread_exit(). - -Sun May 30 00:25:02 1999 Ross Johnson - - * semaphore.h (mode_t): Conditionally typedef it. - -Fri May 28 13:33:05 1999 Mark E. Armstrong - - * condvar.c (pthread_cond_broadcast): Fix possible memory fault - -Thu May 27 13:08:46 1999 Peter Slacik - - * condvar.c (pthread_cond_broadcast): Fix logic bug - -Thu May 27 13:08:46 1999 Bossom, John - - * condvar.c (pthread_cond_broadcast): optimise sem_post loop - -Fri May 14 12:13:18 1999 Mike Russo - - * attr.c (pthread_attr_setdetachstate): Fix logic bug - -Sat May 8 09:42:30 1999 Ross Johnson - - * pthread.def (sem_open): Add. - (sem_close): Add. - (sem_unlink): Add. - (sem_getvalue): Add. - - * FAQ (Question 3): Add. - -Thu Apr 8 01:16:23 1999 Ross Johnson - - * semaphore.c (sem_open): New function; returns an error (ENOSYS). - (sem_close): ditto. - (sem_unlink): ditto. - (sem_getvalue): ditto. - - * semaphore.h (_POSIX_SEMAPHORES): define. - -Wed Apr 7 14:09:52 1999 Ross Johnson - - * errno.c (_REENTRANT || _MT): Invert condition. - - * pthread.h (_errno): Conditionally include prototype. - -Wed Apr 7 09:37:00 1999 Ross Johnson - - * *.c (comments): Remove individual attributions - these are - documented sufficiently elsewhere. - - * implement.h (pthread.h): Remove extraneous include. - -Sun Apr 4 11:05:57 1999 Ross Johnson - - * sched.c (sched.h): Include. - - * sched.h: New file for POSIX 1b scheduling. - - * pthread.h: Move opaque structures to implement.h; move sched_* - prototypes out and into sched.h. - - * implement.h: Add opaque structures from pthread.h. - - * sched.c (sched_yield): New function. - - * condvar.c (ptw32_sem_*): Rename to sem_*; except for - ptw32_sem_timedwait which is an private function. - -Sat Apr 3 23:28:00 1999 Ross Johnson - - * Makefile.in (OBJS): Add errno.o. - -Fri Apr 2 11:08:50 1999 Ross Johnson - - * implement.h (ptw32_sem_*): Remove prototypes now defined in - semaphore.h. - - * pthread.h (sempahore.h): Include. - - * semaphore.h: New file for POSIX 1b semaphores. - - * semaphore.c (ptw32_sem_timedwait): Moved to private.c. - - * pthread.h (ptw32_sem_t): Change to sem_t. - - * private.c (ptw32_sem_timedwait): Moved from semaphore.c; - set errno on error. - - * pthread.h (pthread_t_): Add per-thread errno element. - -Fri Apr 2 11:08:50 1999 John Bossom - - * semaphore.c (ptw32_sem_*): Change to sem_*; these functions - will be exported from the library; set errno on error. - - * errno.c (_errno): New file. New function. - -Fri Mar 26 14:11:45 1999 Tor Lillqvist - - * semaphore.c (ptw32_sem_timedwait): Check for negative - milliseconds. - -Wed Mar 24 11:32:07 1999 John Bossom - - * misc.c (CancelableWait): Initialise exceptionInformation[2]. - (pthread_self): Get a real Win32 thread handle for implicit threads. - - * cancel.c (pthread_testcancel): Initialise exceptionInformation[2]. - - * implement.h (SE_INFORMATION): Fix values. - - * private.c (ptw32_threadDestroy): Close the thread handle. - -Fri Mar 19 12:57:27 1999 Ross Johnson - - * cancel.c (comments): Update and cleanup. - -Fri Mar 19 09:12:59 1999 Ross Johnson - - * private.c (ptw32_threadStart): status returns PTHREAD_CANCELED. - - * pthread.h (PTHREAD_CANCELED): defined. - -Tue Mar 16 1999 Ross Johnson - - * all: Add GNU LGPL and Copyright and Warranty. - -Mon Mar 15 00:20:13 1999 Ross Johnson - - * condvar.c (pthread_cond_init): fix possible uninitialised use - of cv. - -Sun Mar 14 21:01:59 1999 Ross Johnson - - * condvar.c (pthread_cond_destroy): don't do full cleanup if - static initialised cv has never been used. - (cond_timedwait): check result of auto-initialisation. - -Thu Mar 11 09:01:48 1999 Ross Johnson - - * pthread.h (pthread_mutex_t): revert to (pthread_mutex_t *); - define a value to serve as PTHREAD_MUTEX_INITIALIZER. - (pthread_mutex_t_): remove staticinit and valid elements. - (pthread_cond_t): revert to (pthread_cond_t_ *); - define a value to serve as PTHREAD_COND_INITIALIZER. - (pthread_cond_t_): remove staticinit and valid elements. - - * mutex.c (pthread_mutex_t args): adjust indirection of references. - (all functions): check for PTHREAD_MUTEX_INITIALIZER value; - check for NULL (invalid). - - * condvar.c (pthread_cond_t args): adjust indirection of references. - (all functions): check for PTHREAD_COND_INITIALIZER value; - check for NULL (invalid). - -Wed Mar 10 17:18:12 1999 Ross Johnson - - * misc.c (CancelableWait): Undo changes from Mar 8 and 7. - -Mon Mar 8 11:18:59 1999 Ross Johnson - - * misc.c (CancelableWait): Ensure cancelEvent handle is the lowest - indexed element in the handles array. Enhance test for abandoned - objects. - - * pthread.h (PTHREAD_MUTEX_INITIALIZER): Trailing elements not - initialised are set to zero by the compiler. This avoids the - problem of initialising the opaque critical section element in it. - (PTHREAD_COND_INITIALIZER): Ditto. - - * semaphore.c (ptw32_sem_timedwait): Check sem == NULL earlier. - -Sun Mar 7 12:31:14 1999 Ross Johnson - - * condvar.c (pthread_cond_init): set semaphore initial value - to 0, not 1. cond_timedwait was returning signaled immediately. - - * misc.c (CancelableWait): Place the cancel event handle first - in the handle table for WaitForMultipleObjects. This ensures that - the cancel event is recognised and acted apon if both objects - happen to be signaled together. - - * private.c (ptw32_cond_test_init_lock): Initialise and destroy. - - * implement.h (ptw32_cond_test_init_lock): Add extern. - - * global.c (ptw32_cond_test_init_lock): Add declaration. - - * condvar.c (pthread_cond_destroy): check for valid initialised CV; - flag destroyed CVs as invalid. - (pthread_cond_init): pthread_cond_t is no longer just a pointer. - This is because PTHREAD_COND_INITIALIZER needs state info to reside - in pthread_cond_t so that it can initialise on first use. Will work on - making pthread_cond_t (and other objects like it) opaque again, if - possible, later. - (cond_timedwait): add check for statically initialisation of - CV; initialise on first use. - (pthread_cond_signal): check for valid CV. - (pthread_cond_broadcast): check for valid CV. - (_cond_check_need_init): Add. - - * pthread.h (PTHREAD_COND_INITIALIZER): Fix. - (pthread_cond_t): no longer a pointer to pthread_cond_t_. - (pthread_cond_t_): add 'staticinit' and 'valid' elements. - -Sat Mar 6 1999 Ross Johnson - - * implement.h: Undate comments. - -Sun Feb 21 1999 Ross Johnson - - * pthread.h (PTHREAD_MUTEX_INITIALIZER): missing braces around - cs element initialiser. - -1999-02-21 Ben Elliston - - * pthread.h (pthread_exit): The return type of this function is - void, not int. - - * exit.c (pthread_exit): Do not return 0. - -Sat Feb 20 16:03:30 1999 Ross Johnson - - * dll.c (DLLMain): Expand TryEnterCriticalSection support test. - - * mutex.c (pthread_mutex_trylock): The check for - ptw32_try_enter_critical_section == NULL should have been - removed long ago. - -Fri Feb 19 16:03:30 1999 Ross Johnson - - * sync.c (pthread_join): Fix pthread_equal() test. - - * mutex.c (pthread_mutex_trylock): Check mutex != NULL before - using it. - -Thu Feb 18 16:17:30 1999 Ross Johnson - - * misc.c (pthread_equal): Fix inverted result. - - * Makefile.in: Use libpthread32.a as the name of the DLL export - library instead of pthread.lib. - - * condvar.c (pthread_cond_init): cv could have been used unitialised; - initialise. - - * create.c (pthread_create): parms could have been used unitialised; - initialise. - - * pthread.h (struct pthread_once_t_): Remove redefinition. - -Sat Feb 13 03:03:30 1999 Ross Johnson - - * pthread.h (struct pthread_once_t_): Replaced. - - * misc.c (pthread_once): Replace with John Bossom's version; - has lighter weight serialisation; fixes problem of not holding - competing threads until after the init_routine completes. - -Thu Feb 11 13:34:14 1999 Ross Johnson - - * misc.c (CancelableWait): Change C++ exception throw. - - * sync.c (pthread_join): Change FIXME comment - issue resolved. - -Wed Feb 10 12:49:11 1999 Ross Johnson - - * configure: Various temporary changes. - - Kevin Ruland - - * README: Update. - - * pthread.def (pthread_attr_getstackaddr): uncomment - (pthread_attr_setstackaddr): uncomment - -Fri Feb 5 13:42:30 1999 Ross Johnson - - * semaphore.c: Comment format changes. - -Thu Feb 4 10:07:28 1999 Ross Johnson - - * global.c: Remove ptw32_exception instantiation. - - * cancel.c (pthread_testcancel): Change C++ exception throw. - - * implement.h: Remove extern declaration. - -Wed Feb 3 13:04:44 1999 Ross Johnson - - * cleanup.c: Rename ptw32_*_cleanup() to pthread_*_cleanup(). - - * pthread.def: Ditto. - - * pthread.h: Ditto. - - * pthread.def (pthread_cleanup_push): Remove from export list; - the function is defined as a macro under all compilers. - (pthread_cleanup_pop): Ditto. - - * pthread.h: Remove #if defined(). - -Wed Feb 3 10:13:48 1999 Ross Johnson - - * sync.c (pthread_join): Check for NULL value_ptr arg; - check for detached threads. - -Tue Feb 2 18:07:43 1999 Ross Johnson - - * implement.h: Add #include . - Change sem_t to ptw32_sem_t. - -Tue Feb 2 18:07:43 1999 Kevin Ruland - - * signal.c (pthread_sigmask): Add and modify casts. - Reverse LHS/RHS bitwise assignments. - - * pthread.h: Remove #include . - (PTW32_ATTR_VALID): Add cast. - (struct pthread_t_): Add sigmask element. - - * dll.c: Add "extern C" for DLLMain. - (DllMain): Add cast. - - * create.c (pthread_create): Set sigmask in thread. - - * condvar.c: Remove #include. Change sem_* to ptw32_sem_*. - - * attr.c: Changed #include. - - * Makefile.in: Additional targets and changes to build the library - as a DLL. - -Fri Jan 29 11:56:28 1999 Ross Johnson - - * Makefile.in (OBJS): Add semaphore.o to list. - - * semaphore.c (ptw32_sem_timedwait): Move from private.c. - Rename sem_* to ptw32_sem_*. - - * pthread.h (pthread_cond_t): Change type of sem_t. - _POSIX_SEMAPHORES no longer defined. - - * semaphore.h: Contents moved to implement.h. - Removed from source tree. - - * implement.h: Add semaphore function prototypes and rename all - functions to prepend 'ptw32_'. They are - now private to the pthreads-win32 implementation. - - * private.c: Change #warning. - Move ptw32_sem_timedwait() to semaphore.c. - - * cleanup.c: Change #warning. - - * misc.c: Remove #include - - * pthread.def: Cleanup CVS merge conflicts. - - * global.c: Ditto. - - * ChangeLog: Ditto. - - * cleanup.c: Ditto. - -Sun Jan 24 01:34:52 1999 Ross Johnson - - * semaphore.c (sem_wait): Remove second arg to - pthreadCancelableWait() call. - -Sat Jan 23 17:36:40 1999 Ross Johnson - - * pthread.def: Add new functions to export list. - - * pthread.h (PTHREAD_MUTEX_AUTO_CS_NP): New. - (PTHREAD_MUTEX_FORCE_CS_NP): New. - - * README: Updated. - -Fri Jan 22 14:31:59 1999 Ross Johnson - - * Makefile.in (CFLAGS): Remove -fhandle-exceptions. Not needed - with egcs. Add -g for debugging. - - * create.c (pthread_create): Replace __stdcall with PT_STDCALL - macro. This is a hack and must be fixed. - - * misc.c (CancelableWait): Remove redundant statement. - - * mutex.c (pthread_mutexattr_init): Cast calloc return value. - - * misc.c (CancelableWait): Add cast. - (pthread_self): Add cast. - - * exit.c (pthread_exit): Add cast. - - * condvar.c (pthread_condattr_init): Cast calloc return value. - - * cleanup.c: Reorganise conditional compilation. - - * attr.c (pthread_attr_init): Remove unused 'result'. - Cast malloc return value. - - * private.c (ptw32_callUserDestroyRoutines): Redo conditional - compilation. - - * misc.c (CancelableWait): C++ version uses 'throw'. - - * cancel.c (pthread_testcancel): Ditto. - - * implement.h (class ptw32_exception): Define for C++. - - * pthread.h: Fix C, C++, and Win32 SEH condition compilation - mayhem around pthread_cleanup_* defines. C++ version now uses John - Bossom's cleanup handlers. - (pthread_attr_t): Make 'valid' unsigned. - Define '_timeb' as 'timeb' for Ming32. - Define PT_STDCALL as nothing for Mingw32. May be temporary. - - * cancel.c (pthread_testcancel): Cast return value. - -Wed Jan 20 09:31:28 1999 Ross Johnson - - * pthread.h (pthread_mutexattr_t): Changed to a pointer. - - * mutex.c (pthread_mutex_init): Conditionally create Win32 mutex - - from John Bossom's implementation. - (pthread_mutex_destroy): Conditionally close Win32 mutex - - from John Bossom's implementation. - (pthread_mutexattr_init): Replaced by John Bossom's version. - (pthread_mutexattr_destroy): Ditto. - (pthread_mutexattr_getpshared): New function from John Bossom's - implementation. - (pthread_mutexattr_setpshared): New function from John Bossom's - implementation. - -Tue Jan 19 18:27:42 1999 Ross Johnson - - * pthread.h (pthreadCancelableTimedWait): New prototype. - (pthreadCancelableWait): Remove second argument. - - * misc.c (CancelableWait): New static function is - pthreadCancelableWait() renamed. - (pthreadCancelableWait): Now just calls CancelableWait() with - INFINITE timeout. - (pthreadCancelableTimedWait): Just calls CancelableWait() - with passed in timeout. - -Tue Jan 19 18:27:42 1999 Scott Lightner - - * private.c (ptw32_sem_timedwait): 'abstime' arg really is - absolute time. Calculate relative time to wait from current - time before passing timeout to new routine - pthreadCancelableTimedWait(). - -Tue Jan 19 10:27:39 1999 Ross Johnson - - * pthread.h (pthread_mutexattr_setforcecs_np): New prototype. - - * mutex.c (pthread_mutexattr_init): Init 'pshared' and 'forcecs' - attributes to 0. - (pthread_mutexattr_setforcecs_np): New function (not portable). - - * pthread.h (pthread_mutex_t): - Add 'mutex' element. Set to NULL in PTHREAD_MUTEX_INITIALIZER. - The pthread_mutex_*() routines will try to optimise performance - by choosing either mutexes or critical sections as the basis - for pthread mutexes for each indevidual mutex. - (pthread_mutexattr_t_): Add 'forcecs' element. - Some applications may choose to force use of critical sections - if they know that:- - the mutex is PROCESS_PRIVATE and, - either the OS supports TryEnterCriticalSection() or - pthread_mutex_trylock() will never be called on the mutex. - This attribute will be setable via a non-portable routine. - - Note: We don't yet support PROCESS_SHARED mutexes, so the - implementation as it stands will default to Win32 mutexes only if - the OS doesn't support TryEnterCriticalSection. On Win9x, and early - versions of NT 'forcecs' will need to be set in order to get - critical section based mutexes. - -Sun Jan 17 12:01:26 1999 Ross Johnson - - * pthread.h (PTHREAD_MUTEX_INITIALIZER): Init new 'staticinit' - value to '1' and existing 'valid' value to '1'. - - * global.c (ptw32_mutex_test_init_lock): Add. - - * implement.h (ptw32_mutex_test_init_lock.): Add extern. - - * private.c (ptw32_processInitialize): Init critical section for - global lock used by _mutex_check_need_init(). - (ptw32_processTerminate): Ditto (:s/Init/Destroy/). - - * dll.c (dllMain): Move call to FreeLibrary() so that it is only - called once when the process detaches. - - * mutex.c (_mutex_check_need_init): New static function to test - and init PTHREAD_MUTEX_INITIALIZER mutexes. Provides serialised - access to the internal state of the uninitialised static mutex. - Called from pthread_mutex_trylock() and pthread_mutex_lock() which - do a quick unguarded test to check if _mutex_check_need_init() - needs to be called. This is safe as the test is conservative - and is repeated inside the guarded section of - _mutex_check_need_init(). Thus in all calls except the first - calls to lock static mutexes, the additional overhead to lock any - mutex is a single memory fetch and test for zero. - - * pthread.h (pthread_mutex_t_): Add 'staticinit' member. Mutexes - initialised by PTHREAD_MUTEX_INITIALIZER aren't really initialised - until the first attempt to lock it. Using the 'valid' - flag (which flags the mutex as destroyed or not) to record this - information would be messy. It is possible for a statically - initialised mutex such as this to be destroyed before ever being - used. - - * mutex.c (pthread_mutex_trylock): Call _mutex_check_need_init() - to test/init PTHREAD_MUTEX_INITIALIZER mutexes. - (pthread_mutex_lock): Ditto. - (pthread_mutex_unlock): Add check to ensure we don't try to unlock - an unitialised static mutex. - (pthread_mutex_destroy): Add check to ensure we don't try to delete - a critical section that we never created. Allows us to destroy - a static mutex that has never been locked (and hence initialised). - (pthread_mutex_init): Set 'staticinit' flag to 0 for the new mutex. - -Sun Jan 17 12:01:26 1999 Ross Johnson - - * private.c (ptw32_sem_timedwait): Move from semaphore.c. - - * semaphore.c : Remove redundant #includes. - (ptw32_sem_timedwait): Move to private.c. - (sem_wait): Add missing abstime arg to pthreadCancelableWait() call. - -Fri Jan 15 23:38:05 1999 Ross Johnson - - * condvar.c (cond_timedwait): Remove comment. - -Fri Jan 15 15:41:28 1999 Ross Johnson - - * pthread.h: Add new 'abstime' arg to pthreadCancelableWait() - prototype. - - * condvar.c (cond_timedwait): New generalised function called by - both pthread_cond_wait() and pthread_cond_timedwait(). This is - essentially pthread_cond_wait() renamed and modified to add the - 'abstime' arg and call the new ptw32_sem_timedwait() instead of - sem_wait(). - (pthread_cond_wait): Now just calls the internal static - function cond_timedwait() with an INFINITE wait. - (pthread_cond_timedwait): Now implemented. Calls the internal - static function cond_timedwait(). - - * implement.h (ptw32_sem_timedwait): New internal function - prototype. - - * misc.c (pthreadCancelableWait): Added new 'abstime' argument - to allow shorter than INFINITE wait. - - * semaphore.c (ptw32_sem_timedwait): New function for internal - use. This is essentially sem_wait() modified to add the - 'abstime' arg and call the modified (see above) - pthreadCancelableWait(). - -Thu Jan 14 14:27:13 1999 Ross Johnson - - * cleanup.c: Correct _cplusplus to __cplusplus wherever used. - - * Makefile.in: Add CC=g++ and add -fhandle-exceptions to CFLAGS. - The derived Makefile will compile all units of the package as C++ - so that those which include try/catch exception handling should work - properly. The package should compile ok if CC=gcc, however, exception - handling will not be included and thus thread cancellation, for - example, will not work. - - * cleanup.c (ptw32_pop_cleanup): Add #warning to compile this - file as C++ if using a cygwin32 environment. Perhaps the whole package - should be compiled using g++ under cygwin. - - * private.c (ptw32_threadStart): Change #error directive - into #warning and bracket for __CYGWIN__ and derivative compilers. - -Wed Jan 13 09:34:52 1999 Ross Johnson - - * build.bat: Delete old binaries before compiling/linking. - -Tue Jan 12 09:58:38 1999 Tor Lillqvist - - * dll.c: The Microsoft compiler pragmas probably are more - appropriately protected by _MSC_VER than by _WIN32. - - * pthread.h: Define ETIMEDOUT. This should be returned by - pthread_cond_timedwait which is not implemented yet as of - snapshot-1999-01-04-1305. It was implemented in the older version. - The Microsoft compiler pragmas probably are more appropriately - protected by _MSC_VER than by _WIN32. - - * pthread.def: pthread_mutex_destroy was missing from the def file - - * condvar.c (pthread_cond_broadcast): Ensure we only wait on threads - if there were any waiting on the condition. - I think pthread_cond_broadcast should do the WaitForSingleObject - only if cv->waiters > 0? Otherwise it seems to hang, at least in the - testg thread program from glib. - -Tue Jan 12 09:58:38 1999 Ross Johnson - - * condvar.c (pthread_cond_timedwait): Fix function description - comments. - - * semaphore.c (sem_post): Correct typo in comment. - -Mon Jan 11 20:33:19 1999 Ross Johnson - - * pthread.h: Re-arrange conditional compile of pthread_cleanup-* - macros. - - * cleanup.c (ptw32_push_cleanup): Provide conditional - compile of cleanup->prev. - -1999-01-11 Tor Lillqvist - - * condvar.c (pthread_cond_init): Invert logic when testing the - return value from calloc(). - -Sat Jan 9 14:32:08 1999 Ross Johnson - - * implement.h: Compile-time switch for CYGWIN derived environments - to use CreateThread instead of _beginthreadex. Ditto for ExitThread. - Patch provided by Anders Norlander . - -Tue Jan 5 16:33:04 1999 Ross Johnson - - * cleanup.c (ptw32_pop_cleanup): Add C++ version of __try/__except - block. Move trailing "}" out of #ifdef _WIN32 block left there by - (rpj's) mistake. - - * private.c: Remove #include which is included by pthread.h. - -1998-12-11 Ben Elliston - - * README: Update info about subscribing to the mailing list. - -Mon Jan 4 11:23:40 1999 Ross Johnson - - * all: No code changes, just cleanup. - - remove #if 0 /* Pre Bossom */ enclosed code. - - Remove some redundant #includes. - * pthread.h: Update implemented/unimplemented routines list. - * Tag the bossom merge branch getting ready to merge back to main - trunk. - -Tue Dec 29 13:11:16 1998 Ross Johnson - - * implement.h: Move the following struct definitions to pthread.h: - pthread_t_, pthread_attr_t_, pthread_mutex_t_, pthread_mutex_t_, - pthread_mutexattr_t_, pthread_key_t_, pthread_cond_t_, - pthread_condattr_t_, pthread_once_t_. - - * pthread.h: Add "_" prefix to pthread_push_cleanup and - pthread_pop_cleanup internal routines, and associated struct and - typedefs. - - * buildlib.bat: Add compile command for semaphore.c - - * pthread.def: Comment out pthread_atfork routine name. - Now unimplemented. - - * tsd.c (pthread_setspecific): Rename tkAssocCreate to - ptw32_tkAssocCreate. - (pthread_key_delete): Rename tkAssocDestroy to - ptw32_tkAssocDestroy. - - * sync.c (pthread_join): Rename threadDestroy to ptw32_threadDestroy - - * sched.c (is_attr): attr is now **attr (was *attr), so add extra - NULL pointer test. - (pthread_attr_setschedparam): Increase redirection for attr which is - now a **. - (pthread_attr_getschedparam): Ditto. - (pthread_setschedparam): Change thread validation and rename "thread" - Win32 thread Handle element name to match John Bossom's version. - (pthread_getschedparam): Ditto. - - * private.c (ptw32_threadDestroy): Rename call to - callUserDestroyRoutines() as ptw32_callUserDestroyRoutines() - - * misc.c: Add #include "implement.h". - - * dll.c: Remove defined(KLUDGE) wrapped code. - - * fork.c: Remove redefinition of ENOMEM. - Remove pthread_atfork() and fork() with #if 0/#endif. - - * create.c (pthread_create): Rename threadStart and threadDestroy calls - to ptw32_threadStart and ptw32_threadDestroy. - - * implement.h: Rename "detachedstate" to "detachstate". - - * attr.c: Rename "detachedstate" to "detachstate". - -Mon Dec 28 09:54:39 1998 John Bossom - - * semaphore.c: Initial version. - * semaphore.h: Initial version. - -Mon Dec 28 09:54:39 1998 Ross Johnson - - * pthread.h (pthread_attr_t_): Change to *pthread_attr_t. - -Mon Dec 28 09:54:39 1998 John Bossom, Ben Elliston - - * attr.c (pthread_attr_setstacksize): Merge with John's version. - (pthread_attr_getstacksize): Merge with John's version. - (pthread_attr_setstackaddr): Merge with John's version. - (pthread_attr_getstackaddr): Merge with John's version. - (pthread_attr_init): Merge with John's version. - (pthread_attr_destroy): Merge with John's version. - (pthread_attr_getdetachstate): Merge with John's version. - (pthread_attr_setdetachstate): Merge with John's version. - (is_attr): attr is now **attr (was *attr), so add extra NULL pointer - test. - -Mon Dec 28 09:54:39 1998 Ross Johnson - - * implement.h (pthread_attr_t_): Add and rename elements in JEB's - version to correspond to original, so that it can be used with - original attr routines. - - * pthread.h: Add #endif at end which was truncated in merging. - -Sun Dec 20 14:51:58 1998 Ross Johnson - - * misc.c (pthreadCancelableWait): New function by John Bossom. Non-standard - but provides a hook that can be used to implement cancellation points in - applications that use this library. - - * pthread.h (pthread_cleanup_pop): C++ (non-WIN32) version uses - try/catch to emulate John Bossom's WIN32 __try/__finally behaviour. - In the WIN32 version __finally block, add a test for AbnormalTermination otherwise - cleanup is only run if the cleanup_pop execute arg is non-zero. Cancellation - should cause the cleanup to run irrespective of the execute arg. - - * condvar.c (pthread_condattr_init): Replaced by John Bossom's version. - (pthread_condattr_destroy): Replaced by John Bossom's version. - (pthread_condattr_getpshared): Replaced by John Bossom's version. - (pthread_condattr_setpshared): Replaced by John Bossom's version. - (pthread_cond_init): Replaced by John Bossom's version. - Fix comment (refered to mutex rather than condition variable). - (pthread_cond_destroy): Replaced by John Bossom's version. - (pthread_cond_wait): Replaced by John Bossom's version. - (pthread_cond_timedwait): Replaced by John Bossom's version. - (pthread_cond_signal): Replaced by John Bossom's version. - (pthread_cond_broadcast): Replaced by John Bossom's version. - -Thu Dec 17 19:10:46 1998 Ross Johnson - - * tsd.c (pthread_key_create): Replaced by John Bossom's version. - (pthread_key_delete): Replaced by John Bossom's version. - (pthread_setspecific): Replaced by John Bossom's version. - (pthread_getspecific): Replaced by John Bossom's version. - -Mon Dec 7 09:44:40 1998 John Bossom - - * cancel.c (pthread_setcancelstate): Replaced. - (pthread_setcanceltype): Replaced. - (pthread_testcancel): Replaced. - (pthread_cancel): Replaced. - - * exit.c (pthread_exit): Replaced. - - * misc.c (pthread_self): Replaced. - (pthread_equal): Replaced. - - * sync.c (pthread_detach): Replaced. - (pthread_join): Replaced. - - * create.c (pthread_create): Replaced. - - * private.c (ptw32_processInitialize): New. - (ptw32_processTerminate): New. - (ptw32_threadStart): New. - (ptw32_threadDestroy): New. - (ptw32_cleanupStack): New. - (ptw32_tkAssocCreate): New. - (ptw32_tkAssocDestroy): New. - (ptw32_callUserDestroyRoutines): New. - - * implement.h: Added non-API structures and declarations. - - * dll.c (PthreadsEntryPoint): Cast return value of GetProcAddress - to resolve compile warning from MSVC. - - * dll.c (DLLmain): Replaced. - * dll.c (PthreadsEntryPoint): - Re-applied Anders Norlander's patch:- - Initialize ptw32_try_enter_critical_section at startup - and release kernel32 handle when DLL is being unloaded. - -Sun Dec 6 21:54:35 1998 Ross Johnson - - * buildlib.bat: Fix args to CL when building the .DLL - - * cleanup.c (ptw32_destructor_run_all): Fix TSD key management. - This is a tidy-up before TSD and Thread management is completely - replaced by John Bossom's code. - - * tsd.c (pthread_key_create): Fix TSD key management. - - * global.c (ptw32_key_virgin_next): Initialise. - - * build.bat: New DOS script to compile and link a pthreads app - using Microsoft's CL compiler linker. - * buildlib.bat: New DOS script to compile all the object files - and create pthread.lib and pthread.dll using Microsoft's CL - compiler linker. - -1998-12-05 Anders Norlander - - * implement.h (ptw32_try_enter_critical_section): New extern - * dll.c (ptw32_try_enter_critical_section): New pointer to - TryEnterCriticalSection if it exists; otherwise NULL. - * dll.c (PthreadsEntryPoint): - Initialize ptw32_try_enter_critical_section at startup - and release kernel32 handle when DLL is being unloaded. - * mutex.c (pthread_mutex_trylock): Replaced check for NT with - a check if ptw32_try_enter_critical_section is valid - pointer to a function. Call ptw32_try_enter_critical_section - instead of TryEnterCriticalSection to avoid errors on Win95. - -Thu Dec 3 13:32:00 1998 Ross Johnson - - * README: Correct cygwin32 compatibility statement. - -Sun Nov 15 21:24:06 1998 Ross Johnson - - * cleanup.c (ptw32_destructor_run_all): Declare missing void * arg. - Fixup CVS merge conflicts. - -1998-10-30 Ben Elliston - - * condvar.c (cond_wait): Fix semantic error. Test for equality - instead of making an assignment. - -Fri Oct 30 15:15:50 1998 Ross Johnson - - * cleanup.c (ptw32_handler_push): Fixed bug appending new - handler to list reported by Peter Slacik - . - (new_thread): Rename poorly named local variable to - "new_handler". - -Sat Oct 24 18:34:59 1998 Ross Johnson - - * global.c: Add TSD key management array and index declarations. - - * implement.h: Ditto for externs. - -Fri Oct 23 00:08:09 1998 Ross Johnson - - * implement.h (PTW32_TSD_KEY_REUSE): Add enum. - - * private.c (ptw32_delete_thread): Add call to - ptw32_destructor_run_all() to clean up the threads keys. - - * cleanup.c (ptw32_destructor_run_all): Check for no more dirty - keys to run destructors on. Assume that the destructor call always - succeeds and set the key value to NULL. - -Thu Oct 22 21:44:44 1998 Ross Johnson - - * tsd.c (pthread_setspecific): Add key management code. - (pthread_key_create): Ditto. - (pthread_key_delete): Ditto. - - * implement.h (struct ptw32_tsd_key): Add status member. - - * tsd.c: Add description of pthread_key_delete() from the - standard as a comment. - -Fri Oct 16 17:38:47 1998 Ross Johnson - - * cleanup.c (ptw32_destructor_run_all): Fix and improve - stepping through the key table. - -Thu Oct 15 14:05:01 1998 Ross Johnson - - * private.c (ptw32_new_thread): Remove init of destructorstack. - No longer an element of pthread_t. - - * tsd.c (pthread_setspecific): Fix type declaration and cast. - (pthread_getspecific): Ditto. - (pthread_getspecific): Change error return value to NULL if key - is not in use. - -Thu Oct 15 11:53:21 1998 Ross Johnson - - * global.c (ptw32_tsd_key_table): Fix declaration. - - * implement.h(ptw32_TSD_keys_TlsIndex): Add missing extern. - (ptw32_tsd_mutex): Ditto. - - * create.c (ptw32_start_call): Fix "keys" array declaration. - Add comment. - - * tsd.c (pthread_setspecific): Fix type declaration and cast. - (pthread_getspecific): Ditto. - - * cleanup.c (ptw32_destructor_run_all): Declare missing loop - counter. - -Wed Oct 14 21:09:24 1998 Ross Johnson - - * private.c (ptw32_new_thread): Increment ptw32_threads_count. - (ptw32_delete_thread): Decrement ptw32_threads_count. - Remove some comments. - - * exit.c (ptw32_exit): : Fix two pthread_mutex_lock() calls that - should have been pthread_mutex_unlock() calls. - (ptw32_vacuum): Remove call to ptw32_destructor_pop_all(). - - * create.c (pthread_create): Fix two pthread_mutex_lock() calls that - should have been pthread_mutex_unlock() calls. - - * global.c (ptw32_tsd_mutex): Add mutex for TSD operations. - - * tsd.c (pthread_key_create): Add critical section. - (pthread_setspecific): Ditto. - (pthread_getspecific): Ditto. - (pthread_key_delete): Ditto. - - * sync.c (pthread_join): Fix two pthread_mutex_lock() calls that - should have been pthread_mutex_unlock() calls. - -Mon Oct 12 00:00:44 1998 Ross Johnson - - * implement.h (ptw32_tsd_key_table): New. - - * create.c (ptw32_start_call): Initialise per-thread TSD keys - to NULL. - - * misc.c (pthread_once): Correct typo in comment. - - * implement.h (ptw32_destructor_push): Remove. - (ptw32_destructor_pop): Remove. - (ptw32_destructor_run_all): Rename from ptw32_destructor_pop_all. - (PTW32_TSD_KEY_DELETED): Add enum. - (PTW32_TSD_KEY_INUSE): Add enum. - - * cleanup.c (ptw32_destructor_push): Remove. - (ptw32_destructor_pop): Remove. - (ptw32_destructor_run_all): Totally revamped TSD. - - * dll.c (ptw32_TSD_keys_TlsIndex): Initialise. - - * tsd.c (pthread_setspecific): Totally revamped TSD. - (pthread_getspecific): Ditto. - (pthread_create): Ditto. - (pthread_delete): Ditto. - -Sun Oct 11 22:44:55 1998 Ross Johnson - - * global.c (ptw32_tsd_key_table): Add new global. - - * implement.h (ptw32_tsd_key_t and struct ptw32_tsd_key): - Add. - (struct _pthread): Remove destructorstack. - - * cleanup.c (ptw32_destructor_run_all): Rename from - ptw32_destructor_pop_all. The key destructor stack was made - global rather than per-thread. No longer removes destructor nodes - from the stack. Comments updated. - -1998-10-06 Ben Elliston - - * condvar.c (cond_wait): Use POSIX, not Win32 mutex calls. - (pthread_cond_broadcast): Likewise. - (pthread_cond_signal): Likewise. - -1998-10-05 Ben Elliston - - * pthread.def: Update. Some functions aren't available yet, others - are macros in . - - * tests/join.c: Remove; useless. - -Mon Oct 5 14:25:08 1998 Ross Johnson - - * pthread.def: New file for building the DLL. - -1998-10-05 Ben Elliston - - * misc.c (pthread_equal): Correct inverted logic bug. - (pthread_once): Use the POSIX mutex primitives, not Win32. Remove - irrelevant FIXME comment. - - * global.c (PTHREAD_MUTEX_INITIALIZER): Move to pthread.h. - - * pthread.h (PTHREAD_MUTEX_INITIALIZER): Define. - (pthread_mutex_t): Reimplement as a struct containing a valid - flag. If the flag is ever down upon entry to a mutex operation, - we call pthread_mutex_create() to initialise the object. This - fixes the problem of how to handle statically initialised objects - that can't call InitializeCriticalSection() due to their context. - (PTHREAD_ONCE_INIT): Define. - - * mutex.c (pthread_mutex_init): Set valid flag. - (pthread_mutex_destroy): Clear valid flag. - (pthread_mutex_lock): Check and handle the valid flag. - (pthread_mutex_unlock): Likewise. - (pthread_mutex_trylock): Likewise. - - * tests/mutex3.c: New file; test for the static initialisation - macro. Passes. - - * tests/create1.c: New file; test pthread_create(). Passes. - - * tests/equal.c: Poor test; remove. - - * tests/equal1.c New file; test pthread_equal(). Passes. - - * tests/once1.c: New file; test for pthread_once(). Passes. - - * tests/self.c: Remove; rename to self1.c. - - * tests/self1.c: This is the old self.c. - - * tests/self2.c: New file. Test pthread_self() with a single - thread. Passes. - - * tests/self3.c: New file. Test pthread_self() with a couple of - threads to ensure their thread IDs differ. Passes. - -1998-10-04 Ben Elliston - - * tests/mutex2.c: Test pthread_mutex_trylock(). Passes. - - * tests/mutex1.c: New basic test for mutex functions (it passes). - (main): Eliminate warning. - - * configure.in: Test for __stdcall, not _stdcall. Typo. - - * configure: Regenerate. - - * attr.c (pthread_attr_setstackaddr): Remove FIXME comment. Win32 - does know about ENOSYS after all. - (pthread_attr_setstackaddr): Likewise. - -1998-10-03 Ben Elliston - - * configure.in: Test for the `_stdcall' keyword. Define `STDCALL' - to `_stdcall' if we have it, null otherwise. - - * configure: Regenerate. - - * acconfig.h (STDCALL): New define. - - * config.h.in: Regenerate. - - * create.c (ptw32_start_call): Add STDCALL prefix. - - * mutex.c (pthread_mutex_init): Correct function signature. - - * attr.c (pthread_attr_init): Only zero out the `sigmask' member - if we have the sigset_t type. - - * pthread.h: No need to include . It doesn't even exist - on Win32! Again, an artifact of cross-compilation. - (pthread_sigmask): Only provide if we have the sigset_t type. - - * process.h: Remove. This was a stand-in before we started doing - native compilation under Win32. - - * pthread.h (pthread_mutex_init): Make `attr' argument const. - -1998-10-02 Ben Elliston - - * COPYING: Remove. - - * COPYING.LIB: Add. This library is under the LGPL. - -1998-09-13 Ben Elliston - - * configure.in: Test for required system features. - - * configure: Generate. - - * acconfig.h: New file. - - * config.h.in: Generate. - - * Makefile.in: Renamed from Makefile. - - * COPYING: Import from a recent GNU package. - - * config.guess: Likewise. - - * config.sub: Likewise. - - * install-sh: Likewise. - - * config.h: Remove. - - * Makefile: Likewise. - -1998-09-12 Ben Elliston - - * windows.h: No longer needed; remove. - - * windows.c: Likewise. - -Sat Sep 12 20:09:24 1998 Ross Johnson - - * windows.h: Remove error number definitions. These are in - - * tsd.c: Add comment explaining rationale for not building - POSIX TSD on top of Win32 TLS. - -1998-09-12 Ben Elliston - - * {most}.c: Include to get POSIX error values. - - * signal.c (pthread_sigmask): Only provide if HAVE_SIGSET_T is - defined. - - * config.h: #undef features, don't #define them. This will be - generated by autoconf very soon. - -1998-08-11 Ben Elliston - - * Makefile (LIB): Define. - (clean): Define target. - (all): Build a library not just the object files. - - * pthread.h: Provide a definition for struct timespec if we don't - already have one. - - * windows.c (TlsGetValue): Bug fix. - -Thu Aug 6 15:19:22 1998 Ross Johnson - - * misc.c (pthread_once): Fix arg 1 of EnterCriticalSection() - and LeaveCriticalSection() calls to pass address-of lock. - - * fork.c (pthread_atfork): Typecast (void (*)(void *)) funcptr - in each ptw32_handler_push() call. - - * exit.c (ptw32_exit): Fix attr arg in - pthread_attr_getdetachstate() call. - - * private.c (ptw32_new_thread): Typecast (HANDLE) NULL. - (ptw32_delete_thread): Ditto. - - * implement.h: (PTW32_MAX_THREADS): Add define. This keeps - changing in an attempt to make thread administration data types - opaque and cleanup DLL startup. - - * dll.c (PthreadsEntryPoint): - (ptw32_virgins): Remove malloc() and free() calls. - (ptw32_reuse): Ditto. - (ptw32_win32handle_map): Ditto. - (ptw32_threads_mutex_table): Ditto. - - * global.c (_POSIX_THREAD_THREADS_MAX): Initialise with - PTW32_MAX_THREADS. - (ptw32_virgins): Ditto. - (ptw32_reuse): Ditto. - (ptw32_win32handle_map): Ditto. - (ptw32_threads_mutex_table): Ditto. - - * create.c (pthread_create): Typecast (HANDLE) NULL. - Typecast (unsigned (*)(void *)) start_routine. - - * condvar.c (pthread_cond_init): Add address-of operator & to - arg 1 of pthread_mutex_init() call. - (pthread_cond_destroy): Add address-of operator & to - arg 1 of pthread_mutex_destroy() call. - - * cleanup.c (ptw32_destructor_pop_all): Add (int) cast to - pthread_getspecific() arg. - (ptw32_destructor_pop): Add (void *) cast to "if" conditional. - (ptw32_destructor_push): Add (void *) cast to - ptw32_handler_push() "key" arg. - (malloc.h): Add include. - - * implement.h (ptw32_destructor_pop): Add prototype. - - * tsd.c (implement.h): Add include. - - * sync.c (pthread_join): Remove target_thread_mutex and it's - initialisation. Rename getdetachedstate to getdetachstate. - Remove unused variable "exitcode". - (pthread_detach): Remove target_thread_mutex and it's - initialisation. Rename getdetachedstate to getdetachstate. - Rename setdetachedstate to setdetachstate. - - * signal.c (pthread_sigmask): Rename SIG_SET to SIG_SETMASK. - Cast "set" to (long *) in assignment to passify compiler warning. - Add address-of operator & to thread->attr.sigmask in memcpy() call - and assignment. - (pthread_sigmask): Add address-of operator & to thread->attr.sigmask - in memcpy() call and assignment. - - * windows.h (THREAD_PRIORITY_ERROR_RETURN): Add. - (THREAD_PRIORITY_LOWEST): Add. - (THREAD_PRIORITY_HIGHEST): Add. - - * sched.c (is_attr): Add function. - (implement.h): Add include. - (pthread_setschedparam): Rename all instances of "sched_policy" - to "sched_priority". - (pthread_getschedparam): Ditto. - -Tue Aug 4 16:57:58 1998 Ross Johnson - - * private.c (ptw32_delete_thread): Fix typo. Add missing ';'. - - * global.c (ptw32_virgins): Change types from pointer to - array pointer. - (ptw32_reuse): Ditto. - (ptw32_win32handle_map): Ditto. - (ptw32_threads_mutex_table): Ditto. - - * implement.h(ptw32_virgins): Change types from pointer to - array pointer. - (ptw32_reuse): Ditto. - (ptw32_win32handle_map): Ditto. - (ptw32_threads_mutex_table): Ditto. - - * private.c (ptw32_delete_thread): Fix "entry" should be "thread". - - * misc.c (pthread_self): Add extern for ptw32_threadID_TlsIndex. - - * global.c: Add comment. - - * misc.c (pthread_once): Fix member -> dereferences. - Change ptw32_once_flag to once_control->flag in "if" test. - -Tue Aug 4 00:09:30 1998 Ross Johnson - - * implement.h(ptw32_virgins): Add extern. - (ptw32_virgin_next): Ditto. - (ptw32_reuse): Ditto. - (ptw32_reuse_top): Ditto. - (ptw32_win32handle_map): Ditto. - (ptw32_threads_mutex_table): Ditto. - - * global.c (ptw32_virgins): Changed from array to pointer. - Storage allocation for the array moved into dll.c. - (ptw32_reuse): Ditto. - (ptw32_win32handle_map): Ditto. - (ptw32_threads_mutex_table): Ditto. - - * dll.c (PthreadsEntryPoint): Set up thread admin storage when - DLL is loaded. - - * fork.c (pthread_atfork): Fix function pointer arg to all - ptw32_handler_push() calls. Change "arg" arg to NULL in child push. - - * exit.c: Add windows.h and process.h includes. - (ptw32_exit): Add local detachstate declaration. - (ptw32_exit): Fix incorrect name for pthread_attr_getdetachstate(). - - * pthread.h (_POSIX_THREAD_ATTR_STACKSIZE): Move from global.c - (_POSIX_THREAD_ATTR_STACKADDR): Ditto. - - * create.c (pthread_create): Fix #if should be #ifdef. - (ptw32_start_call): Remove usused variables. - - * process.h: Create. - - * windows.h: Move _beginthreadex and _endthreadex into - process.h - -Mon Aug 3 21:19:57 1998 Ross Johnson - - * condvar.c (pthread_cond_init): Add NULL attr to - pthread_mutex_init() call - default attributes will be used. - (cond_wait): Fix typo. - (cond_wait): Fix typo - cv was ev. - (pthread_cond_broadcast): Fix two identical typos. - - * cleanup.c (ptw32_destructor_pop_all): Remove _ prefix from - PTHREAD_DESTRUCTOR_ITERATIONS. - - * pthread.h: Move _POSIX_* values into posix.h - - * pthread.h: Fix typo in pthread_mutex_init() prototype. - - * attr.c (pthread_attr_init): Fix error in priority member init. - - * windows.h (THREAD_PRIORITY_NORMAL): Add. - - * pthread.h (sched_param): Add missing ';' to struct definition. - - * attr.c (pthread_attr_init): Remove obsolete pthread_attr_t - member initialisation - cancelstate, canceltype, cancel_pending. - (is_attr): Make arg "attr" a const. - - * implement.h (PTW32_HANDLER_POP_LIFO): Remove definition. - (PTW32_HANDLER_POP_FIFO): Ditto. - (PTW32_VALID): Add missing newline escape (\). - (ptw32_handler_node): Make element "next" a pointer. - -1998-08-02 Ben Elliston - - * windows.h: Remove duplicate TlsSetValue() prototype. Add - TlsGetValue() prototype. - (FALSE): Define. - (TRUE): Likewise. - Add forgotten errno values. Guard against multiple #includes. - - * windows.c: New file. Implement stubs for Win32 functions. - - * Makefile (SRCS): Remove. Not explicitly needed. - (CFLAGS): Add -Wall for all warnings with GCC. - -Sun Aug 2 19:03:42 1998 Ross Johnson - - * config.h: Create. This is a temporary stand-in for autoconf yet - to be done. - (HAVE_SIGNAL_H): Add. - - * pthread.h: Minor rearrangement for temporary config.h. - -Fri Jul 31 14:00:29 1998 Ross Johnson - - * cleanup.c (ptw32_destructor_pop): Implement. Removes - destructors associated with a key without executing them. - (ptw32_destructor_pop_all): Add FIXME comment. - - * tsd.c (pthread_key_delete): Add call to ptw32_destructor_pop(). - -Fri Jul 31 00:05:45 1998 Ross Johnson - - * tsd.c (pthread_key_create): Update to properly associate - the destructor routine with the key. - (pthread_key_delete): Add FIXME comment. - - * exit.c (ptw32_vacuum): Add call to - ptw32_destructor_pop_all(). - - * implement.h (ptw32_handler_pop_all): Add prototype. - (ptw32_destructor_pop_all): Ditto. - - * cleanup.c (ptw32_destructor_push): Implement. This is just a - call to ptw32_handler_push(). - (ptw32_destructor_pop_all): Implement. This is significantly - different to ptw32_handler_pop_all(). - - * Makefile (SRCS): Create. Preliminary. - - * windows.h: Create. Contains Win32 definitions for compile - testing. This is just a standin for the real one. - - * pthread.h (SIG_UNBLOCK): Fix typo. Was SIG_BLOCK. - (windows.h): Add include. Required for CRITICAL_SECTION. - (pthread_cond_t): Move enum declaration outside of struct - definition. - (unistd.h): Add include - may be temporary. - - * condvar.c (windows.h): Add include. - - * implement.h (PTW32_THIS): Remove - no longer required. - (PTW32_STACK): Use pthread_self() instead of PTW32_THIS. - -Thu Jul 30 23:12:45 1998 Ross Johnson - - * implement.h: Remove ptw32_find_entry() prototype. - - * private.c: Extend comments. - Remove ptw32_find_entry() - no longer needed. - - * create.c (ptw32_start_call): Add call to TlsSetValue() to - store the thread ID. - - * dll.c (PthreadsEntryPoint): Implement. This is called - whenever a process loads the DLL. Used to initialise thread - local storage. - - * implement.h: Add ptw32_threadID_TlsIndex. - Add ()s around PTW32_VALID expression. - - * misc.c (pthread_self): Re-implement using Win32 TLS to store - the threads own ID. - -Wed Jul 29 11:39:03 1998 Ross Johnson - - * private.c: Corrections in comments. - (ptw32_new_thread): Alter "if" flow to be more natural. - - * cleanup.c (ptw32_handler_push): Same as below. - - * create.c (pthread_create): Same as below. - - * private.c (ptw32_new_thread): Rename "new" to "new_thread". - Since when has a C programmer been required to know C++? - -Tue Jul 28 14:04:29 1998 Ross Johnson - - * implement.h: Add PTW32_VALID macro. - - * sync.c (pthread_join): Modify to use the new thread - type and ptw32_delete_thread(). Rename "target" to "thread". - Remove extra local variable "target". - (pthread_detach): Ditto. - - * signal.c (pthread_sigmask): Move init of "us" out of inner block. - Fix instance of "this" should have been "us". Rename "us" to "thread". - - * sched.c (pthread_setschedparam): Modify to use the new thread - type. - (pthread_getschedparam): Ditto. - - * private.c (ptw32_find_thread): Fix return type and arg. - - * implement.h: Remove PTW32_YES and PTW32_NO. - (ptw32_new_thread): Add prototype. - (ptw32_find_thread): Ditto. - (ptw32_delete_thread): Ditto. - (ptw32_new_thread_entry): Remove prototype. - (ptw32_find_thread_entry): Ditto. - (ptw32_delete_thread_entry): Ditto. - ( PTW32_NEW, PTW32_INUSE, PTW32_EXITED, PTW32_REUSE): - Add. - - - * create.c (pthread_create): Minor rename "us" to "new" (I need - these cues but it doesn't stop me coming out with some major bugs - at times). - Load start_routine and arg into the thread so the wrapper can - call it. - - * exit.c (pthread_exit): Fix pthread_this should be pthread_self. - - * cancel.c (pthread_setcancelstate): Change - ptw32_threads_thread_t * to pthread_t and init with - pthread_this(). - (pthread_setcanceltype): Ditto. - - * exit.c (ptw32_exit): Add new pthread_t arg. - Rename ptw32_delete_thread_entry to ptw32_delete_thread. - Rename "us" to "thread". - (pthread_exit): Call ptw32_exit with added thread arg. - - * create.c (ptw32_start_call): Insert missing ")". - Add "us" arg to ptw32_exit() call. - (pthread_create): Modify to use new thread allocation scheme. - - * private.c: Added detailed explanation of the new thread - allocation scheme. - (ptw32_new_thread): Totally rewritten to use - new thread allocation scheme. - (ptw32_delete_thread): Ditto. - (ptw32_find_thread): Obsolete. - -Mon Jul 27 17:46:37 1998 Ross Johnson - - * create.c (pthread_create): Start of rewrite. Not completed yet. - - * private.c (ptw32_new_thread_entry): Start of rewrite. Not - complete. - - * implement.h (ptw32_threads_thread): Rename, remove thread - member, add win32handle and ptstatus members. - (ptw32_t): Add. - - * pthread.h: pthread_t is no longer mapped directly to a Win32 - HANDLE type. This is so we can let the Win32 thread terminate and - reuse the HANDLE while pthreads holds it's own thread ID until - the last waiting join exits. - -Mon Jul 27 00:20:37 1998 Ross Johnson - - * private.c (ptw32_delete_thread_entry): Destroy the thread - entry attribute object before deleting the thread entry itself. - - * attr.c (pthread_attr_init): Initialise cancel_pending = FALSE. - (pthread_attr_setdetachstate): Rename "detached" to "detachedstate". - (pthread_attr_getdetachstate): Ditto. - - * exit.c (ptw32_exit): Fix incorrect check for detachedstate. - - * implement.h (ptw32_call_t): Remove env member. - -Sun Jul 26 13:06:12 1998 Ross Johnson - - * implement.h (ptw32_new_thread_entry): Fix prototype. - (ptw32_find_thread_entry): Ditto. - (ptw32_delete_thread_entry): Ditto. - (ptw32_exit): Add prototype. - - * exit.c (ptw32_exit): New function. Called from pthread_exit() - and ptw32_start_call() to exit the thread. It allows an extra - argument which is the return code passed to _endthreadex(). - (ptw32_exit): Move thread entry delete call from ptw32_vacuum() - into here. Add more explanation of thread entry deletion. - (ptw32_exit): Clarify comment. - - * create.c (ptw32_start_call): Change pthread_exit() call to - ptw32_exit() call. - - * exit.c (ptw32_vacuum): Add thread entry deletion code - moved from ptw32_start_call(). See next item. - (pthread_exit): Remove longjmp(). Add mutex lock around thread table - manipulation code. This routine now calls _enthreadex(). - - * create.c (ptw32_start_call): Remove setjmp() call and move - cleanup code out. Call pthread_exit(NULL) to terminate the thread. - -1998-07-26 Ben Elliston - - * tsd.c (pthread_getspecific): Update comments. - - * mutex.c (pthread_mutexattr_setpshared): Not supported; remove. - (pthread_mutexattr_getpshared): Likewise. - - * pthread.h (pthread_mutexattr_setpshared): Remove prototype. - (pthread_mutexattr_getpshared): Likewise. - -Sun Jul 26 00:09:59 1998 Ross Johnson - - * sync.c: Rename all instances of ptw32_count_mutex to - ptw32_table_mutex. - - * implement.h: Rename ptw32_count_mutex to - ptw32_table_mutex. - - * global.c: Rename ptw32_count_mutex to - ptw32_table_mutex. - - * create.c (pthread_create): Add critical sections. - (ptw32_start_call): Rename ptw32_count_mutex to - ptw32_table_mutex. - - * cancel.c (pthread_setcancelstate): Fix indirection bug and rename - "this" to "us". - - * signal.c (pthread_sigmask): Rename "this" to "us" and fix some - minor syntax errors. Declare "us" and initialise it. - - * sync.c (pthread_detach): Rename "this" to "target". - - * pthread.h: Converting PTHREAD_* defines to alias the (const int) - values in global.c. - - * global.c: Started converting PTHREAD_* defines to (const int) as - a part of making the eventual pthreads DLL binary compatible - through version changes. - - * condvar.c (cond_wait): Add cancelation point. This applies the - point to both pthread_cond_wait() and pthread_cond_timedwait(). - - * exit.c (pthread_exit): Rename "this" to "us". - - * implement.h: Add comment. - - * sync.c (pthread_join): I've satisfied myself that pthread_detach() - does set the detached attribute in the thread entry attributes - to PTHREAD_CREATE_DETACHED. "if" conditions were changed to test - that attribute instead of a separate flag. - - * create.c (pthread_create): Rename "this" to "us". - (pthread_create): cancelstate and canceltype are not attributes - so the copy to thread entry attribute storage was removed. - Only the thread itself can change it's cancelstate or canceltype, - ie. the thread must exist already. - - * private.c (ptw32_delete_thread_entry): Mutex locks removed. - Mutexes must be applied at the caller level. - (ptw32_new_thread_entry): Ditto. - (ptw32_new_thread_entry): Init cancelstate, canceltype, and - cancel_pending to default values. - (ptw32_new_thread_entry): Rename "this" to "new". - (ptw32_find_thread_entry): Rename "this" to "entry". - (ptw32_delete_thread_entry): Rename "thread_entry" to "entry". - - * create.c (ptw32_start_call): Mutexes changed to - ptw32_count_mutex. All access to the threads table entries is - under the one mutex. Otherwise chaos reigns. - -Sat Jul 25 23:16:51 1998 Ross Johnson - - * implement.h (ptw32_threads_thread): Move cancelstate and - canceltype members out of pthread_attr_t into here. - - * fork.c (fork): Add comment. - -1998-07-25 Ben Elliston - - * fork.c (fork): Autoconfiscate. - -Sat Jul 25 00:00:13 1998 Ross Johnson - - * create.c (ptw32_start_call): Set thread priority. Ensure our - thread entry is removed from the thread table but only if - pthread_detach() was called and there are no waiting joins. - (pthread_create): Set detach flag in thread entry if the - thread is created PTHREAD_CREATE_DETACHED. - - * pthread.h (pthread_attr_t): Rename member "detachedstate". - - * attr.c (pthread_attr_init): Rename attr members. - - * exit.c (pthread_exit): Fix indirection mistake. - - * implement.h (PTW32_THREADS_TABLE_INDEX): Add. - - * exit.c (ptw32_vacuum): Fix incorrect args to - ptw32_handler_pop_all() calls. - Make thread entry removal conditional. - - * sync.c (pthread_join): Add multiple join and async detach handling. - - * implement.h (PTW32_THREADS_TABLE_INDEX): Add. - - * global.c (ptw32_threads_mutex_table): Add. - - * implement.h (ptw32_once_flag): Remove. - (ptw32_once_lock): Ditto. - (ptw32_threads_mutex_table): Add. - - * global.c (ptw32_once_flag): Remove. - (ptw32_once_lock): Ditto. - - * sync.c (pthread_join): Fix tests involving new return value - from ptw32_find_thread_entry(). - (pthread_detach): Ditto. - - * private.c (ptw32_find_thread_entry): Failure return code - changed from -1 to NULL. - -Fri Jul 24 23:09:33 1998 Ross Johnson - - * create.c (pthread_create): Change . to -> in sigmask memcpy() args. - - * pthread.h: (pthread_cancel): Add function prototype. - (pthread_testcancel): Ditto. - -1998-07-24 Ben Elliston - - * pthread.h (pthread_condattr_t): Rename dummy structure member. - (pthread_mutexattr_t): Likewise. - -Fri Jul 24 21:13:55 1998 Ross Johnson - - * cancel.c (pthread_cancel): Implement. - (pthread_testcancel): Implement. - - * exit.c (pthread_exit): Add comment explaining the longjmp(). - - * implement.h (ptw32_threads_thread_t): New member cancelthread. - (PTW32_YES): Define. - (PTW32_NO): Define. - (RND_SIZEOF): Remove. - - * create.c (pthread_create): Rename cancelability to cancelstate. - - * pthread.h (pthread_attr_t): Rename cancelability to cancelstate. - (PTHREAD_CANCELED): Define. - -1998-07-24 Ben Elliston - - * pthread.h (SIG_BLOCK): Define if not already defined. - (SIG_UNBLOCK): Likewise. - (SIG_SETMASK): Likewise. - (pthread_attr_t): Add signal mask member. - (pthread_sigmask): Add function prototype. - - * signal.c (pthread_sigmask): Implement. - - * create.c: #include to get a prototype for memcpy(). - (pthread_create): New threads inherit their creator's signal - mask. Copy the signal mask to the new thread structure if we know - about signals. - -Fri Jul 24 16:33:17 1998 Ross Johnson - - * fork.c (pthread_atfork): Add all the necessary push calls. - Local implementation semantics: - If we get an ENOMEM at any time then ALL handlers - (including those from previous pthread_atfork() calls) will be - popped off each of the three atfork stacks before we return. - (fork): Add all the necessary pop calls. Add the thread cancellation - and join calls to the child fork. - Add #includes. - - * implement.h: (ptw32_handler_push): Fix return type and stack arg - type in prototype. - (ptw32_handler_pop): Fix stack arg type in prototype. - (ptw32_handler_pop_all): Fix stack arg type in prototype. - - * cleanup.c (ptw32_handler_push): Change return type to int and - return ENOMEM if malloc() fails. - - * sync.c (pthread_detach): Use equality test, not assignment. - - * create.c (ptw32_start_call): Add call to Win32 CloseHandle() - if thread is detached. - -1998-07-24 Ben Elliston - - * sync.c (pthread_detach): Close the Win32 thread handle to - emulate detached (or daemon) threads. - -Fri Jul 24 03:00:25 1998 Ross Johnson - - * sync.c (pthread_join): Save valueptr arg in joinvalueptr for - pthread_exit() to use. - - * private.c (ptw32_new_thread_entry): Initialise joinvalueptr to - NULL. - - * create.c (ptw32_start_call): Rewrite to facilitate joins. - pthread_exit() will do a longjmp() back to here. Does appropriate - cleanup and exit/return from the thread. - (pthread_create): _beginthreadex() now passes a pointer to our - thread table entry instead of just the call member of that entry. - - * implement.h (ptw32_threads_thread): New member - void ** joinvalueptr. - (ptw32_call_t): New member jmpbuf env. - - * exit.c (pthread_exit): Major rewrite to handle joins and handing - value pointer to joining thread. Uses longjmp() back to - ptw32_start_call(). - - * create.c (pthread_create): Ensure values of new attribute members - are copied to the thread attribute object. - - * attr.c (pthread_attr_destroy): Fix merge conflicts. - (pthread_attr_getdetachstate): Fix merge conflicts. - (pthread_attr_setdetachstate): Fix merge conflicts. - - * pthread.h: Fix merge conflicts. - - * sync.c (pthread_join): Fix merge conflicts. - -Fri Jul 24 00:21:21 1998 Ross Johnson - - * sync.c (pthread_join): Add check for valid and joinable - thread. - (pthread_detach): Implement. After checking for a valid and joinable - thread, it's still a no-op. - - * private.c (ptw32_find_thread_entry): Bug prevented returning - an error value in some cases. - - * attr.c (pthread_attr_setdetachedstate): Implement. - (pthread_attr_getdetachedstate): Implement. - - * implement.h: Move more hidden definitions into here from - pthread.h. - -1998-07-24 Ben Elliston - - * pthread.h (PTHREAD_CREATE_JOINABLE): Define. - (PTHREAD_CREATE_DETACHED): Likewise. - (pthread_attr_t): Add new structure member `detached'. - (pthread_attr_getdetachstate): Add function prototype. - (pthread_attr_setdetachstate): Likewise. - - * sync.c (pthread_join): Return if the target thread is detached. - - * attr.c (pthread_attr_init): Initialise cancelability and - canceltype structure members. - (pthread_attr_getdetachstate): Implement. - (pthread_attr_setdetachstate): Likewise. - - * implement.h (PTW32_CANCEL_DEFAULTS): Remove. Bit fields - proved to be too cumbersome. Set the defaults in attr.c using the - public PTHREAD_CANCEL_* constants. - - * cancel.c: New file. - - * pthread.h (sched_param): Define this type. - (pthread_attr_getschedparam): Add function prototype. - (pthread_attr_setschedparam): Likewise. - (pthread_setcancelstate): Likewise. - (pthread_setcanceltype): Likewise. - (sched_get_priority_min): Likewise. - (sched_get_priority_max): Likewise. - (pthread_mutexattr_setprotocol): Remove; not supported. - (pthread_mutexattr_getprotocol): Likewise. - (pthread_mutexattr_setprioceiling): Likewise. - (pthread_mutexattr_getprioceiling): Likewise. - (pthread_attr_t): Add canceltype member. Update comments. - (SCHED_OTHER): Define this scheduling policy constant. - (SCHED_FIFO): Likewise. - (SCHED_RR): Likewise. - (SCHED_MIN): Define the lowest possible value for this constant. - (SCHED_MAX): Likewise, the maximum possible value. - (PTHREAD_CANCEL_ASYNCHRONOUS): Redefine. - (PTHREAD_CANCEL_DEFERRED): Likewise. - - * sched.c: New file. - (pthread_setschedparam): Implement. - (pthread_getschedparam): Implement. - (sched_get_priority_max): Validate policy argument. - (sched_get_priority_min): Likewise. - - * mutex.c (pthread_mutexattr_setprotocol): Remove; not supported. - (pthread_mutexattr_getprotocol): Likewise. - (pthread_mutexattr_setprioceiling): Likewise. - (pthread_mutexattr_getprioceiling): Likewise. - -Fri Jul 24 00:21:21 1998 Ross Johnson - - * create.c (pthread_create): Arg to ptw32_new_thread_entry() - changed. See next entry. Move mutex locks out. Changes made yesterday - and today allow us to start the new thread running rather than - temporarily suspended. - - * private.c (ptw32_new_thread_entry): ptw32_thread_table - was changed back to a table of thread structures rather than pointers. - As such we're trading storage for increaded speed. This routine - was modified to work with the new table. Mutex lock put in around - global data accesses. - (ptw32_find_thread_entry): Ditto - (ptw32_delete_thread_entry): Ditto - -Thu Jul 23 23:25:30 1998 Ross Johnson - - * global.c: New. Global data objects declared here. These moved from - pthread.h. - - * pthread.h: Move implementation hidden definitions into - implement.h. - - * implement.h: Move implementation hidden definitions from - pthread.h. Add constants to index into the different handler stacks. - - * cleanup.c (ptw32_handler_push): Simplify args. Restructure. - (ptw32_handler_pop): Simplify args. Restructure. - (ptw32_handler_pop_all): Simplify args. Restructure. - -Wed Jul 22 00:16:22 1998 Ross Johnson - - * attr.c, implement.h, pthread.h, ChangeLog: Resolve CVS merge - conflicts. - - * private.c (ptw32_find_thread_entry): Changes to return type - to support leaner ptw32_threads_table[] which now only stores - ptw32_thread_thread_t *. - (ptw32_new_thread_entry): Internal changes. - (ptw32_delete_thread_entry): Internal changes to avoid contention. - Calling routines changed accordingly. - - * pthread.h: Modified cleanup macros to use new generic push and pop. - Added destructor and atfork stacks to ptw32_threads_thread_t. - - * cleanup.c (ptw32_handler_push, ptw32_handler_pop, - ptw32_handler_pop_all): Renamed cleanup push and pop routines - and made generic to handle destructors and atfork handlers as - well. - - * create.c (ptw32_start_call): New function is a wrapper for - all new threads. It allows us to do some cleanup when the thread - returns, ie. that is otherwise only done if the thread is cancelled. - - * exit.c (ptw32_vacuum): New function contains code from - pthread_exit() that we need in the new ptw32_start_call() - as well. - - * implement.h: Various additions and minor changes. - - * pthread.h: Various additions and minor changes. - Change cleanup handler macros to use generic handler push and pop - functions. - - * attr.c: Minor mods to all functions. - (is_attr): Implemented missing function. - - * create.c (pthread_create): More clean up. - - * private.c (ptw32_find_thread_entry): Implement. - (ptw32_delete_thread_entry): Implement. - (ptw32_new_thread_entry): Implement. - These functions manipulate the implementations internal thread - table and are part of general code cleanup and modularisation. - They replace ptw32_getthreadindex() which was removed. - - * exit.c (pthread_exit): Changed to use the new code above. - - * pthread.h: Add cancelability constants. Update comments. - -1998-07-22 Ben Elliston - - * attr.c (pthread_setstacksize): Update test of attr argument. - (pthread_getstacksize): Likewise. - (pthread_setstackaddr): Likewise. - (pthread_getstackaddr): Likewise. - (pthread_attr_init): No need to allocate any storage. - (pthread_attr_destroy): No need to free any storage. - - * mutex.c (is_attr): Not likely to be needed; remove. - (remove_attr): Likewise. - (insert_attr): Likewise. - - * implement.h (ptw32_mutexattr_t): Moved to a public definition - in pthread.h. There was little gain in hiding these details. - (ptw32_condattr_t): Likewise. - (ptw32_attr_t): Likewise. - - * pthread.h (pthread_atfork): Add function prototype. - (pthread_attr_t): Moved here from implement.h. - - * fork.c (pthread_atfork): Preliminary implementation. - (ptw32_fork): Likewise. - -Wed Jul 22 00:16:22 1998 Ross Johnson - - * cleanup.c (ptw32_cleanup_push): Implement. - (ptw32_cleanup_pop): Implement. - (ptw32_do_cancellation): Implement. - These are private to the implementation. The real cleanup functions - are macros. See below. - - * pthread.h (pthread_cleanup_push): Implement as a macro. - (pthread_cleanup_pop): Implement as a macro. - Because these are macros which start and end a block, the POSIX scoping - requirement is observed. See the comment in the file. - - * exit.c (pthread_exit): Refine the code. - - * create.c (pthread_create): Code cleanup. - - * implement.h (RND_SIZEOF): Add RND_SIZEOF(T) to round sizeof(T) - up to multiple of DWORD. - Add function prototypes. - - * private.c (ptw32_getthreadindex): "*thread" should have been - "thread". Detect empty slot fail condition. - -1998-07-20 Ben Elliston - - * misc.c (pthread_once): Implement. Don't use a per-application - flag and mutex--make `pthread_once_t' contain these elements in - their structure. The earlier version had incorrect semantics. - - * pthread.h (ptw32_once_flag): Add new variable. Remove. - (ptw32_once_lock): Add new mutex lock to ensure integrity of - access to ptw32_once_flag. Remove. - (pthread_once): Add function prototype. - (pthread_once_t): Define this type. - -Mon Jul 20 02:31:05 1998 Ross Johnson - - * private.c (ptw32_getthreadindex): Implement. - - * pthread.h: Add application static data dependent on - _PTHREADS_BUILD_DLL define. This is needed to avoid allocating - non-sharable static data within the pthread DLL. - - * implement.h: Add ptw32_cleanup_stack_t, ptw32_cleanup_node_t - and PTW32_HASH_INDEX. - - * exit.c (pthread_exit): Begin work on cleanup and de-allocate - thread-private storage. - - * create.c (pthread_create): Add thread to thread table. - Keep a thread-private copy of the attributes with default values - filled in when necessary. Same for the cleanup stack. Make - pthread_create C run-time library friendly by using _beginthreadex() - instead of CreateThread(). Fix error returns. - -Sun Jul 19 16:26:23 1998 Ross Johnson - - * implement.h: Rename pthreads_thread_count to ptw32_threads_count. - Create ptw32_threads_thread_t struct to keep thread specific data. - - * create.c: Rename pthreads_thread_count to ptw32_threads_count. - (pthread_create): Handle errors from CreateThread(). - -1998-07-19 Ben Elliston - - * condvar.c (pthread_cond_wait): Generalise. Moved from here .. - (cond_wait): To here. - (pthread_cond_timedwait): Implement; use generalised cond_wait(). - - * pthread.h (pthread_key_t): Define this type. - (pthread_key_create): Add function prototype. - (pthread_setspecific): Likewise. - (pthread_getspecific): Likwise. - (pthread_key_delete): Likewise. - - * tsd.c (pthread_key_create): Implement. - (pthread_setspecific): Likewise. - (pthread_getspecific): Likewise. - (pthread_key_delete): Likewise. - - * mutex.c (pthread_mutex_trylock): Return ENOSYS if this function - is called on a Win32 platform which is not Windows NT. - -1998-07-18 Ben Elliston - - * condvar.c (pthread_condattr_init): Do not attempt to malloc any - storage; none is needed now that condattr_t is an empty struct. - (pthread_condattr_destory): Likewise; do not free storage. - (pthread_condattr_setpshared): No longer supported; return ENOSYS. - (pthread_condattr_getpshared): Likewise. - (pthread_cond_init): Implement with help from Douglas Schmidt. - Remember to initialise the cv's internal mutex. - (pthread_cond_wait): Likewise. - (pthread_cond_signal): Likewise. - (pthread_cond_broadcast): Likewise. - (pthread_cond_timedwait): Preliminary implementation, but I need - to see some API documentation for `WaitForMultipleObject'. - (pthread_destory): Implement. - - * pthread.h (pthread_cond_init): Add function protoype. - (pthread_cond_broadcast): Likewise. - (pthread_cond_signal): Likewise. - (pthread_cond_timedwait): Likewise. - (pthread_cond_wait): Likewise. - (pthread_cond_destroy): Likewise. - (pthread_cond_t): Define this type. Fix for u_int. Do not assume - that the mutex contained withing the pthread_cond_t structure will - be a critical section. Use our new POSIX type! - - * implement.h (ptw32_condattr_t): Remove shared attribute. - -1998-07-17 Ben Elliston - - * pthread.h (PTHREADS_PROCESS_PRIVATE): Remove. - (PTHREAD_PROCESS_SHARED): Likewise. No support for mutexes shared - across processes for now. - (pthread_mutex_t): Use a Win32 CRITICAL_SECTION type for better - performance. - - * implement.h (ptw32_mutexattr_t): Remove shared attribute. - - * mutex.c (pthread_mutexattr_setpshared): This optional function - is no longer supported, since we want to implement POSIX mutex - variables using the much more efficient Win32 critical section - primitives. Critical section objects in Win32 cannot be shared - between processes. - (pthread_mutexattr_getpshared): Likewise. - (pthread_mutexattr_init): No need to malloc any storage; the - attributes structure is now empty. - (pthread_mutexattr_destroy): This is now a nop. - (pthread_mutex_init): Use InitializeCriticalSection(). - (pthread_mutex_destroy): Use DeleteCriticalSection(). - (pthread_mutex_lock): Use EnterCriticalSection(). - (pthread_mutex_trylock): Use TryEnterCriticalSection(). This is - not supported by Windows 9x, but trylock is a hack anyway, IMHO. - (pthread_mutex_unlock): Use LeaveCriticalSection(). - -1998-07-14 Ben Elliston - - * attr.c (pthread_attr_setstacksize): Implement. - (pthread_attr_getstacksize): Likewise. - (pthread_attr_setstackaddr): Likewise. - (pthread_attr_getstackaddr): Likewise. - (pthread_attr_init): Likewise. - (pthread_attr_destroy): Likewise. - - * condvar.c (pthread_condattr_init): Add `_cond' to function name. - - * mutex.c (pthread_mutex_lock): Add `_mutex' to function name. - (pthread_mutex_trylock): Likewise. - (pthread_mutex_unlock): Likewise. - - * pthread.h (pthread_condattr_setpshared): Fix typo. - (pthread_attr_init): Add function prototype. - (pthread_attr_destroy): Likewise. - (pthread_attr_setstacksize): Likewise. - (pthread_attr_getstacksize): Likewise. - (pthread_attr_setstackaddr): Likewise. - (pthread_attr_getstackaddr): Likewise. - -Mon Jul 13 01:09:55 1998 Ross Johnson - - * implement.h: Wrap in #ifndef _IMPLEMENT_H - - * create.c (pthread_create): Map stacksize attr to Win32. - - * mutex.c: Include implement.h - -1998-07-13 Ben Elliston - - * condvar.c (pthread_condattr_init): Implement. - (pthread_condattr_destroy): Likewise. - (pthread_condattr_setpshared): Likewise. - (pthread_condattr_getpshared): Likewise. - - * implement.h (PTHREAD_THREADS_MAX): Remove trailing semicolon. - (PTHREAD_STACK_MIN): Specify; needs confirming. - (ptw32_attr_t): Define this type. - (ptw32_condattr_t): Likewise. - - * pthread.h (pthread_mutex_t): Define this type. - (pthread_condattr_t): Likewise. - (pthread_mutex_destroy): Add function prototype. - (pthread_lock): Likewise. - (pthread_trylock): Likewise. - (pthread_unlock): Likewise. - (pthread_condattr_init): Likewise. - (pthread_condattr_destroy): Likewise. - (pthread_condattr_setpshared): Likewise. - (pthread_condattr_getpshared): Likewise. - - * mutex.c (pthread_mutex_init): Implement. - (pthread_mutex_destroy): Likewise. - (pthread_lock): Likewise. - (pthread_trylock): Likewise. - (pthread_unlock): Likewise. - -1998-07-12 Ben Elliston - - * implement.h (ptw32_mutexattr_t): Define this implementation - internal type. Application programmers only see a mutex attribute - object as a void pointer. - - * pthread.h (pthread_mutexattr_t): Define this type. - (pthread_mutexattr_init): Add function prototype. - (pthread_mutexattr_destroy): Likewise. - (pthread_mutexattr_setpshared): Likewise. - (pthread_mutexattr_getpshared): Likewise. - (pthread_mutexattr_setprotocol): Likewise. - (pthread_mutexattr_getprotocol): Likewise. - (pthread_mutexattr_setprioceiling): Likewise. - (pthread_mutexattr_getprioceiling): Likewise. - (PTHREAD_PROCESS_PRIVATE): Define. - (PTHREAD_PROCESS_SHARED): Define. - - * mutex.c (pthread_mutexattr_init): Implement. - (pthread_mutexattr_destroy): Implement. - (pthread_mutexattr_setprotocol): Implement. - (pthread_mutexattr_getprotocol): Likewise. - (pthread_mutexattr_setprioceiling): Likewise. - (pthread_mutexattr_getprioceiling): Likewise. - (pthread_mutexattr_setpshared): Likewise. - (pthread_mutexattr_getpshared): Likewise. - (insert_attr): New function; very preliminary implementation! - (is_attr): Likewise. - (remove_attr): Likewise. - -Sat Jul 11 14:48:54 1998 Ross Johnson - - * implement.h: Preliminary implementation specific defines. - - * create.c (pthread_create): Preliminary implementation. - -1998-07-11 Ben Elliston - - * sync.c (pthread_join): Implement. - - * misc.c (pthread_equal): Likewise. - - * pthread.h (pthread_join): Add function prototype. - (pthread_equal): Likewise. - -1998-07-10 Ben Elliston - - * misc.c (pthread_self): Implement. - - * exit.c (pthread_exit): Implement. - - * pthread.h (pthread_exit): Add function prototype. - (pthread_self): Likewise. - (pthread_t): Define this type. - -1998-07-09 Ben Elliston - - * create.c (pthread_create): A dummy stub right now. - - * pthread.h (pthread_create): Add function prototype. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/FAQ b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/FAQ deleted file mode 100644 index 4f2d449b92f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/FAQ +++ /dev/null @@ -1,403 +0,0 @@ - ========================================= - PTHREADS-WIN32 Frequently Asked Questions - ========================================= - -INDEX ------ - -Q 1 What is it? - -Q 2 Which of the several dll versions do I use? - or, - What are all these pthread*.dll and pthread*.lib files? - -Q 3 What is the library naming convention? - -Q 4 Cleanup code default style or: it used to work when I built - the library myself, but now it doesn't - why? - -Q 5 Why is the default library version now less exception-friendly? - -Q 6 Should I use Cygwin or Mingw32 as a development environment? - -Q 7 Now that pthreads-win32 builds under Mingw32, why do I get - memory access violations (segfaults)? - -Q 8 How do I use pthread.dll for Win32 (Visual C++ 5.0) - -Q 9 Cancelation doesn't work for me, why? - -Q 10 How do I generate pthreadGCE.dll and libpthreadw32.a for use - with Mingw32? - -============================================================================= - -Q 1 What is it? ---- - -Pthreads-win32 is an Open Source Software implementation of the -Threads component of the POSIX 1003.1c 1995 Standard for Microsoft's -Win32 environment. Some functions from POSIX 1003.1b are also -supported including semaphores. Other related functions include -the set of read-write lock functions. The library also supports -some of the functionality of the Open Group's Single Unix -specification, version 2, namely mutex types. - -See the file "ANNOUNCE" for more information including standards -conformance details and list of supported routines. - - ------------------------------------------------------------------------------- - -Q 2 Which of the several dll versions do I use? ---- or, - What are all these pthread*.dll and pthread*.lib files? - -Simply, you only use one of them, but you need to choose carefully. - -The most important choice you need to make is whether to use a -version that uses exceptions internally, or not (there are versions -of the library that use exceptions as part of the thread -cancelation and cleanup implementation, and one that uses -setjmp/longjmp instead). - -There is some contension amongst POSIX threads experts as -to how POSIX threads cancelation and exit should work -with languages that include exceptions and handlers, e.g. -C++ and even C (Microsoft's Structured Exceptions). - -The issue is: should cancelation of a thread in, say, -a C++ application cause object destructors and C++ exception -handlers to be invoked as the stack unwinds during thread -exit, or not? - -There seems to be more opinion in favour of using the -standard C version of the library (no EH) with C++ applications -since this appears to be the assumption commercial pthreads -implementations make. Therefore, if you use an EH version -of pthreads-win32 then you may be under the illusion that -your application will be portable, when in fact it is likely to -behave very differently linked with other pthreads libraries. - -Now you may be asking: why have you kept the EH versions of -the library? - -There are a couple of reasons: -- there is division amongst the experts and so the code may - be needed in the future. (Yes, it's in the repository and we - can get it out anytime in the future, but ...) -- pthreads-win32 is one of the few implementations, and possibly - the only freely available one, that has EH versions. It may be - useful to people who want to play with or study application - behaviour under these conditions. - - ------------------------------------------------------------------------------- - -Q 3 What is the library naming convention? ---- - -Because the library is being built using various exception -handling schemes and compilers - and because the library -may not work reliably if these are mixed in an application, -each different version of the library has it's own name. - -Note 1: the incompatibility is really between EH implementations -of the different compilers. It should be possible to use the -standard C version from either compiler with C++ applications -built with a different compiler. If you use an EH version of -the library, then you must use the same compiler for the -application. This is another complication and dependency that -can be avoided by using only the standard C library version. - -Note 2: if you use a standard C pthread*.dll with a C++ -application, then any functions that you define that are -intended to be called via pthread_cleanup_push() must be -__cdecl. - -Note 3: the intention is to also name either the VC or GC -version (it should be arbitrary) as pthread.dll, including -pthread.lib and libpthread.a as appropriate. - -In general: - pthread[VG]{SE,CE,C}.dll - pthread[VG]{SE,CE,C}.lib - -where: - [VG] indicates the compiler - V - MS VC - G - GNU C - - {SE,CE,C} indicates the exception handling scheme - SE - Structured EH - CE - C++ EH - C - no exceptions - uses setjmp/longjmp - -For example: - pthreadVSE.dll (MSVC/SEH) - pthreadGCE.dll (GNUC/C++ EH) - pthreadGC.dll (GNUC/not dependent on exceptions) - -The GNU library archive file names have changed to: - - libpthreadGCE.a - libpthreadGC.a - - ------------------------------------------------------------------------------- - -Q 4 Cleanup code default style or: it used to work when I built ---- the library myself, but now it doesn't - why? - -Up to and including snapshot 2001-07-12, if not defined, the cleanup -style was determined automatically from the compiler used, and one -of the following was defined accordingly: - - __CLEANUP_SEH MSVC only - __CLEANUP_CXX C++, including MSVC++, GNU G++ - __CLEANUP_C C, including GNU GCC, not MSVC - -These defines determine the style of cleanup (see pthread.h) and, -most importantly, the way that cancelation and thread exit (via -pthread_exit) is performed (see the routine ptw32_throw() in private.c). - -In short, the exceptions versions of the library throw an exception -when a thread is canceled or exits (via pthread_exit()), which is -caught by a handler in the thread startup routine, so that the -the correct stack unwinding occurs regardless of where the thread -is when it's canceled or exits via pthread_exit(). - -After snapshot 2001-07-12, unless your build explicitly defines (e.g. -via a compiler option) __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then -the build now ALWAYS defaults to __CLEANUP_C style cleanup. This style -uses setjmp/longjmp in the cancelation and pthread_exit implementations, -and therefore won't do stack unwinding even when linked to applications -that have it (e.g. C++ apps). This is for consistency with most/all -commercial Unix POSIX threads implementations. - -Although it was not clearly documented before, it is still necessary to -build your application using the same __CLEANUP_* define as was -used for the version of the library that you link with, so that the -correct parts of pthread.h are included. That is, the possible -defines require the following library versions: - - __CLEANUP_SEH pthreadVSE.dll - __CLEANUP_CXX pthreadVCE.dll or pthreadGCE.dll - __CLEANUP_C pthreadVC.dll or pthreadGC.dll - -THE POINT OF ALL THIS IS: if you have not been defining one of these -explicitly, then the defaults have been set according to the compiler -and language you are using, as described at the top of this -section. - -THIS NOW CHANGES, as has been explained above. For example: - -If you were building your application with MSVC++ i.e. using C++ -exceptions (rather than SEH) and not explicitly defining one of -__CLEANUP_*, then __CLEANUP_C++ was defined for you in pthread.h. -You should have been linking with pthreadVCE.dll, which does -stack unwinding. - -If you now build your application as you had before, pthread.h will now -set __CLEANUP_C as the default style, and you will need to link -with pthreadVC.dll. Stack unwinding will now NOT occur when a -thread is canceled, nor when the thread calls pthread_exit(). - -Your application will now most likely behave differently to previous -versions, and in non-obvious ways. Most likely is that local -objects may not be destroyed or cleaned up after a thread -is canceled. - -If you want the same behaviour as before, then you must now define -__CLEANUP_C++ explicitly using a compiler option and link with -pthreadVCE.dll as you did before. - - ------------------------------------------------------------------------------- - -Q 5 Why is the default library version now less exception-friendly? ---- - -Because most commercial Unix POSIX threads implementations don't allow you to -choose to have stack unwinding. (Compaq's TRU64 Unix is possibly an exception.) - -Therefore, providing it in pthread-win32 as a default could be dangerous -and non-portable. We still provide the choice but you must now consciously -make it. - -WHY NOT REMOVE THE EXCEPTIONS VERSIONS OF THE LIBRARY ALTOGETHER? -There are a few reasons: -- because there are well respected POSIX threads people who believe - that POSIX threads implementations should be exceptions-aware and - do the expected thing in that context. (There are equally respected - people who believe it should not be easily accessible, if it's there - at all.) -- because pthreads-win32 is one of the few implementations that has - the choice, perhaps the only freely available one, and so offers - a laboratory to people who may want to explore the effects; -- although the code will always be around somewhere for anyone who - wants it, once it's removed from the current version it will not be - nearly as visible to people who may have a use for it. - - ------------------------------------------------------------------------------- - -Q 6 Should I use Cygwin or Mingw32 as a development environment? ---- - -Important: see Q7 also. - -Use Mingw32 with the MSVCRT library to build applications that use -the pthreads DLL. - -Cygwin's own internal support for POSIX threads is growing. -Consult that project's documentation for more information. - ------------------------------------------------------------------------------- - -Q 7 Now that pthreads-win32 builds under Mingw32, why do I get ---- memory access violations (segfaults)? - -The latest Mingw32 package has thread-safe exception handling (see Q10). -Also, see Q6 above. - ------------------------------------------------------------------------------- - -Q 8 How do I use pthread.dll for Win32 (Visual C++ 5.0) ---- - -> -> I'm a "rookie" when it comes to your pthread implementation. I'm currently -> desperately trying to install the prebuilt .dll file into my MSVC compiler. -> Could you please provide me with explicit instructions on how to do this (or -> direct me to a resource(s) where I can acquire such information)? -> -> Thank you, -> - -You should have a .dll, .lib, .def, and three .h files. It is recommended -that you use pthreadVC.dll, rather than pthreadVCE.dll or pthreadVSE.dll -(see Q2 above). - -The .dll can go in any directory listed in your PATH environment -variable, so putting it into C:\WINDOWS should work. - -The .lib file can go in any directory listed in your LIB environment -variable. - -The .h files can go in any directory listed in your INCLUDE -environment variable. - -Or you might prefer to put the .lib and .h files into a new directory -and add its path to LIB and INCLUDE. You can probably do this easiest -by editing the file:- - -C:\Program Files\DevStudio\vc\bin\vcvars32.bat - -The .def file isn't used by anything in the pre-compiled version but -is included for information. - -Cheers. -Ross - ------------------------------------------------------------------------------- - -Q 9 Cancelation doesn't work for me, why? ---- - -> I'm investigating a problem regarding thread cancelation. The thread I want -> to cancel has PTHREAD_CANCEL_ASYNCHRONOUS, however, this piece of code -> blocks on the join(): -> -> if ((retv = Pthread_cancel( recvThread )) == 0) -> { -> retv = Pthread_join( recvThread, 0 ); -> } -> -> Pthread_* are just macro's; they call pthread_*. -> -> The thread recvThread seems to block on a select() call. It doesn't get -> cancelled. -> -> Two questions: -> -> 1) is this normal behaviour? -> -> 2) if not, how does the cancel mechanism work? I'm not very familliar to -> win32 programming, so I don't really understand how the *Event() family of -> calls work. - -The answer to your first question is, normal POSIX behaviour would -be to asynchronously cancel the thread. However, even that doesn't -guarantee cancelation as the standard only says it should be -cancelled as soon as possible. - -Snapshot 99-11-02 or earlier only partially supports asynchronous cancellation. -Snapshots since then simulate async cancelation by poking the address of -a cancelation routine into the PC of the threads context. This requires -the thread to be resumed in some way for the cancelation to actually -proceed. This is not true async cancelation, but it is as close as we've -been able to get to it. - -If the thread you're trying to cancel is blocked (for instance, it could be -waiting for data from the network), it will only get cancelled when it unblocks -(when the data arrives). For true pre-emptive cancelation in these cases, -pthreads-win32 from snapshot 2004-05-16 can automatically recognise and use the -QueueUserAPCEx package by Panagiotis E. Hadjidoukas. This package is available -from the pthreads-win32 ftp site and is included in the pthreads-win32 -self-unpacking zip from 2004-05-16 onwards. - -Using deferred cancelation would normally be the way to go, however, -even though the POSIX threads standard lists a number of C library -functions that are defined as deferred cancelation points, there is -no hookup between those which are provided by Windows and the -pthreads-win32 library. - -Incidently, it's worth noting for code portability that the older POSIX -threads standards cancelation point lists didn't include "select" because -(as I read in Butenhof) it wasn't part of POSIX. However, it does appear in -the SUSV3. - -Effectively, the only mandatory cancelation points that pthreads-win32 -recognises are those the library implements itself, ie. - - pthread_testcancel - pthread_cond_wait - pthread_cond_timedwait - pthread_join - sem_wait - sem_timedwait - pthread_delay_np - -The following routines from the non-mandatory list in SUSV3 are -cancelation points in pthreads-win32: - - pthread_rwlock_wrlock - pthread_rwlock_timedwrlock - -The following routines from the non-mandatory list in SUSV3 are not -cancelation points in pthreads-win32: - - pthread_rwlock_rdlock - pthread_rwlock_timedrdlock - -Pthreads-win32 also provides two functions that allow you to create -cancelation points within your application, but only for cases where -a thread is going to block on a Win32 handle. These are: - - pthreadCancelableWait(HANDLE waitHandle) /* Infinite wait */ - - pthreadCancelableTimedWait(HANDLE waitHandle, DWORD timeout) - ------------------------------------------------------------------------------- - - -Q 10 How do I create thread-safe applications using ----- pthreadGCE.dll, libpthreadw32.a and Mingw32? - -This should not be a problem with recent versions of MinGW32. - -For early versions, see Thomas Pfaff's email at: -http://sources.redhat.com/ml/pthreads-win32/2002/msg00000.html ------------------------------------------------------------------------------- - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/GNUmakefile b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/GNUmakefile deleted file mode 100644 index 6c48fd23cc7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/GNUmakefile +++ /dev/null @@ -1,583 +0,0 @@ -# -# -------------------------------------------------------------------------- -# -# Pthreads-win32 - POSIX Threads Library for Win32 -# Copyright(C) 1998 John E. Bossom -# Copyright(C) 1999,2005 Pthreads-win32 contributors -# -# Contact Email: rpj@callisto.canberra.edu.au -# -# The current list of contributors is contained -# in the file CONTRIBUTORS included with the source -# code distribution. The list can also be seen at the -# following World Wide Web location: -# http://sources.redhat.com/pthreads-win32/contributors.html -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library in the file COPYING.LIB; -# if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -# - -DLL_VER = 2 -DLL_VERD= $(DLL_VER)d - -DEVROOT = C:\PTHREADS - -DLLDEST = $(DEVROOT)\DLL -LIBDEST = $(DEVROOT)\DLL - -# If Running MsysDTK -RM = rm -f -MV = mv -f -CP = cp -f - -# If not. -#RM = erase -#MV = rename -#CP = copy - -# For cross compiling use e.g. -# make CROSS=i386-mingw32msvc- clean GC-inlined -CROSS = - -AR = $(CROSS)ar -DLLTOOL = $(CROSS)dlltool -CC = $(CROSS)gcc -CXX = $(CROSS)g++ -RANLIB = $(CROSS)ranlib -RC = $(CROSS)windres - -OPT = $(CLEANUP) -O3 -finline-functions -DOPT = $(CLEANUP) -g -O0 -XOPT = - -RCFLAGS = --include-dir=. -LFLAGS = -lwsock32 - -# ---------------------------------------------------------------------- -# The library can be built with some alternative behaviour to -# facilitate development of applications on Win32 that will be ported -# to other POSIX systems. Nothing definable here will make the library -# non-compliant, but applications that make assumptions that POSIX -# does not garrantee may fail or misbehave under some settings. -# -# PTW32_THREAD_ID_REUSE_INCREMENT -# Purpose: -# POSIX says that applications should assume that thread IDs can be -# recycled. However, Solaris and some other systems use a [very large] -# sequence number as the thread ID, which provides virtual uniqueness. -# Pthreads-win32 provides pseudo-unique IDs when the default increment -# (1) is used, but pthread_t is not a scalar type like Solaris's. -# -# Usage: -# Set to any value in the range: 0 <= value <= 2^wordsize -# -# Examples: -# Set to 0 to emulate non recycle-unique behaviour like Linux or *BSD. -# Set to 1 for recycle-unique thread IDs (this is the default). -# Set to some other +ve value to emulate smaller word size types -# (i.e. will wrap sooner). -# -#PTW32_FLAGS = "-DPTW32_THREAD_ID_REUSE_INCREMENT=0" -# -# ---------------------------------------------------------------------- - -GC_CFLAGS = $(PTW32_FLAGS) -GCE_CFLAGS = $(PTW32_FLAGS) -mthreads - -## Mingw32 -MAKE ?= make -CFLAGS = $(OPT) $(XOPT) -I. -DHAVE_CONFIG_H -Wall - -DLL_INLINED_OBJS = \ - pthread.o \ - version.o - -# Agregate modules for inlinability -DLL_OBJS = \ - attr.o \ - barrier.o \ - cancel.o \ - cleanup.o \ - condvar.o \ - create.o \ - dll.o \ - errno.o \ - exit.o \ - fork.o \ - global.o \ - misc.o \ - mutex.o \ - nonportable.o \ - private.o \ - rwlock.o \ - sched.o \ - semaphore.o \ - signal.o \ - spin.o \ - sync.o \ - tsd.o \ - version.o - -# Separate modules for minimum size statically linked images -SMALL_STATIC_OBJS = \ - pthread_attr_init.o \ - pthread_attr_destroy.o \ - pthread_attr_getdetachstate.o \ - pthread_attr_setdetachstate.o \ - pthread_attr_getstackaddr.o \ - pthread_attr_setstackaddr.o \ - pthread_attr_getstacksize.o \ - pthread_attr_setstacksize.o \ - pthread_attr_getscope.o \ - pthread_attr_setscope.o \ - pthread_attr_setschedpolicy.o \ - pthread_attr_getschedpolicy.o \ - pthread_attr_setschedparam.o \ - pthread_attr_getschedparam.o \ - pthread_attr_setinheritsched.o \ - pthread_attr_getinheritsched.o \ - pthread_barrier_init.o \ - pthread_barrier_destroy.o \ - pthread_barrier_wait.o \ - pthread_barrierattr_init.o \ - pthread_barrierattr_destroy.o \ - pthread_barrierattr_setpshared.o \ - pthread_barrierattr_getpshared.o \ - pthread_setcancelstate.o \ - pthread_setcanceltype.o \ - pthread_testcancel.o \ - pthread_cancel.o \ - cleanup.o \ - pthread_condattr_destroy.o \ - pthread_condattr_getpshared.o \ - pthread_condattr_init.o \ - pthread_condattr_setpshared.o \ - pthread_cond_destroy.o \ - pthread_cond_init.o \ - pthread_cond_signal.o \ - pthread_cond_wait.o \ - create.o \ - dll.o \ - errno.o \ - pthread_exit.o \ - fork.o \ - global.o \ - pthread_mutex_init.o \ - pthread_mutex_destroy.o \ - pthread_mutexattr_init.o \ - pthread_mutexattr_destroy.o \ - pthread_mutexattr_getpshared.o \ - pthread_mutexattr_setpshared.o \ - pthread_mutexattr_settype.o \ - pthread_mutexattr_gettype.o \ - pthread_mutex_lock.o \ - pthread_mutex_timedlock.o \ - pthread_mutex_unlock.o \ - pthread_mutex_trylock.o \ - pthread_mutexattr_setkind_np.o \ - pthread_mutexattr_getkind_np.o \ - pthread_getw32threadhandle_np.o \ - pthread_delay_np.o \ - pthread_num_processors_np.o \ - pthread_win32_attach_detach_np.o \ - pthread_equal.o \ - pthread_getconcurrency.o \ - pthread_once.o \ - pthread_self.o \ - pthread_setconcurrency.o \ - pthread_rwlock_init.o \ - pthread_rwlock_destroy.o \ - pthread_rwlockattr_init.o \ - pthread_rwlockattr_destroy.o \ - pthread_rwlockattr_getpshared.o \ - pthread_rwlockattr_setpshared.o \ - pthread_rwlock_rdlock.o \ - pthread_rwlock_wrlock.o \ - pthread_rwlock_unlock.o \ - pthread_rwlock_tryrdlock.o \ - pthread_rwlock_trywrlock.o \ - pthread_setschedparam.o \ - pthread_getschedparam.o \ - pthread_timechange_handler_np.o \ - ptw32_is_attr.o \ - ptw32_cond_check_need_init.o \ - ptw32_MCS_lock.o \ - ptw32_mutex_check_need_init.o \ - ptw32_processInitialize.o \ - ptw32_processTerminate.o \ - ptw32_threadStart.o \ - ptw32_threadDestroy.o \ - ptw32_tkAssocCreate.o \ - ptw32_tkAssocDestroy.o \ - ptw32_callUserDestroyRoutines.o \ - ptw32_timespec.o \ - ptw32_throw.o \ - ptw32_InterlockedCompareExchange.o \ - ptw32_getprocessors.o \ - ptw32_calloc.o \ - ptw32_new.o \ - ptw32_reuse.o \ - ptw32_semwait.o \ - ptw32_relmillisecs.o \ - ptw32_rwlock_check_need_init.o \ - sched_get_priority_max.o \ - sched_get_priority_min.o \ - sched_setscheduler.o \ - sched_getscheduler.o \ - sched_yield.o \ - sem_init.o \ - sem_destroy.o \ - sem_trywait.o \ - sem_timedwait.o \ - sem_wait.o \ - sem_post.o \ - sem_post_multiple.o \ - sem_getvalue.o \ - sem_open.o \ - sem_close.o \ - sem_unlink.o \ - signal.o \ - pthread_kill.o \ - ptw32_spinlock_check_need_init.o \ - pthread_spin_init.o \ - pthread_spin_destroy.o \ - pthread_spin_lock.o \ - pthread_spin_unlock.o \ - pthread_spin_trylock.o \ - pthread_detach.o \ - pthread_join.o \ - pthread_key_create.o \ - pthread_key_delete.o \ - pthread_setspecific.o \ - pthread_getspecific.o \ - w32_CancelableWait.o \ - version.o - -INCL = \ - config.h \ - implement.h \ - semaphore.h \ - pthread.h \ - need_errno.h - -ATTR_SRCS = \ - pthread_attr_init.c \ - pthread_attr_destroy.c \ - pthread_attr_getdetachstate.c \ - pthread_attr_setdetachstate.c \ - pthread_attr_getstackaddr.c \ - pthread_attr_setstackaddr.c \ - pthread_attr_getstacksize.c \ - pthread_attr_setstacksize.c \ - pthread_attr_getscope.c \ - pthread_attr_setscope.c - -BARRIER_SRCS = \ - pthread_barrier_init.c \ - pthread_barrier_destroy.c \ - pthread_barrier_wait.c \ - pthread_barrierattr_init.c \ - pthread_barrierattr_destroy.c \ - pthread_barrierattr_setpshared.c \ - pthread_barrierattr_getpshared.c - -CANCEL_SRCS = \ - pthread_setcancelstate.c \ - pthread_setcanceltype.c \ - pthread_testcancel.c \ - pthread_cancel.c - -CONDVAR_SRCS = \ - ptw32_cond_check_need_init.c \ - pthread_condattr_destroy.c \ - pthread_condattr_getpshared.c \ - pthread_condattr_init.c \ - pthread_condattr_setpshared.c \ - pthread_cond_destroy.c \ - pthread_cond_init.c \ - pthread_cond_signal.c \ - pthread_cond_wait.c - -EXIT_SRCS = \ - pthread_exit.c - -MISC_SRCS = \ - pthread_equal.c \ - pthread_getconcurrency.c \ - pthread_kill.c \ - pthread_once.c \ - pthread_self.c \ - pthread_setconcurrency.c \ - ptw32_calloc.c \ - ptw32_MCS_lock.c \ - ptw32_new.c \ - ptw32_reuse.c \ - w32_CancelableWait.c - -MUTEX_SRCS = \ - ptw32_mutex_check_need_init.c \ - pthread_mutex_init.c \ - pthread_mutex_destroy.c \ - pthread_mutexattr_init.c \ - pthread_mutexattr_destroy.c \ - pthread_mutexattr_getpshared.c \ - pthread_mutexattr_setpshared.c \ - pthread_mutexattr_settype.c \ - pthread_mutexattr_gettype.c \ - pthread_mutex_lock.c \ - pthread_mutex_timedlock.c \ - pthread_mutex_unlock.c \ - pthread_mutex_trylock.c - -NONPORTABLE_SRCS = \ - pthread_mutexattr_setkind_np.c \ - pthread_mutexattr_getkind_np.c \ - pthread_getw32threadhandle_np.c \ - pthread_delay_np.c \ - pthread_num_processors_np.c \ - pthread_win32_attach_detach_np.c \ - pthread_timechange_handler_np.c - -PRIVATE_SRCS = \ - ptw32_is_attr.c \ - ptw32_processInitialize.c \ - ptw32_processTerminate.c \ - ptw32_threadStart.c \ - ptw32_threadDestroy.c \ - ptw32_tkAssocCreate.c \ - ptw32_tkAssocDestroy.c \ - ptw32_callUserDestroyRoutines.c \ - ptw32_semwait.c \ - ptw32_relmillisecs.c \ - ptw32_timespec.c \ - ptw32_throw.c \ - ptw32_InterlockedCompareExchange.c \ - ptw32_getprocessors.c - -RWLOCK_SRCS = \ - ptw32_rwlock_check_need_init.c \ - ptw32_rwlock_cancelwrwait.c \ - pthread_rwlock_init.c \ - pthread_rwlock_destroy.c \ - pthread_rwlockattr_init.c \ - pthread_rwlockattr_destroy.c \ - pthread_rwlockattr_getpshared.c \ - pthread_rwlockattr_setpshared.c \ - pthread_rwlock_rdlock.c \ - pthread_rwlock_timedrdlock.c \ - pthread_rwlock_wrlock.c \ - pthread_rwlock_timedwrlock.c \ - pthread_rwlock_unlock.c \ - pthread_rwlock_tryrdlock.c \ - pthread_rwlock_trywrlock.c - -SCHED_SRCS = \ - pthread_attr_setschedpolicy.c \ - pthread_attr_getschedpolicy.c \ - pthread_attr_setschedparam.c \ - pthread_attr_getschedparam.c \ - pthread_attr_setinheritsched.c \ - pthread_attr_getinheritsched.c \ - pthread_setschedparam.c \ - pthread_getschedparam.c \ - sched_get_priority_max.c \ - sched_get_priority_min.c \ - sched_setscheduler.c \ - sched_getscheduler.c \ - sched_yield.c - -SEMAPHORE_SRCS = \ - sem_init.c \ - sem_destroy.c \ - sem_trywait.c \ - sem_timedwait.c \ - sem_wait.c \ - sem_post.c \ - sem_post_multiple.c \ - sem_getvalue.c \ - sem_open.c \ - sem_close.c \ - sem_unlink.c - -SPIN_SRCS = \ - ptw32_spinlock_check_need_init.c \ - pthread_spin_init.c \ - pthread_spin_destroy.c \ - pthread_spin_lock.c \ - pthread_spin_unlock.c \ - pthread_spin_trylock.c - -SYNC_SRCS = \ - pthread_detach.c \ - pthread_join.c - -TSD_SRCS = \ - pthread_key_create.c \ - pthread_key_delete.c \ - pthread_setspecific.c \ - pthread_getspecific.c - - -GCE_DLL = pthreadGCE$(DLL_VER).dll -GCED_DLL= pthreadGCE$(DLL_VERD).dll -GCE_LIB = libpthreadGCE$(DLL_VER).a -GCED_LIB= libpthreadGCE$(DLL_VERD).a -GCE_INLINED_STAMP = pthreadGCE$(DLL_VER).stamp -GCED_INLINED_STAMP = pthreadGCE$(DLL_VERD).stamp - -GC_DLL = pthreadGC$(DLL_VER).dll -GCD_DLL = pthreadGC$(DLL_VERD).dll -GC_LIB = libpthreadGC$(DLL_VER).a -GCD_LIB = libpthreadGC$(DLL_VERD).a -GC_INLINED_STAMP = pthreadGC$(DLL_VER).stamp -GCD_INLINED_STAMP = pthreadGC$(DLL_VERD).stamp -GC_STATIC_STAMP = libpthreadGC$(DLL_VER).stamp -GCD_STATIC_STAMP = libpthreadGC$(DLL_VERD).stamp - -PTHREAD_DEF = pthread.def - -help: - @ echo "Run one of the following command lines:" - @ echo "make clean GC (to build the GNU C dll with C cleanup code)" - @ echo "make clean GCE (to build the GNU C dll with C++ exception handling)" - @ echo "make clean GC-inlined (to build the GNU C inlined dll with C cleanup code)" - @ echo "make clean GCE-inlined (to build the GNU C inlined dll with C++ exception handling)" - @ echo "make clean GC-static (to build the GNU C inlined static lib with C cleanup code)" - @ echo "make clean GC-debug (to build the GNU C debug dll with C cleanup code)" - @ echo "make clean GCE-debug (to build the GNU C debug dll with C++ exception handling)" - @ echo "make clean GC-inlined-debug (to build the GNU C inlined debug dll with C cleanup code)" - @ echo "make clean GCE-inlined-debug (to build the GNU C inlined debug dll with C++ exception handling)" - @ echo "make clean GC-static-debug (to build the GNU C inlined static debug lib with C cleanup code)" - -all: - @ $(MAKE) clean GCE - @ $(MAKE) clean GC - -GC: - $(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL) - -GC-debug: - $(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_DLL) - -GCE: - $(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL) - -GCE-debug: - $(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_DLL) - -GC-inlined: - $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP) - -GC-inlined-debug: - $(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_INLINED_STAMP) - -GCE-inlined: - $(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP) - -GCE-inlined-debug: - $(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_INLINED_STAMP) - -GC-static: - $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP) - -GC-static-debug: - $(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_STATIC_STAMP) - -tests: - @ cd tests - @ $(MAKE) auto - -%.pre: %.c - $(CC) -E -o $@ $(CFLAGS) $^ - -%.s: %.c - $(CC) -c $(CFLAGS) -DPTW32_BUILD_INLINED -Wa,-ahl $^ > $@ - -%.o: %.rc - $(RC) $(RCFLAGS) $(CLEANUP) -o $@ $< - -.SUFFIXES: .dll .rc .c .o - -.c.o:; $(CC) -c -o $@ $(CFLAGS) $(XC_FLAGS) $< - - -$(GC_DLL) $(GCD_DLL): $(DLL_OBJS) - $(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS) - $(DLLTOOL) -z pthread.def $(DLL_OBJS) - $(DLLTOOL) -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF) - -$(GCE_DLL): $(DLL_OBJS) - $(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS) - $(DLLTOOL) -z pthread.def $(DLL_OBJS) - $(DLLTOOL) -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) - -$(GC_INLINED_STAMP) $(GCD_INLINED_STAMP): $(DLL_INLINED_OBJS) - $(CC) $(OPT) $(XOPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS) - $(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS) - $(DLLTOOL) -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF) - echo touched > $(GC_INLINED_STAMP) - -$(GCE_INLINED_STAMP) $(GCED_INLINED_STAMP): $(DLL_INLINED_OBJS) - $(CC) $(OPT) $(XOPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS) $(LFLAGS) - $(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS) - $(DLLTOOL) -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF) - echo touched > $(GCE_INLINED_STAMP) - -$(GC_STATIC_STAMP) $(GCD_STATIC_STAMP): $(DLL_INLINED_OBJS) - $(RM) $(GC_LIB) - $(AR) -rv $(GC_LIB) $(DLL_INLINED_OBJS) - $(RANLIB) $(GC_LIB) - echo touched > $(GC_STATIC_STAMP) - -clean: - -$(RM) *~ - -$(RM) *.i - -$(RM) *.o - -$(RM) *.obj - -$(RM) *.exe - -$(RM) $(PTHREAD_DEF) - -realclean: clean - -$(RM) $(GC_LIB) - -$(RM) $(GCE_LIB) - -$(RM) $(GC_DLL) - -$(RM) $(GCE_DLL) - -$(RM) $(GC_INLINED_STAMP) - -$(RM) $(GCE_INLINED_STAMP) - -$(RM) $(GC_STATIC_STAMP) - -$(RM) $(GCD_LIB) - -$(RM) $(GCED_LIB) - -$(RM) $(GCD_DLL) - -$(RM) $(GCED_DLL) - -$(RM) $(GCD_INLINED_STAMP) - -$(RM) $(GCED_INLINED_STAMP) - -$(RM) $(GCD_STATIC_STAMP) - -attr.o: attr.c $(ATTR_SRCS) $(INCL) -barrier.o: barrier.c $(BARRIER_SRCS) $(INCL) -cancel.o: cancel.c $(CANCEL_SRCS) $(INCL) -condvar.o: condvar.c $(CONDVAR_SRCS) $(INCL) -exit.o: exit.c $(EXIT_SRCS) $(INCL) -misc.o: misc.c $(MISC_SRCS) $(INCL) -mutex.o: mutex.c $(MUTEX_SRCS) $(INCL) -nonportable.o: nonportable.c $(NONPORTABLE_SRCS) $(INCL) -private.o: private.c $(PRIVATE_SRCS) $(INCL) -rwlock.o: rwlock.c $(RWLOCK_SRCS) $(INCL) -sched.o: sched.c $(SCHED_SRCS) $(INCL) -semaphore.o: semaphore.c $(SEMAPHORE_SRCS) $(INCL) -spin.o: spin.c $(SPIN_SRCS) $(INCL) -sync.o: sync.c $(SYNC_SRCS) $(INCL) -tsd.o: tsd.c $(TSD_SRCS) $(INCL) -version.o: version.rc $(INCL) diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/MAINTAINERS b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/MAINTAINERS deleted file mode 100644 index d253c1f69e7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/MAINTAINERS +++ /dev/null @@ -1,4 +0,0 @@ -CVS Repository maintainers - -Ross Johnson rpj@ise.canberra.edu.au -Ben Elliston bje@cygnus.com diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Makefile b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Makefile deleted file mode 100644 index f10cbef10bf..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Makefile +++ /dev/null @@ -1,504 +0,0 @@ -# This makefile is compatible with MS nmake and can be used as a -# replacement for buildlib.bat. I've changed the target from an ordinary dll -# (/LD) to a debugging dll (/LDd). -# -# The variables $DLLDEST and $LIBDEST hold the destination directories for the -# dll and the lib, respectively. Probably all that needs to change is $DEVROOT. - - -# DLL_VER: -# See pthread.h and README - This number is computed as 'current - age' -DLL_VER = 2 -DLL_VERD= $(DLL_VER)d - -DEVROOT = .\ - -DLLDEST = $(DEVROOT)\DLL -LIBDEST = $(DEVROOT)\LIB -HDRDEST = $(DEVROOT)\INCLUDE - -DLLS = pthreadVCE$(DLL_VER).dll pthreadVSE$(DLL_VER).dll pthreadVC$(DLL_VER).dll \ - pthreadVCE$(DLL_VERD).dll pthreadVSE$(DLL_VERD).dll pthreadVC$(DLL_VERD).dll -INLINED_STAMPS = pthreadVCE$(DLL_VER).stamp pthreadVSE$(DLL_VER).stamp pthreadVC$(DLL_VER).stamp \ - pthreadVCE$(DLL_VERD).stamp pthreadVSE$(DLL_VERD).stamp pthreadVC$(DLL_VERD).stamp -STATIC_STAMPS = pthreadVCE$(DLL_VER).static pthreadVSE$(DLL_VER).static pthreadVC$(DLL_VER).static \ - pthreadVCE$(DLL_VERD).static pthreadVSE$(DLL_VERD).static pthreadVC$(DLL_VERD).static - -OPTIM = /O2 /Ob2 -OPTIMD = - -CFLAGS = /W3 /MD /nologo /I. /D_WIN32_WINNT=0x400 /DHAVE_CONFIG_H /D_CRT_SECURE_NO_WARNINGS -CFLAGSD = /Zi $(CFLAGS) - - -# Default cleanup style -CLEANUP = __CLEANUP_C - -# C++ Exceptions -VCEFLAGS = /GX /TP $(CFLAGS) -VCEFLAGSD = /GX /TP $(CFLAGSD) -#Structured Exceptions -VSEFLAGS = $(CFLAGS) -VSEFLAGSD = $(CFLAGSD) -#C cleanup code -VCFLAGS = $(CFLAGS) -VCFLAGSD= $(CFLAGSD) - -DLL_INLINED_OBJS = \ - pthread.obj \ - version.res - -# Aggregate modules for inlinability -DLL_OBJS = \ - attr.obj \ - barrier.obj \ - cancel.obj \ - cleanup.obj \ - condvar.obj \ - create.obj \ - dll.obj \ - errno.obj \ - exit.obj \ - fork.obj \ - global.obj \ - misc.obj \ - mutex.obj \ - nonportable.obj \ - private.obj \ - rwlock.obj \ - sched.obj \ - semaphore.obj \ - signal.obj \ - spin.obj \ - sync.obj \ - tsd.obj \ - version.res - -# Separate modules for minimising the size of statically linked images -SMALL_STATIC_OBJS = \ - pthread_attr_init.obj \ - pthread_attr_destroy.obj \ - pthread_attr_getdetachstate.obj \ - pthread_attr_setdetachstate.obj \ - pthread_attr_getstackaddr.obj \ - pthread_attr_setstackaddr.obj \ - pthread_attr_getstacksize.obj \ - pthread_attr_setstacksize.obj \ - pthread_attr_getscope.obj \ - pthread_attr_setscope.obj \ - pthread_attr_setschedpolicy.obj \ - pthread_attr_getschedpolicy.obj \ - pthread_attr_setschedparam.obj \ - pthread_attr_getschedparam.obj \ - pthread_attr_setinheritsched.obj \ - pthread_attr_getinheritsched.obj \ - pthread_barrier_init.obj \ - pthread_barrier_destroy.obj \ - pthread_barrier_wait.obj \ - pthread_barrierattr_init.obj \ - pthread_barrierattr_destroy.obj \ - pthread_barrierattr_setpshared.obj \ - pthread_barrierattr_getpshared.obj \ - pthread_setcancelstate.obj \ - pthread_setcanceltype.obj \ - pthread_testcancel.obj \ - pthread_cancel.obj \ - cleanup.obj \ - pthread_condattr_destroy.obj \ - pthread_condattr_getpshared.obj \ - pthread_condattr_init.obj \ - pthread_condattr_setpshared.obj \ - pthread_cond_destroy.obj \ - pthread_cond_init.obj \ - pthread_cond_signal.obj \ - pthread_cond_wait.obj \ - create.obj \ - dll.obj \ - errno.obj \ - pthread_exit.obj \ - fork.obj \ - global.obj \ - pthread_mutex_init.obj \ - pthread_mutex_destroy.obj \ - pthread_mutexattr_init.obj \ - pthread_mutexattr_destroy.obj \ - pthread_mutexattr_getpshared.obj \ - pthread_mutexattr_setpshared.obj \ - pthread_mutexattr_settype.obj \ - pthread_mutexattr_gettype.obj \ - pthread_mutex_lock.obj \ - pthread_mutex_timedlock.obj \ - pthread_mutex_unlock.obj \ - pthread_mutex_trylock.obj \ - pthread_mutexattr_setkind_np.obj \ - pthread_mutexattr_getkind_np.obj \ - pthread_getw32threadhandle_np.obj \ - pthread_delay_np.obj \ - pthread_num_processors_np.obj \ - pthread_win32_attach_detach_np.obj \ - pthread_equal.obj \ - pthread_getconcurrency.obj \ - pthread_once.obj \ - pthread_self.obj \ - pthread_setconcurrency.obj \ - pthread_rwlock_init.obj \ - pthread_rwlock_destroy.obj \ - pthread_rwlockattr_init.obj \ - pthread_rwlockattr_destroy.obj \ - pthread_rwlockattr_getpshared.obj \ - pthread_rwlockattr_setpshared.obj \ - pthread_rwlock_rdlock.obj \ - pthread_rwlock_wrlock.obj \ - pthread_rwlock_unlock.obj \ - pthread_rwlock_tryrdlock.obj \ - pthread_rwlock_trywrlock.obj \ - pthread_setschedparam.obj \ - pthread_getschedparam.obj \ - pthread_timechange_handler_np.obj \ - ptw32_is_attr.obj \ - ptw32_processInitialize.obj \ - ptw32_processTerminate.obj \ - ptw32_threadStart.obj \ - ptw32_threadDestroy.obj \ - ptw32_tkAssocCreate.obj \ - ptw32_tkAssocDestroy.obj \ - ptw32_callUserDestroyRoutines.obj \ - ptw32_timespec.obj \ - ptw32_throw.obj \ - ptw32_InterlockedCompareExchange.obj \ - ptw32_getprocessors.obj \ - ptw32_calloc.obj \ - ptw32_new.obj \ - ptw32_reuse.obj \ - ptw32_rwlock_check_need_init.obj \ - ptw32_cond_check_need_init.obj \ - ptw32_mutex_check_need_init.obj \ - ptw32_semwait.obj \ - ptw32_relmillisecs.obj \ - ptw32_MCS_lock.obj \ - sched_get_priority_max.obj \ - sched_get_priority_min.obj \ - sched_setscheduler.obj \ - sched_getscheduler.obj \ - sched_yield.obj \ - sem_init.obj \ - sem_destroy.obj \ - sem_trywait.obj \ - sem_timedwait.obj \ - sem_wait.obj \ - sem_post.obj \ - sem_post_multiple.obj \ - sem_getvalue.obj \ - sem_open.obj \ - sem_close.obj \ - sem_unlink.obj \ - signal.obj \ - pthread_kill.obj \ - ptw32_spinlock_check_need_init.obj \ - pthread_spin_init.obj \ - pthread_spin_destroy.obj \ - pthread_spin_lock.obj \ - pthread_spin_unlock.obj \ - pthread_spin_trylock.obj \ - pthread_detach.obj \ - pthread_join.obj \ - pthread_key_create.obj \ - pthread_key_delete.obj \ - pthread_setspecific.obj \ - pthread_getspecific.obj \ - w32_CancelableWait.obj \ - version.res - -INCL = config.h implement.h semaphore.h pthread.h need_errno.h - -ATTR_SRCS = \ - pthread_attr_init.c \ - pthread_attr_destroy.c \ - pthread_attr_getdetachstate.c \ - pthread_attr_setdetachstate.c \ - pthread_attr_getstackaddr.c \ - pthread_attr_setstackaddr.c \ - pthread_attr_getstacksize.c \ - pthread_attr_setstacksize.c \ - pthread_attr_getscope.c \ - pthread_attr_setscope.c - -BARRIER_SRCS = \ - pthread_barrier_init.c \ - pthread_barrier_destroy.c \ - pthread_barrier_wait.c \ - pthread_barrierattr_init.c \ - pthread_barrierattr_destroy.c \ - pthread_barrierattr_setpshared.c \ - pthread_barrierattr_getpshared.c - -CANCEL_SRCS = \ - pthread_setcancelstate.c \ - pthread_setcanceltype.c \ - pthread_testcancel.c \ - pthread_cancel.c - -CONDVAR_SRCS = \ - ptw32_cond_check_need_init.c \ - pthread_condattr_destroy.c \ - pthread_condattr_getpshared.c \ - pthread_condattr_init.c \ - pthread_condattr_setpshared.c \ - pthread_cond_destroy.c \ - pthread_cond_init.c \ - pthread_cond_signal.c \ - pthread_cond_wait.c - -EXIT_SRCS = \ - pthread_exit.c - -MISC_SRCS = \ - pthread_equal.c \ - pthread_getconcurrency.c \ - pthread_kill.c \ - pthread_once.c \ - pthread_self.c \ - pthread_setconcurrency.c \ - ptw32_calloc.c \ - ptw32_MCS_lock.c \ - ptw32_new.c \ - ptw32_reuse.c \ - ptw32_relmillisecs.c \ - w32_CancelableWait.c - -MUTEX_SRCS = \ - ptw32_mutex_check_need_init.c \ - pthread_mutex_init.c \ - pthread_mutex_destroy.c \ - pthread_mutexattr_init.c \ - pthread_mutexattr_destroy.c \ - pthread_mutexattr_getpshared.c \ - pthread_mutexattr_setpshared.c \ - pthread_mutexattr_settype.c \ - pthread_mutexattr_gettype.c \ - pthread_mutex_lock.c \ - pthread_mutex_timedlock.c \ - pthread_mutex_unlock.c \ - pthread_mutex_trylock.c - -NONPORTABLE_SRCS = \ - pthread_mutexattr_setkind_np.c \ - pthread_mutexattr_getkind_np.c \ - pthread_getw32threadhandle_np.c \ - pthread_delay_np.c \ - pthread_num_processors_np.c \ - pthread_win32_attach_detach_np.c \ - pthread_timechange_handler_np.c - -PRIVATE_SRCS = \ - ptw32_is_attr.c \ - ptw32_processInitialize.c \ - ptw32_processTerminate.c \ - ptw32_threadStart.c \ - ptw32_threadDestroy.c \ - ptw32_tkAssocCreate.c \ - ptw32_tkAssocDestroy.c \ - ptw32_callUserDestroyRoutines.c \ - ptw32_semwait.c \ - ptw32_timespec.c \ - ptw32_throw.c \ - ptw32_InterlockedCompareExchange.c \ - ptw32_getprocessors.c - -RWLOCK_SRCS = \ - ptw32_rwlock_check_need_init.c \ - ptw32_rwlock_cancelwrwait.c \ - pthread_rwlock_init.c \ - pthread_rwlock_destroy.c \ - pthread_rwlockattr_init.c \ - pthread_rwlockattr_destroy.c \ - pthread_rwlockattr_getpshared.c \ - pthread_rwlockattr_setpshared.c \ - pthread_rwlock_rdlock.c \ - pthread_rwlock_timedrdlock.c \ - pthread_rwlock_wrlock.c \ - pthread_rwlock_timedwrlock.c \ - pthread_rwlock_unlock.c \ - pthread_rwlock_tryrdlock.c \ - pthread_rwlock_trywrlock.c - -SCHED_SRCS = \ - pthread_attr_setschedpolicy.c \ - pthread_attr_getschedpolicy.c \ - pthread_attr_setschedparam.c \ - pthread_attr_getschedparam.c \ - pthread_attr_setinheritsched.c \ - pthread_attr_getinheritsched.c \ - pthread_setschedparam.c \ - pthread_getschedparam.c \ - sched_get_priority_max.c \ - sched_get_priority_min.c \ - sched_setscheduler.c \ - sched_getscheduler.c \ - sched_yield.c - -SEMAPHORE_SRCS = \ - sem_init.c \ - sem_destroy.c \ - sem_trywait.c \ - sem_timedwait.c \ - sem_wait.c \ - sem_post.c \ - sem_post_multiple.c \ - sem_getvalue.c \ - sem_open.c \ - sem_close.c \ - sem_unlink.c - -SPIN_SRCS = \ - ptw32_spinlock_check_need_init.c \ - pthread_spin_init.c \ - pthread_spin_destroy.c \ - pthread_spin_lock.c \ - pthread_spin_unlock.c \ - pthread_spin_trylock.c - -SYNC_SRCS = \ - pthread_detach.c \ - pthread_join.c - -TSD_SRCS = \ - pthread_key_create.c \ - pthread_key_delete.c \ - pthread_setspecific.c \ - pthread_getspecific.c - - -help: - @ echo Run one of the following command lines: - @ echo nmake clean VCE (to build the MSVC dll with C++ exception handling) - @ echo nmake clean VSE (to build the MSVC dll with structured exception handling) - @ echo nmake clean VC (to build the MSVC dll with C cleanup code) - @ echo nmake clean VCE-inlined (to build the MSVC inlined dll with C++ exception handling) - @ echo nmake clean VSE-inlined (to build the MSVC inlined dll with structured exception handling) - @ echo nmake clean VC-inlined (to build the MSVC inlined dll with C cleanup code) - @ echo nmake clean VC-static (to build the MSVC static lib with C cleanup code) - @ echo nmake clean VCE-debug (to build the debug MSVC dll with C++ exception handling) - @ echo nmake clean VSE-debug (to build the debug MSVC dll with structured exception handling) - @ echo nmake clean VC-debug (to build the debug MSVC dll with C cleanup code) - @ echo nmake clean VCE-inlined-debug (to build the debug MSVC inlined dll with C++ exception handling) - @ echo nmake clean VSE-inlined-debug (to build the debug MSVC inlined dll with structured exception handling) - @ echo nmake clean VC-inlined-debug (to build the debug MSVC inlined dll with C cleanup code) - @ echo nmake clean VC-static-debug (to build the debug MSVC static lib with C cleanup code) - -all: - @ nmake clean VCE-inlined - @ nmake clean VSE-inlined - @ nmake clean VC-inlined - @ nmake clean VCE-inlined-debug - @ nmake clean VSE-inlined-debug - @ nmake clean VC-inlined-debug - -VCE: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VCEFLAGS)" CLEANUP=__CLEANUP_CXX pthreadVCE$(DLL_VER).dll - -VCE-debug: - @ nmake /nologo EHFLAGS="$(OPTIMD) $(VCEFLAGSD)" CLEANUP=__CLEANUP_CXX pthreadVCE$(DLL_VERD).dll - -VSE: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VSEFLAGS)" CLEANUP=__CLEANUP_SEH pthreadVSE$(DLL_VER).dll - -VSE-debug: - @ nmake /nologo EHFLAGS="$(OPTIMD) $(VSEFLAGSD)" CLEANUP=__CLEANUP_SEH pthreadVSE$(DLL_VERD).dll - -VC: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VCFLAGS)" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).dll - -VC-debug: - @ nmake /nologo EHFLAGS="$(OPTIMD) $(VCFLAGSD)" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VERD).dll - -# -# The so-called inlined DLL is just a single translation unit with -# inlining optimisation turned on. -# -VCE-inlined: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VCEFLAGS) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_CXX pthreadVCE$(DLL_VER).stamp - -VCE-inlined-debug: - @ nmake /nologo EHFLAGS="$(OPTIMD) $(VCEFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_CXX pthreadVCE$(DLL_VERD).stamp - -VSE-inlined: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VSEFLAGS) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_SEH pthreadVSE$(DLL_VER).stamp - -VSE-inlined-debug: - @ nmake /nologo EHFLAGS="$(OPTIMD) $(VSEFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_SEH pthreadVSE$(DLL_VERD).stamp - -VC-inlined: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VCFLAGS) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).stamp - -VC-inlined-debug: - nmake /nologo EHFLAGS="$(OPTIMD) $(VCFLAGSD) /DPTW32_BUILD_INLINED" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VERD).stamp - -VC-static: - @ nmake /nologo EHFLAGS="$(OPTIM) $(VCFLAGS) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VER).static - -VC-static-debug: - @ nmake /nologo EHFLAGS="$(OPTIMD) $(VCFLAGSD) /DPTW32_BUILD_INLINED /DPTW32_STATIC_LIB" CLEANUP=__CLEANUP_C pthreadVC$(DLL_VERD).static - -realclean: clean - if exist pthread*.dll del pthread*.dll - if exist pthread*.lib del pthread*.lib - if exist *.stamp del *.stamp - -clean: - if exist *.obj del *.obj - if exist *.ilk del *.ilk - if exist *.pdb del *.pdb - if exist *.exp del *.exp - if exist *.map del *.map - if exist *.o del *.o - if exist *.i del *.i - if exist *.res del *.res - - -install: $(DLLS) - copy pthread*.dll $(DLLDEST) - copy pthread*.lib $(LIBDEST) - copy pthread.h $(HDRDEST) - copy sched.h $(HDRDEST) - copy semaphore.h $(HDRDEST) - -$(DLLS): $(DLL_OBJS) - cl /LDd /Zi /nologo $(DLL_OBJS) \ - /link /nodefaultlib:libcmt /implib:$*.lib \ - msvcrt.lib wsock32.lib /out:$@ - -$(INLINED_STAMPS): $(DLL_INLINED_OBJS) - cl /LDd /Zi /nologo $(DLL_INLINED_OBJS) \ - /link /nodefaultlib:libcmt /implib:$*.lib \ - msvcrt.lib wsock32.lib /out:$*.dll - -$(STATIC_STAMPS): $(DLL_INLINED_OBJS) - if exist $*.lib del $*.lib - lib $(DLL_INLINED_OBJS) /out:$*.lib - -.c.obj: - cl $(EHFLAGS) /D$(CLEANUP) -c $< - -.rc.res: - rc /dPTW32_RC_MSC /d$(CLEANUP) $< - -.c.i: - cl /P /O2 /Ob1 $(VCFLAGS) $< - -attr.obj: attr.c $(ATTR_SRCS) $(INCL) -barrier.obj: barrier.c $(BARRIER_SRCS) $(INCL) -cancel.obj: cancel.c $(CANCEL_SRCS) $(INCL) -condvar.obj: condvar.c $(CONDVAR_SRCS) $(INCL) -exit.obj: exit.c $(EXIT_SRCS) $(INCL) -misc.obj: misc.c $(MISC_SRCS) $(INCL) -mutex.obj: mutex.c $(MUTEX_SRCS) $(INCL) -nonportable.obj: nonportable.c $(NONPORTABLE_SRCS) $(INCL) -private.obj: private.c $(PRIVATE_SRCS) $(INCL) -rwlock.obj: rwlock.c $(RWLOCK_SRCS) $(INCL) -sched.obj: sched.c $(SCHED_SRCS) $(INCL) -semaphore.obj: semaphore.c $(SEMAPHORE_SRCS) $(INCL) -spin.obj: spin.c $(SPIN_SRCS) $(INCL) -sync.obj: sync.c $(SYNC_SRCS) $(INCL) -tsd.obj: tsd.c $(TSD_SRCS) $(INCL) -version.res: version.rc $(INCL) diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/NEWS b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/NEWS deleted file mode 100644 index 18fe54325df..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/NEWS +++ /dev/null @@ -1,1110 +0,0 @@ -RELEASE 2.8.0 -------------- -(2006-12-22) - -General -------- -New bug fixes in this release since 2.7.0 have not been applied to the -version 1.x.x series. It is probably time to drop version 1. - -Testing and verification ------------------------- -This release has not yet been tested on SMP architechtures. All tests pass -on a uni-processor system. - -Bug fixes ---------- -Sem_destroy could return EBUSY even though no threads were waiting on the -semaphore. Other races around invalidating semaphore structs (internally) -have been removed as well. - -New tests ---------- -semaphore5.c - tests the bug fix referred to above. - - -RELEASE 2.7.0 -------------- -(2005-06-04) - -General -------- -All new features in this release have been back-ported in release 1.11.0, -including the incorporation of MCS locks in pthread_once, however, versions -1 and 2 remain incompatible even though they are now identical in -performance and functionality. - -Testing and verification ------------------------- -This release has been tested (passed the test suite) on both uni-processor -and multi-processor systems. -- Tim Theisen - -Bug fixes ---------- -Pthread_once has been re-implemented to remove priority boosting and other -complexity to improve robustness. Races for Win32 handles that are not -recycle-unique have been removed. The general form of pthread_once is now -the same as that suggested earlier by Alexander Terekhov, but instead of the -'named mutex', a queue-based lock has been implemented which has the required -properties of dynamic self initialisation and destruction. This lock is also -efficient. The ABI is unaffected in as much as the size of pthread_once_t has -not changed and PTHREAD_ONCE_INIT has not changed, however, applications that -peek inside pthread_once_t, which is supposed to be opaque, will break. -- Vladimir Kliatchko - -New features ------------- -* Support for Mingw cross development tools added to GNUmakefile. -Mingw cross tools allow building the libraries on Linux. -- Mikael Magnusson - - -RELEASE 2.6.0 -------------- -(2005-05-19) - -General -------- -All of the bug fixes and new features in this release have been -back-ported in release 1.10.0. - -Testing and verification ------------------------- -This release has been tested (passed the test suite) on both uni-processor -and multi-processor systems. Thanks to Tim Theisen at TomoTherapy for -exhaustively running the MP tests and for providing crutial observations -and data when faults are detected. - -Bugs fixed ----------- - -* pthread_detach() now reclaims remaining thread resources if called after -the target thread has terminated. Previously, this routine did nothing in -this case. - -New tests ---------- - -* detach1.c - tests that pthread_detach properly invalidates the target -thread, which indicates that the thread resources have been reclaimed. - - -RELEASE 2.5.0 -------------- -(2005-05-09) - -General -------- - -The package now includes a reference documentation set consisting of -HTML formatted Unix-style manual pages that have been edited for -consistency with Pthreads-w32. The set can also be read online at: -http://sources.redhat.com/pthreads-win32/manual/index.html - -Thanks again to Tim Theisen for running the test suite pre-release -on an MP system. - -All of the bug fixes and new features in this release have been -back-ported in release 1.9.0. - -Bugs fixed ----------- - -* Thread Specific Data (TSD) key management has been ammended to -eliminate a source of (what was effectively) resource leakage (a HANDLE -plus memory for each key destruct routine/thread association). This was -not a true leak because these resources were eventually reclaimed when -pthread_key_delete was run AND each thread referencing the key had exited. -The problem was that these two conditions are often not met until very -late, and often not until the process is about to exit. - -The ammended implementation avoids the need for the problematic HANDLE -and reclaims the memory as soon as either the key is deleted OR the -thread exits, whichever is first. - -Thanks to Richard Hughes at Aculab for identifying and locating the leak. - -* TSD key destructors are now processed up to PTHREAD_DESTRUCTOR_ITERATIONS -times instead of just once. PTHREAD_DESTRUCTOR_ITERATIONS has been -defined in pthread.h for some time but not used. - -* Fix a semaphore accounting race between sem_post/sem_post_multiple -and sem_wait cancellation. This is the same issue as with -sem_timedwait that was fixed in the last release. - -* sem_init, sem_post, and sem_post_multiple now check that the -semaphore count never exceeds _POSIX_SEM_VALUE_MAX. - -* Although sigwait() is nothing more than a no-op, it should at least -be a cancellation point to be consistent with the standard. - -New tests ---------- - -* stress1.c - attempts to expose problems in condition variable -and semaphore timed wait logic. This test was inspired by Stephan -Mueller's sample test code used to identify the sem_timedwait bug -from the last release. It's not a part of the regular test suite -because it can take awhile to run. To run it: -nmake clean VC-stress - -* tsd2.c - tests that key destructors are re-run if the tsd key value is -not NULL after the destructor routine has run. Also tests that -pthread_setspecific() and pthread_getspecific() are callable from -destructors. - - -RELEASE 2.4.0 -------------- -(2005-04-26) - -General -------- - -There is now no plan to release a version 3.0.0 to fix problems in -pthread_once(). Other possible implementations of pthread_once -will still be investigated for a possible future release in an attempt -to reduce the current implementation's complexity. - -All of the bug fixes and new features in this release have been -back-ported for release 1.8.0. - -Bugs fixed ----------- - -* Fixed pthread_once race (failures on an MP system). Thanks to -Tim Theisen for running exhaustive pre-release testing on his MP system -using a range of compilers: - VC++ 6 - VC++ 7.1 - Intel C++ version 8.0 -All tests passed. -Some minor speed improvements were also done. - -* Fix integer overrun error in pthread_mutex_timedlock() - missed when -sem_timedwait() was fixed in release 2.2.0. This routine no longer returns -ENOTSUP when NEED_SEM is defined - it is supported (NEED_SEM is only -required for WinCE versions prior to 3.0). - -* Fix timeout bug in sem_timedwait(). -- Thanks to Stephan Mueller for reporting, providing diagnostic output -and test code. - -* Fix several problems in the NEED_SEM conditionally included code. -NEED_SEM included code is provided for systems that don't implement W32 -semaphores, such as WinCE prior to version 3.0. An alternate implementation -of POSIX semaphores is built using W32 events for these systems when -NEED_SEM is defined. This code has been completely rewritten in this -release to reuse most of the default POSIX semaphore code, and particularly, -to implement all of the sem_* routines supported by pthreads-win32. Tim -Theisen also run the test suite over the NEED_SEM code on his MP system. All -tests passed. - -* The library now builds without errors for the Borland Builder 5.5 compiler. - -New features ------------- - -* pthread_mutex_timedlock() and all sem_* routines provided by -pthreads-win32 are now implemented for WinCE versions prior to 3.0. Those -versions did not implement W32 semaphores. Define NEED_SEM in config.h when -building the library for these systems. - -Known issues in this release ----------------------------- - -* pthread_once is too complicated - but it works as far as testing can -determine.. - -* The Borland version of the dll fails some of the tests with a memory read -exception. The cause is not yet known but a compiler bug has not been ruled -out. - - -RELEASE 2.3.0 -------------- -(2005-04-12) - -General -------- - -Release 1.7.0 is a backport of features and bug fixes new in -this release. See earlier notes under Release 2.0.0/General. - -Bugs fixed ----------- - -* Fixed pthread_once potential for post once_routine cancellation -hanging due to starvation. See comments in pthread_once.c. -Momentary priority boosting is used to ensure that, after a -once_routine is cancelled, the thread that will run the -once_routine is not starved by higher priority waiting threads at -critical times. Priority boosting occurs only AFTER a once_routine -cancellation, and is applied only to that once_control. The -once_routine is run at the thread's normal base priority. - -New tests ---------- - -* once4.c: Aggressively tests pthread_once() under realtime -conditions using threads with varying priorities. Windows' -random priority boosting does not occur for threads with realtime -priority levels. - - -RELEASE 2.2.0 -------------- -(2005-04-04) - -General -------- - -* Added makefile targets to build static link versions of the library. -Both MinGW and MSVC. Please note that this does not imply any change -to the LGPL licensing, which still imposes psecific conditions on -distributing software that has been statically linked with this library. - -* There is a known bug in pthread_once(). Cancellation of the init_routine -exposes a potential starvation (i.e. deadlock) problem if a waiting thread -has a higher priority than the initting thread. This problem will be fixed -in version 3.0.0 of the library. - -Bugs fixed ----------- - -* Fix integer overrun error in sem_timedwait(). -Kevin Lussier - -* Fix preprocessor directives for static linking. -Dimitar Panayotov - - -RELEASE 2.1.0 -------------- -(2005-03-16) - -Bugs fixed ----------- - -* Reverse change to pthread_setcancelstate() in 2.0.0. - - -RELEASE 2.0.0 -------------- -(2005-03-16) - -General -------- - -This release represents an ABI change and the DLL version naming has -incremented from 1 to 2, e.g. pthreadVC2.dll. - -Version 1.4.0 back-ports the new functionality included in this -release. Please distribute DLLs built from that version with updates -to applications built on pthreads-win32 version 1.x.x. - -The package naming has changed, replacing the snapshot date with -the version number + descriptive information. E.g. this -release is "pthreads-w32-2-0-0-release". - -Bugs fixed ----------- - -* pthread_setcancelstate() no longer checks for a pending -async cancel event if the library is using alertable async -cancel. See the README file (Prerequisites section) for info -on adding alertable async cancelation. - -New features ------------- - -* pthread_once() now supports init_routine cancellability. - -New tests ---------- - -* Agressively test pthread_once() init_routine cancellability. - - -SNAPSHOT 2005-03-08 -------------------- -Version 1.3.0 - -Bug reports (fixed) -------------------- - -* Implicitly created threads leave Win32 handles behind after exiting. -- Dmitrii Semii - -* pthread_once() starvation problem. -- Gottlob Frege - -New tests ---------- - -* More intense testing of pthread_once(). - - -SNAPSHOT 2005-01-25 -------------------- -Version 1.2.0 - -Bug fixes ---------- - -* Attempted acquisition of a recursive mutex could cause waiting threads -to not be woken when the mutex was released. -- Ralf Kubis - -* Various package omissions have been fixed. - - -SNAPSHOT 2005-01-03 -------------------- -Version 1.1.0 - -Bug fixes ---------- - -* Unlocking recursive or errorcheck mutexes would sometimes -unexpectedly return an EPERM error (bug introduced in -snapshot-2004-11-03). -- Konstantin Voronkov - - -SNAPSHOT 2004-11-22 -------------------- -Version 1.0.0 - -This snapshot primarily fixes the condvar bug introduced in -snapshot-2004-11-03. DLL versioning has also been included to allow -applications to runtime check the Microsoft compatible DLL version -information, and to extend the DLL naming system for ABI and major -(non-backward compatible) API changes. See the README file for details. - -Bug fixes ---------- - -* Condition variables no longer deadlock (bug introduced in -snapshot-2004-11-03). -- Alexander Kotliarov and Nicolas at saintmac - -* DLL naming extended to avoid 'DLL hell' in the future, and to -accommodate the ABI change introduced in snapshot-2004-11-03. Snapshot -2004-11-03 will be removed from FTP sites. - -New features ------------- - -* A Microsoft-style version resource has been added to the DLL for -applications that wish to check DLL compatibility at runtime. - -* Pthreads-win32 DLL naming has been extended to allow incompatible DLL -versions to co-exist in the same filesystem. See the README file for details, -but briefly: while the version information inside the DLL will change with -each release from now on, the DLL version names will only change if the new -DLL is not backward compatible with older applications. - -The versioning scheme has been borrowed from GNU Libtool, and the DLL -naming scheme is from Cygwin. Provided the Libtool-style numbering rules are -honoured, the Cygwin DLL naming scheme automatcally ensures that DLL name -changes are minimal and that applications will not load an incompatible -pthreads-win32 DLL. - -Those who use the pre-built DLLs will find that the DLL/LIB names have a new -suffix (1) in this snapshot. E.g. pthreadVC1.dll etc. - -* The POSIX thread ID reuse uniqueness feature introduced in the last snapshot -has been kept as default, but the behaviour can now be controlled when the DLL -is built to effectively switch it off. This makes the library much more -sensitive to applications that assume that POSIX thread IDs are unique, i.e. -are not strictly compliant with POSIX. See the PTW32_THREAD_ID_REUSE_INCREMENT -macro comments in config.h for details. - -Other changes -------------- -Certain POSIX macros have changed. - -These changes are intended to conform to the Single Unix Specification version 3, -which states that, if set to 0 (zero) or not defined, then applications may use -sysconf() to determine their values at runtime. Pthreads-win32 does not -implement sysconf(). - -The following macros are no longer undefined, but defined and set to -1 -(not implemented): - - _POSIX_THREAD_ATTR_STACKADDR - _POSIX_THREAD_PRIO_INHERIT - _POSIX_THREAD_PRIO_PROTECT - _POSIX_THREAD_PROCESS_SHARED - -The following macros are defined and set to 200112L (implemented): - - _POSIX_THREADS - _POSIX_THREAD_SAFE_FUNCTIONS - _POSIX_THREAD_ATTR_STACKSIZE - _POSIX_THREAD_PRIORITY_SCHEDULING - _POSIX_SEMAPHORES - _POSIX_READER_WRITER_LOCKS - _POSIX_SPIN_LOCKS - _POSIX_BARRIERS - -The following macros are defined and set to appropriate values: - - _POSIX_THREAD_THREADS_MAX - _POSIX_SEM_VALUE_MAX - _POSIX_SEM_NSEMS_MAX - PTHREAD_DESTRUCTOR_ITERATIONS - PTHREAD_KEYS_MAX - PTHREAD_STACK_MIN - PTHREAD_THREADS_MAX - - -SNAPSHOT 2004-11-03 -------------------- - -DLLs produced from this snapshot cannot be used with older applications without -recompiling the application, due to a change to pthread_t to provide unique POSIX -thread IDs. - -Although this snapshot passes the extended test suite, many of the changes are -fairly major, and some applications may show different behaviour than previously, -so adopt with care. Hopefully, any changed behaviour will be due to the library -being better at it's job, not worse. - -Bug fixes ---------- - -* pthread_create() no longer accepts NULL as the thread reference arg. -A segfault (memory access fault) will result, and no thread will be -created. - -* pthread_barrier_wait() no longer acts as a cancelation point. - -* Fix potential race condition in pthread_once() -- Tristan Savatier - -* Changes to pthread_cond_destroy() exposed some coding weaknesses in several -test suite mini-apps because pthread_cond_destroy() now returns EBUSY if the CV -is still in use. - -New features ------------- - -* Added for compatibility: -PTHREAD_RECURSIVE_MUTEX_INITIALIZER, -PTHREAD_ERRORCHECK_MUTEX_INITIALIZER, -PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, -PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - -* Initial support for Digital Mars compiler -- Anuj Goyal - -* Faster Mutexes. These have been been rewritten following a model provided by -Alexander Terekhov that reduces kernel space checks, and eliminates some additional -critical sections used to manage a race between timedlock expiration and unlock. -Please be aware that the new mutexes do not enforce strict absolute FIFO scheduling -of mutexes, however any out-of-order lock acquisition should be very rare. - -* Faster semaphores. Following a similar model to mutexes above, these have been -rewritten to use preliminary users space checks. - -* sem_getvalue() now returns the number of waiters. - -* The POSIX thread ID now has much stronger uniqueness characteristics. The library -garrantees not to reuse the same thread ID for at least 2^(wordsize) thread -destruction/creation cycles. - -New tests ---------- - -* semaphore4.c: Tests cancelation of the new sem_wait(). - -* semaphore4t.c: Likewise for sem_timedwait(). - -* rwlock8.c: Tests and times the slow execution paths of r/w locks, and the CVs, -mutexes, and semaphores that they're built on. - - -SNAPSHOT 2004-05-16 -------------------- - -Attempt to add Watcom to the list of compilers that can build the library. -This failed in the end due to it's non-thread-aware errno. The library -builds but the test suite fails. See README.Watcom for more details. - -Bug fixes ---------- -* Bug and memory leak in sem_init() -- Alex Blanco - -* ptw32_getprocessors() now returns CPU count of 1 for WinCE. -- James Ewing - -* pthread_cond_wait() could be canceled at a point where it should not -be cancelable. Fixed. -- Alexander Terekhov - -* sem_timedwait() had an incorrect timeout calculation. -- Philippe Di Cristo - -* Fix a memory leak left behind after threads are destroyed. -- P. van Bruggen - -New features ------------- -* Ported to AMD64. -- Makoto Kato - -* True pre-emptive asynchronous cancelation of threads. This is optional -and requires that Panagiotis E. Hadjidoukas's QueueUserAPCEx package be -installed. This package is included in the pthreads-win32 self-unpacking -Zip archive starting from this snapshot. See the README.txt file inside -the package for installation details. - -Note: If you don't use async cancelation in your application, or don't need -to cancel threads that are blocked on system resources such as network I/O, -then the default non-preemptive async cancelation is probably good enough. -However, pthreads-win32 auto-detects the availability of these components -at run-time, so you don't need to rebuild the library from source if you -change your mind later. - -All of the advice available in books and elsewhere on the undesirability -of using async cancelation in any application still stands, but this -feature is a welcome addition with respect to the library's conformance to -the POSIX standard. - -SNAPSHOT 2003-09-18 -------------------- - -Cleanup of thread priority management. In particular, setting of thread -priority now attempts to map invalid Win32 values within the range returned -by sched_get_priority_min/max() to useful values. See README.NONPORTABLE -under "Thread priority". - -Bug fixes ---------- -* pthread_getschedparam() now returns the priority given by the most recent -call to pthread_setschedparam() or established by pthread_create(), as -required by the standard. Previously, pthread_getschedparam() incorrectly -returned the running thread priority at the time of the call, which may have -been adjusted or temporarily promoted/demoted. - -* sched_get_priority_min() and sched_get_priority_max() now return -1 on error -and set errno. Previously, they incorrectly returned the error value directly. - - -SNAPSHOT 2003-09-04 -------------------- - -Bug fixes ---------- -* ptw32_cancelableWait() now allows cancelation of waiting implicit POSIX -threads. - -New test --------- -* cancel8.c tests cancelation of Win32 threads waiting at a POSIX cancelation -point. - - -SNAPSHOT 2003-09-03 -------------------- - -Bug fixes ---------- -* pthread_self() would free the newly created implicit POSIX thread handle if -DuplicateHandle failed instead of recycle it (very unlikely). - -* pthread_exit() was neither freeing nor recycling the POSIX thread struct -for implicit POSIX threads. - -New feature - Cancelation of/by Win32 (non-POSIX) threads ---------------------------------------------------------- -Since John Bossom's original implementation, the library has allowed non-POSIX -initialised threads (Win32 threads) to call pthreads-win32 routines and -therefore interact with POSIX threads. This is done by creating an on-the-fly -POSIX thread ID for the Win32 thread that, once created, allows fully -reciprical interaction. This did not extend to thread cancelation (async or -deferred). Now it does. - -Any thread can be canceled by any other thread (Win32 or POSIX) if the former -thread's POSIX pthread_t value is known. It's TSD destructors and POSIX -cleanup handlers will be run before the thread exits with an exit code of -PTHREAD_CANCELED (retrieved with GetExitCodeThread()). - -This allows a Win32 thread to, for example, call POSIX CV routines in the same way -that POSIX threads would/should, with pthread_cond_wait() cancelability and -cleanup handlers (pthread_cond_wait() is a POSIX cancelation point). - -By adding cancelation, Win32 threads should now be able to call all POSIX -threads routines that make sense including semaphores, mutexes, condition -variables, read/write locks, barriers, spinlocks, tsd, cleanup push/pop, -cancelation, pthread_exit, scheduling, etc. - -Note that these on-the-fly 'implicit' POSIX thread IDs are initialised as detached -(not joinable) with deferred cancelation type. The POSIX thread ID will be created -automatically by any POSIX routines that need a POSIX handle (unless the routine -needs a pthread_t as a parameter of course). A Win32 thread can discover it's own -POSIX thread ID by calling pthread_self(), which will create the handle if -necessary and return the pthread_t value. - -New tests ---------- -Test the above new feature. - - -SNAPSHOT 2003-08-19 -------------------- - -This snapshot fixes some accidental corruption to new test case sources. -There are no changes to the library source code. - - -SNAPSHOT 2003-08-15 -------------------- - -Bug fixes ---------- - -* pthread.dsp now uses correct compile flags (/MD). -- Viv - -* pthread_win32_process_detach_np() fixed memory leak. -- Steven Reddie - -* pthread_mutex_destroy() fixed incorrect return code. -- Nicolas Barry - -* pthread_spin_destroy() fixed memory leak. -- Piet van Bruggen - -* Various changes to tighten arg checking, and to work with later versions of -MinGW32 and MsysDTK. - -* pthread_getschedparam() etc, fixed dangerous thread validity checking. -- Nicolas Barry - -* POSIX thread handles are now reused and their memory is not freed on thread exit. -This allows for stronger thread validity checking. - -New standard routine --------------------- - -* pthread_kill() added to provide thread validity checking to applications. -It does not accept any non zero values for the signal arg. - -New test cases --------------- - -* New test cases to confirm validity checking, pthread_kill(), and thread reuse. - - -SNAPSHOT 2003-05-10 -------------------- - -Bug fixes ---------- - -* pthread_mutex_trylock() now returns correct error values. -pthread_mutex_destroy() will no longer destroy a recursively locked mutex. -pthread_mutex_lock() is no longer inadvertantly behaving as a cancelation point. -- Thomas Pfaff - -* pthread_mutex_timedlock() no longer occasionally sets incorrect mutex -ownership, causing deadlocks in some applications. -- Robert Strycek and Alexander Terekhov - - -SNAPSHOT 2002-11-04 -------------------- - -Bug fixes ---------- - -* sem_getvalue() now returns the correct value under Win NT and WinCE. -- Rob Fanner - -* sem_timedwait() now uses tighter checks for unreasonable -abstime values - that would result in unexpected timeout values. - -* ptw32_cond_wait_cleanup() no longer mysteriously consumes -CV signals but may produce more spurious wakeups. It is believed -that the sem_timedwait() call is consuming a CV signal that it -shouldn't. -- Alexander Terekhov - -* Fixed a memory leak in ptw32_threadDestroy() for implicit threads. - -* Fixed potential for deadlock in pthread_cond_destroy(). -A deadlock could occur for statically declared CVs (PTHREAD_COND_INITIALIZER), -when one thread is attempting to destroy the condition variable while another -is attempting to dynamically initialize it. -- Michael Johnson - - -SNAPSHOT 2002-03-02 -------------------- - -Cleanup code default style. (IMPORTANT) ----------------------------------------------------------------------- -Previously, if not defined, the cleanup style was determined automatically -from the compiler/language, and one of the following was defined accordingly: - - __CLEANUP_SEH MSVC only - __CLEANUP_CXX C++, including MSVC++, GNU G++ - __CLEANUP_C C, including GNU GCC, not MSVC - -These defines determine the style of cleanup (see pthread.h) and, -most importantly, the way that cancelation and thread exit (via -pthread_exit) is performed (see the routine ptw32_throw() in private.c). - -In short, the exceptions versions of the library throw an exception -when a thread is canceled or exits (via pthread_exit()), which is -caught by a handler in the thread startup routine, so that the -the correct stack unwinding occurs regardless of where the thread -is when it's canceled or exits via pthread_exit(). - -In this and future snapshots, unless the build explicitly defines (e.g. -via a compiler option) __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then -the build NOW always defaults to __CLEANUP_C style cleanup. This style -uses setjmp/longjmp in the cancelation and pthread_exit implementations, -and therefore won't do stack unwinding even when linked to applications -that have it (e.g. C++ apps). This is for consistency with most -current commercial Unix POSIX threads implementations. Compaq's TRU64 -may be an exception (no pun intended) and possible future trend. - -Although it was not clearly documented before, it is still necessary to -build your application using the same __CLEANUP_* define as was -used for the version of the library that you link with, so that the -correct parts of pthread.h are included. That is, the possible -defines require the following library versions: - - __CLEANUP_SEH pthreadVSE.dll - __CLEANUP_CXX pthreadVCE.dll or pthreadGCE.dll - __CLEANUP_C pthreadVC.dll or pthreadGC.dll - -E.g. regardless of whether your app is C or C++, if you link with -pthreadVC.lib or libpthreadGC.a, then you must define __CLEANUP_C. - - -THE POINT OF ALL THIS IS: if you have not been defining one of these -explicitly, then the defaults as described at the top of this -section were being used. - -THIS NOW CHANGES, as has been explained above, but to try to make this -clearer here's an example: - -If you were building your application with MSVC++ i.e. using C++ -exceptions and not explicitly defining one of __CLEANUP_*, then -__CLEANUP_C++ was automatically defined for you in pthread.h. -You should have been linking with pthreadVCE.dll, which does -stack unwinding. - -If you now build your application as you had before, pthread.h will now -automatically set __CLEANUP_C as the default style, and you will need to -link with pthreadVC.dll. Stack unwinding will now NOT occur when a thread -is canceled, or the thread calls pthread_exit(). - -Your application will now most likely behave differently to previous -versions, and in non-obvious ways. Most likely is that locally -instantiated objects may not be destroyed or cleaned up after a thread -is canceled. - -If you want the same behaviour as before, then you must now define -__CLEANUP_C++ explicitly using a compiler option and link with -pthreadVCE.dll as you did before. - - -WHY ARE WE MAKING THE DEFAULT STYLE LESS EXCEPTION-FRIENDLY? -Because no commercial Unix POSIX threads implementation allows you to -choose to have stack unwinding. Therefore, providing it in pthread-win32 -as a default is dangerous. We still provide the choice but unless -you consciously choose to do otherwise, your pthreads applications will -now run or crash in similar ways irrespective of the threads platform -you use. Or at least this is the hope. - - -WHY NOT REMOVE THE EXCEPTIONS VERSIONS OF THE LIBRARY ALTOGETHER? -There are a few reasons: -- because there are well respected POSIX threads people who believe - that POSIX threads implementations should be exceptions aware and - do the expected thing in that context. (There are equally respected - people who believe it should not be easily accessible, if it's there - at all, for unconditional conformity to other implementations.) -- because pthreads-win32 is one of the few implementations that has - the choice, perhaps the only freely available one, and so offers - a laboratory to people who may want to explore the effects; -- although the code will always be around somewhere for anyone who - wants it, once it's removed from the current version it will not be - nearly as visible to people who may have a use for it. - - -Source module splitting ------------------------ -In order to enable smaller image sizes to be generated -for applications that link statically with the library, -most routines have been separated out into individual -source code files. - -This is being done in such a way as to be backward compatible. -The old source files are reused to congregate the individual -routine files into larger translation units (via a bunch of -# includes) so that the compiler can still optimise wherever -possible, e.g. through inlining, which can only be done -within the same translation unit. - -It is also possible to build the entire library by compiling -the single file named "pthread.c", which just #includes all -the secondary congregation source files. The compiler -may be able to use this to do more inlining of routines. - -Although the GNU compiler is able to produce libraries with -the necessary separation (the -ffunction-segments switch), -AFAIK, the MSVC and other compilers don't have this feature. - -Finally, since I use makefiles and command-line compilation, -I don't know what havoc this reorganisation may wreak amongst -IDE project file users. You should be able to continue -using your existing project files without modification. - - -New non-portable functions --------------------------- -pthread_num_processors_np(): - Returns the number of processors in the system that are - available to the process, as determined from the processor - affinity mask. - -pthread_timechange_handler_np(): - To improve tolerance against operator or time service initiated - system clock changes. - - This routine can be called by an application when it - receives a WM_TIMECHANGE message from the system. At present - it broadcasts all condition variables so that waiting threads - can wake up and re-evaluate their conditions and restart - their timed waits if required. - - Suggested by Alexander Terekhov - - -Platform dependence -------------------- -As Win95 doesn't provide one, the library now contains -it's own InterlockedCompareExchange() routine, which is used -whenever Windows doesn't provide it. InterlockedCompareExchange() -is used to implement spinlocks and barriers, and also in mutexes. -This routine relies on the CMPXCHG machine instruction which -is not available on i386 CPUs. This library (from snapshot -20010712 onwards) is therefore no longer supported on i386 -processor platforms. - - -New standard routines ---------------------- -For source code portability only - rwlocks cannot be process shared yet. - - pthread_rwlockattr_init() - pthread_rwlockattr_destroy() - pthread_rwlockattr_setpshared() - pthread_rwlockattr_getpshared() - -As defined in the new POSIX standard, and the Single Unix Spec version 3: - - sem_timedwait() - pthread_mutex_timedlock() - Alexander Terekhov and Thomas Pfaff - pthread_rwlock_timedrdlock() - adapted from pthread_rwlock_rdlock() - pthread_rwlock_timedwrlock() - adapted from pthread_rwlock_wrlock() - - -pthread.h no longer includes windows.h --------------------------------------- -[Not yet for G++] - -This was done to prevent conflicts. - -HANDLE, DWORD, and NULL are temporarily defined within pthread.h if -they are not already. - - -pthread.h, sched.h and semaphore.h now use dllexport/dllimport --------------------------------------------------------------- -Not only to avoid the need for the pthread.def file, but to -improve performance. Apparently, declaring functions with dllimport -generates a direct call to the function and avoids the overhead -of a stub function call. - -Bug fixes ---------- -* Fixed potential NULL pointer dereferences in pthread_mutexattr_init, -pthread_mutexattr_getpshared, pthread_barrierattr_init, -pthread_barrierattr_getpshared, and pthread_condattr_getpshared. -- Scott McCaskill - -* Removed potential race condition in pthread_mutex_trylock and -pthread_mutex_lock; -- Alexander Terekhov - -* The behaviour of pthread_mutex_trylock in relation to -recursive mutexes was inconsistent with commercial implementations. -Trylock would return EBUSY if the lock was owned already by the -calling thread regardless of mutex type. Trylock now increments the -recursion count and returns 0 for RECURSIVE mutexes, and will -return EDEADLK rather than EBUSY for ERRORCHECK mutexes. This is -consistent with Solaris. -- Thomas Pfaff - -* Found a fix for the library and workaround for applications for -the known bug #2, i.e. where __CLEANUP_CXX or __CLEANUP_SEH is defined. -See the "Known Bugs in this snapshot" section below. - -This could be made transparent to applications by replacing the macros that -define the current C++ and SEH versions of pthread_cleanup_push/pop -with the C version, but AFAIK cleanup handlers would not then run in the -correct sequence with destructors and exception cleanup handlers when -an exception occurs. - -* Cancelation once started in a thread cannot now be inadvertantly -double canceled. That is, once a thread begins it's cancelation run, -cancelation is disabled and a subsequent cancel request will -return an error (ESRCH). - -* errno: An incorrect compiler directive caused a local version -of errno to be used instead of the Win32 errno. Both instances are -thread-safe but applications checking errno after a pthreads-win32 -call would be wrong. Fixing this also fixed a bad compiler -option in the testsuite (/MT should have been /MD) which is -needed to link with the correct library MSVCRT.LIB. - - -SNAPSHOT 2001-07-12 -------------------- - -To be added - - -SNAPSHOT 2001-07-03 -------------------- - -To be added - - -SNAPSHOT 2000-08-13 -------------------- - -New: -- Renamed DLL and LIB files: - pthreadVSE.dll (MS VC++/Structured EH) - pthreadVSE.lib - pthreadVCE.dll (MS VC++/C++ EH) - pthreadVCE.lib - pthreadGCE.dll (GNU G++/C++ EH) - libpthreadw32.a - - Both your application and the pthread dll should use the - same exception handling scheme. - -Bugs fixed: -- MSVC++ C++ exception handling. - -Some new tests have been added. - - -SNAPSHOT 2000-08-10 -------------------- - -New: -- asynchronous cancelation on X86 (Jason Nye) -- Makefile compatible with MS nmake to replace - buildlib.bat -- GNUmakefile for Mingw32 -- tests/Makefile for MS nmake replaces runall.bat -- tests/GNUmakefile for Mingw32 - -Bugs fixed: -- kernel32 load/free problem -- attempt to hide internel exceptions from application - exception handlers (__try/__except and try/catch blocks) -- Win32 thread handle leakage bug - (David Baggett/Paul Redondo/Eyal Lebedinsky) - -Some new tests have been added. - - -SNAPSHOT 1999-11-02 -------------------- - -Bugs fixed: -- ctime_r macro had an incorrect argument (Erik Hensema), -- threads were not being created - PTHREAD_CANCEL_DEFERRED. This should have - had little effect as deferred is the only - supported type. (Ross Johnson). - -Some compatibility improvements added, eg. -- pthread_setcancelstate accepts NULL pointer - for the previous value argument. Ditto for - pthread_setcanceltype. This is compatible - with Solaris but should not affect - standard applications (Erik Hensema) - -Some new tests have been added. - - -SNAPSHOT 1999-10-17 -------------------- - -Bug fix - Cancelation of threads waiting on condition variables -now works properly (Lorin Hochstein and Peter Slacik) - - -SNAPSHOT 1999-08-12 -------------------- - -Fixed exception stack cleanup if calling pthread_exit() -- (Lorin Hochstein and John Bossom). - -Fixed bugs in condition variables - (Peter Slacik): - - additional contention checks - - properly adjust number of waiting threads after timed - condvar timeout. - - -SNAPSHOT 1999-05-30 -------------------- - -Some minor bugs have been fixed. See the ChangeLog file for details. - -Some more POSIX 1b functions are now included but ony return an -error (ENOSYS) if called. They are: - - sem_open - sem_close - sem_unlink - sem_getvalue - - -SNAPSHOT 1999-04-07 -------------------- - -Some POSIX 1b functions which were internally supported are now -available as exported functions: - - sem_init - sem_destroy - sem_wait - sem_trywait - sem_post - sched_yield - sched_get_priority_min - sched_get_priority_max - -Some minor bugs have been fixed. See the ChangeLog file for details. - - -SNAPSHOT 1999-03-16 -------------------- - -Initial release. - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Nmakefile b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Nmakefile deleted file mode 100644 index e6c74dd7162..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Nmakefile +++ /dev/null @@ -1,24 +0,0 @@ -/* - * nmake file for uwin pthread library - */ - -VERSION = - -CCFLAGS = -V -g $(CC.DLL) -HAVE_CONFIG_H == 1 -_MT == 1 -_timeb == timeb -_ftime == ftime -_errno == _ast_errno - -$(INCLUDEDIR) :INSTALLDIR: pthread.h sched.h - -pthread $(VERSION) :LIBRARY: attr.c barrier.c cancel.c cleanup.c condvar.c \ - create.c dll.c exit.c fork.c global.c misc.c mutex.c private.c \ - rwlock.c sched.c semaphore.c spin.c sync.c tsd.c nonportable.c - -:: ANNOUNCE CONTRIBUTORS COPYING.LIB ChangeLog FAQ GNUmakefile MAINTAINERS \ - Makefile Makefile.in Makefile.vc NEWS PROGRESS README README.WinCE \ - TODO WinCE-PORT install-sh errno.c tests tests.mk acconfig.h \ - config.guess config.h.in config.sub configure configure.in signal.c \ - README.CV README.NONPORTABLE pthread.dsp pthread.dsw - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Nmakefile.tests b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Nmakefile.tests deleted file mode 100644 index 203560b6cb0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/Nmakefile.tests +++ /dev/null @@ -1,260 +0,0 @@ -/* for running tests */ -CCFLAGS = -g -_MT == 1 -_timeb == timeb -_ftime == ftime - -.SOURCE: tests -/* -:PACKAGE: pthread -*/ - -set keepgoing - -":test:" : .MAKE .OPERATOR - local I - $(<:D:B:S=.pass) : .IMPLICIT $(>:D:B:S=.pass) - for I $(<) $(>) - $(I:D:B:S=.pass) : .VIRTUAL .FORCE $(I) - $(>) - end -sizes:: sizes.c -loadfree:: loadfree.c -mutex1:: mutex1.c -mutex1e:: mutex1e.c -mutex1n:: mutex1n.c -mutex1r:: mutex1r.c -mutex2:: mutex2.c -mutex2r:: mutex2r.c -mutex2e:: mutex2e.c -exit1:: exit1.c -condvar1:: condvar1.c -condvar1_1:: condvar1_1.c -condvar1_2:: condvar1_2.c -self1:: self1.c -condvar2:: condvar2.c -condvar2_1:: condvar2_1.c -condvar3_1:: condvar3_1.c -condvar3_2:: condvar3_2.c -condvar3_3:: condvar3_3.c -create1.:: create1.c -create2.:: create2.c -cancel1:: cancel1.c -cancel2:: cancel2.c -mutex3:: mutex3.c -mutex3r:: mutex3r.c -mutex3e:: mutex3e.c -mutex4:: mutex4.c -mutex5:: mutex5.c -mutex6:: mutex6.c -mutex6e:: mutex6e.c -mutex6n:: mutex6n.c -mutex6r:: mutex6r.c -mutex7:: mutex7.c -mutex6s:: mutex6s.c -mutex6rs:: mutex6rs.c -mutex6es:: mutex6es.c -mutex7e:: mutex7e.c -mutex7n:: mutex7n.c -mutex7r:: mutex7r.c -mutex8:: mutex8.c -mutex8e:: mutex8e.c -mutex8n:: mutex8n.c -mutex8r:: mutex8r.c -equal1:: equal1.c -exit2:: exit2.c -exit3:: exit3.c -exit4:: exit4.c -exit5:: exit5.c -join0:: join0.c -join1:: join1.c -join2:: join2.c -join3:: join3.c -kill1:: kill1.c -count1:: count1.c -once1:: once1.c -tsd1:: tsd1.c -self2:: self2.c -eyal1:: eyal1.c -condvar3:: condvar3.c -condvar4:: condvar4.c -condvar5:: condvar5.c -condvar6:: condvar6.c -condvar7:: condvar7.c -condvar8:: condvar8.c -condvar9:: condvar9.c -errno1:: errno1.c -reuse1.:: reuse1.c -reuse2.:: reuse2.c -rwlock1:: rwlock1.c -rwlock2:: rwlock2.c -rwlock3:: rwlock3.c -rwlock4:: rwlock4.c -rwlock5:: rwlock5.c -rwlock6:: rwlock6.c -rwlock7:: rwlock7.c -rwlock8:: rwlock8.c -rwlock2_t:: rwlock2_t.c -rwlock3_t:: rwlock3_t.c -rwlock4_t:: rwlock4_t.c -rwlock5_t:: rwlock5_t.c -rwlock6_t:: rwlock6_t.c -rwlock6_t2:: rwlock6_t2.c -semaphore1:: semaphore1.c -semaphore2:: semaphore2.c -semaphore3:: semaphore3.c -context1:: context1.c -cancel3:: cancel3.c -cancel4:: cancel4.c -cancel5:: cancel5.c -cancel6a:: cancel6a.c -cancel6d:: cancel6d.c -cancel7:: cancel7.c -cleanup0:: cleanup0.c -cleanup1:: cleanup1.c -cleanup2:: cleanup2.c -cleanup3:: cleanup3.c -priority1:: priority1.c -priority2:: priority2.c -inherit1:: inherit1.c -spin1:: spin1.c -spin2:: spin2.c -spin3:: spin3.c -spin4:: spin4.c -barrier1:: barrier1.c -barrier2:: barrier2.c -barrier3:: barrier3.c -barrier4:: barrier4.c -barrier5:: barrier5.c -exception1:: exception1.c -exception2:: exception2.c -exception3:: exception3.c -benchtest1:: benchtest1.c -benchtest2:: benchtest2.c -benchtest3:: benchtest3.c -benchtest4:: benchtest4.c -benchtest5:: benchtest5.c -valid1:: valid1.c -valid2:: valid2.c -cancel9:: cancel9.c - -sizes: :test: sizes -loadfree: :test: -mutex5 :test: loadfree -mutex1 :test: loadfree -mutex1n :test: loadfree -mutex1r :test: loadfree -mutex1e :test: loadfree -semaphore1 :test: loadfree -semaphore2 :test: loadfree -semaphore3 :test: loadfree -mutex2 :test: loadfree -mutex2r :test: loadfree -mutex2e :test: loadfree -exit1 :test: loadfree -condvar1 :test: loadfree -kill1 :test: loadfree -condvar1_1 :test: condvar1 -condvar1_2 :test: join2 -self1 :test: loadfree -condvar2 :test: condvar1 -condvar2_1 :test: condvar2 -create1 :test: mutex2 -create2 :test: create1 -reuse1 :test: create2 -reuse2 :test: reuse1 -cancel1 :test: create1 -cancel2 :test: cancel1 -mutex3 :test: create1 -mutex3r :test: create1 -mutex3e :test: create1 -mutex4 :test: mutex3 -mutex6 :test: mutex4 -mutex6n :test: mutex4 -mutex6e :test: mutex4 -mutex6r :test: mutex4 -mutex6s :test: mutex6 -mutex6rs :test: mutex6r -mutex6es :test: mutex6e -mutex7 :test: mutex6 -mutex7n :test: mutex6n -mutex7e :test: mutex6e -mutex7r :test: mutex6r -mutex8 :test: mutex7 -mutex8n :test: mutex7n -mutex8e :test: mutex7e -mutex8r :test: mutex7r -equal1 :test: create1 -exit2 :test: create1 -exit3 :test: create1 -exit4 :test: kill1 -exit5 :test: exit4 -join0 :test: create1 -join1 :test: create1 -join2 :test: create1 -join3 :test: join2 -count1 :test: join1 -once1 :test: create1 -tsd1 :test: join1 -self2 :test: create1 -eyal1 :test: tsd1 -condvar3 :test: create1 -condvar3_1 :test: condvar3 -condvar3_2 :test: condvar3_1 -condvar3_3 :test: condvar3_2 -condvar4 :test: create1 -condvar5 :test: condvar4 -condvar6 :test: condvar5 -condvar7 :test: condvar6 cleanup1 -condvar8 :test: condvar7 -condvar9 :test: condvar8 -errno1 :test: mutex3 -rwlock1 :test: condvar6 -rwlock2 :test: rwlock1 -rwlock3 :test: rwlock2 -rwlock4 :test: rwlock3 -rwlock5 :test: rwlock4 -rwlock6 :test: rwlock5 -rwlock7 :test: rwlock6 -rwlock8 :test: rwlock7 -rwlock2_t :test: rwlock2 -rwlock3_t :test: rwlock2_t -rwlock4_t :test: rwlock3_t -rwlock5_t :test: rwlock4_t -rwlock6_t :test: rwlock5_t -rwlock6_t2 :test: rwlock6_t -context1 :test: cancel2 -cancel3 :test: context1 -cancel4 :test: cancel3 -cancel5 :test: cancel3 -cancel6a :test: cancel3 -cancel6d :test: cancel3 -cancel7 :test: kill1 -cleanup0 :test: cancel5 -cleanup1 :test: cleanup0 -cleanup2 :test: cleanup1 -cleanup3 :test: cleanup2 -priority1 :test: join1 -priority2 :test: priority1 -inherit1 :test: join1 -spin1 :test: -spin2 :test: spin1.c -spin3 :test: spin2.c -spin4 :test: spin3.c -barrier1 :test: -barrier2 :test: barrier1.c -barrier3 :test: barrier2.c -barrier4 :test: barrier3.c -barrier5 :test: barrier4.c -benchtest1 :test: mutex3 -benchtest2 :test: benchtest1 -benchtest3 :test: benchtest2 -benchtest4 :test: benchtest3 -benchtest5 :test: benchtest4 -exception1 :test: cancel4 -exception2 :test: exception1 -exception3 :test: exception2 -exit4 :test: exit3 -valid1 :test: join1 -valid2 :test: valid1 -cancel9 :test: cancel8 diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/PROGRESS b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/PROGRESS deleted file mode 100644 index 9abf0bca471..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/PROGRESS +++ /dev/null @@ -1,4 +0,0 @@ -Please see the ANNOUNCE file "Level of Standards Conformance" -or the web page: - -http://sources.redhat.com/pthreads-win32/conformance.html diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README deleted file mode 100644 index 56493330258..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README +++ /dev/null @@ -1,593 +0,0 @@ -PTHREADS-WIN32 -============== - -Pthreads-win32 is free software, distributed under the GNU Lesser -General Public License (LGPL). See the file 'COPYING.LIB' for terms -and conditions. Also see the file 'COPYING' for information -specific to pthreads-win32, copyrights and the LGPL. - - -What is it? ------------ - -Pthreads-win32 is an Open Source Software implementation of the -Threads component of the POSIX 1003.1c 1995 Standard (or later) -for Microsoft's Win32 environment. Some functions from POSIX -1003.1b are also supported including semaphores. Other related -functions include the set of read-write lock functions. The -library also supports some of the functionality of the Open -Group's Single Unix specification, version 2, namely mutex types, -plus some common and pthreads-win32 specific non-portable -routines (see README.NONPORTABLE). - -See the file "ANNOUNCE" for more information including standards -conformance details and the list of supported and unsupported -routines. - - -Prerequisites -------------- -MSVC or GNU C (MinGW32 MSys development kit) - To build from source. - -QueueUserAPCEx by Panagiotis E. Hadjidoukas - For true async cancelation of threads (including blocked threads). - This is a DLL and Windows driver that provides pre-emptive APC - by forcing threads into an alertable state when the APC is queued. - Both the DLL and driver are provided with the pthreads-win32.exe - self-unpacking ZIP, and on the pthreads-win32 FTP site (in source - and pre-built forms). Currently this is a separate LGPL package to - pthreads-win32. See the README in the QueueUserAPCEx folder for - installation instructions. - - Pthreads-win32 will automatically detect if the QueueUserAPCEx DLL - QuserEx.DLL is available and whether the driver AlertDrv.sys is - loaded. If it is not available, pthreads-win32 will simulate async - cancelation, which means that it can async cancel only threads that - are runnable. The simulated async cancellation cannot cancel blocked - threads. - - -Library naming --------------- - -Because the library is being built using various exception -handling schemes and compilers - and because the library -may not work reliably if these are mixed in an application, -each different version of the library has it's own name. - -Note 1: the incompatibility is really between EH implementations -of the different compilers. It should be possible to use the -standard C version from either compiler with C++ applications -built with a different compiler. If you use an EH version of -the library, then you must use the same compiler for the -application. This is another complication and dependency that -can be avoided by using only the standard C library version. - -Note 2: if you use a standard C pthread*.dll with a C++ -application, then any functions that you define that are -intended to be called via pthread_cleanup_push() must be -__cdecl. - -Note 3: the intention was to also name either the VC or GC -version (it should be arbitrary) as pthread.dll, including -pthread.lib and libpthread.a as appropriate. This is no longer -likely to happen. - -Note 4: the compatibility number was added so that applications -can differentiate between binary incompatible versions of the -libs and dlls. - -In general: - pthread[VG]{SE,CE,C}c.dll - pthread[VG]{SE,CE,C}c.lib - -where: - [VG] indicates the compiler - V - MS VC, or - G - GNU C - - {SE,CE,C} indicates the exception handling scheme - SE - Structured EH, or - CE - C++ EH, or - C - no exceptions - uses setjmp/longjmp - - c - DLL compatibility number indicating ABI and API - compatibility with applications built against - any snapshot with the same compatibility number. - See 'Version numbering' below. - -The name may also be suffixed by a 'd' to indicate a debugging version -of the library. E.g. pthreadVC2d.lib. Debugging versions contain -additional information for debugging (symbols etc) and are often not -optimised in any way (compiled with optimisation turned off). - -For example: - pthreadVSE.dll (MSVC/SEH) - pthreadGCE.dll (GNUC/C++ EH) - pthreadGC.dll (GNUC/not dependent on exceptions) - pthreadVC1.dll (MSVC/not dependent on exceptions - not binary - compatible with pthreadVC.dll) - pthreadVC2.dll (MSVC/not dependent on exceptions - not binary - compatible with pthreadVC1.dll or pthreadVC.dll) - -The GNU library archive file names have correspondingly changed to: - - libpthreadGCEc.a - libpthreadGCc.a - - -Versioning numbering --------------------- - -Version numbering is separate from the snapshot dating system, and -is the canonical version identification system embedded within the -DLL using the Microsoft version resource system. The versioning -system chosen follows the GNU Libtool system. See -http://www.gnu.org/software/libtool/manual.html section 6.2. - -See the resource file 'version.rc'. - -Microsoft version numbers use 4 integers: - - 0.0.0.0 - -Pthreads-win32 uses the first 3 following the Libtool convention. -The fourth is commonly used for the build number, but will be reserved -for future use. - - current.revision.age.0 - -The numbers are changed as follows: - -1. If the library source code has changed at all since the last update, - then increment revision (`c:r:a' becomes `c:r+1:a'). -2. If any interfaces have been added, removed, or changed since the last - update, increment current, and set revision to 0. -3. If any interfaces have been added since the last public release, then - increment age. -4. If any interfaces have been removed or changed since the last public - release, then set age to 0. - - -DLL compatibility numbering is an attempt to ensure that applications -always load a compatible pthreads-win32 DLL by using a DLL naming system -that is consistent with the version numbering system. It also allows -older and newer DLLs to coexist in the same filesystem so that older -applications can continue to be used. For pre .NET Windows systems, -this inevitably requires incompatible versions of the same DLLs to have -different names. - -Pthreads-win32 has adopted the Cygwin convention of appending a single -integer number to the DLL name. The number used is based on the library -version number and is computed as 'current' - 'age'. - -(See http://home.att.net/~perlspinr/libversioning.html for a nicely -detailed explanation.) - -Using this method, DLL name/s will only change when the DLL's -backwards compatibility changes. Note that the addition of new -'interfaces' will not of itself change the DLL's compatibility for older -applications. - - -Which of the several dll versions to use? ------------------------------------------ -or, ---- -What are all these pthread*.dll and pthread*.lib files? -------------------------------------------------------- - -Simple, use either pthreadGCv.* if you use GCC, or pthreadVCv.* if you -use MSVC - where 'v' is the DLL versioning (compatibility) number. - -Otherwise, you need to choose carefully and know WHY. - -The most important choice you need to make is whether to use a -version that uses exceptions internally, or not. There are versions -of the library that use exceptions as part of the thread -cancelation and exit implementation. The default version uses -setjmp/longjmp. - -There is some contension amongst POSIX threads experts as -to how POSIX threads cancelation and exit should work -with languages that use exceptions, e.g. C++ and even C -(Microsoft's Structured Exceptions). - -The issue is: should cancelation of a thread in, say, -a C++ application cause object destructors and C++ exception -handlers to be invoked as the stack unwinds during thread -exit, or not? - -There seems to be more opinion in favour of using the -standard C version of the library (no EH) with C++ applications -for the reason that this appears to be the assumption commercial -pthreads implementations make. Therefore, if you use an EH version -of pthreads-win32 then you may be under the illusion that -your application will be portable, when in fact it is likely to -behave differently when linked with other pthreads libraries. - -Now you may be asking: then why have you kept the EH versions of -the library? - -There are a couple of reasons: -- there is division amongst the experts and so the code may - be needed in the future. Yes, it's in the repository and we - can get it out anytime in the future, but it would be difficult - to find. -- pthreads-win32 is one of the few implementations, and possibly - the only freely available one, that has EH versions. It may be - useful to people who want to play with or study application - behaviour under these conditions. - -Notes: - -[If you use either pthreadVCE or pthreadGCE] - -1. [See also the discussion in the FAQ file - Q2, Q4, and Q5] - -If your application contains catch(...) blocks in your POSIX -threads then you will need to replace the "catch(...)" with the macro -"PtW32Catch", eg. - - #ifdef PtW32Catch - PtW32Catch { - ... - } - #else - catch(...) { - ... - } - #endif - -Otherwise neither pthreads cancelation nor pthread_exit() will work -reliably when using versions of the library that use C++ exceptions -for cancelation and thread exit. - -This is due to what is believed to be a C++ compliance error in VC++ -whereby you may not have multiple handlers for the same exception in -the same try/catch block. GNU G++ doesn't have this restriction. - - -Other name changes ------------------- - -All snapshots prior to and including snapshot 2000-08-13 -used "_pthread_" as the prefix to library internal -functions, and "_PTHREAD_" to many library internal -macros. These have now been changed to "ptw32_" and "PTW32_" -respectively so as to not conflict with the ANSI standard's -reservation of identifiers beginning with "_" and "__" for -use by compiler implementations only. - -If you have written any applications and you are linking -statically with the pthreads-win32 library then you may have -included a call to _pthread_processInitialize. You will -now have to change that to ptw32_processInitialize. - - -Cleanup code default style --------------------------- - -Previously, if not defined, the cleanup style was determined automatically -from the compiler used, and one of the following was defined accordingly: - - __CLEANUP_SEH MSVC only - __CLEANUP_CXX C++, including MSVC++, GNU G++ - __CLEANUP_C C, including GNU GCC, not MSVC - -These defines determine the style of cleanup (see pthread.h) and, -most importantly, the way that cancelation and thread exit (via -pthread_exit) is performed (see the routine ptw32_throw()). - -In short, the exceptions versions of the library throw an exception -when a thread is canceled, or exits via pthread_exit(). This exception is -caught by a handler in the thread startup routine, so that the -the correct stack unwinding occurs regardless of where the thread -is when it's canceled or exits via pthread_exit(). - -In this snapshot, unless the build explicitly defines (e.g. via a -compiler option) __CLEANUP_SEH, __CLEANUP_CXX, or __CLEANUP_C, then -the build NOW always defaults to __CLEANUP_C style cleanup. This style -uses setjmp/longjmp in the cancelation and pthread_exit implementations, -and therefore won't do stack unwinding even when linked to applications -that have it (e.g. C++ apps). This is for consistency with most/all -commercial Unix POSIX threads implementations. - -Although it was not clearly documented before, it is still necessary to -build your application using the same __CLEANUP_* define as was -used for the version of the library that you link with, so that the -correct parts of pthread.h are included. That is, the possible -defines require the following library versions: - - __CLEANUP_SEH pthreadVSE.dll - __CLEANUP_CXX pthreadVCE.dll or pthreadGCE.dll - __CLEANUP_C pthreadVC.dll or pthreadGC.dll - -It is recommended that you let pthread.h use it's default __CLEANUP_C -for both library and application builds. That is, don't define any of -the above, and then link with pthreadVC.lib (MSVC or MSVC++) and -libpthreadGC.a (MinGW GCC or G++). The reason is explained below, but -another reason is that the prebuilt pthreadVCE.dll is currently broken. -Versions built with MSVC++ later than version 6 may not be broken, but I -can't verify this yet. - -WHY ARE WE MAKING THE DEFAULT STYLE LESS EXCEPTION-FRIENDLY? -Because no commercial Unix POSIX threads implementation allows you to -choose to have stack unwinding. Therefore, providing it in pthread-win32 -as a default is dangerous. We still provide the choice but unless -you consciously choose to do otherwise, your pthreads applications will -now run or crash in similar ways irrespective of the pthreads platform -you use. Or at least this is the hope. - - -Building under VC++ using C++ EH, Structured EH, or just C ----------------------------------------------------------- - -From the source directory run nmake without any arguments to list -help information. E.g. - -$ nmake - -Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 -Copyright (C) Microsoft Corp 1988-1998. All rights reserved. - -Run one of the following command lines: -nmake clean VCE (to build the MSVC dll with C++ exception handling) -nmake clean VSE (to build the MSVC dll with structured exception handling) -nmake clean VC (to build the MSVC dll with C cleanup code) -nmake clean VCE-inlined (to build the MSVC inlined dll with C++ exception handling) -nmake clean VSE-inlined (to build the MSVC inlined dll with structured exception handling) -nmake clean VC-inlined (to build the MSVC inlined dll with C cleanup code) -nmake clean VC-static (to build the MSVC static lib with C cleanup code) -nmake clean VCE-debug (to build the debug MSVC dll with C++ exception handling) -nmake clean VSE-debug (to build the debug MSVC dll with structured exception handling) -nmake clean VC-debug (to build the debug MSVC dll with C cleanup code) -nmake clean VCE-inlined-debug (to build the debug MSVC inlined dll with C++ exception handling) -nmake clean VSE-inlined-debug (to build the debug MSVC inlined dll with structured exception handling) -nmake clean VC-inlined-debug (to build the debug MSVC inlined dll with C cleanup code) -nmake clean VC-static-debug (to build the debug MSVC static lib with C cleanup code) - - -The pre-built dlls are normally built using the *-inlined targets. - -You can run the testsuite by changing to the "tests" directory and -running nmake. E.g.: - -$ cd tests -$ nmake - -Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 -Copyright (C) Microsoft Corp 1988-1998. All rights reserved. - -Run one of the following command lines: -nmake clean VC (to test using VC dll with VC (no EH) applications) -nmake clean VCX (to test using VC dll with VC++ (EH) applications) -nmake clean VCE (to test using the VCE dll with VC++ EH applications) -nmake clean VSE (to test using VSE dll with VC (SEH) applications) -nmake clean VC-bench (to benchtest using VC dll with C bench app) -nmake clean VCX-bench (to benchtest using VC dll with C++ bench app) -nmake clean VCE-bench (to benchtest using VCE dll with C++ bench app) -nmake clean VSE-bench (to benchtest using VSE dll with SEH bench app) -nmake clean VC-static (to test using VC static lib with VC (no EH) applications) - - -Building under Mingw32 ----------------------- - -The dll can be built easily with recent versions of Mingw32. -(The distributed versions are built using Mingw32 and MsysDTK -from www.mingw32.org.) - -From the source directory, run make for help information. E.g.: - -$ make -Run one of the following command lines: -make clean GC (to build the GNU C dll with C cleanup code) -make clean GCE (to build the GNU C dll with C++ exception handling) -make clean GC-inlined (to build the GNU C inlined dll with C cleanup code) -make clean GCE-inlined (to build the GNU C inlined dll with C++ exception handling) -make clean GC-static (to build the GNU C inlined static lib with C cleanup code) -make clean GC-debug (to build the GNU C debug dll with C cleanup code) -make clean GCE-debug (to build the GNU C debug dll with C++ exception handling) -make clean GC-inlined-debug (to build the GNU C inlined debug dll with C cleanup code) -make clean GCE-inlined-debug (to build the GNU C inlined debug dll with C++ exception handling) -make clean GC-static-debug (to build the GNU C inlined static debug lib with C cleanup code) - - -The pre-built dlls are normally built using the *-inlined targets. - -You can run the testsuite by changing to the "tests" directory and -running make for help information. E.g.: - -$ cd tests -$ make -Run one of the following command lines: -make clean GC (to test using GC dll with C (no EH) applications) -make clean GCX (to test using GC dll with C++ (EH) applications) -make clean GCE (to test using GCE dll with C++ (EH) applications) -make clean GC-bench (to benchtest using GNU C dll with C cleanup code) -make clean GCE-bench (to benchtest using GNU C dll with C++ exception handling) -make clean GC-static (to test using GC static lib with C (no EH) applications) - - -Building under Linux using the Mingw32 cross development tools --------------------------------------------------------------- - -You can build the library without leaving Linux by using the Mingw32 cross -development toolchain. See http://www.libsdl.org/extras/win32/cross/ for -tools and info. The GNUmakefile contains some support for this, for example: - -make CROSS=i386-mingw32msvc- clean GC-inlined - -will build pthreadGCn.dll and libpthreadGCn.a (n=version#), provided your -cross-tools/bin directory is in your PATH (or use the cross-make.sh script -at the URL above). - - -Building the library as a statically linkable library ------------------------------------------------------ - -General: PTW32_STATIC_LIB must be defined for both the library build and the -application build. The makefiles supplied and used by the following 'make' -command lines will define this for you. - -MSVC (creates pthreadVCn.lib as a static link lib): - -nmake clean VC-static - - -MinGW32 (creates libpthreadGCn.a as a static link lib): - -make clean GC-static - - -Define PTW32_STATIC_LIB when building your application. Also, your -application must call a two non-portable routines to initialise the -some state on startup and cleanup before exit. One other routine needs -to be called to cleanup after any Win32 threads have called POSIX API -routines. See README.NONPORTABLE or the html reference manual pages for -details on these routines: - -BOOL pthread_win32_process_attach_np (void); -BOOL pthread_win32_process_detach_np (void); -BOOL pthread_win32_thread_attach_np (void); // Currently a no-op -BOOL pthread_win32_thread_detach_np (void); - - -The tests makefiles have the same targets but only check that the -static library is statically linkable. They don't run the full -testsuite. To run the full testsuite, build the dlls and run the -dll test targets. - - -Building the library under Cygwin ---------------------------------- - -Cygwin is implementing it's own POSIX threads routines and these -will be the ones to use if you develop using Cygwin. - - -Ready to run binaries ---------------------- - -For convenience, the following ready-to-run files can be downloaded -from the FTP site (see under "Availability" below): - - pthread.h - semaphore.h - sched.h - pthreadVC.dll - built with MSVC compiler using C setjmp/longjmp - pthreadVC.lib - pthreadVCE.dll - built with MSVC++ compiler using C++ EH - pthreadVCE.lib - pthreadVSE.dll - built with MSVC compiler using SEH - pthreadVSE.lib - pthreadGC.dll - built with Mingw32 GCC - libpthreadGC.a - derived from pthreadGC.dll - pthreadGCE.dll - built with Mingw32 G++ - libpthreadGCE.a - derived from pthreadGCE.dll - -As of August 2003 pthreads-win32 pthreadG* versions are built and tested -using the MinGW + MsysDTK environment current as of that date or later. -The following file MAY be needed for older MinGW environments. - - gcc.dll - needed to build and run applications that use - pthreadGCE.dll. - - -Building applications with GNU compilers ----------------------------------------- - -If you're using pthreadGC.dll: - -With the three header files, pthreadGC.dll and libpthreadGC.a in the -same directory as your application myapp.c, you could compile, link -and run myapp.c under Mingw32 as follows: - - gcc -o myapp.exe myapp.c -I. -L. -lpthreadGC - myapp - -Or put pthreadGC.dll in an appropriate directory in your PATH, -put libpthreadGC.a in your system lib directory, and -put the three header files in your system include directory, -then use: - - gcc -o myapp.exe myapp.c -lpthreadGC - myapp - - -If you're using pthreadGCE.dll: - -With the three header files, pthreadGCE.dll, gcc.dll and libpthreadGCE.a -in the same directory as your application myapp.c, you could compile, -link and run myapp.c under Mingw32 as follows: - - gcc -x c++ -o myapp.exe myapp.c -I. -L. -lpthreadGCE - myapp - -Or put pthreadGCE.dll and gcc.dll in an appropriate directory in -your PATH, put libpthreadGCE.a in your system lib directory, and -put the three header files in your system include directory, -then use: - - gcc -x c++ -o myapp.exe myapp.c -lpthreadGCE - myapp - - -Availability ------------- - -The complete source code in either unbundled, self-extracting -Zip file, or tar/gzipped format can be found at: - - ftp://sources.redhat.com/pub/pthreads-win32 - -The pre-built DLL, export libraries and matching pthread.h can -be found at: - - ftp://sources.redhat.com/pub/pthreads-win32/dll-latest - -Home page: - - http://sources.redhat.com/pthreads-win32/ - - -Mailing list ------------- - -There is a mailing list for discussing pthreads on Win32. -To join, send email to: - - pthreads-win32-subscribe@sources.redhat.com - -Unsubscribe by sending mail to: - - pthreads-win32-unsubscribe@sources.redhat.com - - -Acknowledgements ----------------- - -See the ANNOUNCE file for acknowledgements. -See the 'CONTRIBUTORS' file for the list of contributors. - -As much as possible, the ChangeLog file attributes -contributions and patches that have been incorporated -in the library to the individuals responsible. - -Finally, thanks to all those who work on and contribute to the -POSIX and Single Unix Specification standards. The maturity of an -industry can be measured by it's open standards. - ----- -Ross Johnson - - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.Borland b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.Borland deleted file mode 100644 index a130d2bd270..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.Borland +++ /dev/null @@ -1,57 +0,0 @@ -In ptw32_InterlockedCompareExchange.c, I've added a section for -Borland's compiler; it's identical to that for the MS compiler except -that it uses /* ... */ comments instead of ; comments. - -[RPJ: need to define HAVE_TASM32 in config.h to use the above.] - - -The other file is a makefile suitable for use with Borland's compiler -(run "make -fBmakefile" in the directory). It builds a single version -of the library, pthreadBC.dll and the corresponding pthreadBC.lib -import library, which is comparable to the pthreadVC version; I can't -personally see any demand for the versions that include structured or -C++ exception cancellation handling so I haven't attempted to build -those versions of the library. (I imagine a static version might be -of use to some, but we can't legally use that on my commercial -projects so I can't try that out, unfortunately.) - -[RPJ: Added tests\Bmakefile as well.] - -Borland C++ doesn't define the ENOSYS constant used by pthreads-win32; -rather than make more extensive patches to the pthreads-win32 source I -have a mostly-arbitrary constant for it in the makefile. However this -doesn't make it visible to the application using the library, so if -anyone actually wants to use this constant in their apps (why?) -someone might like to make a seperate NEED_BCC_something define to add -this stuff. - -The makefile also #defines EDEADLK as EDEADLOCK, _timeb as timeb, and -_ftime as ftime, to deal with the minor differences between the two -RTLs' naming conventions, and sets the compiler flags as required to -get a normal compile of the library. - -[RPJ: Moved errno values and _timeb etc to pthread.h, so apps will also -use them.] - -(While I'm on the subject, the reason Borland users should recompile -the library, rather than using the impdef/implib technique suggested -previously on the mailing list, is that a) the errno constants are -different, so the results returned by the pthread_* functions can be -meaningless, and b) the errno variable/pseudo-variable itself is -different in the MS & BCC runtimes, so you can't access the -pthreadVC's errno from a Borland C++-compiled host application -correctly - I imagine there are other potential problems from the RTL -mismatch too.) - -[RPJ: Make sure you use the same RTL in both dll and application builds. -The dll and tests Bmakefiles use cw32mti.lib. Having some trouble with -memory read exceptions running the test suite using BCC55.] - -Best regards, -Will - --- -Will Bryant -Systems Architect, eCOSM Limited -Cell +64 21 655 443, office +64 3 365 4176 -http://www.ecosm.com/ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.CV b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.CV deleted file mode 100644 index 698728b95b6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.CV +++ /dev/null @@ -1,3036 +0,0 @@ -README.CV -- Condition Variables --------------------------------- - -The original implementation of condition variables in -pthreads-win32 was based on a discussion paper: - -"Strategies for Implementing POSIX Condition Variables -on Win32": http://www.cs.wustl.edu/~schmidt/win32-cv-1.html - -The changes suggested below were made on Feb 6 2001. This -file is included in the package for the benefit of anyone -interested in understanding the pthreads-win32 implementation -of condition variables and the (sometimes subtle) issues that -it attempts to resolve. - -Thanks go to the individuals whose names appear throughout -the following text. - -Ross Johnson - --------------------------------------------------------------------- - -fyi.. (more detailed problem description/demos + possible fix/patch) - -regards, -alexander. - - -Alexander Terekhov -31.01.2001 17:43 - -To: ace-bugs@cs.wustl.edu -cc: -From: Alexander Terekhov/Germany/IBM@IBMDE -Subject: Implementation of POSIX CVs: spur.wakeups/lost - signals/deadlocks/unfairness - - - - ACE VERSION: - - 5.1.12 (pthread-win32 snapshot 2000-12-29) - - HOST MACHINE and OPERATING SYSTEM: - - IBM IntelliStation Z Pro, 2 x XEON 1GHz, Win2K - - TARGET MACHINE and OPERATING SYSTEM, if different from HOST: - COMPILER NAME AND VERSION (AND PATCHLEVEL): - - Microsoft Visual C++ 6.0 - - AREA/CLASS/EXAMPLE AFFECTED: - - Implementation of POSIX condition variables - OS.cpp/.h - - DOES THE PROBLEM AFFECT: - - EXECUTION? YES! - - SYNOPSIS: - - a) spurious wakeups (minor problem) - b) lost signals - c) broadcast deadlock - d) unfairness (minor problem) - - DESCRIPTION: - - Please see attached copy of discussion thread - from comp.programming.threads for more details on - some reported problems. (i've also posted a "fyi" - message to ace-users a week or two ago but - unfortunately did not get any response so far). - - It seems that current implementation suffers from - two essential problems: - - 1) cond.waiters_count does not accurately reflect - number of waiters blocked on semaphore - w/o - proper synchronisation that could result (in the - time window when counter is not accurate) - in spurious wakeups organised by subsequent - _signals and _broadcasts. - - 2) Always having (with no e.g. copy_and_clear/..) - the same queue in use (semaphore+counter) - neither signal nor broadcast provide 'atomic' - behaviour with respect to other threads/subsequent - calls to signal/broadcast/wait. - - Each problem and combination of both could produce - various nasty things: - - a) spurious wakeups (minor problem) - - it is possible that waiter(s) which was already - unblocked even so is still counted as blocked - waiter. signal and broadcast will release - semaphore which will produce a spurious wakeup - for a 'real' waiter coming later. - - b) lost signals - - signalling thread ends up consuming its own - signal. please see demo/discussion below. - - c) broadcast deadlock - - last_waiter processing code does not correctly - handle the case with multiple threads - waiting for the end of broadcast. - please see demo/discussion below. - - d) unfairness (minor problem) - - without SignalObjectAndWait some waiter(s) - may end up consuming broadcasted signals - multiple times (spurious wakeups) because waiter - thread(s) can be preempted before they call - semaphore wait (but after count++ and mtx.unlock). - - REPEAT BY: - - See below... run problem demos programs (tennis.cpp and - tennisb.cpp) number of times concurrently (on multiprocessor) - and in multiple sessions or just add a couple of "Sleep"s - as described in the attached copy of discussion thread - from comp.programming.threads - - SAMPLE FIX/WORKAROUND: - - See attached patch to pthread-win32.. well, I can not - claim that it is completely bug free but at least my - test and tests provided by pthreads-win32 seem to work. - Perhaps that will help. - - regards, - alexander. - - ->> Forum: comp.programming.threads ->> Thread: pthread_cond_* implementation questions -. -. -. -David Schwartz wrote: - -> terekhov@my-deja.com wrote: -> ->> BTW, could you please also share your view on other perceived ->> "problems" such as nested broadcast deadlock, spurious wakeups ->> and (the latest one) lost signals?? -> ->I'm not sure what you mean. The standard allows an implementation ->to do almost whatever it likes. In fact, you could implement ->pthread_cond_wait by releasing the mutex, sleeping a random ->amount of time, and then reacquiring the mutex. Of course, ->this would be a pretty poor implementation, but any code that ->didn't work under that implementation wouldn't be strictly ->compliant. - -The implementation you suggested is indeed correct -one (yes, now I see it :). However it requires from -signal/broadcast nothing more than to "{ return 0; }" -That is not the case for pthread-win32 and ACE -implementations. I do think that these implementations -(basically the same implementation) have some serious -problems with wait/signal/broadcast calls. I am looking -for help to clarify whether these problems are real -or not. I think that I can demonstrate what I mean -using one or two small sample programs. -. -. -. -========== -tennis.cpp -========== - -#include "ace/Synch.h" -#include "ace/Thread.h" - -enum GAME_STATE { - - START_GAME, - PLAYER_A, // Player A playes the ball - PLAYER_B, // Player B playes the ball - GAME_OVER, - ONE_PLAYER_GONE, - BOTH_PLAYERS_GONE - -}; - -enum GAME_STATE eGameState; -ACE_Mutex* pmtxGameStateLock; -ACE_Condition< ACE_Mutex >* pcndGameStateChange; - -void* - playerA( - void* pParm - ) -{ - - // For access to game state variable - pmtxGameStateLock->acquire(); - - // Play loop - while ( eGameState < GAME_OVER ) { - - // Play the ball - cout << endl << "PLAYER-A" << endl; - - // Now its PLAYER-B's turn - eGameState = PLAYER_B; - - // Signal to PLAYER-B that now it is his turn - pcndGameStateChange->signal(); - - // Wait until PLAYER-B finishes playing the ball - do { - - pcndGameStateChange->wait(); - - if ( PLAYER_B == eGameState ) - cout << endl << "----PLAYER-A: SPURIOUS WAKEUP!!!" << endl; - - } while ( PLAYER_B == eGameState ); - - } - - // PLAYER-A gone - eGameState = (GAME_STATE)(eGameState+1); - cout << endl << "PLAYER-A GONE" << endl; - - // No more access to state variable needed - pmtxGameStateLock->release(); - - // Signal PLAYER-A gone event - pcndGameStateChange->broadcast(); - - return 0; - -} - -void* - playerB( - void* pParm - ) -{ - - // For access to game state variable - pmtxGameStateLock->acquire(); - - // Play loop - while ( eGameState < GAME_OVER ) { - - // Play the ball - cout << endl << "PLAYER-B" << endl; - - // Now its PLAYER-A's turn - eGameState = PLAYER_A; - - // Signal to PLAYER-A that now it is his turn - pcndGameStateChange->signal(); - - // Wait until PLAYER-A finishes playing the ball - do { - - pcndGameStateChange->wait(); - - if ( PLAYER_A == eGameState ) - cout << endl << "----PLAYER-B: SPURIOUS WAKEUP!!!" << endl; - - } while ( PLAYER_A == eGameState ); - - } - - // PLAYER-B gone - eGameState = (GAME_STATE)(eGameState+1); - cout << endl << "PLAYER-B GONE" << endl; - - // No more access to state variable needed - pmtxGameStateLock->release(); - - // Signal PLAYER-B gone event - pcndGameStateChange->broadcast(); - - return 0; - -} - - -int -main (int, ACE_TCHAR *[]) -{ - - pmtxGameStateLock = new ACE_Mutex(); - pcndGameStateChange = new ACE_Condition< ACE_Mutex >( *pmtxGameStateLock -); - - // Set initial state - eGameState = START_GAME; - - // Create players - ACE_Thread::spawn( playerA ); - ACE_Thread::spawn( playerB ); - - // Give them 5 sec. to play - Sleep( 5000 );//sleep( 5 ); - - // Set game over state - pmtxGameStateLock->acquire(); - eGameState = GAME_OVER; - - // Let them know - pcndGameStateChange->broadcast(); - - // Wait for players to stop - do { - - pcndGameStateChange->wait(); - - } while ( eGameState < BOTH_PLAYERS_GONE ); - - // Cleanup - cout << endl << "GAME OVER" << endl; - pmtxGameStateLock->release(); - delete pcndGameStateChange; - delete pmtxGameStateLock; - - return 0; - -} - -=========== -tennisb.cpp -=========== -#include "ace/Synch.h" -#include "ace/Thread.h" - -enum GAME_STATE { - - START_GAME, - PLAYER_A, // Player A playes the ball - PLAYER_B, // Player B playes the ball - GAME_OVER, - ONE_PLAYER_GONE, - BOTH_PLAYERS_GONE - -}; - -enum GAME_STATE eGameState; -ACE_Mutex* pmtxGameStateLock; -ACE_Condition< ACE_Mutex >* pcndGameStateChange; - -void* - playerA( - void* pParm - ) -{ - - // For access to game state variable - pmtxGameStateLock->acquire(); - - // Play loop - while ( eGameState < GAME_OVER ) { - - // Play the ball - cout << endl << "PLAYER-A" << endl; - - // Now its PLAYER-B's turn - eGameState = PLAYER_B; - - // Signal to PLAYER-B that now it is his turn - pcndGameStateChange->broadcast(); - - // Wait until PLAYER-B finishes playing the ball - do { - - pcndGameStateChange->wait(); - - if ( PLAYER_B == eGameState ) - cout << endl << "----PLAYER-A: SPURIOUS WAKEUP!!!" << endl; - - } while ( PLAYER_B == eGameState ); - - } - - // PLAYER-A gone - eGameState = (GAME_STATE)(eGameState+1); - cout << endl << "PLAYER-A GONE" << endl; - - // No more access to state variable needed - pmtxGameStateLock->release(); - - // Signal PLAYER-A gone event - pcndGameStateChange->broadcast(); - - return 0; - -} - -void* - playerB( - void* pParm - ) -{ - - // For access to game state variable - pmtxGameStateLock->acquire(); - - // Play loop - while ( eGameState < GAME_OVER ) { - - // Play the ball - cout << endl << "PLAYER-B" << endl; - - // Now its PLAYER-A's turn - eGameState = PLAYER_A; - - // Signal to PLAYER-A that now it is his turn - pcndGameStateChange->broadcast(); - - // Wait until PLAYER-A finishes playing the ball - do { - - pcndGameStateChange->wait(); - - if ( PLAYER_A == eGameState ) - cout << endl << "----PLAYER-B: SPURIOUS WAKEUP!!!" << endl; - - } while ( PLAYER_A == eGameState ); - - } - - // PLAYER-B gone - eGameState = (GAME_STATE)(eGameState+1); - cout << endl << "PLAYER-B GONE" << endl; - - // No more access to state variable needed - pmtxGameStateLock->release(); - - // Signal PLAYER-B gone event - pcndGameStateChange->broadcast(); - - return 0; - -} - - -int -main (int, ACE_TCHAR *[]) -{ - - pmtxGameStateLock = new ACE_Mutex(); - pcndGameStateChange = new ACE_Condition< ACE_Mutex >( *pmtxGameStateLock -); - - // Set initial state - eGameState = START_GAME; - - // Create players - ACE_Thread::spawn( playerA ); - ACE_Thread::spawn( playerB ); - - // Give them 5 sec. to play - Sleep( 5000 );//sleep( 5 ); - - // Make some noise - pmtxGameStateLock->acquire(); - cout << endl << "---Noise ON..." << endl; - pmtxGameStateLock->release(); - for ( int i = 0; i < 100000; i++ ) - pcndGameStateChange->broadcast(); - cout << endl << "---Noise OFF" << endl; - - // Set game over state - pmtxGameStateLock->acquire(); - eGameState = GAME_OVER; - cout << endl << "---Stopping the game..." << endl; - - // Let them know - pcndGameStateChange->broadcast(); - - // Wait for players to stop - do { - - pcndGameStateChange->wait(); - - } while ( eGameState < BOTH_PLAYERS_GONE ); - - // Cleanup - cout << endl << "GAME OVER" << endl; - pmtxGameStateLock->release(); - delete pcndGameStateChange; - delete pmtxGameStateLock; - - return 0; - -} -. -. -. -David Schwartz wrote: ->> > It's compliant ->> ->> That is really good. -> ->> Tomorrow (I have to go urgently now) I will try to ->> demonstrate the lost-signal "problem" of current ->> pthread-win32 and ACE-(variant w/o SingleObjectAndWait) ->> implementations: players start suddenly drop their balls :-) ->> (with no change in source code). -> ->Signals aren't lost, they're going to the main thread, ->which isn't coded correctly to handle them. Try this: -> -> // Wait for players to stop -> do { -> -> pthread_cond_wait( &cndGameStateChange,&mtxGameStateLock ); ->printf("Main thread stole a signal\n"); -> -> } while ( eGameState < BOTH_PLAYERS_GONE ); -> ->I bet everytime you thing a signal is lost, you'll see that printf. ->The signal isn't lost, it was stolen by another thread. - -well, you can probably loose your bet.. it was indeed stolen -by "another" thread but not the one you seem to think of. - -I think that what actually happens is the following: - -H:\SA\UXX\pt\PTHREADS\TESTS>tennis3.exe - -PLAYER-A - -PLAYER-B - -----PLAYER-B: SPURIOUS WAKEUP!!! - -PLAYER-A GONE - -PLAYER-B GONE - -GAME OVER - -H:\SA\UXX\pt\PTHREADS\TESTS> - -here you can see that PLAYER-B after playing his first -ball (which came via signal from PLAYER-A) just dropped -it down. What happened is that his signal to player A -was consumed as spurious wakeup by himself (player B). - -The implementation has a problem: - -================ -waiting threads: -================ - -{ /** Critical Section - - inc cond.waiters_count - -} - - /* - /* Atomic only if using Win32 SignalObjectAndWait - /* - cond.mtx.release - - /*** ^^-- A THREAD WHICH DID SIGNAL MAY ACQUIRE THE MUTEX, - /*** GO INTO WAIT ON THE SAME CONDITION AND OVERTAKE - /*** ORIGINAL WAITER(S) CONSUMING ITS OWN SIGNAL! - - cond.sem.wait - -Player-A after playing game's initial ball went into -wait (called _wait) but was pre-empted before reaching -wait semaphore. He was counted as waiter but was not -actually waiting/blocked yet. - -=============== -signal threads: -=============== - -{ /** Critical Section - - waiters_count = cond.waiters_count - -} - - if ( waiters_count != 0 ) - - sem.post 1 - - endif - -Player-B after he received signal/ball from Player A -called _signal. The _signal did see that there was -one waiter blocked on the condition (Player-A) and -released the semaphore.. (but it did not unblock -Player-A because he was not actually blocked). -Player-B thread continued its execution, called _wait, -was counted as second waiter BUT was allowed to slip -through opened semaphore gate (which was opened for -Player-B) and received his own signal. Player B remained -blocked followed by Player A. Deadlock happened which -lasted until main thread came in and said game over. - -It seems to me that the implementation fails to -correctly implement the following statement -from specification: - -http://www.opengroup.org/ -onlinepubs/007908799/xsh/pthread_cond_wait.html - -"These functions atomically release mutex and cause -the calling thread to block on the condition variable -cond; atomically here means "atomically with respect -to access by another thread to the mutex and then the -condition variable". That is, if another thread is -able to acquire the mutex after the about-to-block -thread has released it, then a subsequent call to -pthread_cond_signal() or pthread_cond_broadcast() -in that thread behaves as if it were issued after -the about-to-block thread has blocked." - -Question: Am I right? - -(I produced the program output above by simply -adding ?Sleep( 1 )?: - -================ -waiting threads: -================ - -{ /** Critical Section - - inc cond.waiters_count - -} - - /* - /* Atomic only if using Win32 SignalObjectAndWait - /* - cond.mtx.release - -Sleep( 1 ); // Win32 - - /*** ^^-- A THREAD WHICH DID SIGNAL MAY ACQUIRE THE MUTEX, - /*** GO INTO WAIT ON THE SAME CONDITION AND OVERTAKE - /*** ORIGINAL WAITER(S) CONSUMING ITS OWN SIGNAL! - - cond.sem.wait - -to the source code of pthread-win32 implementation: - -http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/ -condvar.c?rev=1.36&content-type=text/ -x-cvsweb-markup&cvsroot=pthreads-win32 - - - /* - * We keep the lock held just long enough to increment the count of - * waiters by one (above). - * Note that we can't keep it held across the - * call to sem_wait since that will deadlock other calls - * to pthread_cond_signal - */ - cleanup_args.mutexPtr = mutex; - cleanup_args.cv = cv; - cleanup_args.resultPtr = &result; - - pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *) -&cleanup_args); - - if ((result = pthread_mutex_unlock (mutex)) == 0) - {((result -Sleep( 1 ); // @AT - - /* - * Wait to be awakened by - * pthread_cond_signal, or - * pthread_cond_broadcast, or - * a timeout - * - * Note: - * ptw32_sem_timedwait is a cancelation point, - * hence providing the - * mechanism for making pthread_cond_wait a cancelation - * point. We use the cleanup mechanism to ensure we - * re-lock the mutex and decrement the waiters count - * if we are canceled. - */ - if (ptw32_sem_timedwait (&(cv->sema), abstime) == -1) { - result = errno; - } - } - - pthread_cleanup_pop (1); /* Always cleanup */ - - -BTW, on my system (2 CPUs) I can manage to get -signals lost even without any source code modification -if I run the tennis program many times in different -shell sessions. -. -. -. -David Schwartz wrote: ->terekhov@my-deja.com wrote: -> ->> well, it might be that the program is in fact buggy. ->> but you did not show me any bug. -> ->You're right. I was close but not dead on. I was correct, however, ->that the code is buggy because it uses 'pthread_cond_signal' even ->though not any thread waiting on the condition variable can do the ->job. I was wrong in which thread could be waiting on the cv but ->unable to do the job. - -Okay, lets change 'pthread_cond_signal' to 'pthread_cond_broadcast' -but also add some noise from main() right before declaring the game -to be over (I need it in order to demonstrate another problem of -pthread-win32/ACE implementations - broadcast deadlock)... -. -. -. -It is my understanding of POSIX conditions, -that on correct implementation added noise -in form of unnecessary broadcasts from main, -should not break the tennis program. The -only 'side effect' of added noise on correct -implementation would be 'spurious wakeups' of -players (in fact they are not spurious, -players just see them as spurious) unblocked, -not by another player but by main before -another player had a chance to acquire the -mutex and change the game state variable: -. -. -. - -PLAYER-B - -PLAYER-A - ----Noise ON... - -PLAYER-B - -PLAYER-A - -. -. -. - -PLAYER-B - -PLAYER-A - -----PLAYER-A: SPURIOUS WAKEUP!!! - -PLAYER-B - -PLAYER-A - ----Noise OFF - -PLAYER-B - ----Stopping the game... - -PLAYER-A GONE - -PLAYER-B GONE - -GAME OVER - -H:\SA\UXX\pt\PTHREADS\TESTS> - -On pthread-win32/ACE implementations the -program could stall: - -. -. -. - -PLAYER-A - -PLAYER-B - -PLAYER-A - -PLAYER-B - -PLAYER-A - -PLAYER-B - -PLAYER-A - -PLAYER-B - ----Noise ON... - -PLAYER-A - ----Noise OFF -^C -H:\SA\UXX\pt\PTHREADS\TESTS> - - -The implementation has problems: - -================ -waiting threads: -================ - -{ /** Critical Section - - inc cond.waiters_count - -} - - /* - /* Atomic only if using Win32 SignalObjectAndWait - /* - cond.mtx.release - cond.sem.wait - - /*** ^^-- WAITER CAN BE PREEMPTED AFTER BEING UNBLOCKED... - -{ /** Critical Section - - dec cond.waiters_count - - /*** ^^- ...AND BEFORE DECREMENTING THE COUNT (1) - - last_waiter = ( cond.was_broadcast && - cond.waiters_count == 0 ) - - if ( last_waiter ) - - cond.was_broadcast = FALSE - - endif - -} - - if ( last_waiter ) - - /* - /* Atomic only if using Win32 SignalObjectAndWait - /* - cond.auto_reset_event_or_sem.post /* Event for Win32 - cond.mtx.acquire - - /*** ^^-- ...AND BEFORE CALL TO mtx.acquire (2) - - /*** ^^-- NESTED BROADCASTS RESULT IN A DEADLOCK - - - else - - cond.mtx.acquire - - /*** ^^-- ...AND BEFORE CALL TO mtx.acquire (3) - - endif - - -================== -broadcast threads: -================== - -{ /** Critical Section - - waiters_count = cond.waiters_count - - if ( waiters_count != 0 ) - - cond.was_broadcast = TRUE - - endif - -} - -if ( waiters_count != 0 ) - - cond.sem.post waiters_count - - /*** ^^^^^--- SPURIOUS WAKEUPS DUE TO (1) - - cond.auto_reset_event_or_sem.wait /* Event for Win32 - - /*** ^^^^^--- DEADLOCK FOR FURTHER BROADCASTS IF THEY - HAPPEN TO GO INTO WAIT WHILE PREVIOUS - BROADCAST IS STILL IN PROGRESS/WAITING - -endif - -a) cond.waiters_count does not accurately reflect -number of waiters blocked on semaphore - that could -result (in the time window when counter is not accurate) -in spurios wakeups organised by subsequent _signals -and _broadcasts. From standard compliance point of view -that is OK but that could be a real problem from -performance/efficiency point of view. - -b) If subsequent broadcast happen to go into wait on -cond.auto_reset_event_or_sem before previous -broadcast was unblocked from cond.auto_reset_event_or_sem -by its last waiter, one of two blocked threads will -remain blocked because last_waiter processing code -fails to unblock both threads. - -In the situation with tennisb.c the Player-B was put -in a deadlock by noise (broadcast) coming from main -thread. And since Player-B holds the game state -mutex when it calls broadcast, the whole program -stalled: Player-A was deadlocked on mutex and -main thread after finishing with producing the noise -was deadlocked on mutex too (needed to declare the -game over) - -(I produced the program output above by simply -adding ?Sleep( 1 )?: - -================== -broadcast threads: -================== - -{ /** Critical Section - - waiters_count = cond.waiters_count - - if ( waiters_count != 0 ) - - cond.was_broadcast = TRUE - - endif - -} - -if ( waiters_count != 0 ) - -Sleep( 1 ); //Win32 - - cond.sem.post waiters_count - - /*** ^^^^^--- SPURIOUS WAKEUPS DUE TO (1) - - cond.auto_reset_event_or_sem.wait /* Event for Win32 - - /*** ^^^^^--- DEADLOCK FOR FURTHER BROADCASTS IF THEY - HAPPEN TO GO INTO WAIT WHILE PREVIOUS - BROADCAST IS STILL IN PROGRESS/WAITING - -endif - -to the source code of pthread-win32 implementation: - -http://sources.redhat.com/cgi-bin/cvsweb.cgi/pthreads/ -condvar.c?rev=1.36&content-type=text/ -x-cvsweb-markup&cvsroot=pthreads-win32 - - if (wereWaiters) - {(wereWaiters)sroot=pthreads-win32eb.cgi/pthreads/Yem...m - /* - * Wake up all waiters - */ - -Sleep( 1 ); //@AT - -#ifdef NEED_SEM - - result = (ptw32_increase_semaphore( &cv->sema, cv->waiters ) - ? 0 - : EINVAL); - -#else /* NEED_SEM */ - - result = (ReleaseSemaphore( cv->sema, cv->waiters, NULL ) - ? 0 - : EINVAL); - -#endif /* NEED_SEM */ - - } - - (void) pthread_mutex_unlock(&(cv->waitersLock)); - - if (wereWaiters && result == 0) - {(wereWaiters - /* - * Wait for all the awakened threads to acquire their part of - * the counting semaphore - */ - - if (WaitForSingleObject (cv->waitersDone, INFINITE) - == WAIT_OBJECT_0) - { - result = 0; - } - else - { - result = EINVAL; - } - - } - - return (result); - -} - -BTW, on my system (2 CPUs) I can manage to get -the program stalled even without any source code -modification if I run the tennisb program many -times in different shell sessions. - -=================== -pthread-win32 patch -=================== -struct pthread_cond_t_ { - long nWaitersBlocked; /* Number of threads blocked -*/ - long nWaitersUnblocked; /* Number of threads unblocked -*/ - long nWaitersToUnblock; /* Number of threads to unblock -*/ - sem_t semBlockQueue; /* Queue up threads waiting for the -*/ - /* condition to become signalled -*/ - sem_t semBlockLock; /* Semaphore that guards access to -*/ - /* | waiters blocked count/block queue -*/ - /* +-> Mandatory Sync.LEVEL-1 -*/ - pthread_mutex_t mtxUnblockLock; /* Mutex that guards access to -*/ - /* | waiters (to)unblock(ed) counts -*/ - /* +-> Optional* Sync.LEVEL-2 -*/ -}; /* Opt*) for _timedwait and -cancellation*/ - -int -pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr) - int result = EAGAIN; - pthread_cond_t cv = NULL; - - if (cond == NULL) - {(cond - return EINVAL; - } - - if ((attr != NULL && *attr != NULL) && - ((*attr)->pshared == PTHREAD_PROCESS_SHARED)) - { - /* - * Creating condition variable that can be shared between - * processes. - */ - result = ENOSYS; - - goto FAIL0; - } - - cv = (pthread_cond_t) calloc (1, sizeof (*cv)); - - if (cv == NULL) - {(cv - result = ENOMEM; - goto FAIL0; - } - - cv->nWaitersBlocked = 0; - cv->nWaitersUnblocked = 0; - cv->nWaitersToUnblock = 0; - - if (sem_init (&(cv->semBlockLock), 0, 1) != 0) - {(sem_init - goto FAIL0; - } - - if (sem_init (&(cv->semBlockQueue), 0, 0) != 0) - {(sem_init - goto FAIL1; - } - - if (pthread_mutex_init (&(cv->mtxUnblockLock), 0) != 0) - {(pthread_mutex_init - goto FAIL2; - } - - - result = 0; - - goto DONE; - - /* - * ------------- - * Failed... - * ------------- - */ -FAIL2: - (void) sem_destroy (&(cv->semBlockQueue)); - -FAIL1: - (void) sem_destroy (&(cv->semBlockLock)); - -FAIL0: -DONE: - *cond = cv; - - return (result); - -} /* pthread_cond_init */ - -int -pthread_cond_destroy (pthread_cond_t * cond) -{ - int result = 0; - pthread_cond_t cv; - - /* - * Assuming any race condition here is harmless. - */ - if (cond == NULL - || *cond == NULL) - { - return EINVAL; - } - - if (*cond != (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) - {(*cond - cv = *cond; - - /* - * Synchronize access to waiters blocked count (LEVEL-1) - */ - if (sem_wait(&(cv->semBlockLock)) != 0) - {(sem_wait(&(cv->semBlockLock)) - return errno; - } - - /* - * Synchronize access to waiters (to)unblock(ed) counts (LEVEL-2) - */ - if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0) - {((result - (void) sem_post(&(cv->semBlockLock)); - return result; - } - - /* - * Check whether cv is still busy (still has waiters blocked) - */ - if (cv->nWaitersBlocked - cv->nWaitersUnblocked > 0) - {(cv->nWaitersBlocked - (void) sem_post(&(cv->semBlockLock)); - (void) pthread_mutex_unlock(&(cv->mtxUnblockLock)); - return EBUSY; - } - - /* - * Now it is safe to destroy - */ - (void) sem_destroy (&(cv->semBlockLock)); - (void) sem_destroy (&(cv->semBlockQueue)); - (void) pthread_mutex_unlock (&(cv->mtxUnblockLock)); - (void) pthread_mutex_destroy (&(cv->mtxUnblockLock)); - - free(cv); - *cond = NULL; - } - else - { - /* - * See notes in ptw32_cond_check_need_init() above also. - */ - EnterCriticalSection(&ptw32_cond_test_init_lock); - - /* - * Check again. - */ - if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) - {(*cond - /* - * This is all we need to do to destroy a statically - * initialised cond that has not yet been used (initialised). - * If we get to here, another thread - * waiting to initialise this cond will get an EINVAL. - */ - *cond = NULL; - } - else - { - /* - * The cv has been initialised while we were waiting - * so assume it's in use. - */ - result = EBUSY; - } - - LeaveCriticalSection(&ptw32_cond_test_init_lock); - } - - return (result); -} - -/* - * Arguments for cond_wait_cleanup, since we can only pass a - * single void * to it. - */ -typedef struct { - pthread_mutex_t * mutexPtr; - pthread_cond_t cv; - int * resultPtr; -} ptw32_cond_wait_cleanup_args_t; - -static void -ptw32_cond_wait_cleanup(void * args) -{ - ptw32_cond_wait_cleanup_args_t * cleanup_args = -(ptw32_cond_wait_cleanup_args_t *) args; - pthread_cond_t cv = cleanup_args->cv; - int * resultPtr = cleanup_args->resultPtr; - int eLastSignal; /* enum: 1=yes 0=no -1=cancelled/timedout w/o signal(s) -*/ - int result; - - /* - * Whether we got here as a result of signal/broadcast or because of - * timeout on wait or thread cancellation we indicate that we are no - * longer waiting. The waiter is responsible for adjusting waiters - * (to)unblock(ed) counts (protected by unblock lock). - * Unblock lock/Sync.LEVEL-2 supports _timedwait and cancellation. - */ - if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0) - {((result - *resultPtr = result; - return; - } - - cv->nWaitersUnblocked++; - - eLastSignal = (cv->nWaitersToUnblock == 0) ? - -1 : (--cv->nWaitersToUnblock == 0); - - /* - * No more LEVEL-2 access to waiters (to)unblock(ed) counts needed - */ - if ((result = pthread_mutex_unlock(&(cv->mtxUnblockLock))) != 0) - {((result - *resultPtr = result; - return; - } - - /* - * If last signal... - */ - if (eLastSignal == 1) - {(eLastSignal - /* - * ...it means that we have end of 'atomic' signal/broadcast - */ - if (sem_post(&(cv->semBlockLock)) != 0) - {(sem_post(&(cv->semBlockLock)) - *resultPtr = errno; - return; - } - } - /* - * If not last signal and not timed out/cancelled wait w/o signal... - */ - else if (eLastSignal == 0) - { - /* - * ...it means that next waiter can go through semaphore - */ - if (sem_post(&(cv->semBlockQueue)) != 0) - {(sem_post(&(cv->semBlockQueue)) - *resultPtr = errno; - return; - } - } - - /* - * XSH: Upon successful return, the mutex has been locked and is owned - * by the calling thread - */ - if ((result = pthread_mutex_lock(cleanup_args->mutexPtr)) != 0) - {((result - *resultPtr = result; - } - -} /* ptw32_cond_wait_cleanup */ - -static int -ptw32_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime) -{ - int result = 0; - pthread_cond_t cv; - ptw32_cond_wait_cleanup_args_t cleanup_args; - - if (cond == NULL || *cond == NULL) - {(cond - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static condition variable. We check - * again inside the guarded section of ptw32_cond_check_need_init() - * to avoid race conditions. - */ - if (*cond == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) - {(*cond - result = ptw32_cond_check_need_init(cond); - } - - if (result != 0 && result != EBUSY) - {(result - return result; - } - - cv = *cond; - - /* - * Synchronize access to waiters blocked count (LEVEL-1) - */ - if (sem_wait(&(cv->semBlockLock)) != 0) - {(sem_wait(&(cv->semBlockLock)) - return errno; - } - - cv->nWaitersBlocked++; - - /* - * Thats it. Counted means waiting, no more access needed - */ - if (sem_post(&(cv->semBlockLock)) != 0) - {(sem_post(&(cv->semBlockLock)) - return errno; - } - - /* - * Setup this waiter cleanup handler - */ - cleanup_args.mutexPtr = mutex; - cleanup_args.cv = cv; - cleanup_args.resultPtr = &result; - - pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *) &cleanup_args); - - /* - * Now we can release 'mutex' and... - */ - if ((result = pthread_mutex_unlock (mutex)) == 0) - {((result - - /* - * ...wait to be awakened by - * pthread_cond_signal, or - * pthread_cond_broadcast, or - * timeout, or - * thread cancellation - * - * Note: - * - * ptw32_sem_timedwait is a cancellation point, - * hence providing the mechanism for making - * pthread_cond_wait a cancellation point. - * We use the cleanup mechanism to ensure we - * re-lock the mutex and adjust (to)unblock(ed) waiters - * counts if we are cancelled, timed out or signalled. - */ - if (ptw32_sem_timedwait (&(cv->semBlockQueue), abstime) != 0) - {(ptw32_sem_timedwait - result = errno; - } - } - - /* - * Always cleanup - */ - pthread_cleanup_pop (1); - - - /* - * "result" can be modified by the cleanup handler. - */ - return (result); - -} /* ptw32_cond_timedwait */ - - -static int -ptw32_cond_unblock (pthread_cond_t * cond, - int unblockAll) -{ - int result; - pthread_cond_t cv; - - if (cond == NULL || *cond == NULL) - {(cond - return EINVAL; - } - - cv = *cond; - - /* - * No-op if the CV is static and hasn't been initialised yet. - * Assuming that any race condition is harmless. - */ - if (cv == (pthread_cond_t) PTW32_OBJECT_AUTO_INIT) - {(cv - return 0; - } - - /* - * Synchronize access to waiters blocked count (LEVEL-1) - */ - if (sem_wait(&(cv->semBlockLock)) != 0) - {(sem_wait(&(cv->semBlockLock)) - return errno; - } - - /* - * Synchronize access to waiters (to)unblock(ed) counts (LEVEL-2) - * This sync.level supports _timedwait and cancellation - */ - if ((result = pthread_mutex_lock(&(cv->mtxUnblockLock))) != 0) - {((result - return result; - } - - /* - * Adjust waiters blocked and unblocked counts (collect garbage) - */ - if (cv->nWaitersUnblocked != 0) - {(cv->nWaitersUnblocked - cv->nWaitersBlocked -= cv->nWaitersUnblocked; - cv->nWaitersUnblocked = 0; - } - - /* - * If (after adjustment) there are still some waiters blocked counted... - */ - if ( cv->nWaitersBlocked > 0) - {( - /* - * We will unblock first waiter and leave semBlockLock/LEVEL-1 locked - * LEVEL-1 access is left disabled until last signal/unblock -completes - */ - cv->nWaitersToUnblock = (unblockAll) ? cv->nWaitersBlocked : 1; - - /* - * No more LEVEL-2 access to waiters (to)unblock(ed) counts needed - * This sync.level supports _timedwait and cancellation - */ - if ((result = pthread_mutex_unlock(&(cv->mtxUnblockLock))) != 0) - {((result - return result; - } - - - /* - * Now, with LEVEL-2 lock released let first waiter go through -semaphore - */ - if (sem_post(&(cv->semBlockQueue)) != 0) - {(sem_post(&(cv->semBlockQueue)) - return errno; - } - } - /* - * No waiter blocked - no more LEVEL-1 access to blocked count needed... - */ - else if (sem_post(&(cv->semBlockLock)) != 0) - { - return errno; - } - /* - * ...and no more LEVEL-2 access to waiters (to)unblock(ed) counts needed -too - * This sync.level supports _timedwait and cancellation - */ - else - { - result = pthread_mutex_unlock(&(cv->mtxUnblockLock)); - } - - return(result); - -} /* ptw32_cond_unblock */ - -int -pthread_cond_wait (pthread_cond_t * cond, - pthread_mutex_t * mutex) -{ - /* The NULL abstime arg means INFINITE waiting. */ - return(ptw32_cond_timedwait(cond, mutex, NULL)); -} /* pthread_cond_wait */ - - -int -pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime) -{ - if (abstime == NULL) - {(abstime - return EINVAL; - } - - return(ptw32_cond_timedwait(cond, mutex, abstime)); -} /* pthread_cond_timedwait */ - - -int -pthread_cond_signal (pthread_cond_t * cond) -{ - /* The '0'(FALSE) unblockAll arg means unblock ONE waiter. */ - return(ptw32_cond_unblock(cond, 0)); -} /* pthread_cond_signal */ - -int -pthread_cond_broadcast (pthread_cond_t * cond) -{ - /* The '1'(TRUE) unblockAll arg means unblock ALL waiters. */ - return(ptw32_cond_unblock(cond, 1)); -} /* pthread_cond_broadcast */ - - - - -TEREKHOV@de.ibm.com on 17.01.2001 01:00:57 - -Please respond to TEREKHOV@de.ibm.com - -To: pthreads-win32@sourceware.cygnus.com -cc: schmidt@uci.edu -Subject: win32 conditions: sem+counter+event = broadcast_deadlock + - spur.wakeup/unfairness/incorrectness ?? - - - - - - - -Hi, - -Problem 1: broadcast_deadlock - -It seems that current implementation does not provide "atomic" -broadcasts. That may lead to "nested" broadcasts... and it seems -that nested case is not handled correctly -> producing a broadcast -DEADLOCK as a result. - -Scenario: - -N (>1) waiting threads W1..N are blocked (in _wait) on condition's -semaphore. - -Thread B1 calls pthread_cond_broadcast, which results in "releasing" N -W threads via incrementing semaphore counter by N (stored in -cv->waiters) BUT cv->waiters counter does not change!! The caller -thread B1 remains blocked on cv->waitersDone event (auto-reset!!) BUT -condition is not protected from starting another broadcast (when called -on another thread) while still waiting for the "old" broadcast to -complete on thread B1. - -M (>=0, waiters counter. - -L (N-M) "late" waiter W threads are a) still blocked/not returned from -their semaphore wait call or b) were preempted after sem_wait but before -lock( &cv->waitersLock ) or c) are blocked on cv->waitersLock. - -cv->waiters is still > 0 (= L). - -Another thread B2 (or some W thread from M group) calls -pthread_cond_broadcast and gains access to counter... neither a) nor b) -prevent thread B2 in pthread_cond_broadcast from gaining access to -counter and starting another broadcast ( for c) - it depends on -cv->waitersLock scheduling rules: FIFO=OK, PRTY=PROBLEM,... ) - -That call to pthread_cond_broadcast (on thread B2) will result in -incrementing semaphore by cv->waiters (=L) which is INCORRECT (all -W1..N were in fact already released by thread B1) and waiting on -_auto-reset_ event cv->waitersDone which is DEADLY WRONG (produces a -deadlock)... - -All late W1..L threads now have a chance to complete their _wait call. -Last W_L thread sets an auto-reselt event cv->waitersDone which will -release either B1 or B2 leaving one of B threads in a deadlock. - -Problem 2: spur.wakeup/unfairness/incorrectness - -It seems that: - -a) because of the same problem with counter which does not reflect the -actual number of NOT RELEASED waiters, the signal call may increment -a semaphore counter w/o having a waiter blocked on it. That will result -in (best case) spurious wake ups - performance degradation due to -unnecessary context switches and predicate re-checks and (in worth case) -unfairness/incorrectness problem - see b) - -b) neither signal nor broadcast prevent other threads - "new waiters" -(and in the case of signal, the caller thread as well) from going into -_wait and overtaking "old" waiters (already released but still not returned -from sem_wait on condition's semaphore). Win semaphore just [API DOC]: -"Maintains a count between zero and some maximum value, limiting the number -of threads that are simultaneously accessing a shared resource." Calling -ReleaseSemaphore does not imply (at least not documented) that on return -from ReleaseSemaphore all waiters will in fact become released (returned -from their Wait... call) and/or that new waiters calling Wait... afterwards -will become less importance. It is NOT documented to be an atomic release -of -waiters... And even if it would be there is still a problem with a thread -being preempted after Wait on semaphore and before Wait on cv->waitersLock -and scheduling rules for cv->waitersLock itself -(??WaitForMultipleObjects??) -That may result in unfairness/incorrectness problem as described -for SetEvent impl. in "Strategies for Implementing POSIX Condition -Variables -on Win32": http://www.cs.wustl.edu/~schmidt/win32-cv-1.html - -Unfairness -- The semantics of the POSIX pthread_cond_broadcast function is -to wake up all threads currently blocked in wait calls on the condition -variable. The awakened threads then compete for the external_mutex. To -ensure -fairness, all of these threads should be released from their -pthread_cond_wait calls and allowed to recheck their condition expressions -before other threads can successfully complete a wait on the condition -variable. - -Unfortunately, the SetEvent implementation above does not guarantee that -all -threads sleeping on the condition variable when cond_broadcast is called -will -acquire the external_mutex and check their condition expressions. Although -the Pthreads specification does not mandate this degree of fairness, the -lack of fairness can cause starvation. - -To illustrate the unfairness problem, imagine there are 2 threads, C1 and -C2, -that are blocked in pthread_cond_wait on condition variable not_empty_ that -is guarding a thread-safe message queue. Another thread, P1 then places two -messages onto the queue and calls pthread_cond_broadcast. If C1 returns -from -pthread_cond_wait, dequeues and processes the message, and immediately -waits -again then it and only it may end up acquiring both messages. Thus, C2 will -never get a chance to dequeue a message and run. - -The following illustrates the sequence of events: - -1. Thread C1 attempts to dequeue and waits on CV non_empty_ -2. Thread C2 attempts to dequeue and waits on CV non_empty_ -3. Thread P1 enqueues 2 messages and broadcasts to CV not_empty_ -4. Thread P1 exits -5. Thread C1 wakes up from CV not_empty_, dequeues a message and runs -6. Thread C1 waits again on CV not_empty_, immediately dequeues the 2nd - message and runs -7. Thread C1 exits -8. Thread C2 is the only thread left and blocks forever since - not_empty_ will never be signaled - -Depending on the algorithm being implemented, this lack of fairness may -yield -concurrent programs that have subtle bugs. Of course, application -developers -should not rely on the fairness semantics of pthread_cond_broadcast. -However, -there are many cases where fair implementations of condition variables can -simplify application code. - -Incorrectness -- A variation on the unfairness problem described above -occurs -when a third consumer thread, C3, is allowed to slip through even though it -was not waiting on condition variable not_empty_ when a broadcast occurred. - -To illustrate this, we will use the same scenario as above: 2 threads, C1 -and -C2, are blocked dequeuing messages from the message queue. Another thread, -P1 -then places two messages onto the queue and calls pthread_cond_broadcast. -C1 -returns from pthread_cond_wait, dequeues and processes the message. At this -time, C3 acquires the external_mutex, calls pthread_cond_wait and waits on -the events in WaitForMultipleObjects. Since C2 has not had a chance to run -yet, the BROADCAST event is still signaled. C3 then returns from -WaitForMultipleObjects, and dequeues and processes the message in the -queue. -Thus, C2 will never get a chance to dequeue a message and run. - -The following illustrates the sequence of events: - -1. Thread C1 attempts to dequeue and waits on CV non_empty_ -2. Thread C2 attempts to dequeue and waits on CV non_empty_ -3. Thread P1 enqueues 2 messages and broadcasts to CV not_empty_ -4. Thread P1 exits -5. Thread C1 wakes up from CV not_empty_, dequeues a message and runs -6. Thread C1 exits -7. Thread C3 waits on CV not_empty_, immediately dequeues the 2nd - message and runs -8. Thread C3 exits -9. Thread C2 is the only thread left and blocks forever since - not_empty_ will never be signaled - -In the above case, a thread that was not waiting on the condition variable -when a broadcast occurred was allowed to proceed. This leads to incorrect -semantics for a condition variable. - - -COMMENTS??? - -regards, -alexander. - ------------------------------------------------------------------------------ - -Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* - implementation questions -Date: Wed, 21 Feb 2001 11:54:47 +0100 -From: TEREKHOV@de.ibm.com -To: lthomas@arbitrade.com -CC: rpj@ise.canberra.edu.au, Thomas Pfaff , - Nanbor Wang - -Hi Louis, - -generation number 8.. - -had some time to revisit timeouts/spurious wakeup problem.. -found some bugs (in 7.b/c/d) and something to improve -(7a - using IPC semaphores but it should speedup Win32 -version as well). - -regards, -alexander. - ----------- Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL ------ -given: -semBlockLock - bin.semaphore -semBlockQueue - semaphore -mtxExternal - mutex or CS -mtxUnblockLock - mutex or CS -nWaitersGone - int -nWaitersBlocked - int -nWaitersToUnblock - int - -wait( timeout ) { - - [auto: register int result ] // error checking omitted - [auto: register int nSignalsWasLeft ] - [auto: register int nWaitersWasGone ] - - sem_wait( semBlockLock ); - nWaitersBlocked++; - sem_post( semBlockLock ); - - unlock( mtxExternal ); - bTimedOut = sem_wait( semBlockQueue,timeout ); - - lock( mtxUnblockLock ); - if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { - if ( bTimeout ) { // timeout (or canceled) - if ( 0 != nWaitersBlocked ) { - nWaitersBlocked--; - } - else { - nWaitersGone++; // count spurious wakeups - } - } - if ( 0 == --nWaitersToUnblock ) { - if ( 0 != nWaitersBlocked ) { - sem_post( semBlockLock ); // open the gate - nSignalsWasLeft = 0; // do not open the gate below -again - } - else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { - nWaitersGone = 0; - } - } - } - else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious -semaphore :-) - sem_wait( semBlockLock ); - nWaitersBlocked -= nWaitersGone; // something is going on here - -test of timeouts? :-) - sem_post( semBlockLock ); - nWaitersGone = 0; - } - unlock( mtxUnblockLock ); - - if ( 1 == nSignalsWasLeft ) { - if ( 0 != nWaitersWasGone ) { - // sem_adjust( -nWaitersWasGone ); - while ( nWaitersWasGone-- ) { - sem_wait( semBlockLock ); // better now than spurious -later - } - } - sem_post( semBlockLock ); // open the gate - } - - lock( mtxExternal ); - - return ( bTimedOut ) ? ETIMEOUT : 0; -} - -signal(bAll) { - - [auto: register int result ] - [auto: register int nSignalsToIssue] - - lock( mtxUnblockLock ); - - if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - if ( 0 == nWaitersBlocked ) { // NO-OP - return unlock( mtxUnblockLock ); - } - if (bAll) { - nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; - nWaitersBlocked = 0; - } - else { - nSignalsToIssue = 1; - nWaitersToUnblock++; - nWaitersBlocked--; - } - } - else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - sem_wait( semBlockLock ); // close the gate - if ( 0 != nWaitersGone ) { - nWaitersBlocked -= nWaitersGone; - nWaitersGone = 0; - } - if (bAll) { - nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; - nWaitersBlocked = 0; - } - else { - nSignalsToIssue = nWaitersToUnblock = 1; - nWaitersBlocked--; - } - } - else { // NO-OP - return unlock( mtxUnblockLock ); - } - - unlock( mtxUnblockLock ); - sem_post( semBlockQueue,nSignalsToIssue ); - return result; -} - ----------- Algorithm 8b / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ONEBYONE ------- -given: -semBlockLock - bin.semaphore -semBlockQueue - bin.semaphore -mtxExternal - mutex or CS -mtxUnblockLock - mutex or CS -nWaitersGone - int -nWaitersBlocked - int -nWaitersToUnblock - int - -wait( timeout ) { - - [auto: register int result ] // error checking omitted - [auto: register int nWaitersWasGone ] - [auto: register int nSignalsWasLeft ] - - sem_wait( semBlockLock ); - nWaitersBlocked++; - sem_post( semBlockLock ); - - unlock( mtxExternal ); - bTimedOut = sem_wait( semBlockQueue,timeout ); - - lock( mtxUnblockLock ); - if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { - if ( bTimeout ) { // timeout (or canceled) - if ( 0 != nWaitersBlocked ) { - nWaitersBlocked--; - nSignalsWasLeft = 0; // do not unblock next waiter -below (already unblocked) - } - else { - nWaitersGone = 1; // spurious wakeup pending!! - } - } - if ( 0 == --nWaitersToUnblock && - if ( 0 != nWaitersBlocked ) { - sem_post( semBlockLock ); // open the gate - nSignalsWasLeft = 0; // do not open the gate below -again - } - else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { - nWaitersGone = 0; - } - } - } - else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious -semaphore :-) - sem_wait( semBlockLock ); - nWaitersBlocked -= nWaitersGone; // something is going on here - -test of timeouts? :-) - sem_post( semBlockLock ); - nWaitersGone = 0; - } - unlock( mtxUnblockLock ); - - if ( 1 == nSignalsWasLeft ) { - if ( 0 != nWaitersWasGone ) { - // sem_adjust( -1 ); - sem_wait( semBlockQueue ); // better now than spurious -later - } - sem_post( semBlockLock ); // open the gate - } - else if ( 0 != nSignalsWasLeft ) { - sem_post( semBlockQueue ); // unblock next waiter - } - - lock( mtxExternal ); - - return ( bTimedOut ) ? ETIMEOUT : 0; -} - -signal(bAll) { - - [auto: register int result ] - - lock( mtxUnblockLock ); - - if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - if ( 0 == nWaitersBlocked ) { // NO-OP - return unlock( mtxUnblockLock ); - } - if (bAll) { - nWaitersToUnblock += nWaitersBlocked; - nWaitersBlocked = 0; - } - else { - nWaitersToUnblock++; - nWaitersBlocked--; - } - unlock( mtxUnblockLock ); - } - else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - sem_wait( semBlockLock ); // close the gate - if ( 0 != nWaitersGone ) { - nWaitersBlocked -= nWaitersGone; - nWaitersGone = 0; - } - if (bAll) { - nWaitersToUnblock = nWaitersBlocked; - nWaitersBlocked = 0; - } - else { - nWaitersToUnblock = 1; - nWaitersBlocked--; - } - unlock( mtxUnblockLock ); - sem_post( semBlockQueue ); - } - else { // NO-OP - unlock( mtxUnblockLock ); - } - - return result; -} - ----------- Algorithm 8c / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ONEBYONE ---------- -given: -hevBlockLock - auto-reset event -hevBlockQueue - auto-reset event -mtxExternal - mutex or CS -mtxUnblockLock - mutex or CS -nWaitersGone - int -nWaitersBlocked - int -nWaitersToUnblock - int - -wait( timeout ) { - - [auto: register int result ] // error checking omitted - [auto: register int nSignalsWasLeft ] - [auto: register int nWaitersWasGone ] - - wait( hevBlockLock,INFINITE ); - nWaitersBlocked++; - set_event( hevBlockLock ); - - unlock( mtxExternal ); - bTimedOut = wait( hevBlockQueue,timeout ); - - lock( mtxUnblockLock ); - if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) { - if ( bTimeout ) { // timeout (or canceled) - if ( 0 != nWaitersBlocked ) { - nWaitersBlocked--; - nSignalsWasLeft = 0; // do not unblock next waiter -below (already unblocked) - } - else { - nWaitersGone = 1; // spurious wakeup pending!! - } - } - if ( 0 == --nWaitersToUnblock ) - if ( 0 != nWaitersBlocked ) { - set_event( hevBlockLock ); // open the gate - nSignalsWasLeft = 0; // do not open the gate below -again - } - else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { - nWaitersGone = 0; - } - } - } - else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious -event :-) - wait( hevBlockLock,INFINITE ); - nWaitersBlocked -= nWaitersGone; // something is going on here - -test of timeouts? :-) - set_event( hevBlockLock ); - nWaitersGone = 0; - } - unlock( mtxUnblockLock ); - - if ( 1 == nSignalsWasLeft ) { - if ( 0 != nWaitersWasGone ) { - reset_event( hevBlockQueue ); // better now than spurious -later - } - set_event( hevBlockLock ); // open the gate - } - else if ( 0 != nSignalsWasLeft ) { - set_event( hevBlockQueue ); // unblock next waiter - } - - lock( mtxExternal ); - - return ( bTimedOut ) ? ETIMEOUT : 0; -} - -signal(bAll) { - - [auto: register int result ] - - lock( mtxUnblockLock ); - - if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - if ( 0 == nWaitersBlocked ) { // NO-OP - return unlock( mtxUnblockLock ); - } - if (bAll) { - nWaitersToUnblock += nWaitersBlocked; - nWaitersBlocked = 0; - } - else { - nWaitersToUnblock++; - nWaitersBlocked--; - } - unlock( mtxUnblockLock ); - } - else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - wait( hevBlockLock,INFINITE ); // close the gate - if ( 0 != nWaitersGone ) { - nWaitersBlocked -= nWaitersGone; - nWaitersGone = 0; - } - if (bAll) { - nWaitersToUnblock = nWaitersBlocked; - nWaitersBlocked = 0; - } - else { - nWaitersToUnblock = 1; - nWaitersBlocked--; - } - unlock( mtxUnblockLock ); - set_event( hevBlockQueue ); - } - else { // NO-OP - unlock( mtxUnblockLock ); - } - - return result; -} - ----------- Algorithm 8d / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ALL ------ -given: -hevBlockLock - auto-reset event -hevBlockQueueS - auto-reset event // for signals -hevBlockQueueB - manual-reset even // for broadcasts -mtxExternal - mutex or CS -mtxUnblockLock - mutex or CS -eBroadcast - int // 0: no broadcast, 1: broadcast, 2: -broadcast after signal(s) -nWaitersGone - int -nWaitersBlocked - int -nWaitersToUnblock - int - -wait( timeout ) { - - [auto: register int result ] // error checking omitted - [auto: register int eWasBroadcast ] - [auto: register int nSignalsWasLeft ] - [auto: register int nWaitersWasGone ] - - wait( hevBlockLock,INFINITE ); - nWaitersBlocked++; - set_event( hevBlockLock ); - - unlock( mtxExternal ); - bTimedOut = waitformultiple( hevBlockQueueS,hevBlockQueueB,timeout,ONE ); - - lock( mtxUnblockLock ); - if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) { - if ( bTimeout ) { // timeout (or canceled) - if ( 0 != nWaitersBlocked ) { - nWaitersBlocked--; - nSignalsWasLeft = 0; // do not unblock next waiter -below (already unblocked) - } - else if ( 1 != eBroadcast ) { - nWaitersGone = 1; - } - } - if ( 0 == --nWaitersToUnblock ) { - if ( 0 != nWaitersBlocked ) { - set_event( hevBlockLock ); // open the gate - nSignalsWasLeft = 0; // do not open the gate below -again - } - else { - if ( 0 != (eWasBroadcast = eBroadcast) ) { - eBroadcast = 0; - } - if ( 0 != (nWaitersWasGone = nWaitersGone ) { - nWaitersGone = 0; - } - } - } - else if ( 0 != eBroadcast ) { - nSignalsWasLeft = 0; // do not unblock next waiter -below (already unblocked) - } - } - else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious -event :-) - wait( hevBlockLock,INFINITE ); - nWaitersBlocked -= nWaitersGone; // something is going on here - -test of timeouts? :-) - set_event( hevBlockLock ); - nWaitersGone = 0; - } - unlock( mtxUnblockLock ); - - if ( 1 == nSignalsWasLeft ) { - if ( 0 != eWasBroadcast ) { - reset_event( hevBlockQueueB ); - } - if ( 0 != nWaitersWasGone ) { - reset_event( hevBlockQueueS ); // better now than spurious -later - } - set_event( hevBlockLock ); // open the gate - } - else if ( 0 != nSignalsWasLeft ) { - set_event( hevBlockQueueS ); // unblock next waiter - } - - lock( mtxExternal ); - - return ( bTimedOut ) ? ETIMEOUT : 0; -} - -signal(bAll) { - - [auto: register int result ] - [auto: register HANDLE hevBlockQueue ] - - lock( mtxUnblockLock ); - - if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - if ( 0 == nWaitersBlocked ) { // NO-OP - return unlock( mtxUnblockLock ); - } - if (bAll) { - nWaitersToUnblock += nWaitersBlocked; - nWaitersBlocked = 0; - eBroadcast = 2; - hevBlockQueue = hevBlockQueueB; - } - else { - nWaitersToUnblock++; - nWaitersBlocked--; - return unlock( mtxUnblockLock ); - } - } - else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - wait( hevBlockLock,INFINITE ); // close the gate - if ( 0 != nWaitersGone ) { - nWaitersBlocked -= nWaitersGone; - nWaitersGone = 0; - } - if (bAll) { - nWaitersToUnblock = nWaitersBlocked; - nWaitersBlocked = 0; - eBroadcast = 1; - hevBlockQueue = hevBlockQueueB; - } - else { - nWaitersToUnblock = 1; - nWaitersBlocked--; - hevBlockQueue = hevBlockQueueS; - } - } - else { // NO-OP - return unlock( mtxUnblockLock ); - } - - unlock( mtxUnblockLock ); - set_event( hevBlockQueue ); - return result; -} ----------------------- Forwarded by Alexander Terekhov/Germany/IBM on -02/21/2001 09:13 AM --------------------------- - -Alexander Terekhov -02/20/2001 04:33 PM - -To: Louis Thomas -cc: - -From: Alexander Terekhov/Germany/IBM@IBMDE -Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio - n questions -Importance: Normal - ->Sorry, gotta take a break and work on something else for a while. ->Real work ->calls, unfortunately. I'll get back to you in two or three days. - -ok. no problem. here is some more stuff for pauses you might have -in between :) - ----------- Algorithm 7d / IMPL_EVENT,UNBLOCK_STRATEGY == UNBLOCK_ALL ------ -given: -hevBlockLock - auto-reset event -hevBlockQueueS - auto-reset event // for signals -hevBlockQueueB - manual-reset even // for broadcasts -mtxExternal - mutex or CS -mtxUnblockLock - mutex or CS -bBroadcast - int -nWaitersGone - int -nWaitersBlocked - int -nWaitersToUnblock - int - -wait( timeout ) { - - [auto: register int result ] // error checking omitted - [auto: register int bWasBroadcast ] - [auto: register int nSignalsWasLeft ] - - wait( hevBlockLock,INFINITE ); - nWaitersBlocked++; - set_event( hevBlockLock ); - - unlock( mtxExternal ); - bTimedOut = waitformultiple( hevBlockQueueS,hevBlockQueueB,timeout,ONE ); - - lock( mtxUnblockLock ); - if ( 0 != (SignalsWasLeft = nWaitersToUnblock) ) { - if ( bTimeout ) { // timeout (or canceled) - if ( 0 != nWaitersBlocked ) { - nWaitersBlocked--; - nSignalsWasLeft = 0; // do not unblock next waiter -below (already unblocked) - } - else if ( !bBroadcast ) { - wait( hevBlockQueueS,INFINITE ); // better now than spurious -later - } - } - if ( 0 == --nWaitersToUnblock ) { - if ( 0 != nWaitersBlocked ) { - if ( bBroadcast ) { - reset_event( hevBlockQueueB ); - bBroadcast = false; - } - set_event( hevBlockLock ); // open the gate - nSignalsWasLeft = 0; // do not open the gate below -again - } - else if ( false != (bWasBroadcast = bBroadcast) ) { - bBroadcast = false; - } - } - else { - bWasBroadcast = bBroadcast; - } - } - else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or spurious -event :-) - wait( hevBlockLock,INFINITE ); - nWaitersBlocked -= nWaitersGone; // something is going on here - -test of timeouts? :-) - set_event( hevBlockLock ); - nWaitersGone = 0; - } - unlock( mtxUnblockLock ); - - if ( 1 == nSignalsWasLeft ) { - if ( bWasBroadcast ) { - reset_event( hevBlockQueueB ); - } - set_event( hevBlockLock ); // open the gate - } - else if ( 0 != nSignalsWasLeft && !bWasBroadcast ) { - set_event( hevBlockQueueS ); // unblock next waiter - } - - lock( mtxExternal ); - - return ( bTimedOut ) ? ETIMEOUT : 0; -} - -signal(bAll) { - - [auto: register int result ] - [auto: register HANDLE hevBlockQueue ] - - lock( mtxUnblockLock ); - - if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - if ( 0 == nWaitersBlocked ) { // NO-OP - return unlock( mtxUnblockLock ); - } - if (bAll) { - nWaitersToUnblock += nWaitersBlocked; - nWaitersBlocked = 0; - bBroadcast = true; - hevBlockQueue = hevBlockQueueB; - } - else { - nWaitersToUnblock++; - nWaitersBlocked--; - return unlock( mtxUnblockLock ); - } - } - else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - wait( hevBlockLock,INFINITE ); // close the gate - if ( 0 != nWaitersGone ) { - nWaitersBlocked -= nWaitersGone; - nWaitersGone = 0; - } - if (bAll) { - nWaitersToUnblock = nWaitersBlocked; - nWaitersBlocked = 0; - bBroadcast = true; - hevBlockQueue = hevBlockQueueB; - } - else { - nWaitersToUnblock = 1; - nWaitersBlocked--; - hevBlockQueue = hevBlockQueueS; - } - } - else { // NO-OP - return unlock( mtxUnblockLock ); - } - - unlock( mtxUnblockLock ); - set_event( hevBlockQueue ); - return result; -} - - ----------------------------------------------------------------------------- - -Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio - n questions -Date: Mon, 26 Feb 2001 22:20:12 -0600 -From: Louis Thomas -To: "'TEREKHOV@de.ibm.com'" -CC: rpj@ise.canberra.edu.au, Thomas Pfaff , - Nanbor Wang - - -Sorry all. Busy week. - -> this insures the fairness -> which POSIX does not (e.g. two subsequent broadcasts - the gate does -insure -> that first wave waiters will start the race for the mutex before waiters -> from the second wave - Linux pthreads process/unblock both waves -> concurrently...) - -I'm not sure how we are any more fair about this than Linux. We certainly -don't guarantee that the threads released by the first broadcast will get -the external mutex before the threads of the second wave. In fact, it is -possible that those threads will never get the external mutex if there is -enough contention for it. - -> e.g. i was thinking about implementation with a pool of -> N semaphores/counters [...] - -I considered that too. The problem is as you mentioned in a). You really -need to assign threads to semaphores once you know how you want to wake them -up, not when they first begin waiting which is the only time you can assign -them. - -> well, i am not quite sure that i've fully understood your scenario, - -Hmm. Well, it think it's an important example, so I'll try again. First, we -have thread A which we KNOW is waiting on a condition. As soon as it becomes -unblocked for any reason, we will know because it will set a flag. Since the -flag is not set, we are 100% confident that thread A is waiting on the -condition. We have another thread, thread B, which has acquired the mutex -and is about to wait on the condition. Thus it is pretty clear that at any -point, either just A is waiting, or A and B are waiting. Now thread C comes -along. C is about to do a broadcast on the condition. A broadcast is -guaranteed to unblock all threads currently waiting on a condition, right? -Again, we said that either just A is waiting, or A and B are both waiting. -So, when C does its broadcast, depending upon whether B has started waiting -or not, thread C will unblock A or unblock A and B. Either way, C must -unblock A, right? - -Now, you said anything that happens is correct so long as a) "a signal is -not lost between unlocking the mutex and waiting on the condition" and b) "a -thread must not steal a signal it sent", correct? Requirement b) is easy to -satisfy: in this scenario, thread C will never wait on the condition, so it -won't steal any signals. Requirement a) is not hard either. The only way we -could fail to meet requirement a) in this scenario is if thread B was -started waiting but didn't wake up because a signal was lost. This will not -happen. - -Now, here is what happens. Assume thread C beats thread B. Thread C looks to -see how many threads are waiting on the condition. Thread C sees just one -thread, thread A, waiting. It does a broadcast waking up just one thread -because just one thread is waiting. Next, before A can become unblocked, -thread B begins waiting. Now there are two threads waiting, but only one -will be unblocked. Suppose B wins. B will become unblocked. A will not -become unblocked, because C only unblocked one thread (sema_post cond, 1). -So at the end, B finishes and A remains blocked. - -We have met both of your requirements, so by your rules, this is an -acceptable outcome. However, I think that the spec says this is an -unacceptable outcome! We know for certain that A was waiting and that C did -a broadcast, but A did not become unblocked! Yet, the spec says that a -broadcast wakes up all waiting threads. This did not happen. Do you agree -that this shows your rules are not strict enough? - -> and what about N2? :) this one does allow almost everything. - -Don't get me started about rule #2. I'll NEVER advocate an algorithm that -uses rule 2 as an excuse to suck! - -> but it is done (decrement)under mutex protection - this is not a subject -> of a race condition. - -You are correct. My mistake. - -> i would remove "_bTimedOut=false".. after all, it was a real timeout.. - -I disagree. A thread that can't successfully retract its waiter status can't -really have timed out. If a thread can't return without executing extra code -to deal with the fact that someone tried to unblock it, I think it is a poor -idea to pretend we -didn't realize someone was trying to signal us. After all, a signal is more -important than a time out. - -> when nSignaled != 0, it is possible to update nWaiters (--) and do not -> touch nGone - -I realize this, but I was thinking that writing it the other ways saves -another if statement. - -> adjust only if nGone != 0 and save one cache memory write - probably much -slower than 'if' - -Hmm. You are probably right. - -> well, in a strange (e.g. timeout test) program you may (theoretically) -> have an overflow of nWaiters/nGone counters (with waiters repeatedly -timing -> out and no signals at all). - -Also true. Not only that, but you also have the possibility that one could -overflow the number of waiters as well! However, considering the limit you -have chosen for nWaitersGone, I suppose it is unlikely that anyone would be -able to get INT_MAX/2 threads waiting on a single condition. :) - -Analysis of 8a: - -It looks correct to me. - -What are IPC semaphores? - -In the line where you state, "else if ( nWaitersBlocked > nWaitersGone ) { -// HARMLESS RACE CONDITION!" there is no race condition for nWaitersGone -because nWaitersGone is never modified without holding mtxUnblockLock. You -are correct that there is a harmless race on nWaitersBlocked, which can -increase and make the condition become true just after we check it. If this -happens, we interpret it as the wait starting after the signal. - -I like your optimization of this. You could improve Alg. 6 as follows: ----------- Algorithm 6b ---------- -signal(bAll) { - _nSig=0 - lock counters - // this is safe because nWaiting can only be decremented by a thread that - // owns counters and nGone can only be changed by a thread that owns -counters. - if (nWaiting>nGone) { - if (0==nSignaled) { - sema_wait gate // close gate if not already closed - } - if (nGone>0) { - nWaiting-=nGone - nGone=0 - } - _nSig=bAll?nWaiting:1 - nSignaled+=_nSig - nWaiting-=_nSig - } - unlock counters - if (0!=_nSig) { - sema_post queue, _nSig - } -} ----------- ---------- ---------- -I guess this wouldn't apply to Alg 8a because nWaitersGone changes meanings -depending upon whether the gate is open or closed. - -In the loop "while ( nWaitersWasGone-- ) {" you do a sema_wait on -semBlockLock. Perhaps waiting on semBlockQueue would be a better idea. - -What have you gained by making the last thread to be signaled do the waits -for all the timed out threads, besides added complexity? It took me a long -time to figure out what your objective was with this, to realize you were -using nWaitersGone to mean two different things, and to verify that you -hadn't introduced any bug by doing this. Even now I'm not 100% sure. - -What has all this playing about with nWaitersGone really gained us besides a -lot of complexity (it is much harder to verify that this solution is -correct), execution overhead (we now have a lot more if statements to -evaluate), and space overhead (more space for the extra code, and another -integer in our data)? We did manage to save a lock/unlock pair in an -uncommon case (when a time out occurs) at the above mentioned expenses in -the common cases. - -As for 8b, c, and d, they look ok though I haven't studied them thoroughly. -What would you use them for? - - Later, - -Louis! :) - ------------------------------------------------------------------------------ - -Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio - n questions -Date: Tue, 27 Feb 2001 15:51:28 +0100 -From: TEREKHOV@de.ibm.com -To: Louis Thomas -CC: rpj@ise.canberra.edu.au, Thomas Pfaff , - Nanbor Wang - -Hi Louis, - ->> that first wave waiters will start the race for the mutex before waiters ->> from the second wave - Linux pthreads process/unblock both waves ->> concurrently...) -> ->I'm not sure how we are any more fair about this than Linux. We certainly ->don't guarantee that the threads released by the first broadcast will get ->the external mutex before the threads of the second wave. In fact, it is ->possible that those threads will never get the external mutex if there is ->enough contention for it. - -correct. but gate is nevertheless more fair than Linux because of the -barrier it establishes between two races (1st and 2nd wave waiters) for -the mutex which under 'normal' circumstances (e.g. all threads of equal -priorities,..) will 'probably' result in fair behaviour with respect to -mutex ownership. - ->> well, i am not quite sure that i've fully understood your scenario, -> ->Hmm. Well, it think it's an important example, so I'll try again. ... - -ok. now i seem to understand this example. well, now it seems to me -that the only meaningful rule is just: - -a) "a signal is not lost between unlocking the mutex and waiting on the -condition" - -and that the rule - -b) "a thread must not steal a signal it sent" - -is not needed at all because a thread which violates b) also violates a). - -i'll try to explain.. - -i think that the most important thing is how POSIX defines waiter's -visibility: - -"if another thread is able to acquire the mutex after the about-to-block -thread -has released it, then a subsequent call to pthread_cond_signal() or -pthread_cond_broadcast() in that thread behaves as if it were issued after -the about-to-block thread has blocked. " - -my understanding is the following: - -1) there is no guarantees whatsoever with respect to whether -signal/broadcast -will actually unblock any 'waiter' if it is done w/o acquiring the mutex -first -(note that a thread may release it before signal/broadcast - it does not -matter). - -2) it is guaranteed that waiters become 'visible' - eligible for unblock as -soon -as signalling thread acquires the mutex (but not before!!) - -so.. - ->So, when C does its broadcast, depending upon whether B has started -waiting ->or not, thread C will unblock A or unblock A and B. Either way, C must ->unblock A, right? - -right. but only if C did acquire the mutex prior to broadcast (it may -release it before broadcast as well). - -implementation will violate waiters visibility rule (signal will become -lost) -if C will not unblock A. - ->Now, here is what happens. Assume thread C beats thread B. Thread C looks -to ->see how many threads are waiting on the condition. Thread C sees just one ->thread, thread A, waiting. It does a broadcast waking up just one thread ->because just one thread is waiting. Next, before A can become unblocked, ->thread B begins waiting. Now there are two threads waiting, but only one ->will be unblocked. Suppose B wins. B will become unblocked. A will not ->become unblocked, because C only unblocked one thread (sema_post cond, 1). ->So at the end, B finishes and A remains blocked. - -thread C did acquire the mutex ("Thread C sees just one thread, thread A, -waiting"). beginning from that moment it is guaranteed that subsequent -broadcast will unblock A. Otherwise we will have a lost signal with respect -to A. I do think that it does not matter whether the signal was physically -(completely) lost or was just stolen by another thread (B) - in both cases -it was simply lost with respect to A. - ->..Do you agree that this shows your rules are not strict enough? - -probably the opposite.. :-) i think that it shows that the only meaningful -rule is - -a) "a signal is not lost between unlocking the mutex and waiting on the -condition" - -with clarification of waiters visibility as defined by POSIX above. - ->> i would remove "_bTimedOut=false".. after all, it was a real timeout.. -> ->I disagree. A thread that can't successfully retract its waiter status -can't ->really have timed out. If a thread can't return without executing extra -code ->to deal with the fact that someone tried to unblock it, I think it is a -poor ->idea to pretend we ->didn't realize someone was trying to signal us. After all, a signal is -more ->important than a time out. - -a) POSIX does allow timed out thread to consume a signal (cancelled is -not). -b) ETIMEDOUT status just says that: "The time specified by abstime to -pthread_cond_timedwait() has passed." -c) it seem to me that hiding timeouts would violate "The -pthread_cond_timedwait() -function is the same as pthread_cond_wait() except that an error is -returned if -the absolute time specified by abstime passes (that is, system time equals -or -exceeds abstime) before the condition cond is signaled or broadcasted" -because -the abs. time did really pass before cond was signaled (waiter was -released via semaphore). however, if it really matters, i could imaging -that we -can save an abs. time of signal/broadcast and compare it with timeout after -unblock to find out whether it was a 'real' timeout or not. absent this -check -i do think that hiding timeouts would result in technical violation of -specification.. but i think that this check is not important and we can -simply -trust timeout error code provided by wait since we are not trying to make -'hard' realtime implementation. - ->What are IPC semaphores? - - -int semctl(int, int, int, ...); -int semget(key_t, int, int); -int semop(int, struct sembuf *, size_t); - -they support adjustment of semaphore counter (semvalue) -in one single call - imaging Win32 ReleaseSemaphore( hsem,-N ) - ->In the line where you state, "else if ( nWaitersBlocked > nWaitersGone ) { ->// HARMLESS RACE CONDITION!" there is no race condition for nWaitersGone ->because nWaitersGone is never modified without holding mtxUnblockLock. You ->are correct that there is a harmless race on nWaitersBlocked, which can ->increase and make the condition become true just after we check it. If -this ->happens, we interpret it as the wait starting after the signal. - -well, the reason why i've asked on comp.programming.threads whether this -race -condition is harmless or not is that in order to be harmless it should not -violate the waiters visibility rule (see above). Fortunately, we increment -the counter under protection of external mutex.. so that any (signalling) -thread which will acquire the mutex next, should see the updated counter -(in signal) according to POSIX memory visibility rules and mutexes -(memory barriers). But i am not so sure how it actually works on -Win32/INTEL -which does not explicitly define any memory visibility rules :( - ->I like your optimization of this. You could improve Alg. 6 as follows: ->---------- Algorithm 6b ---------- ->signal(bAll) { -> _nSig=0 -> lock counters -> // this is safe because nWaiting can only be decremented by a thread -that -> // owns counters and nGone can only be changed by a thread that owns ->counters. -> if (nWaiting>nGone) { -> if (0==nSignaled) { -> sema_wait gate // close gate if not already closed -> } -> if (nGone>0) { -> nWaiting-=nGone -> nGone=0 -> } -> _nSig=bAll?nWaiting:1 -> nSignaled+=_nSig -> nWaiting-=_nSig -> } -> unlock counters -> if (0!=_nSig) { -> sema_post queue, _nSig -> } ->} ->---------- ---------- ---------- ->I guess this wouldn't apply to Alg 8a because nWaitersGone changes -meanings ->depending upon whether the gate is open or closed. - -agree. - ->In the loop "while ( nWaitersWasGone-- ) {" you do a sema_wait on ->semBlockLock. Perhaps waiting on semBlockQueue would be a better idea. - -you are correct. my mistake. - ->What have you gained by making the last thread to be signaled do the waits ->for all the timed out threads, besides added complexity? It took me a long ->time to figure out what your objective was with this, to realize you were ->using nWaitersGone to mean two different things, and to verify that you ->hadn't introduced any bug by doing this. Even now I'm not 100% sure. -> ->What has all this playing about with nWaitersGone really gained us besides -a ->lot of complexity (it is much harder to verify that this solution is ->correct), execution overhead (we now have a lot more if statements to ->evaluate), and space overhead (more space for the extra code, and another ->integer in our data)? We did manage to save a lock/unlock pair in an ->uncommon case (when a time out occurs) at the above mentioned expenses in ->the common cases. - -well, please consider the following: - -1) with multiple waiters unblocked (but some timed out) the trick with -counter -seem to ensure potentially higher level of concurrency by not delaying -most of unblocked waiters for semaphore cleanup - only the last one -will be delayed but all others would already contend/acquire/release -the external mutex - the critical section protected by mtxUnblockLock is -made smaller (increment + couple of IFs is faster than system/kernel call) -which i think is good in general. however, you are right, this is done -at expense of 'normal' waiters.. - -2) some semaphore APIs (e.g. POSIX IPC sems) do allow to adjust the -semaphore counter in one call => less system/kernel calls.. imagine: - -if ( 1 == nSignalsWasLeft ) { - if ( 0 != nWaitersWasGone ) { - ReleaseSemaphore( semBlockQueue,-nWaitersWasGone ); // better now -than spurious later - } - sem_post( semBlockLock ); // open the gate - } - -3) even on win32 a single thread doing multiple cleanup calls (to wait) -will probably result in faster execution (because of processor caching) -than multiple threads each doing a single call to wait. - ->As for 8b, c, and d, they look ok though I haven't studied them -thoroughly. ->What would you use them for? - -8b) for semaphores which do not allow to unblock multiple waiters -in a single call to post/release (e.g. POSIX realtime semaphores - -) - -8c/8d) for WinCE prior to 3.0 (WinCE 3.0 does have semaphores) - -ok. so, which one is the 'final' algorithm(s) which we should use in -pthreads-win32?? - -regards, -alexander. - ----------------------------------------------------------------------------- - -Louis Thomas on 02/27/2001 05:20:12 AM - -Please respond to Louis Thomas - -To: Alexander Terekhov/Germany/IBM@IBMDE -cc: rpj@ise.canberra.edu.au, Thomas Pfaff , Nanbor Wang - -Subject: RE: FYI/comp.programming.threads/Re: pthread_cond_* implementatio - n questions - -Sorry all. Busy week. - -> this insures the fairness -> which POSIX does not (e.g. two subsequent broadcasts - the gate does -insure -> that first wave waiters will start the race for the mutex before waiters -> from the second wave - Linux pthreads process/unblock both waves -> concurrently...) - -I'm not sure how we are any more fair about this than Linux. We certainly -don't guarantee that the threads released by the first broadcast will get -the external mutex before the threads of the second wave. In fact, it is -possible that those threads will never get the external mutex if there is -enough contention for it. - -> e.g. i was thinking about implementation with a pool of -> N semaphores/counters [...] - -I considered that too. The problem is as you mentioned in a). You really -need to assign threads to semaphores once you know how you want to wake -them -up, not when they first begin waiting which is the only time you can assign -them. - -> well, i am not quite sure that i've fully understood your scenario, - -Hmm. Well, it think it's an important example, so I'll try again. First, we -have thread A which we KNOW is waiting on a condition. As soon as it -becomes -unblocked for any reason, we will know because it will set a flag. Since -the -flag is not set, we are 100% confident that thread A is waiting on the -condition. We have another thread, thread B, which has acquired the mutex -and is about to wait on the condition. Thus it is pretty clear that at any -point, either just A is waiting, or A and B are waiting. Now thread C comes -along. C is about to do a broadcast on the condition. A broadcast is -guaranteed to unblock all threads currently waiting on a condition, right? -Again, we said that either just A is waiting, or A and B are both waiting. -So, when C does its broadcast, depending upon whether B has started waiting -or not, thread C will unblock A or unblock A and B. Either way, C must -unblock A, right? - -Now, you said anything that happens is correct so long as a) "a signal is -not lost between unlocking the mutex and waiting on the condition" and b) -"a -thread must not steal a signal it sent", correct? Requirement b) is easy to -satisfy: in this scenario, thread C will never wait on the condition, so it -won't steal any signals. Requirement a) is not hard either. The only way -we -could fail to meet requirement a) in this scenario is if thread B was -started waiting but didn't wake up because a signal was lost. This will not -happen. - -Now, here is what happens. Assume thread C beats thread B. Thread C looks -to -see how many threads are waiting on the condition. Thread C sees just one -thread, thread A, waiting. It does a broadcast waking up just one thread -because just one thread is waiting. Next, before A can become unblocked, -thread B begins waiting. Now there are two threads waiting, but only one -will be unblocked. Suppose B wins. B will become unblocked. A will not -become unblocked, because C only unblocked one thread (sema_post cond, 1). -So at the end, B finishes and A remains blocked. - -We have met both of your requirements, so by your rules, this is an -acceptable outcome. However, I think that the spec says this is an -unacceptable outcome! We know for certain that A was waiting and that C did -a broadcast, but A did not become unblocked! Yet, the spec says that a -broadcast wakes up all waiting threads. This did not happen. Do you agree -that this shows your rules are not strict enough? - -> and what about N2? :) this one does allow almost everything. - -Don't get me started about rule #2. I'll NEVER advocate an algorithm that -uses rule 2 as an excuse to suck! - -> but it is done (decrement)under mutex protection - this is not a subject -> of a race condition. - -You are correct. My mistake. - -> i would remove "_bTimedOut=false".. after all, it was a real timeout.. - -I disagree. A thread that can't successfully retract its waiter status -can't -really have timed out. If a thread can't return without executing extra -code -to deal with the fact that someone tried to unblock it, I think it is a -poor -idea to pretend we -didn't realize someone was trying to signal us. After all, a signal is more -important than a time out. - -> when nSignaled != 0, it is possible to update nWaiters (--) and do not -> touch nGone - -I realize this, but I was thinking that writing it the other ways saves -another if statement. - -> adjust only if nGone != 0 and save one cache memory write - probably much -slower than 'if' - -Hmm. You are probably right. - -> well, in a strange (e.g. timeout test) program you may (theoretically) -> have an overflow of nWaiters/nGone counters (with waiters repeatedly -timing -> out and no signals at all). - -Also true. Not only that, but you also have the possibility that one could -overflow the number of waiters as well! However, considering the limit you -have chosen for nWaitersGone, I suppose it is unlikely that anyone would be -able to get INT_MAX/2 threads waiting on a single condition. :) - -Analysis of 8a: - -It looks correct to me. - -What are IPC semaphores? - -In the line where you state, "else if ( nWaitersBlocked > nWaitersGone ) { -// HARMLESS RACE CONDITION!" there is no race condition for nWaitersGone -because nWaitersGone is never modified without holding mtxUnblockLock. You -are correct that there is a harmless race on nWaitersBlocked, which can -increase and make the condition become true just after we check it. If this -happens, we interpret it as the wait starting after the signal. - -I like your optimization of this. You could improve Alg. 6 as follows: ----------- Algorithm 6b ---------- -signal(bAll) { - _nSig=0 - lock counters - // this is safe because nWaiting can only be decremented by a thread that - // owns counters and nGone can only be changed by a thread that owns -counters. - if (nWaiting>nGone) { - if (0==nSignaled) { - sema_wait gate // close gate if not already closed - } - if (nGone>0) { - nWaiting-=nGone - nGone=0 - } - _nSig=bAll?nWaiting:1 - nSignaled+=_nSig - nWaiting-=_nSig - } - unlock counters - if (0!=_nSig) { - sema_post queue, _nSig - } -} ----------- ---------- ---------- -I guess this wouldn't apply to Alg 8a because nWaitersGone changes meanings -depending upon whether the gate is open or closed. - -In the loop "while ( nWaitersWasGone-- ) {" you do a sema_wait on -semBlockLock. Perhaps waiting on semBlockQueue would be a better idea. - -What have you gained by making the last thread to be signaled do the waits -for all the timed out threads, besides added complexity? It took me a long -time to figure out what your objective was with this, to realize you were -using nWaitersGone to mean two different things, and to verify that you -hadn't introduced any bug by doing this. Even now I'm not 100% sure. - -What has all this playing about with nWaitersGone really gained us besides -a -lot of complexity (it is much harder to verify that this solution is -correct), execution overhead (we now have a lot more if statements to -evaluate), and space overhead (more space for the extra code, and another -integer in our data)? We did manage to save a lock/unlock pair in an -uncommon case (when a time out occurs) at the above mentioned expenses in -the common cases. - -As for 8b, c, and d, they look ok though I haven't studied them thoroughly. -What would you use them for? - - Later, - -Louis! :) - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.NONPORTABLE b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.NONPORTABLE deleted file mode 100644 index aa43297e104..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.NONPORTABLE +++ /dev/null @@ -1,285 +0,0 @@ -This file documents non-portable functions and other issues. - -Non-portable functions included in pthreads-win32 -------------------------------------------------- - -BOOL -pthread_win32_test_features_np(int mask) - - This routine allows an application to check which - run-time auto-detected features are available within - the library. - - The possible features are: - - PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE - Return TRUE if the native version of - InterlockedCompareExchange() is being used. - PTW32_ALERTABLE_ASYNC_CANCEL - Return TRUE is the QueueUserAPCEx package - QUSEREX.DLL is available and the AlertDrv.sys - driver is loaded into Windows, providing - alertable (pre-emptive) asyncronous threads - cancelation. If this feature returns FALSE - then the default async cancel scheme is in - use, which cannot cancel blocked threads. - - Features may be Or'ed into the mask parameter, in which case - the routine returns TRUE if any of the Or'ed features would - return TRUE. At this stage it doesn't make sense to Or features - but it may some day. - - -void * -pthread_timechange_handler_np(void *) - - To improve tolerance against operator or time service - initiated system clock changes. - - This routine can be called by an application when it - receives a WM_TIMECHANGE message from the system. At - present it broadcasts all condition variables so that - waiting threads can wake up and re-evaluate their - conditions and restart their timed waits if required. - - It has the same return type and argument type as a - thread routine so that it may be called directly - through pthread_create(), i.e. as a separate thread. - - Parameters - - Although a parameter must be supplied, it is ignored. - The value NULL can be used. - - Return values - - It can return an error EAGAIN to indicate that not - all condition variables were broadcast for some reason. - Otherwise, 0 is returned. - - If run as a thread, the return value is returned - through pthread_join(). - - The return value should be cast to an integer. - - -HANDLE -pthread_getw32threadhandle_np(pthread_t thread); - - Returns the win32 thread handle that the POSIX - thread "thread" is running as. - - Applications can use the win32 handle to set - win32 specific attributes of the thread. - - -int -pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, int kind) - -int -pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, int *kind) - - These two routines are included for Linux compatibility - and are direct equivalents to the standard routines - pthread_mutexattr_settype - pthread_mutexattr_gettype - - pthread_mutexattr_setkind_np accepts the following - mutex kinds: - PTHREAD_MUTEX_FAST_NP - PTHREAD_MUTEX_ERRORCHECK_NP - PTHREAD_MUTEX_RECURSIVE_NP - - These are really just equivalent to (respectively): - PTHREAD_MUTEX_NORMAL - PTHREAD_MUTEX_ERRORCHECK - PTHREAD_MUTEX_RECURSIVE - -int -pthread_delay_np (const struct timespec *interval); - - This routine causes a thread to delay execution for a specific period of time. - This period ends at the current time plus the specified interval. The routine - will not return before the end of the period is reached, but may return an - arbitrary amount of time after the period has gone by. This can be due to - system load, thread priorities, and system timer granularity. - - Specifying an interval of zero (0) seconds and zero (0) nanoseconds is - allowed and can be used to force the thread to give up the processor or to - deliver a pending cancelation request. - - This routine is a cancelation point. - - The timespec structure contains the following two fields: - - tv_sec is an integer number of seconds. - tv_nsec is an integer number of nanoseconds. - - Return Values - - If an error condition occurs, this routine returns an integer value - indicating the type of error. Possible return values are as follows: - - 0 Successful completion. - [EINVAL] The value specified by interval is invalid. - -int -pthread_num_processors_np - - This routine (found on HPUX systems) returns the number of processors - in the system. This implementation actually returns the number of - processors available to the process, which can be a lower number - than the system's number, depending on the process's affinity mask. - -BOOL -pthread_win32_process_attach_np (void); - -BOOL -pthread_win32_process_detach_np (void); - -BOOL -pthread_win32_thread_attach_np (void); - -BOOL -pthread_win32_thread_detach_np (void); - - These functions contain the code normally run via dllMain - when the library is used as a dll but which need to be - called explicitly by an application when the library - is statically linked. - - You will need to call pthread_win32_process_attach_np() before - you can call any pthread routines when statically linking. - You should call pthread_win32_process_detach_np() before - exiting your application to clean up. - - pthread_win32_thread_attach_np() is currently a no-op, but - pthread_win32_thread_detach_np() is needed to clean up - the implicit pthread handle that is allocated to a Win32 thread if - it calls certain pthreads routines. Call this routine when the - Win32 thread exits. - - These functions invariably return TRUE except for - pthread_win32_process_attach_np() which will return FALSE - if pthreads-win32 initialisation fails. - -int -pthreadCancelableWait (HANDLE waitHandle); - -int -pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout); - - These two functions provide hooks into the pthread_cancel - mechanism that will allow you to wait on a Windows handle - and make it a cancellation point. Both functions block - until either the given w32 handle is signaled, or - pthread_cancel has been called. It is implemented using - WaitForMultipleObjects on 'waitHandle' and a manually - reset w32 event used to implement pthread_cancel. - - -Non-portable issues -------------------- - -Thread priority - - POSIX defines a single contiguous range of numbers that determine a - thread's priority. Win32 defines priority classes and priority - levels relative to these classes. Classes are simply priority base - levels that the defined priority levels are relative to such that, - changing a process's priority class will change the priority of all - of it's threads, while the threads retain the same relativity to each - other. - - A Win32 system defines a single contiguous monotonic range of values - that define system priority levels, just like POSIX. However, Win32 - restricts individual threads to a subset of this range on a - per-process basis. - - The following table shows the base priority levels for combinations - of priority class and priority value in Win32. - - Process Priority Class Thread Priority Level - ----------------------------------------------------------------- - 1 IDLE_PRIORITY_CLASS THREAD_PRIORITY_IDLE - 1 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - 1 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - 1 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - 1 HIGH_PRIORITY_CLASS THREAD_PRIORITY_IDLE - 2 IDLE_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 3 IDLE_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 4 IDLE_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 4 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 5 IDLE_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 5 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 5 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 6 IDLE_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 6 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 6 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 7 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 7 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 7 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 8 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 8 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 8 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 8 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 9 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 9 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 9 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 10 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 10 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 11 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 11 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 11 HIGH_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 12 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 12 HIGH_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 13 HIGH_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 14 HIGH_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - 15 IDLE_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - 15 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - 15 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - 15 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - 16 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_IDLE - 17 REALTIME_PRIORITY_CLASS -7 - 18 REALTIME_PRIORITY_CLASS -6 - 19 REALTIME_PRIORITY_CLASS -5 - 20 REALTIME_PRIORITY_CLASS -4 - 21 REALTIME_PRIORITY_CLASS -3 - 22 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - 23 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - 24 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - 25 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - 26 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - 27 REALTIME_PRIORITY_CLASS 3 - 28 REALTIME_PRIORITY_CLASS 4 - 29 REALTIME_PRIORITY_CLASS 5 - 30 REALTIME_PRIORITY_CLASS 6 - 31 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - - Windows NT: Values -7, -6, -5, -4, -3, 3, 4, 5, and 6 are not supported. - - - As you can see, the real priority levels available to any individual - Win32 thread are non-contiguous. - - An application using pthreads-win32 should not make assumptions about - the numbers used to represent thread priority levels, except that they - are monotonic between the values returned by sched_get_priority_min() - and sched_get_priority_max(). E.g. Windows 95, 98, NT, 2000, XP make - available a non-contiguous range of numbers between -15 and 15, while - at least one version of WinCE (3.0) defines the minimum priority - (THREAD_PRIORITY_LOWEST) as 5, and the maximum priority - (THREAD_PRIORITY_HIGHEST) as 1. - - Internally, pthreads-win32 maps any priority levels between - THREAD_PRIORITY_IDLE and THREAD_PRIORITY_LOWEST to THREAD_PRIORITY_LOWEST, - or between THREAD_PRIORITY_TIME_CRITICAL and THREAD_PRIORITY_HIGHEST to - THREAD_PRIORITY_HIGHEST. Currently, this also applies to - REALTIME_PRIORITY_CLASSi even if levels -7, -6, -5, -4, -3, 3, 4, 5, and 6 - are supported. - - If it wishes, a Win32 application using pthreads-win32 can use the Win32 - defined priority macros THREAD_PRIORITY_IDLE through - THREAD_PRIORITY_TIME_CRITICAL. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.Watcom b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.Watcom deleted file mode 100644 index 2974928a381..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.Watcom +++ /dev/null @@ -1,62 +0,0 @@ -Watcom compiler notes -===================== - -Status ------- -Not yet usable. Although the library builds under Watcom it -substantially fails the test suite. - -There is a working Wmakefile for wmake for the library build. - -invoke as any of: -wmake -f Wmakefile clean WC -wmake -f Wmakefile clean WC-inlined -wmake -f Wmakefile clean WCE -wmake -f Wmakefile clean WCE-inlined - -These build pthreadWC.dll and pthreadWCE.dll. - -There is a working Wmakefile for wmake for the test suite. - -invoke as any of: -wmake -f Wmakefile clean WC -wmake -f Wmakefile clean WCX -wmake -f Wmakefile clean WCE -wmake -f Wmakefile clean WC-bench -wmake -f Wmakefile clean WCX-bench -wmake -f Wmakefile clean WCE-bench - - -Current known problems ----------------------- - -Library build: -The Watcom compiler uses a different default call convention to MS C or GNU C and so -applications are not compatible with pthreadVC.dll etc using pre 2003-10-14 versions -of pthread.h, sched.h, or semaphore.h. The cdecl attribute can be used on exposed -function prototypes to force compatibility with MS C built DLLs. - -However, there appear to be other incompatibilities. Errno.h, for example, defines -different values for the standard C and POSIX errors to those defined by the MS C -errno.h. It may be that references to Watcom's threads compatible 'errno' do set -and return translated numbers consistently, but I have not verified this. - -Watcom defines errno as a dereferenced pointer returned by the function -_get_errno_ptr(). This is similar to both the MS and GNU C environments for -multithreaded use. However, the Watcom version appears to have a number of problems: - -- different threads return the same pointer value. Compare with the MS and GNU C -versions which correctly return different values (since each thread must maintain -a thread specific errno value). - -- an errno value set within the DLL appears as zero in the application even though -both share the same thread. - -Therefore applications built using the Watcom compiler may need to use -a Watcom built version of the library (pthreadWC.dll). If this is the case, then -the cdecl function attribute should not be required. - -Application builds: -The test suite fails with the Watcom compiler. - -Test semaphore1.c fails for pthreadWC.dll because errno returns 0 instead of EAGAIN. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.WinCE b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.WinCE deleted file mode 100644 index a2cd8c21336..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/README.WinCE +++ /dev/null @@ -1,6 +0,0 @@ -WinCE port ----------- -(See the file WinCE-PORT for a detailed explanation.) - -Make sure you define "WINCE" amongst your compiler flags (eg. -DWINCE). -The config.h file will define all the necessary defines for you. diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/TODO b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/TODO deleted file mode 100644 index fa9efc46e7b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/TODO +++ /dev/null @@ -1,7 +0,0 @@ - Things that aren't done yet - --------------------------- - -1. Implement PTHREAD_PROCESS_SHARED for semaphores, mutexes, - condition variables, read/write locks, barriers. - - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/WinCE-PORT b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/WinCE-PORT deleted file mode 100644 index f5981a9dbb7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/WinCE-PORT +++ /dev/null @@ -1,217 +0,0 @@ -NOTE: The comments in this file relate to the original WinCE port -done by Tristan Savatier. The semaphore routines have been -completely rewritten since (2005-04-25), having been progressively -broken more and more by changes to the library. All of the semaphore -routines implemented for W9x/WNT/2000 and up should now also work for -WinCE. Also, pthread_mutex_timedlock should now work. [RPJ] - ----- - -Some interesting news: - -I have been able to port pthread-win32 to Windows-CE, -which uses a subset of the WIN32 API. - -Since we intend to keep using pthread-win32 for our -Commercial WinCE developments, I would be very interested -if WinCE support could be added to the main source tree -of pthread-win32. Also, I would like to be credited -for this port :-) - -Now, here is the story... - -The port was performed and tested on a Casio "Cassiopeia" -PalmSize PC, which runs a MIP processor. The OS in the -Casio is WinCE version 2.11, but I used VC++ 6.0 with -the WinCE SDK for version 2.01. - -I used pthread-win32 to port a heavily multithreaded -commercial application (real-time MPEG video player) -from Linux to WinCE. I consider the changes that -I have done to be quite well tested. - -Overall the modifications that we had to do are minor. - -The WinCE port were based on pthread-win32-snap-1999-05-30, -but I am certain that they can be integrated very easiely -to more recent versions of the source. - -I have attached the modified source code: -pthread-win32-snap-1999-05-30-WinCE. - -All the changes do not affect the code compiled on non-WinCE -environment, provided that the macros used for WinCE compilation -are not used, of course! - -Overall description of the WinCE port: -------------------------------------- - -Most of the changes had to be made in areas where -pthread-win32 was relying on some standard-C librairies -(e.g. _ftime, calloc, errno), which are not available -on WinCE. We have changed the code to use native Win32 -API instead (or in some cases we made wrappers). - -The Win32 Semaphores are not available, -so we had to re-implement Semaphores using mutexes -and events. - -Limitations / known problems of the WinCE port: ----------------------------------------------- - -Not all the semaphore routines have been ported -(semaphores are defined by Posix but are not part -pf pthread). I have just done enough to make -pthread routines (that rely internally on semaphores) -work, like signal conditions. - -I noticed that the Win32 threads work slightly -differently on WinCE. This may have some impact -on some tricky parts of pthread-win32, but I have -not really investigated. For example, on WinCE, -the process is killed if the main thread falls off -the bottom (or calls pthread_exit), regardless -of the existence of any other detached thread. -Microsoft manual indicates that this behavior is -deffirent from that of Windows Threads for other -Win32 platforms. - - -Detailed descriptions of the changes and rationals: - ------------------------------------- -- use a new macro NEED_ERRNO. - -If defined, the code in errno.c that defines a reentrant errno -is compiled, regardless of _MT and _REENTRANT. - -Rational: On WinCE, there is no support for , or -any other standard C library, i.e. even if _MT or _REENTRANT -is defined, errno is not provided by any library. NEED_ERRNO -must be set to compile for WinCE. - ------------------------------------- -- In implement.h, change #include to #include "semaphore.h". - -Rational: semaphore.h is provided in pthread-win32 and should not -be searched in the systems standard include. would not compile. -This change does not seem to create problems on "classic" win32 -(e.g. win95). - ------------------------------------- -- use a new macro NEED_CALLOC. - -If defined, some code in misc.c will provide a replacement -for calloc, which is not available on Win32. - - ------------------------------------- -- use a new macro NEED_CREATETHREAD. - -If defined, implement.h defines the macro _beginthreadex -and _endthreadex. - -Rational: On WinCE, the wrappers _beginthreadex and _endthreadex -do not exist. The native Win32 routines must be used. - ------------------------------------- -- in misc.c: - -#ifdef NEED_DUPLICATEHANDLE - /* DuplicateHandle does not exist on WinCE */ - self->threadH = GetCurrentThread(); -#else - if( !DuplicateHandle( - GetCurrentProcess(), - GetCurrentThread(), - GetCurrentProcess(), - &self->threadH, - 0, - FALSE, - DUPLICATE_SAME_ACCESS ) ) - { - free( self ); - return (NULL); - } -#endif - -Rational: On WinCE, DuplicateHandle does not exist. I could not understand -why DuplicateHandle must be used. It seems to me that getting the current -thread handle with GetCurrentThread() is sufficient, and it seems to work -perfectly fine, so maybe DuplicateHandle was just plain useless to begin with ? - ------------------------------------- -- In private.c, added some code at the beginning of ptw32_processInitialize -to detect the case of multiple calls to ptw32_processInitialize. - -Rational: In order to debug pthread-win32, it is easier to compile -it as a regular library (it is not possible to debug DLL's on winCE). -In that case, the application must call ptw32_rocessInitialize() -explicitely, to initialize pthread-win32. It is safer in this circumstance -to handle the case where ptw32_processInitialize() is called on -an already initialized library: - -int -ptw32_processInitialize (void) -{ - if (ptw32_processInitialized) { - /* - * ignore if already initialized. this is useful for - * programs that uses a non-dll pthread - * library. such programs must call ptw32_processInitialize() explicitely, - * since this initialization routine is automatically called only when - * the dll is loaded. - */ - return TRUE; - } - ptw32_processInitialized = TRUE; - [...] -} - ------------------------------------- -- in private.c, if macro NEED_FTIME is defined, add routines to -convert timespec_to_filetime and filetime_to_timespec, and modified -code that was using _ftime() to use Win32 API instead. - -Rational: _ftime is not available on WinCE. It is necessary to use -the native Win32 time API instead. - -Note: the routine timespec_to_filetime is provided as a convenience and a mean -to test that filetime_to_timespec works, but it is not used by the library. - ------------------------------------- -- in semaphore.c, if macro NEED_SEM is defined, add code for the routines -_increase_semaphore and _decrease_semaphore, and modify significantly -the implementation of the semaphores so that it does not use CreateSemaphore. - -Rational: CreateSemaphore is not available on WinCE. I had to re-implement -semaphores using mutexes and Events. - -Note: Only the semaphore routines that are used by pthread are implemented -(i.e. signal conditions rely on a subset of the semaphores routines, and -this subset works). Some other semaphore routines (e.g. sem_trywait) are -not yet supported on my WinCE port (and since I don't need them, I am not -planning to do anything about them). - ------------------------------------- -- in tsd.c, changed the code that defines TLS_OUT_OF_INDEXES - -/* TLS_OUT_OF_INDEXES not defined on WinCE */ -#ifndef TLS_OUT_OF_INDEXES -#define TLS_OUT_OF_INDEXES 0xffffffff -#endif - -Rational: TLS_OUT_OF_INDEXES is not defined in any standard include file -on WinCE. - ------------------------------------- -- added file need_errno.h - -Rational: On WinCE, there is no errno.h file. need_errno.h is just a -copy of windows version of errno.h, with minor modifications due to the fact -that some of the error codes are defined by the WinCE socket library. -In pthread.h, if NEED_ERRNO is defined, the file need_errno.h is -included (instead of ). - - --- eof diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/attr.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/attr.c deleted file mode 100644 index a9d55f4a4b3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/attr.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * attr.c - * - * Description: - * This translation unit agregates operations on thread attribute objects. - * It is used for inline optimisation. - * - * The included modules are used separately when static executable sizes - * must be minimised. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -#include "pthread_attr_init.c" -#include "pthread_attr_destroy.c" -#include "pthread_attr_getdetachstate.c" -#include "pthread_attr_setdetachstate.c" -#include "pthread_attr_getstackaddr.c" -#include "pthread_attr_setstackaddr.c" -#include "pthread_attr_getstacksize.c" -#include "pthread_attr_setstacksize.c" -#include "pthread_attr_getscope.c" -#include "pthread_attr_setscope.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/barrier.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/barrier.c deleted file mode 100644 index 41b950cd123..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/barrier.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * barrier.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#include "pthread_barrier_init.c" -#include "pthread_barrier_destroy.c" -#include "pthread_barrier_wait.c" -#include "pthread_barrierattr_init.c" -#include "pthread_barrierattr_destroy.c" -#include "pthread_barrierattr_getpshared.c" -#include "pthread_barrierattr_setpshared.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/builddmc.bat b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/builddmc.bat deleted file mode 100644 index 3edbaebb3ea..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/builddmc.bat +++ /dev/null @@ -1,9 +0,0 @@ -; Build the pthreads library with the Digital Mars Compiler -; -set DMCDIR=c:\dm - -; RELEASE -%DMCDIR%\bin\dmc -D_WIN32_WINNT -D_MT -DHAVE_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/NODEBUG -L/SU:WINDOWS - -; DEBUG -%DMCDIR%\bin\dmc -g -D_WIN32_WINNT -D_MT -DHAVE_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/SU:WINDOWS diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/cancel.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/cancel.c deleted file mode 100644 index 1bd14ebe653..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/cancel.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * cancel.c - * - * Description: - * POSIX thread functions related to thread cancellation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#include "pthread_setcancelstate.c" -#include "pthread_setcanceltype.c" -#include "pthread_testcancel.c" -#include "pthread_cancel.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/cleanup.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/cleanup.c deleted file mode 100644 index 381d1e87c83..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/cleanup.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * cleanup.c - * - * Description: - * This translation unit implements routines associated - * with cleaning up threads. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -/* - * The functions ptw32_pop_cleanup and ptw32_push_cleanup - * are implemented here for applications written in C with no - * SEH or C++ destructor support. - */ - -ptw32_cleanup_t * -ptw32_pop_cleanup (int execute) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function pops the most recently pushed cleanup - * handler. If execute is nonzero, then the cleanup handler - * is executed if non-null. - * - * PARAMETERS - * execute - * if nonzero, execute the cleanup handler - * - * - * DESCRIPTION - * This function pops the most recently pushed cleanup - * handler. If execute is nonzero, then the cleanup handler - * is executed if non-null. - * NOTE: specify 'execute' as nonzero to avoid duplication - * of common cleanup code. - * - * RESULTS - * N/A - * - * ------------------------------------------------------ - */ -{ - ptw32_cleanup_t *cleanup; - - cleanup = (ptw32_cleanup_t *) pthread_getspecific (ptw32_cleanupKey); - - if (cleanup != NULL) - { - if (execute && (cleanup->routine != NULL)) - { - - (*cleanup->routine) (cleanup->arg); - - } - - pthread_setspecific (ptw32_cleanupKey, (void *) cleanup->prev); - - } - - return (cleanup); - -} /* ptw32_pop_cleanup */ - - -void -ptw32_push_cleanup (ptw32_cleanup_t * cleanup, - ptw32_cleanup_callback_t routine, void *arg) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function pushes a new cleanup handler onto the thread's stack - * of cleanup handlers. Each cleanup handler pushed onto the stack is - * popped and invoked with the argument 'arg' when - * a) the thread exits by calling 'pthread_exit', - * b) when the thread acts on a cancellation request, - * c) or when the thread calls pthread_cleanup_pop with a nonzero - * 'execute' argument - * - * PARAMETERS - * cleanup - * a pointer to an instance of pthread_cleanup_t, - * - * routine - * pointer to a cleanup handler, - * - * arg - * parameter to be passed to the cleanup handler - * - * - * DESCRIPTION - * This function pushes a new cleanup handler onto the thread's stack - * of cleanup handlers. Each cleanup handler pushed onto the stack is - * popped and invoked with the argument 'arg' when - * a) the thread exits by calling 'pthread_exit', - * b) when the thread acts on a cancellation request, - * c) or when the thrad calls pthread_cleanup_pop with a nonzero - * 'execute' argument - * NOTE: pthread_push_cleanup, ptw32_pop_cleanup must be paired - * in the same lexical scope. - * - * RESULTS - * pthread_cleanup_t * - * pointer to the previous cleanup - * - * ------------------------------------------------------ - */ -{ - cleanup->routine = routine; - cleanup->arg = arg; - - cleanup->prev = (ptw32_cleanup_t *) pthread_getspecific (ptw32_cleanupKey); - - pthread_setspecific (ptw32_cleanupKey, (void *) cleanup); - -} /* ptw32_push_cleanup */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/condvar.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/condvar.c deleted file mode 100644 index 704f4d7931b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/condvar.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * condvar.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - */ - -#include "pthread.h" -#include "implement.h" - -#include "ptw32_cond_check_need_init.c" -#include "pthread_condattr_init.c" -#include "pthread_condattr_destroy.c" -#include "pthread_condattr_getpshared.c" -#include "pthread_condattr_setpshared.c" -#include "pthread_cond_init.c" -#include "pthread_cond_destroy.c" -#include "pthread_cond_wait.c" -#include "pthread_cond_signal.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/config.h b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/config.h deleted file mode 100644 index d6638dfaf3d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/config.h +++ /dev/null @@ -1,134 +0,0 @@ -/* config.h */ - -#ifndef PTW32_CONFIG_H -#define PTW32_CONFIG_H - -/********************************************************************* - * Defaults: see target specific redefinitions below. - *********************************************************************/ - -/* We're building the pthreads-win32 library */ -#define PTW32_BUILD - -/* Do we know about the C type sigset_t? */ -#undef HAVE_SIGSET_T - -/* Define if you have the header file. */ -#undef HAVE_SIGNAL_H - -/* Define if you have the Borland TASM32 or compatible assembler. */ -#undef HAVE_TASM32 - -/* Define if you don't have Win32 DuplicateHandle. (eg. WinCE) */ -#undef NEED_DUPLICATEHANDLE - -/* Define if you don't have Win32 _beginthreadex. (eg. WinCE) */ -#undef NEED_CREATETHREAD - -/* Define if you don't have Win32 errno. (eg. WinCE) */ -#undef NEED_ERRNO - -/* Define if you don't have Win32 calloc. (eg. WinCE) */ -#undef NEED_CALLOC - -/* Define if you don't have Win32 ftime. (eg. WinCE) */ -#undef NEED_FTIME - -/* Define if you don't have Win32 semaphores. (eg. WinCE 2.1 or earlier) */ -#undef NEED_SEM - -/* Define if you need to convert string parameters to unicode. (eg. WinCE) */ -#undef NEED_UNICODE_CONSTS - -/* Define if your C (not C++) compiler supports "inline" functions. */ -#undef HAVE_C_INLINE - -/* Do we know about type mode_t? */ -#undef HAVE_MODE_T - -/* Define if you have the timespec struct */ -#undef HAVE_STRUCT_TIMESPEC - -/* Define if you don't have the GetProcessAffinityMask() */ -#undef NEED_PROCESS_AFFINITY_MASK - -/* -# ---------------------------------------------------------------------- -# The library can be built with some alternative behaviour to better -# facilitate development of applications on Win32 that will be ported -# to other POSIX systems. -# -# Nothing described here will make the library non-compliant and strictly -# compliant applications will not be affected in any way, but -# applications that make assumptions that POSIX does not guarantee are -# not strictly compliant and may fail or misbehave with some settings. -# -# PTW32_THREAD_ID_REUSE_INCREMENT -# Purpose: -# POSIX says that applications should assume that thread IDs can be -# recycled. However, Solaris (and some other systems) use a [very large] -# sequence number as the thread ID, which provides virtual uniqueness. -# This provides a very high but finite level of safety for applications -# that are not meticulous in tracking thread lifecycles e.g. applications -# that call functions which target detached threads without some form of -# thread exit synchronisation. -# -# Usage: -# Set to any value in the range: 0 <= value < 2^wordsize. -# Set to 0 to emulate reusable thread ID behaviour like Linux or *BSD. -# Set to 1 for unique thread IDs like Solaris (this is the default). -# Set to some factor of 2^wordsize to emulate smaller word size types -# (i.e. will wrap sooner). This might be useful to emulate some embedded -# systems. -# -# define PTW32_THREAD_ID_REUSE_INCREMENT 0 -# -# ---------------------------------------------------------------------- - */ -#undef PTW32_THREAD_ID_REUSE_INCREMENT - - -/********************************************************************* - * Target specific groups - * - * If you find that these are incorrect or incomplete please report it - * to the pthreads-win32 maintainer. Thanks. - *********************************************************************/ -#ifdef WINCE -#define NEED_DUPLICATEHANDLE -#define NEED_CREATETHREAD -#define NEED_ERRNO -#define NEED_CALLOC -#define NEED_FTIME -//#define NEED_SEM -#define NEED_UNICODE_CONSTS -#define NEED_PROCESS_AFFINITY_MASK -#endif - -#ifdef _UWIN -#define HAVE_MODE_T -#define HAVE_STRUCT_TIMESPEC -#endif - -#ifdef __GNUC__ -#define HAVE_C_INLINE -#endif - -#ifdef __MINGW32__ -#define HAVE_MODE_T -#endif - -#ifdef __BORLANDC__ -#endif - -#ifdef __WATCOMC__ -#endif - -#ifdef __DMC__ -#define HAVE_SIGNAL_H -#define HAVE_C_INLINE -#endif - - - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/create.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/create.c deleted file mode 100644 index 9e9388b20cc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/create.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * create.c - * - * Description: - * This translation unit implements routines associated with spawning a new - * thread. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#ifndef _UWIN -#include -#endif - -int -pthread_create (pthread_t * tid, - const pthread_attr_t * attr, - void *(*start) (void *), void *arg) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function creates a thread running the start function, - * passing it the parameter value, 'arg'. The 'attr' - * argument specifies optional creation attributes. - * The identity of the new thread is returned - * via 'tid', which should not be NULL. - * - * PARAMETERS - * tid - * pointer to an instance of pthread_t - * - * attr - * optional pointer to an instance of pthread_attr_t - * - * start - * pointer to the starting routine for the new thread - * - * arg - * optional parameter passed to 'start' - * - * - * DESCRIPTION - * This function creates a thread running the start function, - * passing it the parameter value, 'arg'. The 'attr' - * argument specifies optional creation attributes. - * The identity of the new thread is returned - * via 'tid', which should not be the NULL pointer. - * - * RESULTS - * 0 successfully created thread, - * EINVAL attr invalid, - * EAGAIN insufficient resources. - * - * ------------------------------------------------------ - */ -{ - pthread_t thread; - ptw32_thread_t * tp; - register pthread_attr_t a; - HANDLE threadH = 0; - int result = EAGAIN; - int run = PTW32_TRUE; - ThreadParms *parms = NULL; - long stackSize; - int priority; - pthread_t self; - - /* - * Before doing anything, check that tid can be stored through - * without invoking a memory protection error (segfault). - * Make sure that the assignment below can't be optimised out by the compiler. - * This is assured by conditionally assigning *tid again at the end. - */ - tid->x = 0; - - if (attr != NULL) - { - a = *attr; - } - else - { - a = NULL; - } - - if ((thread = ptw32_new ()).p == NULL) - { - goto FAIL0; - } - - tp = (ptw32_thread_t *) thread.p; - - priority = tp->sched_priority; - - if ((parms = (ThreadParms *) malloc (sizeof (*parms))) == NULL) - { - goto FAIL0; - } - - parms->tid = thread; - parms->start = start; - parms->arg = arg; - -#if defined(HAVE_SIGSET_T) - - /* - * Threads inherit their initial sigmask from their creator thread. - */ - self = pthread_self(); - tp->sigmask = ((ptw32_thread_t *)self.p)->sigmask; - -#endif /* HAVE_SIGSET_T */ - - - if (a != NULL) - { - stackSize = a->stacksize; - tp->detachState = a->detachstate; - priority = a->param.sched_priority; - -#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL) - /* WinCE */ -#else - /* Everything else */ - - /* - * Thread priority must be set to a valid system level - * without altering the value set by pthread_attr_setschedparam(). - */ - - /* - * PTHREAD_EXPLICIT_SCHED is the default because Win32 threads - * don't inherit their creator's priority. They are started with - * THREAD_PRIORITY_NORMAL (win32 value). The result of not supplying - * an 'attr' arg to pthread_create() is equivalent to defaulting to - * PTHREAD_EXPLICIT_SCHED and priority THREAD_PRIORITY_NORMAL. - */ - if (PTHREAD_INHERIT_SCHED == a->inheritsched) - { - /* - * If the thread that called pthread_create() is a Win32 thread - * then the inherited priority could be the result of a temporary - * system adjustment. This is not the case for POSIX threads. - */ -#if ! defined(HAVE_SIGSET_T) - self = pthread_self (); -#endif - priority = ((ptw32_thread_t *) self.p)->sched_priority; - } - -#endif - - } - else - { - /* - * Default stackSize - */ - stackSize = PTHREAD_STACK_MIN; - } - - tp->state = run ? PThreadStateInitial : PThreadStateSuspended; - - tp->keys = NULL; - - /* - * Threads must be started in suspended mode and resumed if necessary - * after _beginthreadex returns us the handle. Otherwise we set up a - * race condition between the creating and the created threads. - * Note that we also retain a local copy of the handle for use - * by us in case thread.p->threadH gets NULLed later but before we've - * finished with it here. - */ - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) - - tp->threadH = - threadH = - (HANDLE) _beginthreadex ((void *) NULL, /* No security info */ - (unsigned) stackSize, /* default stack size */ - ptw32_threadStart, - parms, - (unsigned) - CREATE_SUSPENDED, - (unsigned *) &(tp->thread)); - - if (threadH != 0) - { - if (a != NULL) - { - (void) ptw32_setthreadpriority (thread, SCHED_OTHER, priority); - } - - if (run) - { - ResumeThread (threadH); - } - } - -#else /* __MINGW32__ && ! __MSVCRT__ */ - - /* - * This lock will force pthread_threadStart() to wait until we have - * the thread handle and have set the priority. - */ - (void) pthread_mutex_lock (&tp->cancelLock); - - tp->threadH = - threadH = - (HANDLE) _beginthread (ptw32_threadStart, (unsigned) stackSize, /* default stack size */ - parms); - - /* - * Make the return code match _beginthreadex's. - */ - if (threadH == (HANDLE) - 1L) - { - tp->threadH = threadH = 0; - } - else - { - if (!run) - { - /* - * beginthread does not allow for create flags, so we do it now. - * Note that beginthread itself creates the thread in SUSPENDED - * mode, and then calls ResumeThread to start it. - */ - SuspendThread (threadH); - } - - if (a != NULL) - { - (void) ptw32_setthreadpriority (thread, SCHED_OTHER, priority); - } - } - - (void) pthread_mutex_unlock (&tp->cancelLock); - -#endif /* __MINGW32__ && ! __MSVCRT__ */ - - result = (threadH != 0) ? 0 : EAGAIN; - - /* - * Fall Through Intentionally - */ - - /* - * ------------ - * Failure Code - * ------------ - */ - -FAIL0: - if (result != 0) - { - - ptw32_threadDestroy (thread); - tp = NULL; - - if (parms != NULL) - { - free (parms); - } - } - else - { - *tid = thread; - } - -#ifdef _UWIN - if (result == 0) - pthread_count++; -#endif - return (result); - -} /* pthread_create */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/dll.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/dll.c deleted file mode 100644 index c1cd4e96e28..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/dll.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * dll.c - * - * Description: - * This translation unit implements DLL initialisation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef PTW32_STATIC_LIB - -#include "pthread.h" -#include "implement.h" - -#ifdef _MSC_VER -/* - * lpvReserved yields an unreferenced formal parameter; - * ignore it - */ -#pragma warning( disable : 4100 ) -#endif - -#ifdef __cplusplus -/* - * Dear c++: Please don't mangle this name. -thanks - */ -extern "C" -#endif /* __cplusplus */ - BOOL WINAPI -DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) -{ - BOOL result = PTW32_TRUE; - - switch (fdwReason) - { - - case DLL_PROCESS_ATTACH: - result = pthread_win32_process_attach_np (); - break; - - case DLL_THREAD_ATTACH: - /* - * A thread is being created - */ - result = pthread_win32_thread_attach_np (); - break; - - case DLL_THREAD_DETACH: - /* - * A thread is exiting cleanly - */ - result = pthread_win32_thread_detach_np (); - break; - - case DLL_PROCESS_DETACH: - (void) pthread_win32_thread_detach_np (); - result = pthread_win32_process_detach_np (); - break; - } - - return (result); - -} /* DllMain */ - -#endif /* PTW32_STATIC_LIB */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/errno.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/errno.c deleted file mode 100644 index 9998bb8d53f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/errno.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * errno.c - * - * Description: - * This translation unit implements routines associated with spawning a new - * thread. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#if defined(NEED_ERRNO) - -#include "pthread.h" -#include "implement.h" - -static int reallyBad = ENOMEM; - -/* - * Re-entrant errno. - * - * Each thread has it's own errno variable in pthread_t. - * - * The benefit of using the pthread_t structure - * instead of another TSD key is TSD keys are limited - * on Win32 to 64 per process. Secondly, to implement - * it properly without using pthread_t you'd need - * to dynamically allocate an int on starting the thread - * and store it manually into TLS and then ensure that you free - * it on thread termination. We get all that for free - * by simply storing the errno on the pthread_t structure. - * - * MSVC and Mingw32 already have their own thread-safe errno. - * - * #if defined( _REENTRANT ) || defined( _MT ) - * #define errno *_errno() - * - * int *_errno( void ); - * #else - * extern int errno; - * #endif - * - */ - -int * -_errno (void) -{ - pthread_t self; - int *result; - - if ((self = pthread_self ()) == NULL) - { - /* - * Yikes! unable to allocate a thread! - * Throw an exception? return an error? - */ - result = &reallyBad; - } - else - { - result = &(self->ptErrno); - } - - return (result); - -} /* _errno */ - -#endif /* (NEED_ERRNO) */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/exit.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/exit.c deleted file mode 100644 index 7eb9671bb9f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/exit.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * exit.c - * - * Description: - * This translation unit implements routines associated with exiting from - * a thread. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#ifndef _UWIN -# include -#endif - -#include "pthread_exit.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/fork.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/fork.c deleted file mode 100644 index 8a29550caf3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/fork.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * fork.c - * - * Description: - * Implementation of fork() for POSIX threads. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - - -#include "pthread.h" -#include "implement.h" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/global.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/global.c deleted file mode 100644 index 2b55422984c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/global.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * global.c - * - * Description: - * This translation unit instantiates data associated with the implementation - * as a whole. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int ptw32_processInitialized = PTW32_FALSE; -ptw32_thread_t * ptw32_threadReuseTop = PTW32_THREAD_REUSE_EMPTY; -ptw32_thread_t * ptw32_threadReuseBottom = PTW32_THREAD_REUSE_EMPTY; -pthread_key_t ptw32_selfThreadKey = NULL; -pthread_key_t ptw32_cleanupKey = NULL; -pthread_cond_t ptw32_cond_list_head = NULL; -pthread_cond_t ptw32_cond_list_tail = NULL; - -int ptw32_concurrency = 0; - -/* What features have been auto-detaected */ -int ptw32_features = 0; - -BOOL ptw32_smp_system = PTW32_TRUE; /* Safer if assumed true initially. */ - -/* - * Function pointer to InterlockedCompareExchange if it exists, otherwise - * it will be set at runtime to a substitute local version with the same - * functionality but may be architecture specific. - */ -PTW32_INTERLOCKED_LONG - (WINAPI * ptw32_interlocked_compare_exchange) (PTW32_INTERLOCKED_LPLONG, - PTW32_INTERLOCKED_LONG, - PTW32_INTERLOCKED_LONG) = - NULL; - -/* - * Function pointer to QueueUserAPCEx if it exists, otherwise - * it will be set at runtime to a substitute routine which cannot unblock - * blocked threads. - */ -DWORD (*ptw32_register_cancelation) (PAPCFUNC, HANDLE, DWORD) = NULL; - -/* - * Global lock for managing pthread_t struct reuse. - */ -CRITICAL_SECTION ptw32_thread_reuse_lock; - -/* - * Global lock for testing internal state of statically declared mutexes. - */ -CRITICAL_SECTION ptw32_mutex_test_init_lock; - -/* - * Global lock for testing internal state of PTHREAD_COND_INITIALIZER - * created condition variables. - */ -CRITICAL_SECTION ptw32_cond_test_init_lock; - -/* - * Global lock for testing internal state of PTHREAD_RWLOCK_INITIALIZER - * created read/write locks. - */ -CRITICAL_SECTION ptw32_rwlock_test_init_lock; - -/* - * Global lock for testing internal state of PTHREAD_SPINLOCK_INITIALIZER - * created spin locks. - */ -CRITICAL_SECTION ptw32_spinlock_test_init_lock; - -/* - * Global lock for condition variable linked list. The list exists - * to wake up CVs when a WM_TIMECHANGE message arrives. See - * w32_TimeChangeHandler.c. - */ -CRITICAL_SECTION ptw32_cond_list_lock; - -#ifdef _UWIN -/* - * Keep a count of the number of threads. - */ -int pthread_count = 0; -#endif diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/implement.h b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/implement.h deleted file mode 100644 index 3d964836511..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/implement.h +++ /dev/null @@ -1,710 +0,0 @@ -/* - * implement.h - * - * Definitions that don't need to be public. - * - * Keeps all the internals out of pthread.h - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _IMPLEMENT_H -#define _IMPLEMENT_H - -#ifdef _WIN32_WINNT -#undef _WIN32_WINNT -#endif -#define _WIN32_WINNT 0x400 - -#include - -/* - * In case windows.h doesn't define it (e.g. WinCE perhaps) - */ -#ifdef WINCE -typedef VOID (APIENTRY *PAPCFUNC)(DWORD dwParam); -#endif - -/* - * note: ETIMEDOUT is correctly defined in winsock.h - */ -#include - -/* - * In case ETIMEDOUT hasn't been defined above somehow. - */ -#ifndef ETIMEDOUT -# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ -#endif - -#if !defined(malloc) -#include -#endif - -#if !defined(INT_MAX) -#include -#endif - -/* use local include files during development */ -#include "semaphore.h" -#include "sched.h" - -#if defined(HAVE_C_INLINE) || defined(__cplusplus) -#define INLINE inline -#else -#define INLINE -#endif - -#if defined (__MINGW32__) || (_MSC_VER >= 1300) -#define PTW32_INTERLOCKED_LONG long -#define PTW32_INTERLOCKED_LPLONG long* -#else -#define PTW32_INTERLOCKED_LONG PVOID -#define PTW32_INTERLOCKED_LPLONG PVOID* -#endif - -#if defined(__MINGW32__) -#include -#elif defined(__BORLANDC__) -#define int64_t ULONGLONG -#else -#define int64_t _int64 -#endif - -typedef enum -{ - /* - * This enumeration represents the state of the thread; - * The thread is still "alive" if the numeric value of the - * state is greater or equal "PThreadStateRunning". - */ - PThreadStateInitial = 0, /* Thread not running */ - PThreadStateRunning, /* Thread alive & kicking */ - PThreadStateSuspended, /* Thread alive but suspended */ - PThreadStateCancelPending, /* Thread alive but is */ - /* has cancelation pending. */ - PThreadStateCanceling, /* Thread alive but is */ - /* in the process of terminating */ - /* due to a cancellation request */ - PThreadStateException, /* Thread alive but exiting */ - /* due to an exception */ - PThreadStateLast -} -PThreadState; - - -typedef struct ptw32_thread_t_ ptw32_thread_t; - -struct ptw32_thread_t_ -{ -#ifdef _UWIN - DWORD dummy[5]; -#endif - DWORD thread; - HANDLE threadH; /* Win32 thread handle - POSIX thread is invalid if threadH == 0 */ - pthread_t ptHandle; /* This thread's permanent pthread_t handle */ - ptw32_thread_t * prevReuse; /* Links threads on reuse stack */ - volatile PThreadState state; - void *exitStatus; - void *parms; - int ptErrno; - int detachState; - pthread_mutex_t threadLock; /* Used for serialised access to public thread state */ - int sched_priority; /* As set, not as currently is */ - pthread_mutex_t cancelLock; /* Used for async-cancel safety */ - int cancelState; - int cancelType; - HANDLE cancelEvent; -#ifdef __CLEANUP_C - jmp_buf start_mark; -#endif /* __CLEANUP_C */ -#if HAVE_SIGSET_T - sigset_t sigmask; -#endif /* HAVE_SIGSET_T */ - int implicit:1; - void *keys; - void *nextAssoc; -}; - - -/* - * Special value to mark attribute objects as valid. - */ -#define PTW32_ATTR_VALID ((unsigned long) 0xC4C0FFEE) - -struct pthread_attr_t_ -{ - unsigned long valid; - void *stackaddr; - size_t stacksize; - int detachstate; - struct sched_param param; - int inheritsched; - int contentionscope; -#if HAVE_SIGSET_T - sigset_t sigmask; -#endif /* HAVE_SIGSET_T */ -}; - - -/* - * ==================== - * ==================== - * Semaphores, Mutexes and Condition Variables - * ==================== - * ==================== - */ - -struct sem_t_ -{ - int value; - pthread_mutex_t lock; - HANDLE sem; -#ifdef NEED_SEM - int leftToUnblock; -#endif -}; - -#define PTW32_OBJECT_AUTO_INIT ((void *) -1) -#define PTW32_OBJECT_INVALID NULL - -struct pthread_mutex_t_ -{ - LONG lock_idx; /* Provides exclusive access to mutex state - via the Interlocked* mechanism. - 0: unlocked/free. - 1: locked - no other waiters. - -1: locked - with possible other waiters. - */ - int recursive_count; /* Number of unlocks a thread needs to perform - before the lock is released (recursive - mutexes only). */ - int kind; /* Mutex type. */ - pthread_t ownerThread; - HANDLE event; /* Mutex release notification to waiting - threads. */ -}; - -struct pthread_mutexattr_t_ -{ - int pshared; - int kind; -}; - -/* - * Possible values, other than PTW32_OBJECT_INVALID, - * for the "interlock" element in a spinlock. - * - * In this implementation, when a spinlock is initialised, - * the number of cpus available to the process is checked. - * If there is only one cpu then "interlock" is set equal to - * PTW32_SPIN_USE_MUTEX and u.mutex is a initialised mutex. - * If the number of cpus is greater than 1 then "interlock" - * is set equal to PTW32_SPIN_UNLOCKED and the number is - * stored in u.cpus. This arrangement allows the spinlock - * routines to attempt an InterlockedCompareExchange on "interlock" - * immediately and, if that fails, to try the inferior mutex. - * - * "u.cpus" isn't used for anything yet, but could be used at - * some point to optimise spinlock behaviour. - */ -#define PTW32_SPIN_UNLOCKED (1) -#define PTW32_SPIN_LOCKED (2) -#define PTW32_SPIN_USE_MUTEX (3) - -struct pthread_spinlock_t_ -{ - long interlock; /* Locking element for multi-cpus. */ - union - { - int cpus; /* No. of cpus if multi cpus, or */ - pthread_mutex_t mutex; /* mutex if single cpu. */ - } u; -}; - -struct pthread_barrier_t_ -{ - unsigned int nCurrentBarrierHeight; - unsigned int nInitialBarrierHeight; - int iStep; - int pshared; - sem_t semBarrierBreeched[2]; -}; - -struct pthread_barrierattr_t_ -{ - int pshared; -}; - -struct pthread_key_t_ -{ - DWORD key; - void (*destructor) (void *); - pthread_mutex_t keyLock; - void *threads; -}; - - -typedef struct ThreadParms ThreadParms; -typedef struct ThreadKeyAssoc ThreadKeyAssoc; - -struct ThreadParms -{ - pthread_t tid; - void *(*start) (void *); - void *arg; -}; - - -struct pthread_cond_t_ -{ - long nWaitersBlocked; /* Number of threads blocked */ - long nWaitersGone; /* Number of threads timed out */ - long nWaitersToUnblock; /* Number of threads to unblock */ - sem_t semBlockQueue; /* Queue up threads waiting for the */ - /* condition to become signalled */ - sem_t semBlockLock; /* Semaphore that guards access to */ - /* | waiters blocked count/block queue */ - /* +-> Mandatory Sync.LEVEL-1 */ - pthread_mutex_t mtxUnblockLock; /* Mutex that guards access to */ - /* | waiters (to)unblock(ed) counts */ - /* +-> Optional* Sync.LEVEL-2 */ - pthread_cond_t next; /* Doubly linked list */ - pthread_cond_t prev; -}; - - -struct pthread_condattr_t_ -{ - int pshared; -}; - -#define PTW32_RWLOCK_MAGIC 0xfacade2 - -struct pthread_rwlock_t_ -{ - pthread_mutex_t mtxExclusiveAccess; - pthread_mutex_t mtxSharedAccessCompleted; - pthread_cond_t cndSharedAccessCompleted; - int nSharedAccessCount; - int nExclusiveAccessCount; - int nCompletedSharedAccessCount; - int nMagic; -}; - -struct pthread_rwlockattr_t_ -{ - int pshared; -}; - -/* - * MCS lock queue node - see ptw32_MCS_lock.c - */ -struct ptw32_mcs_node_t_ -{ - struct ptw32_mcs_node_t_ **lock; /* ptr to tail of queue */ - struct ptw32_mcs_node_t_ *next; /* ptr to successor in queue */ - LONG readyFlag; /* set after lock is released by - predecessor */ - LONG nextFlag; /* set after 'next' ptr is set by - successor */ -}; - -typedef struct ptw32_mcs_node_t_ ptw32_mcs_local_node_t; -typedef struct ptw32_mcs_node_t_ *ptw32_mcs_lock_t; - - -struct ThreadKeyAssoc -{ - /* - * Purpose: - * This structure creates an association between a thread and a key. - * It is used to implement the implicit invocation of a user defined - * destroy routine for thread specific data registered by a user upon - * exiting a thread. - * - * Graphically, the arrangement is as follows, where: - * - * K - Key with destructor - * (head of chain is key->threads) - * T - Thread that has called pthread_setspecific(Kn) - * (head of chain is thread->keys) - * A - Association. Each association is a node at the - * intersection of two doubly-linked lists. - * - * T1 T2 T3 - * | | | - * | | | - * K1 -----+-----A-----A-----> - * | | | - * | | | - * K2 -----A-----A-----+-----> - * | | | - * | | | - * K3 -----A-----+-----A-----> - * | | | - * | | | - * V V V - * - * Access to the association is guarded by two locks: the key's - * general lock (guarding the row) and the thread's general - * lock (guarding the column). This avoids the need for a - * dedicated lock for each association, which not only consumes - * more handles but requires that: before the lock handle can - * be released - both the key must be deleted and the thread - * must have called the destructor. The two-lock arrangement - * allows the resources to be freed as soon as either thread or - * key is concluded. - * - * To avoid deadlock: whenever both locks are required, the key - * and thread locks are always acquired in the order: key lock - * then thread lock. An exception to this exists when a thread - * calls the destructors, however this is done carefully to - * avoid deadlock. - * - * An association is created when a thread first calls - * pthread_setspecific() on a key that has a specified - * destructor. - * - * An association is destroyed either immediately after the - * thread calls the key destructor function on thread exit, or - * when the key is deleted. - * - * Attributes: - * thread - * reference to the thread that owns the - * association. This is actually the pointer to the - * thread struct itself. Since the association is - * destroyed before the thread exits, this can never - * point to a different logical thread to the one that - * created the assoc, i.e. after thread struct reuse. - * - * key - * reference to the key that owns the association. - * - * nextKey - * The pthread_t->keys attribute is the head of a - * chain of associations that runs through the nextKey - * link. This chain provides the 1 to many relationship - * between a pthread_t and all pthread_key_t on which - * it called pthread_setspecific. - * - * prevKey - * Similarly. - * - * nextThread - * The pthread_key_t->threads attribute is the head of - * a chain of assoctiations that runs through the - * nextThreads link. This chain provides the 1 to many - * relationship between a pthread_key_t and all the - * PThreads that have called pthread_setspecific for - * this pthread_key_t. - * - * prevThread - * Similarly. - * - * Notes: - * 1) As soon as either the key or the thread is no longer - * referencing the association, it can be destroyed. The - * association will be removed from both chains. - * - * 2) Under WIN32, an association is only created by - * pthread_setspecific if the user provided a - * destroyRoutine when they created the key. - * - * - */ - ptw32_thread_t * thread; - pthread_key_t key; - ThreadKeyAssoc *nextKey; - ThreadKeyAssoc *nextThread; - ThreadKeyAssoc *prevKey; - ThreadKeyAssoc *prevThread; -}; - - -#ifdef __CLEANUP_SEH -/* - * -------------------------------------------------------------- - * MAKE_SOFTWARE_EXCEPTION - * This macro constructs a software exception code following - * the same format as the standard Win32 error codes as defined - * in WINERROR.H - * Values are 32 bit values layed out as follows: - * - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+-+-+-----------------------+-------------------------------+ - * |Sev|C|R| Facility | Code | - * +---+-+-+-----------------------+-------------------------------+ - * - * Severity Values: - */ -#define SE_SUCCESS 0x00 -#define SE_INFORMATION 0x01 -#define SE_WARNING 0x02 -#define SE_ERROR 0x03 - -#define MAKE_SOFTWARE_EXCEPTION( _severity, _facility, _exception ) \ -( (DWORD) ( ( (_severity) << 30 ) | /* Severity code */ \ - ( 1 << 29 ) | /* MS=0, User=1 */ \ - ( 0 << 28 ) | /* Reserved */ \ - ( (_facility) << 16 ) | /* Facility Code */ \ - ( (_exception) << 0 ) /* Exception Code */ \ - ) ) - -/* - * We choose one specific Facility/Error code combination to - * identify our software exceptions vs. WIN32 exceptions. - * We store our actual component and error code within - * the optional information array. - */ -#define EXCEPTION_PTW32_SERVICES \ - MAKE_SOFTWARE_EXCEPTION( SE_ERROR, \ - PTW32_SERVICES_FACILITY, \ - PTW32_SERVICES_ERROR ) - -#define PTW32_SERVICES_FACILITY 0xBAD -#define PTW32_SERVICES_ERROR 0xDEED - -#endif /* __CLEANUP_SEH */ - -/* - * Services available through EXCEPTION_PTW32_SERVICES - * and also used [as parameters to ptw32_throw()] as - * generic exception selectors. - */ - -#define PTW32_EPS_EXIT (1) -#define PTW32_EPS_CANCEL (2) - - -/* Useful macros */ -#define PTW32_MAX(a,b) ((a)<(b)?(b):(a)) -#define PTW32_MIN(a,b) ((a)>(b)?(b):(a)) - - -/* Declared in global.c */ -extern PTW32_INTERLOCKED_LONG (WINAPI * - ptw32_interlocked_compare_exchange) - (PTW32_INTERLOCKED_LPLONG, PTW32_INTERLOCKED_LONG, PTW32_INTERLOCKED_LONG); - -/* Declared in pthread_cancel.c */ -extern DWORD (*ptw32_register_cancelation) (PAPCFUNC, HANDLE, DWORD); - -/* Thread Reuse stack bottom marker. Must not be NULL or any valid pointer to memory. */ -#define PTW32_THREAD_REUSE_EMPTY ((ptw32_thread_t *) 1) - -extern int ptw32_processInitialized; -extern ptw32_thread_t * ptw32_threadReuseTop; -extern ptw32_thread_t * ptw32_threadReuseBottom; -extern pthread_key_t ptw32_selfThreadKey; -extern pthread_key_t ptw32_cleanupKey; -extern pthread_cond_t ptw32_cond_list_head; -extern pthread_cond_t ptw32_cond_list_tail; - -extern int ptw32_mutex_default_kind; - -extern int ptw32_concurrency; - -extern int ptw32_features; - -extern BOOL ptw32_smp_system; /* True: SMP system, False: Uni-processor system */ - -extern CRITICAL_SECTION ptw32_thread_reuse_lock; -extern CRITICAL_SECTION ptw32_mutex_test_init_lock; -extern CRITICAL_SECTION ptw32_cond_list_lock; -extern CRITICAL_SECTION ptw32_cond_test_init_lock; -extern CRITICAL_SECTION ptw32_rwlock_test_init_lock; -extern CRITICAL_SECTION ptw32_spinlock_test_init_lock; - -#ifdef _UWIN -extern int pthread_count; -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* - * ===================== - * ===================== - * Forward Declarations - * ===================== - * ===================== - */ - - int ptw32_is_attr (const pthread_attr_t * attr); - - int ptw32_cond_check_need_init (pthread_cond_t * cond); - int ptw32_mutex_check_need_init (pthread_mutex_t * mutex); - int ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock); - - PTW32_INTERLOCKED_LONG WINAPI - ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, - PTW32_INTERLOCKED_LONG value, - PTW32_INTERLOCKED_LONG comparand); - - LONG WINAPI - ptw32_InterlockedExchange (LPLONG location, - LONG value); - - DWORD - ptw32_RegisterCancelation (PAPCFUNC callback, - HANDLE threadH, DWORD callback_arg); - - int ptw32_processInitialize (void); - - void ptw32_processTerminate (void); - - void ptw32_threadDestroy (pthread_t tid); - - void ptw32_pop_cleanup_all (int execute); - - pthread_t ptw32_new (void); - - pthread_t ptw32_threadReusePop (void); - - void ptw32_threadReusePush (pthread_t thread); - - int ptw32_getprocessors (int *count); - - int ptw32_setthreadpriority (pthread_t thread, int policy, int priority); - - void ptw32_rwlock_cancelwrwait (void *arg); - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) - unsigned __stdcall -#else - void -#endif - ptw32_threadStart (void *vthreadParms); - - void ptw32_callUserDestroyRoutines (pthread_t thread); - - int ptw32_tkAssocCreate (ptw32_thread_t * thread, pthread_key_t key); - - void ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc); - - int ptw32_semwait (sem_t * sem); - - DWORD ptw32_relmillisecs (const struct timespec * abstime); - - void ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node); - - void ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node); - -#ifdef NEED_FTIME - void ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft); - void ptw32_filetime_to_timespec (const FILETIME * ft, struct timespec *ts); -#endif - -/* Declared in misc.c */ -#ifdef NEED_CALLOC -#define calloc(n, s) ptw32_calloc(n, s) - void *ptw32_calloc (size_t n, size_t s); -#endif - -/* Declared in private.c */ - void ptw32_throw (DWORD exception); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#ifdef _UWIN_ -# ifdef _MT -# ifdef __cplusplus -extern "C" -{ -# endif - _CRTIMP unsigned long __cdecl _beginthread (void (__cdecl *) (void *), - unsigned, void *); - _CRTIMP void __cdecl _endthread (void); - _CRTIMP unsigned long __cdecl _beginthreadex (void *, unsigned, - unsigned (__stdcall *) (void *), - void *, unsigned, unsigned *); - _CRTIMP void __cdecl _endthreadex (unsigned); -# ifdef __cplusplus -} -# endif -# endif -#else -# include -#endif - - -/* - * Defaults. Could be overridden when building the inlined version of the dll. - * See ptw32_InterlockedCompareExchange.c - */ -#ifndef PTW32_INTERLOCKED_COMPARE_EXCHANGE -#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_interlocked_compare_exchange -#endif - -#ifndef PTW32_INTERLOCKED_EXCHANGE -#define PTW32_INTERLOCKED_EXCHANGE InterlockedExchange -#endif - - -/* - * Check for old and new versions of cygwin. See the FAQ file: - * - * Question 1 - How do I get pthreads-win32 to link under Cygwin or Mingw32? - * - * Patch by Anders Norlander - */ -#if defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(NEED_CREATETHREAD) - -/* - * Macro uses args so we can cast start_proc to LPTHREAD_START_ROUTINE - * in order to avoid warnings because of return type - */ - -#define _beginthreadex(security, \ - stack_size, \ - start_proc, \ - arg, \ - flags, \ - pid) \ - CreateThread(security, \ - stack_size, \ - (LPTHREAD_START_ROUTINE) start_proc, \ - arg, \ - flags, \ - pid) - -#define _endthreadex ExitThread - -#endif /* __CYGWIN32__ || __CYGWIN__ || NEED_CREATETHREAD */ - - -#endif /* _IMPLEMENT_H */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/misc.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/misc.c deleted file mode 100644 index 06d1d21374e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/misc.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * misc.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#include "pthread_kill.c" -#include "pthread_once.c" -#include "pthread_self.c" -#include "pthread_equal.c" -#include "pthread_setconcurrency.c" -#include "pthread_getconcurrency.c" -#include "ptw32_new.c" -#include "ptw32_calloc.c" -#include "ptw32_reuse.c" -#include "w32_CancelableWait.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/mutex.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/mutex.c deleted file mode 100644 index 2e60dabe4ca..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/mutex.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * mutex.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _UWIN -# include -#endif -#ifndef NEED_FTIME -#include -#endif -#include "pthread.h" -#include "implement.h" - - -#include "ptw32_mutex_check_need_init.c" -#include "pthread_mutex_init.c" -#include "pthread_mutex_destroy.c" -#include "pthread_mutexattr_init.c" -#include "pthread_mutexattr_destroy.c" -#include "pthread_mutexattr_getpshared.c" -#include "pthread_mutexattr_setpshared.c" -#include "pthread_mutexattr_settype.c" -#include "pthread_mutexattr_gettype.c" -#include "pthread_mutex_lock.c" -#include "pthread_mutex_timedlock.c" -#include "pthread_mutex_unlock.c" -#include "pthread_mutex_trylock.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/need_errno.h b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/need_errno.h deleted file mode 100644 index 2609f8d6b2b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/need_errno.h +++ /dev/null @@ -1,132 +0,0 @@ -/*** -* errno.h - system wide error numbers (set by system calls) -* -* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. -* -* Purpose: -* This file defines the system-wide error numbers (set by -* system calls). Conforms to the XENIX standard. Extended -* for compatibility with Uniforum standard. -* [System V] -* -* [Public] -* -****/ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifndef _INC_ERRNO -#define _INC_ERRNO - -#if !defined(_WIN32) && !defined(_MAC) -#error ERROR: Only Mac or Win32 targets supported! -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - - -/* Define _CRTIMP */ - -#ifndef _CRTIMP -#ifdef _DLL -#define _CRTIMP __declspec(dllimport) -#else /* ndef _DLL */ -#define _CRTIMP -#endif /* _DLL */ -#endif /* _CRTIMP */ - - -/* Define __cdecl for non-Microsoft compilers */ - -#if ( !defined(_MSC_VER) && !defined(__cdecl) ) -#define __cdecl -#endif - -/* Define _CRTAPI1 (for compatibility with the NT SDK) */ - -#ifndef _CRTAPI1 -#if _MSC_VER >= 800 && _M_IX86 >= 300 -#define _CRTAPI1 __cdecl -#else -#define _CRTAPI1 -#endif -#endif - - -/* declare reference to errno */ - -#if (defined(_MT) || defined(_MD) || defined(_DLL)) && !defined(_MAC) -_CRTIMP extern int * __cdecl _errno(void); -#define errno (*_errno()) -#else /* ndef _MT && ndef _MD && ndef _DLL */ -_CRTIMP extern int errno; -#endif /* _MT || _MD || _DLL */ - -/* Error Codes */ - -#define EPERM 1 -#define ENOENT 2 -#define ESRCH 3 -#define EINTR 4 -#define EIO 5 -#define ENXIO 6 -#define E2BIG 7 -#define ENOEXEC 8 -#define EBADF 9 -#define ECHILD 10 -#define EAGAIN 11 -#define ENOMEM 12 -#define EACCES 13 -#define EFAULT 14 -#define EBUSY 16 -#define EEXIST 17 -#define EXDEV 18 -#define ENODEV 19 -#define ENOTDIR 20 -#define EISDIR 21 -#define EINVAL 22 -#define ENFILE 23 -#define EMFILE 24 -#define ENOTTY 25 -#define EFBIG 27 -#define ENOSPC 28 -#define ESPIPE 29 -#define EROFS 30 -#define EMLINK 31 -#define EPIPE 32 -#define EDOM 33 -#define ERANGE 34 -#define EDEADLK 36 - -/* defined differently in winsock.h on WinCE */ -#ifndef ENAMETOOLONG -#define ENAMETOOLONG 38 -#endif - -#define ENOLCK 39 -#define ENOSYS 40 - -/* defined differently in winsock.h on WinCE */ -#ifndef ENOTEMPTY -#define ENOTEMPTY 41 -#endif - -#define EILSEQ 42 - -/* - * Support EDEADLOCK for compatibiity with older MS-C versions. - */ -#define EDEADLOCK EDEADLK - -#ifdef __cplusplus -} -#endif - -#endif /* _INC_ERRNO */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/nonportable.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/nonportable.c deleted file mode 100644 index 6c2a990aa70..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/nonportable.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * nonportable.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -#include "pthread_mutexattr_setkind_np.c" -#include "pthread_mutexattr_getkind_np.c" -#include "pthread_getw32threadhandle_np.c" -#include "pthread_delay_np.c" -#include "pthread_num_processors_np.c" -#include "pthread_win32_attach_detach_np.c" -#include "pthread_timechange_handler_np.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/private.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/private.c deleted file mode 100644 index 7e311b10eae..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/private.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * private.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* Must be first to define HAVE_INLINABLE_INTERLOCKED_CMPXCHG */ -#include "ptw32_InterlockedCompareExchange.c" - -#include "ptw32_MCS_lock.c" -#include "ptw32_is_attr.c" -#include "ptw32_processInitialize.c" -#include "ptw32_processTerminate.c" -#include "ptw32_threadStart.c" -#include "ptw32_threadDestroy.c" -#include "ptw32_tkAssocCreate.c" -#include "ptw32_tkAssocDestroy.c" -#include "ptw32_callUserDestroyRoutines.c" -#include "ptw32_semwait.c" -#include "ptw32_timespec.c" -#include "ptw32_relmillisecs.c" -#include "ptw32_throw.c" -#include "ptw32_getprocessors.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.c deleted file mode 100644 index 1642a5e8f47..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * pthread.c - * - * Description: - * This translation unit agregates pthreads-win32 translation units. - * It is used for inline optimisation of the library, - * maximising for speed at the expense of size. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#pragma warning(push) -#pragma warning(disable: 4311) -#pragma warning(disable: 4312) -#pragma warning(disable: 4244) -#pragma warning(disable: 4267) - - -#include "pthread.h" -#include "implement.h" - -/* The following are ordered for inlining */ - -#include "private.c" -#include "attr.c" -#include "barrier.c" -#include "cancel.c" -#include "cleanup.c" -#include "condvar.c" -#include "create.c" -#include "dll.c" -#include "errno.c" -#include "exit.c" -#include "fork.c" -#include "global.c" -#include "misc.c" -#include "mutex.c" -#include "nonportable.c" -#include "rwlock.c" -#include "sched.c" -#include "semaphore.c" -#include "signal.c" -#include "spin.c" -#include "sync.c" -#include "tsd.c" - -#pragma warning(pop) \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.dsp b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.dsp deleted file mode 100644 index 112bff72a5a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.dsp +++ /dev/null @@ -1,142 +0,0 @@ -# Microsoft Developer Studio Project File - Name="pthread" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=pthread - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "pthread.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "pthread.mak" CFG="pthread - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "pthread - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "pthread - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "pthread - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "." -# PROP Intermediate_Dir "." -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PTW32_BUILD" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "__CLEANUP_C" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PTW32_BUILD" /YX /FD /c -# SUBTRACT CPP /u -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x409 /i "." /d "NDEBUG" /d "PTW32_RC_MSC" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib ws2_32.lib /nologo /dll /pdb:none /machine:I386 /out:".\pthreadVC2.dll" - -!ELSEIF "$(CFG)" == "pthread - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "." -# PROP Intermediate_Dir "." -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PTW32_BUILD" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "__CLEANUP_C" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PTW32_BUILD" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x409 /i "." /d "_DEBUG" /d "PTW32_RC_MSC" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib ws2_32.lib /nologo /dll /map /debug /machine:I386 /out:".\pthreadVC2.dll" /pdbtype:sept -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "pthread - Win32 Release" -# Name "pthread - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\pthread.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\implement.h -# End Source File -# Begin Source File - -SOURCE=.\pthread.h -# End Source File -# Begin Source File - -SOURCE=.\sched.h -# End Source File -# Begin Source File - -SOURCE=.\semaphore.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=.\version.rc - -!IF "$(CFG)" == "pthread - Win32 Release" - -# ADD BASE RSC /l 0xc09 -# ADD RSC /l 0x409 /i "." /d "PTW32_RC_MSC" - -!ELSEIF "$(CFG)" == "pthread - Win32 Debug" - -# ADD BASE RSC /l 0xc09 -# ADD RSC /l 0x409 /i "." /d "PTW32_RC_MSC" - -!ENDIF - -# End Source File -# End Group -# End Target -# End Project diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.dsw b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.dsw deleted file mode 100644 index 815a678728e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "pthread"=.\pthread.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.h b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.h deleted file mode 100644 index f3d2dac9666..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread.h +++ /dev/null @@ -1,1368 +0,0 @@ -/* This is an implementation of the threads API of POSIX 1003.1-2001. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#if !defined( PTHREAD_H ) -#define PTHREAD_H - -/* - * See the README file for an explanation of the pthreads-win32 version - * numbering scheme and how the DLL is named etc. - */ -#define PTW32_VERSION 2,8,0,0 -#define PTW32_VERSION_STRING "2, 8, 0, 0\0" - -/* There are three implementations of cancel cleanup. - * Note that pthread.h is included in both application - * compilation units and also internally for the library. - * The code here and within the library aims to work - * for all reasonable combinations of environments. - * - * The three implementations are: - * - * WIN32 SEH - * C - * C++ - * - * Please note that exiting a push/pop block via - * "return", "exit", "break", or "continue" will - * lead to different behaviour amongst applications - * depending upon whether the library was built - * using SEH, C++, or C. For example, a library built - * with SEH will call the cleanup routine, while both - * C++ and C built versions will not. - */ - -/* - * Define defaults for cleanup code. - * Note: Unless the build explicitly defines one of the following, then - * we default to standard C style cleanup. This style uses setjmp/longjmp - * in the cancelation and thread exit implementations and therefore won't - * do stack unwinding if linked to applications that have it (e.g. - * C++ apps). This is currently consistent with most/all commercial Unix - * POSIX threads implementations. - */ -#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) -# define __CLEANUP_C -#endif - -#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC)) -#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler. -#endif - -/* - * Stop here if we are being included by the resource compiler. - */ -#ifndef RC_INVOKED - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#ifdef _UWIN -# define HAVE_STRUCT_TIMESPEC 1 -# define HAVE_SIGNAL_H 1 -# undef HAVE_CONFIG_H -# pragma comment(lib, "pthread") -#endif - -/* - * ------------------------------------------------------------- - * - * - * Module: pthread.h - * - * Purpose: - * Provides an implementation of PThreads based upon the - * standard: - * - * POSIX 1003.1-2001 - * and - * The Single Unix Specification version 3 - * - * (these two are equivalent) - * - * in order to enhance code portability between Windows, - * various commercial Unix implementations, and Linux. - * - * See the ANNOUNCE file for a full list of conforming - * routines and defined constants, and a list of missing - * routines and constants not defined in this implementation. - * - * Authors: - * There have been many contributors to this library. - * The initial implementation was contributed by - * John Bossom, and several others have provided major - * sections or revisions of parts of the implementation. - * Often significant effort has been contributed to - * find and fix important bugs and other problems to - * improve the reliability of the library, which sometimes - * is not reflected in the amount of code which changed as - * result. - * As much as possible, the contributors are acknowledged - * in the ChangeLog file in the source code distribution - * where their changes are noted in detail. - * - * Contributors are listed in the CONTRIBUTORS file. - * - * As usual, all bouquets go to the contributors, and all - * brickbats go to the project maintainer. - * - * Maintainer: - * The code base for this project is coordinated and - * eventually pre-tested, packaged, and made available by - * - * Ross Johnson - * - * QA Testers: - * Ultimately, the library is tested in the real world by - * a host of competent and demanding scientists and - * engineers who report bugs and/or provide solutions - * which are then fixed or incorporated into subsequent - * versions of the library. Each time a bug is fixed, a - * test case is written to prove the fix and ensure - * that later changes to the code don't reintroduce the - * same error. The number of test cases is slowly growing - * and therefore so is the code reliability. - * - * Compliance: - * See the file ANNOUNCE for the list of implemented - * and not-implemented routines and defined options. - * Of course, these are all defined is this file as well. - * - * Web site: - * The source code and other information about this library - * are available from - * - * http://sources.redhat.com/pthreads-win32/ - * - * ------------------------------------------------------------- - */ - -/* Try to avoid including windows.h */ -#if defined(__MINGW32__) && defined(__cplusplus) -#define PTW32_INCLUDE_WINDOWS_H -#endif - -#ifdef PTW32_INCLUDE_WINDOWS_H -#include -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) -/* - * VC++6.0 or early compiler's header has no DWORD_PTR type. - */ -typedef unsigned long DWORD_PTR; -#endif -/* - * ----------------- - * autoconf switches - * ----------------- - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#ifndef NEED_FTIME -#include -#else /* NEED_FTIME */ -/* use native WIN32 time API */ -#endif /* NEED_FTIME */ - -#if HAVE_SIGNAL_H -#include -#endif /* HAVE_SIGNAL_H */ - -#include -#include - -/* - * Boolean values to make us independent of system includes. - */ -enum { - PTW32_FALSE = 0, - PTW32_TRUE = (! PTW32_FALSE) -}; - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Several systems don't define some error numbers. - */ -#ifndef ENOTSUP -# define ENOTSUP 48 /* This is the value in Solaris. */ -#endif - -#ifndef ETIMEDOUT -# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ -#endif - -#ifndef ENOSYS -# define ENOSYS 140 /* Semi-arbitrary value */ -#endif - -#ifndef EDEADLK -# ifdef EDEADLOCK -# define EDEADLK EDEADLOCK -# else -# define EDEADLK 36 /* This is the value in MSVC. */ -# endif -#endif - -#include - -/* - * To avoid including windows.h we define only those things that we - * actually need from it. - */ -#ifndef PTW32_INCLUDE_WINDOWS_H -#ifndef HANDLE -# define PTW32__HANDLE_DEF -# define HANDLE void * -#endif -#ifndef DWORD -# define PTW32__DWORD_DEF -# define DWORD unsigned long -#endif -#endif - -#ifndef HAVE_STRUCT_TIMESPEC -#define HAVE_STRUCT_TIMESPEC 1 -struct timespec { - long tv_sec; - long tv_nsec; -}; -#endif /* HAVE_STRUCT_TIMESPEC */ - -#ifndef SIG_BLOCK -#define SIG_BLOCK 0 -#endif /* SIG_BLOCK */ - -#ifndef SIG_UNBLOCK -#define SIG_UNBLOCK 1 -#endif /* SIG_UNBLOCK */ - -#ifndef SIG_SETMASK -#define SIG_SETMASK 2 -#endif /* SIG_SETMASK */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* - * ------------------------------------------------------------- - * - * POSIX 1003.1-2001 Options - * ========================= - * - * Options are normally set in , which is not provided - * with pthreads-win32. - * - * For conformance with the Single Unix Specification (version 3), all of the - * options below are defined, and have a value of either -1 (not supported) - * or 200112L (supported). - * - * These options can neither be left undefined nor have a value of 0, because - * either indicates that sysconf(), which is not implemented, may be used at - * runtime to check the status of the option. - * - * _POSIX_THREADS (== 200112L) - * If == 200112L, you can use threads - * - * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L) - * If == 200112L, you can control the size of a thread's - * stack - * pthread_attr_getstacksize - * pthread_attr_setstacksize - * - * _POSIX_THREAD_ATTR_STACKADDR (== -1) - * If == 200112L, you can allocate and control a thread's - * stack. If not supported, the following functions - * will return ENOSYS, indicating they are not - * supported: - * pthread_attr_getstackaddr - * pthread_attr_setstackaddr - * - * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1) - * If == 200112L, you can use realtime scheduling. - * This option indicates that the behaviour of some - * implemented functions conforms to the additional TPS - * requirements in the standard. E.g. rwlocks favour - * writers over readers when threads have equal priority. - * - * _POSIX_THREAD_PRIO_INHERIT (== -1) - * If == 200112L, you can create priority inheritance - * mutexes. - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PRIO_PROTECT (== -1) - * If == 200112L, you can create priority ceiling mutexes - * Indicates the availability of: - * pthread_mutex_getprioceiling - * pthread_mutex_setprioceiling - * pthread_mutexattr_getprioceiling - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprioceiling - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PROCESS_SHARED (== -1) - * If set, you can create mutexes and condition - * variables that can be shared with another - * process.If set, indicates the availability - * of: - * pthread_mutexattr_getpshared - * pthread_mutexattr_setpshared - * pthread_condattr_getpshared - * pthread_condattr_setpshared - * - * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L) - * If == 200112L you can use the special *_r library - * functions that provide thread-safe behaviour - * - * _POSIX_READER_WRITER_LOCKS (== 200112L) - * If == 200112L, you can use read/write locks - * - * _POSIX_SPIN_LOCKS (== 200112L) - * If == 200112L, you can use spin locks - * - * _POSIX_BARRIERS (== 200112L) - * If == 200112L, you can use barriers - * - * + These functions provide both 'inherit' and/or - * 'protect' protocol, based upon these macro - * settings. - * - * ------------------------------------------------------------- - */ - -/* - * POSIX Options - */ -#undef _POSIX_THREADS -#define _POSIX_THREADS 200112L - -#undef _POSIX_READER_WRITER_LOCKS -#define _POSIX_READER_WRITER_LOCKS 200112L - -#undef _POSIX_SPIN_LOCKS -#define _POSIX_SPIN_LOCKS 200112L - -#undef _POSIX_BARRIERS -#define _POSIX_BARRIERS 200112L - -#undef _POSIX_THREAD_SAFE_FUNCTIONS -#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L - -#undef _POSIX_THREAD_ATTR_STACKSIZE -#define _POSIX_THREAD_ATTR_STACKSIZE 200112L - -/* - * The following options are not supported - */ -#undef _POSIX_THREAD_ATTR_STACKADDR -#define _POSIX_THREAD_ATTR_STACKADDR -1 - -#undef _POSIX_THREAD_PRIO_INHERIT -#define _POSIX_THREAD_PRIO_INHERIT -1 - -#undef _POSIX_THREAD_PRIO_PROTECT -#define _POSIX_THREAD_PRIO_PROTECT -1 - -/* TPS is not fully supported. */ -#undef _POSIX_THREAD_PRIORITY_SCHEDULING -#define _POSIX_THREAD_PRIORITY_SCHEDULING -1 - -#undef _POSIX_THREAD_PROCESS_SHARED -#define _POSIX_THREAD_PROCESS_SHARED -1 - - -/* - * POSIX 1003.1-2001 Limits - * =========================== - * - * These limits are normally set in , which is not provided with - * pthreads-win32. - * - * PTHREAD_DESTRUCTOR_ITERATIONS - * Maximum number of attempts to destroy - * a thread's thread-specific data on - * termination (must be at least 4) - * - * PTHREAD_KEYS_MAX - * Maximum number of thread-specific data keys - * available per process (must be at least 128) - * - * PTHREAD_STACK_MIN - * Minimum supported stack size for a thread - * - * PTHREAD_THREADS_MAX - * Maximum number of threads supported per - * process (must be at least 64). - * - * SEM_NSEMS_MAX - * The maximum number of semaphores a process can have. - * (must be at least 256) - * - * SEM_VALUE_MAX - * The maximum value a semaphore can have. - * (must be at least 32767) - * - */ -#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 - -#undef PTHREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -#undef _POSIX_THREAD_KEYS_MAX -#define _POSIX_THREAD_KEYS_MAX 128 - -#undef PTHREAD_KEYS_MAX -#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX - -#undef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 0 - -#undef _POSIX_THREAD_THREADS_MAX -#define _POSIX_THREAD_THREADS_MAX 64 - - /* Arbitrary value */ -#undef PTHREAD_THREADS_MAX -#define PTHREAD_THREADS_MAX 2019 - -#undef _POSIX_SEM_NSEMS_MAX -#define _POSIX_SEM_NSEMS_MAX 256 - - /* Arbitrary value */ -#undef SEM_NSEMS_MAX -#define SEM_NSEMS_MAX 1024 - -#undef _POSIX_SEM_VALUE_MAX -#define _POSIX_SEM_VALUE_MAX 32767 - -#undef SEM_VALUE_MAX -#define SEM_VALUE_MAX INT_MAX - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * The Open Watcom C/C++ compiler uses a non-standard calling convention - * that passes function args in registers unless __cdecl is explicitly specified - * in exposed function prototypes. - * - * We force all calls to cdecl even though this could slow Watcom code down - * slightly. If you know that the Watcom compiler will be used to build both - * the DLL and application, then you can probably define this as a null string. - * Remember that pthread.h (this file) is used for both the DLL and application builds. - */ -#define PTW32_CDECL __cdecl - -#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX -# include -#else -/* - * Generic handle type - intended to extend uniqueness beyond - * that available with a simple pointer. It should scale for either - * IA-32 or IA-64. - */ -typedef struct { - void * p; /* Pointer to actual object */ - unsigned int x; /* Extra information - reuse count etc */ -} ptw32_handle_t; - -typedef ptw32_handle_t pthread_t; -typedef struct pthread_attr_t_ * pthread_attr_t; -typedef struct pthread_once_t_ pthread_once_t; -typedef struct pthread_key_t_ * pthread_key_t; -typedef struct pthread_mutex_t_ * pthread_mutex_t; -typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t; -typedef struct pthread_cond_t_ * pthread_cond_t; -typedef struct pthread_condattr_t_ * pthread_condattr_t; -#endif -typedef struct pthread_rwlock_t_ * pthread_rwlock_t; -typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t; -typedef struct pthread_spinlock_t_ * pthread_spinlock_t; -typedef struct pthread_barrier_t_ * pthread_barrier_t; -typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t; - -/* - * ==================== - * ==================== - * POSIX Threads - * ==================== - * ==================== - */ - -enum { -/* - * pthread_attr_{get,set}detachstate - */ - PTHREAD_CREATE_JOINABLE = 0, /* Default */ - PTHREAD_CREATE_DETACHED = 1, - -/* - * pthread_attr_{get,set}inheritsched - */ - PTHREAD_INHERIT_SCHED = 0, - PTHREAD_EXPLICIT_SCHED = 1, /* Default */ - -/* - * pthread_{get,set}scope - */ - PTHREAD_SCOPE_PROCESS = 0, - PTHREAD_SCOPE_SYSTEM = 1, /* Default */ - -/* - * pthread_setcancelstate paramters - */ - PTHREAD_CANCEL_ENABLE = 0, /* Default */ - PTHREAD_CANCEL_DISABLE = 1, - -/* - * pthread_setcanceltype parameters - */ - PTHREAD_CANCEL_ASYNCHRONOUS = 0, - PTHREAD_CANCEL_DEFERRED = 1, /* Default */ - -/* - * pthread_mutexattr_{get,set}pshared - * pthread_condattr_{get,set}pshared - */ - PTHREAD_PROCESS_PRIVATE = 0, - PTHREAD_PROCESS_SHARED = 1, - -/* - * pthread_barrier_wait - */ - PTHREAD_BARRIER_SERIAL_THREAD = -1 -}; - -/* - * ==================== - * ==================== - * Cancelation - * ==================== - * ==================== - */ -#define PTHREAD_CANCELED ((void *) -1) - - -/* - * ==================== - * ==================== - * Once Key - * ==================== - * ==================== - */ -#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0} - -struct pthread_once_t_ -{ - int done; /* indicates if user function has been executed */ - void * lock; - int reserved1; - int reserved2; -}; - - -/* - * ==================== - * ==================== - * Object initialisers - * ==================== - * ==================== - */ -#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1) -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2) -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3) - -/* - * Compatibility with LinuxThreads - */ -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER - -#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1) - -#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1) - -#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1) - - -/* - * Mutex types. - */ -enum -{ - /* Compatibility with LinuxThreads */ - PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, - /* For compatibility with POSIX */ - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL -}; - - -typedef struct ptw32_cleanup_t ptw32_cleanup_t; - -#if defined(_MSC_VER) -/* Disable MSVC 'anachronism used' warning */ -#pragma warning( disable : 4229 ) -#endif - -typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *); - -#if defined(_MSC_VER) -#pragma warning( default : 4229 ) -#endif - -struct ptw32_cleanup_t -{ - ptw32_cleanup_callback_t routine; - void *arg; - struct ptw32_cleanup_t *prev; -}; - -#ifdef __CLEANUP_SEH - /* - * WIN32 SEH version of cancel cleanup. - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ - _cleanup.arg = (_arg); \ - __try \ - { \ - -#define pthread_cleanup_pop( _execute ) \ - } \ - __finally \ - { \ - if( _execute || AbnormalTermination()) \ - { \ - (*(_cleanup.routine))( _cleanup.arg ); \ - } \ - } \ - } - -#else /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_C - - /* - * C implementation of PThreads cancel cleanup - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ - -#define pthread_cleanup_pop( _execute ) \ - (void) ptw32_pop_cleanup( _execute ); \ - } - -#else /* __CLEANUP_C */ - -#ifdef __CLEANUP_CXX - - /* - * C++ version of cancel cleanup. - * - John E. Bossom. - */ - - class PThreadCleanup { - /* - * PThreadCleanup - * - * Purpose - * This class is a C++ helper class that is - * used to implement pthread_cleanup_push/ - * pthread_cleanup_pop. - * The destructor of this class automatically - * pops the pushed cleanup routine regardless - * of how the code exits the scope - * (i.e. such as by an exception) - */ - ptw32_cleanup_callback_t cleanUpRout; - void * obj; - int executeIt; - - public: - PThreadCleanup() : - cleanUpRout( 0 ), - obj( 0 ), - executeIt( 0 ) - /* - * No cleanup performed - */ - { - } - - PThreadCleanup( - ptw32_cleanup_callback_t routine, - void * arg ) : - cleanUpRout( routine ), - obj( arg ), - executeIt( 1 ) - /* - * Registers a cleanup routine for 'arg' - */ - { - } - - ~PThreadCleanup() - { - if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) - { - (void) (*cleanUpRout)( obj ); - } - } - - void execute( int exec ) - { - executeIt = exec; - } - }; - - /* - * C++ implementation of PThreads cancel cleanup; - * This implementation takes advantage of a helper - * class who's destructor automatically calls the - * cleanup routine if we exit our scope weirdly - */ -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ - (void *) (_arg) ); - -#define pthread_cleanup_pop( _execute ) \ - cleanup.execute( _execute ); \ - } - -#else - -#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. - -#endif /* __CLEANUP_CXX */ - -#endif /* __CLEANUP_C */ - -#endif /* __CLEANUP_SEH */ - -/* - * =============== - * =============== - * Methods - * =============== - * =============== - */ - -/* - * PThread Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr, - int *detachstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr, - void **stackaddr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr, - size_t * stacksize); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr, - int detachstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr, - void *stackaddr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr, - size_t stacksize); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr, - struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr, - const struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *, - int); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *, - int *); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr, - int inheritsched); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr, - int * inheritsched); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *, - int); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *, - int *); - -/* - * PThread Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid, - const pthread_attr_t * attr, - void *(*start) (void *), - void *arg); - -PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid); - -PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1, - pthread_t t2); - -PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr); - -PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread, - void **value_ptr); - -PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void); - -PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread); - -PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state, - int *oldstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type, - int *oldtype); - -PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void); - -PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control, - void (*init_routine) (void)); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute); - -PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup, - void (*routine) (void *), - void *arg); -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread Specific Data Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key, - void (*destructor) (void *)); - -PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key); - -PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key, - const void *value); - -PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key); - - -/* - * Mutex Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, - int pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind); - -/* - * Barrier Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, - int pshared); - -/* - * Mutex Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex, - const pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex); - -/* - * Spinlock Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock); - -/* - * Barrier Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier, - const pthread_barrierattr_t * attr, - unsigned int count); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier); - -/* - * Condition Variable Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr, - int pshared); - -/* - * Condition Variable Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond, - const pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond, - pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond); - -/* - * Scheduling - */ -PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread, - int policy, - const struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread, - int *policy, - struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int); - -PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void); - -/* - * Read-Write Lock Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock, - const pthread_rwlockattr_t *attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, - int pshared); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 - -/* - * Signal Functions. Should be defined in but MSVC and MinGW32 - * already have signal.h that don't define these. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig); - -/* - * Non-portable functions - */ - -/* - * Compatibility with Linux. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, - int kind); -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, - int *kind); - -/* - * Possibly supported by other POSIX threads implementations - */ -PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval); -PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void); - -/* - * Useful if an application wants to statically link - * the lib rather than load the DLL at run-time. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void); - -/* - * Features that are auto-detected at load/run time. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int); -enum ptw32_features { - PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */ - PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */ -}; - -/* - * Register a system time change with the library. - * Causes the library to perform various functions - * in response to the change. Should be called whenever - * the application's top level window receives a - * WM_TIMECHANGE message. It can be passed directly to - * pthread_create() as a new thread if desired. - */ -PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); - -#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* - * Returns the Win32 HANDLE for the POSIX thread. - */ -PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); - - -/* - * Protected Methods - * - * This function blocks until the given WIN32 handle - * is signaled or pthread_cancel had been called. - * This function allows the caller to hook into the - * PThreads cancel mechanism. It is implemented using - * - * WaitForMultipleObjects - * - * on 'waitHandle' and a manually reset WIN32 Event - * used to implement pthread_cancel. The 'timeout' - * argument to TimedWait is simply passed to - * WaitForMultipleObjects. - */ -PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle); -PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle, - DWORD timeout); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread-Safe C Runtime Library Mappings. - */ -#ifndef _UWIN -# if defined(NEED_ERRNO) - PTW32_DLLPORT int * PTW32_CDECL _errno( void ); -# else -# ifndef errno -# if (defined(_MT) || defined(_DLL)) - __declspec(dllimport) extern int * __cdecl _errno(void); -# define errno (*_errno()) -# endif -# endif -# endif -#endif - -/* - * WIN32 C runtime library had been made thread-safe - * without affecting the user interface. Provide - * mappings from the UNIX thread-safe versions to - * the standard C runtime library calls. - * Only provide function mappings for functions that - * actually exist on WIN32. - */ - -#if !defined(__MINGW32__) -#define strtok_r( _s, _sep, _lasts ) \ - ( *(_lasts) = strtok( (_s), (_sep) ) ) -#endif /* !__MINGW32__ */ - -#define asctime_r( _tm, _buf ) \ - ( strcpy( (_buf), asctime( (_tm) ) ), \ - (_buf) ) - -#define ctime_r( _clock, _buf ) \ - ( strcpy( (_buf), ctime( (_clock) ) ), \ - (_buf) ) - -#define gmtime_r( _clock, _result ) \ - ( *(_result) = *gmtime( (_clock) ), \ - (_result) ) - -#define localtime_r( _clock, _result ) \ - ( *(_result) = *localtime( (_clock) ), \ - (_result) ) - -#define rand_r( _seed ) \ - ( _seed == _seed? rand() : rand() ) - - -/* - * Some compiler environments don't define some things. - */ -#if defined(__BORLANDC__) -# define _ftime ftime -# define _timeb timeb -#endif - -#ifdef __cplusplus - -/* - * Internal exceptions - */ -class ptw32_exception {}; -class ptw32_exception_cancel : public ptw32_exception {}; -class ptw32_exception_exit : public ptw32_exception {}; - -#endif - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* FIXME: This is only required if the library was built using SEH */ -/* - * Get internal SEH tag - */ -PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#ifndef PTW32_BUILD - -#ifdef __CLEANUP_SEH - -/* - * Redefine the SEH __except keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#define __except( E ) \ - __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ - ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) - -#endif /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_CXX - -/* - * Redefine the C++ catch keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#ifdef _MSC_VER - /* - * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' - * if you want Pthread-Win32 cancelation and pthread_exit to work. - */ - -#ifndef PtW32NoCatchWarn - -#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") -#pragma message("------------------------------------------------------------------") -#pragma message("When compiling applications with MSVC++ and C++ exception handling:") -#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") -#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") -#pragma message(" cancelation and pthread_exit to work. For example:") -#pragma message("") -#pragma message(" #ifdef PtW32CatchAll") -#pragma message(" PtW32CatchAll") -#pragma message(" #else") -#pragma message(" catch(...)") -#pragma message(" #endif") -#pragma message(" {") -#pragma message(" /* Catchall block processing */") -#pragma message(" }") -#pragma message("------------------------------------------------------------------") - -#endif - -#define PtW32CatchAll \ - catch( ptw32_exception & ) { throw; } \ - catch( ... ) - -#else /* _MSC_VER */ - -#define catch( E ) \ - catch( ptw32_exception & ) { throw; } \ - catch( E ) - -#endif /* _MSC_VER */ - -#endif /* __CLEANUP_CXX */ - -#endif /* ! PTW32_BUILD */ - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#ifdef PTW32__HANDLE_DEF -# undef HANDLE -#endif -#ifdef PTW32__DWORD_DEF -# undef DWORD -#endif - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* ! RC_INVOKED */ - -#endif /* PTHREAD_H */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthreadVC2.dll.manifest b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthreadVC2.dll.manifest deleted file mode 100644 index 307b6c2a01d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthreadVC2.dll.manifest +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthreadVCE2.dll.manifest b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthreadVCE2.dll.manifest deleted file mode 100644 index 307b6c2a01d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthreadVCE2.dll.manifest +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_destroy.c deleted file mode 100644 index 8b3e04c536d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_destroy.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * pthread_attr_destroy.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_attr_destroy (pthread_attr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Destroys a thread attributes object. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * - * DESCRIPTION - * Destroys a thread attributes object. - * - * NOTES: - * 1) Does not affect threads created with 'attr'. - * - * RESULTS - * 0 successfully destroyed attr, - * EINVAL 'attr' is invalid. - * - * ------------------------------------------------------ - */ -{ - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - /* - * Set the attribute object to a specific invalid value. - */ - (*attr)->valid = 0; - free (*attr); - *attr = NULL; - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getdetachstate.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getdetachstate.c deleted file mode 100644 index 978f2884949..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getdetachstate.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * pthread_attr_getdetachstate.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_attr_getdetachstate (const pthread_attr_t * attr, int *detachstate) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function determines whether threads created with - * 'attr' will run detached. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * detachstate - * pointer to an integer into which is returned one - * of: - * - * PTHREAD_CREATE_JOINABLE - * Thread ID is valid, must be joined - * - * PTHREAD_CREATE_DETACHED - * Thread ID is invalid, cannot be joined, - * canceled, or modified - * - * - * DESCRIPTION - * This function determines whether threads created with - * 'attr' will run detached. - * - * NOTES: - * 1) You cannot join or cancel detached threads. - * - * RESULTS - * 0 successfully retrieved detach state, - * EINVAL 'attr' is invalid - * - * ------------------------------------------------------ - */ -{ - if (ptw32_is_attr (attr) != 0 || detachstate == NULL) - { - *detachstate = PTHREAD_CREATE_DETACHED; - return EINVAL; - } - - *detachstate = (*attr)->detachstate; - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getinheritsched.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getinheritsched.c deleted file mode 100644 index 5085077a66c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getinheritsched.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * pthread_attr_getinheritsched.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_attr_getinheritsched (pthread_attr_t * attr, int *inheritsched) -{ - if (ptw32_is_attr (attr) != 0 || inheritsched == NULL) - { - return EINVAL; - } - - *inheritsched = (*attr)->inheritsched; - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getschedparam.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getschedparam.c deleted file mode 100644 index ab89b2241a1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getschedparam.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * pthread_attr_getschedparam.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_attr_getschedparam (const pthread_attr_t * attr, - struct sched_param *param) -{ - if (ptw32_is_attr (attr) != 0 || param == NULL) - { - return EINVAL; - } - - memcpy (param, &(*attr)->param, sizeof (*param)); - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getschedpolicy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getschedpolicy.c deleted file mode 100644 index 04adbd5c64c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getschedpolicy.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * pthread_attr_getschedpolicy.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_attr_getschedpolicy (pthread_attr_t * attr, int *policy) -{ - if (ptw32_is_attr (attr) != 0 || policy == NULL) - { - return EINVAL; - } - - /* - * Validate the policy arg. - * Check that a policy constant wasn't passed rather than &policy. - */ - if (policy <= (int *) SCHED_MAX) - { - return EINVAL; - } - - *policy = SCHED_OTHER; - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getscope.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getscope.c deleted file mode 100644 index 3c863821ed2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getscope.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * pthread_attr_getscope.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -pthread_attr_getscope (const pthread_attr_t * attr, int *contentionscope) -{ -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - *contentionscope = (*attr)->contentionscope; - return 0; -#else - return ENOSYS; -#endif -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getstackaddr.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getstackaddr.c deleted file mode 100644 index 9b5595928b0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getstackaddr.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * pthread_attr_getstackaddr.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -pthread_attr_getstackaddr (const pthread_attr_t * attr, void **stackaddr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function determines the address of the stack - * on which threads created with 'attr' will run. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * stackaddr - * pointer into which is returned the stack address. - * - * - * DESCRIPTION - * This function determines the address of the stack - * on which threads created with 'attr' will run. - * - * NOTES: - * 1) Function supported only if this macro is - * defined: - * - * _POSIX_THREAD_ATTR_STACKADDR - * - * 2) Create only one thread for each stack - * address.. - * - * RESULTS - * 0 successfully retreived stack address, - * EINVAL 'attr' is invalid - * ENOSYS function not supported - * - * ------------------------------------------------------ - */ -{ -#if defined( _POSIX_THREAD_ATTR_STACKADDR ) - - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - *stackaddr = (*attr)->stackaddr; - return 0; - -#else - - return ENOSYS; - -#endif /* _POSIX_THREAD_ATTR_STACKADDR */ -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getstacksize.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getstacksize.c deleted file mode 100644 index da8db636c83..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_getstacksize.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * pthread_attr_getstacksize.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -pthread_attr_getstacksize (const pthread_attr_t * attr, size_t * stacksize) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function determines the size of the stack on - * which threads created with 'attr' will run. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * stacksize - * pointer to size_t into which is returned the - * stack size, in bytes. - * - * - * DESCRIPTION - * This function determines the size of the stack on - * which threads created with 'attr' will run. - * - * NOTES: - * 1) Function supported only if this macro is - * defined: - * - * _POSIX_THREAD_ATTR_STACKSIZE - * - * 2) Use on newly created attributes object to - * find the default stack size. - * - * RESULTS - * 0 successfully retrieved stack size, - * EINVAL 'attr' is invalid - * ENOSYS function not supported - * - * ------------------------------------------------------ - */ -{ -#ifdef _POSIX_THREAD_ATTR_STACKSIZE - - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - /* Everything is okay. */ - *stacksize = (*attr)->stacksize; - return 0; - -#else - - return ENOSYS; - -#endif /* _POSIX_THREAD_ATTR_STACKSIZE */ - -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_init.c deleted file mode 100644 index 6c10bd3e7fa..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_init.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * pthread_attr_init.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_attr_init (pthread_attr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Initializes a thread attributes object with default - * attributes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * - * DESCRIPTION - * Initializes a thread attributes object with default - * attributes. - * - * NOTES: - * 1) Used to define thread attributes - * - * RESULTS - * 0 successfully initialized attr, - * ENOMEM insufficient memory for attr. - * - * ------------------------------------------------------ - */ -{ - pthread_attr_t attr_result; - - if (attr == NULL) - { - /* This is disallowed. */ - return EINVAL; - } - - attr_result = (pthread_attr_t) malloc (sizeof (*attr_result)); - - if (attr_result == NULL) - { - return ENOMEM; - } - -#ifdef _POSIX_THREAD_ATTR_STACKSIZE - /* - * Default to zero size. Unless changed explicitly this - * will allow Win32 to set the size to that of the - * main thread. - */ - attr_result->stacksize = 0; -#endif - -#ifdef _POSIX_THREAD_ATTR_STACKADDR - /* FIXME: Set this to something sensible when we support it. */ - attr_result->stackaddr = NULL; -#endif - - attr_result->detachstate = PTHREAD_CREATE_JOINABLE; - -#if HAVE_SIGSET_T - memset (&(attr_result->sigmask), 0, sizeof (sigset_t)); -#endif /* HAVE_SIGSET_T */ - - /* - * Win32 sets new threads to THREAD_PRIORITY_NORMAL and - * not to that of the parent thread. We choose to default to - * this arrangement. - */ - attr_result->param.sched_priority = THREAD_PRIORITY_NORMAL; - attr_result->inheritsched = PTHREAD_EXPLICIT_SCHED; - attr_result->contentionscope = PTHREAD_SCOPE_SYSTEM; - - attr_result->valid = PTW32_ATTR_VALID; - - *attr = attr_result; - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setdetachstate.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setdetachstate.c deleted file mode 100644 index 784642a8070..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setdetachstate.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * pthread_attr_setdetachstate.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_attr_setdetachstate (pthread_attr_t * attr, int detachstate) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function specifies whether threads created with - * 'attr' will run detached. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * detachstate - * an integer containing one of: - * - * PTHREAD_CREATE_JOINABLE - * Thread ID is valid, must be joined - * - * PTHREAD_CREATE_DETACHED - * Thread ID is invalid, cannot be joined, - * canceled, or modified - * - * - * DESCRIPTION - * This function specifies whether threads created with - * 'attr' will run detached. - * - * NOTES: - * 1) You cannot join or cancel detached threads. - * - * RESULTS - * 0 successfully set detach state, - * EINVAL 'attr' or 'detachstate' is invalid - * - * ------------------------------------------------------ - */ -{ - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - if (detachstate != PTHREAD_CREATE_JOINABLE && - detachstate != PTHREAD_CREATE_DETACHED) - { - return EINVAL; - } - - (*attr)->detachstate = detachstate; - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setinheritsched.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setinheritsched.c deleted file mode 100644 index e0a407a3b71..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setinheritsched.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * pthread_attr_setinheritsched.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_attr_setinheritsched (pthread_attr_t * attr, int inheritsched) -{ - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - if (PTHREAD_INHERIT_SCHED != inheritsched - && PTHREAD_EXPLICIT_SCHED != inheritsched) - { - return EINVAL; - } - - (*attr)->inheritsched = inheritsched; - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setschedparam.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setschedparam.c deleted file mode 100644 index f246bfae7af..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setschedparam.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * pthread_attr_setschedparam.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_attr_setschedparam (pthread_attr_t * attr, - const struct sched_param *param) -{ - int priority; - - if (ptw32_is_attr (attr) != 0 || param == NULL) - { - return EINVAL; - } - - priority = param->sched_priority; - - /* Validate priority level. */ - if (priority < sched_get_priority_min (SCHED_OTHER) || - priority > sched_get_priority_max (SCHED_OTHER)) - { - return EINVAL; - } - - memcpy (&(*attr)->param, param, sizeof (*param)); - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setschedpolicy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setschedpolicy.c deleted file mode 100644 index 45ff165973e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setschedpolicy.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * pthread_attr_setschedpolicy.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_attr_setschedpolicy (pthread_attr_t * attr, int policy) -{ - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - if (policy != SCHED_OTHER) - { - return ENOTSUP; - } - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setscope.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setscope.c deleted file mode 100644 index 9cef423b252..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setscope.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * pthread_attr_setscope.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -pthread_attr_setscope (pthread_attr_t * attr, int contentionscope) -{ -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING - switch (contentionscope) - { - case PTHREAD_SCOPE_SYSTEM: - (*attr)->contentionscope = contentionscope; - return 0; - case PTHREAD_SCOPE_PROCESS: - return ENOTSUP; - default: - return EINVAL; - } -#else - return ENOSYS; -#endif -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setstackaddr.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setstackaddr.c deleted file mode 100644 index 96a83209711..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setstackaddr.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * pthread_attr_setstackaddr.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_attr_setstackaddr (pthread_attr_t * attr, void *stackaddr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Threads created with 'attr' will run on the stack - * starting at 'stackaddr'. - * Stack must be at least PTHREAD_STACK_MIN bytes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * stacksize - * stack size, in bytes. - * - * - * DESCRIPTION - * Threads created with 'attr' will run on the stack - * starting at 'stackaddr'. - * Stack must be at least PTHREAD_STACK_MIN bytes. - * - * NOTES: - * 1) Function supported only if this macro is - * defined: - * - * _POSIX_THREAD_ATTR_STACKADDR - * - * 2) Create only one thread for each stack - * address.. - * - * 3) Ensure that stackaddr is aligned. - * - * RESULTS - * 0 successfully set stack address, - * EINVAL 'attr' is invalid - * ENOSYS function not supported - * - * ------------------------------------------------------ - */ -{ -#if defined( _POSIX_THREAD_ATTR_STACKADDR ) - - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - (*attr)->stackaddr = stackaddr; - return 0; - -#else - - return ENOSYS; - -#endif /* _POSIX_THREAD_ATTR_STACKADDR */ -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setstacksize.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setstacksize.c deleted file mode 100644 index 9df46afc475..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_attr_setstacksize.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * pthread_attr_setstacksize.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_attr_setstacksize (pthread_attr_t * attr, size_t stacksize) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function specifies the size of the stack on - * which threads created with 'attr' will run. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_attr_t - * - * stacksize - * stack size, in bytes. - * - * - * DESCRIPTION - * This function specifies the size of the stack on - * which threads created with 'attr' will run. - * - * NOTES: - * 1) Function supported only if this macro is - * defined: - * - * _POSIX_THREAD_ATTR_STACKSIZE - * - * 2) Find the default first (using - * pthread_attr_getstacksize), then increase - * by multiplying. - * - * 3) Only use if thread needs more than the - * default. - * - * RESULTS - * 0 successfully set stack size, - * EINVAL 'attr' is invalid or stacksize too - * small or too big. - * ENOSYS function not supported - * - * ------------------------------------------------------ - */ -{ -#ifdef _POSIX_THREAD_ATTR_STACKSIZE - -#if PTHREAD_STACK_MIN > 0 - - /* Verify that the stack size is within range. */ - if (stacksize < PTHREAD_STACK_MIN) - { - return EINVAL; - } - -#endif - - if (ptw32_is_attr (attr) != 0) - { - return EINVAL; - } - - /* Everything is okay. */ - (*attr)->stacksize = stacksize; - return 0; - -#else - - return ENOSYS; - -#endif /* _POSIX_THREAD_ATTR_STACKSIZE */ - -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_destroy.c deleted file mode 100644 index 9302ba7975d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_destroy.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * pthread_barrier_destroy.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrier_destroy (pthread_barrier_t * barrier) -{ - int result = 0; - pthread_barrier_t b; - - if (barrier == NULL || *barrier == (pthread_barrier_t) PTW32_OBJECT_INVALID) - { - return EINVAL; - } - - b = *barrier; - *barrier = NULL; - - if (0 == (result = sem_destroy (&(b->semBarrierBreeched[0])))) - { - if (0 == (result = sem_destroy (&(b->semBarrierBreeched[1])))) - { - (void) free (b); - return 0; - } - (void) sem_init (&(b->semBarrierBreeched[0]), b->pshared, 0); - } - - *barrier = b; - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_init.c deleted file mode 100644 index dc1b50c6f73..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_init.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * pthread_barrier_init.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrier_init (pthread_barrier_t * barrier, - const pthread_barrierattr_t * attr, unsigned int count) -{ - pthread_barrier_t b; - - if (barrier == NULL || count == 0) - { - return EINVAL; - } - - if (NULL != (b = (pthread_barrier_t) calloc (1, sizeof (*b)))) - { - b->pshared = (attr != NULL && *attr != NULL - ? (*attr)->pshared : PTHREAD_PROCESS_PRIVATE); - - b->nCurrentBarrierHeight = b->nInitialBarrierHeight = count; - b->iStep = 0; - - /* - * Two semaphores are used in the same way as two stepping - * stones might be used in crossing a stream. Once all - * threads are safely on one stone, the other stone can - * be moved ahead, and the threads can start moving to it. - * If some threads decide to eat their lunch before moving - * then the other threads have to wait. - */ - if (0 == sem_init (&(b->semBarrierBreeched[0]), b->pshared, 0)) - { - if (0 == sem_init (&(b->semBarrierBreeched[1]), b->pshared, 0)) - { - *barrier = b; - return 0; - } - (void) sem_destroy (&(b->semBarrierBreeched[0])); - } - (void) free (b); - } - - return ENOMEM; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_wait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_wait.c deleted file mode 100644 index 01ae29766ed..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrier_wait.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * pthread_barrier_wait.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrier_wait (pthread_barrier_t * barrier) -{ - int result; - int step; - pthread_barrier_t b; - - if (barrier == NULL || *barrier == (pthread_barrier_t) PTW32_OBJECT_INVALID) - { - return EINVAL; - } - - b = *barrier; - step = b->iStep; - - if (0 == InterlockedDecrement ((long *) &(b->nCurrentBarrierHeight))) - { - /* Must be done before posting the semaphore. */ - b->nCurrentBarrierHeight = b->nInitialBarrierHeight; - - /* - * There is no race condition between the semaphore wait and post - * because we are using two alternating semas and all threads have - * entered barrier_wait and checked nCurrentBarrierHeight before this - * barrier's sema can be posted. Any threads that have not quite - * entered sem_wait below when the multiple_post has completed - * will nevertheless continue through the semaphore (barrier) - * and will not be left stranded. - */ - result = (b->nInitialBarrierHeight > 1 - ? sem_post_multiple (&(b->semBarrierBreeched[step]), - b->nInitialBarrierHeight - 1) : 0); - } - else - { - /* - * Use the non-cancelable version of sem_wait(). - */ - result = ptw32_semwait (&(b->semBarrierBreeched[step])); - } - - /* - * The first thread across will be the PTHREAD_BARRIER_SERIAL_THREAD. - * This also sets up the alternate semaphore as the next barrier. - */ - if (0 == result) - { - result = ((PTW32_INTERLOCKED_LONG) step == - PTW32_INTERLOCKED_COMPARE_EXCHANGE ((PTW32_INTERLOCKED_LPLONG) - & (b->iStep), - (PTW32_INTERLOCKED_LONG) - (1L - step), - (PTW32_INTERLOCKED_LONG) - step) ? - PTHREAD_BARRIER_SERIAL_THREAD : 0); - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_destroy.c deleted file mode 100644 index 5ab662e3f4e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_destroy.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * pthread_barrier_attr_destroy.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrierattr_destroy (pthread_barrierattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Destroys a barrier attributes object. The object can - * no longer be used. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_barrierattr_t - * - * - * DESCRIPTION - * Destroys a barrier attributes object. The object can - * no longer be used. - * - * NOTES: - * 1) Does not affect barrieres created using 'attr' - * - * RESULTS - * 0 successfully released attr, - * EINVAL 'attr' is invalid. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - - if (attr == NULL || *attr == NULL) - { - result = EINVAL; - } - else - { - pthread_barrierattr_t ba = *attr; - - *attr = NULL; - free (ba); - } - - return (result); -} /* pthread_barrierattr_destroy */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_getpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_getpshared.c deleted file mode 100644 index 44c467e2bfc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_getpshared.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * pthread_barrier_attr_getpshared.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrierattr_getpshared (const pthread_barrierattr_t * attr, - int *pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Determine whether barriers created with 'attr' can be - * shared between processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_barrierattr_t - * - * pshared - * will be set to one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * - * DESCRIPTION - * Mutexes creatd with 'attr' can be shared between - * processes if pthread_barrier_t variable is allocated - * in memory shared by these processes. - * NOTES: - * 1) pshared barriers MUST be allocated in shared - * memory. - * 2) The following macro is defined if shared barriers - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully retrieved attribute, - * EINVAL 'attr' is invalid, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && (pshared != NULL)) - { - *pshared = (*attr)->pshared; - result = 0; - } - else - { - result = EINVAL; - } - - return (result); -} /* pthread_barrierattr_getpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_init.c deleted file mode 100644 index 342f8b0c69a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_init.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * pthread_barrier_attr_init.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrierattr_init (pthread_barrierattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Initializes a barrier attributes object with default - * attributes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_barrierattr_t - * - * - * DESCRIPTION - * Initializes a barrier attributes object with default - * attributes. - * - * NOTES: - * 1) Used to define barrier types - * - * RESULTS - * 0 successfully initialized attr, - * ENOMEM insufficient memory for attr. - * - * ------------------------------------------------------ - */ -{ - pthread_barrierattr_t ba; - int result = 0; - - ba = (pthread_barrierattr_t) calloc (1, sizeof (*ba)); - - if (ba == NULL) - { - result = ENOMEM; - } - else - { - ba->pshared = PTHREAD_PROCESS_PRIVATE; - } - - *attr = ba; - - return (result); -} /* pthread_barrierattr_init */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_setpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_setpshared.c deleted file mode 100644 index 08c6fde30bc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_barrierattr_setpshared.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * pthread_barrier_attr_setpshared.c - * - * Description: - * This translation unit implements barrier primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, int pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Barriers created with 'attr' can be shared between - * processes if pthread_barrier_t variable is allocated - * in memory shared by these processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_barrierattr_t - * - * pshared - * must be one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * DESCRIPTION - * Mutexes creatd with 'attr' can be shared between - * processes if pthread_barrier_t variable is allocated - * in memory shared by these processes. - * - * NOTES: - * 1) pshared barriers MUST be allocated in shared - * memory. - * - * 2) The following macro is defined if shared barriers - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully set attribute, - * EINVAL 'attr' or pshared is invalid, - * ENOSYS PTHREAD_PROCESS_SHARED not supported, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && - ((pshared == PTHREAD_PROCESS_SHARED) || - (pshared == PTHREAD_PROCESS_PRIVATE))) - { - if (pshared == PTHREAD_PROCESS_SHARED) - { - -#if !defined( _POSIX_THREAD_PROCESS_SHARED ) - - result = ENOSYS; - pshared = PTHREAD_PROCESS_PRIVATE; - -#else - - result = 0; - -#endif /* _POSIX_THREAD_PROCESS_SHARED */ - - } - else - { - result = 0; - } - - (*attr)->pshared = pshared; - } - else - { - result = EINVAL; - } - - return (result); - -} /* pthread_barrierattr_setpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cancel.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cancel.c deleted file mode 100644 index 1118977ee50..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cancel.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * pthread_cancel.c - * - * Description: - * POSIX thread functions related to thread cancellation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -#if defined(_M_IX86) || defined(_X86_) -#define PTW32_PROGCTR(Context) ((Context).Eip) -#endif - -#if defined (_M_IA64) -#define PTW32_PROGCTR(Context) ((Context).StIIP) -#endif - -#if defined(_MIPS_) -#define PTW32_PROGCTR(Context) ((Context).Fir) -#endif - -#if defined(_ALPHA_) -#define PTW32_PROGCTR(Context) ((Context).Fir) -#endif - -#if defined(_PPC_) -#define PTW32_PROGCTR(Context) ((Context).Iar) -#endif - -#if defined(_AMD64_) -#define PTW32_PROGCTR(Context) ((Context).Rip) -#endif - -#if !defined(PTW32_PROGCTR) -#error Module contains CPU-specific code; modify and recompile. -#endif - -static void -ptw32_cancel_self (void) -{ - ptw32_throw (PTW32_EPS_CANCEL); - - /* Never reached */ -} - -static void CALLBACK -ptw32_cancel_callback (DWORD unused) -{ - ptw32_throw (PTW32_EPS_CANCEL); - - /* Never reached */ -} - -/* - * ptw32_RegisterCancelation() - - * Must have args of same type as QueueUserAPCEx because this function - * is a substitute for QueueUserAPCEx if it's not available. - */ -DWORD -ptw32_RegisterCancelation (PAPCFUNC unused1, HANDLE threadH, DWORD unused2) -{ - CONTEXT context; - - context.ContextFlags = CONTEXT_CONTROL; - GetThreadContext (threadH, &context); - PTW32_PROGCTR (context) = (DWORD_PTR) ptw32_cancel_self; - SetThreadContext (threadH, &context); - return 0; -} - -int -pthread_cancel (pthread_t thread) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function requests cancellation of 'thread'. - * - * PARAMETERS - * thread - * reference to an instance of pthread_t - * - * - * DESCRIPTION - * This function requests cancellation of 'thread'. - * NOTE: cancellation is asynchronous; use pthread_join to - * wait for termination of 'thread' if necessary. - * - * RESULTS - * 0 successfully requested cancellation, - * ESRCH no thread found corresponding to 'thread', - * ENOMEM implicit self thread create failed. - * ------------------------------------------------------ - */ -{ - int result; - int cancel_self; - pthread_t self; - ptw32_thread_t * tp; - - result = pthread_kill (thread, 0); - - if (0 != result) - { - return result; - } - - if ((self = pthread_self ()).p == NULL) - { - return ENOMEM; - }; - - /* - * FIXME!! - * - * Can a thread cancel itself? - * - * The standard doesn't - * specify an error to be returned if the target - * thread is itself. - * - * If it may, then we need to ensure that a thread can't - * deadlock itself trying to cancel itself asyncronously - * (pthread_cancel is required to be an async-cancel - * safe function). - */ - cancel_self = pthread_equal (thread, self); - - tp = (ptw32_thread_t *) thread.p; - - /* - * Lock for async-cancel safety. - */ - (void) pthread_mutex_lock (&tp->cancelLock); - - if (tp->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS - && tp->cancelState == PTHREAD_CANCEL_ENABLE - && tp->state < PThreadStateCanceling) - { - if (cancel_self) - { - tp->state = PThreadStateCanceling; - tp->cancelState = PTHREAD_CANCEL_DISABLE; - - (void) pthread_mutex_unlock (&tp->cancelLock); - ptw32_throw (PTW32_EPS_CANCEL); - - /* Never reached */ - } - else - { - HANDLE threadH = tp->threadH; - - SuspendThread (threadH); - - if (WaitForSingleObject (threadH, 0) == WAIT_TIMEOUT) - { - tp->state = PThreadStateCanceling; - tp->cancelState = PTHREAD_CANCEL_DISABLE; - /* - * If alertdrv and QueueUserAPCEx is available then the following - * will result in a call to QueueUserAPCEx with the args given, otherwise - * this will result in a call to ptw32_RegisterCancelation and only - * the threadH arg will be used. - */ - ptw32_register_cancelation (ptw32_cancel_callback, threadH, 0); - (void) pthread_mutex_unlock (&tp->cancelLock); - ResumeThread (threadH); - } - } - } - else - { - /* - * Set for deferred cancellation. - */ - if (tp->state < PThreadStateCancelPending) - { - tp->state = PThreadStateCancelPending; - if (!SetEvent (tp->cancelEvent)) - { - result = ESRCH; - } - } - else if (tp->state >= PThreadStateCanceling) - { - result = ESRCH; - } - - (void) pthread_mutex_unlock (&tp->cancelLock); - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_destroy.c deleted file mode 100644 index 3d29ffc4057..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_destroy.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * pthread_cond_destroy.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -int -pthread_cond_destroy (pthread_cond_t * cond) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function destroys a condition variable - * - * - * PARAMETERS - * cond - * pointer to an instance of pthread_cond_t - * - * - * DESCRIPTION - * This function destroys a condition variable. - * - * NOTES: - * 1) A condition variable can be destroyed - * immediately after all the threads that - * are blocked on it are awakened. e.g. - * - * struct list { - * pthread_mutex_t lm; - * ... - * } - * - * struct elt { - * key k; - * int busy; - * pthread_cond_t notbusy; - * ... - * } - * - * - * struct elt * - * list_find(struct list *lp, key k) - * { - * struct elt *ep; - * - * pthread_mutex_lock(&lp->lm); - * while ((ep = find_elt(l,k) != NULL) && ep->busy) - * pthread_cond_wait(&ep->notbusy, &lp->lm); - * if (ep != NULL) - * ep->busy = 1; - * pthread_mutex_unlock(&lp->lm); - * return(ep); - * } - * - * delete_elt(struct list *lp, struct elt *ep) - * { - * pthread_mutex_lock(&lp->lm); - * assert(ep->busy); - * ... remove ep from list ... - * ep->busy = 0; - * (A) pthread_cond_broadcast(&ep->notbusy); - * pthread_mutex_unlock(&lp->lm); - * (B) pthread_cond_destroy(&rp->notbusy); - * free(ep); - * } - * - * In this example, the condition variable - * and its list element may be freed (line B) - * immediately after all threads waiting for - * it are awakened (line A), since the mutex - * and the code ensure that no other thread - * can touch the element to be deleted. - * - * RESULTS - * 0 successfully released condition variable, - * EINVAL 'cond' is invalid, - * EBUSY 'cond' is in use, - * - * ------------------------------------------------------ - */ -{ - pthread_cond_t cv; - int result = 0, result1 = 0, result2 = 0; - - /* - * Assuming any race condition here is harmless. - */ - if (cond == NULL || *cond == NULL) - { - return EINVAL; - } - - if (*cond != PTHREAD_COND_INITIALIZER) - { - EnterCriticalSection (&ptw32_cond_list_lock); - - cv = *cond; - - /* - * Close the gate; this will synchronize this thread with - * all already signaled waiters to let them retract their - * waiter status - SEE NOTE 1 ABOVE!!! - */ - if (sem_wait (&(cv->semBlockLock)) != 0) - { - return errno; - } - - /* - * !TRY! lock mtxUnblockLock; try will detect busy condition - * and will not cause a deadlock with respect to concurrent - * signal/broadcast. - */ - if ((result = pthread_mutex_trylock (&(cv->mtxUnblockLock))) != 0) - { - (void) sem_post (&(cv->semBlockLock)); - return result; - } - - /* - * Check whether cv is still busy (still has waiters) - */ - if (cv->nWaitersBlocked > cv->nWaitersGone) - { - if (sem_post (&(cv->semBlockLock)) != 0) - { - result = errno; - } - result1 = pthread_mutex_unlock (&(cv->mtxUnblockLock)); - result2 = EBUSY; - } - else - { - /* - * Now it is safe to destroy - */ - *cond = NULL; - - if (sem_destroy (&(cv->semBlockLock)) != 0) - { - result = errno; - } - if (sem_destroy (&(cv->semBlockQueue)) != 0) - { - result1 = errno; - } - if ((result2 = pthread_mutex_unlock (&(cv->mtxUnblockLock))) == 0) - { - result2 = pthread_mutex_destroy (&(cv->mtxUnblockLock)); - } - - /* Unlink the CV from the list */ - - if (ptw32_cond_list_head == cv) - { - ptw32_cond_list_head = cv->next; - } - else - { - cv->prev->next = cv->next; - } - - if (ptw32_cond_list_tail == cv) - { - ptw32_cond_list_tail = cv->prev; - } - else - { - cv->next->prev = cv->prev; - } - - (void) free (cv); - } - - LeaveCriticalSection (&ptw32_cond_list_lock); - } - else - { - /* - * See notes in ptw32_cond_check_need_init() above also. - */ - EnterCriticalSection (&ptw32_cond_test_init_lock); - - /* - * Check again. - */ - if (*cond == PTHREAD_COND_INITIALIZER) - { - /* - * This is all we need to do to destroy a statically - * initialised cond that has not yet been used (initialised). - * If we get to here, another thread waiting to initialise - * this cond will get an EINVAL. That's OK. - */ - *cond = NULL; - } - else - { - /* - * The cv has been initialised while we were waiting - * so assume it's in use. - */ - result = EBUSY; - } - - LeaveCriticalSection (&ptw32_cond_test_init_lock); - } - - return ((result != 0) ? result : ((result1 != 0) ? result1 : result2)); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_init.c deleted file mode 100644 index d2de232f4b4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_init.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * pthread_cond_init.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_cond_init (pthread_cond_t * cond, const pthread_condattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function initializes a condition variable. - * - * PARAMETERS - * cond - * pointer to an instance of pthread_cond_t - * - * attr - * specifies optional creation attributes. - * - * - * DESCRIPTION - * This function initializes a condition variable. - * - * RESULTS - * 0 successfully created condition variable, - * EINVAL 'attr' is invalid, - * EAGAIN insufficient resources (other than - * memory, - * ENOMEM insufficient memory, - * EBUSY 'cond' is already initialized, - * - * ------------------------------------------------------ - */ -{ - int result; - pthread_cond_t cv = NULL; - - if (cond == NULL) - { - return EINVAL; - } - - if ((attr != NULL && *attr != NULL) && - ((*attr)->pshared == PTHREAD_PROCESS_SHARED)) - { - /* - * Creating condition variable that can be shared between - * processes. - */ - result = ENOSYS; - goto DONE; - } - - cv = (pthread_cond_t) calloc (1, sizeof (*cv)); - - if (cv == NULL) - { - result = ENOMEM; - goto DONE; - } - - cv->nWaitersBlocked = 0; - cv->nWaitersToUnblock = 0; - cv->nWaitersGone = 0; - - if (sem_init (&(cv->semBlockLock), 0, 1) != 0) - { - result = errno; - goto FAIL0; - } - - if (sem_init (&(cv->semBlockQueue), 0, 0) != 0) - { - result = errno; - goto FAIL1; - } - - if ((result = pthread_mutex_init (&(cv->mtxUnblockLock), 0)) != 0) - { - goto FAIL2; - } - - result = 0; - - goto DONE; - - /* - * ------------- - * Failed... - * ------------- - */ -FAIL2: - (void) sem_destroy (&(cv->semBlockQueue)); - -FAIL1: - (void) sem_destroy (&(cv->semBlockLock)); - -FAIL0: - (void) free (cv); - cv = NULL; - -DONE: - if (0 == result) - { - EnterCriticalSection (&ptw32_cond_list_lock); - - cv->next = NULL; - cv->prev = ptw32_cond_list_tail; - - if (ptw32_cond_list_tail != NULL) - { - ptw32_cond_list_tail->next = cv; - } - - ptw32_cond_list_tail = cv; - - if (ptw32_cond_list_head == NULL) - { - ptw32_cond_list_head = cv; - } - - LeaveCriticalSection (&ptw32_cond_list_lock); - } - - *cond = cv; - - return result; - -} /* pthread_cond_init */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_signal.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_signal.c deleted file mode 100644 index 2b4f6d4d440..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_signal.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * pthread_cond_signal.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * ------------------------------------------------------------- - * Algorithm: - * See the comments at the top of pthread_cond_wait.c. - */ - -#include "pthread.h" -#include "implement.h" - -static INLINE int -ptw32_cond_unblock (pthread_cond_t * cond, int unblockAll) - /* - * Notes. - * - * Does not use the external mutex for synchronisation, - * therefore semBlockLock is needed. - * mtxUnblockLock is for LEVEL-2 synch. LEVEL-2 is the - * state where the external mutex is not necessarily locked by - * any thread, ie. between cond_wait unlocking and re-acquiring - * the lock after having been signaled or a timeout or - * cancellation. - * - * Uses the following CV elements: - * nWaitersBlocked - * nWaitersToUnblock - * nWaitersGone - * mtxUnblockLock - * semBlockLock - * semBlockQueue - */ -{ - int result; - pthread_cond_t cv; - int nSignalsToIssue; - - if (cond == NULL || *cond == NULL) - { - return EINVAL; - } - - cv = *cond; - - /* - * No-op if the CV is static and hasn't been initialised yet. - * Assuming that any race condition is harmless. - */ - if (cv == PTHREAD_COND_INITIALIZER) - { - return 0; - } - - if ((result = pthread_mutex_lock (&(cv->mtxUnblockLock))) != 0) - { - return result; - } - - if (0 != cv->nWaitersToUnblock) - { - if (0 == cv->nWaitersBlocked) - { - return pthread_mutex_unlock (&(cv->mtxUnblockLock)); - } - if (unblockAll) - { - cv->nWaitersToUnblock += (nSignalsToIssue = cv->nWaitersBlocked); - cv->nWaitersBlocked = 0; - } - else - { - nSignalsToIssue = 1; - cv->nWaitersToUnblock++; - cv->nWaitersBlocked--; - } - } - else if (cv->nWaitersBlocked > cv->nWaitersGone) - { - /* Use the non-cancellable version of sem_wait() */ - if (ptw32_semwait (&(cv->semBlockLock)) != 0) - { - result = errno; - (void) pthread_mutex_unlock (&(cv->mtxUnblockLock)); - return result; - } - if (0 != cv->nWaitersGone) - { - cv->nWaitersBlocked -= cv->nWaitersGone; - cv->nWaitersGone = 0; - } - if (unblockAll) - { - nSignalsToIssue = cv->nWaitersToUnblock = cv->nWaitersBlocked; - cv->nWaitersBlocked = 0; - } - else - { - nSignalsToIssue = cv->nWaitersToUnblock = 1; - cv->nWaitersBlocked--; - } - } - else - { - return pthread_mutex_unlock (&(cv->mtxUnblockLock)); - } - - if ((result = pthread_mutex_unlock (&(cv->mtxUnblockLock))) == 0) - { - if (sem_post_multiple (&(cv->semBlockQueue), nSignalsToIssue) != 0) - { - result = errno; - } - } - - return result; - -} /* ptw32_cond_unblock */ - -int -pthread_cond_signal (pthread_cond_t * cond) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function signals a condition variable, waking - * one waiting thread. - * If SCHED_FIFO or SCHED_RR policy threads are waiting - * the highest priority waiter is awakened; otherwise, - * an unspecified waiter is awakened. - * - * PARAMETERS - * cond - * pointer to an instance of pthread_cond_t - * - * - * DESCRIPTION - * This function signals a condition variable, waking - * one waiting thread. - * If SCHED_FIFO or SCHED_RR policy threads are waiting - * the highest priority waiter is awakened; otherwise, - * an unspecified waiter is awakened. - * - * NOTES: - * - * 1) Use when any waiter can respond and only one need - * respond (all waiters being equal). - * - * RESULTS - * 0 successfully signaled condition, - * EINVAL 'cond' is invalid, - * - * ------------------------------------------------------ - */ -{ - /* - * The '0'(FALSE) unblockAll arg means unblock ONE waiter. - */ - return (ptw32_cond_unblock (cond, 0)); - -} /* pthread_cond_signal */ - -int -pthread_cond_broadcast (pthread_cond_t * cond) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function broadcasts the condition variable, - * waking all current waiters. - * - * PARAMETERS - * cond - * pointer to an instance of pthread_cond_t - * - * - * DESCRIPTION - * This function signals a condition variable, waking - * all waiting threads. - * - * NOTES: - * - * 1) Use when more than one waiter may respond to - * predicate change or if any waiting thread may - * not be able to respond - * - * RESULTS - * 0 successfully signalled condition to all - * waiting threads, - * EINVAL 'cond' is invalid - * ENOSPC a required resource has been exhausted, - * - * ------------------------------------------------------ - */ -{ - /* - * The TRUE unblockAll arg means unblock ALL waiters. - */ - return (ptw32_cond_unblock (cond, PTW32_TRUE)); - -} /* pthread_cond_broadcast */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_wait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_wait.c deleted file mode 100644 index 5511c5844c4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_cond_wait.c +++ /dev/null @@ -1,567 +0,0 @@ -/* - * pthread_cond_wait.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * ------------------------------------------------------------- - * Algorithm: - * The algorithm used in this implementation is that developed by - * Alexander Terekhov in colaboration with Louis Thomas. The bulk - * of the discussion is recorded in the file README.CV, which contains - * several generations of both colaborators original algorithms. The final - * algorithm used here is the one referred to as - * - * Algorithm 8a / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL - * - * presented below in pseudo-code as it appeared: - * - * - * given: - * semBlockLock - bin.semaphore - * semBlockQueue - semaphore - * mtxExternal - mutex or CS - * mtxUnblockLock - mutex or CS - * nWaitersGone - int - * nWaitersBlocked - int - * nWaitersToUnblock - int - * - * wait( timeout ) { - * - * [auto: register int result ] // error checking omitted - * [auto: register int nSignalsWasLeft ] - * [auto: register int nWaitersWasGone ] - * - * sem_wait( semBlockLock ); - * nWaitersBlocked++; - * sem_post( semBlockLock ); - * - * unlock( mtxExternal ); - * bTimedOut = sem_wait( semBlockQueue,timeout ); - * - * lock( mtxUnblockLock ); - * if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { - * if ( bTimeout ) { // timeout (or canceled) - * if ( 0 != nWaitersBlocked ) { - * nWaitersBlocked--; - * } - * else { - * nWaitersGone++; // count spurious wakeups. - * } - * } - * if ( 0 == --nWaitersToUnblock ) { - * if ( 0 != nWaitersBlocked ) { - * sem_post( semBlockLock ); // open the gate. - * nSignalsWasLeft = 0; // do not open the gate - * // below again. - * } - * else if ( 0 != (nWaitersWasGone = nWaitersGone) ) { - * nWaitersGone = 0; - * } - * } - * } - * else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or - * // spurious semaphore :-) - * sem_wait( semBlockLock ); - * nWaitersBlocked -= nWaitersGone; // something is going on here - * // - test of timeouts? :-) - * sem_post( semBlockLock ); - * nWaitersGone = 0; - * } - * unlock( mtxUnblockLock ); - * - * if ( 1 == nSignalsWasLeft ) { - * if ( 0 != nWaitersWasGone ) { - * // sem_adjust( semBlockQueue,-nWaitersWasGone ); - * while ( nWaitersWasGone-- ) { - * sem_wait( semBlockQueue ); // better now than spurious later - * } - * } sem_post( semBlockLock ); // open the gate - * } - * - * lock( mtxExternal ); - * - * return ( bTimedOut ) ? ETIMEOUT : 0; - * } - * - * signal(bAll) { - * - * [auto: register int result ] - * [auto: register int nSignalsToIssue] - * - * lock( mtxUnblockLock ); - * - * if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - * if ( 0 == nWaitersBlocked ) { // NO-OP - * return unlock( mtxUnblockLock ); - * } - * if (bAll) { - * nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; - * nWaitersBlocked = 0; - * } - * else { - * nSignalsToIssue = 1; - * nWaitersToUnblock++; - * nWaitersBlocked--; - * } - * } - * else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - * sem_wait( semBlockLock ); // close the gate - * if ( 0 != nWaitersGone ) { - * nWaitersBlocked -= nWaitersGone; - * nWaitersGone = 0; - * } - * if (bAll) { - * nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; - * nWaitersBlocked = 0; - * } - * else { - * nSignalsToIssue = nWaitersToUnblock = 1; - * nWaitersBlocked--; - * } - * } - * else { // NO-OP - * return unlock( mtxUnblockLock ); - * } - * - * unlock( mtxUnblockLock ); - * sem_post( semBlockQueue,nSignalsToIssue ); - * return result; - * } - * ------------------------------------------------------------- - * - * Algorithm 9 / IMPL_SEM,UNBLOCK_STRATEGY == UNBLOCK_ALL - * - * presented below in pseudo-code; basically 8a... - * ...BUT W/O "spurious wakes" prevention: - * - * - * given: - * semBlockLock - bin.semaphore - * semBlockQueue - semaphore - * mtxExternal - mutex or CS - * mtxUnblockLock - mutex or CS - * nWaitersGone - int - * nWaitersBlocked - int - * nWaitersToUnblock - int - * - * wait( timeout ) { - * - * [auto: register int result ] // error checking omitted - * [auto: register int nSignalsWasLeft ] - * - * sem_wait( semBlockLock ); - * ++nWaitersBlocked; - * sem_post( semBlockLock ); - * - * unlock( mtxExternal ); - * bTimedOut = sem_wait( semBlockQueue,timeout ); - * - * lock( mtxUnblockLock ); - * if ( 0 != (nSignalsWasLeft = nWaitersToUnblock) ) { - * --nWaitersToUnblock; - * } - * else if ( INT_MAX/2 == ++nWaitersGone ) { // timeout/canceled or - * // spurious semaphore :-) - * sem_wait( semBlockLock ); - * nWaitersBlocked -= nWaitersGone; // something is going on here - * // - test of timeouts? :-) - * sem_post( semBlockLock ); - * nWaitersGone = 0; - * } - * unlock( mtxUnblockLock ); - * - * if ( 1 == nSignalsWasLeft ) { - * sem_post( semBlockLock ); // open the gate - * } - * - * lock( mtxExternal ); - * - * return ( bTimedOut ) ? ETIMEOUT : 0; - * } - * - * signal(bAll) { - * - * [auto: register int result ] - * [auto: register int nSignalsToIssue] - * - * lock( mtxUnblockLock ); - * - * if ( 0 != nWaitersToUnblock ) { // the gate is closed!!! - * if ( 0 == nWaitersBlocked ) { // NO-OP - * return unlock( mtxUnblockLock ); - * } - * if (bAll) { - * nWaitersToUnblock += nSignalsToIssue=nWaitersBlocked; - * nWaitersBlocked = 0; - * } - * else { - * nSignalsToIssue = 1; - * ++nWaitersToUnblock; - * --nWaitersBlocked; - * } - * } - * else if ( nWaitersBlocked > nWaitersGone ) { // HARMLESS RACE CONDITION! - * sem_wait( semBlockLock ); // close the gate - * if ( 0 != nWaitersGone ) { - * nWaitersBlocked -= nWaitersGone; - * nWaitersGone = 0; - * } - * if (bAll) { - * nSignalsToIssue = nWaitersToUnblock = nWaitersBlocked; - * nWaitersBlocked = 0; - * } - * else { - * nSignalsToIssue = nWaitersToUnblock = 1; - * --nWaitersBlocked; - * } - * } - * else { // NO-OP - * return unlock( mtxUnblockLock ); - * } - * - * unlock( mtxUnblockLock ); - * sem_post( semBlockQueue,nSignalsToIssue ); - * return result; - * } - * ------------------------------------------------------------- - * - */ - -#include "pthread.h" -#include "implement.h" - -/* - * Arguments for cond_wait_cleanup, since we can only pass a - * single void * to it. - */ -typedef struct -{ - pthread_mutex_t *mutexPtr; - pthread_cond_t cv; - int *resultPtr; -} ptw32_cond_wait_cleanup_args_t; - -static void PTW32_CDECL -ptw32_cond_wait_cleanup (void *args) -{ - ptw32_cond_wait_cleanup_args_t *cleanup_args = - (ptw32_cond_wait_cleanup_args_t *) args; - pthread_cond_t cv = cleanup_args->cv; - int *resultPtr = cleanup_args->resultPtr; - int nSignalsWasLeft; - int result; - - /* - * Whether we got here as a result of signal/broadcast or because of - * timeout on wait or thread cancellation we indicate that we are no - * longer waiting. The waiter is responsible for adjusting waiters - * (to)unblock(ed) counts (protected by unblock lock). - */ - if ((result = pthread_mutex_lock (&(cv->mtxUnblockLock))) != 0) - { - *resultPtr = result; - return; - } - - if (0 != (nSignalsWasLeft = cv->nWaitersToUnblock)) - { - --(cv->nWaitersToUnblock); - } - else if (INT_MAX / 2 == ++(cv->nWaitersGone)) - { - /* Use the non-cancellable version of sem_wait() */ - if (ptw32_semwait (&(cv->semBlockLock)) != 0) - { - *resultPtr = errno; - /* - * This is a fatal error for this CV, - * so we deliberately don't unlock - * cv->mtxUnblockLock before returning. - */ - return; - } - cv->nWaitersBlocked -= cv->nWaitersGone; - if (sem_post (&(cv->semBlockLock)) != 0) - { - *resultPtr = errno; - /* - * This is a fatal error for this CV, - * so we deliberately don't unlock - * cv->mtxUnblockLock before returning. - */ - return; - } - cv->nWaitersGone = 0; - } - - if ((result = pthread_mutex_unlock (&(cv->mtxUnblockLock))) != 0) - { - *resultPtr = result; - return; - } - - if (1 == nSignalsWasLeft) - { - if (sem_post (&(cv->semBlockLock)) != 0) - { - *resultPtr = errno; - return; - } - } - - /* - * XSH: Upon successful return, the mutex has been locked and is owned - * by the calling thread. - */ - if ((result = pthread_mutex_lock (cleanup_args->mutexPtr)) != 0) - { - *resultPtr = result; - } -} /* ptw32_cond_wait_cleanup */ - -static INLINE int -ptw32_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, const struct timespec *abstime) -{ - int result = 0; - pthread_cond_t cv; - ptw32_cond_wait_cleanup_args_t cleanup_args; - - if (cond == NULL || *cond == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static condition variable. We check - * again inside the guarded section of ptw32_cond_check_need_init() - * to avoid race conditions. - */ - if (*cond == PTHREAD_COND_INITIALIZER) - { - result = ptw32_cond_check_need_init (cond); - } - - if (result != 0 && result != EBUSY) - { - return result; - } - - cv = *cond; - - /* Thread can be cancelled in sem_wait() but this is OK */ - if (sem_wait (&(cv->semBlockLock)) != 0) - { - return errno; - } - - ++(cv->nWaitersBlocked); - - if (sem_post (&(cv->semBlockLock)) != 0) - { - return errno; - } - - /* - * Setup this waiter cleanup handler - */ - cleanup_args.mutexPtr = mutex; - cleanup_args.cv = cv; - cleanup_args.resultPtr = &result; - -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push (ptw32_cond_wait_cleanup, (void *) &cleanup_args); - - /* - * Now we can release 'mutex' and... - */ - if ((result = pthread_mutex_unlock (mutex)) == 0) - { - - /* - * ...wait to be awakened by - * pthread_cond_signal, or - * pthread_cond_broadcast, or - * timeout, or - * thread cancellation - * - * Note: - * - * sem_timedwait is a cancellation point, - * hence providing the mechanism for making - * pthread_cond_wait a cancellation point. - * We use the cleanup mechanism to ensure we - * re-lock the mutex and adjust (to)unblock(ed) waiters - * counts if we are cancelled, timed out or signalled. - */ - if (sem_timedwait (&(cv->semBlockQueue), abstime) != 0) - { - result = errno; - } - } - - /* - * Always cleanup - */ - pthread_cleanup_pop (1); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - /* - * "result" can be modified by the cleanup handler. - */ - return result; - -} /* ptw32_cond_timedwait */ - - -int -pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function waits on a condition variable until - * awakened by a signal or broadcast. - * - * Caller MUST be holding the mutex lock; the - * lock is released and the caller is blocked waiting - * on 'cond'. When 'cond' is signaled, the mutex - * is re-acquired before returning to the caller. - * - * PARAMETERS - * cond - * pointer to an instance of pthread_cond_t - * - * mutex - * pointer to an instance of pthread_mutex_t - * - * - * DESCRIPTION - * This function waits on a condition variable until - * awakened by a signal or broadcast. - * - * NOTES: - * - * 1) The function must be called with 'mutex' LOCKED - * by the calling thread, or undefined behaviour - * will result. - * - * 2) This routine atomically releases 'mutex' and causes - * the calling thread to block on the condition variable. - * The blocked thread may be awakened by - * pthread_cond_signal or - * pthread_cond_broadcast. - * - * Upon successful completion, the 'mutex' has been locked and - * is owned by the calling thread. - * - * - * RESULTS - * 0 caught condition; mutex released, - * EINVAL 'cond' or 'mutex' is invalid, - * EINVAL different mutexes for concurrent waits, - * EINVAL mutex is not held by the calling thread, - * - * ------------------------------------------------------ - */ -{ - /* - * The NULL abstime arg means INFINITE waiting. - */ - return (ptw32_cond_timedwait (cond, mutex, NULL)); - -} /* pthread_cond_wait */ - - -int -pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function waits on a condition variable either until - * awakened by a signal or broadcast; or until the time - * specified by abstime passes. - * - * PARAMETERS - * cond - * pointer to an instance of pthread_cond_t - * - * mutex - * pointer to an instance of pthread_mutex_t - * - * abstime - * pointer to an instance of (const struct timespec) - * - * - * DESCRIPTION - * This function waits on a condition variable either until - * awakened by a signal or broadcast; or until the time - * specified by abstime passes. - * - * NOTES: - * 1) The function must be called with 'mutex' LOCKED - * by the calling thread, or undefined behaviour - * will result. - * - * 2) This routine atomically releases 'mutex' and causes - * the calling thread to block on the condition variable. - * The blocked thread may be awakened by - * pthread_cond_signal or - * pthread_cond_broadcast. - * - * - * RESULTS - * 0 caught condition; mutex released, - * EINVAL 'cond', 'mutex', or abstime is invalid, - * EINVAL different mutexes for concurrent waits, - * EINVAL mutex is not held by the calling thread, - * ETIMEDOUT abstime ellapsed before cond was signaled. - * - * ------------------------------------------------------ - */ -{ - if (abstime == NULL) - { - return EINVAL; - } - - return (ptw32_cond_timedwait (cond, mutex, abstime)); - -} /* pthread_cond_timedwait */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_destroy.c deleted file mode 100644 index 58a14828fd0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_destroy.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * condvar_attr_destroy.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_condattr_destroy (pthread_condattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Destroys a condition variable attributes object. - * The object can no longer be used. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_condattr_t - * - * - * DESCRIPTION - * Destroys a condition variable attributes object. - * The object can no longer be used. - * - * NOTES: - * 1) Does not affect condition variables created - * using 'attr' - * - * RESULTS - * 0 successfully released attr, - * EINVAL 'attr' is invalid. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - - if (attr == NULL || *attr == NULL) - { - result = EINVAL; - } - else - { - (void) free (*attr); - - *attr = NULL; - result = 0; - } - - return result; - -} /* pthread_condattr_destroy */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_getpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_getpshared.c deleted file mode 100644 index a0ac6d88292..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_getpshared.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * pthread_condattr_getpshared.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_condattr_getpshared (const pthread_condattr_t * attr, int *pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Determine whether condition variables created with 'attr' - * can be shared between processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_condattr_t - * - * pshared - * will be set to one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * - * DESCRIPTION - * Condition Variables created with 'attr' can be shared - * between processes if pthread_cond_t variable is allocated - * in memory shared by these processes. - * NOTES: - * 1) pshared condition variables MUST be allocated in - * shared memory. - * - * 2) The following macro is defined if shared mutexes - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully retrieved attribute, - * EINVAL 'attr' or 'pshared' is invalid, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && (pshared != NULL)) - { - *pshared = (*attr)->pshared; - result = 0; - } - else - { - result = EINVAL; - } - - return result; - -} /* pthread_condattr_getpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_init.c deleted file mode 100644 index 5987878e0c6..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_init.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * pthread_condattr_init.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_condattr_init (pthread_condattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Initializes a condition variable attributes object - * with default attributes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_condattr_t - * - * - * DESCRIPTION - * Initializes a condition variable attributes object - * with default attributes. - * - * NOTES: - * 1) Use to define condition variable types - * 2) It is up to the application to ensure - * that it doesn't re-init an attribute - * without destroying it first. Otherwise - * a memory leak is created. - * - * RESULTS - * 0 successfully initialized attr, - * ENOMEM insufficient memory for attr. - * - * ------------------------------------------------------ - */ -{ - pthread_condattr_t attr_result; - int result = 0; - - attr_result = (pthread_condattr_t) calloc (1, sizeof (*attr_result)); - - if (attr_result == NULL) - { - result = ENOMEM; - } - - *attr = attr_result; - - return result; - -} /* pthread_condattr_init */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_setpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_setpshared.c deleted file mode 100644 index 954fb382990..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_condattr_setpshared.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * pthread_condattr_setpshared.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_condattr_setpshared (pthread_condattr_t * attr, int pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Mutexes created with 'attr' can be shared between - * processes if pthread_mutex_t variable is allocated - * in memory shared by these processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_mutexattr_t - * - * pshared - * must be one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * DESCRIPTION - * Mutexes creatd with 'attr' can be shared between - * processes if pthread_mutex_t variable is allocated - * in memory shared by these processes. - * - * NOTES: - * 1) pshared mutexes MUST be allocated in shared - * memory. - * - * 2) The following macro is defined if shared mutexes - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully set attribute, - * EINVAL 'attr' or pshared is invalid, - * ENOSYS PTHREAD_PROCESS_SHARED not supported, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) - && ((pshared == PTHREAD_PROCESS_SHARED) - || (pshared == PTHREAD_PROCESS_PRIVATE))) - { - if (pshared == PTHREAD_PROCESS_SHARED) - { - -#if !defined( _POSIX_THREAD_PROCESS_SHARED ) - result = ENOSYS; - pshared = PTHREAD_PROCESS_PRIVATE; -#else - result = 0; - -#endif /* _POSIX_THREAD_PROCESS_SHARED */ - - } - else - { - result = 0; - } - - (*attr)->pshared = pshared; - } - else - { - result = EINVAL; - } - - return result; - -} /* pthread_condattr_setpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_delay_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_delay_np.c deleted file mode 100644 index 7fe9ae0166b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_delay_np.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * pthreads_delay_np.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * pthread_delay_np - * - * DESCRIPTION - * - * This routine causes a thread to delay execution for a specific period of time. - * This period ends at the current time plus the specified interval. The routine - * will not return before the end of the period is reached, but may return an - * arbitrary amount of time after the period has gone by. This can be due to - * system load, thread priorities, and system timer granularity. - * - * Specifying an interval of zero (0) seconds and zero (0) nanoseconds is - * allowed and can be used to force the thread to give up the processor or to - * deliver a pending cancelation request. - * - * The timespec structure contains the following two fields: - * - * tv_sec is an integer number of seconds. - * tv_nsec is an integer number of nanoseconds. - * - * Return Values - * - * If an error condition occurs, this routine returns an integer value indicating - * the type of error. Possible return values are as follows: - * - * 0 - * Successful completion. - * [EINVAL] - * The value specified by interval is invalid. - * - * Example - * - * The following code segment would wait for 5 and 1/2 seconds - * - * struct timespec tsWait; - * int intRC; - * - * tsWait.tv_sec = 5; - * tsWait.tv_nsec = 500000000L; - * intRC = pthread_delay_np(&tsWait); - */ -int -pthread_delay_np (struct timespec *interval) -{ - DWORD wait_time; - DWORD secs_in_millisecs; - DWORD millisecs; - DWORD status; - pthread_t self; - ptw32_thread_t * sp; - - if (interval == NULL) - { - return EINVAL; - } - - if (interval->tv_sec == 0L && interval->tv_nsec == 0L) - { - pthread_testcancel (); - Sleep (0); - pthread_testcancel (); - return (0); - } - - /* convert secs to millisecs */ - secs_in_millisecs = interval->tv_sec * 1000L; - - /* convert nanosecs to millisecs (rounding up) */ - millisecs = (interval->tv_nsec + 999999L) / 1000000L; - -#if defined(__WATCOMC__) -#pragma disable_message (124) -#endif - - /* - * Most compilers will issue a warning 'comparison always 0' - * because the variable type is unsigned, but we need to keep this - * for some reason I can't recall now. - */ - if (0 > (wait_time = secs_in_millisecs + millisecs)) - { - return EINVAL; - } - -#if defined(__WATCOMC__) -#pragma enable_message (124) -#endif - - if (NULL == (self = pthread_self ()).p) - { - return ENOMEM; - } - - sp = (ptw32_thread_t *) self.p; - - if (sp->cancelState == PTHREAD_CANCEL_ENABLE) - { - /* - * Async cancelation won't catch us until wait_time is up. - * Deferred cancelation will cancel us immediately. - */ - if (WAIT_OBJECT_0 == - (status = WaitForSingleObject (sp->cancelEvent, wait_time))) - { - /* - * Canceling! - */ - (void) pthread_mutex_lock (&sp->cancelLock); - if (sp->state < PThreadStateCanceling) - { - sp->state = PThreadStateCanceling; - sp->cancelState = PTHREAD_CANCEL_DISABLE; - (void) pthread_mutex_unlock (&sp->cancelLock); - - ptw32_throw (PTW32_EPS_CANCEL); - } - - (void) pthread_mutex_unlock (&sp->cancelLock); - return ESRCH; - } - else if (status != WAIT_TIMEOUT) - { - return EINVAL; - } - } - else - { - Sleep (wait_time); - } - - return (0); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_detach.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_detach.c deleted file mode 100644 index 00fb6adfb6d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_detach.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * pthread_detach.c - * - * Description: - * This translation unit implements functions related to thread - * synchronisation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * Not needed yet, but defining it should indicate clashes with build target - * environment that should be fixed. - */ -#include - - -int -pthread_detach (pthread_t thread) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function detaches the given thread. - * - * PARAMETERS - * thread - * an instance of a pthread_t - * - * - * DESCRIPTION - * This function detaches the given thread. You may use it to - * detach the main thread or to detach a joinable thread. - * NOTE: detached threads cannot be joined; - * storage is freed immediately on termination. - * - * RESULTS - * 0 successfully detached the thread, - * EINVAL thread is not a joinable thread, - * ENOSPC a required resource has been exhausted, - * ESRCH no thread could be found for 'thread', - * - * ------------------------------------------------------ - */ -{ - int result; - BOOL destroyIt = PTW32_FALSE; - ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; - - EnterCriticalSection (&ptw32_thread_reuse_lock); - - if (NULL == tp - || thread.x != tp->ptHandle.x) - { - result = ESRCH; - } - else if (PTHREAD_CREATE_DETACHED == tp->detachState) - { - result = EINVAL; - } - else - { - /* - * Joinable ptw32_thread_t structs are not scavenged until - * a join or detach is done. The thread may have exited already, - * but all of the state and locks etc are still there. - */ - result = 0; - - if (pthread_mutex_lock (&tp->cancelLock) == 0) - { - if (tp->state != PThreadStateLast) - { - tp->detachState = PTHREAD_CREATE_DETACHED; - } - else if (tp->detachState != PTHREAD_CREATE_DETACHED) - { - /* - * Thread is joinable and has exited or is exiting. - */ - destroyIt = PTW32_TRUE; - } - (void) pthread_mutex_unlock (&tp->cancelLock); - } - else - { - /* cancelLock shouldn't fail, but if it does ... */ - result = ESRCH; - } - } - - LeaveCriticalSection (&ptw32_thread_reuse_lock); - - if (result == 0) - { - /* Thread is joinable */ - - if (destroyIt) - { - /* The thread has exited or is exiting but has not been joined or - * detached. Need to wait in case it's still exiting. - */ - (void) WaitForSingleObject(tp->threadH, INFINITE); - ptw32_threadDestroy (thread); - } - } - - return (result); - -} /* pthread_detach */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_equal.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_equal.c deleted file mode 100644 index f96372edb8d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_equal.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * pthread_equal.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_equal (pthread_t t1, pthread_t t2) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function returns nonzero if t1 and t2 are equal, else - * returns nonzero - * - * PARAMETERS - * t1, - * t2 - * thread IDs - * - * - * DESCRIPTION - * This function returns nonzero if t1 and t2 are equal, else - * returns zero. - * - * RESULTS - * non-zero if t1 and t2 refer to the same thread, - * 0 t1 and t2 do not refer to the same thread - * - * ------------------------------------------------------ - */ -{ - int result; - - /* - * We also accept NULL == NULL - treating NULL as a thread - * for this special case, because there is no error that we can return. - */ - result = ( t1.p == t2.p && t1.x == t2.x ); - - return (result); - -} /* pthread_equal */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_exit.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_exit.c deleted file mode 100644 index a4903129b68..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_exit.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * pthread_exit.c - * - * Description: - * This translation unit implements routines associated with exiting from - * a thread. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#ifndef _UWIN -//# include -#endif - -void -pthread_exit (void *value_ptr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function terminates the calling thread, returning - * the value 'value_ptr' to any joining thread. - * - * PARAMETERS - * value_ptr - * a generic data value (i.e. not the address of a value) - * - * - * DESCRIPTION - * This function terminates the calling thread, returning - * the value 'value_ptr' to any joining thread. - * NOTE: thread should be joinable. - * - * RESULTS - * N/A - * - * ------------------------------------------------------ - */ -{ - ptw32_thread_t * sp; - - /* - * Don't use pthread_self() to avoid creating an implicit POSIX thread handle - * unnecessarily. - */ - sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey); - -#ifdef _UWIN - if (--pthread_count <= 0) - exit ((int) value_ptr); -#endif - - if (NULL == sp) - { - /* - * A POSIX thread handle was never created. I.e. this is a - * Win32 thread that has never called a pthreads-win32 routine that - * required a POSIX handle. - * - * Implicit POSIX handles are cleaned up in ptw32_throw() now. - */ - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) - _endthreadex ((unsigned) value_ptr); -#else - _endthread (); -#endif - - /* Never reached */ - } - - sp->exitStatus = value_ptr; - - ptw32_throw (PTW32_EPS_EXIT); - - /* Never reached. */ - -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getconcurrency.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getconcurrency.c deleted file mode 100644 index cf9e9c85c27..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getconcurrency.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * pthread_getconcurrency.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_getconcurrency (void) -{ - return ptw32_concurrency; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getschedparam.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getschedparam.c deleted file mode 100644 index 0afcfb74a97..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getschedparam.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * sched_getschedparam.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_getschedparam (pthread_t thread, int *policy, - struct sched_param *param) -{ - int result; - - /* Validate the thread id. */ - result = pthread_kill (thread, 0); - if (0 != result) - { - return result; - } - - /* - * Validate the policy and param args. - * Check that a policy constant wasn't passed rather than &policy. - */ - if (policy <= (int *) SCHED_MAX || param == NULL) - { - return EINVAL; - } - - /* Fill out the policy. */ - *policy = SCHED_OTHER; - - /* - * This function must return the priority value set by - * the most recent pthread_setschedparam() or pthread_create() - * for the target thread. It must not return the actual thread - * priority as altered by any system priority adjustments etc. - */ - param->sched_priority = ((ptw32_thread_t *)thread.p)->sched_priority; - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getspecific.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getspecific.c deleted file mode 100644 index b05ff410acd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getspecific.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * pthread_getspecific.c - * - * Description: - * POSIX thread functions which implement thread-specific data (TSD). - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -void * -pthread_getspecific (pthread_key_t key) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function returns the current value of key in the - * calling thread. If no value has been set for 'key' in - * the thread, NULL is returned. - * - * PARAMETERS - * key - * an instance of pthread_key_t - * - * - * DESCRIPTION - * This function returns the current value of key in the - * calling thread. If no value has been set for 'key' in - * the thread, NULL is returned. - * - * RESULTS - * key value or NULL on failure - * - * ------------------------------------------------------ - */ -{ - void * ptr; - - if (key == NULL) - { - ptr = NULL; - } - else - { - int lasterror = GetLastError (); - int lastWSAerror = WSAGetLastError (); - - ptr = TlsGetValue (key->key); - - SetLastError (lasterror); - WSASetLastError (lastWSAerror); - } - - return ptr; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getw32threadhandle_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getw32threadhandle_np.c deleted file mode 100644 index 9d22def3b45..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_getw32threadhandle_np.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * pthread_getw32threadhandle_np.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * pthread_getw32threadhandle_np() - * - * Returns the win32 thread handle that the POSIX - * thread "thread" is running as. - * - * Applications can use the win32 handle to set - * win32 specific attributes of the thread. - */ -HANDLE -pthread_getw32threadhandle_np (pthread_t thread) -{ - return ((ptw32_thread_t *)thread.p)->threadH; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_join.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_join.c deleted file mode 100644 index 8237b6cf77c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_join.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * pthread_join.c - * - * Description: - * This translation unit implements functions related to thread - * synchronisation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * Not needed yet, but defining it should indicate clashes with build target - * environment that should be fixed. - */ -#include - - -int -pthread_join (pthread_t thread, void **value_ptr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function waits for 'thread' to terminate and - * returns the thread's exit value if 'value_ptr' is not - * NULL. This also detaches the thread on successful - * completion. - * - * PARAMETERS - * thread - * an instance of pthread_t - * - * value_ptr - * pointer to an instance of pointer to void - * - * - * DESCRIPTION - * This function waits for 'thread' to terminate and - * returns the thread's exit value if 'value_ptr' is not - * NULL. This also detaches the thread on successful - * completion. - * NOTE: detached threads cannot be joined or canceled - * - * RESULTS - * 0 'thread' has completed - * EINVAL thread is not a joinable thread, - * ESRCH no thread could be found with ID 'thread', - * ENOENT thread couldn't find it's own valid handle, - * EDEADLK attempt to join thread with self - * - * ------------------------------------------------------ - */ -{ - int result; - pthread_t self; - ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; - - EnterCriticalSection (&ptw32_thread_reuse_lock); - - if (NULL == tp - || thread.x != tp->ptHandle.x) - { - result = ESRCH; - } - else if (PTHREAD_CREATE_DETACHED == tp->detachState) - { - result = EINVAL; - } - else - { - result = 0; - } - - LeaveCriticalSection (&ptw32_thread_reuse_lock); - - if (result == 0) - { - /* - * The target thread is joinable and can't be reused before we join it. - */ - self = pthread_self(); - - if (NULL == self.p) - { - result = ENOENT; - } - else if (pthread_equal (self, thread)) - { - result = EDEADLK; - } - else - { - /* - * Pthread_join is a cancelation point. - * If we are canceled then our target thread must not be - * detached (destroyed). This is guarranteed because - * pthreadCancelableWait will not return if we - * are canceled. - */ - result = pthreadCancelableWait (tp->threadH); - - if (0 == result) - { - if (value_ptr != NULL) - { - *value_ptr = tp->exitStatus; - } - - /* - * The result of making multiple simultaneous calls to - * pthread_join() or pthread_detach() specifying the same - * target is undefined. - */ - result = pthread_detach (thread); - } - else - { - result = ESRCH; - } - } - } - - return (result); - -} /* pthread_join */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_key_create.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_key_create.c deleted file mode 100644 index 5e278c2ca7f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_key_create.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * pthread_key_create.c - * - * Description: - * POSIX thread functions which implement thread-specific data (TSD). - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -/* TLS_OUT_OF_INDEXES not defined on WinCE */ -#ifndef TLS_OUT_OF_INDEXES -#define TLS_OUT_OF_INDEXES 0xffffffff -#endif - -int -pthread_key_create (pthread_key_t * key, void (*destructor) (void *)) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function creates a thread-specific data key visible - * to all threads. All existing and new threads have a value - * NULL for key until set using pthread_setspecific. When any - * thread with a non-NULL value for key terminates, 'destructor' - * is called with key's current value for that thread. - * - * PARAMETERS - * key - * pointer to an instance of pthread_key_t - * - * - * DESCRIPTION - * This function creates a thread-specific data key visible - * to all threads. All existing and new threads have a value - * NULL for key until set using pthread_setspecific. When any - * thread with a non-NULL value for key terminates, 'destructor' - * is called with key's current value for that thread. - * - * RESULTS - * 0 successfully created semaphore, - * EAGAIN insufficient resources or PTHREAD_KEYS_MAX - * exceeded, - * ENOMEM insufficient memory to create the key, - * - * ------------------------------------------------------ - */ -{ - int result = 0; - pthread_key_t newkey; - - if ((newkey = (pthread_key_t) calloc (1, sizeof (*newkey))) == NULL) - { - result = ENOMEM; - } - else if ((newkey->key = TlsAlloc ()) == TLS_OUT_OF_INDEXES) - { - result = EAGAIN; - - free (newkey); - newkey = NULL; - } - else if (destructor != NULL) - { - /* - * Have to manage associations between thread and key; - * Therefore, need a lock that allows multiple threads - * to gain exclusive access to the key->threads list. - * - * The mutex will only be created when it is first locked. - */ - newkey->keyLock = PTHREAD_MUTEX_INITIALIZER; - newkey->destructor = destructor; - } - - *key = newkey; - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_key_delete.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_key_delete.c deleted file mode 100644 index 7da9b2fb6d0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_key_delete.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * pthread_key_delete.c - * - * Description: - * POSIX thread functions which implement thread-specific data (TSD). - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_key_delete (pthread_key_t key) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function deletes a thread-specific data key. This - * does not change the value of the thread specific data key - * for any thread and does not run the key's destructor - * in any thread so it should be used with caution. - * - * PARAMETERS - * key - * pointer to an instance of pthread_key_t - * - * - * DESCRIPTION - * This function deletes a thread-specific data key. This - * does not change the value of the thread specific data key - * for any thread and does not run the key's destructor - * in any thread so it should be used with caution. - * - * RESULTS - * 0 successfully deleted the key, - * EINVAL key is invalid, - * - * ------------------------------------------------------ - */ -{ - int result = 0; - - if (key != NULL) - { - if (key->threads != NULL && - key->destructor != NULL && - pthread_mutex_lock (&(key->keyLock)) == 0) - { - ThreadKeyAssoc *assoc; - /* - * Run through all Thread<-->Key associations - * for this key. - * - * While we hold at least one of the locks guarding - * the assoc, we know that the assoc pointed to by - * key->threads is valid. - */ - while ((assoc = (ThreadKeyAssoc *) key->threads) != NULL) - { - ptw32_thread_t * thread = assoc->thread; - - if (assoc == NULL) - { - /* Finished */ - break; - } - - if (pthread_mutex_lock (&(thread->threadLock)) == 0) - { - /* - * Since we are starting at the head of the key's threads - * chain, this will also point key->threads at the next assoc. - * While we hold key->keyLock, no other thread can insert - * a new assoc via pthread_setspecific. - */ - ptw32_tkAssocDestroy (assoc); - (void) pthread_mutex_unlock (&(thread->threadLock)); - } - else - { - /* Thread or lock is no longer valid? */ - ptw32_tkAssocDestroy (assoc); - } - } - pthread_mutex_unlock (&(key->keyLock)); - } - - TlsFree (key->key); - if (key->destructor != NULL) - { - /* A thread could be holding the keyLock */ - while (EBUSY == pthread_mutex_destroy (&(key->keyLock))) - { - Sleep(1); // Ugly. - } - } - -#if defined( _DEBUG ) - memset ((char *) key, 0, sizeof (*key)); -#endif - free (key); - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_kill.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_kill.c deleted file mode 100644 index 7de3fe2aa78..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_kill.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * pthread_kill.c - * - * Description: - * This translation unit implements the pthread_kill routine. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * Not needed yet, but defining it should indicate clashes with build target - * environment that should be fixed. - */ -#include - -int -pthread_kill (pthread_t thread, int sig) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function requests that a signal be delivered to the - * specified thread. If sig is zero, error checking is - * performed but no signal is actually sent such that this - * function can be used to check for a valid thread ID. - * - * PARAMETERS - * thread reference to an instances of pthread_t - * sig signal. Currently only a value of 0 is supported. - * - * - * DESCRIPTION - * This function requests that a signal be delivered to the - * specified thread. If sig is zero, error checking is - * performed but no signal is actually sent such that this - * function can be used to check for a valid thread ID. - * - * RESULTS - * ESRCH the thread is not a valid thread ID, - * EINVAL the value of the signal is invalid - * or unsupported. - * 0 the signal was successfully sent. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - ptw32_thread_t * tp; - - EnterCriticalSection (&ptw32_thread_reuse_lock); - - tp = (ptw32_thread_t *) thread.p; - - if (NULL == tp - || thread.x != tp->ptHandle.x - || NULL == tp->threadH) - { - result = ESRCH; - } - - LeaveCriticalSection (&ptw32_thread_reuse_lock); - - if (0 == result && 0 != sig) - { - /* - * Currently does not support any signals. - */ - result = EINVAL; - } - - return result; - -} /* pthread_kill */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_destroy.c deleted file mode 100644 index 95509b3df6d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_destroy.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * pthread_mutex_destroy.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutex_destroy (pthread_mutex_t * mutex) -{ - int result = 0; - pthread_mutex_t mx; - - /* - * Let the system deal with invalid pointers. - */ - - /* - * Check to see if we have something to delete. - */ - if (*mutex < PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - mx = *mutex; - - result = pthread_mutex_trylock (&mx); - - /* - * If trylock succeeded and the mutex is not recursively locked it - * can be destroyed. - */ - if (result == 0) - { - if (mx->kind != PTHREAD_MUTEX_RECURSIVE || 1 == mx->recursive_count) - { - /* - * FIXME!!! - * The mutex isn't held by another thread but we could still - * be too late invalidating the mutex below since another thread - * may already have entered mutex_lock and the check for a valid - * *mutex != NULL. - * - * Note that this would be an unusual situation because it is not - * common that mutexes are destroyed while they are still in - * use by other threads. - */ - *mutex = NULL; - - result = pthread_mutex_unlock (&mx); - - if (result == 0) - { - if (!CloseHandle (mx->event)) - { - *mutex = mx; - result = EINVAL; - } - else - { - free (mx); - } - } - else - { - /* - * Restore the mutex before we return the error. - */ - *mutex = mx; - } - } - else /* mx->recursive_count > 1 */ - { - /* - * The mutex must be recursive and already locked by us (this thread). - */ - mx->recursive_count--; /* Undo effect of pthread_mutex_trylock() above */ - result = EBUSY; - } - } - } - else - { - /* - * See notes in ptw32_mutex_check_need_init() above also. - */ - EnterCriticalSection (&ptw32_mutex_test_init_lock); - - /* - * Check again. - */ - if (*mutex >= PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - /* - * This is all we need to do to destroy a statically - * initialised mutex that has not yet been used (initialised). - * If we get to here, another thread - * waiting to initialise this mutex will get an EINVAL. - */ - *mutex = NULL; - } - else - { - /* - * The mutex has been initialised while we were waiting - * so assume it's in use. - */ - result = EBUSY; - } - - LeaveCriticalSection (&ptw32_mutex_test_init_lock); - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_init.c deleted file mode 100644 index cff8e5054b5..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_init.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * pthread_mutex_init.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t * attr) -{ - int result = 0; - pthread_mutex_t mx; - - if (mutex == NULL) - { - return EINVAL; - } - - if (attr != NULL - && *attr != NULL && (*attr)->pshared == PTHREAD_PROCESS_SHARED) - { - /* - * Creating mutex that can be shared between - * processes. - */ -#if _POSIX_THREAD_PROCESS_SHARED >= 0 - - /* - * Not implemented yet. - */ - -#error ERROR [__FILE__, line __LINE__]: Process shared mutexes are not supported yet. - -#else - - return ENOSYS; - -#endif /* _POSIX_THREAD_PROCESS_SHARED */ - - } - - mx = (pthread_mutex_t) calloc (1, sizeof (*mx)); - - if (mx == NULL) - { - result = ENOMEM; - } - else - { - mx->lock_idx = 0; - mx->recursive_count = 0; - mx->kind = (attr == NULL || *attr == NULL - ? PTHREAD_MUTEX_DEFAULT : (*attr)->kind); - mx->ownerThread.p = NULL; - - mx->event = CreateEvent (NULL, PTW32_FALSE, /* manual reset = No */ - PTW32_FALSE, /* initial state = not signaled */ - NULL); /* event name */ - - if (0 == mx->event) - { - result = ENOSPC; - free (mx); - mx = NULL; - } - } - - *mutex = mx; - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_lock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_lock.c deleted file mode 100644 index 4ca5c252fea..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_lock.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * pthread_mutex_lock.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _UWIN -//# include -#endif -#include "pthread.h" -#include "implement.h" - -int -pthread_mutex_lock (pthread_mutex_t * mutex) -{ - int result = 0; - pthread_mutex_t mx; - - /* - * Let the system deal with invalid pointers. - */ - if (*mutex == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static mutex. We check - * again inside the guarded section of ptw32_mutex_check_need_init() - * to avoid race conditions. - */ - if (*mutex >= PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - if ((result = ptw32_mutex_check_need_init (mutex)) != 0) - { - return (result); - } - } - - mx = *mutex; - - if (mx->kind == PTHREAD_MUTEX_NORMAL) - { - if ((LONG) PTW32_INTERLOCKED_EXCHANGE( - (LPLONG) &mx->lock_idx, - (LONG) 1) != 0) - { - while ((LONG) PTW32_INTERLOCKED_EXCHANGE( - (LPLONG) &mx->lock_idx, - (LONG) -1) != 0) - { - if (WAIT_OBJECT_0 != WaitForSingleObject (mx->event, INFINITE)) - { - result = EINVAL; - break; - } - } - } - } - else - { - pthread_t self = pthread_self(); - - if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE( - (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx, - (PTW32_INTERLOCKED_LONG) 1, - (PTW32_INTERLOCKED_LONG) 0) == 0) - { - mx->recursive_count = 1; - mx->ownerThread = self; - } - else - { - if (pthread_equal (mx->ownerThread, self)) - { - if (mx->kind == PTHREAD_MUTEX_RECURSIVE) - { - mx->recursive_count++; - } - else - { - result = EDEADLK; - } - } - else - { - while ((LONG) PTW32_INTERLOCKED_EXCHANGE( - (LPLONG) &mx->lock_idx, - (LONG) -1) != 0) - { - if (WAIT_OBJECT_0 != WaitForSingleObject (mx->event, INFINITE)) - { - result = EINVAL; - break; - } - } - - if (0 == result) - { - mx->recursive_count = 1; - mx->ownerThread = self; - } - } - } - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_timedlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_timedlock.c deleted file mode 100644 index a2385522d5e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_timedlock.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * pthread_mutex_timedlock.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -static INLINE int -ptw32_timed_eventwait (HANDLE event, const struct timespec *abstime) - /* - * ------------------------------------------------------ - * DESCRIPTION - * This function waits on an event until signaled or until - * abstime passes. - * If abstime has passed when this routine is called then - * it returns a result to indicate this. - * - * If 'abstime' is a NULL pointer then this function will - * block until it can successfully decrease the value or - * until interrupted by a signal. - * - * This routine is not a cancelation point. - * - * RESULTS - * 0 successfully signaled, - * ETIMEDOUT abstime passed - * EINVAL 'event' is not a valid event, - * - * ------------------------------------------------------ - */ -{ - - DWORD milliseconds; - DWORD status; - - if (event == NULL) - { - return EINVAL; - } - else - { - if (abstime == NULL) - { - milliseconds = INFINITE; - } - else - { - /* - * Calculate timeout as milliseconds from current system time. - */ - milliseconds = ptw32_relmillisecs (abstime); - } - - status = WaitForSingleObject (event, milliseconds); - - if (status == WAIT_OBJECT_0) - { - return 0; - } - else if (status == WAIT_TIMEOUT) - { - return ETIMEDOUT; - } - else - { - return EINVAL; - } - } - - return 0; - -} /* ptw32_timed_semwait */ - - -int -pthread_mutex_timedlock (pthread_mutex_t * mutex, - const struct timespec *abstime) -{ - int result; - pthread_mutex_t mx; - - /* - * Let the system deal with invalid pointers. - */ - - /* - * We do a quick check to see if we need to do more work - * to initialise a static mutex. We check - * again inside the guarded section of ptw32_mutex_check_need_init() - * to avoid race conditions. - */ - if (*mutex >= PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - if ((result = ptw32_mutex_check_need_init (mutex)) != 0) - { - return (result); - } - } - - mx = *mutex; - - if (mx->kind == PTHREAD_MUTEX_NORMAL) - { - if ((LONG) PTW32_INTERLOCKED_EXCHANGE( - (LPLONG) &mx->lock_idx, - (LONG) 1) != 0) - { - while ((LONG) PTW32_INTERLOCKED_EXCHANGE( - (LPLONG) &mx->lock_idx, - (LONG) -1) != 0) - { - if (0 != (result = ptw32_timed_eventwait (mx->event, abstime))) - { - return result; - } - } - } - } - else - { - pthread_t self = pthread_self(); - - if ((PTW32_INTERLOCKED_LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE( - (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx, - (PTW32_INTERLOCKED_LONG) 1, - (PTW32_INTERLOCKED_LONG) 0) == 0) - { - mx->recursive_count = 1; - mx->ownerThread = self; - } - else - { - if (pthread_equal (mx->ownerThread, self)) - { - if (mx->kind == PTHREAD_MUTEX_RECURSIVE) - { - mx->recursive_count++; - } - else - { - return EDEADLK; - } - } - else - { - while ((LONG) PTW32_INTERLOCKED_EXCHANGE( - (LPLONG) &mx->lock_idx, - (LONG) -1) != 0) - { - if (0 != (result = ptw32_timed_eventwait (mx->event, abstime))) - { - return result; - } - } - - mx->recursive_count = 1; - mx->ownerThread = self; - } - } - } - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_trylock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_trylock.c deleted file mode 100644 index 50e8bc65cc1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_trylock.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * pthread_mutex_trylock.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutex_trylock (pthread_mutex_t * mutex) -{ - int result = 0; - pthread_mutex_t mx; - - /* - * Let the system deal with invalid pointers. - */ - - /* - * We do a quick check to see if we need to do more work - * to initialise a static mutex. We check - * again inside the guarded section of ptw32_mutex_check_need_init() - * to avoid race conditions. - */ - if (*mutex >= PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - if ((result = ptw32_mutex_check_need_init (mutex)) != 0) - { - return (result); - } - } - - mx = *mutex; - - if (0 == (LONG) PTW32_INTERLOCKED_COMPARE_EXCHANGE ( - (PTW32_INTERLOCKED_LPLONG) &mx->lock_idx, - (PTW32_INTERLOCKED_LONG) 1, - (PTW32_INTERLOCKED_LONG) 0)) - { - if (mx->kind != PTHREAD_MUTEX_NORMAL) - { - mx->recursive_count = 1; - mx->ownerThread = pthread_self (); - } - } - else - { - if (mx->kind == PTHREAD_MUTEX_RECURSIVE && - pthread_equal (mx->ownerThread, pthread_self ())) - { - mx->recursive_count++; - } - else - { - result = EBUSY; - } - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_unlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_unlock.c deleted file mode 100644 index 9ebe4e37819..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutex_unlock.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * pthread_mutex_unlock.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutex_unlock (pthread_mutex_t * mutex) -{ - int result = 0; - pthread_mutex_t mx; - - /* - * Let the system deal with invalid pointers. - */ - - mx = *mutex; - - /* - * If the thread calling us holds the mutex then there is no - * race condition. If another thread holds the - * lock then we shouldn't be in here. - */ - if (mx < PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - if (mx->kind == PTHREAD_MUTEX_NORMAL) - { - LONG idx; - - idx = (LONG) PTW32_INTERLOCKED_EXCHANGE ((LPLONG) &mx->lock_idx, - (LONG) 0); - if (idx != 0) - { - if (idx < 0) - { - /* - * Someone may be waiting on that mutex. - */ - if (SetEvent (mx->event) == 0) - { - result = EINVAL; - } - } - } - else - { - /* - * Was not locked (so can't be owned by us). - */ - result = EPERM; - } - } - else - { - if (pthread_equal (mx->ownerThread, pthread_self ())) - { - if (mx->kind != PTHREAD_MUTEX_RECURSIVE - || 0 == --mx->recursive_count) - { - mx->ownerThread.p = NULL; - - if ((LONG) PTW32_INTERLOCKED_EXCHANGE ((LPLONG) &mx->lock_idx, - (LONG) 0) < 0) - { - /* Someone may be waiting on that mutex */ - if (SetEvent (mx->event) == 0) - { - result = EINVAL; - } - } - } - } - else - { - result = EPERM; - } - } - } - else - { - result = EINVAL; - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_destroy.c deleted file mode 100644 index 9d424bfa287..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_destroy.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * pthread_mutexattr_destroy.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutexattr_destroy (pthread_mutexattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Destroys a mutex attributes object. The object can - * no longer be used. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_mutexattr_t - * - * - * DESCRIPTION - * Destroys a mutex attributes object. The object can - * no longer be used. - * - * NOTES: - * 1) Does not affect mutexes created using 'attr' - * - * RESULTS - * 0 successfully released attr, - * EINVAL 'attr' is invalid. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - - if (attr == NULL || *attr == NULL) - { - result = EINVAL; - } - else - { - pthread_mutexattr_t ma = *attr; - - *attr = NULL; - free (ma); - } - - return (result); -} /* pthread_mutexattr_destroy */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_getkind_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_getkind_np.c deleted file mode 100644 index 2d82ec6bc7c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_getkind_np.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * pthread_mutexattr_getkind_np.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -int -pthread_mutexattr_getkind_np (pthread_mutexattr_t * attr, int *kind) -{ - return pthread_mutexattr_gettype (attr, kind); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_getpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_getpshared.c deleted file mode 100644 index 42f9589c519..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_getpshared.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * pthread_mutexattr_getpshared.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutexattr_getpshared (const pthread_mutexattr_t * attr, int *pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Determine whether mutexes created with 'attr' can be - * shared between processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_mutexattr_t - * - * pshared - * will be set to one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * - * DESCRIPTION - * Mutexes creatd with 'attr' can be shared between - * processes if pthread_mutex_t variable is allocated - * in memory shared by these processes. - * NOTES: - * 1) pshared mutexes MUST be allocated in shared - * memory. - * 2) The following macro is defined if shared mutexes - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully retrieved attribute, - * EINVAL 'attr' is invalid, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && (pshared != NULL)) - { - *pshared = (*attr)->pshared; - result = 0; - } - else - { - result = EINVAL; - } - - return (result); - -} /* pthread_mutexattr_getpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_gettype.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_gettype.c deleted file mode 100644 index b60ca30bf01..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_gettype.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * pthread_mutexattr_gettype.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind) -{ - int result = 0; - - if (attr != NULL && *attr != NULL && kind != NULL) - { - *kind = (*attr)->kind; - } - else - { - result = EINVAL; - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_init.c deleted file mode 100644 index d2797ff2482..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_init.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * pthread_mutexattr_init.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutexattr_init (pthread_mutexattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Initializes a mutex attributes object with default - * attributes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_mutexattr_t - * - * - * DESCRIPTION - * Initializes a mutex attributes object with default - * attributes. - * - * NOTES: - * 1) Used to define mutex types - * - * RESULTS - * 0 successfully initialized attr, - * ENOMEM insufficient memory for attr. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - pthread_mutexattr_t ma; - - ma = (pthread_mutexattr_t) calloc (1, sizeof (*ma)); - - if (ma == NULL) - { - result = ENOMEM; - } - else - { - ma->pshared = PTHREAD_PROCESS_PRIVATE; - ma->kind = PTHREAD_MUTEX_DEFAULT; - } - - *attr = ma; - - return (result); -} /* pthread_mutexattr_init */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_setkind_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_setkind_np.c deleted file mode 100644 index faa936658f7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_setkind_np.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * pthread_mutexattr_setkind_np.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -int -pthread_mutexattr_setkind_np (pthread_mutexattr_t * attr, int kind) -{ - return pthread_mutexattr_settype (attr, kind); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_setpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_setpshared.c deleted file mode 100644 index cfa6f719946..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_setpshared.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * pthread_mutexattr_setpshared.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, int pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Mutexes created with 'attr' can be shared between - * processes if pthread_mutex_t variable is allocated - * in memory shared by these processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_mutexattr_t - * - * pshared - * must be one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * DESCRIPTION - * Mutexes creatd with 'attr' can be shared between - * processes if pthread_mutex_t variable is allocated - * in memory shared by these processes. - * - * NOTES: - * 1) pshared mutexes MUST be allocated in shared - * memory. - * - * 2) The following macro is defined if shared mutexes - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully set attribute, - * EINVAL 'attr' or pshared is invalid, - * ENOSYS PTHREAD_PROCESS_SHARED not supported, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && - ((pshared == PTHREAD_PROCESS_SHARED) || - (pshared == PTHREAD_PROCESS_PRIVATE))) - { - if (pshared == PTHREAD_PROCESS_SHARED) - { - -#if !defined( _POSIX_THREAD_PROCESS_SHARED ) - - result = ENOSYS; - pshared = PTHREAD_PROCESS_PRIVATE; - -#else - - result = 0; - -#endif /* _POSIX_THREAD_PROCESS_SHARED */ - - } - else - { - result = 0; - } - - (*attr)->pshared = pshared; - } - else - { - result = EINVAL; - } - - return (result); - -} /* pthread_mutexattr_setpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_settype.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_settype.c deleted file mode 100644 index 8365daf65d2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_mutexattr_settype.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * pthread_mutexattr_settype.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind) - /* - * ------------------------------------------------------ - * - * DOCPUBLIC - * The pthread_mutexattr_settype() and - * pthread_mutexattr_gettype() functions respectively set and - * get the mutex type attribute. This attribute is set in the - * type parameter to these functions. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_mutexattr_t - * - * type - * must be one of: - * - * PTHREAD_MUTEX_DEFAULT - * - * PTHREAD_MUTEX_NORMAL - * - * PTHREAD_MUTEX_ERRORCHECK - * - * PTHREAD_MUTEX_RECURSIVE - * - * DESCRIPTION - * The pthread_mutexattr_settype() and - * pthread_mutexattr_gettype() functions respectively set and - * get the mutex type attribute. This attribute is set in the - * type parameter to these functions. The default value of the - * type attribute is PTHREAD_MUTEX_DEFAULT. - * - * The type of mutex is contained in the type attribute of the - * mutex attributes. Valid mutex types include: - * - * PTHREAD_MUTEX_NORMAL - * This type of mutex does not detect deadlock. A - * thread attempting to relock this mutex without - * first unlocking it will deadlock. Attempting to - * unlock a mutex locked by a different thread - * results in undefined behavior. Attempting to - * unlock an unlocked mutex results in undefined - * behavior. - * - * PTHREAD_MUTEX_ERRORCHECK - * This type of mutex provides error checking. A - * thread attempting to relock this mutex without - * first unlocking it will return with an error. A - * thread attempting to unlock a mutex which another - * thread has locked will return with an error. A - * thread attempting to unlock an unlocked mutex will - * return with an error. - * - * PTHREAD_MUTEX_DEFAULT - * Same as PTHREAD_MUTEX_NORMAL. - * - * PTHREAD_MUTEX_RECURSIVE - * A thread attempting to relock this mutex without - * first unlocking it will succeed in locking the - * mutex. The relocking deadlock which can occur with - * mutexes of type PTHREAD_MUTEX_NORMAL cannot occur - * with this type of mutex. Multiple locks of this - * mutex require the same number of unlocks to - * release the mutex before another thread can - * acquire the mutex. A thread attempting to unlock a - * mutex which another thread has locked will return - * with an error. A thread attempting to unlock an - * unlocked mutex will return with an error. This - * type of mutex is only supported for mutexes whose - * process shared attribute is - * PTHREAD_PROCESS_PRIVATE. - * - * RESULTS - * 0 successfully set attribute, - * EINVAL 'attr' or 'type' is invalid, - * - * ------------------------------------------------------ - */ -{ - int result = 0; - - if ((attr != NULL && *attr != NULL)) - { - switch (kind) - { - case PTHREAD_MUTEX_FAST_NP: - case PTHREAD_MUTEX_RECURSIVE_NP: - case PTHREAD_MUTEX_ERRORCHECK_NP: - (*attr)->kind = kind; - break; - default: - result = EINVAL; - break; - } - } - else - { - result = EINVAL; - } - - return (result); -} /* pthread_mutexattr_settype */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_num_processors_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_num_processors_np.c deleted file mode 100644 index 3067d117d31..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_num_processors_np.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * pthread_num_processors_np.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * pthread_num_processors_np() - * - * Get the number of CPUs available to the process. - */ -int -pthread_num_processors_np (void) -{ - int count; - - if (ptw32_getprocessors (&count) != 0) - { - count = 1; - } - - return (count); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_once.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_once.c deleted file mode 100644 index 96d45f29746..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_once.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * pthread_once.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -static void PTW32_CDECL -ptw32_once_on_init_cancel (void * arg) -{ - /* when the initting thread is cancelled we have to release the lock */ - ptw32_mcs_local_node_t *node = (ptw32_mcs_local_node_t *)arg; - ptw32_mcs_lock_release(node); -} - -int -pthread_once (pthread_once_t * once_control, void (*init_routine) (void)) -{ - if (once_control == NULL || init_routine == NULL) - { - return EINVAL; - } - - if (!InterlockedExchangeAdd((LPLONG)&once_control->done, 0)) /* MBR fence */ - { - ptw32_mcs_local_node_t node; - - ptw32_mcs_lock_acquire((ptw32_mcs_lock_t *)&once_control->lock, &node); - - if (!once_control->done) - { - -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - - pthread_cleanup_push(ptw32_once_on_init_cancel, (void *)&node); - (*init_routine)(); - pthread_cleanup_pop(0); - -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - once_control->done = PTW32_TRUE; - } - - ptw32_mcs_lock_release(&node); - } - - return 0; - -} /* pthread_once */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_destroy.c deleted file mode 100644 index 5a747ede06b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_destroy.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * pthread_rwlock_destroy.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_destroy (pthread_rwlock_t * rwlock) -{ - pthread_rwlock_t rwl; - int result = 0, result1 = 0, result2 = 0; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - if (*rwlock != PTHREAD_RWLOCK_INITIALIZER) - { - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = pthread_mutex_lock (&(rwl->mtxExclusiveAccess))) != 0) - { - return result; - } - - if ((result = - pthread_mutex_lock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - /* - * Check whether any threads own/wait for the lock (wait for ex.access); - * report "BUSY" if so. - */ - if (rwl->nExclusiveAccessCount > 0 - || rwl->nSharedAccessCount > rwl->nCompletedSharedAccessCount) - { - result = pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); - result1 = pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - result2 = EBUSY; - } - else - { - rwl->nMagic = 0; - - if ((result = - pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - pthread_mutex_unlock (&rwl->mtxExclusiveAccess); - return result; - } - - if ((result = - pthread_mutex_unlock (&(rwl->mtxExclusiveAccess))) != 0) - { - return result; - } - - *rwlock = NULL; /* Invalidate rwlock before anything else */ - result = pthread_cond_destroy (&(rwl->cndSharedAccessCompleted)); - result1 = pthread_mutex_destroy (&(rwl->mtxSharedAccessCompleted)); - result2 = pthread_mutex_destroy (&(rwl->mtxExclusiveAccess)); - (void) free (rwl); - } - } - else - { - /* - * See notes in ptw32_rwlock_check_need_init() above also. - */ - EnterCriticalSection (&ptw32_rwlock_test_init_lock); - - /* - * Check again. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - /* - * This is all we need to do to destroy a statically - * initialised rwlock that has not yet been used (initialised). - * If we get to here, another thread - * waiting to initialise this rwlock will get an EINVAL. - */ - *rwlock = NULL; - } - else - { - /* - * The rwlock has been initialised while we were waiting - * so assume it's in use. - */ - result = EBUSY; - } - - LeaveCriticalSection (&ptw32_rwlock_test_init_lock); - } - - return ((result != 0) ? result : ((result1 != 0) ? result1 : result2)); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_init.c deleted file mode 100644 index 3e3f448c074..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_init.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * pthread_rwlock_init.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_init (pthread_rwlock_t * rwlock, - const pthread_rwlockattr_t * attr) -{ - int result; - pthread_rwlock_t rwl = 0; - - if (rwlock == NULL) - { - return EINVAL; - } - - if (attr != NULL && *attr != NULL) - { - result = EINVAL; /* Not supported */ - goto DONE; - } - - rwl = (pthread_rwlock_t) calloc (1, sizeof (*rwl)); - - if (rwl == NULL) - { - result = ENOMEM; - goto DONE; - } - - rwl->nSharedAccessCount = 0; - rwl->nExclusiveAccessCount = 0; - rwl->nCompletedSharedAccessCount = 0; - - result = pthread_mutex_init (&rwl->mtxExclusiveAccess, NULL); - if (result != 0) - { - goto FAIL0; - } - - result = pthread_mutex_init (&rwl->mtxSharedAccessCompleted, NULL); - if (result != 0) - { - goto FAIL1; - } - - result = pthread_cond_init (&rwl->cndSharedAccessCompleted, NULL); - if (result != 0) - { - goto FAIL2; - } - - rwl->nMagic = PTW32_RWLOCK_MAGIC; - - result = 0; - goto DONE; - -FAIL2: - (void) pthread_mutex_destroy (&(rwl->mtxSharedAccessCompleted)); - -FAIL1: - (void) pthread_mutex_destroy (&(rwl->mtxExclusiveAccess)); - -FAIL0: - (void) free (rwl); - rwl = NULL; - -DONE: - *rwlock = rwl; - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_rdlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_rdlock.c deleted file mode 100644 index dba63ddfb54..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_rdlock.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * pthread_rwlock_rdlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_rdlock (pthread_rwlock_t * rwlock) -{ - int result; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static rwlock. We check - * again inside the guarded section of ptw32_rwlock_check_need_init() - * to avoid race conditions. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = ptw32_rwlock_check_need_init (rwlock); - - if (result != 0 && result != EBUSY) - { - return result; - } - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = pthread_mutex_lock (&(rwl->mtxExclusiveAccess))) != 0) - { - return result; - } - - if (++rwl->nSharedAccessCount == INT_MAX) - { - if ((result = - pthread_mutex_lock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - - if ((result = - pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - } - - return (pthread_mutex_unlock (&(rwl->mtxExclusiveAccess))); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_timedrdlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_timedrdlock.c deleted file mode 100644 index 93489502e18..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_timedrdlock.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * pthread_rwlock_timedrdlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_timedrdlock (pthread_rwlock_t * rwlock, - const struct timespec *abstime) -{ - int result; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static rwlock. We check - * again inside the guarded section of ptw32_rwlock_check_need_init() - * to avoid race conditions. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = ptw32_rwlock_check_need_init (rwlock); - - if (result != 0 && result != EBUSY) - { - return result; - } - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = - pthread_mutex_timedlock (&(rwl->mtxExclusiveAccess), abstime)) != 0) - { - return result; - } - - if (++rwl->nSharedAccessCount == INT_MAX) - { - if ((result = - pthread_mutex_timedlock (&(rwl->mtxSharedAccessCompleted), - abstime)) != 0) - { - if (result == ETIMEDOUT) - { - ++rwl->nCompletedSharedAccessCount; - } - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - - if ((result = - pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - } - - return (pthread_mutex_unlock (&(rwl->mtxExclusiveAccess))); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_timedwrlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_timedwrlock.c deleted file mode 100644 index e7d1be25754..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_timedwrlock.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * pthread_rwlock_timedwrlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_timedwrlock (pthread_rwlock_t * rwlock, - const struct timespec *abstime) -{ - int result; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static rwlock. We check - * again inside the guarded section of ptw32_rwlock_check_need_init() - * to avoid race conditions. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = ptw32_rwlock_check_need_init (rwlock); - - if (result != 0 && result != EBUSY) - { - return result; - } - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = - pthread_mutex_timedlock (&(rwl->mtxExclusiveAccess), abstime)) != 0) - { - return result; - } - - if ((result = - pthread_mutex_timedlock (&(rwl->mtxSharedAccessCompleted), - abstime)) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - if (rwl->nExclusiveAccessCount == 0) - { - if (rwl->nCompletedSharedAccessCount > 0) - { - rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - } - - if (rwl->nSharedAccessCount > 0) - { - rwl->nCompletedSharedAccessCount = -rwl->nSharedAccessCount; - - /* - * This routine may be a cancelation point - * according to POSIX 1003.1j section 18.1.2. - */ -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push (ptw32_rwlock_cancelwrwait, (void *) rwl); - - do - { - result = - pthread_cond_timedwait (&(rwl->cndSharedAccessCompleted), - &(rwl->mtxSharedAccessCompleted), - abstime); - } - while (result == 0 && rwl->nCompletedSharedAccessCount < 0); - - pthread_cleanup_pop ((result != 0) ? 1 : 0); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - if (result == 0) - { - rwl->nSharedAccessCount = 0; - } - } - } - - if (result == 0) - { - rwl->nExclusiveAccessCount++; - } - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_tryrdlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_tryrdlock.c deleted file mode 100644 index 308900d141e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_tryrdlock.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * pthread_rwlock_tryrdlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_tryrdlock (pthread_rwlock_t * rwlock) -{ - int result; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static rwlock. We check - * again inside the guarded section of ptw32_rwlock_check_need_init() - * to avoid race conditions. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = ptw32_rwlock_check_need_init (rwlock); - - if (result != 0 && result != EBUSY) - { - return result; - } - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = pthread_mutex_trylock (&(rwl->mtxExclusiveAccess))) != 0) - { - return result; - } - - if (++rwl->nSharedAccessCount == INT_MAX) - { - if ((result = - pthread_mutex_lock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - - if ((result = - pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - } - - return (pthread_mutex_unlock (&rwl->mtxExclusiveAccess)); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_trywrlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_trywrlock.c deleted file mode 100644 index 8ba8b5dad96..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_trywrlock.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * pthread_rwlock_trywrlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_trywrlock (pthread_rwlock_t * rwlock) -{ - int result, result1; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static rwlock. We check - * again inside the guarded section of ptw32_rwlock_check_need_init() - * to avoid race conditions. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = ptw32_rwlock_check_need_init (rwlock); - - if (result != 0 && result != EBUSY) - { - return result; - } - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = pthread_mutex_trylock (&(rwl->mtxExclusiveAccess))) != 0) - { - return result; - } - - if ((result = - pthread_mutex_trylock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - result1 = pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return ((result1 != 0) ? result1 : result); - } - - if (rwl->nExclusiveAccessCount == 0) - { - if (rwl->nCompletedSharedAccessCount > 0) - { - rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - } - - if (rwl->nSharedAccessCount > 0) - { - if ((result = - pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - if ((result = - pthread_mutex_unlock (&(rwl->mtxExclusiveAccess))) == 0) - { - result = EBUSY; - } - } - else - { - rwl->nExclusiveAccessCount = 1; - } - } - else - { - result = EBUSY; - } - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_unlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_unlock.c deleted file mode 100644 index 776c996feae..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_unlock.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * pthread_rwlock_unlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_unlock (pthread_rwlock_t * rwlock) -{ - int result, result1; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return (EINVAL); - } - - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - /* - * Assume any race condition here is harmless. - */ - return 0; - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if (rwl->nExclusiveAccessCount == 0) - { - if ((result = - pthread_mutex_lock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - return result; - } - - if (++rwl->nCompletedSharedAccessCount == 0) - { - result = pthread_cond_signal (&(rwl->cndSharedAccessCompleted)); - } - - result1 = pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); - } - else - { - rwl->nExclusiveAccessCount--; - - result = pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); - result1 = pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - - } - - return ((result != 0) ? result : result1); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_wrlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_wrlock.c deleted file mode 100644 index a0970404417..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlock_wrlock.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * pthread_rwlock_wrlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlock_wrlock (pthread_rwlock_t * rwlock) -{ - int result; - pthread_rwlock_t rwl; - - if (rwlock == NULL || *rwlock == NULL) - { - return EINVAL; - } - - /* - * We do a quick check to see if we need to do more work - * to initialise a static rwlock. We check - * again inside the guarded section of ptw32_rwlock_check_need_init() - * to avoid race conditions. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = ptw32_rwlock_check_need_init (rwlock); - - if (result != 0 && result != EBUSY) - { - return result; - } - } - - rwl = *rwlock; - - if (rwl->nMagic != PTW32_RWLOCK_MAGIC) - { - return EINVAL; - } - - if ((result = pthread_mutex_lock (&(rwl->mtxExclusiveAccess))) != 0) - { - return result; - } - - if ((result = pthread_mutex_lock (&(rwl->mtxSharedAccessCompleted))) != 0) - { - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); - return result; - } - - if (rwl->nExclusiveAccessCount == 0) - { - if (rwl->nCompletedSharedAccessCount > 0) - { - rwl->nSharedAccessCount -= rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - } - - if (rwl->nSharedAccessCount > 0) - { - rwl->nCompletedSharedAccessCount = -rwl->nSharedAccessCount; - - /* - * This routine may be a cancelation point - * according to POSIX 1003.1j section 18.1.2. - */ -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - pthread_cleanup_push (ptw32_rwlock_cancelwrwait, (void *) rwl); - - do - { - result = pthread_cond_wait (&(rwl->cndSharedAccessCompleted), - &(rwl->mtxSharedAccessCompleted)); - } - while (result == 0 && rwl->nCompletedSharedAccessCount < 0); - - pthread_cleanup_pop ((result != 0) ? 1 : 0); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - - if (result == 0) - { - rwl->nSharedAccessCount = 0; - } - } - } - - if (result == 0) - { - rwl->nExclusiveAccessCount++; - } - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_destroy.c deleted file mode 100644 index 0fcbe84053a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_destroy.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * pthread_rwlockattr_destroy.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Destroys a rwlock attributes object. The object can - * no longer be used. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_rwlockattr_t - * - * - * DESCRIPTION - * Destroys a rwlock attributes object. The object can - * no longer be used. - * - * NOTES: - * 1) Does not affect rwlockss created using 'attr' - * - * RESULTS - * 0 successfully released attr, - * EINVAL 'attr' is invalid. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - - if (attr == NULL || *attr == NULL) - { - result = EINVAL; - } - else - { - pthread_rwlockattr_t rwa = *attr; - - *attr = NULL; - free (rwa); - } - - return (result); -} /* pthread_rwlockattr_destroy */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_getpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_getpshared.c deleted file mode 100644 index abfe63f2578..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_getpshared.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * pthread_rwlockattr_getpshared.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, - int *pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Determine whether rwlocks created with 'attr' can be - * shared between processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_rwlockattr_t - * - * pshared - * will be set to one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * - * DESCRIPTION - * Rwlocks creatd with 'attr' can be shared between - * processes if pthread_rwlock_t variable is allocated - * in memory shared by these processes. - * NOTES: - * 1) pshared rwlocks MUST be allocated in shared - * memory. - * 2) The following macro is defined if shared rwlocks - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully retrieved attribute, - * EINVAL 'attr' is invalid, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && (pshared != NULL)) - { - *pshared = (*attr)->pshared; - result = 0; - } - else - { - result = EINVAL; - } - - return (result); - -} /* pthread_rwlockattr_getpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_init.c deleted file mode 100644 index feb8e94073a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_init.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * pthread_rwlockattr_init.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlockattr_init (pthread_rwlockattr_t * attr) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Initializes a rwlock attributes object with default - * attributes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_rwlockattr_t - * - * - * DESCRIPTION - * Initializes a rwlock attributes object with default - * attributes. - * - * RESULTS - * 0 successfully initialized attr, - * ENOMEM insufficient memory for attr. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - pthread_rwlockattr_t rwa; - - rwa = (pthread_rwlockattr_t) calloc (1, sizeof (*rwa)); - - if (rwa == NULL) - { - result = ENOMEM; - } - else - { - rwa->pshared = PTHREAD_PROCESS_PRIVATE; - } - - *attr = rwa; - - return (result); -} /* pthread_rwlockattr_init */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_setpshared.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_setpshared.c deleted file mode 100644 index 316532cb26d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_rwlockattr_setpshared.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * pthread_rwlockattr_setpshared.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include - -#include "pthread.h" -#include "implement.h" - -int -pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, int pshared) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Rwlocks created with 'attr' can be shared between - * processes if pthread_rwlock_t variable is allocated - * in memory shared by these processes. - * - * PARAMETERS - * attr - * pointer to an instance of pthread_rwlockattr_t - * - * pshared - * must be one of: - * - * PTHREAD_PROCESS_SHARED - * May be shared if in shared memory - * - * PTHREAD_PROCESS_PRIVATE - * Cannot be shared. - * - * DESCRIPTION - * Rwlocks creatd with 'attr' can be shared between - * processes if pthread_rwlock_t variable is allocated - * in memory shared by these processes. - * - * NOTES: - * 1) pshared rwlocks MUST be allocated in shared - * memory. - * - * 2) The following macro is defined if shared rwlocks - * are supported: - * _POSIX_THREAD_PROCESS_SHARED - * - * RESULTS - * 0 successfully set attribute, - * EINVAL 'attr' or pshared is invalid, - * ENOSYS PTHREAD_PROCESS_SHARED not supported, - * - * ------------------------------------------------------ - */ -{ - int result; - - if ((attr != NULL && *attr != NULL) && - ((pshared == PTHREAD_PROCESS_SHARED) || - (pshared == PTHREAD_PROCESS_PRIVATE))) - { - if (pshared == PTHREAD_PROCESS_SHARED) - { - -#if !defined( _POSIX_THREAD_PROCESS_SHARED ) - - result = ENOSYS; - pshared = PTHREAD_PROCESS_PRIVATE; - -#else - - result = 0; - -#endif /* _POSIX_THREAD_PROCESS_SHARED */ - - } - else - { - result = 0; - } - - (*attr)->pshared = pshared; - } - else - { - result = EINVAL; - } - - return (result); - -} /* pthread_rwlockattr_setpshared */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_self.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_self.c deleted file mode 100644 index d72a0971d04..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_self.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * pthread_self.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -pthread_t -pthread_self (void) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function returns a reference to the current running - * thread. - * - * PARAMETERS - * N/A - * - * - * DESCRIPTION - * This function returns a reference to the current running - * thread. - * - * RESULTS - * pthread_t reference to the current thread - * - * ------------------------------------------------------ - */ -{ - pthread_t self; - pthread_t nil = {NULL, 0}; - ptw32_thread_t * sp; - -#ifdef _UWIN - if (!ptw32_selfThreadKey) - return nil; -#endif - - sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey); - - if (sp != NULL) - { - self = sp->ptHandle; - } - else - { - /* - * Need to create an implicit 'self' for the currently - * executing thread. - */ - self = ptw32_new (); - sp = (ptw32_thread_t *) self.p; - - if (sp != NULL) - { - /* - * This is a non-POSIX thread which has chosen to call - * a POSIX threads function for some reason. We assume that - * it isn't joinable, but we do assume that it's - * (deferred) cancelable. - */ - sp->implicit = 1; - sp->detachState = PTHREAD_CREATE_DETACHED; - sp->thread = GetCurrentThreadId (); - -#ifdef NEED_DUPLICATEHANDLE - /* - * DuplicateHandle does not exist on WinCE. - * - * NOTE: - * GetCurrentThread only returns a pseudo-handle - * which is only valid in the current thread context. - * Therefore, you should not pass the handle to - * other threads for whatever purpose. - */ - sp->threadH = GetCurrentThread (); -#else - if (!DuplicateHandle (GetCurrentProcess (), - GetCurrentThread (), - GetCurrentProcess (), - &sp->threadH, - 0, FALSE, DUPLICATE_SAME_ACCESS)) - { - /* - * Should not do this, but we have no alternative if - * we can't get a Win32 thread handle. - * Thread structs are never freed. - */ - ptw32_threadReusePush (self); - return nil; - } -#endif - - /* - * No need to explicitly serialise access to sched_priority - * because the new handle is not yet public. - */ - sp->sched_priority = GetThreadPriority (sp->threadH); - - pthread_setspecific (ptw32_selfThreadKey, (void *) sp); - } - } - - return (self); - -} /* pthread_self */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setcancelstate.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setcancelstate.c deleted file mode 100644 index 002cfe5e42e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setcancelstate.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * pthread_setcancelstate.c - * - * Description: - * POSIX thread functions related to thread cancellation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_setcancelstate (int state, int *oldstate) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function atomically sets the calling thread's - * cancelability state to 'state' and returns the previous - * cancelability state at the location referenced by - * 'oldstate' - * - * PARAMETERS - * state, - * oldstate - * PTHREAD_CANCEL_ENABLE - * cancellation is enabled, - * - * PTHREAD_CANCEL_DISABLE - * cancellation is disabled - * - * - * DESCRIPTION - * This function atomically sets the calling thread's - * cancelability state to 'state' and returns the previous - * cancelability state at the location referenced by - * 'oldstate'. - * - * NOTES: - * 1) Use to disable cancellation around 'atomic' code that - * includes cancellation points - * - * COMPATIBILITY ADDITIONS - * If 'oldstate' is NULL then the previous state is not returned - * but the function still succeeds. (Solaris) - * - * RESULTS - * 0 successfully set cancelability type, - * EINVAL 'state' is invalid - * - * ------------------------------------------------------ - */ -{ - int result = 0; - pthread_t self = pthread_self (); - ptw32_thread_t * sp = (ptw32_thread_t *) self.p; - - if (sp == NULL - || (state != PTHREAD_CANCEL_ENABLE && state != PTHREAD_CANCEL_DISABLE)) - { - return EINVAL; - } - - /* - * Lock for async-cancel safety. - */ - (void) pthread_mutex_lock (&sp->cancelLock); - - if (oldstate != NULL) - { - *oldstate = sp->cancelState; - } - - sp->cancelState = state; - - /* - * Check if there is a pending asynchronous cancel - */ - if (state == PTHREAD_CANCEL_ENABLE - && sp->cancelType == PTHREAD_CANCEL_ASYNCHRONOUS - && WaitForSingleObject (sp->cancelEvent, 0) == WAIT_OBJECT_0) - { - sp->state = PThreadStateCanceling; - sp->cancelState = PTHREAD_CANCEL_DISABLE; - ResetEvent (sp->cancelEvent); - (void) pthread_mutex_unlock (&sp->cancelLock); - ptw32_throw (PTW32_EPS_CANCEL); - - /* Never reached */ - } - - (void) pthread_mutex_unlock (&sp->cancelLock); - - return (result); - -} /* pthread_setcancelstate */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setcanceltype.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setcanceltype.c deleted file mode 100644 index 3fb3f0e49bb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setcanceltype.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * pthread_setcanceltype.c - * - * Description: - * POSIX thread functions related to thread cancellation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_setcanceltype (int type, int *oldtype) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function atomically sets the calling thread's - * cancelability type to 'type' and returns the previous - * cancelability type at the location referenced by - * 'oldtype' - * - * PARAMETERS - * type, - * oldtype - * PTHREAD_CANCEL_DEFERRED - * only deferred cancelation is allowed, - * - * PTHREAD_CANCEL_ASYNCHRONOUS - * Asynchronous cancellation is allowed - * - * - * DESCRIPTION - * This function atomically sets the calling thread's - * cancelability type to 'type' and returns the previous - * cancelability type at the location referenced by - * 'oldtype' - * - * NOTES: - * 1) Use with caution; most code is not safe for use - * with asynchronous cancelability. - * - * COMPATIBILITY ADDITIONS - * If 'oldtype' is NULL then the previous type is not returned - * but the function still succeeds. (Solaris) - * - * RESULTS - * 0 successfully set cancelability type, - * EINVAL 'type' is invalid - * - * ------------------------------------------------------ - */ -{ - int result = 0; - pthread_t self = pthread_self (); - ptw32_thread_t * sp = (ptw32_thread_t *) self.p; - - if (sp == NULL - || (type != PTHREAD_CANCEL_DEFERRED - && type != PTHREAD_CANCEL_ASYNCHRONOUS)) - { - return EINVAL; - } - - /* - * Lock for async-cancel safety. - */ - (void) pthread_mutex_lock (&sp->cancelLock); - - if (oldtype != NULL) - { - *oldtype = sp->cancelType; - } - - sp->cancelType = type; - - /* - * Check if there is a pending asynchronous cancel - */ - if (sp->cancelState == PTHREAD_CANCEL_ENABLE - && type == PTHREAD_CANCEL_ASYNCHRONOUS - && WaitForSingleObject (sp->cancelEvent, 0) == WAIT_OBJECT_0) - { - sp->state = PThreadStateCanceling; - sp->cancelState = PTHREAD_CANCEL_DISABLE; - ResetEvent (sp->cancelEvent); - (void) pthread_mutex_unlock (&sp->cancelLock); - ptw32_throw (PTW32_EPS_CANCEL); - - /* Never reached */ - } - - (void) pthread_mutex_unlock (&sp->cancelLock); - - return (result); - -} /* pthread_setcanceltype */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setconcurrency.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setconcurrency.c deleted file mode 100644 index f62346f8e5c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setconcurrency.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * pthread_setconcurrency.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_setconcurrency (int level) -{ - if (level < 0) - { - return EINVAL; - } - else - { - ptw32_concurrency = level; - return 0; - } -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setschedparam.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setschedparam.c deleted file mode 100644 index a122eaca661..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setschedparam.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * sched_setschedparam.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -pthread_setschedparam (pthread_t thread, int policy, - const struct sched_param *param) -{ - int result; - - /* Validate the thread id. */ - result = pthread_kill (thread, 0); - if (0 != result) - { - return result; - } - - /* Validate the scheduling policy. */ - if (policy < SCHED_MIN || policy > SCHED_MAX) - { - return EINVAL; - } - - /* Ensure the policy is SCHED_OTHER. */ - if (policy != SCHED_OTHER) - { - return ENOTSUP; - } - - return (ptw32_setthreadpriority (thread, policy, param->sched_priority)); -} - - -int -ptw32_setthreadpriority (pthread_t thread, int policy, int priority) -{ - int prio; - int result; - ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; - - prio = priority; - - /* Validate priority level. */ - if (prio < sched_get_priority_min (policy) || - prio > sched_get_priority_max (policy)) - { - return EINVAL; - } - -#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL) -/* WinCE */ -#else -/* Everything else */ - - if (THREAD_PRIORITY_IDLE < prio && THREAD_PRIORITY_LOWEST > prio) - { - prio = THREAD_PRIORITY_LOWEST; - } - else if (THREAD_PRIORITY_TIME_CRITICAL > prio - && THREAD_PRIORITY_HIGHEST < prio) - { - prio = THREAD_PRIORITY_HIGHEST; - } - -#endif - - result = pthread_mutex_lock (&tp->threadLock); - - if (0 == result) - { - /* If this fails, the current priority is unchanged. */ - if (0 == SetThreadPriority (tp->threadH, prio)) - { - result = EINVAL; - } - else - { - /* - * Must record the thread's sched_priority as given, - * not as finally adjusted. - */ - tp->sched_priority = priority; - } - - (void) pthread_mutex_unlock (&tp->threadLock); - } - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setspecific.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setspecific.c deleted file mode 100644 index f06b696166c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_setspecific.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * pthread_setspecific.c - * - * Description: - * POSIX thread functions which implement thread-specific data (TSD). - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_setspecific (pthread_key_t key, const void *value) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function sets the value of the thread specific - * key in the calling thread. - * - * PARAMETERS - * key - * an instance of pthread_key_t - * value - * the value to set key to - * - * - * DESCRIPTION - * This function sets the value of the thread specific - * key in the calling thread. - * - * RESULTS - * 0 successfully set value - * EAGAIN could not set value - * ENOENT SERIOUS!! - * - * ------------------------------------------------------ - */ -{ - pthread_t self; - int result = 0; - - if (key != ptw32_selfThreadKey) - { - /* - * Using pthread_self will implicitly create - * an instance of pthread_t for the current - * thread if one wasn't explicitly created - */ - self = pthread_self (); - if (self.p == NULL) - { - return ENOENT; - } - } - else - { - /* - * Resolve catch-22 of registering thread with selfThread - * key - */ - ptw32_thread_t * sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey); - - if (sp == NULL) - { - if (value == NULL) - { - return ENOENT; - } - self = *((pthread_t *) value); - } - else - { - self = sp->ptHandle; - } - } - - result = 0; - - if (key != NULL) - { - if (self.p != NULL && key->destructor != NULL && value != NULL) - { - /* - * Only require associations if we have to - * call user destroy routine. - * Don't need to locate an existing association - * when setting data to NULL for WIN32 since the - * data is stored with the operating system; not - * on the association; setting assoc to NULL short - * circuits the search. - */ - ThreadKeyAssoc *assoc; - - if (pthread_mutex_lock(&(key->keyLock)) == 0) - { - ptw32_thread_t * sp = (ptw32_thread_t *) self.p; - - (void) pthread_mutex_lock(&(sp->threadLock)); - - assoc = (ThreadKeyAssoc *) sp->keys; - /* - * Locate existing association - */ - while (assoc != NULL) - { - if (assoc->key == key) - { - /* - * Association already exists - */ - break; - } - assoc = assoc->nextKey; - } - - /* - * create an association if not found - */ - if (assoc == NULL) - { - result = ptw32_tkAssocCreate (sp, key); - } - - (void) pthread_mutex_unlock(&(sp->threadLock)); - } - (void) pthread_mutex_unlock(&(key->keyLock)); - } - - if (result == 0) - { - if (!TlsSetValue (key->key, (LPVOID) value)) - { - result = EAGAIN; - } - } - } - - return (result); -} /* pthread_setspecific */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_destroy.c deleted file mode 100644 index 8fe22674da3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_destroy.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * pthread_spin_destroy.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_spin_destroy (pthread_spinlock_t * lock) -{ - register pthread_spinlock_t s; - int result = 0; - - if (lock == NULL || *lock == NULL) - { - return EINVAL; - } - - if ((s = *lock) != PTHREAD_SPINLOCK_INITIALIZER) - { - if (s->interlock == PTW32_SPIN_USE_MUTEX) - { - result = pthread_mutex_destroy (&(s->u.mutex)); - } - else if ((PTW32_INTERLOCKED_LONG) PTW32_SPIN_UNLOCKED != - PTW32_INTERLOCKED_COMPARE_EXCHANGE ((PTW32_INTERLOCKED_LPLONG) - & (s->interlock), - (PTW32_INTERLOCKED_LONG) - PTW32_OBJECT_INVALID, - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_UNLOCKED)) - { - result = EINVAL; - } - - if (0 == result) - { - /* - * We are relying on the application to ensure that all other threads - * have finished with the spinlock before destroying it. - */ - *lock = NULL; - (void) free (s); - } - } - else - { - /* - * See notes in ptw32_spinlock_check_need_init() above also. - */ - EnterCriticalSection (&ptw32_spinlock_test_init_lock); - - /* - * Check again. - */ - if (*lock == PTHREAD_SPINLOCK_INITIALIZER) - { - /* - * This is all we need to do to destroy a statically - * initialised spinlock that has not yet been used (initialised). - * If we get to here, another thread - * waiting to initialise this mutex will get an EINVAL. - */ - *lock = NULL; - } - else - { - /* - * The spinlock has been initialised while we were waiting - * so assume it's in use. - */ - result = EBUSY; - } - - LeaveCriticalSection (&ptw32_spinlock_test_init_lock); - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_init.c deleted file mode 100644 index 553af7eac80..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_init.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * pthread_spin_init.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_spin_init (pthread_spinlock_t * lock, int pshared) -{ - pthread_spinlock_t s; - int cpus = 0; - int result = 0; - - if (lock == NULL) - { - return EINVAL; - } - - if (0 != ptw32_getprocessors (&cpus)) - { - cpus = 1; - } - - if (cpus > 1) - { - if (pshared == PTHREAD_PROCESS_SHARED) - { - /* - * Creating spinlock that can be shared between - * processes. - */ -#if _POSIX_THREAD_PROCESS_SHARED >= 0 - - /* - * Not implemented yet. - */ - -#error ERROR [__FILE__, line __LINE__]: Process shared spin locks are not supported yet. - -#else - - return ENOSYS; - -#endif /* _POSIX_THREAD_PROCESS_SHARED */ - - } - } - - s = (pthread_spinlock_t) calloc (1, sizeof (*s)); - - if (s == NULL) - { - return ENOMEM; - } - - if (cpus > 1) - { - s->u.cpus = cpus; - s->interlock = PTW32_SPIN_UNLOCKED; - } - else - { - pthread_mutexattr_t ma; - result = pthread_mutexattr_init (&ma); - - if (0 == result) - { - ma->pshared = pshared; - result = pthread_mutex_init (&(s->u.mutex), &ma); - if (0 == result) - { - s->interlock = PTW32_SPIN_USE_MUTEX; - } - } - (void) pthread_mutexattr_destroy (&ma); - } - - if (0 == result) - { - *lock = s; - } - else - { - (void) free (s); - *lock = NULL; - } - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_lock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_lock.c deleted file mode 100644 index 90b3abee472..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_lock.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * pthread_spin_lock.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_spin_lock (pthread_spinlock_t * lock) -{ - register pthread_spinlock_t s; - - if (NULL == lock || NULL == *lock) - { - return (EINVAL); - } - - if (*lock == PTHREAD_SPINLOCK_INITIALIZER) - { - int result; - - if ((result = ptw32_spinlock_check_need_init (lock)) != 0) - { - return (result); - } - } - - s = *lock; - - while ((PTW32_INTERLOCKED_LONG) PTW32_SPIN_LOCKED == - PTW32_INTERLOCKED_COMPARE_EXCHANGE ((PTW32_INTERLOCKED_LPLONG) & - (s->interlock), - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_LOCKED, - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_UNLOCKED)) - { - } - - if (s->interlock == PTW32_SPIN_LOCKED) - { - return 0; - } - else if (s->interlock == PTW32_SPIN_USE_MUTEX) - { - return pthread_mutex_lock (&(s->u.mutex)); - } - - return EINVAL; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_trylock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_trylock.c deleted file mode 100644 index c601a191fed..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_trylock.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * pthread_spin_trylock.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_spin_trylock (pthread_spinlock_t * lock) -{ - register pthread_spinlock_t s; - - if (NULL == lock || NULL == *lock) - { - return (EINVAL); - } - - if (*lock == PTHREAD_SPINLOCK_INITIALIZER) - { - int result; - - if ((result = ptw32_spinlock_check_need_init (lock)) != 0) - { - return (result); - } - } - - s = *lock; - - switch ((long) - PTW32_INTERLOCKED_COMPARE_EXCHANGE ((PTW32_INTERLOCKED_LPLONG) & - (s->interlock), - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_LOCKED, - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_UNLOCKED)) - { - case PTW32_SPIN_UNLOCKED: - return 0; - case PTW32_SPIN_LOCKED: - return EBUSY; - case PTW32_SPIN_USE_MUTEX: - return pthread_mutex_trylock (&(s->u.mutex)); - } - - return EINVAL; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_unlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_unlock.c deleted file mode 100644 index 67bc2c218dc..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_spin_unlock.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * pthread_spin_unlock.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -pthread_spin_unlock (pthread_spinlock_t * lock) -{ - register pthread_spinlock_t s; - - if (NULL == lock || NULL == *lock) - { - return (EINVAL); - } - - s = *lock; - - if (s == PTHREAD_SPINLOCK_INITIALIZER) - { - return EPERM; - } - - switch ((long) - PTW32_INTERLOCKED_COMPARE_EXCHANGE ((PTW32_INTERLOCKED_LPLONG) & - (s->interlock), - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_UNLOCKED, - (PTW32_INTERLOCKED_LONG) - PTW32_SPIN_LOCKED)) - { - case PTW32_SPIN_LOCKED: - return 0; - case PTW32_SPIN_UNLOCKED: - return EPERM; - case PTW32_SPIN_USE_MUTEX: - return pthread_mutex_unlock (&(s->u.mutex)); - } - - return EINVAL; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_testcancel.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_testcancel.c deleted file mode 100644 index ad7cdb99449..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_testcancel.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * pthread_testcancel.c - * - * Description: - * POSIX thread functions related to thread cancellation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -void -pthread_testcancel (void) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function creates a deferred cancellation point - * in the calling thread. The call has no effect if the - * current cancelability state is - * PTHREAD_CANCEL_DISABLE - * - * PARAMETERS - * N/A - * - * - * DESCRIPTION - * This function creates a deferred cancellation point - * in the calling thread. The call has no effect if the - * current cancelability state is - * PTHREAD_CANCEL_DISABLE - * - * NOTES: - * 1) Cancellation is asynchronous. Use pthread_join - * to wait for termination of thread if necessary - * - * RESULTS - * N/A - * - * ------------------------------------------------------ - */ -{ - pthread_t self = pthread_self (); - ptw32_thread_t * sp = (ptw32_thread_t *) self.p; - - if (sp == NULL) - { - return; - } - - /* - * Pthread_cancel() will have set sp->state to PThreadStateCancelPending - * and set an event, so no need to enter kernel space if - * sp->state != PThreadStateCancelPending - that only slows us down. - */ - if (sp->state != PThreadStateCancelPending) - { - return; - } - - (void) pthread_mutex_lock (&sp->cancelLock); - - if (sp->cancelState != PTHREAD_CANCEL_DISABLE) - { - ResetEvent(sp->cancelEvent); - sp->state = PThreadStateCanceling; - (void) pthread_mutex_unlock (&sp->cancelLock); - sp->cancelState = PTHREAD_CANCEL_DISABLE; - (void) pthread_mutex_unlock (&sp->cancelLock); - ptw32_throw (PTW32_EPS_CANCEL); - } - - (void) pthread_mutex_unlock (&sp->cancelLock); -} /* pthread_testcancel */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_timechange_handler_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_timechange_handler_np.c deleted file mode 100644 index 7d8170a3ff0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_timechange_handler_np.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * pthread_timechange_handler_np.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * Notes on handling system time adjustments (especially negative ones). - * --------------------------------------------------------------------- - * - * This solution was suggested by Alexander Terekhov, but any errors - * in the implementation are mine - [Ross Johnson] - * - * 1) The problem: threads doing a timedwait on a CV may expect to timeout - * at a specific absolute time according to a system timer. If the - * system clock is adjusted backwards then those threads sleep longer than - * expected. Also, pthreads-win32 converts absolute times to intervals in - * order to make use of the underlying Win32, and so waiting threads may - * awake before their proper abstimes. - * - * 2) We aren't able to distinquish between threads on timed or untimed waits, - * so we wake them all at the time of the adjustment so that they can - * re-evaluate their conditions and re-compute their timeouts. - * - * 3) We rely on correctly written applications for this to work. Specifically, - * they must be able to deal properly with spurious wakeups. That is, - * they must re-test their condition upon wakeup and wait again if - * the condition is not satisfied. - */ - -void * -pthread_timechange_handler_np (void *arg) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * Broadcasts all CVs to force re-evaluation and - * new timeouts if required. - * - * PARAMETERS - * NONE - * - * - * DESCRIPTION - * Broadcasts all CVs to force re-evaluation and - * new timeouts if required. - * - * This routine may be passed directly to pthread_create() - * as a new thread in order to run asynchronously. - * - * - * RESULTS - * 0 successfully broadcast all CVs - * EAGAIN Not all CVs were broadcast - * - * ------------------------------------------------------ - */ -{ - int result = 0; - pthread_cond_t cv; - - EnterCriticalSection (&ptw32_cond_list_lock); - - cv = ptw32_cond_list_head; - - while (cv != NULL && 0 == result) - { - result = pthread_cond_broadcast (&cv); - cv = cv->next; - } - - LeaveCriticalSection (&ptw32_cond_list_lock); - - return (void *) (result != 0 ? EAGAIN : 0); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_win32_attach_detach_np.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_win32_attach_detach_np.c deleted file mode 100644 index 2f0bc373a19..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/pthread_win32_attach_detach_np.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * pthread_win32_attach_detach_np.c - * - * Description: - * This translation unit implements non-portable thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * Handle to kernel32.dll - */ -static HINSTANCE ptw32_h_kernel32; - -/* - * Handle to quserex.dll - */ -static HINSTANCE ptw32_h_quserex; - -BOOL -pthread_win32_process_attach_np () -{ - BOOL result = TRUE; - DWORD_PTR vProcessCPUs; - DWORD_PTR vSystemCPUs; - - result = ptw32_processInitialize (); - -#ifdef _UWIN - pthread_count++; -#endif - - ptw32_features = 0; - - -#if defined(NEED_PROCESS_AFFINITY_MASK) - - ptw32_smp_system = PTW32_FALSE; - -#else - - if (GetProcessAffinityMask (GetCurrentProcess (), - &vProcessCPUs, &vSystemCPUs)) - { - int CPUs = 0; - DWORD_PTR bit; - - for (bit = 1; bit != 0; bit <<= 1) - { - if (vSystemCPUs & bit) - { - CPUs++; - } - } - ptw32_smp_system = (CPUs > 1); - } - else - { - ptw32_smp_system = PTW32_FALSE; - } - -#endif - -#ifdef WINCE - - /* - * Load COREDLL and try to get address of InterlockedCompareExchange - */ - ptw32_h_kernel32 = LoadLibrary (TEXT ("COREDLL.DLL")); - -#else - - /* - * Load KERNEL32 and try to get address of InterlockedCompareExchange - */ - ptw32_h_kernel32 = LoadLibrary (TEXT ("KERNEL32.DLL")); - -#endif - - ptw32_interlocked_compare_exchange = - (PTW32_INTERLOCKED_LONG (WINAPI *) - (PTW32_INTERLOCKED_LPLONG, PTW32_INTERLOCKED_LONG, - PTW32_INTERLOCKED_LONG)) -#if defined(NEED_UNICODE_CONSTS) - GetProcAddress (ptw32_h_kernel32, - (const TCHAR *) TEXT ("InterlockedCompareExchange")); -#else - GetProcAddress (ptw32_h_kernel32, (LPCSTR) "InterlockedCompareExchange"); -#endif - - if (ptw32_interlocked_compare_exchange == NULL) - { - ptw32_interlocked_compare_exchange = ptw32_InterlockedCompareExchange; - - /* - * If InterlockedCompareExchange is not being used, then free - * the kernel32.dll handle now, rather than leaving it until - * DLL_PROCESS_DETACH. - * - * Note: this is not a pedantic exercise in freeing unused - * resources! It is a work-around for a bug in Windows 95 - * (see microsoft knowledge base article, Q187684) which - * does Bad Things when FreeLibrary is called within - * the DLL_PROCESS_DETACH code, in certain situations. - * Since w95 just happens to be a platform which does not - * provide InterlockedCompareExchange, the bug will be - * effortlessly avoided. - */ - (void) FreeLibrary (ptw32_h_kernel32); - ptw32_h_kernel32 = 0; - } - else - { - ptw32_features |= PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE; - } - - /* - * Load QUSEREX.DLL and try to get address of QueueUserAPCEx - */ - ptw32_h_quserex = LoadLibrary (TEXT ("QUSEREX.DLL")); - - if (ptw32_h_quserex != NULL) - { - ptw32_register_cancelation = (DWORD (*)(PAPCFUNC, HANDLE, DWORD)) -#if defined(NEED_UNICODE_CONSTS) - GetProcAddress (ptw32_h_quserex, - (const TCHAR *) TEXT ("QueueUserAPCEx")); -#else - GetProcAddress (ptw32_h_quserex, (LPCSTR) "QueueUserAPCEx"); -#endif - } - - if (NULL == ptw32_register_cancelation) - { - ptw32_register_cancelation = ptw32_RegisterCancelation; - - if (ptw32_h_quserex != NULL) - { - (void) FreeLibrary (ptw32_h_quserex); - } - ptw32_h_quserex = 0; - } - else - { - /* Initialise QueueUserAPCEx */ - BOOL (*queue_user_apc_ex_init) (VOID); - - queue_user_apc_ex_init = (BOOL (*)(VOID)) -#if defined(NEED_UNICODE_CONSTS) - GetProcAddress (ptw32_h_quserex, - (const TCHAR *) TEXT ("QueueUserAPCEx_Init")); -#else - GetProcAddress (ptw32_h_quserex, (LPCSTR) "QueueUserAPCEx_Init"); -#endif - - if (queue_user_apc_ex_init == NULL || !queue_user_apc_ex_init ()) - { - ptw32_register_cancelation = ptw32_RegisterCancelation; - - (void) FreeLibrary (ptw32_h_quserex); - ptw32_h_quserex = 0; - } - } - - if (ptw32_h_quserex) - { - ptw32_features |= PTW32_ALERTABLE_ASYNC_CANCEL; - } - - return result; -} - - -BOOL -pthread_win32_process_detach_np () -{ - if (ptw32_processInitialized) - { - ptw32_thread_t * sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey); - - if (sp != NULL) - { - /* - * Detached threads have their resources automatically - * cleaned up upon exit (others must be 'joined'). - */ - if (sp->detachState == PTHREAD_CREATE_DETACHED) - { - ptw32_threadDestroy (sp->ptHandle); - TlsSetValue (ptw32_selfThreadKey->key, NULL); - } - } - - /* - * The DLL is being unmapped from the process's address space - */ - ptw32_processTerminate (); - - if (ptw32_h_quserex) - { - /* Close QueueUserAPCEx */ - BOOL (*queue_user_apc_ex_fini) (VOID); - - queue_user_apc_ex_fini = (BOOL (*)(VOID)) -#if defined(NEED_UNICODE_CONSTS) - GetProcAddress (ptw32_h_quserex, - (const TCHAR *) TEXT ("QueueUserAPCEx_Fini")); -#else - GetProcAddress (ptw32_h_quserex, (LPCSTR) "QueueUserAPCEx_Fini"); -#endif - - if (queue_user_apc_ex_fini != NULL) - { - (void) queue_user_apc_ex_fini (); - } - (void) FreeLibrary (ptw32_h_quserex); - } - - if (ptw32_h_kernel32) - { - (void) FreeLibrary (ptw32_h_kernel32); - } - } - - return TRUE; -} - -BOOL -pthread_win32_thread_attach_np () -{ - return TRUE; -} - -BOOL -pthread_win32_thread_detach_np () -{ - if (ptw32_processInitialized) - { - /* - * Don't use pthread_self() - to avoid creating an implicit POSIX thread handle - * unnecessarily. - */ - ptw32_thread_t * sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey); - - if (sp != NULL) // otherwise Win32 thread with no implicit POSIX handle. - { - ptw32_callUserDestroyRoutines (sp->ptHandle); - - (void) pthread_mutex_lock (&sp->cancelLock); - sp->state = PThreadStateLast; - /* - * If the thread is joinable at this point then it MUST be joined - * or detached explicitly by the application. - */ - (void) pthread_mutex_unlock (&sp->cancelLock); - - if (sp->detachState == PTHREAD_CREATE_DETACHED) - { - ptw32_threadDestroy (sp->ptHandle); - - TlsSetValue (ptw32_selfThreadKey->key, NULL); - } - } - } - - return TRUE; -} - -BOOL -pthread_win32_test_features_np (int feature_mask) -{ - return ((ptw32_features & feature_mask) == feature_mask); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_InterlockedCompareExchange.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_InterlockedCompareExchange.c deleted file mode 100644 index 0094635f6ce..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_InterlockedCompareExchange.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * ptw32_InterlockedCompareExchange.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -/* - * ptw32_InterlockedCompareExchange -- - * - * Originally needed because W9x doesn't support InterlockedCompareExchange. - * We now use this version wherever possible so we can inline it. - */ - -PTW32_INTERLOCKED_LONG WINAPI -ptw32_InterlockedCompareExchange (PTW32_INTERLOCKED_LPLONG location, - PTW32_INTERLOCKED_LONG value, - PTW32_INTERLOCKED_LONG comparand) -{ - -#if defined(__WATCOMC__) -/* Don't report that result is not assigned a value before being referenced */ -#pragma disable_message (200) -#endif - - PTW32_INTERLOCKED_LONG result; - - /* - * Using the LOCK prefix on uni-processor machines is significantly slower - * and it is not necessary. The overhead of the conditional below is - * negligible in comparison. Since an optimised DLL will inline this - * routine, this will be faster than calling the system supplied - * Interlocked routine, which appears to avoid the LOCK prefix on - * uniprocessor systems. So one DLL works for all systems. - */ - if (ptw32_smp_system) - -/* *INDENT-OFF* */ - -#if defined(_M_IX86) || defined(_X86_) - -#if defined(_MSC_VER) || defined(__WATCOMC__) || (defined(__BORLANDC__) && defined(HAVE_TASM32)) -#define HAVE_INLINABLE_INTERLOCKED_CMPXCHG - { - _asm { - PUSH ecx - PUSH edx - MOV ecx,dword ptr [location] - MOV edx,dword ptr [value] - MOV eax,dword ptr [comparand] - LOCK CMPXCHG dword ptr [ecx],edx - MOV dword ptr [result], eax - POP edx - POP ecx - } - } - else - { - _asm { - PUSH ecx - PUSH edx - MOV ecx,dword ptr [location] - MOV edx,dword ptr [value] - MOV eax,dword ptr [comparand] - CMPXCHG dword ptr [ecx],edx - MOV dword ptr [result], eax - POP edx - POP ecx - } - } - -#elif defined(__GNUC__) -#define HAVE_INLINABLE_INTERLOCKED_CMPXCHG - - { - __asm__ __volatile__ - ( - "lock\n\t" - "cmpxchgl %2,%1" /* if (EAX == [location]) */ - /* [location] = value */ - /* else */ - /* EAX = [location] */ - :"=a" (result) - :"m" (*location), "r" (value), "a" (comparand)); - } - else - { - __asm__ __volatile__ - ( - "cmpxchgl %2,%1" /* if (EAX == [location]) */ - /* [location] = value */ - /* else */ - /* EAX = [location] */ - :"=a" (result) - :"m" (*location), "r" (value), "a" (comparand)); - } - -#endif - -#else - - /* - * If execution gets to here then we're running on a currently - * unsupported processor or compiler. - */ - - result = 0; - -#endif - -/* *INDENT-ON* */ - - return result; - -#if defined(__WATCOMC__) -#pragma enable_message (200) -#endif - -} - -/* - * ptw32_InterlockedExchange -- - * - * We now use this version wherever possible so we can inline it. - */ - -LONG WINAPI -ptw32_InterlockedExchange (LPLONG location, - LONG value) -{ - -#if defined(__WATCOMC__) -/* Don't report that result is not assigned a value before being referenced */ -#pragma disable_message (200) -#endif - - LONG result; - - /* - * The XCHG instruction always locks the bus with or without the - * LOCKED prefix. This makes it significantly slower than CMPXCHG on - * uni-processor machines. The Windows InterlockedExchange function - * is nearly 3 times faster than the XCHG instruction, so this routine - * is not yet very useful for speeding up pthreads. - */ - if (ptw32_smp_system) - -/* *INDENT-OFF* */ - -#if defined(_M_IX86) || defined(_X86_) - -#if defined(_MSC_VER) || defined(__WATCOMC__) || (defined(__BORLANDC__) && defined(HAVE_TASM32)) -#define HAVE_INLINABLE_INTERLOCKED_XCHG - - { - _asm { - PUSH ecx - MOV ecx,dword ptr [location] - MOV eax,dword ptr [value] - XCHG dword ptr [ecx],eax - MOV dword ptr [result], eax - POP ecx - } - } - else - { - /* - * Faster version of XCHG for uni-processor systems because - * it doesn't lock the bus. If an interrupt or context switch - * occurs between the MOV and the CMPXCHG then the value in - * 'location' may have changed, in which case we will loop - * back to do the MOV again. - * - * FIXME! Need memory barriers for the MOV+CMPXCHG combo? - * - * Tests show that this routine has almost identical timing - * to Win32's InterlockedExchange(), which is much faster than - * using the inlined 'xchg' instruction above, so it's probably - * doing something similar to this (on UP systems). - * - * Can we do without the PUSH/POP instructions? - */ - _asm { - PUSH ecx - PUSH edx - MOV ecx,dword ptr [location] - MOV edx,dword ptr [value] -L1: MOV eax,dword ptr [ecx] - CMPXCHG dword ptr [ecx],edx - JNZ L1 - MOV dword ptr [result], eax - POP edx - POP ecx - } - } - -#elif defined(__GNUC__) -#define HAVE_INLINABLE_INTERLOCKED_XCHG - - { - __asm__ __volatile__ - ( - "xchgl %2,%1" - :"=r" (result) - :"m" (*location), "0" (value)); - } - else - { - /* - * Faster version of XCHG for uni-processor systems because - * it doesn't lock the bus. If an interrupt or context switch - * occurs between the movl and the cmpxchgl then the value in - * 'location' may have changed, in which case we will loop - * back to do the movl again. - * - * FIXME! Need memory barriers for the MOV+CMPXCHG combo? - * - * Tests show that this routine has almost identical timing - * to Win32's InterlockedExchange(), which is much faster than - * using the an inlined 'xchg' instruction, so it's probably - * doing something similar to this (on UP systems). - */ - __asm__ __volatile__ - ( - "0:\n\t" - "movl %1,%%eax\n\t" - "cmpxchgl %2,%1\n\t" - "jnz 0b" - :"=&a" (result) - :"m" (*location), "r" (value)); - } - -#endif - -#else - - /* - * If execution gets to here then we're running on a currently - * unsupported processor or compiler. - */ - - result = 0; - -#endif - -/* *INDENT-ON* */ - - return result; - -#if defined(__WATCOMC__) -#pragma enable_message (200) -#endif - -} - - -#if 1 - -#if defined(PTW32_BUILD_INLINED) && defined(HAVE_INLINABLE_INTERLOCKED_CMPXCHG) -#undef PTW32_INTERLOCKED_COMPARE_EXCHANGE -#define PTW32_INTERLOCKED_COMPARE_EXCHANGE ptw32_InterlockedCompareExchange -#endif - -#if defined(PTW32_BUILD_INLINED) && defined(HAVE_INLINABLE_INTERLOCKED_XCHG) -#undef PTW32_INTERLOCKED_EXCHANGE -#define PTW32_INTERLOCKED_EXCHANGE ptw32_InterlockedExchange -#endif - -#endif diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_MCS_lock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_MCS_lock.c deleted file mode 100644 index 1a143ea14be..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_MCS_lock.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * ptw32_MCS_lock.c - * - * Description: - * This translation unit implements queue-based locks. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -/* - * About MCS locks: - * - * MCS locks are queue-based locks, where the queue nodes are local to the - * thread. The 'lock' is nothing more than a global pointer that points to - * the last node in the queue, or is NULL if the queue is empty. - * - * Originally designed for use as spin locks requiring no kernel resources - * for synchronisation or blocking, the implementation below has adapted - * the MCS spin lock for use as a general mutex that will suspend threads - * when there is lock contention. - * - * Because the queue nodes are thread-local, most of the memory read/write - * operations required to add or remove nodes from the queue do not trigger - * cache-coherence updates. - * - * Like 'named' mutexes, MCS locks consume system resources transiently - - * they are able to acquire and free resources automatically - but MCS - * locks do not require any unique 'name' to identify the lock to all - * threads using it. - * - * Usage of MCS locks: - * - * - you need a global ptw32_mcs_lock_t instance initialised to 0 or NULL. - * - you need a local thread-scope ptw32_mcs_local_node_t instance, which - * may serve several different locks but you need at least one node for - * every lock held concurrently by a thread. - * - * E.g.: - * - * ptw32_mcs_lock_t lock1 = 0; - * ptw32_mcs_lock_t lock2 = 0; - * - * void *mythread(void *arg) - * { - * ptw32_mcs_local_node_t node; - * - * ptw32_mcs_acquire (&lock1, &node); - * ptw32_mcs_release (&node); - * - * ptw32_mcs_acquire (&lock2, &node); - * ptw32_mcs_release (&node); - * { - * ptw32_mcs_local_node_t nodex; - * - * ptw32_mcs_acquire (&lock1, &node); - * ptw32_mcs_acquire (&lock2, &nodex); - * - * ptw32_mcs_release (&nodex); - * ptw32_mcs_release (&node); - * } - * return (void *)0; - * } - */ - -#include "implement.h" -#include "pthread.h" - -/* - * ptw32_mcs_flag_set -- notify another thread about an event. - * - * Set event if an event handle has been stored in the flag, and - * set flag to -1 otherwise. Note that -1 cannot be a valid handle value. - */ -INLINE void -ptw32_mcs_flag_set (LONG * flag) -{ - HANDLE e = (HANDLE)PTW32_INTERLOCKED_COMPARE_EXCHANGE( - (PTW32_INTERLOCKED_LPLONG)flag, - (PTW32_INTERLOCKED_LONG)-1, - (PTW32_INTERLOCKED_LONG)0); - if ((HANDLE)0 != e) - { - /* another thread has already stored an event handle in the flag */ - SetEvent(e); - } -} - -/* - * ptw32_mcs_flag_set -- wait for notification from another. - * - * Store an event handle in the flag and wait on it if the flag has not been - * set, and proceed without creating an event otherwise. - */ -INLINE void -ptw32_mcs_flag_wait (LONG * flag) -{ - if (0 == InterlockedExchangeAdd((LPLONG)flag, 0)) /* MBR fence */ - { - /* the flag is not set. create event. */ - - HANDLE e = CreateEvent(NULL, PTW32_FALSE, PTW32_FALSE, NULL); - - if (0 == PTW32_INTERLOCKED_COMPARE_EXCHANGE( - (PTW32_INTERLOCKED_LPLONG)flag, - (PTW32_INTERLOCKED_LONG)e, - (PTW32_INTERLOCKED_LONG)0)) - { - /* stored handle in the flag. wait on it now. */ - WaitForSingleObject(e, INFINITE); - } - - CloseHandle(e); - } -} - -/* - * ptw32_mcs_lock_acquire -- acquire an MCS lock. - * - * See: - * J. M. Mellor-Crummey and M. L. Scott. - * Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors. - * ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991. - */ -INLINE void -ptw32_mcs_lock_acquire (ptw32_mcs_lock_t * lock, ptw32_mcs_local_node_t * node) -{ - ptw32_mcs_local_node_t *pred; - - node->lock = lock; - node->nextFlag = 0; - node->readyFlag = 0; - node->next = 0; /* initially, no successor */ - - /* queue for the lock */ - pred = (ptw32_mcs_local_node_t *)PTW32_INTERLOCKED_EXCHANGE((LPLONG)lock, - (LONG)node); - - if (0 != pred) - { - /* the lock was not free. link behind predecessor. */ - pred->next = node; - ptw32_mcs_flag_set(&pred->nextFlag); - ptw32_mcs_flag_wait(&node->readyFlag); - } -} - -/* - * ptw32_mcs_lock_release -- release an MCS lock. - * - * See: - * J. M. Mellor-Crummey and M. L. Scott. - * Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors. - * ACM Transactions on Computer Systems, 9(1):21-65, Feb. 1991. - */ -INLINE void -ptw32_mcs_lock_release (ptw32_mcs_local_node_t * node) -{ - ptw32_mcs_lock_t *lock = node->lock; - ptw32_mcs_local_node_t *next = (ptw32_mcs_local_node_t *) - InterlockedExchangeAdd((LPLONG)&node->next, 0); /* MBR fence */ - - if (0 == next) - { - /* no known successor */ - - if (node == (ptw32_mcs_local_node_t *) - PTW32_INTERLOCKED_COMPARE_EXCHANGE((PTW32_INTERLOCKED_LPLONG)lock, - (PTW32_INTERLOCKED_LONG)0, - (PTW32_INTERLOCKED_LONG)node)) - { - /* no successor, lock is free now */ - return; - } - - /* wait for successor */ - ptw32_mcs_flag_wait(&node->nextFlag); - next = (ptw32_mcs_local_node_t *) - InterlockedExchangeAdd((LPLONG)&node->next, 0); /* MBR fence */ - } - - /* pass the lock */ - ptw32_mcs_flag_set(&next->readyFlag); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_callUserDestroyRoutines.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_callUserDestroyRoutines.c deleted file mode 100644 index a583f188d9f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_callUserDestroyRoutines.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * ptw32_callUserDestroyRoutines.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -#ifdef __cplusplus -# if ! defined (_MSC_VER) && ! (defined(__GNUC__) && __GNUC__ < 3) && ! defined(__WATCOMC__) -using - std::terminate; -# endif -#endif - -void -ptw32_callUserDestroyRoutines (pthread_t thread) - /* - * ------------------------------------------------------------------- - * DOCPRIVATE - * - * This the routine runs through all thread keys and calls - * the destroy routines on the user's data for the current thread. - * It simulates the behaviour of POSIX Threads. - * - * PARAMETERS - * thread - * an instance of pthread_t - * - * RETURNS - * N/A - * ------------------------------------------------------------------- - */ -{ - ThreadKeyAssoc * assoc; - - if (thread.p != NULL) - { - int assocsRemaining; - int iterations = 0; - ptw32_thread_t * sp = (ptw32_thread_t *) thread.p; - - /* - * Run through all Thread<-->Key associations - * for the current thread. - * - * Do this process at most PTHREAD_DESTRUCTOR_ITERATIONS times. - */ - do - { - assocsRemaining = 0; - iterations++; - - (void) pthread_mutex_lock(&(sp->threadLock)); - /* - * The pointer to the next assoc is stored in the thread struct so that - * the assoc destructor in pthread_key_delete can adjust it - * if it deletes this assoc. This can happen if we fail to acquire - * both locks below, and are forced to release all of our locks, - * leaving open the opportunity for pthread_key_delete to get in - * before us. - */ - sp->nextAssoc = sp->keys; - (void) pthread_mutex_unlock(&(sp->threadLock)); - - for (;;) - { - void * value; - pthread_key_t k; - void (*destructor) (void *); - - /* - * First we need to serialise with pthread_key_delete by locking - * both assoc guards, but in the reverse order to our convention, - * so we must be careful to avoid deadlock. - */ - (void) pthread_mutex_lock(&(sp->threadLock)); - - if ((assoc = (ThreadKeyAssoc *)sp->nextAssoc) == NULL) - { - /* Finished */ - pthread_mutex_unlock(&(sp->threadLock)); - break; - } - else - { - /* - * assoc->key must be valid because assoc can't change or be - * removed from our chain while we hold at least one lock. If - * the assoc was on our key chain then the key has not been - * deleted yet. - * - * Now try to acquire the second lock without deadlocking. - * If we fail, we need to relinquish the first lock and the - * processor and then try to acquire them all again. - */ - if (pthread_mutex_trylock(&(assoc->key->keyLock)) == EBUSY) - { - pthread_mutex_unlock(&(sp->threadLock)); - Sleep(1); // Ugly but necessary to avoid priority effects. - /* - * Go around again. - * If pthread_key_delete has removed this assoc in the meantime, - * sp->nextAssoc will point to a new assoc. - */ - continue; - } - } - - /* We now hold both locks */ - - sp->nextAssoc = assoc->nextKey; - - /* - * Key still active; pthread_key_delete - * will block on these same mutexes before - * it can release actual key; therefore, - * key is valid and we can call the destroy - * routine; - */ - k = assoc->key; - destructor = k->destructor; - value = TlsGetValue(k->key); - TlsSetValue (k->key, NULL); - - // Every assoc->key exists and has a destructor - if (value != NULL && iterations <= PTHREAD_DESTRUCTOR_ITERATIONS) - { - /* - * Unlock both locks before the destructor runs. - * POSIX says pthread_key_delete can be run from destructors, - * and that probably includes with this key as target. - * pthread_setspecific can also be run from destructors and - * also needs to be able to access the assocs. - */ - (void) pthread_mutex_unlock(&(sp->threadLock)); - (void) pthread_mutex_unlock(&(k->keyLock)); - - assocsRemaining++; - -#ifdef __cplusplus - - try - { - /* - * Run the caller's cleanup routine. - */ - destructor (value); - } - catch (...) - { - /* - * A system unexpected exception has occurred - * running the user's destructor. - * We get control back within this block in case - * the application has set up it's own terminate - * handler. Since we are leaving the thread we - * should not get any internal pthreads - * exceptions. - */ - terminate (); - } - -#else /* __cplusplus */ - - /* - * Run the caller's cleanup routine. - */ - destructor (value); - -#endif /* __cplusplus */ - - } - else - { - /* - * Remove association from both the key and thread chains - * and reclaim it's memory resources. - */ - ptw32_tkAssocDestroy (assoc); - (void) pthread_mutex_unlock(&(sp->threadLock)); - (void) pthread_mutex_unlock(&(k->keyLock)); - } - } - } - while (assocsRemaining); - } -} /* ptw32_callUserDestroyRoutines */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_calloc.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_calloc.c deleted file mode 100644 index eea7c748283..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_calloc.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ptw32_calloc.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#ifdef NEED_CALLOC -void * -ptw32_calloc (size_t n, size_t s) -{ - unsigned int m = n * s; - void *p; - - p = malloc (m); - if (p == NULL) - return NULL; - - memset (p, 0, m); - - return p; -} -#endif diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_cond_check_need_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_cond_check_need_init.c deleted file mode 100644 index 31359ad3fde..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_cond_check_need_init.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * ptw32_cond_check_need_init.c - * - * Description: - * This translation unit implements condition variables and their primitives. - * - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -INLINE int -ptw32_cond_check_need_init (pthread_cond_t * cond) -{ - int result = 0; - - /* - * The following guarded test is specifically for statically - * initialised condition variables (via PTHREAD_OBJECT_INITIALIZER). - * - * Note that by not providing this synchronisation we risk - * introducing race conditions into applications which are - * correctly written. - * - * Approach - * -------- - * We know that static condition variables will not be PROCESS_SHARED - * so we can serialise access to internal state using - * Win32 Critical Sections rather than Win32 Mutexes. - * - * If using a single global lock slows applications down too much, - * multiple global locks could be created and hashed on some random - * value associated with each mutex, the pointer perhaps. At a guess, - * a good value for the optimal number of global locks might be - * the number of processors + 1. - * - */ - EnterCriticalSection (&ptw32_cond_test_init_lock); - - /* - * We got here possibly under race - * conditions. Check again inside the critical section. - * If a static cv has been destroyed, the application can - * re-initialise it only by calling pthread_cond_init() - * explicitly. - */ - if (*cond == PTHREAD_COND_INITIALIZER) - { - result = pthread_cond_init (cond, NULL); - } - else if (*cond == NULL) - { - /* - * The cv has been destroyed while we were waiting to - * initialise it, so the operation that caused the - * auto-initialisation should fail. - */ - result = EINVAL; - } - - LeaveCriticalSection (&ptw32_cond_test_init_lock); - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_getprocessors.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_getprocessors.c deleted file mode 100644 index e60c3143f9d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_getprocessors.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * ptw32_getprocessors.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -/* - * ptw32_getprocessors() - * - * Get the number of CPUs available to the process. - * - * If the available number of CPUs is 1 then pthread_spin_lock() - * will block rather than spin if the lock is already owned. - * - * pthread_spin_init() calls this routine when initialising - * a spinlock. If the number of available processors changes - * (after a call to SetProcessAffinityMask()) then only - * newly initialised spinlocks will notice. - */ -int -ptw32_getprocessors (int *count) -{ - DWORD_PTR vProcessCPUs; - DWORD_PTR vSystemCPUs; - int result = 0; - -#if defined(NEED_PROCESS_AFFINITY_MASK) - - *count = 1; - -#else - - if (GetProcessAffinityMask (GetCurrentProcess (), - &vProcessCPUs, &vSystemCPUs)) - { - DWORD_PTR bit; - int CPUs = 0; - - for (bit = 1; bit != 0; bit <<= 1) - { - if (vProcessCPUs & bit) - { - CPUs++; - } - } - *count = CPUs; - } - else - { - result = EAGAIN; - } - -#endif - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_is_attr.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_is_attr.c deleted file mode 100644 index 36395f81f00..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_is_attr.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ptw32_is_attr.c - * - * Description: - * This translation unit implements operations on thread attribute objects. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -int -ptw32_is_attr (const pthread_attr_t * attr) -{ - /* Return 0 if the attr object is valid, non-zero otherwise. */ - - return (attr == NULL || - *attr == NULL || (*attr)->valid != PTW32_ATTR_VALID); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_mutex_check_need_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_mutex_check_need_init.c deleted file mode 100644 index 35ec366bde7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_mutex_check_need_init.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ptw32_mutex_check_need_init.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -static struct pthread_mutexattr_t_ ptw32_recursive_mutexattr_s = - {PTHREAD_PROCESS_PRIVATE, PTHREAD_MUTEX_RECURSIVE}; -static struct pthread_mutexattr_t_ ptw32_errorcheck_mutexattr_s = - {PTHREAD_PROCESS_PRIVATE, PTHREAD_MUTEX_ERRORCHECK}; -static pthread_mutexattr_t ptw32_recursive_mutexattr = &ptw32_recursive_mutexattr_s; -static pthread_mutexattr_t ptw32_errorcheck_mutexattr = &ptw32_errorcheck_mutexattr_s; - - -INLINE int -ptw32_mutex_check_need_init (pthread_mutex_t * mutex) -{ - register int result = 0; - register pthread_mutex_t mtx; - - /* - * The following guarded test is specifically for statically - * initialised mutexes (via PTHREAD_MUTEX_INITIALIZER). - * - * Note that by not providing this synchronisation we risk - * introducing race conditions into applications which are - * correctly written. - * - * Approach - * -------- - * We know that static mutexes will not be PROCESS_SHARED - * so we can serialise access to internal state using - * Win32 Critical Sections rather than Win32 Mutexes. - * - * If using a single global lock slows applications down too much, - * multiple global locks could be created and hashed on some random - * value associated with each mutex, the pointer perhaps. At a guess, - * a good value for the optimal number of global locks might be - * the number of processors + 1. - * - */ - EnterCriticalSection (&ptw32_mutex_test_init_lock); - - /* - * We got here possibly under race - * conditions. Check again inside the critical section - * and only initialise if the mutex is valid (not been destroyed). - * If a static mutex has been destroyed, the application can - * re-initialise it only by calling pthread_mutex_init() - * explicitly. - */ - mtx = *mutex; - - if (mtx == PTHREAD_MUTEX_INITIALIZER) - { - result = pthread_mutex_init (mutex, NULL); - } - else if (mtx == PTHREAD_RECURSIVE_MUTEX_INITIALIZER) - { - result = pthread_mutex_init (mutex, &ptw32_recursive_mutexattr); - } - else if (mtx == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) - { - result = pthread_mutex_init (mutex, &ptw32_errorcheck_mutexattr); - } - else if (mtx == NULL) - { - /* - * The mutex has been destroyed while we were waiting to - * initialise it, so the operation that caused the - * auto-initialisation should fail. - */ - result = EINVAL; - } - - LeaveCriticalSection (&ptw32_mutex_test_init_lock); - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_new.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_new.c deleted file mode 100644 index 281256741be..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_new.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * ptw32_new.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -pthread_t -ptw32_new (void) -{ - pthread_t t; - pthread_t nil = {NULL, 0}; - ptw32_thread_t * tp; - - /* - * If there's a reusable pthread_t then use it. - */ - t = ptw32_threadReusePop (); - - if (NULL != t.p) - { - tp = (ptw32_thread_t *) t.p; - } - else - { - /* No reuse threads available */ - tp = (ptw32_thread_t *) calloc (1, sizeof(ptw32_thread_t)); - - if (tp == NULL) - { - return nil; - } - - /* ptHandle.p needs to point to it's parent ptw32_thread_t. */ - t.p = tp->ptHandle.p = tp; - t.x = tp->ptHandle.x = 0; - } - - /* Set default state. */ - tp->sched_priority = THREAD_PRIORITY_NORMAL; - tp->detachState = PTHREAD_CREATE_JOINABLE; - tp->cancelState = PTHREAD_CANCEL_ENABLE; - tp->cancelType = PTHREAD_CANCEL_DEFERRED; - tp->cancelLock = PTHREAD_MUTEX_INITIALIZER; - tp->threadLock = PTHREAD_MUTEX_INITIALIZER; - tp->cancelEvent = CreateEvent (0, (int) PTW32_TRUE, /* manualReset */ - (int) PTW32_FALSE, /* setSignaled */ - NULL); - - if (tp->cancelEvent == NULL) - { - ptw32_threadReusePush (tp->ptHandle); - return nil; - } - - return t; - -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_processInitialize.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_processInitialize.c deleted file mode 100644 index d13b0226f02..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_processInitialize.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * ptw32_processInitialize.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -ptw32_processInitialize (void) - /* - * ------------------------------------------------------ - * DOCPRIVATE - * This function performs process wide initialization for - * the pthread library. - * - * PARAMETERS - * N/A - * - * DESCRIPTION - * This function performs process wide initialization for - * the pthread library. - * If successful, this routine sets the global variable - * ptw32_processInitialized to TRUE. - * - * RESULTS - * TRUE if successful, - * FALSE otherwise - * - * ------------------------------------------------------ - */ -{ - if (ptw32_processInitialized) - { - /* - * Ignore if already initialized. this is useful for - * programs that uses a non-dll pthread - * library. Such programs must call ptw32_processInitialize() explicitly, - * since this initialization routine is automatically called only when - * the dll is loaded. - */ - return PTW32_TRUE; - } - - ptw32_processInitialized = PTW32_TRUE; - - /* - * Initialize Keys - */ - if ((pthread_key_create (&ptw32_selfThreadKey, NULL) != 0) || - (pthread_key_create (&ptw32_cleanupKey, NULL) != 0)) - { - - ptw32_processTerminate (); - } - - /* - * Set up the global locks. - */ - InitializeCriticalSection (&ptw32_thread_reuse_lock); - InitializeCriticalSection (&ptw32_mutex_test_init_lock); - InitializeCriticalSection (&ptw32_cond_list_lock); - InitializeCriticalSection (&ptw32_cond_test_init_lock); - InitializeCriticalSection (&ptw32_rwlock_test_init_lock); - InitializeCriticalSection (&ptw32_spinlock_test_init_lock); - - return (ptw32_processInitialized); - -} /* processInitialize */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_processTerminate.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_processTerminate.c deleted file mode 100644 index d2dfa7a2478..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_processTerminate.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * ptw32_processTerminate.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -void -ptw32_processTerminate (void) - /* - * ------------------------------------------------------ - * DOCPRIVATE - * This function performs process wide termination for - * the pthread library. - * - * PARAMETERS - * N/A - * - * DESCRIPTION - * This function performs process wide termination for - * the pthread library. - * This routine sets the global variable - * ptw32_processInitialized to FALSE - * - * RESULTS - * N/A - * - * ------------------------------------------------------ - */ -{ - if (ptw32_processInitialized) - { - ptw32_thread_t * tp, * tpNext; - - if (ptw32_selfThreadKey != NULL) - { - /* - * Release ptw32_selfThreadKey - */ - pthread_key_delete (ptw32_selfThreadKey); - - ptw32_selfThreadKey = NULL; - } - - if (ptw32_cleanupKey != NULL) - { - /* - * Release ptw32_cleanupKey - */ - pthread_key_delete (ptw32_cleanupKey); - - ptw32_cleanupKey = NULL; - } - - EnterCriticalSection (&ptw32_thread_reuse_lock); - - tp = ptw32_threadReuseTop; - while (tp != PTW32_THREAD_REUSE_EMPTY) - { - tpNext = tp->prevReuse; - free (tp); - tp = tpNext; - } - - LeaveCriticalSection (&ptw32_thread_reuse_lock); - - /* - * Destroy the global locks and other objects. - */ - DeleteCriticalSection (&ptw32_spinlock_test_init_lock); - DeleteCriticalSection (&ptw32_rwlock_test_init_lock); - DeleteCriticalSection (&ptw32_cond_test_init_lock); - DeleteCriticalSection (&ptw32_cond_list_lock); - DeleteCriticalSection (&ptw32_mutex_test_init_lock); - DeleteCriticalSection (&ptw32_thread_reuse_lock); - - ptw32_processInitialized = PTW32_FALSE; - } - -} /* processTerminate */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_relmillisecs.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_relmillisecs.c deleted file mode 100644 index f3e7b769ff1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_relmillisecs.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * ptw32_relmillisecs.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _UWIN -//#include -#endif -#include "pthread.h" -#include "implement.h" -#ifndef NEED_FTIME -#include -#endif - - -INLINE DWORD -ptw32_relmillisecs (const struct timespec * abstime) -{ - const int64_t NANOSEC_PER_MILLISEC = 1000000; - const int64_t MILLISEC_PER_SEC = 1000; - DWORD milliseconds; - int64_t tmpAbsMilliseconds; - int64_t tmpCurrMilliseconds; -#ifdef NEED_FTIME - struct timespec currSysTime; - FILETIME ft; - SYSTEMTIME st; -#else /* ! NEED_FTIME */ - struct _timeb currSysTime; -#endif /* NEED_FTIME */ - - - /* - * Calculate timeout as milliseconds from current system time. - */ - - /* - * subtract current system time from abstime in a way that checks - * that abstime is never in the past, or is never equivalent to the - * defined INFINITE value (0xFFFFFFFF). - * - * Assume all integers are unsigned, i.e. cannot test if less than 0. - */ - tmpAbsMilliseconds = (int64_t)abstime->tv_sec * MILLISEC_PER_SEC; - tmpAbsMilliseconds += ((int64_t)abstime->tv_nsec + (NANOSEC_PER_MILLISEC/2)) / NANOSEC_PER_MILLISEC; - - /* get current system time */ - -#ifdef NEED_FTIME - - GetSystemTime(&st); - SystemTimeToFileTime(&st, &ft); - /* - * GetSystemTimeAsFileTime(&ft); would be faster, - * but it does not exist on WinCE - */ - - ptw32_filetime_to_timespec(&ft, &currSysTime); - - tmpCurrMilliseconds = (int64_t)currSysTime.tv_sec * MILLISEC_PER_SEC; - tmpCurrMilliseconds += ((int64_t)currSysTime.tv_nsec + (NANOSEC_PER_MILLISEC/2)) - / NANOSEC_PER_MILLISEC; - -#else /* ! NEED_FTIME */ - - _ftime(&currSysTime); - - tmpCurrMilliseconds = (int64_t) currSysTime.time * MILLISEC_PER_SEC; - tmpCurrMilliseconds += (int64_t) currSysTime.millitm; - -#endif /* NEED_FTIME */ - - if (tmpAbsMilliseconds > tmpCurrMilliseconds) - { - milliseconds = (DWORD) (tmpAbsMilliseconds - tmpCurrMilliseconds); - if (milliseconds == INFINITE) - { - /* Timeouts must be finite */ - milliseconds--; - } - } - else - { - /* The abstime given is in the past */ - milliseconds = 0; - } - - return milliseconds; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_reuse.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_reuse.c deleted file mode 100644 index 0e86984967b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_reuse.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * ptw32_threadReuse.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -/* - * How it works: - * A pthread_t is a struct (2x32 bit scalar types on IA-32, 2x64 bit on IA-64) - * which is normally passed/returned by value to/from pthreads routines. - * Applications are therefore storing a copy of the struct as it is at that - * time. - * - * The original pthread_t struct plus all copies of it contain the address of - * the thread state struct ptw32_thread_t_ (p), plus a reuse counter (x). Each - * ptw32_thread_t contains the original copy of it's pthread_t. - * Once malloced, a ptw32_thread_t_ struct is not freed until the process exits. - * - * The thread reuse stack is a simple LILO stack managed through a singly - * linked list element in the ptw32_thread_t. - * - * Each time a thread is destroyed, the ptw32_thread_t address is pushed onto the - * reuse stack after it's ptHandle's reuse counter has been incremented. - * - * The following can now be said from this: - * - two pthread_t's are identical if their ptw32_thread_t reference pointers - * are equal and their reuse counters are equal. That is, - * - * equal = (a.p == b.p && a.x == b.x) - * - * - a pthread_t copy refers to a destroyed thread if the reuse counter in - * the copy is not equal to the reuse counter in the original. - * - * threadDestroyed = (copy.x != ((ptw32_thread_t *)copy.p)->ptHandle.x) - * - */ - -/* - * Pop a clean pthread_t struct off the reuse stack. - */ -pthread_t -ptw32_threadReusePop (void) -{ - pthread_t t = {NULL, 0}; - - EnterCriticalSection (&ptw32_thread_reuse_lock); - - if (PTW32_THREAD_REUSE_EMPTY != ptw32_threadReuseTop) - { - ptw32_thread_t * tp; - - tp = ptw32_threadReuseTop; - - ptw32_threadReuseTop = tp->prevReuse; - - if (PTW32_THREAD_REUSE_EMPTY == ptw32_threadReuseTop) - { - ptw32_threadReuseBottom = PTW32_THREAD_REUSE_EMPTY; - } - - tp->prevReuse = NULL; - - t = tp->ptHandle; - } - - LeaveCriticalSection (&ptw32_thread_reuse_lock); - - return t; - -} - -/* - * Push a clean pthread_t struct onto the reuse stack. - * Must be re-initialised when reused. - * All object elements (mutexes, events etc) must have been either - * detroyed before this, or never initialised. - */ -void -ptw32_threadReusePush (pthread_t thread) -{ - ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; - pthread_t t; - - EnterCriticalSection (&ptw32_thread_reuse_lock); - - t = tp->ptHandle; - memset(tp, 0, sizeof(ptw32_thread_t)); - - /* Must restore the original POSIX handle that we just wiped. */ - tp->ptHandle = t; - - /* Bump the reuse counter now */ -#ifdef PTW32_THREAD_ID_REUSE_INCREMENT - tp->ptHandle.x += PTW32_THREAD_ID_REUSE_INCREMENT; -#else - tp->ptHandle.x++; -#endif - - tp->prevReuse = PTW32_THREAD_REUSE_EMPTY; - - if (PTW32_THREAD_REUSE_EMPTY != ptw32_threadReuseBottom) - { - ptw32_threadReuseBottom->prevReuse = tp; - } - else - { - ptw32_threadReuseTop = tp; - } - - ptw32_threadReuseBottom = tp; - - LeaveCriticalSection (&ptw32_thread_reuse_lock); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_rwlock_cancelwrwait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_rwlock_cancelwrwait.c deleted file mode 100644 index a057bd1d72f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_rwlock_cancelwrwait.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ptw32_rwlock_cancelwrwait.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -void -ptw32_rwlock_cancelwrwait (void *arg) -{ - pthread_rwlock_t rwl = (pthread_rwlock_t) arg; - - rwl->nSharedAccessCount = -rwl->nCompletedSharedAccessCount; - rwl->nCompletedSharedAccessCount = 0; - - (void) pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); - (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_rwlock_check_need_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_rwlock_check_need_init.c deleted file mode 100644 index ea2561eefb0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_rwlock_check_need_init.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * pthread_rwlock_check_need_init.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -INLINE int -ptw32_rwlock_check_need_init (pthread_rwlock_t * rwlock) -{ - int result = 0; - - /* - * The following guarded test is specifically for statically - * initialised rwlocks (via PTHREAD_RWLOCK_INITIALIZER). - * - * Note that by not providing this synchronisation we risk - * introducing race conditions into applications which are - * correctly written. - * - * Approach - * -------- - * We know that static rwlocks will not be PROCESS_SHARED - * so we can serialise access to internal state using - * Win32 Critical Sections rather than Win32 Mutexes. - * - * If using a single global lock slows applications down too much, - * multiple global locks could be created and hashed on some random - * value associated with each mutex, the pointer perhaps. At a guess, - * a good value for the optimal number of global locks might be - * the number of processors + 1. - * - */ - EnterCriticalSection (&ptw32_rwlock_test_init_lock); - - /* - * We got here possibly under race - * conditions. Check again inside the critical section - * and only initialise if the rwlock is valid (not been destroyed). - * If a static rwlock has been destroyed, the application can - * re-initialise it only by calling pthread_rwlock_init() - * explicitly. - */ - if (*rwlock == PTHREAD_RWLOCK_INITIALIZER) - { - result = pthread_rwlock_init (rwlock, NULL); - } - else if (*rwlock == NULL) - { - /* - * The rwlock has been destroyed while we were waiting to - * initialise it, so the operation that caused the - * auto-initialisation should fail. - */ - result = EINVAL; - } - - LeaveCriticalSection (&ptw32_rwlock_test_init_lock); - - return result; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_semwait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_semwait.c deleted file mode 100644 index 8b23d11d62e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_semwait.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * ptw32_semwait.c - * - * Description: - * This translation unit implements mutual exclusion (mutex) primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef _UWIN -//# include -#endif -#include "pthread.h" -#include "implement.h" - - -int -ptw32_semwait (sem_t * sem) - /* - * ------------------------------------------------------ - * DESCRIPTION - * This function waits on a POSIX semaphore. If the - * semaphore value is greater than zero, it decreases - * its value by one. If the semaphore value is zero, then - * the calling thread (or process) is blocked until it can - * successfully decrease the value. - * - * Unlike sem_wait(), this routine is non-cancelable. - * - * RESULTS - * 0 successfully decreased semaphore, - * -1 failed, error in errno. - * ERRNO - * EINVAL 'sem' is not a valid semaphore, - * ENOSYS semaphores are not supported, - * EINTR the function was interrupted by a signal, - * EDEADLK a deadlock condition was detected. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = *sem; - - if (s == NULL) - { - result = EINVAL; - } - else - { - if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - int v = --s->value; - - (void) pthread_mutex_unlock (&s->lock); - - if (v < 0) - { - /* Must wait */ - if (WaitForSingleObject (s->sem, INFINITE) == WAIT_OBJECT_0) - { -#ifdef NEED_SEM - if (pthread_mutex_lock (&s->lock) == 0) - { - if (s->leftToUnblock > 0) - { - --s->leftToUnblock; - SetEvent(s->sem); - } - (void) pthread_mutex_unlock (&s->lock); - } -#endif - return 0; - } - } - else - { - return 0; - } - } - } - - if (result != 0) - { - errno = result; - return -1; - } - - return 0; - -} /* ptw32_semwait */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_spinlock_check_need_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_spinlock_check_need_init.c deleted file mode 100644 index bf45bc397a1..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_spinlock_check_need_init.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ptw32_spinlock_check_need_init.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -INLINE int -ptw32_spinlock_check_need_init (pthread_spinlock_t * lock) -{ - int result = 0; - - /* - * The following guarded test is specifically for statically - * initialised spinlocks (via PTHREAD_SPINLOCK_INITIALIZER). - * - * Note that by not providing this synchronisation we risk - * introducing race conditions into applications which are - * correctly written. - */ - EnterCriticalSection (&ptw32_spinlock_test_init_lock); - - /* - * We got here possibly under race - * conditions. Check again inside the critical section - * and only initialise if the spinlock is valid (not been destroyed). - * If a static spinlock has been destroyed, the application can - * re-initialise it only by calling pthread_spin_init() - * explicitly. - */ - if (*lock == PTHREAD_SPINLOCK_INITIALIZER) - { - result = pthread_spin_init (lock, PTHREAD_PROCESS_PRIVATE); - } - else if (*lock == NULL) - { - /* - * The spinlock has been destroyed while we were waiting to - * initialise it, so the operation that caused the - * auto-initialisation should fail. - */ - result = EINVAL; - } - - LeaveCriticalSection (&ptw32_spinlock_test_init_lock); - - return (result); -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_threadDestroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_threadDestroy.c deleted file mode 100644 index eb9abfc61c7..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_threadDestroy.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ptw32_threadDestroy.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -void -ptw32_threadDestroy (pthread_t thread) -{ - ptw32_thread_t * tp = (ptw32_thread_t *) thread.p; - ptw32_thread_t threadCopy; - - if (tp != NULL) - { - /* - * Copy thread state so that the thread can be atomically NULLed. - */ - memcpy (&threadCopy, tp, sizeof (threadCopy)); - - /* - * Thread ID structs are never freed. They're NULLed and reused. - * This also sets the thread to PThreadStateInitial (invalid). - */ - ptw32_threadReusePush (thread); - - /* Now work on the copy. */ - if (threadCopy.cancelEvent != NULL) - { - CloseHandle (threadCopy.cancelEvent); - } - - (void) pthread_mutex_destroy(&threadCopy.cancelLock); - (void) pthread_mutex_destroy(&threadCopy.threadLock); - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) - /* - * See documentation for endthread vs endthreadex. - */ - if (threadCopy.threadH != 0) - { - CloseHandle (threadCopy.threadH); - } -#endif - - } -} /* ptw32_threadDestroy */ - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_threadStart.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_threadStart.c deleted file mode 100644 index 5c0fe0e857c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_threadStart.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * ptw32_threadStart.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -#ifdef __CLEANUP_SEH - -static DWORD -ExceptionFilter (EXCEPTION_POINTERS * ep, DWORD * ei) -{ - switch (ep->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_PTW32_SERVICES: - { - DWORD param; - DWORD numParams = ep->ExceptionRecord->NumberParameters; - - numParams = (numParams > 3) ? 3 : numParams; - - for (param = 0; param < numParams; param++) - { - ei[param] = ep->ExceptionRecord->ExceptionInformation[param]; - } - - return EXCEPTION_EXECUTE_HANDLER; - break; - } - default: - { - /* - * A system unexpected exception has occurred running the user's - * routine. We need to cleanup before letting the exception - * out of thread scope. - */ - pthread_t self = pthread_self (); - - (void) pthread_mutex_destroy (&((ptw32_thread_t *)self.p)->cancelLock); - ptw32_callUserDestroyRoutines (self); - - return EXCEPTION_CONTINUE_SEARCH; - break; - } - } -} - -#elif defined(__CLEANUP_CXX) - -#if defined(_MSC_VER) -# include -#elif defined(__WATCOMC__) -# include -# include -typedef terminate_handler - terminate_function; -#else -# if defined(__GNUC__) && __GNUC__ < 3 -# include -# else -# include -using - std::terminate_handler; -using - std::terminate; -using - std::set_terminate; -# endif -typedef terminate_handler - terminate_function; -#endif - -static terminate_function - ptw32_oldTerminate; - -void -ptw32_terminate () -{ - set_terminate (ptw32_oldTerminate); - (void) pthread_win32_thread_detach_np (); - terminate (); -} - -#endif - -#if ! defined (__MINGW32__) || (defined (__MSVCRT__) && ! defined (__DMC__)) -unsigned - __stdcall -#else -void -#endif -ptw32_threadStart (void *vthreadParms) -{ - ThreadParms * threadParms = (ThreadParms *) vthreadParms; - pthread_t self; - ptw32_thread_t * sp; - void *(*start) (void *); - void * arg; - -#ifdef __CLEANUP_SEH - DWORD - ei[] = { 0, 0, 0 }; -#endif - -#ifdef __CLEANUP_C - int setjmp_rc; -#endif - - void * status = (void *) 0; - - self = threadParms->tid; - sp = (ptw32_thread_t *) self.p; - start = threadParms->start; - arg = threadParms->arg; - - free (threadParms); - -#if defined (__MINGW32__) && ! defined (__MSVCRT__) - /* - * beginthread does not return the thread id and is running - * before it returns us the thread handle, and so we do it here. - */ - sp->thread = GetCurrentThreadId (); - /* - * Here we're using cancelLock as a general-purpose lock - * to make the new thread wait until the creating thread - * has the new handle. - */ - if (pthread_mutex_lock (&sp->cancelLock) == 0) - { - (void) pthread_mutex_unlock (&sp->cancelLock); - } -#endif - - pthread_setspecific (ptw32_selfThreadKey, sp); - - sp->state = PThreadStateRunning; - -#ifdef __CLEANUP_SEH - - __try - { - /* - * Run the caller's routine; - */ - status = sp->exitStatus = (*start) (arg); - -#ifdef _UWIN - if (--pthread_count <= 0) - exit (0); -#endif - - } - __except (ExceptionFilter (GetExceptionInformation (), ei)) - { - switch (ei[0]) - { - case PTW32_EPS_CANCEL: - status = sp->exitStatus = PTHREAD_CANCELED; -#ifdef _UWIN - if (--pthread_count <= 0) - exit (0); -#endif - break; - case PTW32_EPS_EXIT: - status = sp->exitStatus; - break; - default: - status = sp->exitStatus = PTHREAD_CANCELED; - break; - } - } - -#else /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_C - - setjmp_rc = setjmp (sp->start_mark); - - if (0 == setjmp_rc) - { - - /* - * Run the caller's routine; - */ - status = sp->exitStatus = (*start) (arg); - } - else - { - switch (setjmp_rc) - { - case PTW32_EPS_CANCEL: - status = sp->exitStatus = PTHREAD_CANCELED; - break; - case PTW32_EPS_EXIT: - status = sp->exitStatus; - break; - default: - status = sp->exitStatus = PTHREAD_CANCELED; - break; - } - } - -#else /* __CLEANUP_C */ - -#ifdef __CLEANUP_CXX - - ptw32_oldTerminate = set_terminate (&ptw32_terminate); - - try - { - /* - * Run the caller's routine in a nested try block so that we - * can run the user's terminate function, which may call - * pthread_exit() or be canceled. - */ - try - { - status = sp->exitStatus = (*start) (arg); - } - catch (ptw32_exception &) - { - /* - * Pass these through to the outer block. - */ - throw; - } - catch (...) - { - /* - * We want to run the user's terminate function if supplied. - * That function may call pthread_exit() or be canceled, which will - * be handled by the outer try block. - * - * ptw32_terminate() will be called if there is no user - * supplied function. - */ - - terminate_function - term_func = set_terminate (0); - set_terminate (term_func); - - if (term_func != 0) - { - term_func (); - } - - throw; - } - } - catch (ptw32_exception_cancel &) - { - /* - * Thread was canceled. - */ - status = sp->exitStatus = PTHREAD_CANCELED; - } - catch (ptw32_exception_exit &) - { - /* - * Thread was exited via pthread_exit(). - */ - status = sp->exitStatus; - } - catch (...) - { - /* - * A system unexpected exception has occurred running the user's - * terminate routine. We get control back within this block - cleanup - * and release the exception out of thread scope. - */ - status = sp->exitStatus = PTHREAD_CANCELED; - (void) pthread_mutex_lock (&sp->cancelLock); - sp->state = PThreadStateException; - (void) pthread_mutex_unlock (&sp->cancelLock); - (void) pthread_win32_thread_detach_np (); - (void) set_terminate (ptw32_oldTerminate); - throw; - - /* - * Never reached. - */ - } - - (void) set_terminate (ptw32_oldTerminate); - -#else - -#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. - -#endif /* __CLEANUP_CXX */ -#endif /* __CLEANUP_C */ -#endif /* __CLEANUP_SEH */ - -#if defined(PTW32_STATIC_LIB) - /* - * We need to cleanup the pthread now if we have - * been statically linked, in which case the cleanup - * in dllMain won't get done. Joinable threads will - * only be partially cleaned up and must be fully cleaned - * up by pthread_join() or pthread_detach(). - * - * Note: if this library has been statically linked, - * implicitly created pthreads (those created - * for Win32 threads which have called pthreads routines) - * must be cleaned up explicitly by the application - * (by calling pthread_win32_thread_detach_np()). - * For the dll, dllMain will do the cleanup automatically. - */ - (void) pthread_win32_thread_detach_np (); -#endif - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) - _endthreadex ((unsigned) status); -#else - _endthread (); -#endif - - /* - * Never reached. - */ - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) - return (unsigned) status; -#endif - -} /* ptw32_threadStart */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_throw.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_throw.c deleted file mode 100644 index 493f4e4dc1f..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_throw.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * ptw32_throw.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - -/* - * ptw32_throw - * - * All canceled and explicitly exited POSIX threads go through - * here. This routine knows how to exit both POSIX initiated threads and - * 'implicit' POSIX threads for each of the possible language modes (C, - * C++, and SEH). - */ -void -ptw32_throw (DWORD exception) -{ - /* - * Don't use pthread_self() to avoid creating an implicit POSIX thread handle - * unnecessarily. - */ - ptw32_thread_t * sp = (ptw32_thread_t *) pthread_getspecific (ptw32_selfThreadKey); - -#ifdef __CLEANUP_SEH - DWORD exceptionInformation[3]; -#endif - - if (exception != PTW32_EPS_CANCEL && exception != PTW32_EPS_EXIT) - { - /* Should never enter here */ - exit (1); - } - - if (NULL == sp || sp->implicit) - { - /* - * We're inside a non-POSIX initialised Win32 thread - * so there is no point to jump or throw back to. Just do an - * explicit thread exit here after cleaning up POSIX - * residue (i.e. cleanup handlers, POSIX thread handle etc). - */ - unsigned exitCode = 0; - - switch (exception) - { - case PTW32_EPS_CANCEL: - exitCode = (unsigned) PTHREAD_CANCELED; - break; - case PTW32_EPS_EXIT: - exitCode = (unsigned) sp->exitStatus;; - break; - } - -#if defined(PTW32_STATIC_LIB) - - pthread_win32_thread_detach_np (); - -#endif - -#if ! defined (__MINGW32__) || defined (__MSVCRT__) || defined (__DMC__) - _endthreadex (exitCode); -#else - _endthread (); -#endif - - } - -#ifdef __CLEANUP_SEH - - - exceptionInformation[0] = (DWORD) (exception); - exceptionInformation[1] = (DWORD) (0); - exceptionInformation[2] = (DWORD) (0); - - RaiseException (EXCEPTION_PTW32_SERVICES, 0, 3, exceptionInformation); - -#else /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_C - - ptw32_pop_cleanup_all (1); - longjmp (sp->start_mark, exception); - -#else /* __CLEANUP_C */ - -#ifdef __CLEANUP_CXX - - switch (exception) - { - case PTW32_EPS_CANCEL: - throw ptw32_exception_cancel (); - break; - case PTW32_EPS_EXIT: - throw ptw32_exception_exit (); - break; - } - -#else - -#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. - -#endif /* __CLEANUP_CXX */ - -#endif /* __CLEANUP_C */ - -#endif /* __CLEANUP_SEH */ - - /* Never reached */ -} - - -void -ptw32_pop_cleanup_all (int execute) -{ - while (NULL != ptw32_pop_cleanup (execute)) - { - } -} - - -DWORD -ptw32_get_exception_services_code (void) -{ -#ifdef __CLEANUP_SEH - - return EXCEPTION_PTW32_SERVICES; - -#else - - return (DWORD) NULL; - -#endif -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_timespec.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_timespec.c deleted file mode 100644 index 6a2cb565a74..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_timespec.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ptw32_timespec.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#ifdef NEED_FTIME - -/* - * time between jan 1, 1601 and jan 1, 1970 in units of 100 nanoseconds - */ -#define PTW32_TIMESPEC_TO_FILETIME_OFFSET \ - ( ((LONGLONG) 27111902 << 32) + (LONGLONG) 3577643008 ) - -INLINE void -ptw32_timespec_to_filetime (const struct timespec *ts, FILETIME * ft) - /* - * ------------------------------------------------------------------- - * converts struct timespec - * where the time is expressed in seconds and nanoseconds from Jan 1, 1970. - * into FILETIME (as set by GetSystemTimeAsFileTime), where the time is - * expressed in 100 nanoseconds from Jan 1, 1601, - * ------------------------------------------------------------------- - */ -{ - *(LONGLONG *) ft = ts->tv_sec * 10000000 - + (ts->tv_nsec + 50) / 100 + PTW32_TIMESPEC_TO_FILETIME_OFFSET; -} - -INLINE void -ptw32_filetime_to_timespec (const FILETIME * ft, struct timespec *ts) - /* - * ------------------------------------------------------------------- - * converts FILETIME (as set by GetSystemTimeAsFileTime), where the time is - * expressed in 100 nanoseconds from Jan 1, 1601, - * into struct timespec - * where the time is expressed in seconds and nanoseconds from Jan 1, 1970. - * ------------------------------------------------------------------- - */ -{ - ts->tv_sec = - (int) ((*(LONGLONG *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET) / 10000000); - ts->tv_nsec = - (int) ((*(LONGLONG *) ft - PTW32_TIMESPEC_TO_FILETIME_OFFSET - - ((LONGLONG) ts->tv_sec * (LONGLONG) 10000000)) * 100); -} - -#endif /* NEED_FTIME */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_tkAssocCreate.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_tkAssocCreate.c deleted file mode 100644 index 5ba24bbf710..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_tkAssocCreate.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * ptw32_tkAssocCreate.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -int -ptw32_tkAssocCreate (ptw32_thread_t * sp, pthread_key_t key) - /* - * ------------------------------------------------------------------- - * This routine creates an association that - * is unique for the given (thread,key) combination.The association - * is referenced by both the thread and the key. - * This association allows us to determine what keys the - * current thread references and what threads a given key - * references. - * See the detailed description - * at the beginning of this file for further details. - * - * Notes: - * 1) New associations are pushed to the beginning of the - * chain so that the internal ptw32_selfThreadKey association - * is always last, thus allowing selfThreadExit to - * be implicitly called last by pthread_exit. - * 2) - * - * Parameters: - * thread - * current running thread. - * key - * key on which to create an association. - * Returns: - * 0 - if successful, - * ENOMEM - not enough memory to create assoc or other object - * EINVAL - an internal error occurred - * ENOSYS - an internal error occurred - * ------------------------------------------------------------------- - */ -{ - ThreadKeyAssoc *assoc; - - /* - * Have to create an association and add it - * to both the key and the thread. - * - * Both key->keyLock and thread->threadLock are locked on - * entry to this routine. - */ - assoc = (ThreadKeyAssoc *) calloc (1, sizeof (*assoc)); - - if (assoc == NULL) - { - return ENOMEM; - } - - assoc->thread = sp; - assoc->key = key; - - /* - * Register assoc with key - */ - assoc->prevThread = NULL; - assoc->nextThread = (ThreadKeyAssoc *) key->threads; - if (assoc->nextThread != NULL) - { - assoc->nextThread->prevThread = assoc; - } - key->threads = (void *) assoc; - - /* - * Register assoc with thread - */ - assoc->prevKey = NULL; - assoc->nextKey = (ThreadKeyAssoc *) sp->keys; - if (assoc->nextKey != NULL) - { - assoc->nextKey->prevKey = assoc; - } - sp->keys = (void *) assoc; - - return (0); - -} /* ptw32_tkAssocCreate */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_tkAssocDestroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_tkAssocDestroy.c deleted file mode 100644 index a7842ea87dd..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/ptw32_tkAssocDestroy.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * ptw32_tkAssocDestroy.c - * - * Description: - * This translation unit implements routines which are private to - * the implementation and may be used throughout it. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -void -ptw32_tkAssocDestroy (ThreadKeyAssoc * assoc) - /* - * ------------------------------------------------------------------- - * This routine releases all resources for the given ThreadKeyAssoc - * once it is no longer being referenced - * ie) either the key or thread has stopped referencing it. - * - * Parameters: - * assoc - * an instance of ThreadKeyAssoc. - * Returns: - * N/A - * ------------------------------------------------------------------- - */ -{ - - /* - * Both key->keyLock and thread->threadLock are locked on - * entry to this routine. - */ - if (assoc != NULL) - { - ThreadKeyAssoc * prev, * next; - - /* Remove assoc from thread's keys chain */ - prev = assoc->prevKey; - next = assoc->nextKey; - if (prev != NULL) - { - prev->nextKey = next; - } - if (next != NULL) - { - next->prevKey = prev; - } - - if (assoc->thread->keys == assoc) - { - /* We're at the head of the thread's keys chain */ - assoc->thread->keys = next; - } - if (assoc->thread->nextAssoc == assoc) - { - /* - * Thread is exiting and we're deleting the assoc to be processed next. - * Hand thread the assoc after this one. - */ - assoc->thread->nextAssoc = next; - } - - /* Remove assoc from key's threads chain */ - prev = assoc->prevThread; - next = assoc->nextThread; - if (prev != NULL) - { - prev->nextThread = next; - } - if (next != NULL) - { - next->prevThread = prev; - } - - if (assoc->key->threads == assoc) - { - /* We're at the head of the key's threads chain */ - assoc->key->threads = next; - } - - free (assoc); - } - -} /* ptw32_tkAssocDestroy */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/rwlock.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/rwlock.c deleted file mode 100644 index 4a3cd2594cf..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/rwlock.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * rwlock.c - * - * Description: - * This translation unit implements read/write lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "ptw32_rwlock_check_need_init.c" -#include "ptw32_rwlock_cancelwrwait.c" -#include "pthread_rwlock_init.c" -#include "pthread_rwlock_destroy.c" -#include "pthread_rwlockattr_init.c" -#include "pthread_rwlockattr_destroy.c" -#include "pthread_rwlockattr_getpshared.c" -#include "pthread_rwlockattr_setpshared.c" -#include "pthread_rwlock_rdlock.c" -#include "pthread_rwlock_timedrdlock.c" -#include "pthread_rwlock_wrlock.c" -#include "pthread_rwlock_timedwrlock.c" -#include "pthread_rwlock_unlock.c" -#include "pthread_rwlock_tryrdlock.c" -#include "pthread_rwlock_trywrlock.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched.c deleted file mode 100644 index ed30ea7b24a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * sched.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -#include "pthread_attr_setschedpolicy.c" -#include "pthread_attr_getschedpolicy.c" -#include "pthread_attr_setschedparam.c" -#include "pthread_attr_getschedparam.c" -#include "pthread_attr_setinheritsched.c" -#include "pthread_attr_getinheritsched.c" -#include "pthread_setschedparam.c" -#include "pthread_getschedparam.c" -#include "sched_get_priority_max.c" -#include "sched_get_priority_min.c" -#include "sched_setscheduler.c" -#include "sched_getscheduler.c" -#include "sched_yield.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched.h b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched.h deleted file mode 100644 index dfb8e934af4..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Module: sched.h - * - * Purpose: - * Provides an implementation of POSIX realtime extensions - * as defined in - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#ifndef _SCHED_H -#define _SCHED_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#if defined(__MINGW32__) || defined(_UWIN) -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -/* For pid_t */ -# include -/* Required by Unix 98 */ -# include -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ -#else -typedef int pid_t; -#endif - -/* Thread scheduling policies */ - -enum { - SCHED_OTHER = 0, - SCHED_FIFO, - SCHED_RR, - SCHED_MIN = SCHED_OTHER, - SCHED_MAX = SCHED_RR -}; - -struct sched_param { - int sched_priority; -}; - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -PTW32_DLLPORT int __cdecl sched_yield (void); - -PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy); - -PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy); - -PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy); - -PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid); - -/* - * Note that this macro returns ENOTSUP rather than - * ENOSYS as might be expected. However, returning ENOSYS - * should mean that sched_get_priority_{min,max} are - * not implemented as well as sched_rr_get_interval. - * This is not the case, since we just don't support - * round-robin scheduling. Therefore I have chosen to - * return the same value as sched_setscheduler when - * SCHED_RR is passed to it. - */ -#define sched_rr_get_interval(_pid, _interval) \ - ( errno = ENOTSUP, (int) -1 ) - - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !_SCHED_H */ - diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_get_priority_max.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_get_priority_max.c deleted file mode 100644 index cabf2320a7e..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_get_priority_max.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * sched_get_priority_max.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -/* - * On Windows98, THREAD_PRIORITY_LOWEST is (-2) and - * THREAD_PRIORITY_HIGHEST is 2, and everything works just fine. - * - * On WinCE 3.0, it so happen that THREAD_PRIORITY_LOWEST is 5 - * and THREAD_PRIORITY_HIGHEST is 1 (yes, I know, it is funny: - * highest priority use smaller numbers) and the following happens: - * - * sched_get_priority_min() returns 5 - * sched_get_priority_max() returns 1 - * - * The following table shows the base priority levels for combinations - * of priority class and priority value in Win32. - * - * Process Priority Class Thread Priority Level - * ----------------------------------------------------------------- - * 1 IDLE_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 HIGH_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 2 IDLE_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 3 IDLE_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 4 IDLE_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 4 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 5 IDLE_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 5 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 5 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 6 IDLE_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 6 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 6 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 7 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 7 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 7 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 8 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 8 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 8 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 8 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 9 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 9 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 9 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 10 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 10 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 11 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 11 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 11 HIGH_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 12 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 12 HIGH_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 13 HIGH_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 14 HIGH_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 IDLE_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 16 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 17 REALTIME_PRIORITY_CLASS -7 - * 18 REALTIME_PRIORITY_CLASS -6 - * 19 REALTIME_PRIORITY_CLASS -5 - * 20 REALTIME_PRIORITY_CLASS -4 - * 21 REALTIME_PRIORITY_CLASS -3 - * 22 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 23 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 24 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 25 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 26 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 27 REALTIME_PRIORITY_CLASS 3 - * 28 REALTIME_PRIORITY_CLASS 4 - * 29 REALTIME_PRIORITY_CLASS 5 - * 30 REALTIME_PRIORITY_CLASS 6 - * 31 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * - * Windows NT: Values -7, -6, -5, -4, -3, 3, 4, 5, and 6 are not supported. - */ - - -int -sched_get_priority_max (int policy) -{ - if (policy < SCHED_MIN || policy > SCHED_MAX) - { - errno = EINVAL; - return -1; - } - -#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL) - /* WinCE? */ - return PTW32_MAX (THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL); -#else - /* This is independent of scheduling policy in Win32. */ - return PTW32_MAX (THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL); -#endif -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_get_priority_min.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_get_priority_min.c deleted file mode 100644 index 9c4f8591e58..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_get_priority_min.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * sched_get_priority_min.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -/* - * On Windows98, THREAD_PRIORITY_LOWEST is (-2) and - * THREAD_PRIORITY_HIGHEST is 2, and everything works just fine. - * - * On WinCE 3.0, it so happen that THREAD_PRIORITY_LOWEST is 5 - * and THREAD_PRIORITY_HIGHEST is 1 (yes, I know, it is funny: - * highest priority use smaller numbers) and the following happens: - * - * sched_get_priority_min() returns 5 - * sched_get_priority_max() returns 1 - * - * The following table shows the base priority levels for combinations - * of priority class and priority value in Win32. - * - * Process Priority Class Thread Priority Level - * ----------------------------------------------------------------- - * 1 IDLE_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 1 HIGH_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 2 IDLE_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 3 IDLE_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 4 IDLE_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 4 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 5 IDLE_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 5 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 5 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 6 IDLE_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 6 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 6 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 7 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 7 Background NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 7 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 8 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 8 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 8 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 8 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 9 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 9 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 9 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 10 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 10 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 11 Foreground NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 11 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 11 HIGH_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 12 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 12 HIGH_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 13 HIGH_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 14 HIGH_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 15 HIGH_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 IDLE_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 BELOW_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 15 ABOVE_NORMAL_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * 16 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_IDLE - * 17 REALTIME_PRIORITY_CLASS -7 - * 18 REALTIME_PRIORITY_CLASS -6 - * 19 REALTIME_PRIORITY_CLASS -5 - * 20 REALTIME_PRIORITY_CLASS -4 - * 21 REALTIME_PRIORITY_CLASS -3 - * 22 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_LOWEST - * 23 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_BELOW_NORMAL - * 24 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_NORMAL - * 25 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_ABOVE_NORMAL - * 26 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_HIGHEST - * 27 REALTIME_PRIORITY_CLASS 3 - * 28 REALTIME_PRIORITY_CLASS 4 - * 29 REALTIME_PRIORITY_CLASS 5 - * 30 REALTIME_PRIORITY_CLASS 6 - * 31 REALTIME_PRIORITY_CLASS THREAD_PRIORITY_TIME_CRITICAL - * - * Windows NT: Values -7, -6, -5, -4, -3, 3, 4, 5, and 6 are not supported. - * - */ - - -int -sched_get_priority_min (int policy) -{ - if (policy < SCHED_MIN || policy > SCHED_MAX) - { - errno = EINVAL; - return -1; - } - -#if (THREAD_PRIORITY_LOWEST > THREAD_PRIORITY_NORMAL) - /* WinCE? */ - return PTW32_MIN (THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL); -#else - /* This is independent of scheduling policy in Win32. */ - return PTW32_MIN (THREAD_PRIORITY_IDLE, THREAD_PRIORITY_TIME_CRITICAL); -#endif -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_getscheduler.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_getscheduler.c deleted file mode 100644 index 9bc819e4761..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_getscheduler.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * sched_getscheduler.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -sched_getscheduler (pid_t pid) -{ - /* - * Win32 only has one policy which we call SCHED_OTHER. - * However, we try to provide other valid side-effects - * such as EPERM and ESRCH errors. - */ - if (0 != pid) - { - int selfPid = (int) GetCurrentProcessId (); - - if (pid != selfPid) - { - HANDLE h = - OpenProcess (PROCESS_QUERY_INFORMATION, PTW32_FALSE, (DWORD) pid); - - if (NULL == h) - { - errno = - (GetLastError () == - (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; - return -1; - } - } - } - - return SCHED_OTHER; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_setscheduler.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_setscheduler.c deleted file mode 100644 index 4e060c7e559..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_setscheduler.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * sched_setscheduler.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -sched_setscheduler (pid_t pid, int policy) -{ - /* - * Win32 only has one policy which we call SCHED_OTHER. - * However, we try to provide other valid side-effects - * such as EPERM and ESRCH errors. Choosing to check - * for a valid policy last allows us to get the most value out - * of this function. - */ - if (0 != pid) - { - int selfPid = (int) GetCurrentProcessId (); - - if (pid != selfPid) - { - HANDLE h = - OpenProcess (PROCESS_SET_INFORMATION, PTW32_FALSE, (DWORD) pid); - - if (NULL == h) - { - errno = - (GetLastError () == - (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; - return -1; - } - } - } - - if (SCHED_OTHER != policy) - { - errno = ENOSYS; - return -1; - } - - /* - * Don't set anything because there is nothing to set. - * Just return the current (the only possible) value. - */ - return SCHED_OTHER; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_yield.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_yield.c deleted file mode 100644 index 6ac5ed92638..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sched_yield.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * sched_yield.c - * - * Description: - * POSIX thread functions that deal with thread scheduling. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" -#include "sched.h" - -int -sched_yield (void) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function indicates that the calling thread is - * willing to give up some time slices to other threads. - * - * PARAMETERS - * N/A - * - * - * DESCRIPTION - * This function indicates that the calling thread is - * willing to give up some time slices to other threads. - * NOTE: Since this is part of POSIX 1003.1b - * (realtime extensions), it is defined as returning - * -1 if an error occurs and sets errno to the actual - * error. - * - * RESULTS - * 0 successfully created semaphore, - * ENOSYS sched_yield not supported, - * - * ------------------------------------------------------ - */ -{ - Sleep (0); - - return 0; -} diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_close.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_close.c deleted file mode 100644 index 2f95c87857a..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_close.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_close.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -sem_close (sem_t * sem) -{ - errno = ENOSYS; - return -1; -} /* sem_close */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_destroy.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_destroy.c deleted file mode 100644 index 6c98e80b93b..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_destroy.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_destroy.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -int -sem_destroy (sem_t * sem) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function destroys an unnamed semaphore. - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * DESCRIPTION - * This function destroys an unnamed semaphore. - * - * RESULTS - * 0 successfully destroyed semaphore, - * -1 failed, error in errno - * ERRNO - * EINVAL 'sem' is not a valid semaphore, - * ENOSYS semaphores are not supported, - * EBUSY threads (or processes) are currently - * blocked on 'sem' - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = NULL; - - if (sem == NULL || *sem == NULL) - { - result = EINVAL; - } - else - { - s = *sem; - - if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - if (s->value < 0) - { - (void) pthread_mutex_unlock (&s->lock); - result = EBUSY; - } - else - { - /* There are no threads currently blocked on this semaphore. */ - - if (!CloseHandle (s->sem)) - { - (void) pthread_mutex_unlock (&s->lock); - result = EINVAL; - } - else - { - /* - * Invalidate the semaphore handle when we have the lock. - * Other sema operations should test this after acquiring the lock - * to check that the sema is still valid, i.e. before performing any - * operations. This may only be necessary before the sema op routine - * returns so that the routine can return EINVAL - e.g. if setting - * s->value to SEM_VALUE_MAX below does force a fall-through. - */ - *sem = NULL; - - /* Prevent anyone else actually waiting on or posting this sema. - */ - s->value = SEM_VALUE_MAX; - - (void) pthread_mutex_unlock (&s->lock); - - do - { - /* Give other threads a chance to run and exit any sema op - * routines. Due to the SEM_VALUE_MAX value, if sem_post or - * sem_wait were blocked by us they should fall through. - */ - Sleep(0); - } - while (pthread_mutex_destroy (&s->lock) == EBUSY); - } - } - } - } - - if (result != 0) - { - errno = result; - return -1; - } - - free (s); - - return 0; - -} /* sem_destroy */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_getvalue.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_getvalue.c deleted file mode 100644 index baafb02cf0c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_getvalue.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_getvalue.c - * - * Purpose: - * Semaphores aren't actually part of PThreads. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1-2001 - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -int -sem_getvalue (sem_t * sem, int *sval) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function stores the current count value of the - * semaphore. - * RESULTS - * - * Return value - * - * 0 sval has been set. - * -1 failed, error in errno - * - * in global errno - * - * EINVAL 'sem' is not a valid semaphore, - * ENOSYS this function is not supported, - * - * - * PARAMETERS - * - * sem pointer to an instance of sem_t - * - * sval pointer to int. - * - * DESCRIPTION - * This function stores the current count value of the semaphore - * pointed to by sem in the int pointed to by sval. - */ -{ - if (sem == NULL || *sem == NULL || sval == NULL) - { - errno = EINVAL; - return -1; - } - else - { - long value; - register sem_t s = *sem; - int result = 0; - - if ((result = pthread_mutex_lock(&s->lock)) == 0) - { - /* See sem_destroy.c - */ - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - errno = EINVAL; - return -1; - } - - value = s->value; - (void) pthread_mutex_unlock(&s->lock); - *sval = value; - } - - return result; - } - -} /* sem_getvalue */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_init.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_init.c deleted file mode 100644 index 02acd90f117..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_init.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_init.c - * - * Purpose: - * Semaphores aren't actually part of PThreads. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1-2001 - * - * ------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - -int -sem_init (sem_t * sem, int pshared, unsigned int value) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function initializes a semaphore. The - * initial value of the semaphore is 'value' - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * pshared - * if zero, this semaphore may only be shared between - * threads in the same process. - * if nonzero, the semaphore can be shared between - * processes - * - * value - * initial value of the semaphore counter - * - * DESCRIPTION - * This function initializes a semaphore. The - * initial value of the semaphore is set to 'value'. - * - * RESULTS - * 0 successfully created semaphore, - * -1 failed, error in errno - * ERRNO - * EINVAL 'sem' is not a valid semaphore, or - * 'value' >= SEM_VALUE_MAX - * ENOMEM out of memory, - * ENOSPC a required resource has been exhausted, - * ENOSYS semaphores are not supported, - * EPERM the process lacks appropriate privilege - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = NULL; - - if (pshared != 0) - { - /* - * Creating a semaphore that can be shared between - * processes - */ - result = EPERM; - } - else if (value > (unsigned int)SEM_VALUE_MAX) - { - result = EINVAL; - } - else - { - s = (sem_t) calloc (1, sizeof (*s)); - - if (NULL == s) - { - result = ENOMEM; - } - else - { - - s->value = value; - if (pthread_mutex_init(&s->lock, NULL) == 0) - { - -#ifdef NEED_SEM - - s->sem = CreateEvent (NULL, - PTW32_FALSE, /* auto (not manual) reset */ - PTW32_FALSE, /* initial state is unset */ - NULL); - - if (0 == s->sem) - { - free (s); - (void) pthread_mutex_destroy(&s->lock); - result = ENOSPC; - } - else - { - s->leftToUnblock = 0; - } - -#else /* NEED_SEM */ - - if ((s->sem = CreateSemaphore (NULL, /* Always NULL */ - (long) 0, /* Force threads to wait */ - (long) SEM_VALUE_MAX, /* Maximum value */ - NULL)) == 0) /* Name */ - { - (void) pthread_mutex_destroy(&s->lock); - result = ENOSPC; - } - -#endif /* NEED_SEM */ - - } - else - { - result = ENOSPC; - } - - if (result != 0) - { - free(s); - } - } - } - - if (result != 0) - { - errno = result; - return -1; - } - - *sem = s; - - return 0; - -} /* sem_init */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_open.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_open.c deleted file mode 100644 index bf48c831ca2..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_open.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_open.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -sem_open (const char *name, int oflag, mode_t mode, unsigned int value) -{ - errno = ENOSYS; - return -1; -} /* sem_open */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_post.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_post.c deleted file mode 100644 index c7a7a3cf904..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_post.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_post.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -int -sem_post (sem_t * sem) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function posts a wakeup to a semaphore. - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * DESCRIPTION - * This function posts a wakeup to a semaphore. If there - * are waiting threads (or processes), one is awakened; - * otherwise, the semaphore value is incremented by one. - * - * RESULTS - * 0 successfully posted semaphore, - * -1 failed, error in errno - * ERRNO - * EINVAL 'sem' is not a valid semaphore, - * ENOSYS semaphores are not supported, - * ERANGE semaphore count is too big - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = *sem; - - if (s == NULL) - { - result = EINVAL; - } - else if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - /* See sem_destroy.c - */ - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - result = EINVAL; - return -1; - } - - if (s->value < SEM_VALUE_MAX) - { -#ifdef NEED_SEM - if (++s->value <= 0 - && !SetEvent(s->sem)) - { - s->value--; - result = EINVAL; - } -#else - if (++s->value <= 0 - && !ReleaseSemaphore (s->sem, 1, NULL)) - { - s->value--; - result = EINVAL; - } -#endif /* NEED_SEM */ - } - else - { - result = ERANGE; - } - - (void) pthread_mutex_unlock (&s->lock); - } - - if (result != 0) - { - errno = result; - return -1; - } - - return 0; - -} /* sem_post */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_post_multiple.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_post_multiple.c deleted file mode 100644 index 3d1e4ef2864..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_post_multiple.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_post_multiple.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -int -sem_post_multiple (sem_t * sem, int count) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function posts multiple wakeups to a semaphore. - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * count - * counter, must be greater than zero. - * - * DESCRIPTION - * This function posts multiple wakeups to a semaphore. If there - * are waiting threads (or processes), n <= count are awakened; - * the semaphore value is incremented by count - n. - * - * RESULTS - * 0 successfully posted semaphore, - * -1 failed, error in errno - * ERRNO - * EINVAL 'sem' is not a valid semaphore - * or count is less than or equal to zero. - * ERANGE semaphore count is too big - * - * ------------------------------------------------------ - */ -{ - int result = 0; - long waiters; - sem_t s = *sem; - - if (s == NULL || count <= 0) - { - result = EINVAL; - } - else if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - /* See sem_destroy.c - */ - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - result = EINVAL; - return -1; - } - - if (s->value <= (SEM_VALUE_MAX - count)) - { - waiters = -s->value; - s->value += count; - if (waiters > 0) - { -#ifdef NEED_SEM - if (SetEvent(s->sem)) - { - waiters--; - s->leftToUnblock += count - 1; - if (s->leftToUnblock > waiters) - { - s->leftToUnblock = waiters; - } - } -#else - if (ReleaseSemaphore (s->sem, (waiters<=count)?waiters:count, 0)) - { - /* No action */ - } -#endif - else - { - s->value -= count; - result = EINVAL; - } - } - } - else - { - result = ERANGE; - } - (void) pthread_mutex_unlock (&s->lock); - } - - if (result != 0) - { - errno = result; - return -1; - } - - return 0; - -} /* sem_post_multiple */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_timedwait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_timedwait.c deleted file mode 100644 index 52146b478e0..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_timedwait.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_timedwait.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -typedef struct { - sem_t sem; - int * resultPtr; -} sem_timedwait_cleanup_args_t; - - -static void PTW32_CDECL -ptw32_sem_timedwait_cleanup (void * args) -{ - sem_timedwait_cleanup_args_t * a = (sem_timedwait_cleanup_args_t *)args; - sem_t s = a->sem; - - if (pthread_mutex_lock (&s->lock) == 0) - { - /* - * We either timed out or were cancelled. - * If someone has posted between then and now we try to take the semaphore. - * Otherwise the semaphore count may be wrong after we - * return. In the case of a cancellation, it is as if we - * were cancelled just before we return (after taking the semaphore) - * which is ok. - */ - if (WaitForSingleObject(s->sem, 0) == WAIT_OBJECT_0) - { - /* We got the semaphore on the second attempt */ - *(a->resultPtr) = 0; - } - else - { - /* Indicate we're no longer waiting */ - s->value++; -#ifdef NEED_SEM - if (s->value > 0) - { - s->leftToUnblock = 0; - } -#else - /* - * Don't release the W32 sema, it doesn't need adjustment - * because it doesn't record the number of waiters. - */ -#endif - } - (void) pthread_mutex_unlock (&s->lock); - } -} - - -int -sem_timedwait (sem_t * sem, const struct timespec *abstime) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function waits on a semaphore possibly until - * 'abstime' time. - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * abstime - * pointer to an instance of struct timespec - * - * DESCRIPTION - * This function waits on a semaphore. If the - * semaphore value is greater than zero, it decreases - * its value by one. If the semaphore value is zero, then - * the calling thread (or process) is blocked until it can - * successfully decrease the value or until interrupted by - * a signal. - * - * If 'abstime' is a NULL pointer then this function will - * block until it can successfully decrease the value or - * until interrupted by a signal. - * - * RESULTS - * 0 successfully decreased semaphore, - * -1 failed, error in errno - * ERRNO - * EINVAL 'sem' is not a valid semaphore, - * ENOSYS semaphores are not supported, - * EINTR the function was interrupted by a signal, - * EDEADLK a deadlock condition was detected. - * ETIMEDOUT abstime elapsed before success. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = *sem; - - pthread_testcancel(); - - if (sem == NULL) - { - result = EINVAL; - } - else - { - DWORD milliseconds; - - if (abstime == NULL) - { - milliseconds = INFINITE; - } - else - { - /* - * Calculate timeout as milliseconds from current system time. - */ - milliseconds = ptw32_relmillisecs (abstime); - } - - if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - int v; - - /* See sem_destroy.c - */ - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - errno = EINVAL; - return -1; - } - - v = --s->value; - (void) pthread_mutex_unlock (&s->lock); - - if (v < 0) - { -#ifdef NEED_SEM - int timedout; -#endif - sem_timedwait_cleanup_args_t cleanup_args; - - cleanup_args.sem = s; - cleanup_args.resultPtr = &result; - -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - /* Must wait */ - pthread_cleanup_push(ptw32_sem_timedwait_cleanup, (void *) &cleanup_args); -#ifdef NEED_SEM - timedout = -#endif - result = pthreadCancelableTimedWait (s->sem, milliseconds); - pthread_cleanup_pop(result); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - -#ifdef NEED_SEM - - if (!timedout && pthread_mutex_lock (&s->lock) == 0) - { - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - errno = EINVAL; - return -1; - } - - if (s->leftToUnblock > 0) - { - --s->leftToUnblock; - SetEvent(s->sem); - } - (void) pthread_mutex_unlock (&s->lock); - } - -#endif /* NEED_SEM */ - - } - } - - } - - if (result != 0) - { - - errno = result; - return -1; - - } - - return 0; - -} /* sem_timedwait */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_trywait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_trywait.c deleted file mode 100644 index 63614ba2b83..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_trywait.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_trywait.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -int -sem_trywait (sem_t * sem) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function tries to wait on a semaphore. - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * DESCRIPTION - * This function tries to wait on a semaphore. If the - * semaphore value is greater than zero, it decreases - * its value by one. If the semaphore value is zero, then - * this function returns immediately with the error EAGAIN - * - * RESULTS - * 0 successfully decreased semaphore, - * -1 failed, error in errno - * ERRNO - * EAGAIN the semaphore was already locked, - * EINVAL 'sem' is not a valid semaphore, - * ENOTSUP sem_trywait is not supported, - * EINTR the function was interrupted by a signal, - * EDEADLK a deadlock condition was detected. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = *sem; - - if (s == NULL) - { - result = EINVAL; - } - else if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - /* See sem_destroy.c - */ - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - errno = EINVAL; - return -1; - } - - if (s->value > 0) - { - s->value--; - } - else - { - result = EAGAIN; - } - - (void) pthread_mutex_unlock (&s->lock); - } - - if (result != 0) - { - errno = result; - return -1; - } - - return 0; - -} /* sem_trywait */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_unlink.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_unlink.c deleted file mode 100644 index a6c6f81b0f3..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_unlink.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_unlink.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - -/* ignore warning "unreferenced formal parameter" */ -#ifdef _MSC_VER -#pragma warning( disable : 4100 ) -#endif - -int -sem_unlink (const char *name) -{ - errno = ENOSYS; - return -1; -} /* sem_unlink */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_wait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_wait.c deleted file mode 100644 index d39d2b4b65c..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sem_wait.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: sem_wait.c - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -static void PTW32_CDECL -ptw32_sem_wait_cleanup(void * sem) -{ - sem_t s = (sem_t) sem; - - if (pthread_mutex_lock (&s->lock) == 0) - { - /* - * If sema is destroyed do nothing, otherwise:- - * If the sema is posted between us being cancelled and us locking - * the sema again above then we need to consume that post but cancel - * anyway. If we don't get the semaphore we indicate that we're no - * longer waiting. - */ - if (*((sem_t *)sem) != NULL && !(WaitForSingleObject(s->sem, 0) == WAIT_OBJECT_0)) - { - ++s->value; -#ifdef NEED_SEM - if (s->value > 0) - { - s->leftToUnblock = 0; - } -#else - /* - * Don't release the W32 sema, it doesn't need adjustment - * because it doesn't record the number of waiters. - */ -#endif /* NEED_SEM */ - } - (void) pthread_mutex_unlock (&s->lock); - } -} - -int -sem_wait (sem_t * sem) - /* - * ------------------------------------------------------ - * DOCPUBLIC - * This function waits on a semaphore. - * - * PARAMETERS - * sem - * pointer to an instance of sem_t - * - * DESCRIPTION - * This function waits on a semaphore. If the - * semaphore value is greater than zero, it decreases - * its value by one. If the semaphore value is zero, then - * the calling thread (or process) is blocked until it can - * successfully decrease the value or until interrupted by - * a signal. - * - * RESULTS - * 0 successfully decreased semaphore, - * -1 failed, error in errno - * ERRNO - * EINVAL 'sem' is not a valid semaphore, - * ENOSYS semaphores are not supported, - * EINTR the function was interrupted by a signal, - * EDEADLK a deadlock condition was detected. - * - * ------------------------------------------------------ - */ -{ - int result = 0; - sem_t s = *sem; - - pthread_testcancel(); - - if (s == NULL) - { - result = EINVAL; - } - else - { - if ((result = pthread_mutex_lock (&s->lock)) == 0) - { - int v; - - /* See sem_destroy.c - */ - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - errno = EINVAL; - return -1; - } - - v = --s->value; - (void) pthread_mutex_unlock (&s->lock); - - if (v < 0) - { -#ifdef _MSC_VER -#pragma inline_depth(0) -#endif - /* Must wait */ - pthread_cleanup_push(ptw32_sem_wait_cleanup, (void *) s); - result = pthreadCancelableWait (s->sem); - /* Cleanup if we're canceled or on any other error */ - pthread_cleanup_pop(result); -#ifdef _MSC_VER -#pragma inline_depth() -#endif - } -#ifdef NEED_SEM - - if (!result && pthread_mutex_lock (&s->lock) == 0) - { - if (*sem == NULL) - { - (void) pthread_mutex_unlock (&s->lock); - errno = EINVAL; - return -1; - } - - if (s->leftToUnblock > 0) - { - --s->leftToUnblock; - SetEvent(s->sem); - } - (void) pthread_mutex_unlock (&s->lock); - } - -#endif /* NEED_SEM */ - - } - - } - - if (result != 0) - { - errno = result; - return -1; - } - - return 0; - -} /* sem_wait */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/semaphore.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/semaphore.c deleted file mode 100644 index 6b2b10e8576..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/semaphore.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ------------------------------------------------------------- - * - * Module: semaphore.c - * - * Purpose: - * Concatenated version of separate modules to allow - * inlining optimisation, which it is assumed can only - * be effective within a single module. - * - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * ------------------------------------------------------------- - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#ifndef NEED_FTIME -# include -#endif - -#include - -#include "pthread.h" -#include "semaphore.h" -#include "implement.h" - - -#include "sem_init.c" -#include "sem_destroy.c" -#include "sem_trywait.c" -#include "sem_wait.c" -#include "sem_timedwait.c" -#include "sem_post.c" -#include "sem_post_multiple.c" -#include "sem_getvalue.c" -#include "sem_open.c" -#include "sem_close.c" -#include "sem_unlink.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/semaphore.h b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/semaphore.h deleted file mode 100644 index a3330a6388d..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/semaphore.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Module: semaphore.h - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#if !defined( SEMAPHORE_H ) -#define SEMAPHORE_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#define _POSIX_SEMAPHORES - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifndef HAVE_MODE_T -typedef unsigned int mode_t; -#endif - - -typedef struct sem_t_ * sem_t; - -PTW32_DLLPORT int __cdecl sem_init (sem_t * sem, - int pshared, - unsigned int value); - -PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem, - const struct timespec * abstime); - -PTW32_DLLPORT int __cdecl sem_post (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem, - int count); - -PTW32_DLLPORT int __cdecl sem_open (const char * name, - int oflag, - mode_t mode, - unsigned int value); - -PTW32_DLLPORT int __cdecl sem_close (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_unlink (const char * name); - -PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem, - int * sval); - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !SEMAPHORE_H */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/signal.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/signal.c deleted file mode 100644 index 8f56c48b534..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/signal.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * signal.c - * - * Description: - * Thread-aware signal functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -/* - * Possible future strategy for implementing pthread_kill() - * ======================================================== - * - * Win32 does not implement signals. - * Signals are simply software interrupts. - * pthread_kill() asks the system to deliver a specified - * signal (interrupt) to a specified thread in the same - * process. - * Signals are always asynchronous (no deferred signals). - * Pthread-win32 has an async cancelation mechanism. - * A similar system can be written to deliver signals - * within the same process (on ix86 processors at least). - * - * Each thread maintains information about which - * signals it will respond to. Handler routines - * are set on a per-process basis - not per-thread. - * When signalled, a thread will check it's sigmask - * and, if the signal is not being ignored, call the - * handler routine associated with the signal. The - * thread must then (except for some signals) return to - * the point where it was interrupted. - * - * Ideally the system itself would check the target thread's - * mask before possibly needlessly bothering the thread - * itself. This could be done by pthread_kill(), that is, - * in the signaling thread since it has access to - * all pthread_t structures. It could also retrieve - * the handler routine address to minimise the target - * threads response overhead. This may also simplify - * serialisation of the access to the per-thread signal - * structures. - * - * pthread_kill() eventually calls a routine similar to - * ptw32_cancel_thread() which manipulates the target - * threads processor context to cause the thread to - * run the handler launcher routine. pthread_kill() must - * save the target threads current context so that the - * handler launcher routine can restore the context after - * the signal handler has returned. Some handlers will not - * return, eg. the default SIGKILL handler may simply - * call pthread_exit(). - * - * The current context is saved in the target threads - * pthread_t structure. - */ - -#include "pthread.h" -#include "implement.h" - -#if HAVE_SIGSET_T - -static void -ptw32_signal_thread () -{ -} - -static void -ptw32_signal_callhandler () -{ -} - -int -pthread_sigmask (int how, sigset_t const *set, sigset_t * oset) -{ - pthread_t thread = pthread_self (); - - if (thread.p == NULL) - { - return ENOENT; - } - - /* Validate the `how' argument. */ - if (set != NULL) - { - switch (how) - { - case SIG_BLOCK: - break; - case SIG_UNBLOCK: - break; - case SIG_SETMASK: - break; - default: - /* Invalid `how' argument. */ - return EINVAL; - } - } - - /* Copy the old mask before modifying it. */ - if (oset != NULL) - { - memcpy (oset, &(thread.p->sigmask), sizeof (sigset_t)); - } - - if (set != NULL) - { - unsigned int i; - - /* FIXME: this code assumes that sigmask is an even multiple of - the size of a long integer. */ - - unsigned long *src = (unsigned long const *) set; - unsigned long *dest = (unsigned long *) &(thread.p->sigmask); - - switch (how) - { - case SIG_BLOCK: - for (i = 0; i < (sizeof (sigset_t) / sizeof (unsigned long)); i++) - { - /* OR the bit field longword-wise. */ - *dest++ |= *src++; - } - break; - case SIG_UNBLOCK: - for (i = 0; i < (sizeof (sigset_t) / sizeof (unsigned long)); i++) - { - /* XOR the bitfield longword-wise. */ - *dest++ ^= *src++; - } - case SIG_SETMASK: - /* Replace the whole sigmask. */ - memcpy (&(thread.p->sigmask), set, sizeof (sigset_t)); - break; - } - } - - return 0; -} - -int -sigwait (const sigset_t * set, int *sig) -{ - /* This routine is a cancellation point */ - pthread_test_cancel(); -} - -int -sigaction (int signum, const struct sigaction *act, struct sigaction *oldact) -{ -} - -#endif /* HAVE_SIGSET_T */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/spin.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/spin.c deleted file mode 100644 index 41b5aa52512..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/spin.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * spin.c - * - * Description: - * This translation unit implements spin lock primitives. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#include "ptw32_spinlock_check_need_init.c" -#include "pthread_spin_init.c" -#include "pthread_spin_destroy.c" -#include "pthread_spin_lock.c" -#include "pthread_spin_unlock.c" -#include "pthread_spin_trylock.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sync.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sync.c deleted file mode 100644 index 5e56fa9a1fb..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/sync.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * sync.c - * - * Description: - * This translation unit implements functions related to thread - * synchronisation. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#include "pthread_detach.c" -#include "pthread_join.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/tsd.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/tsd.c deleted file mode 100644 index ed44fe6cb40..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/tsd.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * tsd.c - * - * Description: - * POSIX thread functions which implement thread-specific data (TSD). - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -#include "pthread_key_create.c" -#include "pthread_key_delete.c" -#include "pthread_setspecific.c" -#include "pthread_getspecific.c" diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/version.rc b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/version.rc deleted file mode 100644 index a6c22a2acde..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/version.rc +++ /dev/null @@ -1,384 +0,0 @@ -/* This is an implementation of the threads API of POSIX 1003.1-2001. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include -#include "pthread.h" - -/* - * Note: the correct __CLEANUP_* macro must be defined corresponding to - * the definition used for the object file builds. This is done in the - * relevent makefiles for the command line builds, but users should ensure - * that their resource compiler knows what it is too. - * If using the default (no __CLEANUP_* defined), pthread.h will define it - * as __CLEANUP_C. - */ - -#ifdef PTW32_RC_MSC -# if defined(__CLEANUP_C) -# define PTW32_VERSIONINFO_NAME "pthreadVC\0" -# define PTW32_VERSIONINFO_COMMENT "MS C build -- longjmp thread exiting\0" -# elif defined(__CLEANUP_CXX) -# define PTW32_VERSIONINFO_NAME "pthreadVCE\0" -# define PTW32_VERSIONINFO_COMMENT "MS C++ build -- C++ exception thread exiting\0" -# elif defined(__CLEANUP_SEH) -# define PTW32_VERSIONINFO_NAME "pthreadVSE\0" -# define PTW32_VERSIONINFO_COMMENT "MS C build -- structured exception thread exiting\0" -# else -# error Resource compiler doesn't know which cleanup style you're using - see version.rc -# endif -#elif defined(__GNUC__) -# if defined(__CLEANUP_C) -# define PTW32_VERSIONINFO_NAME "pthreadGC\0" -# define PTW32_VERSIONINFO_COMMENT "GNU C build -- longjmp thread exiting\0" -# elif defined(__CLEANUP_CXX) -# define PTW32_VERSIONINFO_NAME "pthreadGCE\0" -# define PTW32_VERSIONINFO_COMMENT "GNU C++ build -- C++ exception thread exiting\0" -# else -# error Resource compiler doesn't know which cleanup style you're using - see version.rc -# endif -#elif defined(__BORLANDC__) -# if defined(__CLEANUP_C) -# define PTW32_VERSIONINFO_NAME "pthreadBC\0" -# define PTW32_VERSIONINFO_COMMENT "BORLAND C build -- longjmp thread exiting\0" -# elif defined(__CLEANUP_CXX) -# define PTW32_VERSIONINFO_NAME "pthreadBCE\0" -# define PTW32_VERSIONINFO_COMMENT "BORLAND C++ build -- C++ exception thread exiting\0" -# else -# error Resource compiler doesn't know which cleanup style you're using - see version.rc -# endif -#elif defined(__WATCOMC__) -# if defined(__CLEANUP_C) -# define PTW32_VERSIONINFO_NAME "pthreadWC\0" -# define PTW32_VERSIONINFO_COMMENT "WATCOM C build -- longjmp thread exiting\0" -# elif defined(__CLEANUP_CXX) -# define PTW32_VERSIONINFO_NAME "pthreadWCE\0" -# define PTW32_VERSIONINFO_COMMENT "WATCOM C++ build -- C++ exception thread exiting\0" -# else -# error Resource compiler doesn't know which cleanup style you're using - see version.rc -# endif -#else -# error Resource compiler doesn't know which compiler you're using - see version.rc -#endif - - -VS_VERSION_INFO VERSIONINFO - FILEVERSION PTW32_VERSION - PRODUCTVERSION PTW32_VERSION - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "POSIX Threads for Windows32 Library\0" - VALUE "ProductVersion", PTW32_VERSION_STRING - VALUE "FileVersion", PTW32_VERSION_STRING - VALUE "InternalName", PTW32_VERSIONINFO_NAME - VALUE "OriginalFilename", PTW32_VERSIONINFO_NAME - VALUE "CompanyName", "Open Source Software community project\0" - VALUE "LegalCopyright", "Copyright (C) Project contributors 1998-2004\0" - VALUE "Licence", "LGPL\0" - VALUE "Info", "http://sources.redhat.com/pthreads-win32/\0" - VALUE "Comment", PTW32_VERSIONINFO_COMMENT - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -/* -VERSIONINFO Resource - -The VERSIONINFO resource-definition statement creates a version-information -resource. The resource contains such information about the file as its -version number, its intended operating system, and its original filename. -The resource is intended to be used with the Version Information functions. - -versionID VERSIONINFO fixed-info { block-statement...} - -versionID - Version-information resource identifier. This value must be 1. - -fixed-info - Version information, such as the file version and the intended operating - system. This parameter consists of the following statements. - - - Statement Description - -------------------------------------------------------------------------- - FILEVERSION - version Binary version number for the file. The version - consists of two 32-bit integers, defined by four - 16-bit integers. For example, "FILEVERSION 3,10,0,61" - is translated into two doublewords: 0x0003000a and - 0x0000003d, in that order. Therefore, if version is - defined by the DWORD values dw1 and dw2, they need - to appear in the FILEVERSION statement as follows: - HIWORD(dw1), LOWORD(dw1), HIWORD(dw2), LOWORD(dw2). - PRODUCTVERSION - version Binary version number for the product with which the - file is distributed. The version parameter is two - 32-bit integers, defined by four 16-bit integers. - For more information about version, see the - FILEVERSION description. - FILEFLAGSMASK - fileflagsmask Bits in the FILEFLAGS statement are valid. If a bit - is set, the corresponding bit in FILEFLAGS is valid. - FILEFLAGSfileflags Attributes of the file. The fileflags parameter must - be the combination of all the file flags that are - valid at compile time. For 16-bit Windows, this - value is 0x3f. - FILEOSfileos Operating system for which this file was designed. - The fileos parameter can be one of the operating - system values given in the Remarks section. - FILETYPEfiletype General type of file. The filetype parameter can be - one of the file type values listed in the Remarks - section. - FILESUBTYPE - subtype Function of the file. The subtype parameter is zero - unless the type parameter in the FILETYPE statement - is VFT_DRV, VFT_FONT, or VFT_VXD. For a list of file - subtype values, see the Remarks section. - -block-statement - Specifies one or more version-information blocks. A block can contain - string information or variable information. For more information, see - StringFileInfo Block or VarFileInfo Block. - -Remarks - -To use the constants specified with the VERSIONINFO statement, you must -include the Winver.h or Windows.h header file in the resource-definition file. - -The following list describes the parameters used in the VERSIONINFO statement: - -fileflags - A combination of the following values. - - Value Description - - VS_FF_DEBUG File contains debugging information or is compiled - with debugging features enabled. - VS_FF_PATCHED File has been modified and is not identical to the - original shipping file of the same version number. - VS_FF_PRERELEASE File is a development version, not a commercially - released product. - VS_FF_PRIVATEBUILD File was not built using standard release procedures. - If this value is given, the StringFileInfo block must - contain a PrivateBuild string. - VS_FF_SPECIALBUILD File was built by the original company using standard - release procedures but is a variation of the standard - file of the same version number. If this value is - given, the StringFileInfo block must contain a - SpecialBuild string. - -fileos - One of the following values. - - Value Description - - VOS_UNKNOWN The operating system for which the file was designed - is unknown. - VOS_DOS File was designed for MS-DOS. - VOS_NT File was designed for Windows Server 2003 family, - Windows XP, Windows 2000, or Windows NT. - VOS__WINDOWS16 File was designed for 16-bit Windows. - VOS__WINDOWS32 File was designed for 32-bit Windows. - VOS_DOS_WINDOWS16 File was designed for 16-bit Windows running with - MS-DOS. - VOS_DOS_WINDOWS32 File was designed for 32-bit Windows running with - MS-DOS. - VOS_NT_WINDOWS32 File was designed for Windows Server 2003 family, - Windows XP, Windows 2000, or Windows NT. - - The values 0x00002L, 0x00003L, 0x20000L and 0x30000L are reserved. - -filetype - One of the following values. - - Value Description - - VFT_UNKNOWN File type is unknown. - VFT_APP File contains an application. - VFT_DLL File contains a dynamic-link library (DLL). - VFT_DRV File contains a device driver. If filetype is - VFT_DRV, subtype contains a more specific - description of the driver. - VFT_FONT File contains a font. If filetype is VFT_FONT, - subtype contains a more specific description of the - font. - VFT_VXD File contains a virtual device. - VFT_STATIC_LIB File contains a static-link library. - - All other values are reserved for use by Microsoft. - -subtype - Additional information about the file type. - - If filetype specifies VFT_DRV, this parameter can be one of the - following values. - - Value Description - - VFT2_UNKNOWN Driver type is unknown. - VFT2_DRV_COMM File contains a communications driver. - VFT2_DRV_PRINTER File contains a printer driver. - VFT2_DRV_KEYBOARD File contains a keyboard driver. - VFT2_DRV_LANGUAGE File contains a language driver. - VFT2_DRV_DISPLAY File contains a display driver. - VFT2_DRV_MOUSE File contains a mouse driver. - VFT2_DRV_NETWORK File contains a network driver. - VFT2_DRV_SYSTEM File contains a system driver. - VFT2_DRV_INSTALLABLE File contains an installable driver. - VFT2_DRV_SOUND File contains a sound driver. - VFT2_DRV_VERSIONED_PRINTER File contains a versioned printer driver. - - If filetype specifies VFT_FONT, this parameter can be one of the - following values. - - Value Description - - VFT2_UNKNOWN Font type is unknown. - VFT2_FONT_RASTER File contains a raster font. - VFT2_FONT_VECTOR File contains a vector font. - VFT2_FONT_TRUETYPE File contains a TrueType font. - - If filetype specifies VFT_VXD, this parameter must be the virtual-device - identifier included in the virtual-device control block. - - All subtype values not listed here are reserved for use by Microsoft. - -langID - One of the following language codes. - - Code Language Code Language - - 0x0401 Arabic 0x0415 Polish - 0x0402 Bulgarian 0x0416 Portuguese (Brazil) - 0x0403 Catalan 0x0417 Rhaeto-Romanic - 0x0404 Traditional Chinese 0x0418 Romanian - 0x0405 Czech 0x0419 Russian - 0x0406 Danish 0x041A Croato-Serbian (Latin) - 0x0407 German 0x041B Slovak - 0x0408 Greek 0x041C Albanian - 0x0409 U.S. English 0x041D Swedish - 0x040A Castilian Spanish 0x041E Thai - 0x040B Finnish 0x041F Turkish - 0x040C French 0x0420 Urdu - 0x040D Hebrew 0x0421 Bahasa - 0x040E Hungarian 0x0804 Simplified Chinese - 0x040F Icelandic 0x0807 Swiss German - 0x0410 Italian 0x0809 U.K. English - 0x0411 Japanese 0x080A Mexican Spanish - 0x0412 Korean 0x080C Belgian French - 0x0413 Dutch 0x0C0C Canadian French - 0x0414 Norwegian – Bokmal 0x100C Swiss French - 0x0810 Swiss Italian 0x0816 Portuguese (Portugal) - 0x0813 Belgian Dutch 0x081A Serbo-Croatian (Cyrillic) - 0x0814 Norwegian – Nynorsk - -charsetID - One of the following character-set identifiers. - - Identifier Character Set - - 0 7-bit ASCII - 932 Japan (Shift %G–%@ JIS X-0208) - 949 Korea (Shift %G–%@ KSC 5601) - 950 Taiwan (Big5) - 1200 Unicode - 1250 Latin-2 (Eastern European) - 1251 Cyrillic - 1252 Multilingual - 1253 Greek - 1254 Turkish - 1255 Hebrew - 1256 Arabic - -string-name - One of the following predefined names. - - Name Description - - Comments Additional information that should be displayed for - diagnostic purposes. - CompanyName Company that produced the file%G—%@for example, - "Microsoft Corporation" or "Standard Microsystems - Corporation, Inc." This string is required. - FileDescription File description to be presented to users. This - string may be displayed in a list box when the user - is choosing files to install%G—%@for example, - "Keyboard Driver for AT-Style Keyboards". This - string is required. - FileVersion Version number of the file%G—%@for example, - "3.10" or "5.00.RC2". This string is required. - InternalName Internal name of the file, if one exists — for - example, a module name if the file is a dynamic-link - library. If the file has no internal name, this - string should be the original filename, without - extension. This string is required. - LegalCopyright Copyright notices that apply to the file. This - should include the full text of all notices, legal - symbols, copyright dates, and so on — for example, - "Copyright (C) Microsoft Corporation 1990–1999". - This string is optional. - LegalTrademarks Trademarks and registered trademarks that apply to - the file. This should include the full text of all - notices, legal symbols, trademark numbers, and so on. - This string is optional. - OriginalFilename Original name of the file, not including a path. - This information enables an application to determine - whether a file has been renamed by a user. The - format of the name depends on the file system for - which the file was created. This string is required. - PrivateBuild Information about a private version of the file — for - example, "Built by TESTER1 on \TESTBED". This string - should be present only if VS_FF_PRIVATEBUILD is - specified in the fileflags parameter of the root - block. - ProductName Name of the product with which the file is - distributed. This string is required. - ProductVersion Version of the product with which the file is - distributed — for example, "3.10" or "5.00.RC2". - This string is required. - SpecialBuild Text that indicates how this version of the file - differs from the standard version — for example, - "Private build for TESTER1 solving mouse problems - on M250 and M250E computers". This string should be - present only if VS_FF_SPECIALBUILD is specified in - the fileflags parameter of the root block. - */ diff --git a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/w32_CancelableWait.c b/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/w32_CancelableWait.c deleted file mode 100644 index 97e15aa3106..00000000000 --- a/src/utils/mp_gpprof_server/libraries/pthreads-w32-2-8-0-release/w32_CancelableWait.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * w32_CancelableWait.c - * - * Description: - * This translation unit implements miscellaneous thread functions. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#include "pthread.h" -#include "implement.h" - - -static INLINE int -ptw32_cancelable_wait (HANDLE waitHandle, DWORD timeout) - /* - * ------------------------------------------------------------------- - * This provides an extra hook into the pthread_cancel - * mechanism that will allow you to wait on a Windows handle and make it a - * cancellation point. This function blocks until the given WIN32 handle is - * signaled or pthread_cancel has been called. It is implemented using - * WaitForMultipleObjects on 'waitHandle' and a manually reset WIN32 - * event used to implement pthread_cancel. - * - * Given this hook it would be possible to implement more of the cancellation - * points. - * ------------------------------------------------------------------- - */ -{ - int result; - pthread_t self; - ptw32_thread_t * sp; - HANDLE handles[2]; - DWORD nHandles = 1; - DWORD status; - - handles[0] = waitHandle; - - self = pthread_self(); - sp = (ptw32_thread_t *) self.p; - - if (sp != NULL) - { - /* - * Get cancelEvent handle - */ - if (sp->cancelState == PTHREAD_CANCEL_ENABLE) - { - - if ((handles[1] = sp->cancelEvent) != NULL) - { - nHandles++; - } - } - } - else - { - handles[1] = NULL; - } - - status = WaitForMultipleObjects (nHandles, handles, PTW32_FALSE, timeout); - - switch (status - WAIT_OBJECT_0) - { - case 0: - /* - * Got the handle. - * In the event that both handles are signalled, the smallest index - * value (us) is returned. As it has been arranged, this ensures that - * we don't drop a signal that we should act on (i.e. semaphore, - * mutex, or condition variable etc). - */ - result = 0; - break; - - case 1: - /* - * Got cancel request. - * In the event that both handles are signaled, the cancel will - * be ignored (see case 0 comment). - */ - ResetEvent (handles[1]); - - if (sp != NULL) - { - /* - * Should handle POSIX and implicit POSIX threads.. - * Make sure we haven't been async-canceled in the meantime. - */ - (void) pthread_mutex_lock (&sp->cancelLock); - if (sp->state < PThreadStateCanceling) - { - sp->state = PThreadStateCanceling; - sp->cancelState = PTHREAD_CANCEL_DISABLE; - (void) pthread_mutex_unlock (&sp->cancelLock); - ptw32_throw (PTW32_EPS_CANCEL); - - /* Never reached */ - } - (void) pthread_mutex_unlock (&sp->cancelLock); - } - - /* Should never get to here. */ - result = EINVAL; - break; - - default: - if (status == WAIT_TIMEOUT) - { - result = ETIMEDOUT; - } - else - { - result = EINVAL; - } - break; - } - - return (result); - -} /* CancelableWait */ - -int -pthreadCancelableWait (HANDLE waitHandle) -{ - return (ptw32_cancelable_wait (waitHandle, INFINITE)); -} - -int -pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout) -{ - return (ptw32_cancelable_wait (waitHandle, timeout)); -} diff --git a/src/utils/mp_gpprof_server/mp_gpprof_server.vcxproj b/src/utils/mp_gpprof_server/mp_gpprof_server.vcxproj deleted file mode 100644 index 2f5d253c545..00000000000 --- a/src/utils/mp_gpprof_server/mp_gpprof_server.vcxproj +++ /dev/null @@ -1,269 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {6E9637D8-B32D-4ABD-A5CC-6E4677039B47} - mp_gpprof_server - Win32Proj - - - - Application - v120 - MultiByte - true - - - Application - v120 - MultiByte - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(xrBinDir) - $(xrIntDir)$(ProjectName)\ - true - - - $(xrBinDir) - $(xrIntDir)$(ProjectName)\ - false - - - - Disabled - libraries\fcgi-2.4.0\;libraries\fcgi-2.4.0\include;libraries\gamespy;libraries\pthreads-w32-2-8-0-release;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;XRAY_DISABLE_GAMESPY_WARNINGS;GSI_COMMON_DEBUG;PTW32_STATIC_LIB;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - - - ws2_32.lib;%(AdditionalDependencies) - true - Console - MachineX86 - - - - - libraries\fcgi-2.4.0\;libraries\fcgi-2.4.0\include;libraries\gamespy;libraries\pthreads-w32-2-8-0-release;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;XRAY_DISABLE_GAMESPY_WARNINGS;PTW32_STATIC_LIB;%(PreprocessorDefinitions) - MultiThreadedDLL - - Level3 - ProgramDatabase - - - ws2_32.lib;%(AdditionalDependencies) - true - Console - true - true - MachineX86 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - - - - - - true - true - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/mp_gpprof_server.vcxproj.filters b/src/utils/mp_gpprof_server/mp_gpprof_server.vcxproj.filters deleted file mode 100644 index ad94cd4ffc0..00000000000 --- a/src/utils/mp_gpprof_server/mp_gpprof_server.vcxproj.filters +++ /dev/null @@ -1,495 +0,0 @@ - - - - - {dd00ad18-4cc8-463e-8a59-03b277337fc2} - - - {fec0e399-7cd6-4f7a-a62b-404ae4b257a1} - - - {bf3aa093-c3a8-4688-a4d6-8dd7fc64620f} - - - {cf7b79b8-2309-4286-b18a-057b889901fc} - - - {be07d9d0-a695-4ee4-a919-bfb4e00b6897} - - - {48f8dd3d-ed6d-448b-9a1a-f0d9c884d50a} - - - {c45538a2-17e3-40fe-ab01-3e7ad633b8be} - - - {cb7957cd-005b-4419-95f6-8297b312ef0a} - - - {54b33adb-f7e9-420b-8d78-fbe45e115891} - - - {7875fa9d-8769-498e-8df3-c1b30f5549d8} - - - {b21d5656-c6c6-4f71-b1bb-447627fef7d5} - - - - - 3rd party\libfastcgi - - - 3rd party\libfastcgi\include - - - 3rd party\libfastcgi\include - - - 3rd party\gamespy - - - 3rd party\gamespy - - - 3rd party\gamespy - - - 3rd party\gamespy - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - 3rd party\libfastcgi - - - 3rd party\libfastcgi - - - 3rd party\libfastcgi - - - 3rd party\libfastcgi - - - 3rd party\gamespy - - - 3rd party\gamespy - - - 3rd party\gamespy - - - 3rd party\gamespy - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\common - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\ghttp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\gp - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\sake - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\gamespy\gt2 - - - 3rd party\pthread - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/src/utils/mp_gpprof_server/mpgpprof b/src/utils/mp_gpprof_server/mpgpprof deleted file mode 100644 index bef242e7e22..00000000000 --- a/src/utils/mp_gpprof_server/mpgpprof +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# -# Startup script for program -# -# chkconfig: 345 85 15 - start or stop process definition within the boot process -# description: STALKER FastCGI server that shows player profiles -# processname: mp_gpprof_server -# pidfile: /var/run/mp_gpprof_server.pid - -# Source function library. This creates the operating environment for the process to be started -. /lib/lsb/init-functions -. /etc/default/rcS - - -prog="mp_gpprof_server" -exe="/usr/share/mp_gpprof_server/mp_gpprof_server" -pidfile="/var/run/mp_gpprof_server.pid" - - -case "$1" in - start) - echo -n "Starting $prog:" - daemon -F $pidfile -r -A 5 -L 30 $exe 127.0.0.1:9000 /gprof - ;; - stop) - echo -n "Shutting down $prog:" - kill `cat $pidfile` - echo - rm -f $pidfile - ;; - restart) - $0 stop - $0 start - ;; - status) - status_of_proc -p $pidfile "$DAEMON" $exe - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 -esac - -exit 0 diff --git a/src/utils/mp_gpprof_server/profile_data_types.cpp b/src/utils/mp_gpprof_server/profile_data_types.cpp deleted file mode 100644 index a6ee2f095fc..00000000000 --- a/src/utils/mp_gpprof_server/profile_data_types.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#include "profile_data_types.h" -#include -#include - -namespace gamespy_profile -{ -char* profile_table_name = "PlayerStats_v1"; - -static char const* awards_names[at_awards_count] = { - "mp_award_massacre", "mp_award_paranoia", "mp_award_overwhelming_superiority", "mp_award_blitzkrieg", - "mp_award_dry_victory", "mp_award_multichampion", "mp_award_mad", "mp_award_achilles_heel", - "mp_award_fater_than_bullets", "mp_award_harvest_time", "mp_award_skewer", "mp_award_double_shot_double_kill", - "mp_award_climber", "mp_award_opener", "mp_award_toughy", "mp_award_invincible_fury", "mp_award_oculist", - "mp_award_lightning_reflexes", "mp_award_sprinter_stopper", "mp_award_marksman", "mp_award_peace_ambassador", - "mp_award_deadly_accuracy", "mp_award_remembrance", "mp_award_avenger", "mp_award_cherub", "mp_award_dignity", - "mp_award_stalker_flair", "mp_award_lucky", "mp_award_black_list", "mp_award_silent_death", -}; - -static unsigned short award_atlas_stats_map[at_awards_count][ap_award_params_count] = { - {STAT_AwardMasscare, STAT_AwardMasscareLastRewardDate}, // mp_award_massacre - {STAT_AwardParanoia, STAT_AwardParanoiaLastRewardDate}, // mp_award_paranoia - {STAT_AwardOwerwhelmingSuperiority, - STAT_AwardOwerwhelmingSuperiorityLastRewardDate}, // mp_award_overwhelming_superiority - {STAT_AwardBlitzkrieg, STAT_AwardBlitzkriegLastRewardDate}, // mp_award_blitzkrieg - {STAT_AwardDryVictory, STAT_AwardDryVictoryLastRewardDate}, // mp_award_dry_victory - {STAT_AwardMultichampion, STAT_AwardMultichampionLastRewardDate}, // mp_award_multichampion - {STAT_AwardMad, STAT_AwardMadLastRewardDate}, // mp_award_mad - {STAT_AwardAchillesHeel, STAT_AwardAchillesHeelLastRewardDate}, // mp_award_achilles_heel - {STAT_AwardFasterThanBullets, STAT_AwardFasterThanBulletsLastRewardDate}, // mp_award_fater_than_bullets - {STAT_AwardHarvestTime, STAT_AwardHarvestTimeLastRewardDate}, // mp_award_harvest_time - {STAT_AwardSkewer, STAT_AwardSkewerLastRewardDate}, // mp_award_skewer - {STAT_AwardDoubleShotDoubleKill, STAT_AwardDoubleShotDoubleKillLastRewardDate}, // mp_award_double_shot_double_kill - {STAT_AwardClimber, STAT_AwardClimberLastRewardDate}, // mp_award_climber - {STAT_AwardOpener, STAT_AwardOpenerLastRewardDate}, // mp_award_opener - {STAT_AwardToughy, STAT_AwardToughyLastRewardDate}, // mp_award_toughy - {STAT_AwardInvincibleFury, STAT_AwardInvincibleFuryLastRewardDate}, // mp_award_invincible_fury - {STAT_AwardOculist, STAT_AwardOculistLastRewardDate}, // mp_award_oculist - {STAT_AwardLightingReflexes, STAT_AwardLightingReflexesLastRewardDate}, // mp_award_lightning_reflexes - {STAT_AwardSprinterStopper, STAT_AwardSprinterStopperLastRewardDate}, // mp_award_sprinter_stopper - {STAT_AwardMarksman, STAT_AwardMarksmanLastRewardDate}, // mp_award_marksman - {STAT_AwardPeaceAmbassador, STAT_AwardPeaceAmbassadorLastRewardDate}, // mp_award_peace_ambassador - {STAT_AwardDeadlyAccuracy, STAT_AwardDeadlyAccuracyLastRewardDate}, // mp_award_deadly_accuracy - {STAT_AwardRemembrance, STAT_AwardRemembranceLastRewardDate}, // mp_award_remembrance - {STAT_AwardAvenger, STAT_AwardAvengerLastRewardDate}, // mp_award_avenger - {STAT_AwardCherub, STAT_AwardCherubLastRewardDate}, // mp_award_cherub - {STAT_AwardDignity, STAT_AwardDignityLastRewardDate}, // mp_award_dignity - {STAT_AwardStalkerFlair, STAT_AwardStalkerFlairLastRewardDate}, // mp_award_stalker_flair - {STAT_AwardLucky, STAT_AwardLuckyLastRewardDate}, // mp_award_lucky - {STAT_AwardBlackList, STAT_AwardBlackListLastRewardDate}, // mp_award_black_list - {STAT_AwardSilentDeath, STAT_AwardSilentDeathLastRewardDate}, // mp_award_silent_death -}; - -char const* get_award_name(enum_awards_t award) -{ - assert(award < at_awards_count); - return awards_names[award]; -} - -unsigned short get_award_id_stat(enum_awards_t award) -{ - assert(award < at_awards_count); - return award_atlas_stats_map[award][ap_award_id]; -} -unsigned short get_award_reward_date_stat(enum_awards_t award) -{ - assert(award < at_awards_count); - return award_atlas_stats_map[award][ap_award_rdate]; -} -enum_awards_t get_award_by_stat_id_name(char const* stat_name) -{ - for (int i = 0; i < at_awards_count; ++i) - { - if (!strcmp(stat_name, ATLAS_GET_STAT_NAME(award_atlas_stats_map[i][ap_award_id]))) - { - return static_cast(i); - } - } - return static_cast(at_awards_count); -} - -enum_awards_t get_award_by_stat_rdate_name(char const* stat_name) -{ - for (int i = 0; i < at_awards_count; ++i) - { - if (!strcmp(stat_name, ATLAS_GET_STAT_NAME(award_atlas_stats_map[i][ap_award_rdate]))) - { - return static_cast(i); - } - } - return static_cast(at_awards_count); -} - -// best scores ----- - -static char const* best_score_names[bst_score_types_count] = {"mp_bst_kills_in_row", "mp_bst_kinife_kills_in_row", - "mp_bst_backstabs_in_row", "mp_bst_head_shots_in_row", "mp_bst_eye_kills_in_row", "mp_bst_bleed_kills_in_row", - "mp_bst_explosive_kills_in_row"}; // static char const * best_score_names[bst_score_types_count] - -static unsigned short best_scores_atlas_stats_map[bst_score_types_count] = {STAT_BestScore_KillsInRow, - STAT_BestScore_KnifeKillsInRow, STAT_BestScore_BackstabsKillsInRow, STAT_BestScore_HeadshotsKillsInRow, - STAT_BestScore_EyeKillsInRow, STAT_BestScore_BleedKillsInRow, - STAT_BestScore_ExplosiveKillsInRow}; // static u16 best_scores_atlas_stats_map[bst_score_types_count] - -char const* get_best_score_name(enum_best_score_type bst) -{ - assert(bst < bst_score_types_count); - return best_score_names[bst]; -} - -unsigned short get_best_score_id_stat(enum_best_score_type bst) -{ - assert(bst < bst_score_types_count); - return best_scores_atlas_stats_map[bst]; -} - -enum_best_score_type get_best_score_type_by_sname(char const* stat_name) -{ - for (int i = 0; i < bst_score_types_count; ++i) - { - if (!strcmp(stat_name, ATLAS_GET_STAT_NAME(best_scores_atlas_stats_map[i]))) - { - return static_cast(i); - } - } - return static_cast(bst_score_types_count); -} - -} // namespace gamespy_profile diff --git a/src/utils/mp_gpprof_server/profile_data_types.h b/src/utils/mp_gpprof_server/profile_data_types.h deleted file mode 100644 index a8497848079..00000000000 --- a/src/utils/mp_gpprof_server/profile_data_types.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef PLAYER_AWARDS -#define PLAYER_AWARDS - -#include "atlas_stalkercoppc_v1.h" -#include -#include -#include -#include - -namespace gamespy_profile -{ -enum enum_awards_t -{ - at_award_massacre = 0x00, - at_award_paranoia, - at_award_overwhelming_superiority, - at_award_blitzkrieg, - at_award_dry_victory, - at_award_multichampion, - at_award_mad, - at_award_achilles_heel, - at_award_fater_than_bullets, - at_award_harvest_time, - at_award_skewer, - at_award_double_shot_double_kill, - at_award_climber, - at_award_opener, - at_award_toughy, - at_award_invincible_fury, - at_award_oculist, - at_award_lightning_reflexes, - at_award_sprinter_stopper, - at_award_marksman, - at_award_peace_ambassador, - at_award_deadly_accuracy, - at_award_remembrance, - at_award_avenger, - at_award_cherub, - at_award_dignity, - at_award_stalker_flair, - at_award_lucky, - at_award_black_list, - at_award_silent_death, - // at_award_okulist = 0x00, - at_awards_count -}; // enum enum_awards_t - -enum enum_award_params -{ - ap_award_id = 0x00, - ap_award_rdate, - ap_award_params_count -}; // enum enum_award_params - -struct award_data -{ - award_data() : m_count(0), m_last_reward_date(0) {} - award_data(unsigned short count, unsigned int const& rdate) : m_count(count), m_last_reward_date(rdate) {} - unsigned short m_count; - unsigned int m_last_reward_date; -}; - -extern char const* get_award_name(enum_awards_t award); -extern unsigned short get_award_id_stat(enum_awards_t award); -extern unsigned short get_award_reward_date_stat(enum_awards_t award); -extern enum_awards_t get_award_by_stat_id_name(char const* stat_name); -extern enum_awards_t get_award_by_stat_rdate_name(char const* stat_name); - -enum enum_best_score_type -{ - bst_kills_in_row = 0x00, - bst_kinife_kills_in_row, - bst_backstabs_in_row, - bst_head_shots_in_row, - bst_eye_kills_in_row, - bst_bleed_kills_in_row, - bst_explosive_kills_in_row, - bst_score_types_count -}; // enum enum_best_score_type - -char const* get_best_score_name(enum_best_score_type bst); -unsigned short get_best_score_id_stat(enum_best_score_type bst); -enum_best_score_type get_best_score_type_by_sname(char const* stat_name); - -extern char* profile_table_name; - -typedef award_data awards_map_t[at_awards_count]; -typedef unsigned int bestscores_map_t[bst_score_types_count]; - -struct profile_data -{ - profile_data() - { - memset(&m_awards, 0, sizeof(m_awards)); - memset(&m_best_scores, 0, sizeof(m_best_scores)); - } - awards_map_t m_awards; - bestscores_map_t m_best_scores; -}; - -} // namespace gamespy_profile - -#endif //#ifndef PLAYER_AWARDS diff --git a/src/utils/mp_gpprof_server/profile_printer.h b/src/utils/mp_gpprof_server/profile_printer.h deleted file mode 100644 index 2bd4b526b20..00000000000 --- a/src/utils/mp_gpprof_server/profile_printer.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef PROFILE_PRINTER_INCLUDED -#define PROFILE_PRINTER_INCLUDED - -#include "profile_data_types.h" -#include - -template -inline std::basic_ostream& crlf(std::basic_ostream& ostr) -{ - ostr << "\r\n"; - return ostr; -} - -template -inline std::basic_ostream& operator<<( - std::basic_ostream& ostr, gamespy_profile::profile_data const& profile_data) -{ - using namespace gamespy_profile; - for (int i = 0; i < at_awards_count; ++i) - { - char const* tmp_award_name = get_award_name(enum_awards_t(i)); - ostr << tmp_award_name << "=" << profile_data.m_awards[i].m_count << crlf << tmp_award_name - << "_rdate=" << profile_data.m_awards[i].m_last_reward_date << crlf; - } - for (int i = 0; i < bst_score_types_count; ++i) - { - char const* tmp_score_name = get_best_score_name(enum_best_score_type(i)); - ostr << tmp_score_name << "=" << profile_data.m_best_scores[i] << crlf; - } - return ostr; -} - -#endif //#ifndef PROFILE_PRINTER_INCLUDED diff --git a/src/utils/mp_gpprof_server/profile_request.cpp b/src/utils/mp_gpprof_server/profile_request.cpp deleted file mode 100644 index a469b0d60bf..00000000000 --- a/src/utils/mp_gpprof_server/profile_request.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include "profile_request.h" -#include -#include "profile_printer.h" - -template -inline char* decode_url(char const (&src_url)[ArraySize], char (&dst_url)[ArraySize]) -{ - size_t src_length = strlen(src_url); - if (src_length > (ArraySize - 1)) - { - src_length = ArraySize - 1; - } - char number[3]; - char* pend = NULL; - size_t i = 0; - size_t di = 0; - - while (i < src_length) - { - char cvt_char; - if (src_url[i] == '%') - { - ++i; - if ((i + 2) > src_length) - break; - strncpy(number, &src_url[i], 2); - number[2] = 0; - cvt_char = (char)strtoul(number, &pend, 16); - i += 2; - } - else - { - cvt_char = src_url[i]; - ++i; - } - dst_url[di] = cvt_char; - ++di; - } - dst_url[di] = 0; - return dst_url; -} - -char* extract_username(char const* uri, char const* root_path, user_name_t& dst_user) -{ - typedef char url_string_t[256]; - url_string_t tmp_format; - sprintf(tmp_format, "%s/%%255s", root_path); // for url_string_t[256]; - url_string_t tmp_uname; - strcpy(tmp_uname, ""); - - if (sscanf(uri, tmp_format, tmp_uname)) - { - url_string_t decoded_uname; - strncpy(dst_user, decode_url(tmp_uname, decoded_uname), sizeof(dst_user) - 1); - dst_user[sizeof(dst_user) - 1] = 0; - } - else - { - strcpy(dst_user, ""); - } - return dst_user; -} - -fetch_profile_request::fetch_profile_request(request_ptr_t fcgx_request, user_name_t const profile_name) - : m_fcg_request(fcgx_request), m_profile_name(profile_name), m_in(m_fcg_request->in), m_out(m_fcg_request->out), - m_err(m_fcg_request->err) -{ -} - -fetch_profile_request::~fetch_profile_request(){}; - -void fetch_profile_request::complete_success(gamespy_profile::profile_data const& profdata) -{ - m_out << crlf << m_profile_name << crlf << profdata << crlf; - FCGX_SetExitStatus(200, m_fcg_request->out); - FCGX_Finish_r(m_fcg_request.get()); -} - -void fetch_profile_request::complete_failed() -{ - FCGX_SetExitStatus(404, m_fcg_request->out); - FCGX_Finish_r(m_fcg_request.get()); -} diff --git a/src/utils/mp_gpprof_server/profile_request.h b/src/utils/mp_gpprof_server/profile_request.h deleted file mode 100644 index e6a234f45e2..00000000000 --- a/src/utils/mp_gpprof_server/profile_request.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef PROFILE_REQUEST_INCLUDED -#define PROFILE_REQUEST_INCLUDED - -#include -#include -#include -#include "profile_data_types.h" - -#define MAX_URI_SIZE 256 -#define MAX_USER_NAME 128 -typedef char request_uri_t[MAX_URI_SIZE]; -typedef char user_name_t[MAX_USER_NAME]; - -char* extract_username(char const* uri, char const* root_path, user_name_t& dst_user); - -class fetch_profile_request -{ -public: - typedef std::auto_ptr request_ptr_t; - - fetch_profile_request(request_ptr_t fcgx_request, user_name_t const profile_name); - ~fetch_profile_request(); - - char const* get_profile_name() const { return m_profile_name.c_str(); }; - void complete_success(gamespy_profile::profile_data const& profdata); - void complete_failed(); - -private: - fetch_profile_request() : m_in(NULL), m_out(NULL), m_err(NULL) {} - request_ptr_t m_fcg_request; - std::string m_profile_name; - fcgi_istream m_in; - fcgi_ostream m_out; - fcgi_ostream m_err; -}; // class fetch_profile_request - -#endif //#ifndef PROFILE_REQUEST_INCLUDED diff --git a/src/utils/mp_gpprof_server/profiles_cache.cpp b/src/utils/mp_gpprof_server/profiles_cache.cpp deleted file mode 100644 index 7a389ffe1bf..00000000000 --- a/src/utils/mp_gpprof_server/profiles_cache.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "profiles_cache.h" -#include -#include - -extern unsigned int cache_expire_time; - -profiles_cache::profiles_cache(unsigned int max_memory) -{ - m_items_allowed = max_memory / sizeof(cache_item); - assert(m_items_allowed); - m_cache.reserve(m_items_allowed); -} - -profiles_cache::~profiles_cache() {} -bool profiles_cache::search(user_name_t const& profname, gamespy_profile::profile_data& dest_data) -{ - cache_item search_item; - strcpy(search_item.m_user_name, profname); - cache_t::iterator tmp_iter = std::lower_bound(m_cache.begin(), m_cache.end(), search_item, cache_item_less_p()); - if (tmp_iter != m_cache.end()) - { - if (strcmp(tmp_iter->m_user_name, profname)) - return false; - - if ((xray::get_clock_ms() - tmp_iter->m_creation_time) >= cache_expire_time) - { - m_cache.erase(tmp_iter); - return false; - } - - dest_data = tmp_iter->m_profile_data; - ++tmp_iter->m_hits_count; - return true; - } - return false; -} - -profiles_cache::cache_item::cache_item() -{ - strcpy(m_user_name, ""); - m_creation_time = 0; - m_hits_count = 0; -} - -profiles_cache::cache_item::cache_item(cache_item const& copy) -{ - strcpy(m_user_name, copy.m_user_name); - m_profile_data = copy.m_profile_data; - m_creation_time = copy.m_creation_time; - m_hits_count = copy.m_hits_count; -} - -bool const profiles_cache::cache_item_less_p::operator()(cache_item const& left, cache_item const& right) const -{ - return strcmp(left.m_user_name, right.m_user_name) < 0; -}; - -bool profiles_cache::add(char const* profname, gamespy_profile::profile_data const& src_data) -{ - if (!get_free_space()) - { - return false; - } - cache_item search_item; - strcpy(search_item.m_user_name, profname); - cache_t::iterator tmp_iter = std::lower_bound(m_cache.begin(), m_cache.end(), search_item, cache_item_less_p()); - if (tmp_iter != m_cache.end()) - { - if (!strcmp(tmp_iter->m_user_name, profname)) - { - tmp_iter->m_profile_data = src_data; - tmp_iter->m_creation_time = xray::get_clock_ms(); - return true; - } - } - - cache_item new_item; - strcpy(new_item.m_user_name, profname); - new_item.m_profile_data = src_data; - new_item.m_creation_time = xray::get_clock_ms(); - m_cache.push_back(new_item); - return true; -} - -void profiles_cache::sort() { std::sort(m_cache.begin(), m_cache.end(), cache_item_less_p()); } -profiles_cache::cache_t::size_type profiles_cache::get_free_space() { return m_cache.capacity() - m_cache.size(); } -bool const profiles_cache::cache_item_expired_p::operator()(cache_item const& left) const -{ - if (!left.m_hits_count) - return true; - if ((m_current_time - left.m_creation_time) >= m_expire_time) - return true; - return false; -} - -void profiles_cache::clear_expired() -{ - cache_item_expired_p tmp_predicate; - tmp_predicate.m_current_time = xray::get_clock_ms(); - tmp_predicate.m_expire_time = cache_expire_time; - m_cache.erase(std::remove_if(m_cache.begin(), m_cache.end(), tmp_predicate), m_cache.end()); -} diff --git a/src/utils/mp_gpprof_server/profiles_cache.h b/src/utils/mp_gpprof_server/profiles_cache.h deleted file mode 100644 index d11b64ad27d..00000000000 --- a/src/utils/mp_gpprof_server/profiles_cache.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef PROFILES_CACHE_INCLUDED -#define PROFILES_CACHE_INCLUDED - -#include -#include "profile_data_types.h" -#include "profile_request.h" -#include "threads.h" - -class profiles_cache -{ -public: - profiles_cache(unsigned int max_memory); - ~profiles_cache(); - bool search(user_name_t const& profname, gamespy_profile::profile_data& dest_data); - bool add(char const* profname, gamespy_profile::profile_data const& src_data); - void clear_expired(); - void sort(); - -private: - profiles_cache(){}; - struct cache_item - { - cache_item(); - cache_item(cache_item const& copy); - user_name_t m_user_name; - gamespy_profile::profile_data m_profile_data; - unsigned int m_creation_time; - unsigned int m_hits_count; - }; - struct cache_item_less_p - { - bool const operator()(cache_item const& left, cache_item const& right) const; - }; // struct cache_item_less_predicate - struct cache_item_expired_p - { - cache_item_expired_p(){}; - cache_item_expired_p(cache_item_expired_p const& copy) - : m_current_time(copy.m_current_time), m_expire_time(copy.m_expire_time) - { - } - unsigned int m_current_time; - unsigned int m_expire_time; - bool const operator()(cache_item const& left) const; - }; - typedef std::vector cache_t; - - cache_t m_cache; - cache_t::size_type m_items_allowed; - - cache_t::size_type get_free_space(); -}; // class profiles_cache - -#endif //#ifndef PROFILES_CACHE_INCLUDED diff --git a/src/utils/mp_gpprof_server/requests_processor.cpp b/src/utils/mp_gpprof_server/requests_processor.cpp deleted file mode 100644 index bc61f315cc4..00000000000 --- a/src/utils/mp_gpprof_server/requests_processor.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "requests_processor.h" - -extern char const* default_root_path; -extern char const* root_path; - -static gsi_time const gamespy_think_time = 100; -static unsigned int wait_train_time_ms = 100; -static unsigned int profiles_cache_size = 1024 * 1024 * 32; // 32 Mb -unsigned int cache_expire_time = 1000 * 60 * 5; // 5 min - -requests_poll::requests_poll() : m_profiles_cache(profiles_cache_size) { start_work(); } -requests_poll::~requests_poll() {} -bool requests_poll::requests_worker(void* arg, sake_processor* sproc) -{ - requests_poll* me = static_cast(arg); - return me->request_processor(sproc); -} - -void requests_poll::add_request(request_ptr_t fcgx_request) -{ - using namespace gamespy_profile; - user_name_t tmp_user_name; - char* requested_uri = FCGX_GetParam("REQUEST_URI", fcgx_request->envp); - if (!requested_uri || !strlen(requested_uri)) - { - std::cerr << "requested invalid url" << std::endl; - FCGX_SetExitStatus(404, fcgx_request->out); - FCGX_Finish_r(fcgx_request.get()); - return; - } - - char const* rpath = root_path != NULL ? root_path : default_root_path; - extract_username(requested_uri, rpath, tmp_user_name); - if (!strlen(tmp_user_name)) - { - std::cerr << "no user specified in request" << std::endl; - FCGX_SetExitStatus(404, fcgx_request->out); - FCGX_Finish_r(fcgx_request.get()); - return; - } - - profile_data tmp_profdata; - m_cache_sync.lock(); - if (m_profiles_cache.search(tmp_user_name, tmp_profdata)) - { - m_cache_sync.unlock(); - fetch_profile_request tmp_request(fcgx_request, tmp_user_name); - tmp_request.complete_success(tmp_profdata); - return; - } - m_cache_sync.unlock(); - - // trying to search name in cache .. - // adding request to processor queue .. - add_new_request(fcgx_request, tmp_user_name); -} - -void requests_poll::add_new_request(request_ptr_t fcgx_request, user_name_t const profile_name) -{ - m_new_request_sync.lock(); - m_new_requests.push_back(new fetch_profile_request(fcgx_request, profile_name)); - m_new_request_sync.unlock(); -} - -void requests_poll::start_work() { m_sake_worker.add_task(&requests_poll::requests_worker, this); } -bool requests_poll::request_processor(sake_processor* sproc) -{ - bool is_active = false; - m_new_request_sync.lock(); - is_active = !m_active_requests.empty(); - m_new_request_sync.unlock(); - - if (is_active) - { - sproc->think(gamespy_think_time); - if (sproc->is_result_ready()) - { - process_result(sproc); - } - else - { - return true; - } - } - - if (m_new_requests.empty()) - { - xray::sleep(wait_train_time_ms); - return true; - } - - m_new_request_sync.lock(); - sproc->begin_fetch(); - for (requests_t::iterator i = m_new_requests.begin(), ie = m_new_requests.end(); i != ie; ++i) - { - sproc->add_name((*i)->get_profile_name()); - } - sproc->fetch(); - m_active_requests = m_new_requests; - m_new_requests.clear(); - m_new_request_sync.unlock(); - - return true; -} - -void requests_poll::process_result(sake_processor* sproc) -{ - bool need_sort = false; - bool cleared_expired = false; - m_new_request_sync.lock(); - for (requests_t::iterator i = m_active_requests.begin(), ie = m_active_requests.end(); i != ie; ++i) - { - gamespy_profile::profile_data tmp_data; - if (sproc->get_profile((*i)->get_profile_name(), tmp_data)) - { - m_cache_sync.lock(); - need_sort |= m_profiles_cache.add((*i)->get_profile_name(), tmp_data); - if (!need_sort && !cleared_expired) - { - m_profiles_cache.clear_expired(); - need_sort |= m_profiles_cache.add((*i)->get_profile_name(), tmp_data); - cleared_expired = true; - } - m_cache_sync.unlock(); - (*i)->complete_success(tmp_data); - } - else - { - (*i)->complete_failed(); - } - delete (*i); - } - m_active_requests.clear(); - m_new_request_sync.unlock(); - if (need_sort) - { - m_cache_sync.lock(); - m_profiles_cache.sort(); - m_cache_sync.unlock(); - } -} diff --git a/src/utils/mp_gpprof_server/requests_processor.h b/src/utils/mp_gpprof_server/requests_processor.h deleted file mode 100644 index 812ccf606e1..00000000000 --- a/src/utils/mp_gpprof_server/requests_processor.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef REQUESTS_PROCESSOR_INCLUDED -#define REQUESTS_PROCESSOR_INCLUDED - -#include -#include -#include -#include -#include "threads.h" -#include "sake_worker.h" -#include "profile_request.h" -#include "profiles_cache.h" - -class requests_poll -{ -public: - requests_poll(); - ~requests_poll(); - typedef fetch_profile_request::request_ptr_t request_ptr_t; - void add_request(request_ptr_t fcgx_request); - -private: - typedef std::vector requests_t; - static bool requests_worker(void* arg, sake_processor* sproc); - - bool request_processor(sake_processor* sproc); - void start_work(); - void add_new_request(request_ptr_t fcgx_request, user_name_t const profile_name); - void process_result(sake_processor* sproc); - - xray::mutex m_new_request_sync; - xray::mutex m_cache_sync; - requests_t m_new_requests; - requests_t m_active_requests; - profiles_cache m_profiles_cache; - sake_worker m_sake_worker; -}; // class requests_poll - -#endif //#ifndef REQUESTS_PROCESSOR_INCLUDED diff --git a/src/utils/mp_gpprof_server/sake_worker.cpp b/src/utils/mp_gpprof_server/sake_worker.cpp deleted file mode 100644 index 4299274b7a7..00000000000 --- a/src/utils/mp_gpprof_server/sake_worker.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include "sake_worker.h" - -sake_worker::sake_worker() : m_thread_initialized(0), m_initialization_success(0) -{ - m_thread.reset(new thread_t(&sake_worker::worker_thread, this)); - sched_yield(); - while (!m_thread_initialized) - { - sched_yield(); - } - if (!m_initialization_success) - throw std::runtime_error("failed to initialize sake_worker"); -} - -sake_worker::~sake_worker() { add_task(&sake_worker::thread_stopper, NULL); } -void sake_worker::add_task(sake_task_proc_t proc, void* arg) -{ - m_newtask_mutex.lock(); - m_tasks.emplace_back(proc, arg); - m_newtask_cond.signal(); - m_newtask_mutex.unlock(); -} - -void* sake_worker::worker_thread() -{ - using namespace std; - try - { - std::auto_ptr m_sake_inst(new sake_processor()); - m_thread_initialized = 1; - m_initialization_success = 1; - bool stop_signal = false; - while (!stop_signal) - { - m_newtask_mutex.lock(); - while (m_tasks.empty()) - m_newtask_cond.wait(m_newtask_mutex); - - while (!m_tasks.empty()) - { - task_item_t& tmp_item = m_tasks.front(); - if (tmp_item.first == thread_stopper) - { - stop_signal = true; - break; - } - if (tmp_item.first(tmp_item.second, m_sake_inst.get())) - { - m_tasks.push_back(tmp_item); - } - m_tasks.pop_front(); - } - m_newtask_mutex.unlock(); - } - } - catch (const std::exception& e) - { - m_thread_initialized = 1; - m_initialization_success = 0; - cerr << "Caught exception: " << e.what() << endl << "Type: " << typeid(e).name() << endl; - } - return NULL; -} diff --git a/src/utils/mp_gpprof_server/sake_worker.h b/src/utils/mp_gpprof_server/sake_worker.h deleted file mode 100644 index cece3d3621b..00000000000 --- a/src/utils/mp_gpprof_server/sake_worker.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef SAKE_WORKER_INCLUDED -#define SAKE_WORKER_INCLUDED - -#include "gamespy_sake.h" -#include "threads.h" -#include - -class sake_worker -{ -public: - sake_worker(); - ~sake_worker(); - - typedef bool (*sake_task_proc_t)(void*, sake_processor*); - void add_task(sake_task_proc_t proc, void* arg); - -private: - typedef xray::thread_method thread_t; - typedef std::pair task_item_t; - typedef std::deque tasks_queue_t; - - volatile long m_thread_initialized; - volatile long m_initialization_success; - // WARNING ! do not change order of members ! - xray::mutex m_newtask_mutex; - xray::condition m_newtask_cond; - tasks_queue_t m_tasks; - std::auto_ptr m_thread; - - void* worker_thread(); - static bool thread_stopper(void*, sake_processor*) { return false; }; -}; // class sake_worker - -#endif //#ifndef SAKE_WORKER_INCLUDED diff --git a/src/utils/mp_gpprof_server/threads.cpp b/src/utils/mp_gpprof_server/threads.cpp deleted file mode 100644 index 411e7ca5eaa..00000000000 --- a/src/utils/mp_gpprof_server/threads.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include "threads.h" - -namespace xray -{ -mutex::mutex() -{ - if (pthread_mutex_init(&m_mutex, NULL) != 0) - throw std::runtime_error("failed to initialize mutex"); -} -mutex::~mutex() { pthread_mutex_destroy(&m_mutex); } -void mutex::lock() { pthread_mutex_lock(&m_mutex); } -bool mutex::try_lock() { return (pthread_mutex_trylock(&m_mutex) == 0); } -void mutex::unlock() { pthread_mutex_unlock(&m_mutex); } -condition::condition() -{ - if (pthread_cond_init(&m_cond, NULL) != 0) - throw std::runtime_error("failed to initialize condition variable"); -} - -condition::~condition() { pthread_cond_destroy(&m_cond); } -void condition::wait(mutex& m) { pthread_cond_wait(&m_cond, m.get()); } -void condition::signal() { pthread_cond_signal(&m_cond); } -unsigned int const get_clock_ms() { return (clock() / CLOCKS_PER_SEC) * 1000; } -void sleep(unsigned int const ms) -{ - timespec tmp_ts; - timespec tmp_tsrem; - tmp_ts.tv_sec = ms / 1000; - tmp_ts.tv_nsec = (ms % 1000) * 1000; - nanosleep(&tmp_ts, &tmp_tsrem); -} - -} // namespace xray diff --git a/src/utils/mp_gpprof_server/threads.h b/src/utils/mp_gpprof_server/threads.h deleted file mode 100644 index fdd63adb5ba..00000000000 --- a/src/utils/mp_gpprof_server/threads.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef THREADS_H_INCLUDED -#define THREADS_H_INCLUDED - -#include -#include -#include -#include -#include -#include - -namespace xray -{ -class mutex -{ -public: - mutex(); - ~mutex(); - void lock(); - bool try_lock(); - void unlock(); - pthread_mutex_t* get() { return &m_mutex; } -private: - pthread_mutex_t m_mutex; -}; // class mutex - -class condition -{ -public: - condition(); - ~condition(); - void wait(mutex& m); - void signal(); - -private: - pthread_cond_t m_cond; -}; // class condition - -template -class thread_method -{ -public: - thread_method(void* (T::*method)(), T* this_ptr) - { - m_method = method; - m_this_ptr = this_ptr; - pthread_attr_init(&m_attr); - pthread_attr_setdetachstate(&m_attr, PTHREAD_CREATE_DETACHED); - m_thread_is_running = true; - if (pthread_create(&m_pid, &m_attr, worker, this) != 0) - { - std::string err_string("failed to start thread: "); - err_string.append(typeid(method).name()); - throw std::runtime_error(err_string); - } - pthread_detach(m_pid); - } - - ~thread_method() - { - m_stop_mutex.lock(); - if (m_thread_is_running) - { - pthread_kill(m_pid, SIGTERM); - while (m_thread_is_running) - m_stopped_cond.wait(m_stop_mutex); - } - m_stop_mutex.unlock(); - } - // pthread_t const get_pid() const { return m_pid; }; -private: - thread_method(){}; - typedef void* (T::*method_t)(); - - pthread_t m_pid; - pthread_attr_t m_attr; - T* m_this_ptr; - method_t m_method; - - mutex m_stop_mutex; - condition m_stopped_cond; - volatile long m_thread_is_running; - - static void* worker(void* arg) - { - thread_method* me = static_cast(arg); - assert(me); - T* this_ptr = me->m_this_ptr; - assert(me->m_this_ptr); - void* ret_value = NULL; - try - { - ret_value = (me->m_this_ptr->*(me->m_method))(); - } - catch (...) - { - std::cerr << "Caught unknown exception: thread: " << typeid(thread_method).name() << std::endl; - } - me->m_stop_mutex.lock(); - me->m_stopped_cond.signal(); - me->m_thread_is_running = false; - me->m_stop_mutex.unlock(); - pthread_exit(ret_value); - return ret_value; - }; -}; // class thread_method - -unsigned int const get_clock_ms(); -void sleep(unsigned int const ms); - -} // namespace xray - -#endif //#ifndef THREADS_H_INCLUDED diff --git a/src/utils/xrLoadSurface.cpp b/src/utils/xrLoadSurface.cpp deleted file mode 100644 index f3ac517cee5..00000000000 --- a/src/utils/xrLoadSurface.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "stdafx.h" -#pragma hdrstop - -#include - -struct SExts -{ - xr_vector exts; - void format_register(pcstr ext) - { - if (ext && ext[0]) - { - for (u32 i = 0; i < exts.size(); i++) - if (0 == xr_stricmp(exts[i], ext)) - return; - exts.push_back(xr_strdup(ext)); - } - } - u32 size() { return (u32)exts.size(); } - pstr operator[](int k) { return exts[k]; } - ~SExts() - { - for (u32 i = 0; i < exts.size(); i++) - xr_free(exts[i]); - exts.clear(); - } -}; -SExts formats; - -void Surface_FormatExt(FREE_IMAGE_FORMAT f) -{ - pcstr n = FreeImage_GetFIFExtensionList(f); - if (n) - { - pstr base = xr_strdup(n); - pstr ext = base; - pstr cur = ext; - for (; ext[0]; ext++) - { - if (ext[0] == ',') - { - ext[0] = 0; - formats.format_register(cur); - cur = ++ext; - } - } - if (cur && cur[0]) - formats.format_register(cur); - xr_free(base); - } -} -void Surface_Init() -{ - Msg("* ImageLibrary version: %s", FreeImage_GetVersion()); - - formats.format_register("tga"); - Surface_FormatExt(FIF_BMP); - Surface_FormatExt(FIF_ICO); - Surface_FormatExt(FIF_JPEG); - Surface_FormatExt(FIF_JNG); - Surface_FormatExt(FIF_KOALA); - Surface_FormatExt(FIF_LBM); - Surface_FormatExt(FIF_MNG); - Surface_FormatExt(FIF_PBM); - Surface_FormatExt(FIF_PBMRAW); - Surface_FormatExt(FIF_PCD); - Surface_FormatExt(FIF_PCX); - Surface_FormatExt(FIF_PGM); - Surface_FormatExt(FIF_PGMRAW); - Surface_FormatExt(FIF_PNG); - Surface_FormatExt(FIF_PPM); - Surface_FormatExt(FIF_PPMRAW); - Surface_FormatExt(FIF_RAS); - Surface_FormatExt(FIF_TARGA); - Surface_FormatExt(FIF_TIFF); - Surface_FormatExt(FIF_WBMP); - Surface_FormatExt(FIF_PSD); - Surface_FormatExt(FIF_IFF); - - Msg("* %d supported formats", formats.size()); -} - -bool Surface_Detect(string_path& F, pstr N) -{ - FS.update_path(F, "$game_textures$", strconcat(sizeof(F), F, N, ".dds")); - FILE* file = fopen(F, "rb"); - if (file) - { - fclose(file); - return true; - } - - return false; -} - -u32* Surface_Load(char* name, u32& w, u32& h) -{ - if (strchr(name, '.')) - *(strchr(name, '.')) = 0; - - // detect format - string_path full; - if (!Surface_Detect(full, name)) - return nullptr; - - fipImage image; - image.load(full); - - // convert if needed - if (image.getBitsPerPixel() != 32) - { - image.convertTo32Bits(); - } - - if (!image.isValid()) - return nullptr; - - w = image.getWidth(); - h = image.getHeight(); - - const size_t size = w * h * 4; - - u32* memory = (u32*)xr_malloc(size); - u32* data = (u32*)image.getScanLine(0); - - CopyMemory(memory, data, size); - - return memory; -} diff --git a/src/xrCore/CMakeLists.txt b/src/xrCore/CMakeLists.txt index 7e1fc50a178..412ac61e95b 100644 --- a/src/xrCore/CMakeLists.txt +++ b/src/xrCore/CMakeLists.txt @@ -23,7 +23,6 @@ target_sources_grouped( FILES ../Common/Common.hpp ../Common/Config.hpp - ../Common/face_smoth_flags.h ../Common/FSMacros.hpp ../Common/LevelGameDef.h ../Common/Noncopyable.hpp diff --git a/src/xrCore/xrCoreB.bpf b/src/xrCore/xrCoreB.bpf deleted file mode 100644 index f06587f02f9..00000000000 --- a/src/xrCore/xrCoreB.bpf +++ /dev/null @@ -1,2 +0,0 @@ -This file is used by the project manager only and should be treated like the project file -DllMain \ No newline at end of file diff --git a/src/xrCore/xrCoreB.bpr b/src/xrCore/xrCoreB.bpr deleted file mode 100644 index 2ac09578ed0..00000000000 --- a/src/xrCore/xrCoreB.bpr +++ /dev/null @@ -1,439 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=34 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1058 -CodePage=1251 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.34 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=30 -Item0=..\editors\ECore;E:\Program Files (x86)\Borland\CBuilder6\Projects;blackbox;$(ETOOLS_DIR);$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item1=blackbox;$(ETOOLS_DIR);$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item2=$(VC_INCLUDE);blackbox;$(ETOOLS_DIR);$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item3=blackbox;$(ETOOLS_DIR);$(DXSDK_DIR)\Include;$(BCB)\_include_;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item4=$(ETOOLS_DIR);$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item5=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item6=$(DXSDK)\Include;$(BCB)\include;$(BCB)\include\vcl;$(BCB)\Include\Mfc -Item7=I:\Program Files\Microsoft DirectX SDK (October 2006)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;$(BCB)\Include\Mfc -Item8=R:\SDK\Microsoft DirectX 9.0 SDK (April 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;$(BCB)\Include\Mfc -Item9=R:\SDK\Microsoft DirectX 9.0 SDK (April 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc -Item10=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc;..\Tools\Etools -Item11=R:\SDK\Microsoft DirectX 9.0 SDK (October 2004)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc;..\Tools\Etools -Item12=R:\SDK\DirectX9.0_sum_2004\Include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc;..\Tools\Etools -Item13=R:\SDK\DirectX9.0_sum_2004\Include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc -Item14=$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc -Item15=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\Borland\CBuilder6\Include\Mfc -Item16=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;R:\Borland\CBuilder6\Include\Mfc -Item17=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item18=R:\SDK\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item19=R:\SDK\DirectX8.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item20=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;$(BCB)\include\mfc -Item21=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;$(BCB)\include\mfc -Item22=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item23=R:\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item24=R:\DirectX9\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item25=R:\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item26=..\LevelOptions\Engine;..\LevelOptions\Editor;..\LevelOptions;Editor;R:\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;engine;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item27=Editor;R:\DirectX8.1\include\;$(BCB)\include;$(BCB)\include\vcl;engine;P:\MagicFM_Borland\Sdk\Include\;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item28=Editor;Engine\Blenders;R:\Borland\Components\Eldos\Code\Source\;r:\borland\components\alexmx\;lib\DX;R:\DirectX8.1\include\;c:\rad\Borland\CBuilder5\Bin\;c:\rad\borland\CBuilder5\Projects\;$(BCB)\include;$(BCB)\include\vcl;engine;edit;Import\LWO;Collide;P:\MagicFM_Borland\Sdk\Include\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;c:\rad\borland\components\renderwindow\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item29=Engine\Blenders;R:\Borland\Components\Eldos\Code\Source\;r:\borland\components\alexmx\;lib\DX;R:\DirectX8.1\include\;c:\rad\Borland\CBuilder5\Bin\;c:\rad\borland\CBuilder5\Projects\;$(BCB)\include;$(BCB)\include\vcl;engine;edit;Import\LWO;Collide;P:\MagicFM_Borland\Sdk\Include\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;c:\rad\borland\components\renderwindow\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ - -[HistoryLists\hlLibraryPath] -Count=30 -Item0=..\editors\ECore;E:\Program Files (x86)\Borland\CBuilder6\Projects;blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(OUT_LIB_DIR);..\..\sdk\components\Elpack\Code;..\..\sdk\components\AlexMX -Item1=..\editors\ECore;E:\Program Files (x86)\Borland\CBuilder6\Projects;blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(OUT_LIB_DIR);$(COMPONENTS)\Elpack\Code;$(COMPONENTS)\AlexMX -Item2=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(OUT_LIB_DIR);$(COMPONENTS)\Elpack\Code;$(COMPONENTS)\AlexMX -Item3=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(COMPONENTS)\ElPack\Code;$(OUT_LIB_DIR) -Item4=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(COMPONENTS)\ElPack\Code;$(OUTPUT_LIBRARIES_DIR) -Item5=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(COMPONENTS)\ElPack\Code;$(OUTPUT_LINRARIES_DIR) -Item6=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(COMPONENTS)\ElPack\Code -Item7=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(COMPONENTS_DIR)\ElPack\Code -Item8=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\stalker_addon\libraries;$(BCB)\lib\psdk;X:\stalker_addon\sources\sdk\components\ElPack\Code;x:\libraries;X:\sources\sdk\components\ElPack\Code -Item9=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\stalker_addon\libraries;$(BCB)\lib\psdk;X:\stalker_addon\sources\sdk\components\ElPack\Code;x:\libraries -Item10=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\stalker_addon\libraries;$(BCB)\lib\psdk;X:\stalker_addon\sources\sdk\components\ElPack\Code;x:\libraries\ -Item11=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\stalker_addon\libraries;$(BCB)\lib\psdk;X:\stalker_addon\sources\sdk\components\ElPack\Code -Item12=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\stalker_addon\libraries;$(BCB)\lib\psdk -Item13=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\libraries;$(BCB)\lib\psdk -Item14=blackbox;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\libraries -Item15=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\libraries -Item16=i:\Projects\editors\components\Alexmx;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;x:\libraries -Item17=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(COMPONENTS)\AlexMX;$(COMPONENTS)\ElPack\Code;x:\libraries -Item18=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(COMPONENTS)\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib;x:\ -Item19=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib;x:\ -Item20=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib -Item21=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\lib\dx;..\lib -Item22=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;lib;lib\dx -Item23=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;lib -Item24=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk -Item25=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk\ -Item26=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item27=..\LevelOptions\Engine;..\LevelOptions\Editor;..\LevelOptions;c:\rad\borland\CBuilder5\Projects;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item28=c:\rad\borland\CBuilder5\Projects\;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item29=c:\rad\borland\CBuilder5\Projects\;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;r:\borland\components\alexmx\;R:\Borland\Components\Eldos\Code\Source\;R:\Borland\Components\Eldos\Code\ - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=8 -Item0=_EDITOR;_XRCOREB;XRCORE_EXPORTS;_DEBUG -Item1=_EDITOR;_XRCOREB;XRCORE_EXPORTS -Item2=_XRCOREB;XRCORE_EXPORTS -Item3=_XRCOREB;XRCORE_EXPORTS;_DEBUG -Item4=_XRCOREB -Item5=_LEVEL_OPTIONS -Item6=_OPTIONS -Item7=_DEBUG - -[HistoryLists\hlIntOutputDir] -Count=9 -Item0=..\..\intermediate\editors\xrCoreB\ -Item1=x:\intermediate_ed\core -Item2=$(OUTPUT_INTERMEDIATE_DIR)\core -Item3=$(OUTPUT_INTERMEDIATE_DIR) -Item4=$(OUTPUT_INTERMEDIATE_DIR)\ -Item5=x:\intermediate_ed -Item6=Intermediate -Item7=XRLC_Intermediate -Item8=xrLC_Options - -[HistoryLists\hlFinalOutputDir] -Count=19 -Item0=..\..\bin\editors\ -Item1=$(OUTPUT_BINARIES_DIR)\ -Item2=x:\stalker_addon\binaries\ -Item3=x:\binaries\ -Item4=x:\binaries -Item5=C:\Program Files\THQ\S.T.A.L.K.E.R. - Shadow of Chernobyl\ -Item6=x:\ -Item7=x:\build\ -Item8=x:\build -Item9=u:\preliminary\ -Item10=u:\preliminary -Item11=s:\bin\ -Item12=z:\ -Item13=S:\build_zmey\ -Item14=S:\build_zmey -Item15=x:\xrCoreB.dll\ -Item16=x:\xrCoreB.dll -Item17=!run\ -Item18=!run - -[HistoryLists\hIBPIOutputDir] -Count=8 -Item0=..\..\lib\editors\ -Item1=x:\stalker_addon\libraries -Item2=$(OUT_LIB_DIR) -Item3=$(OUT_LIB_DIR)\ -Item4=$(OUTPUT_LIBRARIES_DIR) -Item5=$(OUTPUT_LIBRARIES_DIR)\ -Item6=x:\libraries -Item7=x:\libraries\ - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams=-wf x:\stalker_addon\resources -Launcher= -UseLauncher=0 -DebugCWD= -HostApplication=x:\stalker_addon\binaries\LevelEditor.exe -RemoteHost= -RemotePath= -RemoteLauncher= -RemoteCWD= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[CORBA] -AddServerUnit=1 -AddClientUnit=1 -PrecompiledHeaders=1 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -[Linker] -LibPrefix= -LibSuffix= -LibVersion= - - \ No newline at end of file diff --git a/src/xrCore/xrCoreB.dsk b/src/xrCore/xrCoreB.dsk deleted file mode 100644 index 07eaae9c755..00000000000 --- a/src/xrCore/xrCoreB.dsk +++ /dev/null @@ -1,222 +0,0 @@ -[Closed Files] -File_0=SourceModule,'I:\xray-svn\xrCore\xrMemory_pso_Fill32.cpp',0,1,1,1,1,0,0 -File_1=SourceModule,'I:\xray-svn\xrCore\stdafx.cpp',0,1,1,1,1,0,0 -File_2=SourceModule,'I:\xray-svn\xrCore\_sphere.cpp',0,1,1,65,14,0,0 -File_3=SourceModule,'I:\xray-svn\xrCore\xrDebug.cpp',0,1,311,93,323,0,0 -File_4=SourceModule,'I:\xray-svn\xrCore\xrCore.rc',0,1,1,57,6,0,0 -File_5=SourceModule,'I:\xray-svn\xrCore\ELocatorAPI.cpp',0,1,13,1,1,0,0 -File_6=SourceModule,'I:\xray-svn\xrCore\xrMemory_subst_borland.cpp',0,1,1,1,5,0,0 -File_7=SourceModule,'I:\xray-svn\xrCore\cpuid.cpp',0,1,1,1,1,0,0 -File_8=SourceModule,'I:\xray-svn\xrCore\xrMemory.h',0,1,1,23,5,0,0 -File_9=SourceModule,'I:\xray-svn\xrCore\log.cpp',0,1,1,103,7,0,0 - -[Modules] -Module0=I:\xray-svn\xrCore\xrCore.cpp -Count=1 -EditWindowCount=1 - -[I:\xray-svn\xrCore\xrCore.cpp] -ModuleType=SourceModule -FormState=0 -FormOnTop=0 - -[I:\xray-svn\xrCore\xrCoreB.bpr] -FormState=0 -FormOnTop=0 - -[I:\Program Files\Borland\CBuilder6\Projects\ProjectGroup1.bpg] -FormState=0 -FormOnTop=0 - -[EditWindow0] -ViewCount=1 -CurrentView=0 -View0=0 -CodeExplorer=CodeExplorer@EditWindow0 -MessageView=MessageView@EditWindow0 -ClassHierarchy=ClassHierarchy@EditWindow0 -Create=1 -Visible=1 -State=0 -Left=31 -Top=101 -Width=1241 -Height=863 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=1233 -ClientHeight=836 -LeftPanelSize=0 -LeftPanelClients=CodeExplorer@EditWindow0 -LeftPanelData=00000400010000000C000000436F64654578706C6F72657200000000000000000000000000000000000100000000000000000C000000436F64654578706C6F726572FFFFFFFF -RightPanelSize=0 -BottomPanelSize=314 -BottomPanelClients=MessageView@EditWindow0,ProjectManager -BottomPanelData=0000040000000000D104000000000000023A010000000000000100000000E80100001200000050726F6A6563744D616E61676572466F726D0100000000D10400000B0000004D65737361676556696577FFFFFFFF - -[View0] -Module=I:\xray-svn\xrCore\xrCore.cpp -CursorX=1 -CursorY=1 -TopLine=1 -LeftCol=1 - -[Watches] -Count=0 - -[Breakpoints] -Count=0 - -[AddressBreakpoints] -Count=0 - -[Main Window] -Create=1 -Visible=1 -State=0 -Left=0 -Top=0 -Width=1280 -Height=105 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=1272 -ClientHeight=78 - -[ProjectManager] -Create=1 -Visible=1 -State=0 -Left=12 -Top=0 -Width=472 -Height=314 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=472 -ClientHeight=314 -TBDockHeight=314 -LRDockWidth=438 -Dockable=1 - -[AlignmentPalette] -Create=1 -Visible=0 -State=0 -Left=200 -Top=107 -Width=156 -Height=82 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=150 -ClientHeight=60 - -[PropertyInspector] -Create=1 -Visible=0 -State=0 -Left=0 -Top=451 -Width=190 -Height=509 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=182 -ClientHeight=485 -TBDockHeight=509 -LRDockWidth=190 -Dockable=1 -SplitPos=85 -ArrangeBy=Name -SelectedItem= -ExpandedItems= -HiddenCategories= - -[ObjectTree] -Create=1 -Visible=0 -State=0 -Left=0 -Top=105 -Width=190 -Height=344 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=182 -ClientHeight=320 -TBDockHeight=344 -LRDockWidth=190 -Dockable=1 - -[CodeguardLog] -Create=1 -Visible=0 -State=0 -Left=191 -Top=108 -Width=448 -Height=190 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=440 -ClientHeight=166 -TBDockHeight=190 -LRDockWidth=448 -Dockable=1 - -[ClassHierarchy@EditWindow0] -Create=1 -Visible=0 -State=0 -Left=218 -Top=113 -Width=403 -Height=284 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=395 -ClientHeight=260 -TBDockHeight=284 -LRDockWidth=403 -Dockable=1 -TreeWidth=121 -Col1Width=120 -Col2Width=120 - -[CodeExplorer@EditWindow0] -Create=1 -Visible=0 -State=0 -Left=0 -Top=12 -Width=170 -Height=603 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=170 -ClientHeight=603 -TBDockHeight=388 -LRDockWidth=170 -Dockable=1 -ClassViewDisplayMode=0 - -[MessageView@EditWindow0] -Create=1 -Visible=1 -State=0 -Left=500 -Top=0 -Width=733 -Height=314 -MaxLeft=-1 -MaxTop=-1 -ClientWidth=733 -ClientHeight=314 -TBDockHeight=314 -LRDockWidth=443 -Dockable=1 - -[DockHosts] -DockHostCount=0 - diff --git a/src/xrEngine/CMakeLists.txt b/src/xrEngine/CMakeLists.txt index 6ee391fa94c..78d27bea464 100644 --- a/src/xrEngine/CMakeLists.txt +++ b/src/xrEngine/CMakeLists.txt @@ -391,14 +391,6 @@ target_sources_grouped( EnnumerateVertices.h ) -# XXX: This is only used in utils, should be moved somewhere to utils -#target_sources_grouped( -# TARGET xrEngine -# NAME "" -# FILES -# xrLoadSurface.cpp -#) - target_sources(xrEngine PRIVATE ClientServer.txt diff --git a/src/xrParticles/xrParticlesB.bpf b/src/xrParticles/xrParticlesB.bpf deleted file mode 100644 index 7e0f6a59fb5..00000000000 --- a/src/xrParticles/xrParticlesB.bpf +++ /dev/null @@ -1,3 +0,0 @@ -This file is used by the project manager only and should be treated like the project file - -DllEntryPoint \ No newline at end of file diff --git a/src/xrParticles/xrParticlesB.bpr b/src/xrParticles/xrParticlesB.bpr deleted file mode 100644 index d54eb717401..00000000000 --- a/src/xrParticles/xrParticlesB.bpr +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=34 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1058 -CodePage=1251 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.34 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=26 -Item0=$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR) -Item1=$(VC_INCLUDE);$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR) -Item2=P:\Editors\ParticleEditor;$(BCB)\include;$(BCB)\include\vcl;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore -Item3=P:\Editors\ParticleEditor;$(BCB)\include;$(BCB)\include\vcl;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\DirectX9.0_sum_2004\Include -Item4=P:\Editors\ParticleEditor;R:\SDK\DirectX9.0_sum_2004\Include;C:\Rad\Borland\CBuilder6\Projects;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore -Item5=R:\SDK\DirectX9.0_sum_2004\Include;C:\Rad\Borland\CBuilder6\Projects;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore -Item6=C:\Rad\Borland\CBuilder6\Projects;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore -Item7=C:\Rad\Borland\CBuilder6\Projects;R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore -Item8=C:\Rad\Borland\CBuilder6\Projects;R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;P:\xrCore -Item9=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;P:\xrCore -Item10=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item11=R:\SDK\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item12=R:\SDK\DirectX8.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item13=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;$(BCB)\include\mfc -Item14=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;$(BCB)\include\mfc -Item15=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item16=R:\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item17=R:\DirectX9\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item18=R:\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item19=..\LevelOptions\Engine;..\LevelOptions\Editor;..\LevelOptions;Editor;R:\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;engine;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item20=Editor;R:\DirectX8.1\include\;$(BCB)\include;$(BCB)\include\vcl;engine;P:\MagicFM_Borland\Sdk\Include\;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source -Item21=Editor;Engine\Blenders;R:\Borland\Components\Eldos\Code\Source\;r:\borland\components\alexmx\;lib\DX;R:\DirectX8.1\include\;c:\rad\Borland\CBuilder5\Bin\;c:\rad\borland\CBuilder5\Projects\;$(BCB)\include;$(BCB)\include\vcl;engine;edit;Import\LWO;Collide;P:\MagicFM_Borland\Sdk\Include\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;c:\rad\borland\components\renderwindow\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item22=Engine\Blenders;R:\Borland\Components\Eldos\Code\Source\;r:\borland\components\alexmx\;lib\DX;R:\DirectX8.1\include\;c:\rad\Borland\CBuilder5\Bin\;c:\rad\borland\CBuilder5\Projects\;$(BCB)\include;$(BCB)\include\vcl;engine;edit;Import\LWO;Collide;P:\MagicFM_Borland\Sdk\Include\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;c:\rad\borland\components\renderwindow\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item23=$(BCB)\include;shared;$(BCB)\include\vcl;edit;edit\Shader;Import\LWO;Collide;P:\MagicFM_Borland\Sdk\Include\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;c:\rad\borland\components\renderwindow\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item24=$(BCB)\include;$(BCB)\include\vcl;edit -Item25=$(BCB)\include;$(BCB)\include\vcl - -[HistoryLists\hlLibraryPath] -Count=26 -Item0=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;..\..\sdk\components\ElPack\code;..\..\sdk\components\AlexMX;$(OUT_LIB_DIR) -Item1=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;$(COMPONENTS)\Elpack\code;$(OUT_LIB_DIR);$(COMPONENTS)\alexMX -Item2=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;$(COMPONENTS)\Elpack\code;$(OUT_LIB_DIR) -Item3=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;$(COMPONENTS)\Elpack\code -Item4=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk -Item5=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;x:\stalker_addon\libraries;X:\stalker_addon\sources\sdk\components\ElPack\Code;x:\libraries -Item6=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;x:\stalker_addon\libraries;X:\stalker_addon\sources\sdk\components\ElPack\Code -Item7=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;x:\stalker_addon\libraries -Item8=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\Lib\Psdk;x:\libraries -Item9=P:\Editors\ParticleEditor;C:\Rad\Borland\CBuilder6\Projects;c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;\Editors\lib\dx;\Editors\lib -Item10=C:\Rad\Borland\CBuilder6\Projects;c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;\Editors\lib\dx;\Editors\lib -Item11=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;\Editors\lib\dx;\Editors\lib -Item12=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib -Item13=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\lib\dx;..\lib -Item14=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;lib;lib\dx -Item15=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;lib -Item16=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk -Item17=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk\ -Item18=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item19=..\LevelOptions\Engine;..\LevelOptions\Editor;..\LevelOptions;c:\rad\borland\CBuilder5\Projects;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item20=c:\rad\borland\CBuilder5\Projects\;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item21=c:\rad\borland\CBuilder5\Projects\;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;r:\borland\components\alexmx\;R:\Borland\Components\Eldos\Code\Source\;R:\Borland\Components\Eldos\Code\ -Item22=Editor;shared;edit;edit\Shader;Collide;Import\LWO;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;c:\rad\borland\components\renderwindow\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item23=shared;edit;edit\Shader;Collide;Import\LWO;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;c:\rad\borland\components\renderwindow\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item24=edit;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib -Item25=$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=4 -Item0=_EDITOR;XR_PARTICLES_EXPORTS;_DEBUG -Item1=_EDITOR;XR_PARTICLES_EXPORTS -Item2=_EDITOR;PARTICLEDLL_EXPORTS;_DEBUG -Item3=_EDITOR;_PARTICLEDLLB;PARTICLEDLL_EXPORTS;_DEBUG - -[HistoryLists\hlIntOutputDir] -Count=9 -Item0=..\..\intermediate\editors\xrParticlesB -Item1=..\..\intermediate\editors\Particles -Item2=..\..\intermediate\editors\Particles\ -Item3=x:\intermediate_ed\particles -Item4=$(OUTPUT_INTERMEDIATE_DIR)\particles -Item5=$(OUTPUT_INTERMEDIATE_DIR) -Item6=$(OUTPUT_INTERMEDIATE_DIR)\ -Item7=x:\intermediate_ed -Item8=Intermediate - -[HistoryLists\hlFinalOutputDir] -Count=8 -Item0=..\..\bin\editors\ -Item1=$(OUTPUT_BINARIES_DIR)\ -Item2=x:\stalker_addon\binaries\ -Item3=x:\binaries\ -Item4=x:\binaries -Item5=x:\ -Item6=x:\build\ -Item7=x:\build - -[HistoryLists\hIBPIOutputDir] -Count=7 -Item0=..\..\lib\editors -Item1=..\..\lib\editors\ -Item2=x:\stalker_addon\libraries -Item3=$(OUTPUT_LIBRARIES_DIR) -Item4=$(OUTPUT_LIBRARIES_DIR)\ -Item5=x:\libraries -Item6=x:\ - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams=-wf x:\resources -Launcher= -UseLauncher=0 -DebugCWD= -HostApplication=x:\binaries\ParticleEditor.exe -RemoteHost= -RemotePath= -RemoteLauncher= -RemoteCWD= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[CORBA] -AddServerUnit=1 -AddClientUnit=1 -PrecompiledHeaders=1 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -[Linker] -LibPrefix= -LibSuffix= -LibVersion= - - \ No newline at end of file diff --git a/src/xrSound/xrSoundB.bpf b/src/xrSound/xrSoundB.bpf deleted file mode 100644 index 7e0f6a59fb5..00000000000 --- a/src/xrSound/xrSoundB.bpf +++ /dev/null @@ -1,3 +0,0 @@ -This file is used by the project manager only and should be treated like the project file - -DllEntryPoint \ No newline at end of file diff --git a/src/xrSound/xrSoundB.bpr b/src/xrSound/xrSoundB.bpr deleted file mode 100644 index b8f1c044b1f..00000000000 --- a/src/xrSound/xrSoundB.bpr +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=34 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1058 -CodePage=1251 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.34 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=30 -Item0=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR);$(XIPH_DIR);$(ETOOLS_DIR);$(EAX_DIR);$(AL_DIR) -Item1=$(VC_INCLUDE);$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR);$(XIPH_DIR);$(ETOOLS_DIR);$(EAX_DIR);$(AL_DIR) -Item2=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR);$(XIPH_DIR);$(ETOOLS_DIR);$(EAX_DIR) -Item3=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR);R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;$(XIPH_DIR);$(ETOOLS_DIR) -Item4=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR);R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;$(XIPH_DIR) -Item5=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;$(CORE_DIR);R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\xiph\include -Item6=$(DXSDK_DIR)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\xiph\include -Item7=R:\SDK\Microsoft DirectX 9.0 SDK (April 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\xiph\include -Item8=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\xiph\include -Item9=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\xiph\include;R:\SDK\!old\ogg.old\vorbis\include -Item10=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\!old\ogg.old\vorbis\include;R:\SDK\xiph\include -Item11=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\!old\ogg.old\vorbis\include;R:\SDK\xiph\include;R:\SDK\!old\ogg.old\ogg\include -Item12=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\!old\ogg.old\ogg\include;R:\SDK\xiph\include -Item13=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;R:\SDK\!old\ogg.old\ogg\include;R:\SDK\!old\ogg.old\vorbis\include;R:\SDK\xiph\include\1 -Item14=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\xiph\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL -Item15=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL -Item16=R:\SDK\Microsoft DirectX 9.0 SDK (February 2005)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL;..\..\Tools\Etools -Item17=R:\SDK\Microsoft DirectX 9.0 SDK (October 2004)\Include;$(BCB)\include;$(BCB)\include\vcl;R:\SDK\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL -Item18=R:\SDK\DirectX9.0_sum_2004\Include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL -Item19=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include;R:\SDK\OpenAL\include\AL -Item20=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include;R:\SDK\OpenAL\include -Item21=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include;R:\SDK\eax20\Include -Item22=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;P:\xrCore;R:\SDK\ogg\ogg\include;R:\SDK\ogg\vorbis\include -Item23=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;P:\xrCore -Item24=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item25=R:\SDK\DirectX8.1\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item26=R:\SDK\DirectX8.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include -Item27=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;R:\VS7.NET\Vc7\atlmfc\include;$(BCB)\include\mfc -Item28=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source;$(BCB)\include\mfc -Item29=R:\SDK\DirectX9.0\include;$(BCB)\include;$(BCB)\include\vcl;P:\MagicFM_Borland\Sdk\Include;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code\Source - -[HistoryLists\hlLibraryPath] -Count=28 -Item0=..\..\sdk\components\ElPack\Code;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(OUT_LIB_DIR) -Item1=..\..\sdk\components\ElPack\Code;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk -Item2=..\..\sdk\components\ElPack\Code;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\stalker_addon\libraries;E:\drive_x\stalker_addon\sources\sdk\components\ElPack\Code;x:\libraries -Item3=E:\drive_x\stalker_addon\sources\sdk\components\ElPack\Code;..\..\sdk\components\ElPack\Code;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\stalker_addon\libraries -Item4=..\..\sdk\components\ElPack\Code;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\stalker_addon\libraries -Item5=..\..\sdk\components\ElPack\Code;E:\SDK\components\ElPack\Code;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\libraries -Item6=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\libraries -Item7=$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\ -Item8=P:\xrCore;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;x:\ -Item9=P:\xrCore;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;$(BCB)\Lib\Psdk;x:\ -Item10=P:\xrCore;c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib;x:\ -Item11=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib;x:\ -Item12=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;$(BCB)\lib\psdk;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib -Item13=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib;$(BCB)\lib\psdk -Item14=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\Editors\lib\dx;..\Editors\lib -Item15=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;..\lib\dx;..\lib -Item16=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;lib;lib\dx -Item17=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk;lib -Item18=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk -Item19=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code;R:\Borland\CBuilder6\Lib\Psdk\ -Item20=c:\rad\borland\CBuilder5\Projects;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item21=..\LevelOptions\Engine;..\LevelOptions\Editor;..\LevelOptions;c:\rad\borland\CBuilder5\Projects;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item22=c:\rad\borland\CBuilder5\Projects\;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;R:\Borland\Components6\AlexMX;R:\Borland\Components6\ElPack\Code -Item23=c:\rad\borland\CBuilder5\Projects\;engine;editor;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;r:\borland\components\alexmx\;R:\Borland\Components\Eldos\Code\Source\;R:\Borland\Components\Eldos\Code\ -Item24=Editor;shared;edit;edit\Shader;Collide;Import\LWO;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;c:\rad\borland\components\renderwindow\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item25=shared;edit;edit\Shader;Collide;Import\LWO;$(BCB)\lib;$(BCB)\lib\obj;$(BCB)\Projects\Lib;c:\rad\borland\components\renderwindow\;c:\rad\borland\components\extbtn\;c:\rad\borland\components\multi\;C:\RAD\borland\Components\RX\Units\;C:\RAD\borland\Components\ElTree\Code\Source\ -Item26=edit;$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib -Item27=$(BCB)\Projects\Lib;$(BCB)\lib\obj;$(BCB)\lib - -[HistoryLists\hlDebugSourcePath] -Count=2 -Item0=$(BCB)\source\vcl -Item1=$(BCB)\source\vcl;P:\Editors\xrEProps\ - -[HistoryLists\hlConditionals] -Count=3 -Item0=_EDITOR;_XRSOUNDB;XRSOUND_EXPORTS;_DEBUG -Item1=_EDITOR;_XRSOUNDB;XRSOUND_EXPORTS -Item2=_XRSOUNDB;XRSOUND_EXPORTS;_DEBUG - -[HistoryLists\hlIntOutputDir] -Count=8 -Item0=..\..\intermediate\editors\xrSoundB -Item1=x:\intermediate_ed\sound -Item2=$(OUTPUT_INTERMEDIATE_DIR)\sound -Item3=$(OUTPUT_INTERMEDIATE_DIR) -Item4=$(OUTPUT_INTERMEDIATE_DIR)\ -Item5=Intermediate -Item6=XRLC_Intermediate -Item7=xrLC_Options - -[HistoryLists\hlFinalOutputDir] -Count=11 -Item0=..\..\bin\editors\ -Item1=$(OUTPUT_BINARIES_DIR)\ -Item2=x:\stalker_addon\binaries\ -Item3=x:\binaries\ -Item4=x:\binaries -Item5=x:\ -Item6=x:\build\ -Item7=x:\xrCoreB.dll\ -Item8=x:\xrCoreB.dll -Item9=!run\ -Item10=!run - -[HistoryLists\hIBPIOutputDir] -Count=6 -Item0=..\..\lib\editors\ -Item1=x:\stalker_addon\libraries -Item2=$(OUT_LIB_DIR) -Item3=$(OUTPUT_LIBRARIES_DIR) -Item4=$(OUTPUT_LIBRARIES_DIR)\ -Item5=x:\libraries - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -[Parameters] -RunParams=-wf x:\stalker_addon\resources -Launcher= -UseLauncher=0 -DebugCWD= -HostApplication=x:\stalker_addon\binaries\ShaderEditor.exe -RemoteHost= -RemotePath= -RemoteLauncher= -RemoteCWD= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[CORBA] -AddServerUnit=1 -AddClientUnit=1 -PrecompiledHeaders=1 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - -[Linker] -LibPrefix= -LibSuffix= -LibVersion= - - \ No newline at end of file