/** * Computes the length in bytes of the BER encoded variable bindings without * including the length of BER sequence length. * * @param variableBindings a list of variable bindings. * @return the length in bytes of the BER encoded VB list. */ public static int getBERLength(List<? extends VariableBinding> variableBindings) { int length = 0; // length for all vbs for (VariableBinding variableBinding : variableBindings) { length += variableBinding.getBERLength(); } return length; }
/** * Computes the length in bytes of the BER encoded variable bindings without * including the length of BER sequence length. * @param variableBindings * a list of variable bindings. * @return * the length in bytes of the BER encoded VB list. */ public static int getBERLength(List<? extends VariableBinding> variableBindings) { int length = 0; // length for all vbs for (VariableBinding variableBinding : variableBindings) { length += variableBinding.getBERLength(); } return length; }
public static void encodeVariableBindings(OutputStream outputStream, List<VariableBinding> variableBindings) throws IOException { int vbLength = 0; for (VariableBinding vb : variableBindings) { vbLength += vb.getBERLength(); } BER.encodeHeader(outputStream, BER.SEQUENCE, vbLength); for (VariableBinding vb : variableBindings) { vb.encodeBER(outputStream); } }
public void encodeBER(OutputStream outputStream) throws IOException { BER.encodeHeader(outputStream, type, getBERPayloadLengthPDU()); requestID.encodeBER(outputStream); errorStatus.encodeBER(outputStream); errorIndex.encodeBER(outputStream); int vbLength = 0; for (int i=0; i<variableBindings.size(); i++) { vbLength += ((VariableBinding)variableBindings.get(i)).getBERLength(); } BER.encodeHeader(outputStream, BER.SEQUENCE, vbLength); for (int i=0; i<variableBindings.size(); i++) { ((VariableBinding)variableBindings.get(i)).encodeBER(outputStream); } }
protected int getBERPayloadLengthPDU() { int length = 0; // length for all vbs for (int i = 0; i < variableBindings.size(); i++) { length += ((VariableBinding)variableBindings.get(i)).getBERLength(); } length += BER.getBERLengthOfLength(length) + 1; // req id, error status, error index Integer32 i32 = new Integer32(requestID.getValue()); length += i32.getBERLength(); i32 = errorStatus; length += i32.getBERLength(); i32 = errorIndex; length += i32.getBERLength(); i32 = null; return length; }
protected int getBERPayloadLengthPDU() { if (getType() != PDU.V1TRAP) { return super.getBERPayloadLengthPDU(); } else { int length = 0; // length for all vbs for (int i = 0; i < variableBindings.size(); i++) { length += ((VariableBinding)variableBindings.get(i)).getBERLength(); } length += BER.getBERLengthOfLength(length) + 1; length += agentAddress.getBERLength(); length += enterprise.getBERLength(); length += genericTrap.getBERLength(); length += specificTrap.getBERLength(); length += timestamp.getBERLength(); return length; } }
public void encodeBER(OutputStream outputStream) throws IOException { BER.encodeHeader(outputStream, type, getBERPayloadLengthPDU()); requestID.encodeBER(outputStream); errorStatus.encodeBER(outputStream); errorIndex.encodeBER(outputStream); int vbLength = 0; for (VariableBinding vb : variableBindings) { vbLength += vb.getBERLength(); } BER.encodeHeader(outputStream, BER.SEQUENCE, vbLength); for (VariableBinding vb : variableBindings) { vb.encodeBER(outputStream); } }
vbLength += ((VariableBinding)variableBindings.get(i)).getBERLength();
protected int getBERPayloadLengthPDU() { if (getType() != PDU.V1TRAP) { return super.getBERPayloadLengthPDU(); } else { int length = 0; // length for all vbs for (VariableBinding variableBinding : variableBindings) { length += variableBinding.getBERLength(); } length += BER.getBERLengthOfLength(length) + 1; length += agentAddress.getBERLength(); length += enterprise.getBERLength(); length += genericTrap.getBERLength(); length += specificTrap.getBERLength(); length += timestamp.getBERLength(); return length; } }
protected int getBERPayloadLengthPDU() { if (getType() != PDU.V1TRAP) { return super.getBERPayloadLengthPDU(); } else { int length = 0; // length for all vbs for (VariableBinding variableBinding : variableBindings) { length += variableBinding.getBERLength(); } length += BER.getBERLengthOfLength(length) + 1; length += agentAddress.getBERLength(); length += enterprise.getBERLength(); length += genericTrap.getBERLength(); length += specificTrap.getBERLength(); length += timestamp.getBERLength(); return length; } }
vbLength += variableBinding.getBERLength();
vbLength += variableBinding.getBERLength();