mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
### This file configures various client-side behaviors.
### ### The commented-out examples below are intended to demonstrate ### how to use this file. ### Section for authentication and authorization customizations. [auth] ### Set store-passwords to 'no' to avoid storing passwords in the ### auth/ area of your config directory. It defaults to 'yes'. ### Note that this option only prevents saving of *new* passwords; ### it doesn't invalidate existing passwords. (To do that, remove ### the cache files by hand as described in the Subversion book.) # store-passwords = no ### Set store-auth-creds to 'no' to avoid storing any subversion ### credentials in the auth/ area of your config directory. ### It defaults to 'yes'. Note that this option only prevents ### saving of *new* credentials; it doesn't invalidate existing ### caches. (To do that, remove the cache files by hand.) # store-auth-creds = no ### Section for configuring external helper applications. [helpers] ### Set editor to the command used to invoke your text editor. ### This will override the environment variables that Subversion ### examines by default to find this information ($EDITOR, ### et al). # editor-cmd = editor (vi, emacs, notepad, etc.) ### Set diff-cmd to the absolute path of your 'diff' program. ### This will override the compile-time default, which is to use ### Subversion's internal diff implementation. # diff-cmd = diff_program (diff, gdiff, etc.) ### Set diff3-cmd to the absolute path of your 'diff3' program. ### This will override the compile-time default, which is to use ### Subversion's internal diff3 implementation. # diff3-cmd = diff3_program (diff3, gdiff3, etc.) ### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3' ### program accepts the '--diff-program' option. # diff3-has-program-arg = [true | false] ### Section for configuring tunnel agents. [tunnels] ### Configure svn protocol tunnel schemes here. By default, only ### the 'ssh' scheme is defined. You can define other schemes to ### be used with 'svn+scheme://hostname/path' URLs. A scheme ### definition is simply a command, optionally prefixed by an ### environment variable name which can override the command if it ### is defined. The command (or environment variable) may contain ### arguments, using standard shell quoting for arguments with ### spaces. The command will be invoked as: ### <command> <hostname> svnserve -t ### (If the URL includes a username, then the hostname will be ### passed to the tunnel agent as <user>@<hostname>.) If the ### built-in ssh scheme were not predefined, it could be defined ### as: # ssh = $SVN_SSH ssh ### If you wanted to define a new 'rsh' scheme, to be used with ### 'svn+rsh:' URLs, you could do so as follows: # rsh = rsh ### Or, if you wanted to specify a full path and arguments: # rsh = /path/to/rsh -l myusername ### On Windows, if you are specifying a full path to a command, ### use a forward slash (/) or a paired backslash (\\) as the ### path separator. A single backslash will be treated as an ### escape for the following character. ### Section for configuring miscelleneous Subversion options. [miscellany] ### Set global-ignores to a set of whitespace-delimited globs ### which Subversion will ignore in its 'status' output, and ### while importing or adding files and directories. # global-ignores = *.o *.lo *.la #*# .*.rej *.rej .*~ *~ .#* .DS_Store ### Set log-encoding to the default encoding for log messages # log-encoding = latin1 ### Set use-commit-times to make checkout/update/switch/revert ### put last-committed timestamps on every file touched. # use-commit-times = yes ### Set no-unlock to prevent 'svn commit' from automatically ### releasing locks on files. # no-unlock = yes ### Set enable-auto-props to 'yes' to enable automatic properties ### for 'svn add' and 'svn import', it defaults to 'no'. ### Automatic properties are defined in the section 'auto-props'. # enable-auto-props = yes ### Section for configuring automatic properties. [auto-props] ### The format of the entries is: ### file-name-pattern = propname[=value][;propname[=value]...] ### The file-name-pattern can contain wildcards (such as '*' and ### '?'). All entries which match will be applied to the file. ### Note that auto-props functionality must be enabled, which ### is typically done by setting the 'enable-auto-props' option. # *.c = svn:eol-style=native # *.cpp = svn:eol-style=native # *.h = svn:eol-style=native # *.dsp = svn:eol-style=CRLF # *.dsw = svn:eol-style=CRLF # *.sh = svn:eol-style=native;svn:executable # *.txt = svn:eol-style=native # *.png = svn:mime-type=image/png # *.jpg = svn:mime-type=image/jpeg # Makefile = svn:eol-style=native git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@250 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a89e5a4784
commit
23d1894b2b
@ -1,36 +1,12 @@
|
||||
|
||||
/*
|
||||
* libretroshare/src/serialiser: rstlvtypes.cc
|
||||
*
|
||||
* RetroShare Serialiser.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie, Chris Parker
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library 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.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rstlvbase.h"
|
||||
#include "rstlvtypes.h"
|
||||
#include "rsbaseserial.h"
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
#include "serialiser/rsbaseserial.h"
|
||||
|
||||
std::ostream &RsTlvItem::printBase(std::ostream &out, std::string clsName, uint16_t indent)
|
||||
{
|
||||
@ -59,7 +35,7 @@ std::ostream &printIndent(std::ostream &out, uint16_t indent)
|
||||
|
||||
|
||||
|
||||
/*********************************** RsTlvFileBinaryData **********************************/
|
||||
/*!********************************** RsTlvFileBinaryData **********************************/
|
||||
|
||||
|
||||
RsTlvBinaryData::RsTlvBinaryData(uint16_t t)
|
||||
@ -68,6 +44,7 @@ RsTlvBinaryData::RsTlvBinaryData(uint16_t t)
|
||||
return;
|
||||
}
|
||||
|
||||
/// used to allocate memory andinitialize binary data member
|
||||
bool RsTlvBinaryData::setBinData(void *data, uint16_t size)
|
||||
{
|
||||
/* ready to load */
|
||||
@ -202,7 +179,7 @@ void RsTlvPeerIdSet::TlvClear()
|
||||
uint16_t RsTlvPeerIdSet::TlvSize()
|
||||
{
|
||||
|
||||
uint32_t s = 8; /* header + 4 for size */
|
||||
uint32_t s = 4; /* header */
|
||||
|
||||
/* determine the total size of ids strings in list */
|
||||
|
||||
@ -210,13 +187,14 @@ uint16_t RsTlvPeerIdSet::TlvSize()
|
||||
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
if ((*it).length() > 0)
|
||||
if (it->length() > 0)
|
||||
s += GetTlvStringSize(*it);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
bool RsTlvPeerIdSet::SetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
/* must check sizes */
|
||||
@ -238,7 +216,7 @@ bool RsTlvPeerIdSet::SetTlv(void *data, uint32_t size, uint32_t *offset) /*
|
||||
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
if ((*it).length() > 0)
|
||||
if (it->length() > 0)
|
||||
ok &= SetTlvString(data, tlvend, offset, TLV_TYPE_STR_PEERID, *it);
|
||||
}
|
||||
|
||||
@ -246,17 +224,22 @@ bool RsTlvPeerIdSet::SetTlv(void *data, uint32_t size, uint32_t *offset) /*
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool RsTlvPeerIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
if (size < *offset + 4)
|
||||
return false;
|
||||
|
||||
uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
uint16_t tlvsize = GetTlvSize( &(((uint8_t *) data)[*offset]) );
|
||||
uint32_t tlvend = *offset + tlvsize;
|
||||
|
||||
|
||||
|
||||
if (size < tlvend) /* check size */
|
||||
return false; /* not enough space */
|
||||
|
||||
if (tlvtype != TLV_TYPE_FILEDATA) /* check type */
|
||||
std::cout << "yeah!!!" << std::endl;
|
||||
if (tlvtype != TLV_TYPE_PEERSET) /* check type */
|
||||
return false;
|
||||
|
||||
bool ok = true;
|
||||
@ -267,7 +250,7 @@ bool RsTlvPeerIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /*
|
||||
/* skip the header */
|
||||
(*offset) += 4;
|
||||
|
||||
int i = 0; /* temp variable to iterate through 'listed' data */
|
||||
|
||||
|
||||
/* while there is TLV */
|
||||
while((*offset) + 2 < tlvend)
|
||||
@ -275,15 +258,15 @@ bool RsTlvPeerIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /*
|
||||
/* get the next type */
|
||||
uint16_t tlvsubtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
|
||||
if (tlvsubtype = TLV_TYPE_STR_PEERID)
|
||||
if (tlvsubtype == TLV_TYPE_STR_PEERID)
|
||||
{
|
||||
i++;
|
||||
|
||||
ids.resize(i);
|
||||
|
||||
ok &= GetTlvString(data, tlvend, offset, TLV_TYPE_STR_PEERID, *ids.rbegin());
|
||||
|
||||
std::string newIds;
|
||||
ok &= GetTlvString(data, tlvend, offset, TLV_TYPE_STR_PEERID, newIds);
|
||||
if(ok)
|
||||
{
|
||||
ids.push_back(newIds);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
@ -292,6 +275,26 @@ bool RsTlvPeerIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /*
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/// print to screen RsTlvPeerIdSet contents
|
||||
std::ostream &RsTlvPeerIdSet::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printBase(out, "RsTlvPeerIdSet", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
printIndent(out, int_Indent);
|
||||
out << "id:" << *it;
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
printEnd(out, "RsTlvPeerIdSet", indent);
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -305,16 +308,14 @@ void RsTlvServiceIdSet::TlvClear()
|
||||
|
||||
uint16_t RsTlvServiceIdSet::TlvSize()
|
||||
{
|
||||
uint32_t s = 8; /* header + 4 for size */
|
||||
uint32_t s = 4; /* header */
|
||||
|
||||
/* determine the total size of ids strings in list */
|
||||
|
||||
std::list<uint8_t>::iterator it;
|
||||
|
||||
std::list<uint32_t>::iterator it;
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
if (*it > 0)
|
||||
s += GetTlvUInt8Size();
|
||||
s += GetTlvUInt32Size();
|
||||
}
|
||||
|
||||
return s;
|
||||
@ -332,17 +333,15 @@ bool RsTlvServiceIdSet::SetTlv(void *data, uint32_t size, uint32_t *offset)
|
||||
bool ok = true;
|
||||
|
||||
|
||||
/* start at data[offset] */
|
||||
/* start at data[offset] */
|
||||
ok &= SetTlvBase(data, tlvend, offset, TLV_TYPE_SERVICESET , tlvsize);
|
||||
|
||||
/* determine the total size of ids strings in list */
|
||||
|
||||
std::list<uint8_t>::iterator it;
|
||||
|
||||
std::list<uint32_t>::iterator it;
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
/* if (*it > 0)
|
||||
ok &= SetTlvUInt8(data, tlvend, offset, TLV_TYPE_UINT8_SERID, *it); (function needs to be implemented in rstlvbase.cc)*/
|
||||
if (*it > 0)
|
||||
ok &= SetTlvUInt32(data, tlvend, offset, TLV_TYPE_UINT32_SERID, *it);
|
||||
}
|
||||
|
||||
return ok;
|
||||
@ -351,6 +350,8 @@ bool RsTlvServiceIdSet::SetTlv(void *data, uint32_t size, uint32_t *offset)
|
||||
|
||||
bool RsTlvServiceIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
if (size < *offset + 4)
|
||||
return false;
|
||||
|
||||
uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
uint16_t tlvsize = GetTlvSize( &(((uint8_t *) data)[*offset]) );
|
||||
@ -370,23 +371,21 @@ bool RsTlvServiceIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset)
|
||||
/* skip the header */
|
||||
(*offset) += 4;
|
||||
|
||||
int i = 0; /* temp variable to iterate through 'listed' data */
|
||||
|
||||
/* while there is TLV */
|
||||
while((*offset) + 2 < tlvend)
|
||||
{
|
||||
/* get the next type */
|
||||
uint16_t tlvsubtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
|
||||
if (tlvsubtype = TLV_TYPE_UINT8_SERID)
|
||||
if (tlvsubtype == TLV_TYPE_UINT32_SERID)
|
||||
{
|
||||
i++;
|
||||
|
||||
ids.resize(i);
|
||||
|
||||
// ok &= GetTlvUint8(data, size, offset); (function needs to be implemented in rstlvbase.cc)
|
||||
|
||||
uint32_t newIds;
|
||||
ok &= GetTlvUInt32(data, tlvend, offset, TLV_TYPE_UINT32_SERID, &newIds);
|
||||
if(ok)
|
||||
{
|
||||
ids.push_back(newIds);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
@ -395,6 +394,26 @@ bool RsTlvServiceIdSet::GetTlv(void *data, uint32_t size, uint32_t *offset)
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
/// print to screen RsTlvServiceSet contents
|
||||
std::ostream &RsTlvServiceIdSet::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printBase(out, "RsTlvServiceIdSet", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
|
||||
std::list<uint32_t>::iterator it;
|
||||
for(it = ids.begin(); it != ids.end() ; ++it)
|
||||
{
|
||||
printIndent(out, int_Indent);
|
||||
out << "id:" << *it;
|
||||
out << std::endl;
|
||||
}
|
||||
|
||||
printEnd(out, "RsTlvServiceIdSet", indent);
|
||||
return out;
|
||||
|
||||
}
|
||||
|
||||
/************************************* RsTlvKeyValue ************************************/
|
||||
@ -407,11 +426,7 @@ void RsTlvKeyValue::TlvClear()
|
||||
|
||||
uint16_t RsTlvKeyValue::TlvSize()
|
||||
{
|
||||
uint32_t s = 8; /* header + 4 for size */
|
||||
|
||||
/* first determine the total size of RstlvFileItems in list */
|
||||
|
||||
std::list<RsTlvFileItem>::iterator it;
|
||||
uint32_t s = 4; /* header + 4 for size */
|
||||
|
||||
/* now add comment and title length of this tlv object */
|
||||
|
||||
@ -452,6 +467,9 @@ return ok;
|
||||
|
||||
bool RsTlvKeyValue::GetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
if (size < *offset + 4)
|
||||
return false;
|
||||
|
||||
uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
uint16_t tlvsize = GetTlvSize( &(((uint8_t *) data)[*offset]) );
|
||||
uint32_t tlvend = *offset + tlvsize;
|
||||
@ -499,7 +517,21 @@ bool RsTlvKeyValue::GetTlv(void *data, uint32_t size, uint32_t *offset) /* seri
|
||||
|
||||
}
|
||||
|
||||
std::ostream &RsTlvKeyValue::print(std::ostream &out, uint16_t indent)
|
||||
{
|
||||
printBase(out, "RsTlvKeyValue", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
|
||||
printIndent(out, int_Indent);
|
||||
out << "Key:" << key;
|
||||
printIndent(out, int_Indent);
|
||||
out << "Value:" << value;
|
||||
out << std::endl;
|
||||
|
||||
|
||||
printEnd(out, "RsTlvKeyValue", indent);
|
||||
return out;
|
||||
}
|
||||
|
||||
/************************************* RsTlvKeyValueSet ************************************/
|
||||
|
||||
@ -511,7 +543,7 @@ void RsTlvKeyValueSet::TlvClear()
|
||||
uint16_t RsTlvKeyValueSet::TlvSize()
|
||||
{
|
||||
|
||||
uint32_t s = 8; /* header + 4 for size */
|
||||
uint32_t s = 4; /* header + 4 for size */
|
||||
|
||||
std::list<RsTlvKeyValue>::iterator it;
|
||||
|
||||
@ -519,7 +551,7 @@ uint16_t RsTlvKeyValueSet::TlvSize()
|
||||
{
|
||||
|
||||
for(it = pairs.begin(); it != pairs.end() ; ++it)
|
||||
s += (*it).TlvSize();
|
||||
s += it->TlvSize();
|
||||
|
||||
}
|
||||
|
||||
@ -546,8 +578,7 @@ bool RsTlvKeyValueSet::SetTlv(void *data, uint32_t size, uint32_t *offset) /* s
|
||||
std::list<RsTlvKeyValue>::iterator it;
|
||||
|
||||
for(it = pairs.begin(); it != pairs.end() ; ++it)
|
||||
ok &= (*it).SetTlv(data, size, offset);
|
||||
|
||||
ok &= it->SetTlv(data, size, offset);
|
||||
}
|
||||
|
||||
|
||||
@ -555,8 +586,12 @@ return ok;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool RsTlvKeyValueSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /* serialise */
|
||||
{
|
||||
if (size < *offset + 4)
|
||||
return false;
|
||||
|
||||
uint16_t tlvtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
uint16_t tlvsize = GetTlvSize( &(((uint8_t *) data)[*offset]) );
|
||||
uint32_t tlvend = *offset + tlvsize;
|
||||
@ -575,23 +610,17 @@ bool RsTlvKeyValueSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /* s
|
||||
/* skip the header */
|
||||
(*offset) += 4;
|
||||
|
||||
int i = 0; /* temporary variable to go through listed data*/
|
||||
|
||||
/* while there is TLV */
|
||||
while((*offset) + 2 < tlvend)
|
||||
{
|
||||
/* get the next type */
|
||||
uint16_t tlvsubtype = GetTlvType( &(((uint8_t *) data)[*offset]) );
|
||||
|
||||
if (tlvsubtype = TLV_TYPE_KEYVALUE)
|
||||
RsTlvKeyValue kv;
|
||||
ok &= kv.GetTlv(data, size, offset);
|
||||
if (ok)
|
||||
{
|
||||
i++;
|
||||
|
||||
pairs.resize(i);
|
||||
|
||||
ok &= (*pairs.rbegin()).GetTlv(data, size, offset);
|
||||
|
||||
|
||||
pairs.push_back(kv);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
@ -600,16 +629,21 @@ bool RsTlvKeyValueSet::GetTlv(void *data, uint32_t size, uint32_t *offset) /* s
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::ostream &RsTlvPeerIdSet::print(std::ostream &out, uint16_t indent)
|
||||
{ return out; }
|
||||
std::ostream &RsTlvServiceIdSet::print(std::ostream &out, uint16_t indent)
|
||||
{ return out; }
|
||||
std::ostream &RsTlvKeyValue::print(std::ostream &out, uint16_t indent)
|
||||
{ return out; }
|
||||
/// prints out contents of RsTlvKeyValueSet
|
||||
std::ostream &RsTlvKeyValueSet::print(std::ostream &out, uint16_t indent)
|
||||
{ return out; }
|
||||
{
|
||||
printBase(out, "RsTlvKeyValue", indent);
|
||||
uint16_t int_Indent = indent + 2;
|
||||
|
||||
std::list<RsTlvKeyValue>::iterator it;
|
||||
|
||||
for(it = pairs.begin(); it != pairs.end() ; ++it)
|
||||
it->print(out, indent);
|
||||
|
||||
printEnd(out, "RsTlvKeyValue", indent);
|
||||
return out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user