'''
Created on Nov 2, 2011
Modified on Mar 6, 2012
@version: 0.12
@author: Dilum Bandara
@email: dilumb@engr.colostate.edu
@license: Apache License v2.0

   Copyright 2012 H. M. N. Dilum Bandara and Anura P. Jayasumana, Colorado State
   University

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
'''

class CCNData(object):
    '''
    CCN Data message class
    Extended to support subscription based queries
    '''

    def __init__(self, name, realName, dataSize, data, genTime, hops, \
                 dataSource, loc):
        '''
        Constructor
        @param name: Content name
        @param realName: Actual content name 
        @param dataSize: Size of data
        @param data: Data
        @param genTime: Time content was generated
        @param hops: Number of hops interest message traveled (for stat only)
        @param dataSource: Data source
        @param loc: Location of data source
        '''
        self.msgType = 'CCNData'
        self.name = name
        self.realName = realName
        self.dataSize = dataSize
        self.data = data
        self.genTime = genTime
        self.hops = hops #for state
        self.source = dataSource
        self.sourceLoc = loc
        self.size = float((len(realName) + dataSize + 8) * 8) #in bits (4+4+2*4)