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