1. About
    1. Welcome
    2. Project News
    3. Architecture
    4. Community Wiki
  2. Get Involved
    1. Get the Code
    2. Mailing Lists
    3. Contributing
  3. Virtual Device
    1. Building
    2. Running
  4. Server Components
    1. Install
    2. Configure
  5. Client — Android
    1. Build & Install
    2. Using
  6. Client — iOS
    1. Build & Install
  7. Wire Protocol
    1. Protocol Description
    2. Extend and Build

Modifying the Protocol

Because the protocol is specified and generated using the Protocol Buffers format, it is easy to modify and extend. New message types can be easily introduced by adding new optional fields without breaking compatibility with unmodified versions of the client, server, or VM. Optional fields not recognized by a component running an older protocol version will be simply ignored as if they never existed.

For best results, avoid altering any existing fields, especially required ones, as this will likely result in breaking existing deployed components.

First check out the svmp-protocol-def project

git clone https://github.com/SVMP/svmp-protocol-def

You will also need the Protocol Buffers v2.5.0 tools installed, specifically the protoc compiler. Version 2.6 has not yet been tested for compatibility.

SVMP Server

The SVMP Server utilizes a Javascript library that interprets the protocol specification file at run time so no code generation is required in this case. Simply copy the updated svmp.proto file into the svmp-server/protocol/ directory, overwriting the copy already there. Then restart the server process.

Android Client

Both the Android client application and the SVMP daemon contained within the virtual device image itself utilize a Java code library generated from the protocol buffer specification file. This Java code is contained in the svmp-protocol-def and must be regenerated for any protocol changes to take effect.

To re-generate the Java code in the svmp-protocol-def package in the Android client:

cd svmp-android-client/svmp-protocol-def
protoc --java_out=src/ svmp.proto

Then rebuild the client as normal.

Virtual Machine Image

Like the Android client, the virtual device image uses the Java code library generated from the protocol definition file.

To re-generate it in the VM code tree:

cd external/svmp/svmp-protocol-def
protoc --java_out=src/ svmp.proto

The run the VM build script as normal.

iOS Client

The iOS client requires generating Objective-C code from the protocol definition file.

An additional plugin is required to generate Objective-C code from the protocol definition file. Download, build, and install the plugin with the following commands:

git clone https://github.com/Packetdancer/protobuf-objc.git
cd protobuf-objc
./autogen.sh
./configure CXXFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
make
make install

Next use protoc and the plugin to generate the Obj-C code:

cd svmp-iOS-client
protoc --plugin=/usr/local/bin/protoc-gen-objc \
       --proto_path=../svmp-protocol-def/ \
       --objc_out=./ios-example/AppRTCDemo ../svmp-protocol-def/svmp.proto

Following this command there should be an Svmp.pb.h and Svmp.pb.m file in the svmp-iOS-client/ios-example/AppRTCDemo directory.

Unfortunately, there is an error in the objective c code generated by the plugin. You must comment out a for loop within the storeInDictionary method within the Svmp.pb.m file.


  - (void) storeInDictionary:(NSMutableDictionary *)dictionary {

    ...

    // V-- Comment this out otherwise you will get an error stating 'use of undeclared identifier 'output''
    //for (NSString* element in self.categoriesArray) {
    //  [output appendFormat:@"%@%@: %@\n", indent, @"categories", element];
    //}
    [self.unknownFields storeInDictionary:dictionary];
  }