1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.transport.socket;
21
22 import java.net.DatagramSocket;
23
24
25
26
27
28
29 public class DefaultDatagramSessionConfig extends AbstractDatagramSessionConfig {
30 private static boolean DEFAULT_BROADCAST = false;
31 private static boolean DEFAULT_REUSE_ADDRESS = false;
32 private static int DEFAULT_RECEIVE_BUFFER_SIZE = 1024;
33 private static int DEFAULT_SEND_BUFFER_SIZE = 1024;
34 private static int DEFAULT_TRAFFIC_CLASS = 0;
35
36 private boolean broadcast = DEFAULT_BROADCAST;
37 private boolean reuseAddress = DEFAULT_REUSE_ADDRESS;
38 private int receiveBufferSize = DEFAULT_RECEIVE_BUFFER_SIZE;
39 private int sendBufferSize = DEFAULT_SEND_BUFFER_SIZE;
40 private int trafficClass = DEFAULT_TRAFFIC_CLASS;
41
42
43
44
45 public DefaultDatagramSessionConfig() {
46
47 }
48
49
50
51
52 public boolean isBroadcast() {
53 return broadcast;
54 }
55
56
57
58
59 public void setBroadcast(boolean broadcast) {
60 this.broadcast = broadcast;
61 }
62
63
64
65
66 public boolean isReuseAddress() {
67 return reuseAddress;
68 }
69
70
71
72
73 public void setReuseAddress(boolean reuseAddress) {
74 this.reuseAddress = reuseAddress;
75 }
76
77
78
79
80 public int getReceiveBufferSize() {
81 return receiveBufferSize;
82 }
83
84
85
86
87 public void setReceiveBufferSize(int receiveBufferSize) {
88 this.receiveBufferSize = receiveBufferSize;
89 }
90
91
92
93
94 public int getSendBufferSize() {
95 return sendBufferSize;
96 }
97
98
99
100
101 public void setSendBufferSize(int sendBufferSize) {
102 this.sendBufferSize = sendBufferSize;
103 }
104
105
106
107
108 public int getTrafficClass() {
109 return trafficClass;
110 }
111
112
113
114
115 public void setTrafficClass(int trafficClass) {
116 this.trafficClass = trafficClass;
117 }
118
119 @Override
120 protected boolean isBroadcastChanged() {
121 return broadcast != DEFAULT_BROADCAST;
122 }
123
124 @Override
125 protected boolean isReceiveBufferSizeChanged() {
126 return receiveBufferSize != DEFAULT_RECEIVE_BUFFER_SIZE;
127 }
128
129 @Override
130 protected boolean isReuseAddressChanged() {
131 return reuseAddress != DEFAULT_REUSE_ADDRESS;
132 }
133
134 @Override
135 protected boolean isSendBufferSizeChanged() {
136 return sendBufferSize != DEFAULT_SEND_BUFFER_SIZE;
137 }
138
139 @Override
140 protected boolean isTrafficClassChanged() {
141 return trafficClass != DEFAULT_TRAFFIC_CLASS;
142 }
143
144 }