P2PFile

The *.p2p file extension is a base64 encoded file that when decoded contains an XML layout as below this means other client's could if they like add extra data to the XML and it will work in client that dont support this exta information,

 

<?xml version="1.0"?>
<p2pfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <FileList>
    <Files>
      <File>
        <Name>test3.txt</Name>
        <BlockSize>1</BlockSize>
        <Blocks>1</Blocks>
        <hash>gj859hj9i8hyg58346gfbhrej45784twey8</hash>
      </File>
    </Files>
    <Directory>
      <Dir>
        <Name>test folder</Name>
        <Files>
          <File>
            <Name>test.txt</Name>
            <BlockSize>1</BlockSize>
            <Blocks>1</Blocks>
            <hash>gj859hj9i8hyg58346gfbhrej45784twey8</hash>
          </File>
          <File>
            <Name>test2.txt</Name>
            <BlockSize>1</BlockSize>
            <Blocks>1</Blocks>
            <hash>gj859hj9i8hyg58346gfbhrej45784twey8</hash>
          </File>
        </Files>
      </Dir>
    </Directory>
  </FileList>
  <StatusServers>
    <Servers>
      <Server>
        <Name>Local Server</Name>
        <Address>http://localhost:8088/list.php</Address>
      </Server>
    </Servers>
  </StatusServers>
  <Hash>OUJCMDcyRUVCRkU3RURCQUM2Mzg0RTlGNzdENjk2N0I0QkI3N0Q3NQ==</Hash>
</p2pfile>

 

The FileList contains the directorys and file's that are to be downloaded by the client and support for Directory's inside directorys is a must, for each file we hold the filename the blockSize and the blockCount the Blocksize is the size of the base64 blocks the client will download supporting more than one download at once this should be calulated by the size of the file and then the block count should then be the number of blocks the file is to be divided into this will then inform the client of the size of each file.

Next is the StatusServers these servers are the allso known as the ClientList server they will repond with an XML Object of clients and some servers want to provide feedback as to seeders and leaches it can though the meta data however our version 1 client wont support informing servers of download progress but a third party client could, one of the things you see here is a Server this is a standard server that dose not require any Authentication on the client should it look like below then authentication is required the client will have to handle this

 

<AuthServers>
    <AuthServer>
        <Name>Test Server</Name>
        <Address>http://localhost:8088/login.php</Address>
        <Method>GET</Method>
        <UsernameKey>username</UsernameKey>
        <PasswordKey>password</PasswordKey>
    <AuthServer>
</AuthServers>

When an auth server is used the last three options are not required as the values above are assumed if not provided.

 

The Hash is built up by getting the SHA1 for all file's appending them to one string and then running that string though SHA1 again it is then base64 encoded this then allows a client once finished make sure that the files end result files are downloaded correctly and are the original file's provided from host

Another thing not shown above but is listed on the homepage as some thing we need to build in is the Host only p2p so no 3rd party servers are used.

<Host>
    <IP>192.168.0.1</IP>
    <Port>41896</Port>
    <Client>P2PShare Client</Client>
</Host>

this contains the basic information required to connect to a host only p2p files client

Last edited Mar 23, 2012 at 10:01 PM by barkermn01, version 5

Comments

No comments yet.