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
32 private static boolean DEFAULT_REUSE_ADDRESS = false;
33
34
35 private static int DEFAULT_RECEIVE_BUFFER_SIZE = -1;
36
37
38 private static int DEFAULT_SEND_BUFFER_SIZE = -1;
39
40 private static int DEFAULT_TRAFFIC_CLASS = 0;
41
42 private boolean broadcast = DEFAULT_BROADCAST;
43
44 private boolean reuseAddress = DEFAULT_REUSE_ADDRESS;
45
46 private int receiveBufferSize = DEFAULT_RECEIVE_BUFFER_SIZE;
47
48 private int sendBufferSize = DEFAULT_SEND_BUFFER_SIZE;
49
50 private int trafficClass = DEFAULT_TRAFFIC_CLASS;
51
52
53
54
55 public DefaultDatagramSessionConfig() {
56
57 }
58
59
60
61
62 public boolean isBroadcast() {
63 return broadcast;
64 }
65
66
67
68
69 public void setBroadcast(boolean broadcast) {
70 this.broadcast = broadcast;
71 }
72
73
74
75
76 public boolean isReuseAddress() {
77 return reuseAddress;
78 }
79
80
81
82
83 public void setReuseAddress(boolean reuseAddress) {
84 this.reuseAddress = reuseAddress;
85 }
86
87
88
89
90 public int getReceiveBufferSize() {
91 return receiveBufferSize;
92 }
93
94
95
96
97 public void setReceiveBufferSize(int receiveBufferSize) {
98 this.receiveBufferSize = receiveBufferSize;
99 }
100
101
102
103
104 public int getSendBufferSize() {
105 return sendBufferSize;
106 }
107
108
109
110
111 public void setSendBufferSize(int sendBufferSize) {
112 this.sendBufferSize = sendBufferSize;
113 }
114
115
116
117
118 public int getTrafficClass() {
119 return trafficClass;
120 }
121
122
123
124
125 public void setTrafficClass(int trafficClass) {
126 this.trafficClass = trafficClass;
127 }
128
129 @Override
130 protected boolean isBroadcastChanged() {
131 return broadcast != DEFAULT_BROADCAST;
132 }
133
134 @Override
135 protected boolean isReceiveBufferSizeChanged() {
136 return receiveBufferSize != DEFAULT_RECEIVE_BUFFER_SIZE;
137 }
138
139 @Override
140 protected boolean isReuseAddressChanged() {
141 return reuseAddress != DEFAULT_REUSE_ADDRESS;
142 }
143
144 @Override
145 protected boolean isSendBufferSizeChanged() {
146 return sendBufferSize != DEFAULT_SEND_BUFFER_SIZE;
147 }
148
149 @Override
150 protected boolean isTrafficClassChanged() {
151 return trafficClass != DEFAULT_TRAFFIC_CLASS;
152 }
153
154 }