All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.sdnwiselab.sdnwise.packet.ConfigFunctionPacket Maven / Gradle / Ivy

Go to download

The stateful Software Defined Networking solution for WIreless SEnsor Networks.

There is a newer version: 3.0.10
Show newest version
/* 
 * Copyright (C) 2015 SDN-WISE
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package com.github.sdnwiselab.sdnwise.packet;

import com.github.sdnwiselab.sdnwise.util.NodeAddress;

/**
 *
 * @author Seby
 */
public class ConfigFunctionPacket extends ConfigPacket {

    public ConfigFunctionPacket(NetworkPacket data) {
        super(data);
    }

    public ConfigFunctionPacket(int netId, NodeAddress src, NodeAddress dst) {
        super(netId, src, dst);
    }

    public final static byte SDN_WISE_CNF_ADD_FUNCTION = 16,
            SDN_WISE_CNF_REMOVE_FUNCTION = 17;

    public final ConfigPacket setAddFunctionAtPositionValue(int index,
            byte[] payload) {
        this.setWrite()
                .setConfigId(SDN_WISE_CNF_ADD_FUNCTION)
                .setValue(index)
                .setPayload(payload, (byte) 0, (byte) 3, (byte) payload.length);
        return this;
    }

    public final ConfigPacket setRemoveFunctionAtPositionValue(int index) {
        this.setWrite()
                .setConfigId(SDN_WISE_CNF_REMOVE_FUNCTION)
                .setValue(index);
        return this;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy