Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
dbird committed Nov 29, 2011
1 parent e43857f commit 0181e76
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1761,6 +1761,7 @@ private JComboBox getSimulationTypeComboBox() {
"Auth & Acct (Start Only)",
"Acct Only (Start, Interim, Stop)",
"Acct Only (Start Only)",
"Acct Only (Interim Only)",
"Acct Only (Stop Only)",
"Acct On/Off",
"Disconnect Request",
Expand Down Expand Up @@ -2485,10 +2486,11 @@ public void run()
case 3: sendPackets[1] = true; break;
case 4: sendPackets = new boolean[]{ false, true, true, true }; break;
case 5: sendPackets = new boolean[]{ false, true, false, false }; break;
case 6: sendPackets = new boolean[]{ false, false, false, true }; break;
case 7: sendPackets = new boolean[]{ false, true, false, true }; sendOnOff = true; break;
case 8: sendDisconnectRequest = true; break;
case 9: sendCoARequest = true; break;
case 6: sendPackets = new boolean[]{ false, false, true, false }; break;
case 7: sendPackets = new boolean[]{ false, false, false, true }; break;
case 8: sendPackets = new boolean[]{ false, true, false, true }; sendOnOff = true; break;
case 9: sendDisconnectRequest = true; break;
case 10: sendCoARequest = true; break;
//case 3: sendPackets[1] = true; interactiveSession = true; break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

package net.jradius.webservice;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Socket;
Expand Down Expand Up @@ -169,10 +172,12 @@ private void sendResponse(WebServiceRequest request, OutputStream out) throws IO
return;
}

writeResponse(out, request.getHttpVersion(), response.getHeaders(), response.getContent());
writeResponse(out, request.getHttpVersion(), response.getHeaders(),
response.getContent(), response.getSendFile());
}

private void writeResponse(OutputStream writer, String httpVersion, Map headers, byte[] payload) throws IOException
private void writeResponse(OutputStream writer, String httpVersion, Map headers,
byte[] payload, File sendFile) throws IOException
{
boolean wroteCT = false;
boolean wroteCL = false;
Expand Down Expand Up @@ -202,12 +207,27 @@ else if (headers.get("WWW-Authenticate") != null)
if (!wroteCT) writer.write(ctype);
if (!wroteCL)
{
long totalLength = payload == null ? 0 : payload.length;
totalLength += sendFile == null ? 0 : sendFile.length();
writer.write(clength);
writer.write(toHTTPBytes(Integer.toString(payload.length)));
writer.write(toHTTPBytes(Long.toString(totalLength)));
writer.write(newline);
}
writer.write(newline);
writer.write(payload);
if (payload != null)
writer.write(payload);
if (sendFile != null)
{
int len;
byte[] data = new byte[512];
InputStream in = new FileInputStream(sendFile);
do {
len = in.read(data);
if (len > 0)
writer.write(data, 0, len);
} while (len > 0);
in.close();
}
}

private void writeBadRequest(OutputStream writer, String httpVersion) throws IOException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package net.jradius.webservice;

import java.io.File;
import java.util.LinkedHashMap;
import java.util.Map;

Expand All @@ -31,6 +32,7 @@
public class WebServiceResponse extends JRadiusEvent
{
private static final long serialVersionUID = 0L;
private File sendFile;
private byte[] content;
private int type;

Expand Down Expand Up @@ -76,4 +78,12 @@ public Map<String, String> getHeaders()
{
return this.headers;
}

public void setSendFile(File file) {
sendFile = file;
}

public File getSendFile() {
return sendFile;
}
}
4 changes: 4 additions & 0 deletions freeradius/dict/dictionary.chillispot
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ VALUE ChilliSpot-Session-State TotalDataLimitReached 16
VALUE ChilliSpot-Session-State LocationChanged 17

ATTRIBUTE ChilliSpot-Session-Id 16 string
ATTRIBUTE ChilliSpot-AP-Session-Id 17 string
ATTRIBUTE ChilliSpot-User-Agent 18 string
ATTRIBUTE ChilliSpot-Accept-Language 19 string

ATTRIBUTE ChilliSpot-Max-Input-Gigawords 21 integer
ATTRIBUTE ChilliSpot-Max-Output-Gigawords 22 integer
Expand All @@ -50,6 +53,7 @@ ATTRIBUTE ChilliSpot-Max-Total-Gigawords 23 integer
ATTRIBUTE ChilliSpot-VLAN-Id 24 integer
ATTRIBUTE ChilliSpot-Location 25 string
ATTRIBUTE ChilliSpot-Old-Location 26 string
ATTRIBUTE ChilliSpot-Location-Change-Count 27 integer

ATTRIBUTE ChilliSpot-Sys-Uptime 40 integer
ATTRIBUTE ChilliSpot-Sys-LoadAvg 41 string
Expand Down

0 comments on commit 0181e76

Please sign in to comment.