close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Changes between Version 2 and Version 3 of Proto/cModules/f0Computing/b0MFclick


Ignore:
Timestamp:
Nov 29, 2014, 2:08:37 AM (9 years ago)
Author:
seskar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Proto/cModules/f0Computing/b0MFclick

    v2 v3  
     1= How to host the computing layer in the MF click router =
     2
     3This page describes how to integrate the computing services in the click MF router (based on the May 23, 2014 version):
     4To trigger a transparent services, there are three steps:
     5 * intercept a complete chunk from the router (from mf_segmentor)
     6 * update the chunk payload, note that the chunk size might be changed (e.g., compression services)
     7 * ship back the processed chunk for further delivery
     8
     9When need to change the mf_segmentor.cc accordingly:
     10
     11add a ''computing'' parameter, to specify the service number (0 - doing nothing, 1 - a simple encryption service)
     12{{{
     13int MF_Segmentor::configure(Vector<String> &conf, ErrorHandler *errh){
     14  if(cp_va_kparse(conf, this, errh,
     15                  "ROUTER_STATS", cpkP+cpkM, cpElement, &_routerStats,
     16                  "CHUNK_MANAGER", cpkP+cpkM, cpElement, &_chunkManager,
     17                  "WINDOW_SIZE", cpkP, cpUnsigned, &_window_size,
     18                  "COMPUTING", cpkP, cpUnsigned, &_computing_service, // 0 - no service, 1 - simple encryption
     19                  cpEnd) < 0) {
     20    return -1;
     21  }
     22  return 0;
     23}
     24}}}
     25also
     26
     27we need to put
     28{{{
     29#include "Core_Computing_Func.hh"
     30}}}
     31in the beginning
     32also
     33we need to add
     34{{{
     35while ((!isSendingPoolFull()) && (_readyCache->size() > 0)) {
     36      uint32_t hop_ID = findMinReadyHopID();
     37      logger.log(MF_DEBUG,
     38                 "seg: starting trxfr hop ID: %d; ready chks: %d",
     39                 hop_ID, _readyCache->size());
     40
     41      Chunk *chunk = _readyCache->find(hop_ID).value();
     42      Computing_Core_Func(chunk);
     43
     44      //find ready chunks, erase from readyQ
     45      ReadyChunkMap::iterator it = _readyCache->find(hop_ID);
     46      Chunk *readyChunk = it.value();
     47      _readyCache->erase(it);
     48}}}
     49accordingly, we need some updates in the mf_segmentor.hh
     50{{{
     51 private:
     52   void Computing_Core_Func(Chunk *chunk);
     53   void Computing_parse_chunk_info(Chunk *chunk);
     54   void Computing_chunk_processing(uint32_t _service_type, Chunk *chunk, uint32_t ori_chunk_size);
     55   void Computing_updated_chunk(Chunk *chunk, uint32_t new_chunk_size, uint32_t hop_id_log, uint32_t _pkt_size);
     56   uint32_t _computing_service;
     57}}}
     58 * '''Computing_Core_Function''' is the main interface for the router to trigger the computing service
     59 * '''Computing_parse_chunk_info''' is used for parsing the basic information of a received chunk
     60 * '''Computing_chunk_processing''' is the main part of the computing function, you can add as many services as you wish here
     61 * '''Computing_updated_chunk''' is used for clearing the old chunk payload, and adding the new chunk payload